"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t",this._properties=t&&t.properties||{},this._zoneDelegate=new l(this,this._parent&&this._parent._zoneDelegate,t)}return t.assertZonePatched=function(){if(e.Promise!==j.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")},Object.defineProperty(t,"root",{get:function(){for(var e=t.current;e.parent;)e=e.parent;return e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"current",{get:function(){return A.zone},enumerable:!1,configurable:!0}),Object.defineProperty(t,"currentTask",{get:function(){return I},enumerable:!1,configurable:!0}),t.__load_patch=function(o,i,a){if(void 0===a&&(a=!1),j.hasOwnProperty(o)){if(!a&&s)throw Error("Already loaded patch: "+o)}else if(!e["__Zone_disable_"+o]){var c="Zone:"+o;n(c),j[o]=i(e,t,C),r(c,c)}},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t.prototype.get=function(e){var t=this.getZoneWith(e);if(t)return t._properties[e]},t.prototype.getZoneWith=function(e){for(var t=this;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null},t.prototype.fork=function(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)},t.prototype.wrap=function(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);var n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}},t.prototype.run=function(e,t,n,r){A={parent:A,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{A=A.parent}},t.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),A={parent:A,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{A=A.parent}},t.prototype.runTask=function(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||v).name+"; Execution: "+this.name+")");if(e.state!==T||e.type!==D&&e.type!==Z){var r=e.state!=S;r&&e._transitionTo(S,b),e.runCount++;var o=I;I=e,A={parent:A,zone:this};try{e.type==Z&&e.data&&!e.data.isPeriodic&&(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{e.state!==T&&e.state!==w&&(e.type==D||e.data&&e.data.isPeriodic?r&&e._transitionTo(b,S):(e.runCount=0,this._updateTaskCount(e,-1),r&&e._transitionTo(T,S,T))),A=A.parent,I=o}}},t.prototype.scheduleTask=function(e){if(e.zone&&e.zone!==this)for(var t=this;t;){if(t===e.zone)throw Error("can not reschedule task to "+this.name+" which is descendants of the original zone "+e.zone.name);t=t.parent}e._transitionTo(g,T);var n=[];e._zoneDelegates=n,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(w,g,T),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===n&&this._updateTaskCount(e,1),e.state==g&&e._transitionTo(b,g),e},t.prototype.scheduleMicroTask=function(e,t,n,r){return this.scheduleTask(new h(E,e,t,n,r,void 0))},t.prototype.scheduleMacroTask=function(e,t,n,r,o){return this.scheduleTask(new h(Z,e,t,n,r,o))},t.prototype.scheduleEventTask=function(e,t,n,r,o){return this.scheduleTask(new h(D,e,t,n,r,o))},t.prototype.cancelTask=function(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||v).name+"; Execution: "+this.name+")");e._transitionTo(P,b,S);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(w,P),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(T,P),e.runCount=0,e},t.prototype._updateTaskCount=function(e,t){var n=e._zoneDelegates;-1==t&&(e._zoneDelegates=null);for(var r=0;r0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e})},e}(),h=function(){function t(n,r,o,i,s,a){if(this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=n,this.source=r,this.data=i,this.scheduleFn=s,this.cancelFn=a,!o)throw new Error("callback is not defined");this.callback=o;var c=this;this.invoke=n===D&&i&&i.useG?t.invokeTask:function(){return t.invokeTask.call(e,c,this,arguments)}}return t.invokeTask=function(e,t,n){e||(e=this),O++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==O&&m(),O--}},Object.defineProperty(t.prototype,"zone",{get:function(){return this._zone},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.cancelScheduleRequest=function(){this._transitionTo(T,g)},t.prototype._transitionTo=function(e,t,n){if(this._state!==t&&this._state!==n)throw new Error(this.type+" '"+this.source+"': can not transition to '"+e+"', expecting state '"+t+"'"+(n?" or '"+n+"'":"")+", was '"+this._state+"'.");this._state=e,e==T&&(this._zoneDelegates=null)},t.prototype.toString=function(){return this.data&&void 0!==this.data.handleId?this.data.handleId.toString():Object.prototype.toString.call(this)},t.prototype.toJSON=function(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}},t}(),f=i("setTimeout"),p=i("Promise"),d=i("then"),y=[],_=!1;function k(t){if(0===O&&0===y.length)if(c||e[p]&&(c=e[p].resolve(0)),c){var n=c[d];n||(n=c.then),n.call(c,m)}else e[f](m,0);t&&y.push(t)}function m(){if(!_){for(_=!0;y.length;){var e=y;y=[];for(var t=0;t=0;n--)"function"==typeof e[n]&&(e[n]=i(e[n],t+"_"+n));return e}var p="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,d=!("nw"in l)&&void 0!==l.process&&"[object process]"==={}.toString.call(l.process),y=!d&&!p&&!(!c||!u.HTMLElement),_=void 0!==l.process&&"[object process]"==={}.toString.call(l.process)&&!p&&!(!c||!u.HTMLElement),k={},m=function(e){if(e=e||l.event){var t=k[e.type];t||(t=k[e.type]=a("ON_PROPERTY"+e.type));var n,r=this||e.target||l,o=r[t];if(y&&r===u&&"error"===e.type){var i=e;!0===(n=o&&o.call(this,i.message,i.filename,i.lineno,i.colno,i.error))&&e.preventDefault()}else null==(n=o&&o.apply(this,arguments))||n||e.preventDefault();return n}};function v(n,r,o){var i=e(n,r);if(!i&&o&&e(o,r)&&(i={enumerable:!0,configurable:!0}),i&&i.configurable){var s=a("on"+r+"patched");if(!n.hasOwnProperty(s)||!n[s]){delete i.writable,delete i.value;var c=i.get,u=i.set,f=r.substr(2),p=k[f];p||(p=k[f]=a("ON_PROPERTY"+f)),i.set=function(e){var t=this;t||n!==l||(t=l),t&&(t[p]&&t.removeEventListener(f,m),u&&u.apply(t,h),"function"==typeof e?(t[p]=e,t.addEventListener(f,m,!1)):t[p]=null)},i.get=function(){var e=this;if(e||n!==l||(e=l),!e)return null;var t=e[p];if(t)return t;if(c){var o=c&&c.call(this);if(o)return i.set.call(this,o),"function"==typeof e.removeAttribute&&e.removeAttribute(r),o}return null},t(n,r,i),n[s]=!0}}}function T(e,t,n){if(t)for(var r=0;r=0&&"function"==typeof r[i.cbIdx]?s(i.name,r[i.cbIdx],i,o):e.apply(t,r)}}))}function P(e,t){e[a("OriginalDelegate")]=t} /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */Zone.__load_patch("ZoneAwarePromise",(function(e,t,n){var r=Object.getOwnPropertyDescriptor,o=Object.defineProperty,i=n.symbol,s=[],a=!0===e[i("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],c=i("Promise"),u=i("then");n.onUnhandledError=function(e){if(n.showUncaughtError()){var t=e&&e.rejection;t?console.error("Unhandled Promise rejection:",t instanceof Error?t.message:t,"; Zone:",e.zone.name,"; Task:",e.task&&e.task.source,"; Value:",t,t instanceof Error?t.stack:void 0):console.error(e)}},n.microtaskDrainDone=function(){for(var e=function(){var e=s.shift();try{e.zone.runGuarded((function(){if(e.throwOriginal)throw e.rejection;throw e}))}catch(e){!function r(e){n.onUnhandledError(e);try{var r=t[l];"function"==typeof r&&r.call(this,e)}catch(e){}}(e)}};s.length;)e()};var l=i("unhandledPromiseRejectionHandler");function h(e){return e&&e.then}function f(e){return e}function p(e){return Z.reject(e)}var d=i("state"),y=i("value"),_=i("finally"),k=i("parentPromiseValue"),m=i("parentPromiseState");function v(e,t){return function(n){try{g(e,t,n)}catch(t){g(e,!1,t)}}}var T=i("currentTaskTrace");function g(e,r,i){var c,u=(c=!1,function e(t){return function(){c||(c=!0,t.apply(null,arguments))}});if(e===i)throw new TypeError("Promise resolved with itself");if(null===e[d]){var l=null;try{"object"!=typeof i&&"function"!=typeof i||(l=i&&i.then)}catch(t){return u((function(){g(e,!1,t)}))(),e}if(!1!==r&&i instanceof Z&&i.hasOwnProperty(d)&&i.hasOwnProperty(y)&&null!==i[d])P(i),g(e,i[d],i[y]);else if(!1!==r&&"function"==typeof l)try{l.call(i,u(v(e,r)),u(v(e,!1)))}catch(t){u((function(){g(e,!1,t)}))()}else{e[d]=r;var h=e[y];if(e[y]=i,e[_]===_&&!0===r&&(e[d]=e[m],e[y]=e[k]),!1===r&&i instanceof Error){var f=t.currentTask&&t.currentTask.data&&t.currentTask.data.__creationTrace__;f&&o(i,T,{configurable:!0,enumerable:!1,writable:!0,value:f})}for(var p=0;p0?n.length-1:-1,target:e}}))}))})); /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var F=a("zoneTask");function x(e,t,n,r){var o=null,i=null;n+=r;var a={};function c(t){var n=t.data;return n.args[0]=function(){return t.invoke.apply(this,arguments)},n.handleId=o.apply(e,n.args),t}function u(t){return i.call(e,t.data.handleId)}o=b(e,t+=r,(function(n){return function(o,i){if("function"==typeof i[0]){var l={isPeriodic:"Interval"===r,delay:"Timeout"===r||"Interval"===r?i[1]||0:void 0,args:i},h=i[0];i[0]=function e(){try{return h.apply(this,arguments)}finally{l.isPeriodic||("number"==typeof l.handleId?delete a[l.handleId]:l.handleId&&(l.handleId[F]=null))}};var f=s(t,i[0],l,c,u);if(!f)return f;var p=f.data.handleId;return"number"==typeof p?a[p]=f:p&&(p[F]=f),p&&p.ref&&p.unref&&"function"==typeof p.ref&&"function"==typeof p.unref&&(f.ref=p.ref.bind(p),f.unref=p.unref.bind(p)),"number"==typeof p||p?p:f}return n.apply(e,i)}})),i=b(e,n,(function(t){return function(n,r){var o,i=r[0];"number"==typeof i?o=a[i]:(o=i&&i[F])||(o=i),o&&"string"==typeof o.type?"notScheduled"!==o.state&&(o.cancelFn&&o.data.isPeriodic||0===o.runCount)&&("number"==typeof i?delete a[i]:i&&(i[F]=null),o.zone.cancelTask(o)):t.apply(e,r)}}))} /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */var z="set";Zone.__load_patch("node_timers",(function(e,t){var n=!1;try{var r=require("timers");if(e.setTimeout!==r.setTimeout&&!_){var o=r.setTimeout;r.setTimeout=function(){return n=!0,o.apply(this,arguments)};var i=e.setTimeout((function(){}),100);clearTimeout(i),r.setTimeout=o}x(r,z,"clear","Timeout"),x(r,z,"clear","Interval"),x(r,z,"clear","Immediate")}catch(e){}_||(n?(e[t.__symbol__("setTimeout")]=e.setTimeout,e[t.__symbol__("setInterval")]=e.setInterval,e[t.__symbol__("setImmediate")]=e.setImmediate):(x(e,z,"clear","Timeout"),x(e,z,"clear","Interval"),x(e,z,"clear","Immediate")))})),Zone.__load_patch("nextTick",(function(){!function e(t,n,r){var o=null;function i(e){var t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},o.apply(t.target,t.args),e}o=b(t,n,(function(e){return function(t,n){var o=r(t,n);return o.cbIdx>=0&&"function"==typeof n[o.cbIdx]?Zone.current.scheduleMicroTask(o.name,n[o.cbIdx],o,i):e.apply(t,n)}}))}(process,"nextTick",(function(e,t){return{name:"process.nextTick",args:t,cbIdx:t.length>0&&"function"==typeof t[0]?0:-1,target:process}}))})),Zone.__load_patch("handleUnhandledPromiseRejection",(function(e,t,n){function r(e){return function(t){O(process,e).forEach((function(n){"unhandledRejection"===e?n.invoke(t.rejection,t.promise):"rejectionHandled"===e&&n.invoke(t.promise)}))}}t[n.symbol("unhandledPromiseRejectionHandler")]=r("unhandledRejection"),t[n.symbol("rejectionHandledHandler")]=r("rejectionHandled")})),Zone.__load_patch("crypto",(function(){var e;try{e=require("crypto")}catch(e){}e&&["randomBytes","pbkdf2"].forEach((function(t){S(e,t,(function(n,r){return{name:"crypto."+t,args:r,cbIdx:r.length>0&&"function"==typeof r[r.length-1]?r.length-1:-1,target:e}}))}))})),Zone.__load_patch("console",(function(e,t){["dir","log","info","error","warn","assert","debug","timeEnd","trace"].forEach((function(e){var n=console[t.__symbol__(e)]=console[e];n&&(console[e]=function(){var e=r.call(arguments);return t.current===t.root?n.apply(this,e):t.root.run(n,this,e)})}))})); /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var R={},M="__SEP_TAG__@[native]",N=function N(){this.error=Q(),this.timestamp=new Date};function L(){return new Error("STACKTRACE TRACKING")}function q(){try{throw L()}catch(e){return e}}var H=L(),U=q(),Q=H.stack?L:U.stack?q:L;function G(e){return e.stack?e.stack.split("\n"):[]}function W(e,t){for(var n=G(t),r=0;r0}Zone.longStackTraceZoneSpec={name:"long-stack-trace",longStackTraceLimit:10,getLongStackTrace:function(e){if(e){var t=e[Zone.__symbol__("currentTaskTrace")];return t?B(t,e.stack):e.stack}},onScheduleTask:function(e,t,n,r){if(K()){var o=Zone.currentTask,i=o&&o.data&&o.data.__creationTrace__||[];(i=[new N].concat(i)).length>this.longStackTraceLimit&&(i.length=this.longStackTraceLimit),r.data||(r.data={}),"eventTask"===r.type&&(r.data=Object.assign({},r.data)),r.data.__creationTrace__=i}return e.scheduleTask(n,r)},onHandleError:function(e,t,n,r){if(K()){var o=Zone.currentTask||r.task;if(r instanceof Error&&o){var i=B(o.data&&o.data.__creationTrace__,r.stack);try{r.stack=r.longStack=i}catch(e){}}}return e.handleError(n,r)}},function V(){if(K()){var e=[];!function e(t,n){n>0&&(t.push(G((new N).error)),e(t,n-1))}(e,2);for(var t=e[0],n=e[1],r=0;r0?arguments[0]:new Date;return e.setFakeBaseSystemTime.apply(e,n&&"function"==typeof n.getTime?[n.getTime()]:arguments)}return r.apply(this,arguments)},u&&["install","uninstall"].forEach((function(n){var r=e[a(n)]=e[n];e[n]=function(){var e=t.FakeAsyncTestZoneSpec;if(!e)return r.apply(this,arguments);jasmine[a("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),n=t.length>=3?t[2]:null;if(n){var r=Object.defineProperty;Object.defineProperty=function(e,t,n){return r.call(this,e,t,Object.assign(Object.assign({},n),{configurable:!0,enumerable:!0}))};try{e=p.apply(this,t)}finally{Object.defineProperty=r}}else e=p.apply(this,t);return e}}var d=jasmine.QueueRunner;jasmine.QueueRunner=function(n){function r(r){var o,s=this;r.onComplete&&(r.onComplete=(o=r.onComplete,function(){s.testProxyZone=null,s.testProxyZoneSpec=null,i.scheduleMicroTask("jasmine.onComplete",o)}));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,s=!1;r;){if(r===i){s=!0;break}r=r.parent}if(!s)throw new Error("Unexpected Zone: "+t.current.name);this.testProxyZoneSpec=new o,this.testProxyZone=i.fork(this.testProxyZoneSpec),t.currentTask?n.prototype.execute.call(this):t.current.scheduleMicroTask("jasmine.execute().forceTask",(function(){return d.prototype.execute.call(e)}))},r}(d)}function y(e,n,r,o){var i=!!jasmine[a("clockInstalled")],s=r.testProxyZone;if(i&&u){var c=t[t.__symbol__("fakeAsyncTest")];c&&"function"==typeof c.fakeAsync&&(e=c.fakeAsync(e))}return o?s.run(e,n,[o]):s.run(e,n)}function _(e){return e&&(e.length?function(t){return y(e,this,this.queueRunner,t)}:function(){return y(e,this,this.queueRunner)})}})), /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ Zone.__load_patch("jest",(function(e,t,n){if("undefined"!=typeof jest&&!jest.__zone_patch__){jest.__zone_patch__=!0;var r=t.ProxyZoneSpec,o=t.SyncTestZoneSpec;if(!r)throw new Error("Missing ProxyZoneSpec");var i=t.current,s=i.fork(new o("jest.describe")),a=new r,c=i.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},t.prototype._finishCallbackIfDone=function(){var e=this;this._pendingMicroTasks||this._pendingMacroTasks||this.supportWaitUnresolvedChainedPromise&&this.isUnresolvedChainedPromisePending()||this.runZone.run((function(){setTimeout((function(){e._alreadyErrored||e._pendingMicroTasks||e._pendingMacroTasks||e.finishCallback()}),0)}))},t.prototype.patchPromiseForTest=function(){if(this.supportWaitUnresolvedChainedPromise){var e=Promise[Zone.__symbol__("patchPromiseForTest")];e&&e()}},t.prototype.unPatchPromiseForTest=function(){if(this.supportWaitUnresolvedChainedPromise){var e=Promise[Zone.__symbol__("unPatchPromiseForTest")];e&&e()}},t.prototype.onScheduleTask=function(e,n,r,o){return"eventTask"!==o.type&&(this._isSync=!1),"microTask"===o.type&&o.data&&o.data instanceof Promise&&!0===o.data[t.symbolParentUnresolved]&&this.unresolvedChainedPromiseCount--,e.scheduleTask(r,o)},t.prototype.onInvokeTask=function(e,t,n,r,o,i){return"eventTask"!==r.type&&(this._isSync=!1),e.invokeTask(n,r,o,i)},t.prototype.onCancelTask=function(e,t,n,r){return"eventTask"!==r.type&&(this._isSync=!1),e.cancelTask(n,r)},t.prototype.onInvoke=function(e,t,n,r,o,i,s){try{return this._isSync=!0,e.invoke(n,r,o,i,s)}finally{this._isSync&&this._finishCallbackIfDone()}},t.prototype.onHandleError=function(e,t,n,r){return e.handleError(n,r)&&(this.failCallback(r),this._alreadyErrored=!0),!1},t.prototype.onHasTask=function(e,t,n,r){e.hasTask(n,r),"microTask"==r.change?(this._pendingMicroTasks=r.microTask,this._finishCallbackIfDone()):"macroTask"==r.change&&(this._pendingMacroTasks=r.macroTask,this._finishCallbackIfDone())},t}();t.symbolParentUnresolved=Zone.__symbol__("parentUnresolved"),Zone.AsyncTestZoneSpec=t}("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global),Zone.__load_patch("asynctest",(function(e,t,n){function r(e,n,r,o){var i=t.current,s=t.AsyncTestZoneSpec;if(void 0===s)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/dist/async-test.js");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/dist/proxy.js");var c=a.get();a.assertPresent();var u=t.current.getZoneWith("ProxyZoneSpec"),l=c.getDelegate();return u.parent.run((function(){var e=new s((function(){c.getDelegate()==e&&c.setDelegate(l),e.unPatchPromiseForTest(),i.run((function(){r()}))}),(function(t){c.getDelegate()==e&&c.setDelegate(l),e.unPatchPromiseForTest(),i.run((function(){o(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,o){r(n,e,t,o)}))}}})), /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ function(e){var t=e.Date;function n(){if(0===arguments.length){var e=new t;return e.setTime(n.now()),e}var r=Array.prototype.slice.call(arguments);return new(t.bind.apply(t,__spreadArrays([void 0],r)))}n.now=function(){var e=Zone.current.get("FakeAsyncTestZoneSpec");return e?e.getFakeSystemTime():t.now.apply(this,arguments)},n.UTC=t.UTC,n.parse=t.parse;var r={setTimeout:e.setTimeout,setInterval:e.setInterval,clearTimeout:e.clearTimeout,clearInterval:e.clearInterval},o=function(){function n(){this._schedulerQueue=[],this._currentTickTime=0,this._currentFakeBaseSystemTime=t.now(),this._currentTickRequeuePeriodicEntries=[]}return n.prototype.getCurrentTickTime=function(){return this._currentTickTime},n.prototype.getFakeSystemTime=function(){return this._currentFakeBaseSystemTime+this._currentTickTime},n.prototype.setFakeBaseSystemTime=function(e){this._currentFakeBaseSystemTime=e},n.prototype.getRealSystemTime=function(){return t.now()},n.prototype.scheduleFunction=function(e,t,r){var o=(r=Object.assign({args:[],isPeriodic:!1,isRequestAnimationFrame:!1,id:-1,isRequeuePeriodic:!1},r)).id<0?n.nextId++:r.id,i={endTime:this._currentTickTime+t,id:o,func:e,args:r.args,delay:t,isPeriodic:r.isPeriodic,isRequestAnimationFrame:r.isRequestAnimationFrame};r.isRequeuePeriodic&&this._currentTickRequeuePeriodicEntries.push(i);for(var s=0;s0&&(this._currentTickRequeuePeriodicEntries=[],!(o=0&&this._schedulerQueue.splice(c,1)}if(i=this._currentTickTime,this._currentTickTime=a.endTime,n&&n(this._currentTickTime-i),!a.func.apply(e,a.isRequestAnimationFrame?[this._currentTickTime]:a.args))break;r.processNewMacroTasksSynchronously||this._currentTickRequeuePeriodicEntries.forEach((function(e){for(var t=0;t0;){if(++i>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 s=this._schedulerQueue.shift();if(o=this._currentTickTime,this._currentTickTime=s.endTime,n&&n(this._currentTickTime-o),!s.func.apply(e,s.args))break}return this._currentTickTime-r},n}();o.nextId=1;var i=function(){function i(t,n,r){void 0===n&&(n=!1),this.trackPendingRequestAnimationFrame=n,this.macroTaskOptions=r,this._scheduler=new o,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 i.assertInZone=function(){if(null==Zone.current.get("FakeAsyncTestZoneSpec"))throw new Error("The code should be running in the fakeAsync zone to call this function")},i.prototype._fnAndFlush=function(t,n){var r=this;return function(){for(var o=[],i=0;i-1&&e.splice(n,1)},i.prototype._dequeueTimer=function(e){var t=this;return function(){i._removeTimer(t.pendingTimers,e)}},i.prototype._requeuePeriodicTimer=function(e,t,n,r){var o=this;return function(){-1!==o.pendingPeriodicTimers.indexOf(r)&&o._scheduler.scheduleFunction(e,t,{args:n,isPeriodic:!0,id:r,isRequeuePeriodic:!0})}},i.prototype._dequeuePeriodicTimer=function(e){var t=this;return function(){i._removeTimer(t.pendingPeriodicTimers,e)}},i.prototype._setTimeout=function(e,t,n,r){void 0===r&&(r=!0);var i=this._dequeueTimer(o.nextId),s=this._fnAndFlush(e,{onSuccess:i,onError:i}),a=this._scheduler.scheduleFunction(s,t,{args:n,isRequestAnimationFrame:!r});return r&&this.pendingTimers.push(a),a},i.prototype._clearTimeout=function(e){i._removeTimer(this.pendingTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},i.prototype._setInterval=function(e,t,n){var r=o.nextId,i={onSuccess:null,onError:this._dequeuePeriodicTimer(r)},s=this._fnAndFlush(e,i);return i.onSuccess=this._requeuePeriodicTimer(s,t,n,r),this._scheduler.scheduleFunction(s,t,{args:n,isPeriodic:!0}),this.pendingPeriodicTimers.push(r),r},i.prototype._clearInterval=function(e){i._removeTimer(this.pendingPeriodicTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},i.prototype._resetLastErrorAndThrow=function(){var e=this._lastError||this._uncaughtPromiseErrors[0];throw this._uncaughtPromiseErrors.length=0,this._lastError=null,e},i.prototype.getCurrentTickTime=function(){return this._scheduler.getCurrentTickTime()},i.prototype.getFakeSystemTime=function(){return this._scheduler.getFakeSystemTime()},i.prototype.setFakeBaseSystemTime=function(e){this._scheduler.setFakeBaseSystemTime(e)},i.prototype.getRealSystemTime=function(){return this._scheduler.getRealSystemTime()},i.patchDate=function(){e[Zone.__symbol__("disableDatePatching")]||e.Date!==n&&(e.Date=n,n.prototype=t.prototype,i.checkTimerPatch())},i.resetDate=function(){e.Date===n&&(e.Date=t)},i.checkTimerPatch=function(){e.setTimeout!==r.setTimeout&&(e.setTimeout=r.setTimeout,e.clearTimeout=r.clearTimeout),e.setInterval!==r.setInterval&&(e.setInterval=r.setInterval,e.clearInterval=r.clearInterval)},i.prototype.lockDatePatch=function(){this.patchDateLocked=!0,i.patchDate()},i.prototype.unlockDatePatch=function(){this.patchDateLocked=!1,i.resetDate()},i.prototype.tickToNext=function(e,t,n){void 0===e&&(e=1),void 0===n&&(n={processNewMacroTasksSynchronously:!0}),e<=0||(i.assertInZone(),this.flushMicrotasks(),this._scheduler.tickToNext(e,t,n),null!==this._lastError&&this._resetLastErrorAndThrow())},i.prototype.tick=function(e,t,n){void 0===e&&(e=0),void 0===n&&(n={processNewMacroTasksSynchronously:!0}),i.assertInZone(),this.flushMicrotasks(),this._scheduler.tick(e,t,n),null!==this._lastError&&this._resetLastErrorAndThrow()},i.prototype.flushMicrotasks=function(){for(i.assertInZone();this._microtasks.length>0;){var e=this._microtasks.shift();e.func.apply(e.target,e.args)}(null!==this._lastError||this._uncaughtPromiseErrors.length)&&this._resetLastErrorAndThrow()},i.prototype.flush=function(e,t,n){i.assertInZone(),this.flushMicrotasks();var r=this._scheduler.flush(e,t,n);return null!==this._lastError&&this._resetLastErrorAndThrow(),r},i.prototype.flushOnlyPendingTimers=function(e){i.assertInZone(),this.flushMicrotasks();var t=this._scheduler.flushOnlyPendingTimers(e);return null!==this._lastError&&this._resetLastErrorAndThrow(),t},i.prototype.removeAllTimers=function(){i.assertInZone(),this._scheduler.removeAll(),this.pendingPeriodicTimers=[],this.pendingTimers=[]},i.prototype.getTimerCount=function(){return this._scheduler.getTimerCount()+this._microtasks.length},i.prototype.onScheduleTask=function(e,t,n,r){switch(r.type){case"microTask":var o=r.data&&r.data.args,i=void 0;if(o){var s=r.data.cbIdx;"number"==typeof o.length&&o.length>s+1&&(i=Array.prototype.slice.call(o,s+1))}this._microtasks.push({func:r.invoke,args:i,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},i.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 o=this.findMacroTaskOption(r);if(o){var i=r.data.handleId;return o.isPeriodic?this._clearInterval(i):this._clearTimeout(i)}return e.cancelTask(n,r)}},i.prototype.onInvoke=function(e,t,n,r,o,s,a){try{return i.patchDate(),e.invoke(n,r,o,s,a)}finally{this.patchDateLocked||i.resetDate()}},i.prototype.findMacroTaskOption=function(e){if(!this.macroTaskOptions)return null;for(var t=0;t0)throw new Error(i.pendingPeriodicTimers.length+" periodic timer(s) still in the queue.");if(i.pendingTimers.length>0)throw new Error(i.pendingTimers.length+" timer(s) still in the queue.");return h}finally{s()}};return n.isFakeAsync=!0,n}}}),!0), /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ Zone.__load_patch("promisefortest",(function(e,t,n){var r=n.symbol("state"),o=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 i=t.current.get("AsyncTestZoneSpec");i&&(i.unresolvedChainedPromiseCount++,e[o]=!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)}}))}));