'use strict'; /** * @license Angular * (c) 2010-2025 Google LLC. https://angular.dev/ * License: MIT */(function(g,f){if(typeof define=="function"&&define.amd){define(f)}else if(typeof exports=="object" && typeof module<"u"){module.exports=f()}else{var m=f();for(var i in m) g[i]=m[i]}}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this,function(){var exports={};var __exports=exports;var module={exports}; "use strict";var q=exports&&exports.__generator||function(v,T){var h={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},m,p,a,k=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return k.next=P(0),k.throw=P(1),k.return=P(2),typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function P(o){return function(w){return F([o,w])}}function F(o){if(m)throw new TypeError("Generator is already executing.");for(;k&&(k=0,o[0]&&(h=0)),h;)try{if(m=1,p&&(a=o[0]&2?p.return:o[0]?p.throw||((a=p.return)&&a.call(p),0):p.next)&&!(a=a.call(p,o[1])).done)return a;switch(p=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return h.label++,{value:o[1],done:!1};case 5:h.label++,p=o[1],o=[0];continue;case 7:o=h.ops.pop(),h.trys.pop();continue;default:if(a=h.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){h=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]0;){this._currentTickRequeuePeriodicEntries=[];var f=u[0];if(n=0&&this._schedulerQueue.splice(y,1)}s=this._currentTickTime,this._currentTickTime=c.endTime,r&&r(this._currentTickTime-s);var A=c.func.apply(l,c.isRequestAnimationFrame?[this._currentTickTime]:c.args);if(!A)break;i.processNewMacroTasksSynchronously||this._currentTickRequeuePeriodicEntries.forEach(function(S){for(var M=0;M0;){if(s++,s>e)throw new Error("flush failed after reaching the limit of "+e+" tasks. Does your code use a polling timeout?");if(this._schedulerQueue.filter(function(c){return!c.isPeriodic&&!c.isRequestAnimationFrame}).length===0)break;var u=this._schedulerQueue.shift();n=this._currentTickTime,this._currentTickTime=u.endTime,r&&r(this._currentTickTime-n);var f=u.func.apply(l,u.args);if(!f)break}return this._currentTickTime-i},t}();o(D,"nextNodeJSId",1),o(D,"nextId",-1);var I=D,B=function(){function t(e,r,i){r===void 0&&(r=!1),o(this,"trackPendingRequestAnimationFrame"),o(this,"macroTaskOptions"),o(this,"_scheduler",new I),o(this,"_microtasks",[]),o(this,"_lastError",null),o(this,"_uncaughtPromiseErrors",Promise[Zone.__symbol__("uncaughtPromiseErrors")]),o(this,"pendingPeriodicTimers",[]),o(this,"pendingTimers",[]),o(this,"patchDateLocked",!1),o(this,"tickMode",{counter:0,mode:"manual"}),o(this,"name"),o(this,"properties",{FakeAsyncTestZoneSpec:this}),this.trackPendingRequestAnimationFrame=r,this.macroTaskOptions=i,this.name="fakeAsyncTestZone for "+e,this.macroTaskOptions||(this.macroTaskOptions=l[Zone.__symbol__("FakeAsyncTestMacroTask")])}return t.assertInZone=function(){if(Zone.current.get("FakeAsyncTestZoneSpec")==null)throw new Error("The code should be running in the fakeAsync zone to call this function")},t.prototype._fnAndFlush=function(e,r){var i=this;return function(){for(var n=[],s=0;s-1&&e.splice(i,1)},t.prototype._dequeueTimer=function(e){var r=this;return function(){t._removeTimer(r.pendingTimers,e)}},t.prototype._requeuePeriodicTimer=function(e,r,i,n){var s=this;return function(){s.pendingPeriodicTimers.indexOf(n)!==-1&&s._scheduler.scheduleFunction(e,r,{args:i,isPeriodic:!0,id:n,isRequeuePeriodic:!0})}},t.prototype._dequeuePeriodicTimer=function(e){var r=this;return function(){t._removeTimer(r.pendingPeriodicTimers,e)}},t.prototype._setTimeout=function(e,r,i,n){n===void 0&&(n=!0);var s=this._dequeueTimer(I.nextId),u=this._fnAndFlush(e,{onSuccess:s,onError:s}),f=this._scheduler.scheduleFunction(u,r,{args:i,isRequestAnimationFrame:!n});return n&&this.pendingTimers.push(f),f},t.prototype._clearTimeout=function(e){t._removeTimer(this.pendingTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},t.prototype._setInterval=function(e,r,i){var n=I.nextId,s={onSuccess:null,onError:this._dequeuePeriodicTimer(n)},u=this._fnAndFlush(e,s);return s.onSuccess=this._requeuePeriodicTimer(u,r,i,n),this._scheduler.scheduleFunction(u,r,{args:i,isPeriodic:!0}),this.pendingPeriodicTimers.push(n),n},t.prototype._clearInterval=function(e){t._removeTimer(this.pendingPeriodicTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},t.prototype._resetLastErrorAndThrow=function(){var e=this._lastError||this._uncaughtPromiseErrors[0];throw this._uncaughtPromiseErrors.length=0,this._lastError=null,e},t.prototype.getCurrentTickTime=function(){return this._scheduler.getCurrentTickTime()},t.prototype.getFakeSystemTime=function(){return this._scheduler.getFakeSystemTime()},t.prototype.setFakeBaseSystemTime=function(e){this._scheduler.setFakeBaseSystemTime(e)},t.prototype.getRealSystemTime=function(){return this._scheduler.getRealSystemTime()},t.patchDate=function(){l[Zone.__symbol__("disableDatePatching")]||l.Date!==b&&(l.Date=b,b.prototype=_.prototype,t.checkTimerPatch())},t.resetDate=function(){l.Date===b&&(l.Date=_)},t.checkTimerPatch=function(){if(!g)throw new Error("Expected timers to have been patched.");l.setTimeout!==g.setTimeout&&(l.setTimeout=g.setTimeout,l.clearTimeout=g.clearTimeout),l.setInterval!==g.setInterval&&(l.setInterval=g.setInterval,l.clearInterval=g.clearInterval)},t.prototype.lockDatePatch=function(){this.patchDateLocked=!0,t.patchDate()},t.prototype.unlockDatePatch=function(){this.patchDateLocked=!1,t.resetDate()},t.prototype.setTickMode=function(e,r){e!==this.tickMode.mode&&(this.tickMode.counter++,this.tickMode.mode=e,e==="automatic"&&this.advanceUntilModeChanges(r))},t.prototype.advanceUntilModeChanges=function(e){var r=this;t.assertInZone();var i=Zone.current,n=this.tickMode.counter;Zone.root.run(function(){return w(r,null,function(){var s=this;return q(this,function(u){switch(u.label){case 0:return[4,R(function(){return w(s,null,function(){var f=this;return q(this,function(c){switch(c.label){case 0:return[4,void 0];case 1:return c.sent(),i.run(function(){f.flushMicrotasks()}),[2]}})})})];case 1:if(u.sent(),this.tickMode.counter!==n)return[2];u.label=2;case 2:return[4,R(function(){return s.newMacrotask(i)})];case 3:return u.sent(),this.tickMode.counter!==n?[2]:[4,R(function(){return i.run(function(){s._scheduler.executeNextTask(e)})})];case 4:return u.sent(),[3,2];case 5:return[2]}})})})},t.prototype.newMacrotask=function(e){return w(this,null,function(){var r,i=this;return q(this,function(n){switch(n.label){case 0:return Q?[4,new Promise(function(s){Q(s)})]:[3,2];case 1:return n.sent(),[3,5];case 2:return r=new MessageChannel,[4,new Promise(function(s){r.port1.onmessage=s,r.port2.postMessage(void 0)})];case 3:return n.sent(),r.port1.close(),r.port2.close(),[4,new Promise(function(s){C(s)})];case 4:n.sent(),n.label=5;case 5:return e.run(function(){i.flushMicrotasks()}),[2]}})})},t.prototype.tickToNext=function(e,r,i){e===void 0&&(e=1),i===void 0&&(i={processNewMacroTasksSynchronously:!0}),!(e<=0)&&(t.assertInZone(),this.flushMicrotasks(),this._scheduler.tickToNext(e,r,i),this._lastError!==null&&this._resetLastErrorAndThrow())},t.prototype.tick=function(e,r,i){e===void 0&&(e=0),i===void 0&&(i={processNewMacroTasksSynchronously:!0}),t.assertInZone(),this.flushMicrotasks(),this._scheduler.tick(e,r,i),this._lastError!==null&&this._resetLastErrorAndThrow()},t.prototype.flushMicrotasks=function(){var e=this;t.assertInZone();for(var r=function(){(e._lastError!==null||e._uncaughtPromiseErrors.length)&&e._resetLastErrorAndThrow()};this._microtasks.length>0;){var i=this._microtasks.shift();i.func.apply(i.target,i.args)}r()},t.prototype.flush=function(e,r,i){t.assertInZone(),this.flushMicrotasks();var n=this._scheduler.flush(e,r,i);return this._lastError!==null&&this._resetLastErrorAndThrow(),n},t.prototype.flushOnlyPendingTimers=function(e){t.assertInZone(),this.flushMicrotasks();var r=this._scheduler.flushOnlyPendingTimers(e);return this._lastError!==null&&this._resetLastErrorAndThrow(),r},t.prototype.removeAllTimers=function(){t.assertInZone(),this._scheduler.removeAll(),this.pendingPeriodicTimers=[],this.pendingTimers=[]},t.prototype.getTimerCount=function(){return this._scheduler.getTimerCount()+this._microtasks.length},t.prototype.onScheduleTask=function(e,r,i,n){switch(n.type){case"microTask":var s=n.data&&n.data.args,u=void 0;if(s){var f=n.data.cbIdx;typeof s.length=="number"&&s.length>f+1&&(u=Array.prototype.slice.call(s,f+1))}this._microtasks.push({func:n.invoke,args:u,target:n.data&&n.data.target});break;case"macroTask":switch(n.source){case"setTimeout":n.data.handleId=this._setTimeout(n.invoke,n.data.delay,Array.prototype.slice.call(n.data.args,2));break;case"setImmediate":n.data.handleId=this._setTimeout(n.invoke,0,Array.prototype.slice.call(n.data.args,1));break;case"setInterval":n.data.handleId=this._setInterval(n.invoke,n.data.delay,Array.prototype.slice.call(n.data.args,2));break;case"XMLHttpRequest.send":if(this.tickMode.mode==="manual")throw new Error("Cannot make XHRs from within a fake async test. Request URL: "+n.data.url);n=e.scheduleTask(i,n);break;case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":n.data.handleId=this._setTimeout(n.invoke,16,n.data.args,this.trackPendingRequestAnimationFrame);break;default:var c=this.findMacroTaskOption(n);if(c){var y=n.data&&n.data.args,A=y&&y.length>1?y[1]:0,S=c.callbackArgs?c.callbackArgs:y;c.isPeriodic?(n.data.handleId=this._setInterval(n.invoke,A,S),n.data.isPeriodic=!0):n.data.handleId=this._setTimeout(n.invoke,A,S);break}throw new Error("Unknown macroTask scheduled in fake async test: "+n.source)}break;case"eventTask":n=e.scheduleTask(i,n);break}return n},t.prototype.onCancelTask=function(e,r,i,n){switch(n.source){case"setTimeout":case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":return this._clearTimeout(n.data.handleId);case"setInterval":return this._clearInterval(n.data.handleId);default:var s=this.findMacroTaskOption(n);if(s){var u=n.data.handleId;return s.isPeriodic?this._clearInterval(u):this._clearTimeout(u)}return e.cancelTask(i,n)}},t.prototype.onInvoke=function(e,r,i,n,s,u,f){try{return t.patchDate(),e.invoke(i,n,s,u,f)}finally{this.patchDateLocked||t.resetDate()}},t.prototype.findMacroTaskOption=function(e){if(!this.macroTaskOptions)return null;for(var r=0;r0)throw new Error("".concat(d.pendingPeriodicTimers.length," periodic timer(s) still in the queue."));if(d.pendingTimers.length>0)throw new Error("".concat(d.pendingTimers.length," timer(s) still in the queue."))}return A}finally{O()}};return n.isFakeAsync=!0,n}function x(){if(d==null&&(d=Zone.current.get("FakeAsyncTestZoneSpec"),d==null))throw new Error("The code should be running in the fakeAsync zone to call this function");return d}function H(t,e){t===void 0&&(t=0),e===void 0&&(e=!1),x().tick(t,null,e)}function W(t){return x().flush(t)}function J(){var t=x(),e=t.pendingPeriodicTimers;t.pendingPeriodicTimers.length=0}function X(t){var e=function(){for(var r=[],i=0;i