"use strict";var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n * (c) 2010-2022 Google LLC. https://angular.io/ * License: MIT */ !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){var e="\n",t={},n="__creationTrace__",r="STACKTRACE TRACKING",i="__SEP_TAG__",s=i+"@[native]",o=function o(){this.error=h(),this.timestamp=new Date};function a(){return new Error(r)}function c(){try{throw a()}catch(e){return e}}var u=a(),l=c(),h=u.stack?a:l.stack?c:a;function p(t){return t.stack?t.stack.split(e):[]}function f(e,n){for(var r=p(n),i=0;i0}function m(e,t){t>0&&(e.push(p((new o).error)),m(e,t-1))}Zone.longStackTraceZoneSpec={name:"long-stack-trace",longStackTraceLimit:10,getLongStackTrace:function(e){if(e){var t=e[Zone.__symbol__("currentTaskTrace")];return t?d(t,e.stack):e.stack}},onScheduleTask:function(e,t,r,i){if(y()){var s=Zone.currentTask,a=s&&s.data&&s.data[n]||[];(a=[new o].concat(a)).length>this.longStackTraceLimit&&(a.length=this.longStackTraceLimit),i.data||(i.data={}),"eventTask"===i.type&&(i.data=__assign({},i.data)),i.data[n]=a}return e.scheduleTask(r,i)},onHandleError:function(e,t,r,i){if(y()){var s=Zone.currentTask||i.task;if(i instanceof Error&&s){var o=d(s.data&&s.data[n],i.stack);try{i.stack=i.longStack=o}catch(e){}}}return e.handleError(r,i)}},function T(){if(y()){var e=[];m(e,2);for(var n=e[0],o=e[1],a=0;a0?arguments[0]:new Date;return e.setFakeBaseSystemTime.apply(e,n&&"function"==typeof n.getTime?[n.getTime()]:arguments)}return r.apply(this,arguments)},c&&["install","uninstall"].forEach((function(n){var r=e[o(n)]=e[n];e[n]=function(){if(!t.FakeAsyncTestZoneSpec)return r.apply(this,arguments);jasmine[o("clockInstalled")]="install"===n}}))}return e}}if(!jasmine[t.__symbol__("createSpyObj")]){var p=jasmine.createSpyObj;jasmine[t.__symbol__("createSpyObj")]=p,jasmine.createSpyObj=function(){var e,t=Array.prototype.slice.call(arguments);if(t.length>=3&&t[2]){var n=Object.defineProperty;Object.defineProperty=function(e,t,r){return n.call(this,e,t,__assign(__assign({},r),{configurable:!0,enumerable:!0}))};try{e=p.apply(this,t)}finally{Object.defineProperty=n}}else e=p.apply(this,t);return e}}var f=jasmine.QueueRunner;jasmine.QueueRunner=function(n){function r(r){var i,o=this;r.onComplete&&(r.onComplete=(i=r.onComplete,function(){o.testProxyZone=null,o.testProxyZoneSpec=null,s.scheduleMicroTask("jasmine.onComplete",i)}));var a=e[t.__symbol__("setTimeout")],c=e[t.__symbol__("clearTimeout")];a&&(r.timeout={setTimeout:a||e.setTimeout,clearTimeout:c||e.clearTimeout}),jasmine.UserContext?(r.userContext||(r.userContext=new jasmine.UserContext),r.userContext.queueRunner=this):(r.userContext||(r.userContext={}),r.userContext.queueRunner=this);var u=r.onException;r.onException=function(e){if(e&&"Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL."===e.message){var t=this&&this.testProxyZoneSpec;if(t){var n=t.getAndClearPendingTasksInfo();try{e.message+=n}catch(e){}}}u&&u.call(this,e)},n.call(this,r)}return function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);function r(){this.constructor=e}e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(r,n),r.prototype.execute=function(){for(var e=this,r=t.current,o=!1;r;){if(r===s){o=!0;break}r=r.parent}if(!o)throw new Error("Unexpected Zone: "+t.current.name);this.testProxyZoneSpec=new i,this.testProxyZone=s.fork(this.testProxyZoneSpec),t.currentTask?n.prototype.execute.call(this):t.current.scheduleMicroTask("jasmine.execute().forceTask",(function(){return f.prototype.execute.call(e)}))},r}(f)}function d(e,n,r,i){var s=!!jasmine[o("clockInstalled")],a=r.testProxyZone;if(s&&c){var u=t[t.__symbol__("fakeAsyncTest")];u&&"function"==typeof u.fakeAsync&&(e=u.fakeAsync(e))}return i?a.run(e,n,[i]):a.run(e,n)}function y(e){return e&&(e.length?function(t){return d(e,this,this.queueRunner,t)}:function(){return d(e,this,this.queueRunner)})}})),Zone.__load_patch("jest",(function(e,t,n){if("undefined"!=typeof jest&&!jest.__zone_patch__){t[n.symbol("ignoreConsoleErrorUncaughtError")]=!0,jest.__zone_patch__=!0;var r=t.ProxyZoneSpec,i=t.SyncTestZoneSpec;if(!r)throw new Error("Missing ProxyZoneSpec");var s=t.current,o=s.fork(new i("jest.describe")),a=new r,c=s.fork(a);["describe","xdescribe","fdescribe"].forEach((function(n){var r=e[n];e[t.__symbol__(n)]||(e[t.__symbol__(n)]=r,e[n]=function(){for(var e=[],t=0;t0},e.prototype._finishCallbackIfDone=function(){var e=this;null!==this._existingFinishTimer&&(clearTimeout(this._existingFinishTimer),this._existingFinishTimer=null),this._pendingMicroTasks||this._pendingMacroTasks||this.supportWaitUnresolvedChainedPromise&&this.isUnresolvedChainedPromisePending()||this.runZone.run((function(){e._existingFinishTimer=setTimeout((function(){e._alreadyErrored||e._pendingMicroTasks||e._pendingMacroTasks||e.finishCallback()}),0)}))},e.prototype.patchPromiseForTest=function(){if(this.supportWaitUnresolvedChainedPromise){var e=Promise[Zone.__symbol__("patchPromiseForTest")];e&&e()}},e.prototype.unPatchPromiseForTest=function(){if(this.supportWaitUnresolvedChainedPromise){var e=Promise[Zone.__symbol__("unPatchPromiseForTest")];e&&e()}},e.prototype.onScheduleTask=function(e,t,n,r){return"eventTask"!==r.type&&(this._isSync=!1),"microTask"===r.type&&r.data&&r.data instanceof Promise&&!0===r.data[g.symbolParentUnresolved]&&this.unresolvedChainedPromiseCount--,e.scheduleTask(n,r)},e.prototype.onInvokeTask=function(e,t,n,r,i,s){return"eventTask"!==r.type&&(this._isSync=!1),e.invokeTask(n,r,i,s)},e.prototype.onCancelTask=function(e,t,n,r){return"eventTask"!==r.type&&(this._isSync=!1),e.cancelTask(n,r)},e.prototype.onInvoke=function(e,t,n,r,i,s,o){this.entryFunction||(this.entryFunction=r);try{return this._isSync=!0,e.invoke(n,r,i,s,o)}finally{this._isSync&&this.entryFunction===r&&this._finishCallbackIfDone()}},e.prototype.onHandleError=function(e,t,n,r){return e.handleError(n,r)&&(this.failCallback(r),this._alreadyErrored=!0),!1},e.prototype.onHasTask=function(e,t,n,r){e.hasTask(n,r),t===n&&("microTask"==r.change?(this._pendingMicroTasks=r.microTask,this._finishCallbackIfDone()):"macroTask"==r.change&&(this._pendingMacroTasks=r.macroTask,this._finishCallbackIfDone()))},e}(),(g=v).symbolParentUnresolved=Zone.__symbol__("parentUnresolved"),Zone.AsyncTestZoneSpec=v,Zone.__load_patch("asynctest",(function(e,t,n){function r(e,n,r,i){var s=t.current,o=t.AsyncTestZoneSpec;if(void 0===o)throw new Error("AsyncTestZoneSpec is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/plugins/async-test");var a=t.ProxyZoneSpec;if(!a)throw new Error("ProxyZoneSpec is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/plugins/proxy");var c=a.get();a.assertPresent();var u=t.current.getZoneWith("ProxyZoneSpec"),l=c.getDelegate();return u.parent.run((function(){var e=new o((function(){c.getDelegate()==e&&c.setDelegate(l),e.unPatchPromiseForTest(),s.run((function(){r()}))}),(function(t){c.getDelegate()==e&&c.setDelegate(l),e.unPatchPromiseForTest(),s.run((function(){i(t)}))}),"test");c.setDelegate(e),e.patchPromiseForTest()})),t.current.runGuarded(e,n)}t[n.symbol("asyncTest")]=function t(n){return e.jasmine?function(e){e||((e=function(){}).fail=function(e){throw e}),r(n,this,e,(function(t){if("string"==typeof t)return e.fail(new Error(t));e.fail(t)}))}:function(){var e=this;return new Promise((function(t,i){r(n,e,t,i)}))}}})),function(e){var t,n=e.Date;function r(){if(0===arguments.length){var e=new n;return e.setTime(r.now()),e}var t=Array.prototype.slice.call(arguments);return new(n.bind.apply(n,__spreadArray([void 0],t,!1)))}r.now=function(){var e=Zone.current.get("FakeAsyncTestZoneSpec");return e?e.getFakeSystemTime():n.now.apply(this,arguments)},r.UTC=n.UTC,r.parse=n.parse;var i={setTimeout:e.setTimeout,setInterval:e.setInterval,clearTimeout:e.clearTimeout,clearInterval:e.clearInterval},s=function(){function r(){this._schedulerQueue=[],this._currentTickTime=0,this._currentFakeBaseSystemTime=n.now(),this._currentTickRequeuePeriodicEntries=[]}return r.prototype.getCurrentTickTime=function(){return this._currentTickTime},r.prototype.getFakeSystemTime=function(){return this._currentFakeBaseSystemTime+this._currentTickTime},r.prototype.setFakeBaseSystemTime=function(e){this._currentFakeBaseSystemTime=e},r.prototype.getRealSystemTime=function(){return n.now()},r.prototype.scheduleFunction=function(e,n,r){var i=(r=__assign({args:[],isPeriodic:!1,isRequestAnimationFrame:!1,id:-1,isRequeuePeriodic:!1},r)).id<0?t.nextId++:r.id,s={endTime:this._currentTickTime+n,id:i,func:e,args:r.args,delay:n,isPeriodic:r.isPeriodic,isRequestAnimationFrame:r.isRequestAnimationFrame};r.isRequeuePeriodic&&this._currentTickRequeuePeriodicEntries.push(s);for(var o=0;o0&&(this._currentTickRequeuePeriodicEntries=[],!(i=0&&this._schedulerQueue.splice(c,1)}if(s=this._currentTickTime,this._currentTickTime=a.endTime,n&&n(this._currentTickTime-s),!a.func.apply(e,a.isRequestAnimationFrame?[this._currentTickTime]:a.args))break;r.processNewMacroTasksSynchronously||this._currentTickRequeuePeriodicEntries.forEach((function(e){for(var t=0;t0;){if(++s>t)throw new Error("flush failed after reaching the limit of "+t+" tasks. Does your code use a polling timeout?");if(0===this._schedulerQueue.filter((function(e){return!e.isPeriodic&&!e.isRequestAnimationFrame})).length)break;var o=this._schedulerQueue.shift();if(i=this._currentTickTime,this._currentTickTime=o.endTime,n&&n(this._currentTickTime-i),!o.func.apply(e,o.args))break}return this._currentTickTime-r},r}();(t=s).nextId=1;var o=function(){function t(t,n,r){void 0===n&&(n=!1),this.trackPendingRequestAnimationFrame=n,this.macroTaskOptions=r,this._scheduler=new s,this._microtasks=[],this._lastError=null,this._uncaughtPromiseErrors=Promise[Zone.__symbol__("uncaughtPromiseErrors")],this.pendingPeriodicTimers=[],this.pendingTimers=[],this.patchDateLocked=!1,this.properties={FakeAsyncTestZoneSpec:this},this.name="fakeAsyncTestZone for "+t,this.macroTaskOptions||(this.macroTaskOptions=e[Zone.__symbol__("FakeAsyncTestMacroTask")])}return t.assertInZone=function(){if(null==Zone.current.get("FakeAsyncTestZoneSpec"))throw new Error("The code should be running in the fakeAsync zone to call this function")},t.prototype._fnAndFlush=function(t,n){var r=this;return function(){for(var i=[],s=0;s-1&&e.splice(n,1)},t.prototype._dequeueTimer=function(e){var n=this;return function(){t._removeTimer(n.pendingTimers,e)}},t.prototype._requeuePeriodicTimer=function(e,t,n,r){var i=this;return function(){-1!==i.pendingPeriodicTimers.indexOf(r)&&i._scheduler.scheduleFunction(e,t,{args:n,isPeriodic:!0,id:r,isRequeuePeriodic:!0})}},t.prototype._dequeuePeriodicTimer=function(e){var n=this;return function(){t._removeTimer(n.pendingPeriodicTimers,e)}},t.prototype._setTimeout=function(e,t,n,r){void 0===r&&(r=!0);var i=this._dequeueTimer(s.nextId),o=this._fnAndFlush(e,{onSuccess:i,onError:i}),a=this._scheduler.scheduleFunction(o,t,{args:n,isRequestAnimationFrame:!r});return r&&this.pendingTimers.push(a),a},t.prototype._clearTimeout=function(e){t._removeTimer(this.pendingTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},t.prototype._setInterval=function(e,t,n){var r=s.nextId,i={onSuccess:null,onError:this._dequeuePeriodicTimer(r)},o=this._fnAndFlush(e,i);return i.onSuccess=this._requeuePeriodicTimer(o,t,n,r),this._scheduler.scheduleFunction(o,t,{args:n,isPeriodic:!0}),this.pendingPeriodicTimers.push(r),r},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(){e[Zone.__symbol__("disableDatePatching")]||e.Date!==r&&(e.Date=r,r.prototype=n.prototype,t.checkTimerPatch())},t.resetDate=function(){e.Date===r&&(e.Date=n)},t.checkTimerPatch=function(){e.setTimeout!==i.setTimeout&&(e.setTimeout=i.setTimeout,e.clearTimeout=i.clearTimeout),e.setInterval!==i.setInterval&&(e.setInterval=i.setInterval,e.clearInterval=i.clearInterval)},t.prototype.lockDatePatch=function(){this.patchDateLocked=!0,t.patchDate()},t.prototype.unlockDatePatch=function(){this.patchDateLocked=!1,t.resetDate()},t.prototype.tickToNext=function(e,n,r){void 0===e&&(e=1),void 0===r&&(r={processNewMacroTasksSynchronously:!0}),e<=0||(t.assertInZone(),this.flushMicrotasks(),this._scheduler.tickToNext(e,n,r),null!==this._lastError&&this._resetLastErrorAndThrow())},t.prototype.tick=function(e,n,r){void 0===e&&(e=0),void 0===r&&(r={processNewMacroTasksSynchronously:!0}),t.assertInZone(),this.flushMicrotasks(),this._scheduler.tick(e,n,r),null!==this._lastError&&this._resetLastErrorAndThrow()},t.prototype.flushMicrotasks=function(){var e=this;for(t.assertInZone();this._microtasks.length>0;){var n=this._microtasks.shift();n.func.apply(n.target,n.args)}(null!==e._lastError||e._uncaughtPromiseErrors.length)&&e._resetLastErrorAndThrow()},t.prototype.flush=function(e,n,r){t.assertInZone(),this.flushMicrotasks();var i=this._scheduler.flush(e,n,r);return null!==this._lastError&&this._resetLastErrorAndThrow(),i},t.prototype.flushOnlyPendingTimers=function(e){t.assertInZone(),this.flushMicrotasks();var n=this._scheduler.flushOnlyPendingTimers(e);return null!==this._lastError&&this._resetLastErrorAndThrow(),n},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,t,n,r){switch(r.type){case"microTask":var i=r.data&&r.data.args,s=void 0;if(i){var o=r.data.cbIdx;"number"==typeof i.length&&i.length>o+1&&(s=Array.prototype.slice.call(i,o+1))}this._microtasks.push({func:r.invoke,args:s,target:r.data&&r.data.target});break;case"macroTask":switch(r.source){case"setTimeout":r.data.handleId=this._setTimeout(r.invoke,r.data.delay,Array.prototype.slice.call(r.data.args,2));break;case"setImmediate":r.data.handleId=this._setTimeout(r.invoke,0,Array.prototype.slice.call(r.data.args,1));break;case"setInterval":r.data.handleId=this._setInterval(r.invoke,r.data.delay,Array.prototype.slice.call(r.data.args,2));break;case"XMLHttpRequest.send":throw new Error("Cannot make XHRs from within a fake async test. Request URL: "+r.data.url);case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":r.data.handleId=this._setTimeout(r.invoke,16,r.data.args,this.trackPendingRequestAnimationFrame);break;default:var a=this.findMacroTaskOption(r);if(a){var c=r.data&&r.data.args,u=c&&c.length>1?c[1]:0,l=a.callbackArgs?a.callbackArgs:c;a.isPeriodic?(r.data.handleId=this._setInterval(r.invoke,u,l),r.data.isPeriodic=!0):r.data.handleId=this._setTimeout(r.invoke,u,l);break}throw new Error("Unknown macroTask scheduled in fake async test: "+r.source)}break;case"eventTask":r=e.scheduleTask(n,r)}return r},t.prototype.onCancelTask=function(e,t,n,r){switch(r.source){case"setTimeout":case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":return this._clearTimeout(r.data.handleId);case"setInterval":return this._clearInterval(r.data.handleId);default:var i=this.findMacroTaskOption(r);if(i){var s=r.data.handleId;return i.isPeriodic?this._clearInterval(s):this._clearTimeout(s)}return e.cancelTask(n,r)}},t.prototype.onInvoke=function(e,n,r,i,s,o,a){try{return t.patchDate(),e.invoke(r,i,s,o,a)}finally{this.patchDateLocked||t.resetDate()}},t.prototype.findMacroTaskOption=function(e){if(!this.macroTaskOptions)return null;for(var t=0;t0)throw new Error("".concat(s.pendingPeriodicTimers.length," ")+"periodic timer(s) still in the queue.");if(s.pendingTimers.length>0)throw new Error("".concat(s.pendingTimers.length," timer(s) still in the queue."));return h}finally{o()}};return n.isFakeAsync=!0,n}}}),!0),Zone.__load_patch("promisefortest",(function(e,t,n){var r=n.symbol("state"),i=n.symbol("parentUnresolved");Promise[n.symbol("patchPromiseForTest")]=function e(){var n=Promise[t.__symbol__("ZonePromiseThen")];n||(n=Promise[t.__symbol__("ZonePromiseThen")]=Promise.prototype.then,Promise.prototype.then=function(){var e=n.apply(this,arguments);if(null===this[r]){var s=t.current.get("AsyncTestZoneSpec");s&&(s.unresolvedChainedPromiseCount++,e[i]=!0)}return e})},Promise[n.symbol("unPatchPromiseForTest")]=function e(){var n=Promise[t.__symbol__("ZonePromiseThen")];n&&(Promise.prototype.then=n,Promise[t.__symbol__("ZonePromiseThen")]=void 0)}}))}));