var __read=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},__spread=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}; /** * @license Angular v0.10.2 * (c) 2010-2019 Google LLC. https://angular.io/ * License: MIT */ !function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict"; /** * @license * Copyright Google Inc. 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 */ /** * @license * Copyright Google Inc. 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,r=function(){function e(){if(0===arguments.length){var r=new t;return r.setTime(e.now()),r}var n=Array.prototype.slice.call(arguments);return new(t.bind.apply(t,__spread([void 0],n)))}return e.now=function(){var e=Zone.current.get("FakeAsyncTestZoneSpec");return e?e.getCurrentRealTime()+e.getCurrentTime():t.now.apply(this,arguments)},e}();r.UTC=t.UTC,r.parse=t.parse;var n={setTimeout:e.setTimeout,setInterval:e.setInterval,clearTimeout:e.clearTimeout,clearInterval:e.clearInterval},i=function(){function r(){this._schedulerQueue=[],this._currentTime=0,this._currentRealTime=t.now()}return r.prototype.getCurrentTime=function(){return this._currentTime},r.prototype.getCurrentRealTime=function(){return this._currentRealTime},r.prototype.setCurrentRealTime=function(e){this._currentRealTime=e},r.prototype.scheduleFunction=function(e,t,n,i,s,o){void 0===n&&(n=[]),void 0===i&&(i=!1),void 0===s&&(s=!1),void 0===o&&(o=-1);for(var a=o<0?r.nextId++:o,u={endTime:this._currentTime+t,id:a,func:e,args:n,delay:t,isPeriodic:i,isRequestAnimationFrame:s},c=0;c<this._schedulerQueue.length&&!(u.endTime<this._schedulerQueue[c].endTime);c++);return this._schedulerQueue.splice(c,0,u),a},r.prototype.removeScheduledFunctionWithId=function(e){for(var t=0;t<this._schedulerQueue.length;t++)if(this._schedulerQueue[t].id==e){this._schedulerQueue.splice(t,1);break}},r.prototype.tick=function(t,r){void 0===t&&(t=0);var n=this._currentTime+t,i=0;if(0===this._schedulerQueue.length&&r)r(t);else{for(;this._schedulerQueue.length>0&&!(n<this._schedulerQueue[0].endTime);){var s=this._schedulerQueue.shift();if(i=this._currentTime,this._currentTime=s.endTime,r&&r(this._currentTime-i),!s.func.apply(e,s.isRequestAnimationFrame?[this._currentTime]:s.args))break}i=this._currentTime,this._currentTime=n,r&&r(this._currentTime-i)}},r.prototype.flush=function(e,t,r){return void 0===e&&(e=20),void 0===t&&(t=!1),t?this.flushPeriodic(r):this.flushNonPeriodic(e,r)},r.prototype.flushPeriodic=function(e){if(0===this._schedulerQueue.length)return 0;var t=this._currentTime;return this.tick(this._schedulerQueue[this._schedulerQueue.length-1].endTime-t,e),this._currentTime-t},r.prototype.flushNonPeriodic=function(t,r){for(var n=this._currentTime,i=0,s=0;this._schedulerQueue.length>0;){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._currentTime,this._currentTime=o.endTime,r&&r(this._currentTime-i),!o.func.apply(e,o.args))break}return this._currentTime-n},r}();i.nextId=1;var s=function(){function s(t,r,n){void 0===r&&(r=!1),this.trackPendingRequestAnimationFrame=r,this.macroTaskOptions=n,this._scheduler=new i,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 s.assertInZone=function(){if(null==Zone.current.get("FakeAsyncTestZoneSpec"))throw new Error("The code should be running in the fakeAsync zone to call this function")},s.prototype._fnAndFlush=function(t,r){var n=this;return function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return t.apply(e,i),null===n._lastError?(null!=r.onSuccess&&r.onSuccess.apply(e),n.flushMicrotasks()):null!=r.onError&&r.onError.apply(e),null===n._lastError}},s._removeTimer=function(e,t){var r=e.indexOf(t);r>-1&&e.splice(r,1)},s.prototype._dequeueTimer=function(e){var t=this;return function(){s._removeTimer(t.pendingTimers,e)}},s.prototype._requeuePeriodicTimer=function(e,t,r,n){var i=this;return function(){-1!==i.pendingPeriodicTimers.indexOf(n)&&i._scheduler.scheduleFunction(e,t,r,!0,!1,n)}},s.prototype._dequeuePeriodicTimer=function(e){var t=this;return function(){s._removeTimer(t.pendingPeriodicTimers,e)}},s.prototype._setTimeout=function(e,t,r,n){void 0===n&&(n=!0);var s=this._dequeueTimer(i.nextId),o=this._fnAndFlush(e,{onSuccess:s,onError:s}),a=this._scheduler.scheduleFunction(o,t,r,!1,!n);return n&&this.pendingTimers.push(a),a},s.prototype._clearTimeout=function(e){s._removeTimer(this.pendingTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},s.prototype._setInterval=function(e,t,r){var n=i.nextId,s={onSuccess:null,onError:this._dequeuePeriodicTimer(n)},o=this._fnAndFlush(e,s);return s.onSuccess=this._requeuePeriodicTimer(o,t,r,n),this._scheduler.scheduleFunction(o,t,r,!0),this.pendingPeriodicTimers.push(n),n},s.prototype._clearInterval=function(e){s._removeTimer(this.pendingPeriodicTimers,e),this._scheduler.removeScheduledFunctionWithId(e)},s.prototype._resetLastErrorAndThrow=function(){var e=this._lastError||this._uncaughtPromiseErrors[0];throw this._uncaughtPromiseErrors.length=0,this._lastError=null,e},s.prototype.getCurrentTime=function(){return this._scheduler.getCurrentTime()},s.prototype.getCurrentRealTime=function(){return this._scheduler.getCurrentRealTime()},s.prototype.setCurrentRealTime=function(e){this._scheduler.setCurrentRealTime(e)},s.patchDate=function(){e[Zone.__symbol__("disableDatePatching")]||e.Date!==r&&(e.Date=r,r.prototype=t.prototype,s.checkTimerPatch())},s.resetDate=function(){e.Date===r&&(e.Date=t)},s.checkTimerPatch=function(){e.setTimeout!==n.setTimeout&&(e.setTimeout=n.setTimeout,e.clearTimeout=n.clearTimeout),e.setInterval!==n.setInterval&&(e.setInterval=n.setInterval,e.clearInterval=n.clearInterval)},s.prototype.lockDatePatch=function(){this.patchDateLocked=!0,s.patchDate()},s.prototype.unlockDatePatch=function(){this.patchDateLocked=!1,s.resetDate()},s.prototype.tick=function(e,t){void 0===e&&(e=0),s.assertInZone(),this.flushMicrotasks(),this._scheduler.tick(e,t),null!==this._lastError&&this._resetLastErrorAndThrow()},s.prototype.flushMicrotasks=function(){for(s.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()},s.prototype.flush=function(e,t,r){s.assertInZone(),this.flushMicrotasks();var n=this._scheduler.flush(e,t,r);return null!==this._lastError&&this._resetLastErrorAndThrow(),n},s.prototype.onScheduleTask=function(e,t,r,n){switch(n.type){case"microTask":var i=n.data&&n.data.args,s=void 0;if(i){var o=n.data.cbIdx;"number"==typeof i.length&&i.length>o+1&&(s=Array.prototype.slice.call(i,o+1))}this._microtasks.push({func:n.invoke,args:s,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":throw new Error("Cannot make XHRs from within a fake async test. Request URL: "+n.data.url);case"requestAnimationFrame":case"webkitRequestAnimationFrame":case"mozRequestAnimationFrame":n.data.handleId=this._setTimeout(n.invoke,16,n.data.args,this.trackPendingRequestAnimationFrame);break;default:var a=this.findMacroTaskOption(n);if(a){var u=n.data&&n.data.args,c=u&&u.length>1?u[1]:0,h=a.callbackArgs?a.callbackArgs:u;a.isPeriodic?(n.data.handleId=this._setInterval(n.invoke,c,h),n.data.isPeriodic=!0):n.data.handleId=this._setTimeout(n.invoke,c,h);break}throw new Error("Unknown macroTask scheduled in fake async test: "+n.source)}break;case"eventTask":n=e.scheduleTask(r,n)}return n},s.prototype.onCancelTask=function(e,t,r,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 i=this.findMacroTaskOption(n);if(i){var s=n.data.handleId;return i.isPeriodic?this._clearInterval(s):this._clearTimeout(s)}return e.cancelTask(r,n)}},s.prototype.onInvoke=function(e,t,r,n,i,o,a){try{return s.patchDate(),e.invoke(r,n,i,o,a)}finally{this.patchDateLocked||s.resetDate()}},s.prototype.findMacroTaskOption=function(e){if(!this.macroTaskOptions)return null;for(var t=0;t<this.macroTaskOptions.length;t++){var r=this.macroTaskOptions[t];if(r.source===e.source)return r}return null},s.prototype.onHandleError=function(e,t,r,n){return this._lastError=n,!1},s}();Zone.FakeAsyncTestZoneSpec=s}("object"==typeof window&&window||"object"==typeof self&&self||global), /** * @license * Copyright Google Inc. 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("fakeasync",function(e,t,r){var n=t&&t.FakeAsyncTestZoneSpec,i=t&&t.ProxyZoneSpec,s=null;function o(){s&&s.unlockDatePatch(),s=null,i&&i.assertPresent().resetDelegate()}function a(){if(null==s&&null==(s=t.current.get("FakeAsyncTestZoneSpec")))throw new Error("The code should be running in the fakeAsync zone to call this function");return s}function u(){a().flushMicrotasks()}t[r.symbol("fakeAsyncTest")]={resetFakeAsyncZone:o,flushMicrotasks:u,discardPeriodicTasks:function c(){a().pendingPeriodicTimers.length=0},tick:function h(e){void 0===e&&(e=0),a().tick(e)},flush:function l(e){return a().flush(e)},fakeAsync:function d(e){return function(){for(var r=[],a=0;a<arguments.length;a++)r[a]=arguments[a];var c=i.assertPresent();if(t.current.get("FakeAsyncTestZoneSpec"))throw new Error("fakeAsync() calls can not be nested");try{if(!s){if(c.getDelegate()instanceof n)throw new Error("fakeAsync() calls can not be nested");s=new n}var h=void 0,l=c.getDelegate();c.setDelegate(s),s.lockDatePatch();try{h=e.apply(this,r),u()}finally{c.setDelegate(l)}if(s.pendingPeriodicTimers.length>0)throw new Error(s.pendingPeriodicTimers.length+" periodic timer(s) still in the queue.");if(s.pendingTimers.length>0)throw new Error(s.pendingTimers.length+" timer(s) still in the queue.");return h}finally{o()}}}}})});