From c555b083b902bd8370d20a35ce523302d1448492 Mon Sep 17 00:00:00 2001 From: JiaLiPassion Date: Tue, 30 Apr 2019 16:43:22 +0000 Subject: [PATCH] build: release zone.js 0.9.1 --- CHANGELOG.md | 16 +++ dist/fake-async-test.js | 2 +- dist/jasmine-patch.js | 92 +++++++++-------- dist/jasmine-patch.min.js | 2 +- dist/zone-evergreen-testing-bundle.js | 113 +++++++++++--------- dist/zone-evergreen.js | 17 ++- dist/zone-evergreen.min.js | 2 +- dist/zone-legacy.js | 29 +++++- dist/zone-legacy.min.js | 2 +- dist/zone-mix.js | 17 ++- dist/zone-testing-bundle.js | 142 +++++++++++++++++--------- dist/zone-testing-node-bundle.js | 94 +++++++++-------- dist/zone-testing.js | 94 +++++++++-------- dist/zone.js | 46 +++++++-- dist/zone.min.js | 2 +- file-size-limit.json | 2 +- package.json | 2 +- 17 files changed, 429 insertions(+), 245 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06eef6011..872b2c9ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ + +## [0.9.1](https://github.com/angular/zone.js/compare/v0.9.0...0.9.1) (2019-04-30) + + +### Bug Fixes + +* ensure that EventTarget is patched prior to legacy property descriptor patch ([#1214](https://github.com/angular/zone.js/issues/1214)) ([aca4728](https://github.com/angular/zone.js/commit/aca4728)) +* fakeAsyncTest requestAnimationFrame should pass timestamp as parameter ([#1220](https://github.com/angular/zone.js/issues/1220)) ([62b8525](https://github.com/angular/zone.js/commit/62b8525)), closes [#1216](https://github.com/angular/zone.js/issues/1216) + + +### Features + +* add option to disable jasmine clock patch, also rename the flag of auto jump in FakeAsyncTest ([#1222](https://github.com/angular/zone.js/issues/1222)) ([10e1b0c](https://github.com/angular/zone.js/commit/10e1b0c)) + + + # [0.9.0](https://github.com/angular/zone.js/compare/v0.8.29...0.9.0) (2019-03-12) diff --git a/dist/fake-async-test.js b/dist/fake-async-test.js index 63ac9898d..44c0969c2 100644 --- a/dist/fake-async-test.js +++ b/dist/fake-async-test.js @@ -145,7 +145,7 @@ var __spread = (undefined && undefined.__spread) || function () { if (doTick) { doTick(this._currentTime - lastCurrentTime); } - var retval = current_1.func.apply(global, current_1.args); + var retval = current_1.func.apply(global, current_1.isRequestAnimationFrame ? [this._currentTime] : current_1.args); if (!retval) { // Uncaught exception in the current scheduled function. Stop processing the queue. break; diff --git a/dist/jasmine-patch.js b/dist/jasmine-patch.js index 4191c6005..3c6958113 100644 --- a/dist/jasmine-patch.js +++ b/dist/jasmine-patch.js @@ -51,7 +51,13 @@ var syncZone = ambientZone.fork(new SyncTestZoneSpec('jasmine.describe')); var symbol = Zone.__symbol__; // whether patch jasmine clock when in fakeAsync - var enableClockPatch = _global[symbol('fakeAsyncPatchLock')] === true; + var disablePatchingJasmineClock = _global[symbol('fakeAsyncDisablePatchingClock')] === true; + // the original variable name fakeAsyncPatchLock is not accurate, so the name will be + // fakeAsyncAutoFakeAsyncWhenClockPatched and if this enablePatchingJasmineClock is false, we also + // automatically disable the auto jump into fakeAsync feature + var enableAutoFakeAsyncWhenClockPatched = !disablePatchingJasmineClock && + ((_global[symbol('fakeAsyncPatchLock')] === true) || + (_global[symbol('fakeAsyncAutoFakeAsyncWhenClockPatched')] === true)); var ignoreUnhandledRejection = _global[symbol('ignoreUnhandledRejection')] === true; if (!ignoreUnhandledRejection) { var globalErrors_1 = jasmine.GlobalErrors; @@ -100,48 +106,50 @@ return originalJasmineFn.apply(this, arguments); }; }); - // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so - // they can work properly in FakeAsyncTest - var originalClockFn = (jasmine[symbol('clock')] = jasmine['clock']); - jasmine['clock'] = function () { - var clock = originalClockFn.apply(this, arguments); - if (!clock[symbol('patched')]) { - clock[symbol('patched')] = symbol('patched'); - var originalTick_1 = (clock[symbol('tick')] = clock.tick); - clock.tick = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); - } - return originalTick_1.apply(this, arguments); - }; - var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); - clock.mockDate = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - var dateTime = arguments.length > 0 ? arguments[0] : new Date(); - return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : - arguments); + if (!disablePatchingJasmineClock) { + // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so + // they can work properly in FakeAsyncTest + var originalClockFn_1 = (jasmine[symbol('clock')] = jasmine['clock']); + jasmine['clock'] = function () { + var clock = originalClockFn_1.apply(this, arguments); + if (!clock[symbol('patched')]) { + clock[symbol('patched')] = symbol('patched'); + var originalTick_1 = (clock[symbol('tick')] = clock.tick); + clock.tick = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); + } + return originalTick_1.apply(this, arguments); + }; + var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); + clock.mockDate = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + var dateTime = arguments.length > 0 ? arguments[0] : new Date(); + return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : + arguments); + } + return originalMockDate_1.apply(this, arguments); + }; + // for auto go into fakeAsync feature, we need the flag to enable it + if (enableAutoFakeAsyncWhenClockPatched) { + ['install', 'uninstall'].forEach(function (methodName) { + var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); + clock[methodName] = function () { + var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; + if (FakeAsyncTestZoneSpec) { + jasmine[symbol('clockInstalled')] = 'install' === methodName; + return; + } + return originalClockFn.apply(this, arguments); + }; + }); } - return originalMockDate_1.apply(this, arguments); - }; - // for auto go into fakeAsync feature, we need the flag to enable it - if (enableClockPatch) { - ['install', 'uninstall'].forEach(function (methodName) { - var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); - clock[methodName] = function () { - var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; - if (FakeAsyncTestZoneSpec) { - jasmine[symbol('clockInstalled')] = 'install' === methodName; - return; - } - return originalClockFn.apply(this, arguments); - }; - }); } - } - return clock; - }; + return clock; + }; + } /** * Gets a function wrapping the body of a Jasmine `describe` block to execute in a * synchronous-only zone. @@ -155,7 +163,7 @@ var isClockInstalled = !!jasmine[symbol('clockInstalled')]; var testProxyZoneSpec = queueRunner.testProxyZoneSpec; var testProxyZone = queueRunner.testProxyZone; - if (isClockInstalled && enableClockPatch) { + if (isClockInstalled && enableAutoFakeAsyncWhenClockPatched) { // auto run a fakeAsync var fakeAsyncModule = Zone[Zone.__symbol__('fakeAsyncTest')]; if (fakeAsyncModule && typeof fakeAsyncModule.fakeAsync === 'function') { diff --git a/dist/jasmine-patch.min.js b/dist/jasmine-patch.min.js index 505ff0c26..016466a6a 100644 --- a/dist/jasmine-patch.min.js +++ b/dist/jasmine-patch.min.js @@ -1 +1 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";!function(){var e="undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global;if(!Zone)throw new Error("Missing: zone.js");if("undefined"==typeof jasmine)throw new Error("Missing: jasmine.js");if(jasmine.__zone_patch__)throw new Error("'jasmine' has already been patched with 'Zone'.");jasmine.__zone_patch__=!0;var n=Zone.SyncTestZoneSpec,t=Zone.ProxyZoneSpec;if(!n)throw new Error("Missing: SyncTestZoneSpec");if(!t)throw new Error("Missing: ProxyZoneSpec");var o=Zone.current,r=o.fork(new n("jasmine.describe")),i=Zone.__symbol__,s=!0===e[i("fakeAsyncPatchLock")];if(!(!0===e[i("ignoreUnhandledRejection")])){var a=jasmine.GlobalErrors;a&&!jasmine[i("GlobalErrors")]&&(jasmine[i("GlobalErrors")]=a,jasmine.GlobalErrors=function(){var e=new a,n=e.install;return n&&!e[i("install")]&&(e[i("install")]=n,e.install=function(){var e=process.listeners("unhandledRejection"),t=n.apply(this,arguments);return process.removeAllListeners("unhandledRejection"),e&&e.forEach(function(e){return process.on("unhandledRejection",e)}),t}),e})}var c=jasmine.getEnv();["describe","xdescribe","fdescribe"].forEach(function(e){var n=c[e];c[e]=function(e,t){return n.call(this,e,(o=t,function(){return r.run(o,this,arguments)}));var o}}),["it","xit","fit"].forEach(function(e){var n=c[e];c[i(e)]=n,c[e]=function(e,t,o){return arguments[1]=f(t),n.apply(this,arguments)}}),["beforeEach","afterEach","beforeAll","afterAll"].forEach(function(e){var n=c[e];c[i(e)]=n,c[e]=function(e,t){return arguments[0]=f(e),n.apply(this,arguments)}});var u=jasmine[i("clock")]=jasmine.clock;function l(e,n,t,o){var r=!!jasmine[i("clockInstalled")],a=(t.testProxyZoneSpec,t.testProxyZone);if(r&&s){var c=Zone[Zone.__symbol__("fakeAsyncTest")];c&&"function"==typeof c.fakeAsync&&(e=c.fakeAsync(e))}return o?a.run(e,n,[o]):a.run(e,n)}function f(e){return e&&(e.length?function(n){return l(e,this,this.queueRunner,n)}:function(){return l(e,this,this.queueRunner)})}jasmine.clock=function(){var e=u.apply(this,arguments);if(!e[i("patched")]){e[i("patched")]=i("patched");var n=e[i("tick")]=e.tick;e.tick=function(){var e=Zone.current.get("FakeAsyncTestZoneSpec");return e?e.tick.apply(e,arguments):n.apply(this,arguments)};var t=e[i("mockDate")]=e.mockDate;e.mockDate=function(){var e=Zone.current.get("FakeAsyncTestZoneSpec");if(e){var n=arguments.length>0?arguments[0]:new Date;return e.setCurrentRealTime.apply(e,n&&"function"==typeof n.getTime?[n.getTime()]:arguments)}return t.apply(this,arguments)},s&&["install","uninstall"].forEach(function(n){var t=e[i(n)]=e[n];e[n]=function(){if(!Zone.FakeAsyncTestZoneSpec)return t.apply(this,arguments);jasmine[i("clockInstalled")]="install"===n}})}return e};var p=jasmine.QueueRunner;jasmine.QueueRunner=function(n){function r(t){var r,i=this;t.onComplete=(r=t.onComplete,function(){i.testProxyZone=null,i.testProxyZoneSpec=null,o.scheduleMicroTask("jasmine.onComplete",r)});var s=e.__zone_symbol__setTimeout,a=e.__zone_symbol__clearTimeout;s&&(t.timeout={setTimeout:s||e.setTimeout,clearTimeout:a||e.clearTimeout}),jasmine.UserContext?(t.userContext||(t.userContext=new jasmine.UserContext),t.userContext.queueRunner=this):(t.userContext||(t.userContext={}),t.userContext.queueRunner=this);var c=t.onException;t.onException=function(e){if(e&&"Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL."===e.message){var n=this&&this.testProxyZoneSpec;if(n){var t=n.getAndClearPendingTasksInfo();try{e.message+=t}catch(e){}}}c&&c.call(this,e)},n.call(this,t)}return function(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);function o(){this.constructor=e}e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(r,n),r.prototype.execute=function(){for(var e=this,r=Zone.current,i=!1;r;){if(r===o){i=!0;break}r=r.parent}if(!i)throw new Error("Unexpected Zone: "+Zone.current.name);this.testProxyZoneSpec=new t,this.testProxyZone=o.fork(this.testProxyZoneSpec),Zone.currentTask?n.prototype.execute.call(this):Zone.current.scheduleMicroTask("jasmine.execute().forceTask",function(){return p.prototype.execute.call(e)})},r}(p)}()}); \ No newline at end of file +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";!function(){var e="undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global;if(!Zone)throw new Error("Missing: zone.js");if("undefined"==typeof jasmine)throw new Error("Missing: jasmine.js");if(jasmine.__zone_patch__)throw new Error("'jasmine' has already been patched with 'Zone'.");jasmine.__zone_patch__=!0;var n=Zone.SyncTestZoneSpec,t=Zone.ProxyZoneSpec;if(!n)throw new Error("Missing: SyncTestZoneSpec");if(!t)throw new Error("Missing: ProxyZoneSpec");var o=Zone.current,r=o.fork(new n("jasmine.describe")),i=Zone.__symbol__,s=!0===e[i("fakeAsyncDisablePatchingClock")],c=!s&&(!0===e[i("fakeAsyncPatchLock")]||!0===e[i("fakeAsyncAutoFakeAsyncWhenClockPatched")]);if(!(!0===e[i("ignoreUnhandledRejection")])){var a=jasmine.GlobalErrors;a&&!jasmine[i("GlobalErrors")]&&(jasmine[i("GlobalErrors")]=a,jasmine.GlobalErrors=function(){var e=new a,n=e.install;return n&&!e[i("install")]&&(e[i("install")]=n,e.install=function(){var e=process.listeners("unhandledRejection"),t=n.apply(this,arguments);return process.removeAllListeners("unhandledRejection"),e&&e.forEach(function(e){return process.on("unhandledRejection",e)}),t}),e})}var u=jasmine.getEnv();if(["describe","xdescribe","fdescribe"].forEach(function(e){var n=u[e];u[e]=function(e,t){return n.call(this,e,(o=t,function(){return r.run(o,this,arguments)}));var o}}),["it","xit","fit"].forEach(function(e){var n=u[e];u[i(e)]=n,u[e]=function(e,t,o){return arguments[1]=p(t),n.apply(this,arguments)}}),["beforeEach","afterEach","beforeAll","afterAll"].forEach(function(e){var n=u[e];u[i(e)]=n,u[e]=function(e,t){return arguments[0]=p(e),n.apply(this,arguments)}}),!s){var l=jasmine[i("clock")]=jasmine.clock;jasmine.clock=function(){var e=l.apply(this,arguments);if(!e[i("patched")]){e[i("patched")]=i("patched");var n=e[i("tick")]=e.tick;e.tick=function(){var e=Zone.current.get("FakeAsyncTestZoneSpec");return e?e.tick.apply(e,arguments):n.apply(this,arguments)};var t=e[i("mockDate")]=e.mockDate;e.mockDate=function(){var e=Zone.current.get("FakeAsyncTestZoneSpec");if(e){var n=arguments.length>0?arguments[0]:new Date;return e.setCurrentRealTime.apply(e,n&&"function"==typeof n.getTime?[n.getTime()]:arguments)}return t.apply(this,arguments)},c&&["install","uninstall"].forEach(function(n){var t=e[i(n)]=e[n];e[n]=function(){if(!Zone.FakeAsyncTestZoneSpec)return t.apply(this,arguments);jasmine[i("clockInstalled")]="install"===n}})}return e}}function f(e,n,t,o){var r=!!jasmine[i("clockInstalled")],s=(t.testProxyZoneSpec,t.testProxyZone);if(r&&c){var a=Zone[Zone.__symbol__("fakeAsyncTest")];a&&"function"==typeof a.fakeAsync&&(e=a.fakeAsync(e))}return o?s.run(e,n,[o]):s.run(e,n)}function p(e){return e&&(e.length?function(n){return f(e,this,this.queueRunner,n)}:function(){return f(e,this,this.queueRunner)})}var h=jasmine.QueueRunner;jasmine.QueueRunner=function(n){function r(t){var r,i=this;t.onComplete=(r=t.onComplete,function(){i.testProxyZone=null,i.testProxyZoneSpec=null,o.scheduleMicroTask("jasmine.onComplete",r)});var s=e.__zone_symbol__setTimeout,c=e.__zone_symbol__clearTimeout;s&&(t.timeout={setTimeout:s||e.setTimeout,clearTimeout:c||e.clearTimeout}),jasmine.UserContext?(t.userContext||(t.userContext=new jasmine.UserContext),t.userContext.queueRunner=this):(t.userContext||(t.userContext={}),t.userContext.queueRunner=this);var a=t.onException;t.onException=function(e){if(e&&"Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL."===e.message){var n=this&&this.testProxyZoneSpec;if(n){var t=n.getAndClearPendingTasksInfo();try{e.message+=t}catch(e){}}}a&&a.call(this,e)},n.call(this,t)}return function(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);function o(){this.constructor=e}e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(r,n),r.prototype.execute=function(){for(var e=this,r=Zone.current,i=!1;r;){if(r===o){i=!0;break}r=r.parent}if(!i)throw new Error("Unexpected Zone: "+Zone.current.name);this.testProxyZoneSpec=new t,this.testProxyZone=o.fork(this.testProxyZoneSpec),Zone.currentTask?n.prototype.execute.call(this):Zone.current.scheduleMicroTask("jasmine.execute().forceTask",function(){return h.prototype.execute.call(e)})},r}(h)}()}); \ No newline at end of file diff --git a/dist/zone-evergreen-testing-bundle.js b/dist/zone-evergreen-testing-bundle.js index da3dce583..2547a6396 100644 --- a/dist/zone-evergreen-testing-bundle.js +++ b/dist/zone-evergreen-testing-bundle.js @@ -2632,7 +2632,11 @@ function propertyDescriptorPatch(api, _global) { patchFilteredProperties(Worker_1.prototype, workerEventNames, ignoreProperties); } } - patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + var XMLHttpRequest = _global['XMLHttpRequest']; + if (XMLHttpRequest) { + // XMLHttpRequest is not available in ServiceWorker, so we need to check here + patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + } var XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget']; if (XMLHttpRequestEventTarget) { patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties); @@ -2849,7 +2853,7 @@ function patchTimer(window, setName, cancelName, nameSuffix) { */ function patchCustomElements(_global, api) { var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix; - if ((!isBrowser && !isMix) || !('customElements' in _global)) { + if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) { return; } var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback']; @@ -2864,6 +2868,10 @@ function patchCustomElements(_global, api) { * found in the LICENSE file at https://angular.io/license */ function eventTargetPatch(_global, api) { + if (Zone[api.symbol('patchEventTarget')]) { + // EventTarget is already patched. + return; + } var _a = api.getGlobalObjects(), eventNames = _a.eventNames, zoneSymbolEventNames = _a.zoneSymbolEventNames, TRUE_STR = _a.TRUE_STR, FALSE_STR = _a.FALSE_STR, ZONE_SYMBOL_PREFIX = _a.ZONE_SYMBOL_PREFIX; // predefine all __zone_symbol__ + eventName + true/false string for (var i = 0; i < eventNames.length; i++) { @@ -2957,6 +2965,11 @@ Zone.__load_patch('XHR', function (global, Zone) { var XHR_URL = zoneSymbol('xhrURL'); var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled'); function patchXHR(window) { + var XMLHttpRequest = window['XMLHttpRequest']; + if (!XMLHttpRequest) { + // XMLHttpRequest is not available in service worker + return; + } var XMLHttpRequestPrototype = XMLHttpRequest.prototype; function findPendingTask(target) { return target[XHR_TASK]; @@ -3555,7 +3568,13 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; var syncZone = ambientZone.fork(new SyncTestZoneSpec('jasmine.describe')); var symbol = Zone.__symbol__; // whether patch jasmine clock when in fakeAsync - var enableClockPatch = _global[symbol('fakeAsyncPatchLock')] === true; + var disablePatchingJasmineClock = _global[symbol('fakeAsyncDisablePatchingClock')] === true; + // the original variable name fakeAsyncPatchLock is not accurate, so the name will be + // fakeAsyncAutoFakeAsyncWhenClockPatched and if this enablePatchingJasmineClock is false, we also + // automatically disable the auto jump into fakeAsync feature + var enableAutoFakeAsyncWhenClockPatched = !disablePatchingJasmineClock && + ((_global[symbol('fakeAsyncPatchLock')] === true) || + (_global[symbol('fakeAsyncAutoFakeAsyncWhenClockPatched')] === true)); var ignoreUnhandledRejection = _global[symbol('ignoreUnhandledRejection')] === true; if (!ignoreUnhandledRejection) { var globalErrors_1 = jasmine.GlobalErrors; @@ -3604,48 +3623,50 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; return originalJasmineFn.apply(this, arguments); }; }); - // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so - // they can work properly in FakeAsyncTest - var originalClockFn = (jasmine[symbol('clock')] = jasmine['clock']); - jasmine['clock'] = function () { - var clock = originalClockFn.apply(this, arguments); - if (!clock[symbol('patched')]) { - clock[symbol('patched')] = symbol('patched'); - var originalTick_1 = (clock[symbol('tick')] = clock.tick); - clock.tick = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); - } - return originalTick_1.apply(this, arguments); - }; - var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); - clock.mockDate = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - var dateTime = arguments.length > 0 ? arguments[0] : new Date(); - return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : - arguments); - } - return originalMockDate_1.apply(this, arguments); - }; - // for auto go into fakeAsync feature, we need the flag to enable it - if (enableClockPatch) { - ['install', 'uninstall'].forEach(function (methodName) { - var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); - clock[methodName] = function () { - var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; - if (FakeAsyncTestZoneSpec) { - jasmine[symbol('clockInstalled')] = 'install' === methodName; - return; - } - return originalClockFn.apply(this, arguments); - }; - }); + if (!disablePatchingJasmineClock) { + // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so + // they can work properly in FakeAsyncTest + var originalClockFn_1 = (jasmine[symbol('clock')] = jasmine['clock']); + jasmine['clock'] = function () { + var clock = originalClockFn_1.apply(this, arguments); + if (!clock[symbol('patched')]) { + clock[symbol('patched')] = symbol('patched'); + var originalTick_1 = (clock[symbol('tick')] = clock.tick); + clock.tick = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); + } + return originalTick_1.apply(this, arguments); + }; + var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); + clock.mockDate = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + var dateTime = arguments.length > 0 ? arguments[0] : new Date(); + return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : + arguments); + } + return originalMockDate_1.apply(this, arguments); + }; + // for auto go into fakeAsync feature, we need the flag to enable it + if (enableAutoFakeAsyncWhenClockPatched) { + ['install', 'uninstall'].forEach(function (methodName) { + var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); + clock[methodName] = function () { + var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; + if (FakeAsyncTestZoneSpec) { + jasmine[symbol('clockInstalled')] = 'install' === methodName; + return; + } + return originalClockFn.apply(this, arguments); + }; + }); + } } - } - return clock; - }; + return clock; + }; + } /** * Gets a function wrapping the body of a Jasmine `describe` block to execute in a * synchronous-only zone. @@ -3659,7 +3680,7 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; var isClockInstalled = !!jasmine[symbol('clockInstalled')]; var testProxyZoneSpec = queueRunner.testProxyZoneSpec; var testProxyZone = queueRunner.testProxyZone; - if (isClockInstalled && enableClockPatch) { + if (isClockInstalled && enableAutoFakeAsyncWhenClockPatched) { // auto run a fakeAsync var fakeAsyncModule = Zone[Zone.__symbol__('fakeAsyncTest')]; if (fakeAsyncModule && typeof fakeAsyncModule.fakeAsync === 'function') { @@ -4145,7 +4166,7 @@ var __spread = (undefined && undefined.__spread) || function () { if (doTick) { doTick(this._currentTime - lastCurrentTime); } - var retval = current_1.func.apply(global, current_1.args); + var retval = current_1.func.apply(global, current_1.isRequestAnimationFrame ? [this._currentTime] : current_1.args); if (!retval) { // Uncaught exception in the current scheduled function. Stop processing the queue. break; diff --git a/dist/zone-evergreen.js b/dist/zone-evergreen.js index 6666bf1cb..691d2b91f 100644 --- a/dist/zone-evergreen.js +++ b/dist/zone-evergreen.js @@ -2540,7 +2540,11 @@ function propertyDescriptorPatch(api, _global) { patchFilteredProperties(Worker.prototype, workerEventNames, ignoreProperties); } } - patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + const XMLHttpRequest = _global['XMLHttpRequest']; + if (XMLHttpRequest) { + // XMLHttpRequest is not available in ServiceWorker, so we need to check here + patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + } const XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget']; if (XMLHttpRequestEventTarget) { patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties); @@ -2757,7 +2761,7 @@ function patchTimer(window, setName, cancelName, nameSuffix) { */ function patchCustomElements(_global, api) { const { isBrowser, isMix } = api.getGlobalObjects(); - if ((!isBrowser && !isMix) || !('customElements' in _global)) { + if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) { return; } const callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback']; @@ -2772,6 +2776,10 @@ function patchCustomElements(_global, api) { * found in the LICENSE file at https://angular.io/license */ function eventTargetPatch(_global, api) { + if (Zone[api.symbol('patchEventTarget')]) { + // EventTarget is already patched. + return; + } const { eventNames, zoneSymbolEventNames, TRUE_STR, FALSE_STR, ZONE_SYMBOL_PREFIX } = api.getGlobalObjects(); // predefine all __zone_symbol__ + eventName + true/false string for (let i = 0; i < eventNames.length; i++) { @@ -2865,6 +2873,11 @@ Zone.__load_patch('XHR', (global, Zone) => { const XHR_URL = zoneSymbol('xhrURL'); const XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled'); function patchXHR(window) { + const XMLHttpRequest = window['XMLHttpRequest']; + if (!XMLHttpRequest) { + // XMLHttpRequest is not available in service worker + return; + } const XMLHttpRequestPrototype = XMLHttpRequest.prototype; function findPendingTask(target) { return target[XHR_TASK]; diff --git a/dist/zone-evergreen.min.js b/dist/zone-evergreen.min.js index 7d044141c..999a289ac 100644 --- a/dist/zone-evergreen.min.js +++ b/dist/zone-evergreen.min.js @@ -1 +1 @@ -const Zone$1=function(e){const t=e.performance;function n(e){t&&t.mark&&t.mark(e)}function o(e,n){t&&t.measure&&t.measure(e,n)}n("Zone");const r=!0===e.__zone_symbol__forceDuplicateZoneCheck;if(e.Zone){if(r||"function"!=typeof e.Zone.__symbol__)throw new Error("Zone already loaded.");return e.Zone}class s{constructor(e,t){this._parent=e,this._name=t?t.name||"unnamed":"",this._properties=t&&t.properties||{},this._zoneDelegate=new a(this,this._parent&&this._parent._zoneDelegate,t)}static assertZonePatched(){if(e.Promise!==P.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.)")}static get root(){let e=s.current;for(;e.parent;)e=e.parent;return e}static get current(){return D.zone}static get currentTask(){return z}static __load_patch(t,i){if(P.hasOwnProperty(t)){if(r)throw Error("Already loaded patch: "+t)}else if(!e["__Zone_disable_"+t]){const r="Zone:"+t;n(r),P[t]=i(e,s,N),o(r,r)}}get parent(){return this._parent}get name(){return this._name}get(e){const t=this.getZoneWith(e);if(t)return t._properties[e]}getZoneWith(e){let t=this;for(;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null}fork(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)}wrap(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);const n=this._zoneDelegate.intercept(this,e,t),o=this;return function(){return o.runGuarded(n,this,arguments,t)}}run(e,t,n,o){D={parent:D,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,o)}finally{D=D.parent}}runGuarded(e,t=null,n,o){D={parent:D,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,o)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{D=D.parent}}runTask(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");if(e.state===y&&(e.type===w||e.type===O))return;const o=e.state!=T;o&&e._transitionTo(T,b),e.runCount++;const r=z;z=e,D={parent:D,zone:this};try{e.type==O&&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!==y&&e.state!==v&&(e.type==w||e.data&&e.data.isPeriodic?o&&e._transitionTo(b,T):(e.runCount=0,this._updateTaskCount(e,-1),o&&e._transitionTo(y,T,y))),D=D.parent,z=r}}scheduleTask(e){if(e.zone&&e.zone!==this){let t=this;for(;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(E,y);const t=[];e._zoneDelegates=t,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(v,E,y),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===t&&this._updateTaskCount(e,1),e.state==E&&e._transitionTo(b,E),e}scheduleMicroTask(e,t,n,o){return this.scheduleTask(new c(S,e,t,n,o,void 0))}scheduleMacroTask(e,t,n,o,r){return this.scheduleTask(new c(O,e,t,n,o,r))}scheduleEventTask(e,t,n,o,r){return this.scheduleTask(new c(w,e,t,n,o,r))}cancelTask(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");e._transitionTo(k,b,T);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(v,k),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(y,k),e.runCount=0,e}_updateTaskCount(e,t){const n=e._zoneDelegates;-1==t&&(e._zoneDelegates=null);for(let o=0;oe.hasTask(n,o),onScheduleTask:(e,t,n,o)=>e.scheduleTask(n,o),onInvokeTask:(e,t,n,o,r,s)=>e.invokeTask(n,o,r,s),onCancelTask:(e,t,n,o)=>e.cancelTask(n,o)};class a{constructor(e,t,n){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=e,this._parentDelegate=t,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this.zone:t.zone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this.zone:t.zone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this.zone:t.zone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this.zone:t.zone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this.zone:t.zone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this.zone:t.zone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this.zone:t.zone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;const o=n&&n.onHasTask,r=t&&t._hasTaskZS;(o||r)&&(this._hasTaskZS=o?n:i,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=e,n.onScheduleTask||(this._scheduleTaskZS=i,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this.zone),n.onInvokeTask||(this._invokeTaskZS=i,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this.zone),n.onCancelTask||(this._cancelTaskZS=i,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this.zone))}fork(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new s(e,t)}intercept(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t}invoke(e,t,n,o,r){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,o,r):t.apply(n,o)}handleError(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t)}scheduleTask(e,t){let n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),(n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t))||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else{if(t.type!=S)throw new Error("Task is missing scheduleFn.");_(t)}return n}invokeTask(e,t,n,o){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,o):t.callback.apply(n,o)}cancelTask(e,t){let n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error("Task is not cancelable");n=t.cancelFn(t)}return n}hasTask(e,t){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(t){this.handleError(e,t)}}_updateTaskCount(e,t){const n=this._taskCounts,o=n[e],r=n[e]=o+t;if(r<0)throw new Error("More tasks executed then were scheduled.");if(0==o||0==r){const t={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this.zone,t)}}}class c{constructor(t,n,o,r,s,i){this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=t,this.source=n,this.data=r,this.scheduleFn=s,this.cancelFn=i,this.callback=o;const a=this;t===w&&r&&r.useG?this.invoke=c.invokeTask:this.invoke=function(){return c.invokeTask.call(e,a,this,arguments)}}static invokeTask(e,t,n){e||(e=this),Z++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==Z&&m(),Z--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(y,E)}_transitionTo(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==y&&(this._zoneDelegates=null)}toString(){return this.data&&void 0!==this.data.handleId?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}const l=R("setTimeout"),u=R("Promise"),p=R("then");let h,f=[],d=!1;function _(t){if(0===Z&&0===f.length)if(h||e[u]&&(h=e[u].resolve(0)),h){let e=h[p];e||(e=h.then),e.call(h,m)}else e[l](m,0);t&&f.push(t)}function m(){if(!d){for(d=!0;f.length;){const e=f;f=[];for(let t=0;tD,onUnhandledError:I,microtaskDrainDone:I,scheduleMicroTask:_,showUncaughtError:()=>!s[R("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:I,patchMethod:()=>I,bindArguments:()=>[],patchThen:()=>I,patchMacroTask:()=>I,setNativePromise:e=>{e&&"function"==typeof e.resolve&&(h=e.resolve(0))},patchEventPrototype:()=>I,isIEOrEdge:()=>!1,getGlobalObjects:()=>void 0,ObjectDefineProperty:()=>I,ObjectGetOwnPropertyDescriptor:()=>void 0,ObjectCreate:()=>void 0,ArraySlice:()=>[],patchClass:()=>I,wrapWithCurrentZone:()=>I,filterProperties:()=>[],attachOriginToPatched:()=>I,_redefineProperty:()=>I,patchCallbacks:()=>I};let D={parent:null,zone:new s(null,null)},z=null,Z=0;function I(){}function R(e){return"__zone_symbol__"+e}return o("Zone","Zone"),e.Zone=s}("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global);Zone.__load_patch("ZoneAwarePromise",(e,t,n)=>{const o=Object.getOwnPropertyDescriptor,r=Object.defineProperty;const s=n.symbol,i=[],a=s("Promise"),c=s("then"),l="__creationTrace__";n.onUnhandledError=(e=>{if(n.showUncaughtError()){const 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=(()=>{for(;i.length;)for(;i.length;){const e=i.shift();try{e.zone.runGuarded(()=>{throw e})}catch(e){p(e)}}});const u=s("unhandledPromiseRejectionHandler");function p(e){n.onUnhandledError(e);try{const n=t[u];n&&"function"==typeof n&&n.call(this,e)}catch(e){}}function h(e){return e&&e.then}function f(e){return e}function d(e){return M.reject(e)}const _=s("state"),m=s("value"),g=s("finally"),y=s("parentPromiseValue"),E=s("parentPromiseState"),b="Promise.then",T=null,k=!0,v=!1,S=0;function O(e,t){return n=>{try{D(e,t,n)}catch(t){D(e,!1,t)}}}const w=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},P="Promise resolved with itself",N=s("currentTaskTrace");function D(e,o,s){const a=w();if(e===s)throw new TypeError(P);if(e[_]===T){let c=null;try{"object"!=typeof s&&"function"!=typeof s||(c=s&&s.then)}catch(t){return a(()=>{D(e,!1,t)})(),e}if(o!==v&&s instanceof M&&s.hasOwnProperty(_)&&s.hasOwnProperty(m)&&s[_]!==T)Z(s),D(e,s[_],s[m]);else if(o!==v&&"function"==typeof c)try{c.call(s,a(O(e,o)),a(O(e,!1)))}catch(t){a(()=>{D(e,!1,t)})()}else{e[_]=o;const a=e[m];if(e[m]=s,e[g]===g&&o===k&&(e[_]=e[E],e[m]=e[y]),o===v&&s instanceof Error){const e=t.currentTask&&t.currentTask.data&&t.currentTask.data[l];e&&r(s,N,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t{try{const o=e[m],r=n&&g===n[g];r&&(n[y]=o,n[E]=s);const a=t.run(i,void 0,r&&i!==d&&i!==f?[]:[o]);D(n,!0,a)}catch(e){D(n,!1,e)}},n)}const R="function ZoneAwarePromise() { [native code] }";class M{constructor(e){const t=this;if(!(t instanceof M))throw new Error("Must be an instanceof Promise.");t[_]=T,t[m]=[];try{e&&e(O(t,k),O(t,v))}catch(e){D(t,!1,e)}}static toString(){return R}static resolve(e){return D(new this(null),k,e)}static reject(e){return D(new this(null),v,e)}static race(e){let t,n,o=new this((e,o)=>{t=e,n=o});function r(e){t(e)}function s(e){n(e)}for(let t of e)h(t)||(t=this.resolve(t)),t.then(r,s);return o}static all(e){let t,n,o=new this((e,o)=>{t=e,n=o}),r=2,s=0;const i=[];for(let o of e){h(o)||(o=this.resolve(o));const e=s;o.then(n=>{i[e]=n,0===--r&&t(i)},n),r++,s++}return 0===(r-=2)&&t(i),o}get[Symbol.toStringTag](){return"Promise"}then(e,n){const o=new this.constructor(null),r=t.current;return this[_]==T?this[m].push(r,o,e,n):I(this,r,o,e,n),o}catch(e){return this.then(null,e)}finally(e){const n=new this.constructor(null);n[g]=g;const o=t.current;return this[_]==T?this[m].push(o,n,e,e):I(this,o,n,e,e),n}}M.resolve=M.resolve,M.reject=M.reject,M.race=M.race,M.all=M.all;const j=e[a]=e.Promise,C=t.__symbol__("ZoneAwarePromise");let L=o(e,"Promise");L&&!L.configurable||(L&&delete L.writable,L&&delete L.value,L||(L={configurable:!0,enumerable:!0}),L.get=function(){return e[C]?e[C]:e[a]},L.set=function(t){t===M?e[C]=t:(e[a]=t,t.prototype[c]||F(t),n.setNativePromise(t))},r(e,"Promise",L)),e.Promise=M;const A=s("thenPatched");function F(e){const t=e.prototype,n=o(t,"then");if(n&&(!1===n.writable||!n.configurable))return;const r=t.then;t[c]=r,e.prototype.then=function(e,t){return new M((e,t)=>{r.call(this,e,t)}).then(e,t)},e[A]=!0}if(n.patchThen=F,j){F(j);const t=e.fetch;"function"==typeof t&&(e[n.symbol("fetch")]=t,e.fetch=function(e){return function(){let t=e.apply(this,arguments);if(t instanceof M)return t;let n=t.constructor;return n[A]||F(n),t}}(t))}return Promise[t.__symbol__("uncaughtPromiseErrors")]=i,M});const ObjectGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,ObjectDefineProperty=Object.defineProperty,ObjectGetPrototypeOf=Object.getPrototypeOf,ObjectCreate=Object.create,ArraySlice=Array.prototype.slice,ADD_EVENT_LISTENER_STR="addEventListener",REMOVE_EVENT_LISTENER_STR="removeEventListener",ZONE_SYMBOL_ADD_EVENT_LISTENER=Zone.__symbol__(ADD_EVENT_LISTENER_STR),ZONE_SYMBOL_REMOVE_EVENT_LISTENER=Zone.__symbol__(REMOVE_EVENT_LISTENER_STR),TRUE_STR="true",FALSE_STR="false",ZONE_SYMBOL_PREFIX="__zone_symbol__";function wrapWithCurrentZone(e,t){return Zone.current.wrap(e,t)}function scheduleMacroTaskWithCurrentZone(e,t,n,o,r){return Zone.current.scheduleMacroTask(e,t,n,o,r)}const zoneSymbol=Zone.__symbol__,isWindowExists="undefined"!=typeof window,internalWindow=isWindowExists?window:void 0,_global=isWindowExists&&internalWindow||"object"==typeof self&&self||global,REMOVE_ATTRIBUTE="removeAttribute",NULL_ON_PROP_VALUE=[null];function bindArguments(e,t){for(let n=e.length-1;n>=0;n--)"function"==typeof e[n]&&(e[n]=wrapWithCurrentZone(e[n],t+"_"+n));return e}function patchPrototype(e,t){const n=e.constructor.name;for(let o=0;o{const t=function(){return e.apply(this,bindArguments(arguments,n+"."+r))};return attachOriginToPatched(t,e),t})(s)}}}function isPropertyWritable(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&void 0===e.set)}const isWebWorker="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,isNode=!("nw"in _global)&&void 0!==_global.process&&"[object process]"==={}.toString.call(_global.process),isBrowser=!isNode&&!isWebWorker&&!(!isWindowExists||!internalWindow.HTMLElement),isMix=void 0!==_global.process&&"[object process]"==={}.toString.call(_global.process)&&!isWebWorker&&!(!isWindowExists||!internalWindow.HTMLElement),zoneSymbolEventNames={},wrapFn=function(e){if(!(e=e||_global.event))return;let t=zoneSymbolEventNames[e.type];t||(t=zoneSymbolEventNames[e.type]=zoneSymbol("ON_PROPERTY"+e.type));const n=this||e.target||_global,o=n[t];let r;if(isBrowser&&n===internalWindow&&"error"===e.type){const t=e;!0===(r=o&&o.call(this,t.message,t.filename,t.lineno,t.colno,t.error))&&e.preventDefault()}else null==(r=o&&o.apply(this,arguments))||r||e.preventDefault();return r};function patchProperty(e,t,n){let o=ObjectGetOwnPropertyDescriptor(e,t);if(!o&&n){ObjectGetOwnPropertyDescriptor(n,t)&&(o={enumerable:!0,configurable:!0})}if(!o||!o.configurable)return;const r=zoneSymbol("on"+t+"patched");if(e.hasOwnProperty(r)&&e[r])return;delete o.writable,delete o.value;const s=o.get,i=o.set,a=t.substr(2);let c=zoneSymbolEventNames[a];c||(c=zoneSymbolEventNames[a]=zoneSymbol("ON_PROPERTY"+a)),o.set=function(t){let n=this;n||e!==_global||(n=_global),n&&(n[c]&&n.removeEventListener(a,wrapFn),i&&i.apply(n,NULL_ON_PROP_VALUE),"function"==typeof t?(n[c]=t,n.addEventListener(a,wrapFn,!1)):n[c]=null)},o.get=function(){let n=this;if(n||e!==_global||(n=_global),!n)return null;const r=n[c];if(r)return r;if(s){let e=s&&s.call(this);if(e)return o.set.call(this,e),"function"==typeof n[REMOVE_ATTRIBUTE]&&n.removeAttribute(t),e}return null},ObjectDefineProperty(e,t,o),e[r]=!0}function patchOnProperties(e,t,n){if(t)for(let o=0;o{const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){(!o||o.writable&&"function"==typeof o.set)&&(e[n]=t)},enumerable:!o||o.enumerable,configurable:!o||o.configurable})})}let shouldCopySymbolProperties=!1;function patchMethod(e,t,n){let o=e;for(;o&&!o.hasOwnProperty(t);)o=ObjectGetPrototypeOf(o);!o&&e[t]&&(o=e);const r=zoneSymbol(t);let s=null;if(o&&!(s=o[r])){if(s=o[r]=o[t],isPropertyWritable(o&&ObjectGetOwnPropertyDescriptor(o,t))){const e=n(s,r,t);o[t]=function(){return e(this,arguments)},attachOriginToPatched(o[t],s),shouldCopySymbolProperties&©SymbolProperties(s,o[t])}}return s}function patchMacroTask(e,t,n){let o=null;function r(e){const t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},o.apply(t.target,t.args),e}o=patchMethod(e,t,e=>(function(t,o){const s=n(t,o);return s.cbIdx>=0&&"function"==typeof o[s.cbIdx]?scheduleMacroTaskWithCurrentZone(s.name,o[s.cbIdx],s,r):e.apply(t,o)}))}function attachOriginToPatched(e,t){e[zoneSymbol("OriginalDelegate")]=t}let isDetectedIEOrEdge=!1,ieOrEdge=!1;function isIE(){try{const e=internalWindow.navigator.userAgent;if(-1!==e.indexOf("MSIE ")||-1!==e.indexOf("Trident/"))return!0}catch(e){}return!1}function isIEOrEdge(){if(isDetectedIEOrEdge)return ieOrEdge;isDetectedIEOrEdge=!0;try{const e=internalWindow.navigator.userAgent;-1===e.indexOf("MSIE ")&&-1===e.indexOf("Trident/")&&-1===e.indexOf("Edge/")||(ieOrEdge=!0)}catch(e){}return ieOrEdge}Zone.__load_patch("toString",e=>{const t=Function.prototype.toString,n=zoneSymbol("OriginalDelegate"),o=zoneSymbol("Promise"),r=zoneSymbol("Error"),s=function(){if("function"==typeof this){const s=this[n];if(s)return"function"==typeof s?t.call(s):Object.prototype.toString.call(s);if(this===Promise){const n=e[o];if(n)return t.call(n)}if(this===Error){const n=e[r];if(n)return t.call(n)}}return t.call(this)};s[n]=t,Function.prototype.toString=s;const i=Object.prototype.toString;Object.prototype.toString=function(){return this instanceof Promise?"[object Promise]":i.call(this)}});let passiveSupported=!1;if("undefined"!=typeof window)try{const e=Object.defineProperty({},"passive",{get:function(){passiveSupported=!0}});window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){passiveSupported=!1}const OPTIMIZED_ZONE_EVENT_TASK_DATA={useG:!0},zoneSymbolEventNames$1={},globalSources={},EVENT_NAME_SYMBOL_REGX=/^__zone_symbol__(\w+)(true|false)$/,IMMEDIATE_PROPAGATION_SYMBOL="__zone_symbol__propagationStopped";function patchEventTarget(e,t,n){const o=n&&n.add||ADD_EVENT_LISTENER_STR,r=n&&n.rm||REMOVE_EVENT_LISTENER_STR,s=n&&n.listeners||"eventListeners",i=n&&n.rmAll||"removeAllListeners",a=zoneSymbol(o),c="."+o+":",l="prependListener",u="."+l+":",p=function(e,t,n){if(e.isRemoved)return;const o=e.callback;"object"==typeof o&&o.handleEvent&&(e.callback=(e=>o.handleEvent(e)),e.originalDelegate=o),e.invoke(e,t,[n]);const s=e.options;if(s&&"object"==typeof s&&s.once){const o=e.originalDelegate?e.originalDelegate:e.callback;t[r].call(t,n.type,o,s)}},h=function(t){if(!(t=t||e.event))return;const n=this||t.target||e,o=n[zoneSymbolEventNames$1[t.type][FALSE_STR]];if(o)if(1===o.length)p(o[0],n,t);else{const e=o.slice();for(let o=0;o(function(t,n){t[IMMEDIATE_PROPAGATION_SYMBOL]=!0,e&&e.apply(t,n)}))}function patchCallbacks(e,t,n,o,r){const s=Zone.__symbol__(o);if(t[s])return;const i=t[s]=t[o];t[o]=function(s,a,c){return a&&a.prototype&&r.forEach(function(t){const r=`${n}.${o}::`+t,s=a.prototype;if(s.hasOwnProperty(t)){const n=e.ObjectGetOwnPropertyDescriptor(s,t);n&&n.value?(n.value=e.wrapWithCurrentZone(n.value,r),e._redefineProperty(a.prototype,t,n)):s[t]&&(s[t]=e.wrapWithCurrentZone(s[t],r))}else s[t]&&(s[t]=e.wrapWithCurrentZone(s[t],r))}),i.call(t,s,a,c)},e.attachOriginToPatched(t[o],i)}const zoneSymbol$1=Zone.__symbol__,_defineProperty=Object[zoneSymbol$1("defineProperty")]=Object.defineProperty,_getOwnPropertyDescriptor=Object[zoneSymbol$1("getOwnPropertyDescriptor")]=Object.getOwnPropertyDescriptor,_create=Object.create,unconfigurablesKey=zoneSymbol$1("unconfigurables");function propertyPatch(){Object.defineProperty=function(e,t,n){if(isUnconfigurable(e,t))throw new TypeError("Cannot assign to read only property '"+t+"' of "+e);const o=n.configurable;return"prototype"!==t&&(n=rewriteDescriptor(e,t,n)),_tryDefineProperty(e,t,n,o)},Object.defineProperties=function(e,t){return Object.keys(t).forEach(function(n){Object.defineProperty(e,n,t[n])}),e},Object.create=function(e,t){return"object"!=typeof t||Object.isFrozen(t)||Object.keys(t).forEach(function(n){t[n]=rewriteDescriptor(e,n,t[n])}),_create(e,t)},Object.getOwnPropertyDescriptor=function(e,t){const n=_getOwnPropertyDescriptor(e,t);return n&&isUnconfigurable(e,t)&&(n.configurable=!1),n}}function _redefineProperty(e,t,n){const o=n.configurable;return _tryDefineProperty(e,t,n=rewriteDescriptor(e,t,n),o)}function isUnconfigurable(e,t){return e&&e[unconfigurablesKey]&&e[unconfigurablesKey][t]}function rewriteDescriptor(e,t,n){return Object.isFrozen(n)||(n.configurable=!0),n.configurable||(e[unconfigurablesKey]||Object.isFrozen(e)||_defineProperty(e,unconfigurablesKey,{writable:!0,value:{}}),e[unconfigurablesKey]&&(e[unconfigurablesKey][t]=!0)),n}function _tryDefineProperty(e,t,n,o){try{return _defineProperty(e,t,n)}catch(r){if(!n.configurable)throw r;void 0===o?delete n.configurable:n.configurable=o;try{return _defineProperty(e,t,n)}catch(o){let r=null;try{r=JSON.stringify(n)}catch(e){r=n.toString()}console.log(`Attempting to configure '${t}' with descriptor '${r}' on object '${e}' and got error, giving up: ${o}`)}}}const globalEventHandlersEventNames=["abort","animationcancel","animationend","animationiteration","auxclick","beforeinput","blur","cancel","canplay","canplaythrough","change","compositionstart","compositionupdate","compositionend","cuechange","click","close","contextmenu","curechange","dblclick","drag","dragend","dragenter","dragexit","dragleave","dragover","drop","durationchange","emptied","ended","error","focus","focusin","focusout","gotpointercapture","input","invalid","keydown","keypress","keyup","load","loadstart","loadeddata","loadedmetadata","lostpointercapture","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","orientationchange","pause","play","playing","pointercancel","pointerdown","pointerenter","pointerleave","pointerlockchange","mozpointerlockchange","webkitpointerlockerchange","pointerlockerror","mozpointerlockerror","webkitpointerlockerror","pointermove","pointout","pointerover","pointerup","progress","ratechange","reset","resize","scroll","seeked","seeking","select","selectionchange","selectstart","show","sort","stalled","submit","suspend","timeupdate","volumechange","touchcancel","touchmove","touchstart","touchend","transitioncancel","transitionend","waiting","wheel"],documentEventNames=["afterscriptexecute","beforescriptexecute","DOMContentLoaded","freeze","fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange","fullscreenerror","mozfullscreenerror","webkitfullscreenerror","msfullscreenerror","readystatechange","visibilitychange","resume"],windowEventNames=["absolutedeviceorientation","afterinput","afterprint","appinstalled","beforeinstallprompt","beforeprint","beforeunload","devicelight","devicemotion","deviceorientation","deviceorientationabsolute","deviceproximity","hashchange","languagechange","message","mozbeforepaint","offline","online","paint","pageshow","pagehide","popstate","rejectionhandled","storage","unhandledrejection","unload","userproximity","vrdisplyconnected","vrdisplaydisconnected","vrdisplaypresentchange"],htmlElementEventNames=["beforecopy","beforecut","beforepaste","copy","cut","paste","dragstart","loadend","animationstart","search","transitionrun","transitionstart","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend"],mediaElementEventNames=["encrypted","waitingforkey","msneedkey","mozinterruptbegin","mozinterruptend"],ieElementEventNames=["activate","afterupdate","ariarequest","beforeactivate","beforedeactivate","beforeeditfocus","beforeupdate","cellchange","controlselect","dataavailable","datasetchanged","datasetcomplete","errorupdate","filterchange","layoutcomplete","losecapture","move","moveend","movestart","propertychange","resizeend","resizestart","rowenter","rowexit","rowsdelete","rowsinserted","command","compassneedscalibration","deactivate","help","mscontentzoom","msmanipulationstatechanged","msgesturechange","msgesturedoubletap","msgestureend","msgesturehold","msgesturestart","msgesturetap","msgotpointercapture","msinertiastart","mslostpointercapture","mspointercancel","mspointerdown","mspointerenter","mspointerhover","mspointerleave","mspointermove","mspointerout","mspointerover","mspointerup","pointerout","mssitemodejumplistitemremoved","msthumbnailclick","stop","storagecommit"],webglEventNames=["webglcontextrestored","webglcontextlost","webglcontextcreationerror"],formEventNames=["autocomplete","autocompleteerror"],detailEventNames=["toggle"],frameEventNames=["load"],frameSetEventNames=["blur","error","focus","load","resize","scroll","messageerror"],marqueeEventNames=["bounce","finish","start"],XMLHttpRequestEventNames=["loadstart","progress","abort","error","load","progress","timeout","loadend","readystatechange"],IDBIndexEventNames=["upgradeneeded","complete","abort","success","error","blocked","versionchange","close"],websocketEventNames=["close","error","open","message"],workerEventNames=["error","message"],eventNames=globalEventHandlersEventNames.concat(webglEventNames,formEventNames,detailEventNames,documentEventNames,windowEventNames,htmlElementEventNames,ieElementEventNames);function filterProperties(e,t,n){if(!n||0===n.length)return t;const o=n.filter(t=>t.target===e);if(!o||0===o.length)return t;const r=o[0].ignoreProperties;return t.filter(e=>-1===r.indexOf(e))}function patchFilteredProperties(e,t,n,o){if(!e)return;patchOnProperties(e,filterProperties(e,t,n),o)}function propertyDescriptorPatch(e,t){if(isNode&&!isMix)return;if(Zone[e.symbol("patchEvents")])return;const n="undefined"!=typeof WebSocket,o=t.__Zone_ignore_on_properties;if(isBrowser){const e=window,t=isIE?[{target:e,ignoreProperties:["error"]}]:[];patchFilteredProperties(e,eventNames.concat(["messageerror"]),o?o.concat(t):o,ObjectGetPrototypeOf(e)),patchFilteredProperties(Document.prototype,eventNames,o),void 0!==e.SVGElement&&patchFilteredProperties(e.SVGElement.prototype,eventNames,o),patchFilteredProperties(Element.prototype,eventNames,o),patchFilteredProperties(HTMLElement.prototype,eventNames,o),patchFilteredProperties(HTMLMediaElement.prototype,mediaElementEventNames,o),patchFilteredProperties(HTMLFrameSetElement.prototype,windowEventNames.concat(frameSetEventNames),o),patchFilteredProperties(HTMLBodyElement.prototype,windowEventNames.concat(frameSetEventNames),o),patchFilteredProperties(HTMLFrameElement.prototype,frameEventNames,o),patchFilteredProperties(HTMLIFrameElement.prototype,frameEventNames,o);const n=e.HTMLMarqueeElement;n&&patchFilteredProperties(n.prototype,marqueeEventNames,o);const r=e.Worker;r&&patchFilteredProperties(r.prototype,workerEventNames,o)}patchFilteredProperties(XMLHttpRequest.prototype,XMLHttpRequestEventNames,o);const r=t.XMLHttpRequestEventTarget;r&&patchFilteredProperties(r&&r.prototype,XMLHttpRequestEventNames,o),"undefined"!=typeof IDBIndex&&(patchFilteredProperties(IDBIndex.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBRequest.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBOpenDBRequest.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBDatabase.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBTransaction.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBCursor.prototype,IDBIndexEventNames,o)),n&&patchFilteredProperties(WebSocket.prototype,websocketEventNames,o)}Zone.__load_patch("util",(e,t,n)=>{n.patchOnProperties=patchOnProperties,n.patchMethod=patchMethod,n.bindArguments=bindArguments,n.patchMacroTask=patchMacroTask;const o=t.__symbol__("BLACK_LISTED_EVENTS"),r=t.__symbol__("UNPATCHED_EVENTS");e[r]&&(e[o]=e[r]),e[o]&&(t[o]=t[r]=e[o]),n.patchEventPrototype=patchEventPrototype,n.patchEventTarget=patchEventTarget,n.isIEOrEdge=isIEOrEdge,n.ObjectDefineProperty=ObjectDefineProperty,n.ObjectGetOwnPropertyDescriptor=ObjectGetOwnPropertyDescriptor,n.ObjectCreate=ObjectCreate,n.ArraySlice=ArraySlice,n.patchClass=patchClass,n.wrapWithCurrentZone=wrapWithCurrentZone,n.filterProperties=filterProperties,n.attachOriginToPatched=attachOriginToPatched,n._redefineProperty=_redefineProperty,n.patchCallbacks=patchCallbacks,n.getGlobalObjects=(()=>({globalSources,zoneSymbolEventNames:zoneSymbolEventNames$1,eventNames,isBrowser,isMix,isNode,TRUE_STR,FALSE_STR,ZONE_SYMBOL_PREFIX,ADD_EVENT_LISTENER_STR,REMOVE_EVENT_LISTENER_STR}))});const taskSymbol=zoneSymbol("zoneTask");function patchTimer(e,t,n,o){let r=null,s=null;n+=o;const i={};function a(t){const n=t.data;return n.args[0]=function(){try{t.invoke.apply(this,arguments)}finally{t.data&&t.data.isPeriodic||("number"==typeof n.handleId?delete i[n.handleId]:n.handleId&&(n.handleId[taskSymbol]=null))}},n.handleId=r.apply(e,n.args),t}function c(e){return s(e.data.handleId)}r=patchMethod(e,t+=o,n=>(function(r,s){if("function"==typeof s[0]){const e={isPeriodic:"Interval"===o,delay:"Timeout"===o||"Interval"===o?s[1]||0:void 0,args:s},n=scheduleMacroTaskWithCurrentZone(t,s[0],e,a,c);if(!n)return n;const r=n.data.handleId;return"number"==typeof r?i[r]=n:r&&(r[taskSymbol]=n),r&&r.ref&&r.unref&&"function"==typeof r.ref&&"function"==typeof r.unref&&(n.ref=r.ref.bind(r),n.unref=r.unref.bind(r)),"number"==typeof r||r?r:n}return n.apply(e,s)})),s=patchMethod(e,n,t=>(function(n,o){const r=o[0];let s;"number"==typeof r?s=i[r]:(s=r&&r[taskSymbol])||(s=r),s&&"string"==typeof s.type?"notScheduled"!==s.state&&(s.cancelFn&&s.data.isPeriodic||0===s.runCount)&&("number"==typeof r?delete i[r]:r&&(r[taskSymbol]=null),s.zone.cancelTask(s)):t.apply(e,o)}))}function patchCustomElements(e,t){const{isBrowser:n,isMix:o}=t.getGlobalObjects();if(!n&&!o||!("customElements"in e))return;t.patchCallbacks(t,e.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback"])}function eventTargetPatch(e,t){const{eventNames:n,zoneSymbolEventNames:o,TRUE_STR:r,FALSE_STR:s,ZONE_SYMBOL_PREFIX:i}=t.getGlobalObjects();for(let e=0;e{const t=e[Zone.__symbol__("legacyPatch")];t&&t()}),Zone.__load_patch("timers",e=>{patchTimer(e,"set","clear","Timeout"),patchTimer(e,"set","clear","Interval"),patchTimer(e,"set","clear","Immediate")}),Zone.__load_patch("requestAnimationFrame",e=>{patchTimer(e,"request","cancel","AnimationFrame"),patchTimer(e,"mozRequest","mozCancel","AnimationFrame"),patchTimer(e,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",(e,t)=>{const n=["alert","prompt","confirm"];for(let o=0;o(function(o,s){return t.current.run(n,e,s,r)}))}}),Zone.__load_patch("EventTarget",(e,t,n)=>{patchEvent(e,n),eventTargetPatch(e,n);const o=e.XMLHttpRequestEventTarget;o&&o.prototype&&n.patchEventTarget(e,[o.prototype]),patchClass("MutationObserver"),patchClass("WebKitMutationObserver"),patchClass("IntersectionObserver"),patchClass("FileReader")}),Zone.__load_patch("on_property",(e,t,n)=>{propertyDescriptorPatch(n,e),propertyPatch()}),Zone.__load_patch("customElements",(e,t,n)=>{patchCustomElements(e,n)}),Zone.__load_patch("XHR",(e,t)=>{!function(e){const c=XMLHttpRequest.prototype;let l=c[ZONE_SYMBOL_ADD_EVENT_LISTENER],u=c[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];if(!l){const t=e.XMLHttpRequestEventTarget;if(t){const e=t.prototype;l=e[ZONE_SYMBOL_ADD_EVENT_LISTENER],u=e[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]}}const p="readystatechange",h="scheduled";function f(e){const t=e.data,o=t.target;o[s]=!1,o[a]=!1;const i=o[r];l||(l=o[ZONE_SYMBOL_ADD_EVENT_LISTENER],u=o[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]),i&&u.call(o,p,i);const c=o[r]=(()=>{if(o.readyState===o.DONE)if(!t.aborted&&o[s]&&e.state===h){const n=o.__zone_symbol__loadfalse;if(n&&n.length>0){const r=e.invoke;e.invoke=function(){const n=o.__zone_symbol__loadfalse;for(let t=0;t(function(e,t){return e[o]=0==t[2],e[i]=t[1],m.apply(e,t)})),g=zoneSymbol("fetchTaskAborting"),y=zoneSymbol("fetchTaskScheduling"),E=patchMethod(c,"send",()=>(function(e,n){if(!0===t.current[y])return E.apply(e,n);if(e[o])return E.apply(e,n);{const t={target:e,url:e[i],isPeriodic:!1,args:n,aborted:!1},o=scheduleMacroTaskWithCurrentZone("XMLHttpRequest.send",d,t,f,_);e&&!0===e[a]&&!t.aborted&&o.state===h&&o.invoke()}})),b=patchMethod(c,"abort",()=>(function(e,o){const r=e[n];if(r&&"string"==typeof r.type){if(null==r.cancelFn||r.data&&r.data.aborted)return;r.zone.cancelTask(r)}else if(!0===t.current[g])return b.apply(e,o)}))}(e);const n=zoneSymbol("xhrTask"),o=zoneSymbol("xhrSync"),r=zoneSymbol("xhrListener"),s=zoneSymbol("xhrScheduled"),i=zoneSymbol("xhrURL"),a=zoneSymbol("xhrErrorBeforeScheduled")}),Zone.__load_patch("geolocation",e=>{e.navigator&&e.navigator.geolocation&&patchPrototype(e.navigator.geolocation,["getCurrentPosition","watchPosition"])}),Zone.__load_patch("PromiseRejectionEvent",(e,t)=>{function n(t){return function(n){findEventTasks(e,t).forEach(o=>{const r=e.PromiseRejectionEvent;if(r){const e=new r(t,{promise:n.promise,reason:n.rejection});o.invoke(e)}})}}e.PromiseRejectionEvent&&(t[zoneSymbol("unhandledPromiseRejectionHandler")]=n("unhandledrejection"),t[zoneSymbol("rejectionHandledHandler")]=n("rejectionhandled"))}); \ No newline at end of file +const Zone$1=function(e){const t=e.performance;function n(e){t&&t.mark&&t.mark(e)}function o(e,n){t&&t.measure&&t.measure(e,n)}n("Zone");const r=!0===e.__zone_symbol__forceDuplicateZoneCheck;if(e.Zone){if(r||"function"!=typeof e.Zone.__symbol__)throw new Error("Zone already loaded.");return e.Zone}class s{constructor(e,t){this._parent=e,this._name=t?t.name||"unnamed":"",this._properties=t&&t.properties||{},this._zoneDelegate=new a(this,this._parent&&this._parent._zoneDelegate,t)}static assertZonePatched(){if(e.Promise!==P.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.)")}static get root(){let e=s.current;for(;e.parent;)e=e.parent;return e}static get current(){return D.zone}static get currentTask(){return z}static __load_patch(t,i){if(P.hasOwnProperty(t)){if(r)throw Error("Already loaded patch: "+t)}else if(!e["__Zone_disable_"+t]){const r="Zone:"+t;n(r),P[t]=i(e,s,N),o(r,r)}}get parent(){return this._parent}get name(){return this._name}get(e){const t=this.getZoneWith(e);if(t)return t._properties[e]}getZoneWith(e){let t=this;for(;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null}fork(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)}wrap(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);const n=this._zoneDelegate.intercept(this,e,t),o=this;return function(){return o.runGuarded(n,this,arguments,t)}}run(e,t,n,o){D={parent:D,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,o)}finally{D=D.parent}}runGuarded(e,t=null,n,o){D={parent:D,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,o)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{D=D.parent}}runTask(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");if(e.state===y&&(e.type===w||e.type===O))return;const o=e.state!=T;o&&e._transitionTo(T,b),e.runCount++;const r=z;z=e,D={parent:D,zone:this};try{e.type==O&&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!==y&&e.state!==v&&(e.type==w||e.data&&e.data.isPeriodic?o&&e._transitionTo(b,T):(e.runCount=0,this._updateTaskCount(e,-1),o&&e._transitionTo(y,T,y))),D=D.parent,z=r}}scheduleTask(e){if(e.zone&&e.zone!==this){let t=this;for(;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(E,y);const t=[];e._zoneDelegates=t,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(v,E,y),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===t&&this._updateTaskCount(e,1),e.state==E&&e._transitionTo(b,E),e}scheduleMicroTask(e,t,n,o){return this.scheduleTask(new c(S,e,t,n,o,void 0))}scheduleMacroTask(e,t,n,o,r){return this.scheduleTask(new c(O,e,t,n,o,r))}scheduleEventTask(e,t,n,o,r){return this.scheduleTask(new c(w,e,t,n,o,r))}cancelTask(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");e._transitionTo(k,b,T);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(v,k),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(y,k),e.runCount=0,e}_updateTaskCount(e,t){const n=e._zoneDelegates;-1==t&&(e._zoneDelegates=null);for(let o=0;oe.hasTask(n,o),onScheduleTask:(e,t,n,o)=>e.scheduleTask(n,o),onInvokeTask:(e,t,n,o,r,s)=>e.invokeTask(n,o,r,s),onCancelTask:(e,t,n,o)=>e.cancelTask(n,o)};class a{constructor(e,t,n){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=e,this._parentDelegate=t,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this.zone:t.zone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this.zone:t.zone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this.zone:t.zone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this.zone:t.zone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this.zone:t.zone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this.zone:t.zone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this.zone:t.zone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;const o=n&&n.onHasTask,r=t&&t._hasTaskZS;(o||r)&&(this._hasTaskZS=o?n:i,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=e,n.onScheduleTask||(this._scheduleTaskZS=i,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this.zone),n.onInvokeTask||(this._invokeTaskZS=i,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this.zone),n.onCancelTask||(this._cancelTaskZS=i,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this.zone))}fork(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new s(e,t)}intercept(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t}invoke(e,t,n,o,r){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,o,r):t.apply(n,o)}handleError(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t)}scheduleTask(e,t){let n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),(n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t))||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else{if(t.type!=S)throw new Error("Task is missing scheduleFn.");_(t)}return n}invokeTask(e,t,n,o){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,o):t.callback.apply(n,o)}cancelTask(e,t){let n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error("Task is not cancelable");n=t.cancelFn(t)}return n}hasTask(e,t){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(t){this.handleError(e,t)}}_updateTaskCount(e,t){const n=this._taskCounts,o=n[e],r=n[e]=o+t;if(r<0)throw new Error("More tasks executed then were scheduled.");if(0==o||0==r){const t={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this.zone,t)}}}class c{constructor(t,n,o,r,s,i){this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=t,this.source=n,this.data=r,this.scheduleFn=s,this.cancelFn=i,this.callback=o;const a=this;t===w&&r&&r.useG?this.invoke=c.invokeTask:this.invoke=function(){return c.invokeTask.call(e,a,this,arguments)}}static invokeTask(e,t,n){e||(e=this),Z++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==Z&&m(),Z--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(y,E)}_transitionTo(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==y&&(this._zoneDelegates=null)}toString(){return this.data&&void 0!==this.data.handleId?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}const l=R("setTimeout"),u=R("Promise"),p=R("then");let h,f=[],d=!1;function _(t){if(0===Z&&0===f.length)if(h||e[u]&&(h=e[u].resolve(0)),h){let e=h[p];e||(e=h.then),e.call(h,m)}else e[l](m,0);t&&f.push(t)}function m(){if(!d){for(d=!0;f.length;){const e=f;f=[];for(let t=0;tD,onUnhandledError:I,microtaskDrainDone:I,scheduleMicroTask:_,showUncaughtError:()=>!s[R("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:I,patchMethod:()=>I,bindArguments:()=>[],patchThen:()=>I,patchMacroTask:()=>I,setNativePromise:e=>{e&&"function"==typeof e.resolve&&(h=e.resolve(0))},patchEventPrototype:()=>I,isIEOrEdge:()=>!1,getGlobalObjects:()=>void 0,ObjectDefineProperty:()=>I,ObjectGetOwnPropertyDescriptor:()=>void 0,ObjectCreate:()=>void 0,ArraySlice:()=>[],patchClass:()=>I,wrapWithCurrentZone:()=>I,filterProperties:()=>[],attachOriginToPatched:()=>I,_redefineProperty:()=>I,patchCallbacks:()=>I};let D={parent:null,zone:new s(null,null)},z=null,Z=0;function I(){}function R(e){return"__zone_symbol__"+e}return o("Zone","Zone"),e.Zone=s}("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global);Zone.__load_patch("ZoneAwarePromise",(e,t,n)=>{const o=Object.getOwnPropertyDescriptor,r=Object.defineProperty;const s=n.symbol,i=[],a=s("Promise"),c=s("then"),l="__creationTrace__";n.onUnhandledError=(e=>{if(n.showUncaughtError()){const 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=(()=>{for(;i.length;)for(;i.length;){const e=i.shift();try{e.zone.runGuarded(()=>{throw e})}catch(e){p(e)}}});const u=s("unhandledPromiseRejectionHandler");function p(e){n.onUnhandledError(e);try{const n=t[u];n&&"function"==typeof n&&n.call(this,e)}catch(e){}}function h(e){return e&&e.then}function f(e){return e}function d(e){return M.reject(e)}const _=s("state"),m=s("value"),g=s("finally"),y=s("parentPromiseValue"),E=s("parentPromiseState"),b="Promise.then",T=null,k=!0,v=!1,S=0;function O(e,t){return n=>{try{D(e,t,n)}catch(t){D(e,!1,t)}}}const w=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},P="Promise resolved with itself",N=s("currentTaskTrace");function D(e,o,s){const a=w();if(e===s)throw new TypeError(P);if(e[_]===T){let c=null;try{"object"!=typeof s&&"function"!=typeof s||(c=s&&s.then)}catch(t){return a(()=>{D(e,!1,t)})(),e}if(o!==v&&s instanceof M&&s.hasOwnProperty(_)&&s.hasOwnProperty(m)&&s[_]!==T)Z(s),D(e,s[_],s[m]);else if(o!==v&&"function"==typeof c)try{c.call(s,a(O(e,o)),a(O(e,!1)))}catch(t){a(()=>{D(e,!1,t)})()}else{e[_]=o;const a=e[m];if(e[m]=s,e[g]===g&&o===k&&(e[_]=e[E],e[m]=e[y]),o===v&&s instanceof Error){const e=t.currentTask&&t.currentTask.data&&t.currentTask.data[l];e&&r(s,N,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t{try{const o=e[m],r=n&&g===n[g];r&&(n[y]=o,n[E]=s);const a=t.run(i,void 0,r&&i!==d&&i!==f?[]:[o]);D(n,!0,a)}catch(e){D(n,!1,e)}},n)}const R="function ZoneAwarePromise() { [native code] }";class M{constructor(e){const t=this;if(!(t instanceof M))throw new Error("Must be an instanceof Promise.");t[_]=T,t[m]=[];try{e&&e(O(t,k),O(t,v))}catch(e){D(t,!1,e)}}static toString(){return R}static resolve(e){return D(new this(null),k,e)}static reject(e){return D(new this(null),v,e)}static race(e){let t,n,o=new this((e,o)=>{t=e,n=o});function r(e){t(e)}function s(e){n(e)}for(let t of e)h(t)||(t=this.resolve(t)),t.then(r,s);return o}static all(e){let t,n,o=new this((e,o)=>{t=e,n=o}),r=2,s=0;const i=[];for(let o of e){h(o)||(o=this.resolve(o));const e=s;o.then(n=>{i[e]=n,0===--r&&t(i)},n),r++,s++}return 0===(r-=2)&&t(i),o}get[Symbol.toStringTag](){return"Promise"}then(e,n){const o=new this.constructor(null),r=t.current;return this[_]==T?this[m].push(r,o,e,n):I(this,r,o,e,n),o}catch(e){return this.then(null,e)}finally(e){const n=new this.constructor(null);n[g]=g;const o=t.current;return this[_]==T?this[m].push(o,n,e,e):I(this,o,n,e,e),n}}M.resolve=M.resolve,M.reject=M.reject,M.race=M.race,M.all=M.all;const j=e[a]=e.Promise,C=t.__symbol__("ZoneAwarePromise");let L=o(e,"Promise");L&&!L.configurable||(L&&delete L.writable,L&&delete L.value,L||(L={configurable:!0,enumerable:!0}),L.get=function(){return e[C]?e[C]:e[a]},L.set=function(t){t===M?e[C]=t:(e[a]=t,t.prototype[c]||F(t),n.setNativePromise(t))},r(e,"Promise",L)),e.Promise=M;const A=s("thenPatched");function F(e){const t=e.prototype,n=o(t,"then");if(n&&(!1===n.writable||!n.configurable))return;const r=t.then;t[c]=r,e.prototype.then=function(e,t){return new M((e,t)=>{r.call(this,e,t)}).then(e,t)},e[A]=!0}if(n.patchThen=F,j){F(j);const t=e.fetch;"function"==typeof t&&(e[n.symbol("fetch")]=t,e.fetch=function(e){return function(){let t=e.apply(this,arguments);if(t instanceof M)return t;let n=t.constructor;return n[A]||F(n),t}}(t))}return Promise[t.__symbol__("uncaughtPromiseErrors")]=i,M});const ObjectGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,ObjectDefineProperty=Object.defineProperty,ObjectGetPrototypeOf=Object.getPrototypeOf,ObjectCreate=Object.create,ArraySlice=Array.prototype.slice,ADD_EVENT_LISTENER_STR="addEventListener",REMOVE_EVENT_LISTENER_STR="removeEventListener",ZONE_SYMBOL_ADD_EVENT_LISTENER=Zone.__symbol__(ADD_EVENT_LISTENER_STR),ZONE_SYMBOL_REMOVE_EVENT_LISTENER=Zone.__symbol__(REMOVE_EVENT_LISTENER_STR),TRUE_STR="true",FALSE_STR="false",ZONE_SYMBOL_PREFIX="__zone_symbol__";function wrapWithCurrentZone(e,t){return Zone.current.wrap(e,t)}function scheduleMacroTaskWithCurrentZone(e,t,n,o,r){return Zone.current.scheduleMacroTask(e,t,n,o,r)}const zoneSymbol=Zone.__symbol__,isWindowExists="undefined"!=typeof window,internalWindow=isWindowExists?window:void 0,_global=isWindowExists&&internalWindow||"object"==typeof self&&self||global,REMOVE_ATTRIBUTE="removeAttribute",NULL_ON_PROP_VALUE=[null];function bindArguments(e,t){for(let n=e.length-1;n>=0;n--)"function"==typeof e[n]&&(e[n]=wrapWithCurrentZone(e[n],t+"_"+n));return e}function patchPrototype(e,t){const n=e.constructor.name;for(let o=0;o{const t=function(){return e.apply(this,bindArguments(arguments,n+"."+r))};return attachOriginToPatched(t,e),t})(s)}}}function isPropertyWritable(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&void 0===e.set)}const isWebWorker="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,isNode=!("nw"in _global)&&void 0!==_global.process&&"[object process]"==={}.toString.call(_global.process),isBrowser=!isNode&&!isWebWorker&&!(!isWindowExists||!internalWindow.HTMLElement),isMix=void 0!==_global.process&&"[object process]"==={}.toString.call(_global.process)&&!isWebWorker&&!(!isWindowExists||!internalWindow.HTMLElement),zoneSymbolEventNames={},wrapFn=function(e){if(!(e=e||_global.event))return;let t=zoneSymbolEventNames[e.type];t||(t=zoneSymbolEventNames[e.type]=zoneSymbol("ON_PROPERTY"+e.type));const n=this||e.target||_global,o=n[t];let r;if(isBrowser&&n===internalWindow&&"error"===e.type){const t=e;!0===(r=o&&o.call(this,t.message,t.filename,t.lineno,t.colno,t.error))&&e.preventDefault()}else null==(r=o&&o.apply(this,arguments))||r||e.preventDefault();return r};function patchProperty(e,t,n){let o=ObjectGetOwnPropertyDescriptor(e,t);if(!o&&n){ObjectGetOwnPropertyDescriptor(n,t)&&(o={enumerable:!0,configurable:!0})}if(!o||!o.configurable)return;const r=zoneSymbol("on"+t+"patched");if(e.hasOwnProperty(r)&&e[r])return;delete o.writable,delete o.value;const s=o.get,i=o.set,a=t.substr(2);let c=zoneSymbolEventNames[a];c||(c=zoneSymbolEventNames[a]=zoneSymbol("ON_PROPERTY"+a)),o.set=function(t){let n=this;n||e!==_global||(n=_global),n&&(n[c]&&n.removeEventListener(a,wrapFn),i&&i.apply(n,NULL_ON_PROP_VALUE),"function"==typeof t?(n[c]=t,n.addEventListener(a,wrapFn,!1)):n[c]=null)},o.get=function(){let n=this;if(n||e!==_global||(n=_global),!n)return null;const r=n[c];if(r)return r;if(s){let e=s&&s.call(this);if(e)return o.set.call(this,e),"function"==typeof n[REMOVE_ATTRIBUTE]&&n.removeAttribute(t),e}return null},ObjectDefineProperty(e,t,o),e[r]=!0}function patchOnProperties(e,t,n){if(t)for(let o=0;o{const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){(!o||o.writable&&"function"==typeof o.set)&&(e[n]=t)},enumerable:!o||o.enumerable,configurable:!o||o.configurable})})}let shouldCopySymbolProperties=!1;function patchMethod(e,t,n){let o=e;for(;o&&!o.hasOwnProperty(t);)o=ObjectGetPrototypeOf(o);!o&&e[t]&&(o=e);const r=zoneSymbol(t);let s=null;if(o&&!(s=o[r])){if(s=o[r]=o[t],isPropertyWritable(o&&ObjectGetOwnPropertyDescriptor(o,t))){const e=n(s,r,t);o[t]=function(){return e(this,arguments)},attachOriginToPatched(o[t],s),shouldCopySymbolProperties&©SymbolProperties(s,o[t])}}return s}function patchMacroTask(e,t,n){let o=null;function r(e){const t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},o.apply(t.target,t.args),e}o=patchMethod(e,t,e=>(function(t,o){const s=n(t,o);return s.cbIdx>=0&&"function"==typeof o[s.cbIdx]?scheduleMacroTaskWithCurrentZone(s.name,o[s.cbIdx],s,r):e.apply(t,o)}))}function attachOriginToPatched(e,t){e[zoneSymbol("OriginalDelegate")]=t}let isDetectedIEOrEdge=!1,ieOrEdge=!1;function isIE(){try{const e=internalWindow.navigator.userAgent;if(-1!==e.indexOf("MSIE ")||-1!==e.indexOf("Trident/"))return!0}catch(e){}return!1}function isIEOrEdge(){if(isDetectedIEOrEdge)return ieOrEdge;isDetectedIEOrEdge=!0;try{const e=internalWindow.navigator.userAgent;-1===e.indexOf("MSIE ")&&-1===e.indexOf("Trident/")&&-1===e.indexOf("Edge/")||(ieOrEdge=!0)}catch(e){}return ieOrEdge}Zone.__load_patch("toString",e=>{const t=Function.prototype.toString,n=zoneSymbol("OriginalDelegate"),o=zoneSymbol("Promise"),r=zoneSymbol("Error"),s=function(){if("function"==typeof this){const s=this[n];if(s)return"function"==typeof s?t.call(s):Object.prototype.toString.call(s);if(this===Promise){const n=e[o];if(n)return t.call(n)}if(this===Error){const n=e[r];if(n)return t.call(n)}}return t.call(this)};s[n]=t,Function.prototype.toString=s;const i=Object.prototype.toString;Object.prototype.toString=function(){return this instanceof Promise?"[object Promise]":i.call(this)}});let passiveSupported=!1;if("undefined"!=typeof window)try{const e=Object.defineProperty({},"passive",{get:function(){passiveSupported=!0}});window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){passiveSupported=!1}const OPTIMIZED_ZONE_EVENT_TASK_DATA={useG:!0},zoneSymbolEventNames$1={},globalSources={},EVENT_NAME_SYMBOL_REGX=/^__zone_symbol__(\w+)(true|false)$/,IMMEDIATE_PROPAGATION_SYMBOL="__zone_symbol__propagationStopped";function patchEventTarget(e,t,n){const o=n&&n.add||ADD_EVENT_LISTENER_STR,r=n&&n.rm||REMOVE_EVENT_LISTENER_STR,s=n&&n.listeners||"eventListeners",i=n&&n.rmAll||"removeAllListeners",a=zoneSymbol(o),c="."+o+":",l="prependListener",u="."+l+":",p=function(e,t,n){if(e.isRemoved)return;const o=e.callback;"object"==typeof o&&o.handleEvent&&(e.callback=(e=>o.handleEvent(e)),e.originalDelegate=o),e.invoke(e,t,[n]);const s=e.options;if(s&&"object"==typeof s&&s.once){const o=e.originalDelegate?e.originalDelegate:e.callback;t[r].call(t,n.type,o,s)}},h=function(t){if(!(t=t||e.event))return;const n=this||t.target||e,o=n[zoneSymbolEventNames$1[t.type][FALSE_STR]];if(o)if(1===o.length)p(o[0],n,t);else{const e=o.slice();for(let o=0;o(function(t,n){t[IMMEDIATE_PROPAGATION_SYMBOL]=!0,e&&e.apply(t,n)}))}function patchCallbacks(e,t,n,o,r){const s=Zone.__symbol__(o);if(t[s])return;const i=t[s]=t[o];t[o]=function(s,a,c){return a&&a.prototype&&r.forEach(function(t){const r=`${n}.${o}::`+t,s=a.prototype;if(s.hasOwnProperty(t)){const n=e.ObjectGetOwnPropertyDescriptor(s,t);n&&n.value?(n.value=e.wrapWithCurrentZone(n.value,r),e._redefineProperty(a.prototype,t,n)):s[t]&&(s[t]=e.wrapWithCurrentZone(s[t],r))}else s[t]&&(s[t]=e.wrapWithCurrentZone(s[t],r))}),i.call(t,s,a,c)},e.attachOriginToPatched(t[o],i)}const zoneSymbol$1=Zone.__symbol__,_defineProperty=Object[zoneSymbol$1("defineProperty")]=Object.defineProperty,_getOwnPropertyDescriptor=Object[zoneSymbol$1("getOwnPropertyDescriptor")]=Object.getOwnPropertyDescriptor,_create=Object.create,unconfigurablesKey=zoneSymbol$1("unconfigurables");function propertyPatch(){Object.defineProperty=function(e,t,n){if(isUnconfigurable(e,t))throw new TypeError("Cannot assign to read only property '"+t+"' of "+e);const o=n.configurable;return"prototype"!==t&&(n=rewriteDescriptor(e,t,n)),_tryDefineProperty(e,t,n,o)},Object.defineProperties=function(e,t){return Object.keys(t).forEach(function(n){Object.defineProperty(e,n,t[n])}),e},Object.create=function(e,t){return"object"!=typeof t||Object.isFrozen(t)||Object.keys(t).forEach(function(n){t[n]=rewriteDescriptor(e,n,t[n])}),_create(e,t)},Object.getOwnPropertyDescriptor=function(e,t){const n=_getOwnPropertyDescriptor(e,t);return n&&isUnconfigurable(e,t)&&(n.configurable=!1),n}}function _redefineProperty(e,t,n){const o=n.configurable;return _tryDefineProperty(e,t,n=rewriteDescriptor(e,t,n),o)}function isUnconfigurable(e,t){return e&&e[unconfigurablesKey]&&e[unconfigurablesKey][t]}function rewriteDescriptor(e,t,n){return Object.isFrozen(n)||(n.configurable=!0),n.configurable||(e[unconfigurablesKey]||Object.isFrozen(e)||_defineProperty(e,unconfigurablesKey,{writable:!0,value:{}}),e[unconfigurablesKey]&&(e[unconfigurablesKey][t]=!0)),n}function _tryDefineProperty(e,t,n,o){try{return _defineProperty(e,t,n)}catch(r){if(!n.configurable)throw r;void 0===o?delete n.configurable:n.configurable=o;try{return _defineProperty(e,t,n)}catch(o){let r=null;try{r=JSON.stringify(n)}catch(e){r=n.toString()}console.log(`Attempting to configure '${t}' with descriptor '${r}' on object '${e}' and got error, giving up: ${o}`)}}}const globalEventHandlersEventNames=["abort","animationcancel","animationend","animationiteration","auxclick","beforeinput","blur","cancel","canplay","canplaythrough","change","compositionstart","compositionupdate","compositionend","cuechange","click","close","contextmenu","curechange","dblclick","drag","dragend","dragenter","dragexit","dragleave","dragover","drop","durationchange","emptied","ended","error","focus","focusin","focusout","gotpointercapture","input","invalid","keydown","keypress","keyup","load","loadstart","loadeddata","loadedmetadata","lostpointercapture","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","orientationchange","pause","play","playing","pointercancel","pointerdown","pointerenter","pointerleave","pointerlockchange","mozpointerlockchange","webkitpointerlockerchange","pointerlockerror","mozpointerlockerror","webkitpointerlockerror","pointermove","pointout","pointerover","pointerup","progress","ratechange","reset","resize","scroll","seeked","seeking","select","selectionchange","selectstart","show","sort","stalled","submit","suspend","timeupdate","volumechange","touchcancel","touchmove","touchstart","touchend","transitioncancel","transitionend","waiting","wheel"],documentEventNames=["afterscriptexecute","beforescriptexecute","DOMContentLoaded","freeze","fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange","fullscreenerror","mozfullscreenerror","webkitfullscreenerror","msfullscreenerror","readystatechange","visibilitychange","resume"],windowEventNames=["absolutedeviceorientation","afterinput","afterprint","appinstalled","beforeinstallprompt","beforeprint","beforeunload","devicelight","devicemotion","deviceorientation","deviceorientationabsolute","deviceproximity","hashchange","languagechange","message","mozbeforepaint","offline","online","paint","pageshow","pagehide","popstate","rejectionhandled","storage","unhandledrejection","unload","userproximity","vrdisplyconnected","vrdisplaydisconnected","vrdisplaypresentchange"],htmlElementEventNames=["beforecopy","beforecut","beforepaste","copy","cut","paste","dragstart","loadend","animationstart","search","transitionrun","transitionstart","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend"],mediaElementEventNames=["encrypted","waitingforkey","msneedkey","mozinterruptbegin","mozinterruptend"],ieElementEventNames=["activate","afterupdate","ariarequest","beforeactivate","beforedeactivate","beforeeditfocus","beforeupdate","cellchange","controlselect","dataavailable","datasetchanged","datasetcomplete","errorupdate","filterchange","layoutcomplete","losecapture","move","moveend","movestart","propertychange","resizeend","resizestart","rowenter","rowexit","rowsdelete","rowsinserted","command","compassneedscalibration","deactivate","help","mscontentzoom","msmanipulationstatechanged","msgesturechange","msgesturedoubletap","msgestureend","msgesturehold","msgesturestart","msgesturetap","msgotpointercapture","msinertiastart","mslostpointercapture","mspointercancel","mspointerdown","mspointerenter","mspointerhover","mspointerleave","mspointermove","mspointerout","mspointerover","mspointerup","pointerout","mssitemodejumplistitemremoved","msthumbnailclick","stop","storagecommit"],webglEventNames=["webglcontextrestored","webglcontextlost","webglcontextcreationerror"],formEventNames=["autocomplete","autocompleteerror"],detailEventNames=["toggle"],frameEventNames=["load"],frameSetEventNames=["blur","error","focus","load","resize","scroll","messageerror"],marqueeEventNames=["bounce","finish","start"],XMLHttpRequestEventNames=["loadstart","progress","abort","error","load","progress","timeout","loadend","readystatechange"],IDBIndexEventNames=["upgradeneeded","complete","abort","success","error","blocked","versionchange","close"],websocketEventNames=["close","error","open","message"],workerEventNames=["error","message"],eventNames=globalEventHandlersEventNames.concat(webglEventNames,formEventNames,detailEventNames,documentEventNames,windowEventNames,htmlElementEventNames,ieElementEventNames);function filterProperties(e,t,n){if(!n||0===n.length)return t;const o=n.filter(t=>t.target===e);if(!o||0===o.length)return t;const r=o[0].ignoreProperties;return t.filter(e=>-1===r.indexOf(e))}function patchFilteredProperties(e,t,n,o){if(!e)return;patchOnProperties(e,filterProperties(e,t,n),o)}function propertyDescriptorPatch(e,t){if(isNode&&!isMix)return;if(Zone[e.symbol("patchEvents")])return;const n="undefined"!=typeof WebSocket,o=t.__Zone_ignore_on_properties;if(isBrowser){const e=window,t=isIE?[{target:e,ignoreProperties:["error"]}]:[];patchFilteredProperties(e,eventNames.concat(["messageerror"]),o?o.concat(t):o,ObjectGetPrototypeOf(e)),patchFilteredProperties(Document.prototype,eventNames,o),void 0!==e.SVGElement&&patchFilteredProperties(e.SVGElement.prototype,eventNames,o),patchFilteredProperties(Element.prototype,eventNames,o),patchFilteredProperties(HTMLElement.prototype,eventNames,o),patchFilteredProperties(HTMLMediaElement.prototype,mediaElementEventNames,o),patchFilteredProperties(HTMLFrameSetElement.prototype,windowEventNames.concat(frameSetEventNames),o),patchFilteredProperties(HTMLBodyElement.prototype,windowEventNames.concat(frameSetEventNames),o),patchFilteredProperties(HTMLFrameElement.prototype,frameEventNames,o),patchFilteredProperties(HTMLIFrameElement.prototype,frameEventNames,o);const n=e.HTMLMarqueeElement;n&&patchFilteredProperties(n.prototype,marqueeEventNames,o);const r=e.Worker;r&&patchFilteredProperties(r.prototype,workerEventNames,o)}const r=t.XMLHttpRequest;r&&patchFilteredProperties(r.prototype,XMLHttpRequestEventNames,o);const s=t.XMLHttpRequestEventTarget;s&&patchFilteredProperties(s&&s.prototype,XMLHttpRequestEventNames,o),"undefined"!=typeof IDBIndex&&(patchFilteredProperties(IDBIndex.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBRequest.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBOpenDBRequest.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBDatabase.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBTransaction.prototype,IDBIndexEventNames,o),patchFilteredProperties(IDBCursor.prototype,IDBIndexEventNames,o)),n&&patchFilteredProperties(WebSocket.prototype,websocketEventNames,o)}Zone.__load_patch("util",(e,t,n)=>{n.patchOnProperties=patchOnProperties,n.patchMethod=patchMethod,n.bindArguments=bindArguments,n.patchMacroTask=patchMacroTask;const o=t.__symbol__("BLACK_LISTED_EVENTS"),r=t.__symbol__("UNPATCHED_EVENTS");e[r]&&(e[o]=e[r]),e[o]&&(t[o]=t[r]=e[o]),n.patchEventPrototype=patchEventPrototype,n.patchEventTarget=patchEventTarget,n.isIEOrEdge=isIEOrEdge,n.ObjectDefineProperty=ObjectDefineProperty,n.ObjectGetOwnPropertyDescriptor=ObjectGetOwnPropertyDescriptor,n.ObjectCreate=ObjectCreate,n.ArraySlice=ArraySlice,n.patchClass=patchClass,n.wrapWithCurrentZone=wrapWithCurrentZone,n.filterProperties=filterProperties,n.attachOriginToPatched=attachOriginToPatched,n._redefineProperty=_redefineProperty,n.patchCallbacks=patchCallbacks,n.getGlobalObjects=(()=>({globalSources,zoneSymbolEventNames:zoneSymbolEventNames$1,eventNames,isBrowser,isMix,isNode,TRUE_STR,FALSE_STR,ZONE_SYMBOL_PREFIX,ADD_EVENT_LISTENER_STR,REMOVE_EVENT_LISTENER_STR}))});const taskSymbol=zoneSymbol("zoneTask");function patchTimer(e,t,n,o){let r=null,s=null;n+=o;const i={};function a(t){const n=t.data;return n.args[0]=function(){try{t.invoke.apply(this,arguments)}finally{t.data&&t.data.isPeriodic||("number"==typeof n.handleId?delete i[n.handleId]:n.handleId&&(n.handleId[taskSymbol]=null))}},n.handleId=r.apply(e,n.args),t}function c(e){return s(e.data.handleId)}r=patchMethod(e,t+=o,n=>(function(r,s){if("function"==typeof s[0]){const e={isPeriodic:"Interval"===o,delay:"Timeout"===o||"Interval"===o?s[1]||0:void 0,args:s},n=scheduleMacroTaskWithCurrentZone(t,s[0],e,a,c);if(!n)return n;const r=n.data.handleId;return"number"==typeof r?i[r]=n:r&&(r[taskSymbol]=n),r&&r.ref&&r.unref&&"function"==typeof r.ref&&"function"==typeof r.unref&&(n.ref=r.ref.bind(r),n.unref=r.unref.bind(r)),"number"==typeof r||r?r:n}return n.apply(e,s)})),s=patchMethod(e,n,t=>(function(n,o){const r=o[0];let s;"number"==typeof r?s=i[r]:(s=r&&r[taskSymbol])||(s=r),s&&"string"==typeof s.type?"notScheduled"!==s.state&&(s.cancelFn&&s.data.isPeriodic||0===s.runCount)&&("number"==typeof r?delete i[r]:r&&(r[taskSymbol]=null),s.zone.cancelTask(s)):t.apply(e,o)}))}function patchCustomElements(e,t){const{isBrowser:n,isMix:o}=t.getGlobalObjects();if(!((n||o)&&e.customElements&&"customElements"in e))return;t.patchCallbacks(t,e.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback"])}function eventTargetPatch(e,t){if(Zone[t.symbol("patchEventTarget")])return;const{eventNames:n,zoneSymbolEventNames:o,TRUE_STR:r,FALSE_STR:s,ZONE_SYMBOL_PREFIX:i}=t.getGlobalObjects();for(let e=0;e{const t=e[Zone.__symbol__("legacyPatch")];t&&t()}),Zone.__load_patch("timers",e=>{patchTimer(e,"set","clear","Timeout"),patchTimer(e,"set","clear","Interval"),patchTimer(e,"set","clear","Immediate")}),Zone.__load_patch("requestAnimationFrame",e=>{patchTimer(e,"request","cancel","AnimationFrame"),patchTimer(e,"mozRequest","mozCancel","AnimationFrame"),patchTimer(e,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",(e,t)=>{const n=["alert","prompt","confirm"];for(let o=0;o(function(o,s){return t.current.run(n,e,s,r)}))}}),Zone.__load_patch("EventTarget",(e,t,n)=>{patchEvent(e,n),eventTargetPatch(e,n);const o=e.XMLHttpRequestEventTarget;o&&o.prototype&&n.patchEventTarget(e,[o.prototype]),patchClass("MutationObserver"),patchClass("WebKitMutationObserver"),patchClass("IntersectionObserver"),patchClass("FileReader")}),Zone.__load_patch("on_property",(e,t,n)=>{propertyDescriptorPatch(n,e),propertyPatch()}),Zone.__load_patch("customElements",(e,t,n)=>{patchCustomElements(e,n)}),Zone.__load_patch("XHR",(e,t)=>{!function(e){const c=e.XMLHttpRequest;if(!c)return;const l=c.prototype;let u=l[ZONE_SYMBOL_ADD_EVENT_LISTENER],p=l[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];if(!u){const t=e.XMLHttpRequestEventTarget;if(t){const e=t.prototype;u=e[ZONE_SYMBOL_ADD_EVENT_LISTENER],p=e[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]}}const h="readystatechange",f="scheduled";function d(e){const t=e.data,o=t.target;o[s]=!1,o[a]=!1;const i=o[r];u||(u=o[ZONE_SYMBOL_ADD_EVENT_LISTENER],p=o[ZONE_SYMBOL_REMOVE_EVENT_LISTENER]),i&&p.call(o,h,i);const c=o[r]=(()=>{if(o.readyState===o.DONE)if(!t.aborted&&o[s]&&e.state===f){const n=o.__zone_symbol__loadfalse;if(n&&n.length>0){const r=e.invoke;e.invoke=function(){const n=o.__zone_symbol__loadfalse;for(let t=0;t(function(e,t){return e[o]=0==t[2],e[i]=t[1],g.apply(e,t)})),y=zoneSymbol("fetchTaskAborting"),E=zoneSymbol("fetchTaskScheduling"),b=patchMethod(l,"send",()=>(function(e,n){if(!0===t.current[E])return b.apply(e,n);if(e[o])return b.apply(e,n);{const t={target:e,url:e[i],isPeriodic:!1,args:n,aborted:!1},o=scheduleMacroTaskWithCurrentZone("XMLHttpRequest.send",_,t,d,m);e&&!0===e[a]&&!t.aborted&&o.state===f&&o.invoke()}})),T=patchMethod(l,"abort",()=>(function(e,o){const r=e[n];if(r&&"string"==typeof r.type){if(null==r.cancelFn||r.data&&r.data.aborted)return;r.zone.cancelTask(r)}else if(!0===t.current[y])return T.apply(e,o)}))}(e);const n=zoneSymbol("xhrTask"),o=zoneSymbol("xhrSync"),r=zoneSymbol("xhrListener"),s=zoneSymbol("xhrScheduled"),i=zoneSymbol("xhrURL"),a=zoneSymbol("xhrErrorBeforeScheduled")}),Zone.__load_patch("geolocation",e=>{e.navigator&&e.navigator.geolocation&&patchPrototype(e.navigator.geolocation,["getCurrentPosition","watchPosition"])}),Zone.__load_patch("PromiseRejectionEvent",(e,t)=>{function n(t){return function(n){findEventTasks(e,t).forEach(o=>{const r=e.PromiseRejectionEvent;if(r){const e=new r(t,{promise:n.promise,reason:n.rejection});o.invoke(e)}})}}e.PromiseRejectionEvent&&(t[zoneSymbol("unhandledPromiseRejectionHandler")]=n("unhandledrejection"),t[zoneSymbol("rejectionHandledHandler")]=n("rejectionhandled"))}); \ No newline at end of file diff --git a/dist/zone-legacy.js b/dist/zone-legacy.js index 69d76cd2c..ab6b76b57 100644 --- a/dist/zone-legacy.js +++ b/dist/zone-legacy.js @@ -32,7 +32,7 @@ function eventTargetLegacyPatch(_global, api) { apis = WTF_ISSUE_555_ARRAY.map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET); } else if (_global[EVENT_TARGET]) { - // EventTarget is already patched in browser.ts + apis.push(EVENT_TARGET); } else { // Note: EventTarget is not available in all browsers, @@ -107,6 +107,7 @@ function eventTargetLegacyPatch(_global, api) { // vh is validateHandler to check event handler // is valid or not(for security check) api.patchEventTarget(_global, apiTypes, { vh: checkIEAndCrossContext }); + Zone[api.symbol('patchEventTarget')] = !!_global[EVENT_TARGET]; return true; } @@ -181,8 +182,8 @@ function propertyDescriptorLegacyPatch(api, _global) { if (isNode && !isMix) { return; } - var supportsWebSocket = typeof WebSocket !== 'undefined'; - if (!canPatchViaPropertyDescriptor(api)) { + if (!canPatchViaPropertyDescriptor(api, _global)) { + var supportsWebSocket = typeof WebSocket !== 'undefined'; // Safari, Android browsers (Jelly Bean) patchViaCapturingAllTheEvents(api); api.patchClass('XMLHttpRequest'); @@ -192,7 +193,7 @@ function propertyDescriptorLegacyPatch(api, _global) { Zone[api.symbol('patchEvents')] = true; } } -function canPatchViaPropertyDescriptor(api) { +function canPatchViaPropertyDescriptor(api, _global) { var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix; if ((isBrowser || isMix) && !api.ObjectGetOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && @@ -202,6 +203,26 @@ function canPatchViaPropertyDescriptor(api) { var desc = api.ObjectGetOwnPropertyDescriptor(Element.prototype, 'onclick'); if (desc && !desc.configurable) return false; + // try to use onclick to detect whether we can patch via propertyDescriptor + // because XMLHttpRequest is not available in service worker + if (desc) { + api.ObjectDefineProperty(Element.prototype, 'onclick', { + enumerable: true, + configurable: true, + get: function () { + return true; + } + }); + var div = document.createElement('div'); + var result = !!div.onclick; + api.ObjectDefineProperty(Element.prototype, 'onclick', desc); + return result; + } + } + var XMLHttpRequest = _global['XMLHttpRequest']; + if (!XMLHttpRequest) { + // XMLHttpRequest is not available in service worker + return false; } var ON_READY_STATE_CHANGE = 'onreadystatechange'; var XMLHttpRequestPrototype = XMLHttpRequest.prototype; diff --git a/dist/zone-legacy.min.js b/dist/zone-legacy.min.js index 7ec8b01a1..292949830 100644 --- a/dist/zone-legacy.min.js +++ b/dist/zone-legacy.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function e(e,t){var n=e.getGlobalObjects(),r=n.isNode,a=n.isMix;if(!r||a){var o="undefined"!=typeof WebSocket;(function(e){var t=e.getGlobalObjects(),n=t.isBrowser,r=t.isMix;if((n||r)&&!e.ObjectGetOwnPropertyDescriptor(HTMLElement.prototype,"onclick")&&"undefined"!=typeof Element){var a=e.ObjectGetOwnPropertyDescriptor(Element.prototype,"onclick");if(a&&!a.configurable)return!1}var o=XMLHttpRequest.prototype,c=e.ObjectGetOwnPropertyDescriptor(o,"onreadystatechange");if(c){e.ObjectDefineProperty(o,"onreadystatechange",{enumerable:!0,configurable:!0,get:function(){return!0}});var i=new XMLHttpRequest,l=!!i.onreadystatechange;return e.ObjectDefineProperty(o,"onreadystatechange",c||{}),l}var s=e.symbol("fake");e.ObjectDefineProperty(o,"onreadystatechange",{enumerable:!0,configurable:!0,get:function(){return this[s]},set:function(e){this[s]=e}});var i=new XMLHttpRequest,u=function(){};i.onreadystatechange=u;var l=i[s]===u;return i.onreadystatechange=null,l})(e)||(!function(e){for(var t=e.getGlobalObjects().eventNames,n=e.symbol("unbound"),r=function(r){var a=t[r],o="on"+a;self.addEventListener(a,function(t){var r,a,c=t.target;for(a=c?c.constructor.name+"."+o:"unknown."+o;c;)c[o]&&!c[o][n]&&((r=e.wrapWithCurrentZone(c[o],a))[n]=c[o],c[o]=r),c=c.parentElement},!0)},a=0;a1?new o(t,n):new o(t),s=e.ObjectGetOwnPropertyDescriptor(l,"onmessage");return s&&!1===s.configurable?(c=e.ObjectCreate(l),i=l,[r,a,"send","close"].forEach(function(t){c[t]=function(){var n=e.ArraySlice.call(arguments);if(t===r||t===a){var o=n.length>0?n[0]:void 0;if(o){var i=Zone.__symbol__("ON_PROPERTY"+o);l[i]=c[i]}}return l[t].apply(l,n)}})):c=l,e.patchOnProperties(c,["close","error","message","open"],i),c};var c=t.WebSocket;for(var i in o)c[i]=o[i]}(e,t),Zone[e.symbol("patchEvents")]=!0)}}var t;(t="undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global).__zone_symbol__legacyPatch=function(){var n=t.Zone;n.__load_patch("registerElement",function(e,t,n){!function(e,t){var n=t.getGlobalObjects(),r=n.isBrowser,a=n.isMix;(r||a)&&"registerElement"in e.document&&t.patchCallbacks(t,document,"Document","registerElement",["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"])}(e,n)}),n.__load_patch("EventTargetLegacy",function(t,n,r){!function(e,t){var n=t.getGlobalObjects(),r=n.eventNames,a=n.globalSources,o=n.zoneSymbolEventNames,c=n.TRUE_STR,i=n.FALSE_STR,l=n.ZONE_SYMBOL_PREFIX,s="Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video",u="ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket".split(","),p=[],f=e.wtf,b=s.split(",");f?p=b.map(function(e){return"HTML"+e+"Element"}).concat(u):e.EventTarget||(p=u);for(var d=e.__Zone_disable_IE_check||!1,g=e.__Zone_enable_cross_context_check||!1,v=t.isIEOrEdge(),y="function __BROWSERTOOLS_CONSOLE_SAFEFUNC() { [native code] }",E=0;E1?new a(t,n):new a(t),s=e.ObjectGetOwnPropertyDescriptor(l,"onmessage");return s&&!1===s.configurable?(c=e.ObjectCreate(l),i=l,[r,o,"send","close"].forEach(function(t){c[t]=function(){var n=e.ArraySlice.call(arguments);if(t===r||t===o){var a=n.length>0?n[0]:void 0;if(a){var i=Zone.__symbol__("ON_PROPERTY"+a);l[i]=c[i]}}return l[t].apply(l,n)}})):c=l,e.patchOnProperties(c,["close","error","message","open"],i),c};var c=t.WebSocket;for(var i in a)c[i]=a[i]}(e,t),Zone[e.symbol("patchEvents")]=!0}}var n;(n="undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global).__zone_symbol__legacyPatch=function(){var r=n.Zone;r.__load_patch("registerElement",function(e,t,n){!function(e,t){var n=t.getGlobalObjects(),r=n.isBrowser,o=n.isMix;(r||o)&&"registerElement"in e.document&&t.patchCallbacks(t,document,"Document","registerElement",["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"])}(e,n)}),r.__load_patch("EventTargetLegacy",function(n,r,o){e(n,o),t(o,n)})}}); \ No newline at end of file diff --git a/dist/zone-mix.js b/dist/zone-mix.js index df2cc402c..c8354162d 100644 --- a/dist/zone-mix.js +++ b/dist/zone-mix.js @@ -2334,7 +2334,7 @@ function patchTimer(window, setName, cancelName, nameSuffix) { */ function patchCustomElements(_global, api) { var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix; - if ((!isBrowser && !isMix) || !('customElements' in _global)) { + if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) { return; } var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback']; @@ -2453,6 +2453,10 @@ function _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) { * found in the LICENSE file at https://angular.io/license */ function eventTargetPatch(_global, api) { + if (Zone[api.symbol('patchEventTarget')]) { + // EventTarget is already patched. + return; + } var _a = api.getGlobalObjects(), eventNames = _a.eventNames, zoneSymbolEventNames = _a.zoneSymbolEventNames, TRUE_STR = _a.TRUE_STR, FALSE_STR = _a.FALSE_STR, ZONE_SYMBOL_PREFIX = _a.ZONE_SYMBOL_PREFIX; // predefine all __zone_symbol__ + eventName + true/false string for (var i = 0; i < eventNames.length; i++) { @@ -2757,7 +2761,11 @@ function propertyDescriptorPatch(api, _global) { patchFilteredProperties(Worker_1.prototype, workerEventNames, ignoreProperties); } } - patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + var XMLHttpRequest = _global['XMLHttpRequest']; + if (XMLHttpRequest) { + // XMLHttpRequest is not available in ServiceWorker, so we need to check here + patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + } var XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget']; if (XMLHttpRequestEventTarget) { patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties); @@ -2845,6 +2853,11 @@ Zone.__load_patch('XHR', function (global, Zone) { var XHR_URL = zoneSymbol('xhrURL'); var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled'); function patchXHR(window) { + var XMLHttpRequest = window['XMLHttpRequest']; + if (!XMLHttpRequest) { + // XMLHttpRequest is not available in service worker + return; + } var XMLHttpRequestPrototype = XMLHttpRequest.prototype; function findPendingTask(target) { return target[XHR_TASK]; diff --git a/dist/zone-testing-bundle.js b/dist/zone-testing-bundle.js index d860dc392..2eeab9077 100644 --- a/dist/zone-testing-bundle.js +++ b/dist/zone-testing-bundle.js @@ -2632,7 +2632,11 @@ function propertyDescriptorPatch(api, _global) { patchFilteredProperties(Worker_1.prototype, workerEventNames, ignoreProperties); } } - patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + var XMLHttpRequest = _global['XMLHttpRequest']; + if (XMLHttpRequest) { + // XMLHttpRequest is not available in ServiceWorker, so we need to check here + patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + } var XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget']; if (XMLHttpRequestEventTarget) { patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties); @@ -2734,7 +2738,7 @@ function eventTargetLegacyPatch(_global, api) { apis = WTF_ISSUE_555_ARRAY.map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET); } else if (_global[EVENT_TARGET]) { - // EventTarget is already patched in browser.ts + apis.push(EVENT_TARGET); } else { // Note: EventTarget is not available in all browsers, @@ -2809,6 +2813,7 @@ function eventTargetLegacyPatch(_global, api) { // vh is validateHandler to check event handler // is valid or not(for security check) api.patchEventTarget(_global, apiTypes, { vh: checkIEAndCrossContext }); + Zone[api.symbol('patchEventTarget')] = !!_global[EVENT_TARGET]; return true; } @@ -2883,8 +2888,8 @@ function propertyDescriptorLegacyPatch(api, _global) { if (isNode && !isMix) { return; } - var supportsWebSocket = typeof WebSocket !== 'undefined'; - if (!canPatchViaPropertyDescriptor(api)) { + if (!canPatchViaPropertyDescriptor(api, _global)) { + var supportsWebSocket = typeof WebSocket !== 'undefined'; // Safari, Android browsers (Jelly Bean) patchViaCapturingAllTheEvents(api); api.patchClass('XMLHttpRequest'); @@ -2894,7 +2899,7 @@ function propertyDescriptorLegacyPatch(api, _global) { Zone[api.symbol('patchEvents')] = true; } } -function canPatchViaPropertyDescriptor(api) { +function canPatchViaPropertyDescriptor(api, _global) { var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix; if ((isBrowser || isMix) && !api.ObjectGetOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && @@ -2904,6 +2909,26 @@ function canPatchViaPropertyDescriptor(api) { var desc = api.ObjectGetOwnPropertyDescriptor(Element.prototype, 'onclick'); if (desc && !desc.configurable) return false; + // try to use onclick to detect whether we can patch via propertyDescriptor + // because XMLHttpRequest is not available in service worker + if (desc) { + api.ObjectDefineProperty(Element.prototype, 'onclick', { + enumerable: true, + configurable: true, + get: function () { + return true; + } + }); + var div = document.createElement('div'); + var result = !!div.onclick; + api.ObjectDefineProperty(Element.prototype, 'onclick', desc); + return result; + } + } + var XMLHttpRequest = _global['XMLHttpRequest']; + if (!XMLHttpRequest) { + // XMLHttpRequest is not available in service worker + return false; } var ON_READY_STATE_CHANGE = 'onreadystatechange'; var XMLHttpRequestPrototype = XMLHttpRequest.prototype; @@ -3156,7 +3181,7 @@ function patchTimer(window, setName, cancelName, nameSuffix) { */ function patchCustomElements(_global, api) { var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix; - if ((!isBrowser && !isMix) || !('customElements' in _global)) { + if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) { return; } var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback']; @@ -3171,6 +3196,10 @@ function patchCustomElements(_global, api) { * found in the LICENSE file at https://angular.io/license */ function eventTargetPatch(_global, api) { + if (Zone[api.symbol('patchEventTarget')]) { + // EventTarget is already patched. + return; + } var _a = api.getGlobalObjects(), eventNames = _a.eventNames, zoneSymbolEventNames = _a.zoneSymbolEventNames, TRUE_STR = _a.TRUE_STR, FALSE_STR = _a.FALSE_STR, ZONE_SYMBOL_PREFIX = _a.ZONE_SYMBOL_PREFIX; // predefine all __zone_symbol__ + eventName + true/false string for (var i = 0; i < eventNames.length; i++) { @@ -3264,6 +3293,11 @@ Zone.__load_patch('XHR', function (global, Zone) { var XHR_URL = zoneSymbol('xhrURL'); var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled'); function patchXHR(window) { + var XMLHttpRequest = window['XMLHttpRequest']; + if (!XMLHttpRequest) { + // XMLHttpRequest is not available in service worker + return; + } var XMLHttpRequestPrototype = XMLHttpRequest.prototype; function findPendingTask(target) { return target[XHR_TASK]; @@ -3862,7 +3896,13 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; var syncZone = ambientZone.fork(new SyncTestZoneSpec('jasmine.describe')); var symbol = Zone.__symbol__; // whether patch jasmine clock when in fakeAsync - var enableClockPatch = _global[symbol('fakeAsyncPatchLock')] === true; + var disablePatchingJasmineClock = _global[symbol('fakeAsyncDisablePatchingClock')] === true; + // the original variable name fakeAsyncPatchLock is not accurate, so the name will be + // fakeAsyncAutoFakeAsyncWhenClockPatched and if this enablePatchingJasmineClock is false, we also + // automatically disable the auto jump into fakeAsync feature + var enableAutoFakeAsyncWhenClockPatched = !disablePatchingJasmineClock && + ((_global[symbol('fakeAsyncPatchLock')] === true) || + (_global[symbol('fakeAsyncAutoFakeAsyncWhenClockPatched')] === true)); var ignoreUnhandledRejection = _global[symbol('ignoreUnhandledRejection')] === true; if (!ignoreUnhandledRejection) { var globalErrors_1 = jasmine.GlobalErrors; @@ -3911,48 +3951,50 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; return originalJasmineFn.apply(this, arguments); }; }); - // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so - // they can work properly in FakeAsyncTest - var originalClockFn = (jasmine[symbol('clock')] = jasmine['clock']); - jasmine['clock'] = function () { - var clock = originalClockFn.apply(this, arguments); - if (!clock[symbol('patched')]) { - clock[symbol('patched')] = symbol('patched'); - var originalTick_1 = (clock[symbol('tick')] = clock.tick); - clock.tick = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); - } - return originalTick_1.apply(this, arguments); - }; - var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); - clock.mockDate = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - var dateTime = arguments.length > 0 ? arguments[0] : new Date(); - return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : - arguments); - } - return originalMockDate_1.apply(this, arguments); - }; - // for auto go into fakeAsync feature, we need the flag to enable it - if (enableClockPatch) { - ['install', 'uninstall'].forEach(function (methodName) { - var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); - clock[methodName] = function () { - var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; - if (FakeAsyncTestZoneSpec) { - jasmine[symbol('clockInstalled')] = 'install' === methodName; - return; - } - return originalClockFn.apply(this, arguments); - }; - }); + if (!disablePatchingJasmineClock) { + // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so + // they can work properly in FakeAsyncTest + var originalClockFn_1 = (jasmine[symbol('clock')] = jasmine['clock']); + jasmine['clock'] = function () { + var clock = originalClockFn_1.apply(this, arguments); + if (!clock[symbol('patched')]) { + clock[symbol('patched')] = symbol('patched'); + var originalTick_1 = (clock[symbol('tick')] = clock.tick); + clock.tick = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); + } + return originalTick_1.apply(this, arguments); + }; + var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); + clock.mockDate = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + var dateTime = arguments.length > 0 ? arguments[0] : new Date(); + return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : + arguments); + } + return originalMockDate_1.apply(this, arguments); + }; + // for auto go into fakeAsync feature, we need the flag to enable it + if (enableAutoFakeAsyncWhenClockPatched) { + ['install', 'uninstall'].forEach(function (methodName) { + var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); + clock[methodName] = function () { + var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; + if (FakeAsyncTestZoneSpec) { + jasmine[symbol('clockInstalled')] = 'install' === methodName; + return; + } + return originalClockFn.apply(this, arguments); + }; + }); + } } - } - return clock; - }; + return clock; + }; + } /** * Gets a function wrapping the body of a Jasmine `describe` block to execute in a * synchronous-only zone. @@ -3966,7 +4008,7 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; var isClockInstalled = !!jasmine[symbol('clockInstalled')]; var testProxyZoneSpec = queueRunner.testProxyZoneSpec; var testProxyZone = queueRunner.testProxyZone; - if (isClockInstalled && enableClockPatch) { + if (isClockInstalled && enableAutoFakeAsyncWhenClockPatched) { // auto run a fakeAsync var fakeAsyncModule = Zone[Zone.__symbol__('fakeAsyncTest')]; if (fakeAsyncModule && typeof fakeAsyncModule.fakeAsync === 'function') { @@ -4452,7 +4494,7 @@ var __spread = (undefined && undefined.__spread) || function () { if (doTick) { doTick(this._currentTime - lastCurrentTime); } - var retval = current_1.func.apply(global, current_1.args); + var retval = current_1.func.apply(global, current_1.isRequestAnimationFrame ? [this._currentTime] : current_1.args); if (!retval) { // Uncaught exception in the current scheduled function. Stop processing the queue. break; diff --git a/dist/zone-testing-node-bundle.js b/dist/zone-testing-node-bundle.js index 1114a410a..58d0a7038 100644 --- a/dist/zone-testing-node-bundle.js +++ b/dist/zone-testing-node-bundle.js @@ -2906,7 +2906,13 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; var syncZone = ambientZone.fork(new SyncTestZoneSpec('jasmine.describe')); var symbol = Zone.__symbol__; // whether patch jasmine clock when in fakeAsync - var enableClockPatch = _global[symbol('fakeAsyncPatchLock')] === true; + var disablePatchingJasmineClock = _global[symbol('fakeAsyncDisablePatchingClock')] === true; + // the original variable name fakeAsyncPatchLock is not accurate, so the name will be + // fakeAsyncAutoFakeAsyncWhenClockPatched and if this enablePatchingJasmineClock is false, we also + // automatically disable the auto jump into fakeAsync feature + var enableAutoFakeAsyncWhenClockPatched = !disablePatchingJasmineClock && + ((_global[symbol('fakeAsyncPatchLock')] === true) || + (_global[symbol('fakeAsyncAutoFakeAsyncWhenClockPatched')] === true)); var ignoreUnhandledRejection = _global[symbol('ignoreUnhandledRejection')] === true; if (!ignoreUnhandledRejection) { var globalErrors_1 = jasmine.GlobalErrors; @@ -2955,48 +2961,50 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; return originalJasmineFn.apply(this, arguments); }; }); - // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so - // they can work properly in FakeAsyncTest - var originalClockFn = (jasmine[symbol('clock')] = jasmine['clock']); - jasmine['clock'] = function () { - var clock = originalClockFn.apply(this, arguments); - if (!clock[symbol('patched')]) { - clock[symbol('patched')] = symbol('patched'); - var originalTick_1 = (clock[symbol('tick')] = clock.tick); - clock.tick = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); - } - return originalTick_1.apply(this, arguments); - }; - var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); - clock.mockDate = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - var dateTime = arguments.length > 0 ? arguments[0] : new Date(); - return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : - arguments); + if (!disablePatchingJasmineClock) { + // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so + // they can work properly in FakeAsyncTest + var originalClockFn_1 = (jasmine[symbol('clock')] = jasmine['clock']); + jasmine['clock'] = function () { + var clock = originalClockFn_1.apply(this, arguments); + if (!clock[symbol('patched')]) { + clock[symbol('patched')] = symbol('patched'); + var originalTick_1 = (clock[symbol('tick')] = clock.tick); + clock.tick = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); + } + return originalTick_1.apply(this, arguments); + }; + var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); + clock.mockDate = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + var dateTime = arguments.length > 0 ? arguments[0] : new Date(); + return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : + arguments); + } + return originalMockDate_1.apply(this, arguments); + }; + // for auto go into fakeAsync feature, we need the flag to enable it + if (enableAutoFakeAsyncWhenClockPatched) { + ['install', 'uninstall'].forEach(function (methodName) { + var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); + clock[methodName] = function () { + var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; + if (FakeAsyncTestZoneSpec) { + jasmine[symbol('clockInstalled')] = 'install' === methodName; + return; + } + return originalClockFn.apply(this, arguments); + }; + }); } - return originalMockDate_1.apply(this, arguments); - }; - // for auto go into fakeAsync feature, we need the flag to enable it - if (enableClockPatch) { - ['install', 'uninstall'].forEach(function (methodName) { - var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); - clock[methodName] = function () { - var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; - if (FakeAsyncTestZoneSpec) { - jasmine[symbol('clockInstalled')] = 'install' === methodName; - return; - } - return originalClockFn.apply(this, arguments); - }; - }); } - } - return clock; - }; + return clock; + }; + } /** * Gets a function wrapping the body of a Jasmine `describe` block to execute in a * synchronous-only zone. @@ -3010,7 +3018,7 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; var isClockInstalled = !!jasmine[symbol('clockInstalled')]; var testProxyZoneSpec = queueRunner.testProxyZoneSpec; var testProxyZone = queueRunner.testProxyZone; - if (isClockInstalled && enableClockPatch) { + if (isClockInstalled && enableAutoFakeAsyncWhenClockPatched) { // auto run a fakeAsync var fakeAsyncModule = Zone[Zone.__symbol__('fakeAsyncTest')]; if (fakeAsyncModule && typeof fakeAsyncModule.fakeAsync === 'function') { @@ -3496,7 +3504,7 @@ var __spread = (undefined && undefined.__spread) || function () { if (doTick) { doTick(this._currentTime - lastCurrentTime); } - var retval = current_1.func.apply(global, current_1.args); + var retval = current_1.func.apply(global, current_1.isRequestAnimationFrame ? [this._currentTime] : current_1.args); if (!retval) { // Uncaught exception in the current scheduled function. Stop processing the queue. break; diff --git a/dist/zone-testing.js b/dist/zone-testing.js index 221d8d75e..59a2b0c4d 100644 --- a/dist/zone-testing.js +++ b/dist/zone-testing.js @@ -435,7 +435,13 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; var syncZone = ambientZone.fork(new SyncTestZoneSpec('jasmine.describe')); var symbol = Zone.__symbol__; // whether patch jasmine clock when in fakeAsync - var enableClockPatch = _global[symbol('fakeAsyncPatchLock')] === true; + var disablePatchingJasmineClock = _global[symbol('fakeAsyncDisablePatchingClock')] === true; + // the original variable name fakeAsyncPatchLock is not accurate, so the name will be + // fakeAsyncAutoFakeAsyncWhenClockPatched and if this enablePatchingJasmineClock is false, we also + // automatically disable the auto jump into fakeAsync feature + var enableAutoFakeAsyncWhenClockPatched = !disablePatchingJasmineClock && + ((_global[symbol('fakeAsyncPatchLock')] === true) || + (_global[symbol('fakeAsyncAutoFakeAsyncWhenClockPatched')] === true)); var ignoreUnhandledRejection = _global[symbol('ignoreUnhandledRejection')] === true; if (!ignoreUnhandledRejection) { var globalErrors_1 = jasmine.GlobalErrors; @@ -484,48 +490,50 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; return originalJasmineFn.apply(this, arguments); }; }); - // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so - // they can work properly in FakeAsyncTest - var originalClockFn = (jasmine[symbol('clock')] = jasmine['clock']); - jasmine['clock'] = function () { - var clock = originalClockFn.apply(this, arguments); - if (!clock[symbol('patched')]) { - clock[symbol('patched')] = symbol('patched'); - var originalTick_1 = (clock[symbol('tick')] = clock.tick); - clock.tick = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); - } - return originalTick_1.apply(this, arguments); - }; - var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); - clock.mockDate = function () { - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); - if (fakeAsyncZoneSpec) { - var dateTime = arguments.length > 0 ? arguments[0] : new Date(); - return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : - arguments); + if (!disablePatchingJasmineClock) { + // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so + // they can work properly in FakeAsyncTest + var originalClockFn_1 = (jasmine[symbol('clock')] = jasmine['clock']); + jasmine['clock'] = function () { + var clock = originalClockFn_1.apply(this, arguments); + if (!clock[symbol('patched')]) { + clock[symbol('patched')] = symbol('patched'); + var originalTick_1 = (clock[symbol('tick')] = clock.tick); + clock.tick = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments); + } + return originalTick_1.apply(this, arguments); + }; + var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate); + clock.mockDate = function () { + var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec'); + if (fakeAsyncZoneSpec) { + var dateTime = arguments.length > 0 ? arguments[0] : new Date(); + return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] : + arguments); + } + return originalMockDate_1.apply(this, arguments); + }; + // for auto go into fakeAsync feature, we need the flag to enable it + if (enableAutoFakeAsyncWhenClockPatched) { + ['install', 'uninstall'].forEach(function (methodName) { + var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); + clock[methodName] = function () { + var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; + if (FakeAsyncTestZoneSpec) { + jasmine[symbol('clockInstalled')] = 'install' === methodName; + return; + } + return originalClockFn.apply(this, arguments); + }; + }); } - return originalMockDate_1.apply(this, arguments); - }; - // for auto go into fakeAsync feature, we need the flag to enable it - if (enableClockPatch) { - ['install', 'uninstall'].forEach(function (methodName) { - var originalClockFn = (clock[symbol(methodName)] = clock[methodName]); - clock[methodName] = function () { - var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec']; - if (FakeAsyncTestZoneSpec) { - jasmine[symbol('clockInstalled')] = 'install' === methodName; - return; - } - return originalClockFn.apply(this, arguments); - }; - }); } - } - return clock; - }; + return clock; + }; + } /** * Gets a function wrapping the body of a Jasmine `describe` block to execute in a * synchronous-only zone. @@ -539,7 +547,7 @@ Zone['SyncTestZoneSpec'] = SyncTestZoneSpec; var isClockInstalled = !!jasmine[symbol('clockInstalled')]; var testProxyZoneSpec = queueRunner.testProxyZoneSpec; var testProxyZone = queueRunner.testProxyZone; - if (isClockInstalled && enableClockPatch) { + if (isClockInstalled && enableAutoFakeAsyncWhenClockPatched) { // auto run a fakeAsync var fakeAsyncModule = Zone[Zone.__symbol__('fakeAsyncTest')]; if (fakeAsyncModule && typeof fakeAsyncModule.fakeAsync === 'function') { @@ -1025,7 +1033,7 @@ var __spread = (undefined && undefined.__spread) || function () { if (doTick) { doTick(this._currentTime - lastCurrentTime); } - var retval = current_1.func.apply(global, current_1.args); + var retval = current_1.func.apply(global, current_1.isRequestAnimationFrame ? [this._currentTime] : current_1.args); if (!retval) { // Uncaught exception in the current scheduled function. Stop processing the queue. break; diff --git a/dist/zone.js b/dist/zone.js index f812a3b72..75d3e835e 100644 --- a/dist/zone.js +++ b/dist/zone.js @@ -2632,7 +2632,11 @@ function propertyDescriptorPatch(api, _global) { patchFilteredProperties(Worker_1.prototype, workerEventNames, ignoreProperties); } } - patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + var XMLHttpRequest = _global['XMLHttpRequest']; + if (XMLHttpRequest) { + // XMLHttpRequest is not available in ServiceWorker, so we need to check here + patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties); + } var XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget']; if (XMLHttpRequestEventTarget) { patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties); @@ -2734,7 +2738,7 @@ function eventTargetLegacyPatch(_global, api) { apis = WTF_ISSUE_555_ARRAY.map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET); } else if (_global[EVENT_TARGET]) { - // EventTarget is already patched in browser.ts + apis.push(EVENT_TARGET); } else { // Note: EventTarget is not available in all browsers, @@ -2809,6 +2813,7 @@ function eventTargetLegacyPatch(_global, api) { // vh is validateHandler to check event handler // is valid or not(for security check) api.patchEventTarget(_global, apiTypes, { vh: checkIEAndCrossContext }); + Zone[api.symbol('patchEventTarget')] = !!_global[EVENT_TARGET]; return true; } @@ -2883,8 +2888,8 @@ function propertyDescriptorLegacyPatch(api, _global) { if (isNode && !isMix) { return; } - var supportsWebSocket = typeof WebSocket !== 'undefined'; - if (!canPatchViaPropertyDescriptor(api)) { + if (!canPatchViaPropertyDescriptor(api, _global)) { + var supportsWebSocket = typeof WebSocket !== 'undefined'; // Safari, Android browsers (Jelly Bean) patchViaCapturingAllTheEvents(api); api.patchClass('XMLHttpRequest'); @@ -2894,7 +2899,7 @@ function propertyDescriptorLegacyPatch(api, _global) { Zone[api.symbol('patchEvents')] = true; } } -function canPatchViaPropertyDescriptor(api) { +function canPatchViaPropertyDescriptor(api, _global) { var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix; if ((isBrowser || isMix) && !api.ObjectGetOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && @@ -2904,6 +2909,26 @@ function canPatchViaPropertyDescriptor(api) { var desc = api.ObjectGetOwnPropertyDescriptor(Element.prototype, 'onclick'); if (desc && !desc.configurable) return false; + // try to use onclick to detect whether we can patch via propertyDescriptor + // because XMLHttpRequest is not available in service worker + if (desc) { + api.ObjectDefineProperty(Element.prototype, 'onclick', { + enumerable: true, + configurable: true, + get: function () { + return true; + } + }); + var div = document.createElement('div'); + var result = !!div.onclick; + api.ObjectDefineProperty(Element.prototype, 'onclick', desc); + return result; + } + } + var XMLHttpRequest = _global['XMLHttpRequest']; + if (!XMLHttpRequest) { + // XMLHttpRequest is not available in service worker + return false; } var ON_READY_STATE_CHANGE = 'onreadystatechange'; var XMLHttpRequestPrototype = XMLHttpRequest.prototype; @@ -3156,7 +3181,7 @@ function patchTimer(window, setName, cancelName, nameSuffix) { */ function patchCustomElements(_global, api) { var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix; - if ((!isBrowser && !isMix) || !('customElements' in _global)) { + if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) { return; } var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback']; @@ -3171,6 +3196,10 @@ function patchCustomElements(_global, api) { * found in the LICENSE file at https://angular.io/license */ function eventTargetPatch(_global, api) { + if (Zone[api.symbol('patchEventTarget')]) { + // EventTarget is already patched. + return; + } var _a = api.getGlobalObjects(), eventNames = _a.eventNames, zoneSymbolEventNames = _a.zoneSymbolEventNames, TRUE_STR = _a.TRUE_STR, FALSE_STR = _a.FALSE_STR, ZONE_SYMBOL_PREFIX = _a.ZONE_SYMBOL_PREFIX; // predefine all __zone_symbol__ + eventName + true/false string for (var i = 0; i < eventNames.length; i++) { @@ -3264,6 +3293,11 @@ Zone.__load_patch('XHR', function (global, Zone) { var XHR_URL = zoneSymbol('xhrURL'); var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled'); function patchXHR(window) { + var XMLHttpRequest = window['XMLHttpRequest']; + if (!XMLHttpRequest) { + // XMLHttpRequest is not available in service worker + return; + } var XMLHttpRequestPrototype = XMLHttpRequest.prototype; function findPendingTask(target) { return target[XHR_TASK]; diff --git a/dist/zone.min.js b/dist/zone.min.js index 3c96665e7..5709b6db5 100644 --- a/dist/zone.min.js +++ b/dist/zone.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";!function(e){var t=e.performance;function n(e){t&&t.mark&&t.mark(e)}function r(e,n){t&&t.measure&&t.measure(e,n)}n("Zone");var o=!0===e.__zone_symbol__forceDuplicateZoneCheck;if(e.Zone){if(o||"function"!=typeof e.Zone.__symbol__)throw new Error("Zone already loaded.");return e.Zone}var a,i=function(){function t(e,t){this._parent=e,this._name=t?t.name||"unnamed":"",this._properties=t&&t.properties||{},this._zoneDelegate=new c(this,this._parent&&this._parent._zoneDelegate,t)}return t.assertZonePatched=function(){if(e.Promise!==P.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:!0,configurable:!0}),Object.defineProperty(t,"current",{get:function(){return Z.zone},enumerable:!0,configurable:!0}),Object.defineProperty(t,"currentTask",{get:function(){return j},enumerable:!0,configurable:!0}),t.__load_patch=function(a,i){if(P.hasOwnProperty(a)){if(o)throw Error("Already loaded patch: "+a)}else if(!e["__Zone_disable_"+a]){var s="Zone:"+a;n(s),P[a]=i(e,t,D),r(s,s)}},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,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){Z={parent:Z,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{Z=Z.parent}},t.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),Z={parent:Z,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{Z=Z.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||y).name+"; Execution: "+this.name+")");if(e.state!==_||e.type!==O&&e.type!==S){var r=e.state!=k;r&&e._transitionTo(k,b),e.runCount++;var o=j;j=e,Z={parent:Z,zone:this};try{e.type==S&&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!==_&&e.state!==E&&(e.type==O||e.data&&e.data.isPeriodic?r&&e._transitionTo(b,k):(e.runCount=0,this._updateTaskCount(e,-1),r&&e._transitionTo(_,k,_))),Z=Z.parent,j=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(m,_);var n=[];e._zoneDelegates=n,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(E,m,_),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===n&&this._updateTaskCount(e,1),e.state==m&&e._transitionTo(b,m),e},t.prototype.scheduleMicroTask=function(e,t,n,r){return this.scheduleTask(new l(w,e,t,n,r,void 0))},t.prototype.scheduleMacroTask=function(e,t,n,r,o){return this.scheduleTask(new l(S,e,t,n,r,o))},t.prototype.scheduleEventTask=function(e,t,n,r,o){return this.scheduleTask(new l(O,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||y).name+"; Execution: "+this.name+")");e._transitionTo(T,b,k);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(E,T),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(_,T),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};this.hasTask(this.zone,a)}},e}(),l=function(){function t(n,r,o,a,i,s){this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=n,this.source=r,this.data=a,this.scheduleFn=i,this.cancelFn=s,this.callback=o;var c=this;n===O&&a&&a.useG?this.invoke=t.invokeTask:this.invoke=function(){return t.invokeTask.call(e,c,this,arguments)}}return t.invokeTask=function(e,t,n){e||(e=this),z++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==z&&g(),z--}},Object.defineProperty(t.prototype,"zone",{get:function(){return this._zone},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),t.prototype.cancelScheduleRequest=function(){this._transitionTo(_,m)},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==_&&(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}(),u=I("setTimeout"),f=I("Promise"),p=I("then"),h=[],d=!1;function v(t){if(0===z&&0===h.length)if(a||e[f]&&(a=e[f].resolve(0)),a){var n=a[p];n||(n=a.then),n.call(a,g)}else e[u](g,0);t&&h.push(t)}function g(){if(!d){for(d=!0;h.length;){var e=h;h=[];for(var t=0;t=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}};Zone.__load_patch("ZoneAwarePromise",function(t,n,r){var o=Object.getOwnPropertyDescriptor,a=Object.defineProperty;var i=r.symbol,s=[],c=i("Promise"),l=i("then"),u="__creationTrace__";r.onUnhandledError=function(e){if(r.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)}},r.microtaskDrainDone=function(){for(;s.length;)for(var e=function(){var e=s.shift();try{e.zone.runGuarded(function(){throw e})}catch(e){p(e)}};s.length;)e()};var f=i("unhandledPromiseRejectionHandler");function p(e){r.onUnhandledError(e);try{var t=n[f];t&&"function"==typeof t&&t.call(this,e)}catch(e){}}function h(e){return e&&e.then}function d(e){return e}function v(e){return R.reject(e)}var g=i("state"),y=i("value"),_=i("finally"),m=i("parentPromiseValue"),b=i("parentPromiseState"),k="Promise.then",T=null,E=!0,w=!1,S=0;function O(e,t){return function(n){try{j(e,t,n)}catch(t){j(e,!1,t)}}}var P=function(){var e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},D="Promise resolved with itself",Z=i("currentTaskTrace");function j(e,t,o){var i=P();if(e===o)throw new TypeError(D);if(e[g]===T){var c=null;try{"object"!=typeof o&&"function"!=typeof o||(c=o&&o.then)}catch(t){return i(function(){j(e,!1,t)})(),e}if(t!==w&&o instanceof R&&o.hasOwnProperty(g)&&o.hasOwnProperty(y)&&o[g]!==T)C(o),j(e,o[g],o[y]);else if(t!==w&&"function"==typeof c)try{c.call(o,i(O(e,t)),i(O(e,!1)))}catch(t){i(function(){j(e,!1,t)})()}else{e[g]=t;var l=e[y];if(e[y]=o,e[_]===_&&t===E&&(e[g]=e[b],e[y]=e[m]),t===w&&o instanceof Error){var f=n.currentTask&&n.currentTask.data&&n.currentTask.data[u];f&&a(o,Z,{configurable:!0,enumerable:!1,writable:!0,value:f})}for(var p=0;p=0;n--)"function"==typeof e[n]&&(e[n]=h(e[n],t+"_"+n));return e}function T(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&void 0===e.set)}var E="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,w=!("nw"in _)&&void 0!==_.process&&"[object process]"==={}.toString.call(_.process),S=!w&&!E&&!(!g||!y.HTMLElement),O=void 0!==_.process&&"[object process]"==={}.toString.call(_.process)&&!E&&!(!g||!y.HTMLElement),P={},D=function(e){if(e=e||_.event){var t=P[e.type];t||(t=P[e.type]=v("ON_PROPERTY"+e.type));var n,r=this||e.target||_,o=r[t];if(S&&r===y&&"error"===e.type){var a=e;!0===(n=o&&o.call(this,a.message,a.filename,a.lineno,a.colno,a.error))&&e.preventDefault()}else null==(n=o&&o.apply(this,arguments))||n||e.preventDefault();return n}};function Z(e,r,o){var a=t(e,r);!a&&o&&(t(o,r)&&(a={enumerable:!0,configurable:!0}));if(a&&a.configurable){var i=v("on"+r+"patched");if(!e.hasOwnProperty(i)||!e[i]){delete a.writable,delete a.value;var s=a.get,c=a.set,l=r.substr(2),u=P[l];u||(u=P[l]=v("ON_PROPERTY"+l)),a.set=function(t){var n=this;(n||e!==_||(n=_),n)&&(n[u]&&n.removeEventListener(l,D),c&&c.apply(n,b),"function"==typeof t?(n[u]=t,n.addEventListener(l,D,!1)):n[u]=null)},a.get=function(){var t=this;if(t||e!==_||(t=_),!t)return null;var n=t[u];if(n)return n;if(s){var o=s&&s.call(this);if(o)return a.set.call(this,o),"function"==typeof t[m]&&t.removeAttribute(r),o}return null},n(e,r,a),e[i]=!0}}}function j(e,t,n){if(t)for(var r=0;r=0&&"function"==typeof r[a.cbIdx]?d(a.name,r[a.cbIdx],a,o):e.apply(t,r)}})}function M(e,t){e[v("OriginalDelegate")]=t}var x=!1,N=!1;function F(){try{var e=y.navigator.userAgent;if(-1!==e.indexOf("MSIE ")||-1!==e.indexOf("Trident/"))return!0}catch(e){}return!1}function H(){if(x)return N;x=!0;try{var e=y.navigator.userAgent;-1===e.indexOf("MSIE ")&&-1===e.indexOf("Trident/")&&-1===e.indexOf("Edge/")||(N=!0)}catch(e){}return N}Zone.__load_patch("toString",function(e){var t=Function.prototype.toString,n=v("OriginalDelegate"),r=v("Promise"),o=v("Error"),a=function(){if("function"==typeof this){var a=this[n];if(a)return"function"==typeof a?t.call(a):Object.prototype.toString.call(a);if(this===Promise){var i=e[r];if(i)return t.call(i)}if(this===Error){var s=e[o];if(s)return t.call(s)}}return t.call(this)};a[n]=t,Function.prototype.toString=a;var i=Object.prototype.toString;Object.prototype.toString=function(){return this instanceof Promise?"[object Promise]":i.call(this)}});var A=!1;if("undefined"!=typeof window)try{var B=Object.defineProperty({},"passive",{get:function(){A=!0}});window.addEventListener("test",B,B),window.removeEventListener("test",B,B)}catch(e){A=!1}var G={useG:!0},q={},W={},U=/^__zone_symbol__(\w+)(true|false)$/,X="__zone_symbol__propagationStopped";function V(e,t,n){var o=n&&n.add||i,a=n&&n.rm||s,c=n&&n.listeners||"eventListeners",l=n&&n.rmAll||"removeAllListeners",h=v(o),d="."+o+":",g="prependListener",y="."+g+":",_=function(e,t,n){if(!e.isRemoved){var r=e.callback;"object"==typeof r&&r.handleEvent&&(e.callback=function(e){return r.handleEvent(e)},e.originalDelegate=r),e.invoke(e,t,[n]);var o=e.options;if(o&&"object"==typeof o&&o.once){var i=e.originalDelegate?e.originalDelegate:e.callback;t[a].call(t,n.type,i,o)}}},m=function(t){if(t=t||e.event){var n=this||t.target||e,r=n[q[t.type][f]];if(r)if(1===r.length)_(r[0],n,t);else for(var o=r.slice(),a=0;a1?new a(t,n):new a(t),l=e.ObjectGetOwnPropertyDescriptor(c,"onmessage");return l&&!1===l.configurable?(i=e.ObjectCreate(c),s=c,[r,o,"send","close"].forEach(function(t){i[t]=function(){var n=e.ArraySlice.call(arguments);if(t===r||t===o){var a=n.length>0?n[0]:void 0;if(a){var s=Zone.__symbol__("ON_PROPERTY"+a);c[s]=i[s]}}return c[t].apply(c,n)}})):i=c,e.patchOnProperties(i,["close","error","message","open"],s),i};var i=t.WebSocket;for(var s in a)i[s]=a[s]}(e,t),Zone[e.symbol("patchEvents")]=!0)}}Zone.__load_patch("util",function(e,r,c){c.patchOnProperties=j,c.patchMethod=R,c.bindArguments=k,c.patchMacroTask=L;var l=r.__symbol__("BLACK_LISTED_EVENTS"),d=r.__symbol__("UNPATCHED_EVENTS");e[d]&&(e[l]=e[d]),e[l]&&(r[l]=r[d]=e[l]),c.patchEventPrototype=K,c.patchEventTarget=V,c.isIEOrEdge=H,c.ObjectDefineProperty=n,c.ObjectGetOwnPropertyDescriptor=t,c.ObjectCreate=o,c.ArraySlice=a,c.patchClass=C,c.wrapWithCurrentZone=h,c.filterProperties=ye,c.attachOriginToPatched=M,c._redefineProperty=re,c.patchCallbacks=J,c.getGlobalObjects=function(){return{globalSources:W,zoneSymbolEventNames:q,eventNames:ge,isBrowser:S,isMix:O,isNode:w,TRUE_STR:u,FALSE_STR:f,ZONE_SYMBOL_PREFIX:p,ADD_EVENT_LISTENER_STR:i,REMOVE_EVENT_LISTENER_STR:s}}}),function(e){e.__zone_symbol__legacyPatch=function(){var t=e.Zone;t.__load_patch("registerElement",function(e,t,n){!function(e,t){var n=t.getGlobalObjects(),r=n.isBrowser,o=n.isMix;(r||o)&&"registerElement"in e.document&&t.patchCallbacks(t,document,"Document","registerElement",["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"])}(e,n)}),t.__load_patch("EventTargetLegacy",function(e,t,n){!function(e,t){var n=t.getGlobalObjects(),r=n.eventNames,o=n.globalSources,a=n.zoneSymbolEventNames,i=n.TRUE_STR,s=n.FALSE_STR,c=n.ZONE_SYMBOL_PREFIX,l="Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video",u="ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket".split(","),f=[],p=e.wtf,h=l.split(",");p?f=h.map(function(e){return"HTML"+e+"Element"}).concat(u):e.EventTarget||(f=u);for(var d=e.__Zone_disable_IE_check||!1,v=e.__Zone_enable_cross_context_check||!1,g=t.isIEOrEdge(),y="function __BROWSERTOOLS_CONSOLE_SAFEFUNC() { [native code] }",_=0;_0){var o=e.invoke;e.invoke=function(){for(var n=r.__zone_symbol__loadfalse,a=0;a",this._properties=t&&t.properties||{},this._zoneDelegate=new s(this,this._parent&&this._parent._zoneDelegate,t)}return t.assertZonePatched=function(){if(e.Promise!==P.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:!0,configurable:!0}),Object.defineProperty(t,"current",{get:function(){return Z.zone},enumerable:!0,configurable:!0}),Object.defineProperty(t,"currentTask",{get:function(){return j},enumerable:!0,configurable:!0}),t.__load_patch=function(a,i){if(P.hasOwnProperty(a)){if(o)throw Error("Already loaded patch: "+a)}else if(!e["__Zone_disable_"+a]){var c="Zone:"+a;n(c),P[a]=i(e,t,D),r(c,c)}},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,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){Z={parent:Z,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{Z=Z.parent}},t.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),Z={parent:Z,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{Z=Z.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||y).name+"; Execution: "+this.name+")");if(e.state!==_||e.type!==S&&e.type!==O){var r=e.state!=k;r&&e._transitionTo(k,b),e.runCount++;var o=j;j=e,Z={parent:Z,zone:this};try{e.type==O&&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!==_&&e.state!==E&&(e.type==S||e.data&&e.data.isPeriodic?r&&e._transitionTo(b,k):(e.runCount=0,this._updateTaskCount(e,-1),r&&e._transitionTo(_,k,_))),Z=Z.parent,j=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(m,_);var n=[];e._zoneDelegates=n,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(E,m,_),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===n&&this._updateTaskCount(e,1),e.state==m&&e._transitionTo(b,m),e},t.prototype.scheduleMicroTask=function(e,t,n,r){return this.scheduleTask(new l(w,e,t,n,r,void 0))},t.prototype.scheduleMacroTask=function(e,t,n,r,o){return this.scheduleTask(new l(O,e,t,n,r,o))},t.prototype.scheduleEventTask=function(e,t,n,r,o){return this.scheduleTask(new l(S,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||y).name+"; Execution: "+this.name+")");e._transitionTo(T,b,k);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(E,T),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(_,T),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};this.hasTask(this.zone,a)}},e}(),l=function(){function t(n,r,o,a,i,c){this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=n,this.source=r,this.data=a,this.scheduleFn=i,this.cancelFn=c,this.callback=o;var s=this;n===S&&a&&a.useG?this.invoke=t.invokeTask:this.invoke=function(){return t.invokeTask.call(e,s,this,arguments)}}return t.invokeTask=function(e,t,n){e||(e=this),z++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==z&&g(),z--}},Object.defineProperty(t.prototype,"zone",{get:function(){return this._zone},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),t.prototype.cancelScheduleRequest=function(){this._transitionTo(_,m)},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==_&&(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}(),u=I("setTimeout"),f=I("Promise"),p=I("then"),h=[],d=!1;function v(t){if(0===z&&0===h.length)if(a||e[f]&&(a=e[f].resolve(0)),a){var n=a[p];n||(n=a.then),n.call(a,g)}else e[u](g,0);t&&h.push(t)}function g(){if(!d){for(d=!0;h.length;){var e=h;h=[];for(var t=0;t=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}};Zone.__load_patch("ZoneAwarePromise",function(t,n,r){var o=Object.getOwnPropertyDescriptor,a=Object.defineProperty;var i=r.symbol,c=[],s=i("Promise"),l=i("then"),u="__creationTrace__";r.onUnhandledError=function(e){if(r.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)}},r.microtaskDrainDone=function(){for(;c.length;)for(var e=function(){var e=c.shift();try{e.zone.runGuarded(function(){throw e})}catch(e){p(e)}};c.length;)e()};var f=i("unhandledPromiseRejectionHandler");function p(e){r.onUnhandledError(e);try{var t=n[f];t&&"function"==typeof t&&t.call(this,e)}catch(e){}}function h(e){return e&&e.then}function d(e){return e}function v(e){return R.reject(e)}var g=i("state"),y=i("value"),_=i("finally"),m=i("parentPromiseValue"),b=i("parentPromiseState"),k="Promise.then",T=null,E=!0,w=!1,O=0;function S(e,t){return function(n){try{j(e,t,n)}catch(t){j(e,!1,t)}}}var P=function(){var e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},D="Promise resolved with itself",Z=i("currentTaskTrace");function j(e,t,o){var i=P();if(e===o)throw new TypeError(D);if(e[g]===T){var s=null;try{"object"!=typeof o&&"function"!=typeof o||(s=o&&o.then)}catch(t){return i(function(){j(e,!1,t)})(),e}if(t!==w&&o instanceof R&&o.hasOwnProperty(g)&&o.hasOwnProperty(y)&&o[g]!==T)C(o),j(e,o[g],o[y]);else if(t!==w&&"function"==typeof s)try{s.call(o,i(S(e,t)),i(S(e,!1)))}catch(t){i(function(){j(e,!1,t)})()}else{e[g]=t;var l=e[y];if(e[y]=o,e[_]===_&&t===E&&(e[g]=e[b],e[y]=e[m]),t===w&&o instanceof Error){var f=n.currentTask&&n.currentTask.data&&n.currentTask.data[u];f&&a(o,Z,{configurable:!0,enumerable:!1,writable:!0,value:f})}for(var p=0;p=0;n--)"function"==typeof e[n]&&(e[n]=h(e[n],t+"_"+n));return e}function T(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&void 0===e.set)}var E="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,w=!("nw"in _)&&void 0!==_.process&&"[object process]"==={}.toString.call(_.process),O=!w&&!E&&!(!g||!y.HTMLElement),S=void 0!==_.process&&"[object process]"==={}.toString.call(_.process)&&!E&&!(!g||!y.HTMLElement),P={},D=function(e){if(e=e||_.event){var t=P[e.type];t||(t=P[e.type]=v("ON_PROPERTY"+e.type));var n,r=this||e.target||_,o=r[t];if(O&&r===y&&"error"===e.type){var a=e;!0===(n=o&&o.call(this,a.message,a.filename,a.lineno,a.colno,a.error))&&e.preventDefault()}else null==(n=o&&o.apply(this,arguments))||n||e.preventDefault();return n}};function Z(e,r,o){var a=t(e,r);!a&&o&&(t(o,r)&&(a={enumerable:!0,configurable:!0}));if(a&&a.configurable){var i=v("on"+r+"patched");if(!e.hasOwnProperty(i)||!e[i]){delete a.writable,delete a.value;var c=a.get,s=a.set,l=r.substr(2),u=P[l];u||(u=P[l]=v("ON_PROPERTY"+l)),a.set=function(t){var n=this;(n||e!==_||(n=_),n)&&(n[u]&&n.removeEventListener(l,D),s&&s.apply(n,b),"function"==typeof t?(n[u]=t,n.addEventListener(l,D,!1)):n[u]=null)},a.get=function(){var t=this;if(t||e!==_||(t=_),!t)return null;var n=t[u];if(n)return n;if(c){var o=c&&c.call(this);if(o)return a.set.call(this,o),"function"==typeof t[m]&&t.removeAttribute(r),o}return null},n(e,r,a),e[i]=!0}}}function j(e,t,n){if(t)for(var r=0;r=0&&"function"==typeof r[a.cbIdx]?d(a.name,r[a.cbIdx],a,o):e.apply(t,r)}})}function M(e,t){e[v("OriginalDelegate")]=t}var x=!1,N=!1;function F(){try{var e=y.navigator.userAgent;if(-1!==e.indexOf("MSIE ")||-1!==e.indexOf("Trident/"))return!0}catch(e){}return!1}function H(){if(x)return N;x=!0;try{var e=y.navigator.userAgent;-1===e.indexOf("MSIE ")&&-1===e.indexOf("Trident/")&&-1===e.indexOf("Edge/")||(N=!0)}catch(e){}return N}Zone.__load_patch("toString",function(e){var t=Function.prototype.toString,n=v("OriginalDelegate"),r=v("Promise"),o=v("Error"),a=function(){if("function"==typeof this){var a=this[n];if(a)return"function"==typeof a?t.call(a):Object.prototype.toString.call(a);if(this===Promise){var i=e[r];if(i)return t.call(i)}if(this===Error){var c=e[o];if(c)return t.call(c)}}return t.call(this)};a[n]=t,Function.prototype.toString=a;var i=Object.prototype.toString;Object.prototype.toString=function(){return this instanceof Promise?"[object Promise]":i.call(this)}});var A=!1;if("undefined"!=typeof window)try{var B=Object.defineProperty({},"passive",{get:function(){A=!0}});window.addEventListener("test",B,B),window.removeEventListener("test",B,B)}catch(e){A=!1}var G={useG:!0},W={},q={},U=/^__zone_symbol__(\w+)(true|false)$/,X="__zone_symbol__propagationStopped";function V(e,t,n){var o=n&&n.add||i,a=n&&n.rm||c,s=n&&n.listeners||"eventListeners",l=n&&n.rmAll||"removeAllListeners",h=v(o),d="."+o+":",g="prependListener",y="."+g+":",_=function(e,t,n){if(!e.isRemoved){var r=e.callback;"object"==typeof r&&r.handleEvent&&(e.callback=function(e){return r.handleEvent(e)},e.originalDelegate=r),e.invoke(e,t,[n]);var o=e.options;if(o&&"object"==typeof o&&o.once){var i=e.originalDelegate?e.originalDelegate:e.callback;t[a].call(t,n.type,i,o)}}},m=function(t){if(t=t||e.event){var n=this||t.target||e,r=n[W[t.type][f]];if(r)if(1===r.length)_(r[0],n,t);else for(var o=r.slice(),a=0;a1?new a(t,n):new a(t),l=e.ObjectGetOwnPropertyDescriptor(s,"onmessage");return l&&!1===l.configurable?(i=e.ObjectCreate(s),c=s,[r,o,"send","close"].forEach(function(t){i[t]=function(){var n=e.ArraySlice.call(arguments);if(t===r||t===o){var a=n.length>0?n[0]:void 0;if(a){var c=Zone.__symbol__("ON_PROPERTY"+a);s[c]=i[c]}}return s[t].apply(s,n)}})):i=s,e.patchOnProperties(i,["close","error","message","open"],c),i};var i=t.WebSocket;for(var c in a)i[c]=a[c]}(e,t),Zone[e.symbol("patchEvents")]=!0}}Zone.__load_patch("util",function(e,r,s){s.patchOnProperties=j,s.patchMethod=R,s.bindArguments=k,s.patchMacroTask=L;var l=r.__symbol__("BLACK_LISTED_EVENTS"),d=r.__symbol__("UNPATCHED_EVENTS");e[d]&&(e[l]=e[d]),e[l]&&(r[l]=r[d]=e[l]),s.patchEventPrototype=K,s.patchEventTarget=V,s.isIEOrEdge=H,s.ObjectDefineProperty=n,s.ObjectGetOwnPropertyDescriptor=t,s.ObjectCreate=o,s.ArraySlice=a,s.patchClass=C,s.wrapWithCurrentZone=h,s.filterProperties=ye,s.attachOriginToPatched=M,s._redefineProperty=re,s.patchCallbacks=J,s.getGlobalObjects=function(){return{globalSources:q,zoneSymbolEventNames:W,eventNames:ge,isBrowser:O,isMix:S,isNode:w,TRUE_STR:u,FALSE_STR:f,ZONE_SYMBOL_PREFIX:p,ADD_EVENT_LISTENER_STR:i,REMOVE_EVENT_LISTENER_STR:c}}}),function(e){e.__zone_symbol__legacyPatch=function(){var t=e.Zone;t.__load_patch("registerElement",function(e,t,n){!function(e,t){var n=t.getGlobalObjects(),r=n.isBrowser,o=n.isMix;(r||o)&&"registerElement"in e.document&&t.patchCallbacks(t,document,"Document","registerElement",["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"])}(e,n)}),t.__load_patch("EventTargetLegacy",function(e,t,n){be(e,n),ke(n,e)})}}("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global);var Te=v("zoneTask");function Ee(e,t,n,r){var o=null,a=null;n+=r;var i={};function c(t){var n=t.data;return n.args[0]=function(){try{t.invoke.apply(this,arguments)}finally{t.data&&t.data.isPeriodic||("number"==typeof n.handleId?delete i[n.handleId]:n.handleId&&(n.handleId[Te]=null))}},n.handleId=o.apply(e,n.args),t}function s(e){return a(e.data.handleId)}o=R(e,t+=r,function(n){return function(o,a){if("function"==typeof a[0]){var l={isPeriodic:"Interval"===r,delay:"Timeout"===r||"Interval"===r?a[1]||0:void 0,args:a},u=d(t,a[0],l,c,s);if(!u)return u;var f=u.data.handleId;return"number"==typeof f?i[f]=u:f&&(f[Te]=u),f&&f.ref&&f.unref&&"function"==typeof f.ref&&"function"==typeof f.unref&&(u.ref=f.ref.bind(f),u.unref=f.unref.bind(f)),"number"==typeof f||f?f:u}return n.apply(e,a)}}),a=R(e,n,function(t){return function(n,r){var o,a=r[0];"number"==typeof a?o=i[a]:(o=a&&a[Te])||(o=a),o&&"string"==typeof o.type?"notScheduled"!==o.state&&(o.cancelFn&&o.data.isPeriodic||0===o.runCount)&&("number"==typeof a?delete i[a]:a&&(a[Te]=null),o.zone.cancelTask(o)):t.apply(e,r)}})}function we(e,t){if(!Zone[t.symbol("patchEventTarget")]){for(var n=t.getGlobalObjects(),r=n.eventNames,o=n.zoneSymbolEventNames,a=n.TRUE_STR,i=n.FALSE_STR,c=n.ZONE_SYMBOL_PREFIX,s=0;s0){var o=e.invoke;e.invoke=function(){for(var n=r.__zone_symbol__loadfalse,a=0;a