PageSourceSearch

http://acs-uat.advatix.net/acs20/polyfills.22f2a8b687dd0aa1.js

js advatix.net collected 2026-09-24 20:05:27 UTC 111,855 bytes, 3,397 lines download raw bytes

1"use strict";
2(self["webpackChunkAdminLTE"] = self["webpackChunkAdminLTE"] || []).push([["polyfills"],{
3
4/***/ 7435:
5/*!**************************!*\
6  !*** ./src/polyfills.ts ***!
7  \**************************/
8/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9
10__webpack_require__.r(__webpack_exports__);
11/* harmony import */ var zone_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! zone.js */ 88583);
12/* harmony import */ var zone_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(zone_js__WEBPACK_IMPORTED_MODULE_0__);
13/**
14 * This file includes polyfills needed by Angular and is loaded before the app.
15 * You can add your own extra polyfills to this file.
16 *
17 * This file is divided into 2 sections:
18 *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
19 *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
20 *      file.
21 *
22 * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
23 * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
24 * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
25 *
26 * Learn more in https://angular.io/guide/browser-support
27 */
28/***************************************************************************************************
29 * BROWSER POLYFILLS
30 */
31/**
32 * By default, zone.js will patch all possible macroTask and DomEvents
33 * user can disable parts of macroTask/DomEvents patch by setting following flags
34 * because those flags need to be set before `zone.js` being loaded, and webpack
35 * will put import in the top of bundle, so user need to create a separate file
36 * in this directory (for example: zone-flags.ts), and put the following flags
37 * into that file, and then add the following code before importing zone.js.
38 * import './zone-flags.ts';
39 *
40 * The flags allowed in zone-flags.ts are listed here.
41 *
42 * The following flags will work for all browsers.
43 *
44 * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45 * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46 * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47 *
48 *  in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49 *  with the following flag, it will bypass `zone.js` patch for IE/Edge
50 *
51 *  (window as any).__Zone_enable_cross_context_check = true;
52 *
53 */
54/***************************************************************************************************
55 * Zone JS is required by default for Angular itself.
56 */
57 // Included with Angular CLI.
58/***************************************************************************************************
59 * APPLICATION IMPORTS
60 */
61
62
63/***/ }),
64
65/***/ 88583:
66/*!***********************************************!*\
67  !*** ./node_modules/zone.js/fesm2015/zone.js ***!
68  \***********************************************/
69/***/ (() => {
70
71
72/**
73 * @license Angular v14.2.0-next.0
74 * (c) 2010-2022 Google LLC. https://angular.io/
75 * License: MIT
76 */
77
78/**
79 * @license
80 * Copyright Google LLC All Rights Reserved.
81 *
82 * Use of this source code is governed by an MIT-style license that can be
83 * found in the LICENSE file at https://angular.io/license
84 */
85
86(function (global) {
87  const performance = global['performance'];
88
89  function mark(name) {
90    performance && performance['mark'] && performance['mark'](name);
91  }
92
93  function performanceMeasure(name, label) {
94    performance && performance['measure'] && performance['measure'](name, label);
95  }
96
97  mark('Zone'); // Initialize before it's accessed below.
98  // __Zone_symbol_prefix global can be used to override the default zone
99  // symbol prefix with a custom one if needed.
100
101  const symbolPrefix = global['__Zone_symbol_prefix'] || '__zone_symbol__';
102
103  function __symbol__(name) {
104    return symbolPrefix + name;
105  }
106
107  const checkDuplicate = global[__symbol__('forceDuplicateZoneCheck')] === true;
108
109  if (global['Zone']) {
110    // if global['Zone'] already exists (maybe zone.js was already loaded or
111    // some other lib also registered a global object named Zone), we may 
111need
112    // to throw an error, but sometimes user may not want this error.
113    // For example,
114    // we have two web pages, page1 includes zone.js, page2 doesn't.
115    // and the 1st time user load page1 and page2, everything work fine,
116    // but when user load page2 again, error occurs because global['Zone'] already exists.
117    // so we add a flag to let user choose whether to throw this error or not.
118    // By default, if existing Zone is from zone.js, we will not throw the error.
119    if (checkDuplicate || typeof global['Zone'].__symbol__ !== 'function') {
120      throw new Error('Zone already loaded.');
121    } else {
122      return global['Zone'];
123    }
124  }
125
126  class Zone {
127    constructor(parent, zoneSpec) {
128      this._parent = parent;
129      this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '<root>';
130      this._properties = zoneSpec && zoneSpec.properties || {};
131      this._zoneDelegate = new _ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);
132    }
133
134    static assertZonePatched() {
135      if (global['Promise'] !== patches['ZoneAwarePromise']) {
136        throw new Error('Zone.js has detected that ZoneAwarePromise `(window|global).Promise` ' + 'has been overwritten.\n' + 'Most 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.)');
137      }
138    }
139
140    static get root() {
141      let zone = Zone.current;
142
143      while (zone.parent) {
144        zone = zone.parent;
145      }
146
147      return zone;
148    }
149
150    static get current() {
151      return _currentZoneFrame.zone;
152    }
153
154    static get currentTask() {
155      return _currentTask;
156    } // tslint:disable-next-line:require-internal-with-underscore
157
158
159    static __load_patch(name, fn, ignoreDuplicate = false) {
160      if (patches.hasOwnProperty(name)) {
161        // `checkDuplicate` option is defined from global variable
162        // so it works for all modules.
163        // `ignoreDuplicate` can work for the specified module
164        if (!ignoreDuplicate && checkDuplicate) {
165          throw Error('Already loaded patch: ' + name);
166        }
167      } else if (!global['__Zone_disable_' + name]) {
168        const perfName = 'Zone:' + name;
169        mark(perfName);
170        patches[name] = fn(global, Zone, _api);
171        performanceMeasure(perfName, perfName);
172      }
173    }
174
175    get parent() {
176      return this._parent;
177    }
178
179    get name() {
180      return this._name;
181    }
182
183    get(key) {
184      const zone = this.getZoneWith(key);
185      if (zone) return zone._properties[key];
186    }
187
188    getZoneWith(key) {
189      let current = this;
190
191      while (current) {
192        if (current._properties.hasOwnProperty(key)) {
193          return current;
194        }
195
196        current = current._parent;
197      }
198
199      return null;
200    }
201
202    fork(zoneSpec) {
203      if (!zoneSpec) throw new Error('ZoneSpec required!');
204      return this._zoneDelegate.fork(this, zoneSpec);
205    }
206
207    wrap(callback, source) {
208      if (typeof callback !== 'function') {
209        throw new Error('Expecting function got: ' + callback);
210      }
211
212      const _callback = this._zoneDelegate.intercept(this, callback, source);
213
214      const zone = this;
215      return function () {
216        return zone.runGuarded(_callback, this, arguments, source);
217      };
218    }
219
220    run(callback, applyThis, applyArgs, source) {
221      _currentZoneFrame = {
222        parent: _currentZoneFrame,
223        zone: this
224      };
225
226      try {
227        return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
228      } finally {
229        _currentZoneFrame = _currentZoneFrame.parent;
230      }
231    }
232
233    runGuarded(callback, applyThis = null, applyArgs, source) {
234      _currentZoneFrame = {
235        parent: _currentZoneFrame,
236        zone: this
237      };
238
239      try {
240        try {
241          return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
242        } catch (error) {
243          if (this._zoneDelegate.handleError(this, error)) {
244            throw error;
245          }
246        }
247      } finally {
248        _currentZoneFrame = _currentZoneFrame.parent;
249      }
250    }
251
252    runTask(task, applyThis, applyArgs) {
253      if (task.zone != this) {
254        throw new Error('A task can only be run in the zone of creation! (Creation: ' + (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');
255      } // https://github.com/angular/zone.js/issues/778, sometimes eventTask
256      // will run in notScheduled(canceled) state, we should not try to
257      // run such kind of task but just return
258
259
260      if (task.state === notScheduled && (task.type === eventTask || task.type === macroTask)) {
261        return;
262      }
263
264      const reEntryGuard = task.state != running;
265      reEntryGuard && task._transitionTo(running, scheduled);
266      task.runCount++;
267      const previousTask = _currentTask;
268      _currentTask = task;
269      _currentZoneFrame = {
270        parent: _currentZoneFrame,
271        zone: this
272      };
273
274      try {
275        if (task.type == macroTask && task.data && !task.data.isPeriodic) {
276          task.cancelFn = undefined;
277        }
278
279        try {
280          return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
281        } catch (error) {
282          if (this._zoneDelegate.handleError(this, error)) {
283            throw error;
284          }
285        }
286      } finally {
287        // if the task's state is notScheduled or unknown, then it has already been cancelled
288        // we should not reset the state to scheduled
289        if (task.state !== notScheduled && task.state !== unknown) {
290          if (task.type == eventTask || task.data && task.data.isPeriodic) {
291            reEntryGuard && task._transitionTo(scheduled, running);
292          } else {
293            task.runCount = 0;
294
295            this._updateTaskCount(task, -1);
296
297            reEntryGuard && task._transitionTo(notScheduled, running, notScheduled);
298          }
299        }
300
301        _currentZoneFrame = _currentZoneFrame.parent;
302        _currentTask = previousTask;
303      }
304    }
305
306    scheduleTask(task) {
307      if (task.zone && task.zone !== this) {
308        // check if the task was rescheduled, the newZone
309        // should not be the children of the original zone
310        let newZone = this;
311
312        while (newZone) {
313          if (newZone === task.zone) {
314            throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${task.zone.name}`);
315          }
316
317          newZone = newZone.parent;
318        }
319      }
320
321      task._transitionTo(scheduling, notScheduled);
322
323      const zoneDelegates = [];
324      task._zoneDelegates = zoneDelegates;
325      task._zone = this;
326
327      try {
328        task = this._zoneDelegate.scheduleTask(this, task);
329      } catch (err) {
330        // should set task's state to unknown when scheduleTask throw error
331        // because the err may from reschedule, so the fromState maybe notScheduled
332        task._transitionTo(unknown, scheduling, notScheduled); // TODO: @JiaLiPassion, should we check the result from handleError?
333
334
335        this._zoneDelegate.handleError(this, err);
336
337        throw err;
338      }
339
340      if (task._zoneDelegates === zoneDelegates) {
341        // we have to check because internally the delegate can reschedule the task.
342        this._updateTaskCount(task, 1);
343      }
344
345      if (task.state == scheduling) {
346        task._transitionTo(scheduled, scheduling);
347      }
348
349      return task;
350    }
351
352    scheduleMicroTask(source, callback, data, customSchedule) {
353      return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, undefined));
354    }
355
356    scheduleMacroTask(source, callback, data, customSchedule, customCancel) {
357      return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));
358    }
359
360    scheduleEventTask(source, callback, data, customSchedule, customCancel) {
361      return this.scheduleTask(new ZoneTask(eventTask, source, callback, data, customSchedule, customCancel));
362    }
363
364    cancelTask(task) {
365      if (task.zone != this) throw new Error('A task can only be cancelled in the zone of creation! (Creation: ' + (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');
366
367      task._transitionTo(canceling, scheduled, running);
368
369      try {
370        this._zoneDelegate.cancelTask(this, task);
371      } catch (err) {
372        // if error occurs when cancelTask, transit the state to unknown
373        task._transitionTo(unknown, canceling);
374
375        this._zoneDelegate.handleError(this, err);
376
377        throw err;
378      }
379
380      this._updateTaskCount(task, -1);
381
382      task._transitionTo(notScheduled, canceling);
383
384      task.runCount = 0;
385      return task;
386    }
387
388    _updateTaskCount(task, count) {
389      const zoneDelegates = task._zoneDelegates;
390
391      if (count == -1) {
392        task._zoneDelegates = null;
393      }
394
395      for (let i = 0; i < zoneDelegates.length; i++) {
396        zoneDelegates[i]._updateTaskCount(task.type, count);
397      }
398    }
399
400  } // tslint:disable-next-line:require-internal-with-underscore
401
402
403  Zone.__symbol__ = __symbol__;
404  const DELEGATE_ZS = {
405    name: '',
406    onHasTask: (delegate, _, target, hasTaskState) => delegate.hasTask(target, hasTaskState),
407    onScheduleTask: (delegate, _, target, task) => delegate.scheduleTask(target, task),
408    onInvokeTask: (delegate, _, target, task, applyThis, applyArgs) => delegate.invokeTask(target, task, applyThis, applyArgs),
409    onCancelTask: (delegate, _, target, task) => delegate.cancelTask(target, task)
410  };
411
412  class _ZoneDelegate {
413    constructor(zone, parentDelegate, zoneSpec) {
414      this._taskCounts = {
415        'microTask': 0,
416        'macroTask': 0,
417        'eventTask': 0
418      };
419      this.zone = zone;
420      this._parentDelegate = parentDelegate;
421      this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS);
422      this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt);
423      this._forkCurrZone = zoneSpec && (zoneSpec.onFork ? this.zone : parentDelegate._forkCurrZone);
424      this._interceptZS = zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS);
425      this._interceptDlgt = zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt);
426      this._interceptCurrZone = zoneSpec && (zoneSpec.onIntercept ? this.zone : parentDelegate._interceptCurrZone);
427      this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS);
428      this._invokeDlgt = zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt);
429      this._invokeCurrZone = zoneSpec && (zoneSpec.onInvoke ? this.zone : parentDelegate._invokeCurrZone);
430      this._handleErrorZS = zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS);
431      this._handleErrorDlgt = zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt);
432      this._handleErrorCurrZone = zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate._handleErrorCurrZone);
433      this._scheduleTaskZS = zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
434      this._scheduleTaskDlgt = zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
435      this._scheduleTaskCurrZone = zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate._scheduleTaskCurrZone);
436      this._invokeTaskZS = zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS);
437      this._invokeTaskDlgt = zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt);
438      this._invokeTaskCurrZone = zoneSpec && (zoneSpec.onInvokeTask ? this.zone : parentDelegate._invokeTaskCurrZone);
439      this._cancelTaskZS = zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS);
440      this._cancelTaskDlgt = zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt);
441      this._cancelTaskCurrZone = zoneSpec && (zoneSpec.onCancelTask ? this.zone : parentDelegate._cancelTaskCurrZone);
442      this._hasTaskZS = null;
443      this._hasTaskDlgt = null;
444      this._hasTaskDlgtOwner = null;
445      this._hasTaskCurrZone = null;
446      const zoneSpecHasTask = zoneSpec && zoneSpec.onHasTask;
447      const parentHasTask = parentDelegate && parentDelegate._hasTaskZS;
448
449      if (zoneSpecHasTask || parentHasTask) {
450        // If we need to report hasTask, than this ZS needs to do ref counting on tasks. In such
451        // a case all task related interceptors must go through this ZD. We can't short circuit it.
452        this._hasTaskZS = zoneSpecHasTask ? zoneSpec : DELEGATE_ZS;
453        this._hasTaskDlgt = parentDelegate;
454        this._hasTaskDlgtOwner = this;
455        this._hasTaskCurrZone = zone;
456
457        if (!zoneSpec.onScheduleTask) {
458          this._scheduleTaskZS = DELEGATE_ZS;
459          this._scheduleTaskDlgt = parentDelegate;
460          this._scheduleTaskCurrZone = this.zone;
461        }
462
463        if (!zoneSpec.onInvokeTask) {
464          this._invokeTaskZS = DELEGATE_ZS;
465          this._invokeTaskDlgt = parentDelegate;
466          this._invokeTaskCurrZone = this.zone;
467        }
468
469        if (!zoneSpec.onCancelTask) {
470          this._cancelTaskZS = DELEGATE_ZS;
471          this._cancelTaskDlgt = parentDelegate;
472          this._cancelTaskCurrZone = this.zone;
473        }
474      }
475    }
476
477    fork(targetZone, zoneSpec) {
478      return this._forkZS ? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec) : new Zone(targetZone, zoneSpec);
479    }
480
481    intercept(targetZone, callback, source) {
482      return this._interceptZS ? this._interceptZS.onIntercept(this._interceptDlgt, this._interceptCurrZone, targetZone, callback, source) : callback;
483    }
484
485    invoke(targetZone, callback, applyThis, applyArgs, source) {
486      return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) : callback.apply(applyThis, applyArgs);
487    }
488
489    handleError(targetZone, error) {
490      return this._handleErrorZS ? this._handleErrorZS.onHandleError(this._handleErrorDlgt, this._handleErrorCurrZone, targetZone, error) : true;
491    }
492
493    scheduleTask(targetZone, task) {
494      let returnTask = task;
495
496      if (this._scheduleTaskZS) {
497        if (this._hasTaskZS) {
498          returnTask._zoneDelegates.push(this._hasTaskDlgtOwner);
499        } // clang-format off
500
501
502        returnTask = this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this._scheduleTaskCurrZone, targetZone, task); // clang-format on
503
504        if (!returnTask) returnTask = task;
505      } else {
506        if (task.scheduleFn) {
507          task.scheduleFn(task);
508        } else if (task.type == microTask) {
509          scheduleMicroTask(task);
510        } else {
511          throw new Error('Task is missing scheduleFn.');
512        }
513      }
514
515      return returnTask;
516    }
517
518    invokeTask(targetZone, task, applyThis, applyArgs) {
519      return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) : task.callback.apply(applyThis, applyArgs);
520    }
521
522    cancelTask(targetZone, task) {
523      let value;
524
525      if (this._cancelTaskZS) {
526        value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this._cancelTaskCurrZone, targetZone, task);
527      } else {
528        if (!task.cancelFn) {
529          throw Error('Task is not cancelable');
530        }
531
532        value = task.cancelFn(task);
533      }
534
535      return value;
536    }
537
538    hasTask(targetZone, isEmpty) {
539      // hasTask should not throw error so other ZoneDelegate
540      // can still trigger hasTask callback
541      try {
542        this._hasTaskZS && this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);
543      } catch (err) {
544        this.handleError(targetZone, err);
545      }
546    } // tslint:disable-next-line:require-internal-with-underscore
547
548
549    _updateTaskCount(type, count) {
550      const counts = this._taskCounts;
551      const prev = counts[type];
552      const next = counts[type] = prev + count;
553
554      if (next < 0) {
555        throw new Error('More tasks executed then were scheduled.');
556      }
557
558      if (prev == 0 || next == 0) {
559        const isEmpty = {
560          microTask: counts['microTask'] > 0,
561          macroTask: counts['macroTask'] > 0,
562          eventTask: counts['eventTask'] > 0,
563          change: type
564        };
565        this.hasTask(this.zone, isEmpty);
566      }
567    }
568
569  }
570
571  class ZoneTask {
572    constructor(type, source, callback, options, scheduleFn, cancelFn) {
573      // tslint:disable-next-line:require-internal-with-underscore
574      this._zone = null;
575      this.runCount = 0; // tslint:disable-next-line:require-internal-with-underscore
576
577      this._zoneDelegates = null; // tslint:disable-next-line:require-internal-with-underscore
578
579      this._state = 'notScheduled';
580      this.type = type;
581      this.source = source;
582      this.data = options;
583      this.scheduleFn = scheduleFn;
584      this.cancelFn = cancelFn;
585
586      if (!callback) {
587        throw new Error('callback is not defined');
588      }
589
590      this.callback = callback;
591      const self = this; // TODO: @JiaLiPassion options should have interface
592
593      if (type === eventTask && options && options.useG) {
594        this.invoke = ZoneTask.invokeTask;
595      } else {
596        this.invoke = function () {
597          return ZoneTask.invokeTask.call(global, self, this, arguments);
598        };
599      }
600    }
601
602    static invokeTask(task, target, args) {
603      if (!task) {
604        task = this;
605      }
606
607      _numberOfNestedTaskFrames++;
608
609      try {
610        task.runCount++;
611        return task.zone.runTask(task, target, args);
612      } finally {
613        if (_numberOfNestedTaskFrames == 1) {
614          drainMicroTaskQueue();
615        }
616
617        _numberOfNestedTaskFrames--;
618      }
619    }
620
621    get zone() {
622      return this._zone;
623    }
624
625    get state() {
626      return this._state;
627    }
628
629    cancelScheduleRequest() {
630      this._transitionTo(notScheduled, scheduling);
631    } // tslint:disable-next-line:require-internal-with-underscore
632
633
634    _transitionTo(toState, fromState1, fromState2) {
635      if (this._state === fromState1 || this._state === fromState2) {
636        this._state = toState;
637
638        if (toState == notScheduled) {
639          this._zoneDelegates = null;
640        }
641      } else {
642        throw new Error(`${this.type} '${this.source}': can not transition to '${toState}', expecting state '${fromState1}'${fromState2 ? ' or \'' + fromState2 + '\'' : ''}, was '${this._state}'.`);
643      }
644    }
645
646    toString() {
647      if (this.data && typeof this.data.handleId !== 'undefined') {
648        return this.data.handleId.toString();
649      } else {
650        return Object.prototype.toString.call(this);
651      }
652    } // add toJSON method to prevent cyclic error when
653    // call JSON.stringify(zoneTask)
654
655
656    toJSON() {
657      return {
658        type: this.type,
659        state: this.state,
660        source: this.source,
661        zone: this.zone.name,
662        runCount: this.runCount
663      };
664    }
665
666  } //////////////////////////////////////////////////////
667  //////////////////////////////////////////////////////
668  ///  MICROTASK QUEUE
669  //////////////////////////////////////////////////////
670  //////////////////////////////////////////////////////
671
672
673  const symbolSetTimeout = __symbol__('setTimeout');
674
675  const symbolPromise = __symbol__('Promise');
676
677  const symbolThen = __symbol__('then');
678
679  let _microTaskQueue = [];
680  let _isDrainingMicrotaskQueue = false;
681  let nativeMicroTaskQueuePromise;
682
683  function nativeScheduleMicroTask(func) {
684    if (!nativeMicroTaskQueuePromise) {
685      if (global[symbolPromise]) {
686        nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);
687      }
688    }
689
690    if (nativeMicroTaskQueuePromise) {
691      let nativeThen = nativeMicroTaskQueuePromise[symbolThen];
692
693      if (!nativeThen) {
694        // native Promise is not patchable, we need to use `then` directly
695        // issue 1078
696        nativeThen = nativeMicroTaskQueuePromise['then'];
697      }
698
699      nativeThen.call(nativeMicroTaskQueuePromise, func);
700    } else {
701      global[symbolSetTimeout](func, 0);
702    }
703  }
704
705  function scheduleMicroTask(task) {
706    // if we are not running in any task, and there has not been anything scheduled
707    // we must bootstrap the initial task creation by manually scheduling the drain
708    if (_numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0) {
709      // We are not running in Task, so we need to kickstart the microtask queue.
710      nativeScheduleMicroTask(drainMicroTaskQueue);
711    }
712
713    task && _microTaskQueue.push(task);
714  }
715
716  function drainMicroTaskQueue() {
717    if (!_isDrainingMicrotaskQueue) {
718      _isDrainingMicrotaskQueue = true;
719
720      while (_microTaskQueue.length) {
721        const queue = _microTaskQueue;
722        _microTaskQueue = [];
723
724        for (let i = 0; i < queue.length; i++) {
725          const task = queue[i];
726
727          try {
728            task.zone.runTask(task, null, null);
729          } catch (error) {
730            _api.onUnhandledError(error);
731          }
732        }
733      }
734
735      _api.microtaskDrainDone();
736
737      _isDrainingMicrotaskQueue = false;
738    }
739  } //////////////////////////////////////////////////////
740  //////////////////////////////////////////////////////
741  ///  BOOTSTRAP
742  //////////////////////////////////////////////////////
743  //////////////////////////////////////////////////////
744
745
746  const NO_ZONE = {
747    name: 'NO ZONE'
748  };
749  const notScheduled = 'notScheduled',
750        scheduling = 'scheduling',
751        scheduled = 'scheduled',
752        running = 'running',
753        canceling = 'canceling',
754        unknown = 'unknown';
755  const microTask = 'microTask',
756        macroTask = 'macroTask',
757        eventTask = 'eventTask';
758  const patches = {};
759  const _api = {
760    symbol: __symbol__,
761    currentZoneFrame: () => _currentZoneFrame,
762    onUnhandledError: noop,
763    microtaskDrainDone: noop,
764    scheduleMicroTask: scheduleMicroTask,
765    showUncaughtError: () => !Zone[__symbol__('ignoreConsoleErrorUncaughtError')],
766    patchEventTarget: () => [],
767    patchOnProperties: noop,
768    patchMethod: () => noop,
769    bindArguments: () => [],
770    patchThen: () => noop,
771    patchMacroTask: () => noop,
772    patchEventPrototype: () => noop,
773    isIEOrEdge: () => false,
774    getGlobalObjects: () => undefined,
775    ObjectDefineProperty: () => noop,
776    ObjectGetOwnPropertyDescriptor: () => undefined,
777    ObjectCreate: () => undefined,
778    ArraySlice: () => [],
779    patchClass: () => noop,
780    wrapWithCurrentZone: () => noop,
781    filterProperties: () => [],
782    attachOriginToPatched: () => noop,
783    _redefineProperty: () => noop,
784    patchCallbacks: () => noop,
785    nativeScheduleMicroTask: nativeScheduleMicroTask
786  };
787  let _currentZoneFrame = {
788    parent: null,
789    zone: new Zone(null, null)
790  };
791  let _currentTask = null;
792  let _numberOfNestedTaskFrames = 0;
793
794  function noop() {}
795
796  performanceMeasure('Zone', 'Zone');
797  return global['Zone'] = Zone;
798})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
799/**
800 * @license
801 * Copyright Google LLC All Rights Reserved.
802 *
803 * Use of this source code is governed by an MIT-style license that can be
804 * found in the LICENSE file at https://angular.io/license
805 */
806
807/**
808 * Suppress closure compiler errors about unknown 'Zone' variable
809 * @fileoverview
810 * @suppress {undefinedVars,globalThis,missingRequire}
811 */
812/// <reference types="node"/>
813// issue #989, to reduce bundle size, use short name
814
815/** Object.getOwnPropertyDescriptor */
816
817
818const ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
819/** Object.defineProperty */
820
821const ObjectDefineProperty = Object.defineProperty;
822/** Object.getPrototypeOf */
823
824const ObjectGetPrototypeOf = Object.getPrototypeOf;
825/** Object.create */
826
827const ObjectCreate = Object.create;
828/** Array.prototype.slice */
829
830const ArraySlice = Array.prototype.slice;
831/** addEventListener string const */
832
833const ADD_EVENT_LISTENER_STR = 'addEventListener';
834/** removeEventListener string const */
835
836const REMOVE_EVENT_LISTENER_STR = 'removeEventListener';
837/** zoneSymbol addEventListener */
838
839const ZONE_SYMBOL_ADD_EVENT_LISTENER = Zone.__symbol__(ADD_EVENT_LISTENER_STR);
840/** zoneSymbol removeEventListener */
841
842
843const ZONE_SYMBOL_REMOVE_EVENT_LISTENER = Zone.__symbol__(REMOVE_EVENT_LISTENER_STR);
844/** true string const */
845
846
847const TRUE_STR = 'true';
848/** false string const */
849
850const FALSE_STR = 'false';
851/** Zone symbol prefix string const. */
852
853const ZONE_SYMBOL_PREFIX = Zone.__symbol__('');
854
855function wrapWithCurrentZone(callback, source) {
856  return Zone.current.wrap(callback, source);
857}
858
859function scheduleMacroTaskWithCurrentZone(source, callback, data, customSchedule, customCancel) {
860  return Zone.current.scheduleMacroTask(source, callback, data, customSchedule, customCancel);
861}
862
863const zoneSymbol = Zone.__symbol__;
864const isWindowExists = typeof window !== 'undefined';
865const internalWindow = isWindowExists ? window : undefined;
866
867const _global = isWindowExists && internalWindow || typeof self === 'object' && self || global;
868
869const REMOVE_ATTRIBUTE = 'removeAttribute';
870
871function bindArguments(args, source) {
872  for (let i = args.length - 1; i >= 0; i--) {
873    if (typeof args[i] === 'function') {
874      args[i] = wrapWithCurrentZone(args[i], source + '_' + i);
875    }
876  }
877
878  return args;
879}
880
881function patchPrototype(prototype, fnNames) {
882  const source = prototype.constructor['name'];
883
884  for (let i = 0; i < fnNames.length; i++) {
885    const name = fnNames[i];
886    const delegate = prototype[name];
887
888    if (delegate) {
889      const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, name);
890
891      if (!isPropertyWritable(prototypeDesc)) {
892        continue;
893      }
894
895      prototype[name] = (delegate => {
896        const patched = function () {
897          return delegate.apply(this, bindArguments(arguments, source + '.' + name));
898        };
899
900        attachOriginToPatched(patched, delegate);
901        return patched;
902      })(delegate);
903    }
904  }
905}
906
907function isPropertyWritable(propertyDesc) {
908  if (!propertyDesc) {
909    return true;
910  }
911
912  if (propertyDesc.writable === false) {
913    return false;
914  }
915
916  return !(typeof propertyDesc.get === 'function' && typeof propertyDesc.set === 'undefined');
917}
918
919const isWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope; // Make sure to access `process` through `_global` so that WebPack does not accidentally browserify
920// this code.
921
922const isNode = !('nw' in _global) && typeof _global.process !== 'undefined' && {}.toString.call(_global.process) === '[object process]';
923const isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow['HTMLElement']); // we are in electron of nw, so we are both browser and nodejs
924// Make sure to access `process` through `_global` so that WebPack does not accidentally browserify
925// this code.
926
927const isMix = typeof _global.process !== 'undefined' && {}.toString.call(_global.process) === '[object process]' && !isWebWorker && !!(isWindowExists && internalWindow['HTMLElement']);
928const zoneSymbolEventNames$1 = {};
929
930const wrapFn = function (event) {
931  // https://github.com/angular/zone.js/issues/911, in IE, sometimes
932  // event will be undefined, so we need to use window.event
933  event = event || _global.event;
934
935  if (!event) {
936    return;
937  }
938
939  let eventNameSymbol = zoneSymbolEventNames$1[event.type];
940
941  if (!eventNameSymbol) {
942    eventNameSymbol = zoneSymbolEventNames$1[event.type] = zoneSymbol('ON_PROPERTY' + event.type);
943  }
944
945  const target = this || event.target || _global;
946  const listener = target[eventNameSymbol];
947  let result;
948
949  if (isBrowser && target === internalWindow && event.type === 'error') {
950    // window.onerror have different signature
951    // https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror#window.onerror
952    // and onerror callback will prevent default when callback return true
953    const errorEvent = event;
954    result = listener && listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error);
955
956    if (result === true) {
957      event.preventDefault();
958    }
959  } else {
960    result = listener && listener.apply(this, arguments);
961
962    if (result != undefined && !result) {
963      event.preventDefault();
964    }
965  }
966
967  return result;
968};
969
970function patchProperty(obj, prop, prototype) {
971  let desc = ObjectGetOwnPropertyDescriptor(obj, prop);
972
973  if (!desc && prototype) {
974    // when patch window object, use prototype to check prop exist or not
975    const prototypeDesc = ObjectGetOwnPropertyDescriptor(prototype, prop);
976
977    if (prototypeDesc) {
978      desc = {
979        enumerable: true,
980        configurable: true
981      };
982    }
983  } // if the descriptor not exists or is not configurable
984  // just return
985
986
987  if (!desc || !desc.configurable) {
988    return;
989  }
990
991  const onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched');
992
993  if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {
994    return;
995  } // A property descriptor cannot have getter/setter and be writable
996  // deleting the writable and value properties avoids this error:
997  //
998  // TypeError: property descriptors must not specify a value or be writable when a
999  // getter or setter has been specified
1000
1001
1002  delete desc.writable;
1003  delete desc.value;
1004  const originalDescGet = desc.get;
1005  const originalDescSet = desc.set; // slice(2) cuz 'onclick' -> 'click', etc
1006
1007  const eventName = prop.slice(2);
1008  let eventNameSymbol = zoneSymbolEventNames$1[eventName];
1009
1010  if (!eventNameSymbol) {
1011    eventNameSymbol = zoneSymbolEventNames$1[eventName] = zoneSymbol('ON_PROPERTY' + eventName);
1012  }
1013
1014  desc.set = function (newValue) {
1015    // in some of windows's onproperty callback, this is undefined
1016    // so we need to check it
1017    let target = this;
1018
1019    if (!target && obj === _global) {
1020      target = _global;
1021    }
1022
1023    if (!target) {
1024      return;
1025    }
1026
1027    const previousValue = target[eventNameSymbol];
1028
1029    if (typeof previousValue === 'function') {
1030      target.removeEventListener(eventName, wrapFn);
1031    } // issue #978, when onload handler was added before loading zone.js
1032    // we should remove it with originalDescSet
1033
1034
1035    originalDescSet && originalDescSet.call(target, null);
1036    target[eventNameSymbol] = newValue;
1037
1038    if (typeof newValue === 'function') {
1039      target.addEventListener(eventName, wrapFn, false);
1040    }
1041  }; // The getter would return undefined for unassigned properties but the default value of an
1042  // unassigned property is null
1043
1044
1045  desc.get = function () {
1046    // in some of windows's onproperty callback, this is undefined
1047    // so we need to check it
1048    let target = this;
1049
1050    if (!target && obj === _global) {
1051      target = _global;
1052    }
1053
1054    if (!target) {
1055      return null;
1056    }
1057
1058    const listener = target[eventNameSymbol];
1059
1060    if (listener) {
1061      return listener;
1062    } else if (originalDescGet) {
1063      // result will be null when use inline event attribute,
1064      // such as <button onclick="func();">OK</button>
1065      // because the onclick function is internal raw uncompiled handler
1066      // the onclick will be evaluated when first time event was triggered or
1067      // the property is accessed, https://github.com/angular/zone.js/issues/525
1068      // so we should use original native get to retrieve the handler
1069      let value = originalDescGet.call(this);
1070
1071      if (value) {
1072        desc.set.call(this, value);
1073
1074        if (typeof target[REMOVE_ATTRIBUTE] === 'function') {
1075          target.removeAttribute(prop);
1076        }
1077
1078        return value;
1079      }
1080    }
1081
1082    return null;
1083  };
1084
1085  ObjectDefineProperty(obj, prop, desc);
1086  obj[onPropPatchedSymbol] = true;
1087}
1088
1089function patchOnProperties(obj, properties, prototype) {
1090  if (properties) {
1091    for (let i = 0; i < properties.length; i++) {
1092      patchProperty(obj, 'on' + properties[i], prototype);
1093    }
1094  } else {
1095    const onProperties = [];
1096
1097    for (const prop in obj) {
1098      if (prop.slice(0, 2) == 'on') {
1099        onProperties.push(prop);
1100      }
1101    }
1102
1103    for (let j = 0; j < onProperties.length; j++) {
1104      patchProperty(obj, onProperties[j], prototype);
1105    }
1106  }
1107}
1108
1109const originalInstanceKey = zoneSymbol('originalInstance'); // wrap some native API on `window`
1110
1111function patchClass(className) {
1112  const OriginalClass = _global[className];
1113  if (!OriginalClass) return; // keep original class in global
1114
1115  _global[zoneSymbol(className)] = OriginalClass;
1116
1117  _global[className] = function () {
1118    const a = bindArguments(arguments, className);
1119
1120    switch (a.length) {
1121      case 0:
1122        this[originalInstanceKey] = new OriginalClass();
1123        break;
1124
1125      case 1:
1126        this[originalInstanceKey] = new OriginalClass(a[0]);
1127        break;
1128
1129      case 2:
1130        this[originalInstanceKey] = new OriginalClass(a[0], a[1]);
1131        break;
1132
1133      case 3:
1134        this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]);
1135        break;
1136
1137      case 4:
1138        this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]);
1139        break;
1140
1141      default:
1142        throw new Error('Arg list too long.');
1143    }
1144  }; // attach original delegate to patched function
1145
1146
1147  attachOriginToPatched(_global[className], OriginalClass);
1148  const instance = new OriginalClass(function () {});
1149  let prop;
1150
1151  for (prop in instance) {
1152    // https://bugs.webkit.org/show_bug.cgi?id=44721
1153    if (className === 'XMLHttpRequest' && prop === 'responseBlob') continue;
1154
1155    (function (prop) {
1156      if (typeof instance[prop] === 'function') {
1157        _global[className].prototype[prop] = function () {
1158          return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments);
1159        };
1160      } else {
1161        ObjectDefineProperty(_global[className].prototype, prop, {
1162          set: function (fn) {
1163            if (typeof fn === 'function') {
1164              this[originalInstanceKey][prop] = wrapWithCurrentZone(fn, className + '.' + prop); // keep callback in wrapped function so we can
1165              // use it in Function.prototype.toString to return
1166              // the native one.
1167
1168              attachOriginToPatched(this[originalInstanceKey][prop], fn);
1169            } else {
1170              this[originalInstanceKey][prop] = fn;
1171            }
1172          },
1173          get: function () {
1174            return this[originalInstanceKey][prop];
1175          }
1176        });
1177      }
1178    })(prop);
1179  }
1180
1181  for (prop in OriginalClass) {
1182    if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) {
1183      _global[className][prop] = OriginalClass[prop];
1184    }
1185  }
1186}
1187
1188function patchMethod(target, name, patchFn) {
1189  let proto = target;
1190
1191  while (proto && !proto.hasOwnProperty(name)) {
1192    proto = ObjectGetPrototypeOf(proto);
1193  }
1194
1195  if (!proto && target[name]) {
1196    // somehow we did not find it, but we can see it. This happens on IE for Window properties.
1197    proto = target;
1198  }
1199
1200  const delegateName = zoneSymbol(name);
1201  let delegate = null;
1202
1203  if (proto && (!(delegate = proto[delegateName]) || !proto.hasOwnProperty(delegateName))) {
1204    delegate = proto[delegateName] = proto[name]; // check whether proto[name] is writable
1205    // some property is readonly in safari, such as HtmlCanvasElement.prototype.toBlob
1206
1207    const desc = proto && ObjectGetOwnPropertyDescriptor(proto, name);
1208
1209    if (isPropertyWritable(desc)) {
1210      const patchDelegate = patchFn(delegate, delegateName, name);
1211
1212      proto[name] = function () {
1213        return patchDelegate(this, arguments);
1214      };
1215
1216      attachOriginToPatched(proto[name], delegate);
1217    }
1218  }
1219
1220  return delegate;
1221} // TODO: @JiaLiPassion, support cancel task later if necessary
1222
1223
1224function patchMacroTask(obj, funcName, metaCreator) {
1225  let setNative = null;
1226
1227  function scheduleTask(task) {
1228    const data = task.data;
1229
1230    data.args[data.cbIdx] = function () {
1231      task.invoke.apply(this, arguments);
1232    };
1233
1234    setNative.apply(data.target, data.args);
1235    return task;
1236  }
1237
1238  setNative = patchMethod(obj, funcName, delegate => function (self, args) {
1239    const meta = metaCreator(self, args);
1240
1241    if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === 'function') {
1242      return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask);
1243    } else {
1244      // cause an error by calling it directly.
1245      return delegate.apply(self, args);
1246    }
1247  });
1248}
1249
1250function attachOriginToPatched(patched, original) {
1251  patched[zoneSymbol('OriginalDelegate')] = original;
1252}
1253
1254let isDetectedIEOrEdge = false;
1255let ieOrEdge = false;
1256
1257function isIE() {
1258  try {
1259    const ua = internalWindow.navigator.userAgent;
1260
1261    if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1) {
1262      return true;
1263    }
1264  } catch (error) {}
1265
1266  return false;
1267}
1268
1269function isIEOrEdge() {
1270  if (isDetectedIEOrEdge) {
1271    return ieOrEdge;
1272  }
1273
1274  isDetectedIEOrEdge = true;
1275
1276  try {
1277    const ua = internalWindow.navigator.userAgent;
1278
1279    if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1 || ua.indexOf('Edge/') !== -1) {
1280      ieOrEdge = true;
1281    }
1282  } catch (error) {}
1283
1284  return ieOrEdge;
1285}
1286/**
1287 * @license
1288 * Copyright Google LLC All Rights Reserved.
1289 *
1290 * Use of this source code is governed by an MIT-style license that can be
1291 * found in the LICENSE file at https://angular.io/license
1292 */
1293
1294
1295Zone.__load_patch('ZoneAwarePromise', (global, Zone, api) => {
1296  const ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1297  const ObjectDefineProperty = Object.defineProperty;
1298
1299  function readableObjectToString(obj) {
1300    if (obj && obj.toString === Object.prototype.toString) {
1301      const className = obj.constructor && obj.constructor.name;
1302      return (className ? className : '') + ': ' + JSON.stringify(obj);
1303    }
1304
1305    return obj ? obj.toString() : Object.prototype.toString.call(obj);
1306  }
1307
1308  const __symbol__ = api.symbol;
1309  const _uncaughtPromiseErrors = [];
1310  const isDisableWrappingUncaughtPromiseRejection = global[__symbol__('DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION')] === true;
1311
1312  const symbolPromise = __symbol__('Promise');
1313
1314  const symbolThen = __symbol__('then');
1315
1316  const creationTrace = '__creationTrace__';
1317
1318  api.onUnhandledError = e => {
1319    if (api.showUncaughtError()) {
1320      const rejection = e && e.rejection;
1321
1322      if (rejection) {
1323        console.error('Unhandled Promise rejection:', rejection instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name, '; Task:', e.task && e.task.source, '; Value:', rejection, rejection instanceof Error ? rejection.stack : undefined);
1324      } else {
1325        console.error(e);
1326      }
1327    }
1328  };
1329
1330  api.microtaskDrainDone = () => {
1331    while (_uncaughtPromiseErrors.length) {
1332      const uncaughtPromiseError = _uncaughtPromiseErrors.shift();
1333
1334      try {
1335        uncaughtPromiseError.zone.runGuarded(() => {
1336          if (uncaughtPromiseError.throwOriginal) {
1337            throw uncaughtPromiseError.rejection;
1338          }
1339
1340          throw uncaughtPromiseError;
1341        });
1342      } catch (error) {
1343        handleUnhandledRejection(error);
1344      }
1345    }
1346  };
1347
1348  const UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__('unhandledPromiseRejectionHandler');
1349
1350  function handleUnhandledRejection(e) {
1351    api.onUnhandledError(e);
1352
1353    try {
1354      const handler = Zone[UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL];
1355
1356      if (typeof handler === 'function') {
1357        handler.call(this, e);
1358      }
1359    } catch (err) {}
1360  }
1361
1362  function isThenable(value) {
1363    return value && value.then;
1364  }
1365
1366  function forwardResolution(value) {
1367    return value;
1368  }
1369
1370  function forwardRejection(rejection) {
1371    return ZoneAwarePromise.reject(rejection);
1372  }
1373
1374  const symbolState = __symbol__('state');
1375
1376  const symbolValue = __symbol__('value');
1377
1378  const symbolFinally = __symbol__('finally');
1379
1380  const symbolParentPromiseValue = __symbol__('parentPromiseValue');
1381
1382  const symbolParentPromiseState = __symbol__('parentPromiseState');
1383
1384  const source = 'Promise.then';
1385  const UNRESOLVED = null;
1386  const RESOLVED = true;
1387  const REJECTED = false;
1388  const REJECTED_NO_CATCH = 0;
1389
1390  function makeResolver(promise, state) {
1391    return v => {
1392      try {
1393        resolvePromise(promise, state, v);
1394      } catch (err) {
1395        resolvePromise(promise, false, err);
1396      } // Do not return value or you will break the Promise spec.
1397
1398    };
1399  }
1400
1401  const once = function () {
1402    let wasCalled = false;
1403    return function wrapper(wrappedFunction) {
1404      return function () {
1405        if (wasCalled) {
1406          return;
1407        }
1408
1409        wasCalled = true;
1410        wrappedFunction.apply(null, arguments);
1411      };
1412    };
1413  };
1414
1415  const TYPE_ERROR = 'Promise resolved with itself';
1416
1417  const CURRENT_TASK_TRACE_SYMBOL = __symbol__('currentTaskTrace'); // Promise Resolution
1418
1419
1420  function resolvePromise(promise, state, value) {
1421    const onceWrapper = once();
1422
1423    if (promise === value) {
1424      throw new TypeError(TYPE_ERROR);
1425    }
1426
1427    if (promise[symbolState] === UNRESOLVED) {
1428      // should only get value.then once based on promise spec.
1429      let then = null;
1430
1431      try {
1432        if (typeof value === 'object' || typeof value === 'function') {
1433          then = value && value.then;
1434        }
1435      } catch (err) {
1436        onceWrapper(() => {
1437          resolvePromise(promise, false, err);
1438        })();
1439        return promise;
1440      } // if (value instanceof ZoneAwarePromise) {
1441
1442
1443      if (state !== REJECTED && value instanceof ZoneAwarePromise && value.hasOwnProperty(symbolState) && value.hasOwnProperty(symbolValue) && value[symbolState] !== UNRESOLVED) {
1444        clearRejectedNoCatch(value);
1445        resolvePromise(promise, value[symbolState], value[symbolValue]);
1446      } else if (state !== REJECTED && typeof then === 'function') {
1447        try {
1448          then.call(value, onceWrapper(makeResolver(promise, state)), onceWrapper(makeResolver(promise, false)));
1449        } catch (err) {
1450          onceWrapper(() => {
1451            resolvePromise(promise, false, err);
1452          })();
1453        }
1454      } else {
1455        promise[symbolState] = state;
1456        const queue = promise[symbolValue];
1457        promise[symbolValue] = value;
1458
1459        if (promise[symbolFinally] === symbolFinally) {
1460          // the promise is generated by Promise.prototype.finally
1461          if (state === RESOLVED) {
1462            // the state is resolved, should ignore the value
1463            // and use parent promise value
1464            promise[symbolState] = promise[symbolParentPromiseState];
1465            promise[symbolValue] = promise[symbolParentPromiseValue];
1466          }
1467        } // record task information in value when error occurs, so we can
1468        // do some additional work such as render longStackTrace
1469
1470
1471        if (state === REJECTED && value instanceof Error) {
1472          // check if longStackTraceZone is here
1473          const trace = Zone.currentTask && Zone.currentTask.data && Zone.currentTask.data[creationTrace];
1474
1475          if (trace) {
1476            // only keep the long stack trace into error when in longStackTraceZone
1477            ObjectDefineProperty(value, CURRENT_TASK_TRACE_SYMBOL, {
1478              configurable: true,
1479              enumerable: false,
1480              writable: true,
1481              value: trace
1482            });
1483          }
1484        }
1485
1486        for (let i = 0; i < queue.length;) {
1487          scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]);
1488        }
1489
1490        if (queue.length == 0 && state == REJECTED) {
1491          promise[symbolState] = REJECTED_NO_CATCH;
1492          let uncaughtPromiseError = value;
1493
1494          try {
1495            // Here we throws a new Error to print more readable error log
1496            // and if the value is not an error, zone.js builds an `Error`
1497            // Object here to attach the stack information.
1498            throw new Error('Uncaught (in promise): ' + readableObjectToString(value) + (value && value.stack ? '\n' + value.stack : ''));
1499          } catch (err) {
1500            uncaughtPromiseError = err;
1501          }
1502
1503          if (isDisableWrappingUncaughtPromiseRejection) {
1504            // If disable wrapping uncaught promise reject
1505            // use the value instead of wrapping it.
1506            uncaughtPromiseError.throwOriginal = true;
1507          }
1508
1509          uncaughtPromiseError.rejection = value;
1510          uncaughtPromiseError.promise = promise;
1511          uncaughtPromiseError.zone = Zone.current;
1512          uncaughtPromiseError.task = Zone.currentTask;
1513
1514          _uncaughtPromiseErrors.push(uncaughtPromiseError);
1515
1516          api.scheduleMicroTask(); // to make sure that it is running
1517        }
1518      }
1519    } // Resolving an already resolved promise is a noop.
1520
1521
1522    return promise;
1523  }
1524
1525  const REJECTION_HANDLED_HANDLER = __symbol__('rejectionHandledHandler');
1526
1527  function clearRejectedNoCatch(promise) {
1528    if (promise[symbolState] === REJECTED_NO_CATCH) {
1529      // if the promise is rejected no catch status
1530      // and queue.length > 0, means there is a error handler
1531      // here to handle the rejected promise, we should trigger
1532      // windows.rejectionhandled eventHandler or nodejs rejectionHandled
1533      // eventHandler
1534      try {
1535        const handler = Zone[REJECTION_HANDLED_HANDLER];
1536
1537        if (handler && typeof handler === 'function') {
1538          handler.call(this, {
1539            rejection: promise[symbolValue],
1540            promise: promise
1541          });
1542        }
1543      } catch (err) {}
1544
1545      promise[symbolState] = REJECTED;
1546
1547      for (let i = 0; i < _uncaughtPromiseErrors.length; i++) {
1548        if (promise === _uncaughtPromiseErrors[i].promise) {
1549          _uncaughtPromiseErrors.splice(i, 1);
1550        }
1551      }
1552    }
1553  }
1554
1555  function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) {
1556    clearRejectedNoCatch(promise);
1557    const promiseState = promise[symbolState];
1558    const delegate = promiseState ? typeof onFulfilled === 'function' ? onFulfilled : forwardResolution : typeof onRejected === 'function' ? onRejected : forwardRejection;
1559    zone.scheduleMicroTask(source, () => {
1560      try {
1561        const parentPromiseValue = promise[symbolValue];
1562        const isFinallyPromise = !!chainPromise && symbolFinally === chainPromise[symbolFinally];
1563
1564        if (isFinallyPromise) {
1565          // if the promise is generated from finally call, keep parent promise's state and value
1566          chainPromise[symbolParentPromiseValue] = parentPromiseValue;
1567          chainPromise[symbolParentPromiseState] = promiseState;
1568        } // should not pass value to finally callback
1569
1570
1571        const value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ? [] : [parentPromiseValue]);
1572        resolvePromise(chainPromise, true, value);
1573      } catch (error) {
1574        // if error occurs, should always return this error
1575        resolvePromise(chainPromise, false, error);
1576      }
1577    }, chainPromise);
1578  }
1579
1580  const ZONE_AWARE_PROMISE_TO_STRING = 'function ZoneAwarePromise() { [native code] }';
1581
1582  const noop = function () {};
1583
1584  const AggregateError = global.AggregateError;
1585
1586  class ZoneAwarePromise {
1587    static toString() {
1588      return ZONE_AWARE_PROMISE_TO_STRING;
1589    }
1590
1591    static resolve(value) {
1592      return resolvePromise(new this(null), RESOLVED, value);
1593    }
1594
1595    static reject(error) {
1596      return resolvePromise(new this(null), REJECTED, error);
1597    }
1598
1599    static any(values) {
1600      if (!values || typeof values[Symbol.iterator] !== 'function') {
1601        return Promise.reject(new AggregateError([], 'All promises were rejected'));
1602      }
1603
1604      const promises = [];
1605      let count = 0;
1606
1607      try {
1608        for (let v of values) {
1609          count++;
1610          promises.push(ZoneAwarePromise.resolve(v));
1611        }
1612      } catch (err) {
1613        return Promise.reject(new AggregateError([], 'All promises were rejected'));
1614      }
1615
1616      if (count === 0) {
1617        return Promise.reject(new AggregateError([], 'All promises were rejected'));
1618      }
1619
1620      let finished = false;
1621      const errors = [];
1622      return new ZoneAwarePromise((resolve, reject) => {
1623        for (let i = 0; i < promises.length; i++) {
1624          promises[i].then(v => {
1625            if (finished) {
1626              return;
1627            }
1628
1629            finished = true;
1630            resolve(v);
1631          }, err => {
1632            errors.push(err);
1633            count--;
1634
1635            if (count === 0) {
1636              finished = true;
1637              reject(new AggregateError(errors, 'All promises were rejected'));
1638            }
1639          });
1640        }
1641      });
1642    }
1643
1644    static race(values) {
1645      let resolve;
1646      let reject;
1647      let promise = new this((res, rej) => {
1648        resolve = res;
1649        reject = rej;
1650      });
1651
1652      function onResolve(value) {
1653        resolve(value);
1654      }
1655
1656      function onReject(error) {
1657        reject(error);
1658      }
1659
1660      for (let value of values) {
1661        if (!isThenable(value)) {
1662          value = this.resolve(value);
1663        }
1664
1665        value.then(onResolve, onReject);
1666      }
1667
1668      return promise;
1669    }
1670
1671    static all(values) {
1672      return ZoneAwarePromise.allWithCallback(values);
1673    }
1674
1675    static allSettled(values) {
1676      const P = this && this.prototype instanceof ZoneAwarePromise ? this : ZoneAwarePromise;
1677      return P.allWithCallback(values, {
1678        thenCallback: value => ({
1679          status: 'fulfilled',
1680          value
1681        }),
1682        errorCallback: err => ({
1683          status: 'rejected',
1684          reason: err
1685        })
1686      });
1687    }
1688
1689    static allWithCallback(values, callback) {
1690      let resolve;
1691      let reject;
1692      let promise = new this((res, rej) => {
1693        resolve = res;
1694        reject = rej;
1695      }); // Start at 2 to prevent prematurely resolving if .then is called 
1695immediately.
1696
1697      let unresolvedCount = 2;
1698      let valueIndex = 0;
1699      const resolvedValues = [];
1700
1701      for (let value of values) {
1702        if (!isThenable(value)) {
1703          value = this.resolve(value);
1704        }
1705
1706        const curValueIndex = valueIndex;
1707
1708        try {
1709          value.then(value => {
1710            resolvedValues[curValueIndex] = callback ? callback.thenCallback(value) : value;
1711            unresolvedCount--;
1712
1713            if (unresolvedCount === 0) {
1714              resolve(resolvedValues);
1715            }
1716          }, err => {
1717            if (!callback) {
1718              reject(err);
1719            } else {
1720              resolvedValues[curValueIndex] = callback.errorCallback(err);
1721              unresolvedCount--;
1722
1723              if (unresolvedCount === 0) {
1724                resolve(resolvedValues);
1725              }
1726            }
1727          });
1728        } catch (thenErr) {
1729          reject(thenErr);
1730        }
1731
1732        unresolvedCount++;
1733        valueIndex++;
1734      } // Make the unresolvedCount zero-based again.
1735
1736
1737      unresolvedCount -= 2;
1738
1739      if (unresolvedCount === 0) {
1740        resolve(resolvedValues);
1741      }
1742
1743      return promise;
1744    }
1745
1746    constructor(executor) {
1747      const promise = this;
1748
1749      if (!(promise instanceof ZoneAwarePromise)) {
1750        throw new Error('Must be an instanceof Promise.');
1751      }
1752
1753      promise[symbolState] = UNRESOLVED;
1754      promise[symbolValue] = []; // queue;
1755
1756      try {
1757        const onceWrapper = once();
1758        executor && executor(onceWrapper(makeResolver(promise, RESOLVED)), onceWrapper(makeResolver(promise, REJECTED)));
1759      } catch (error) {
1760        resolvePromise(promise, false, error);
1761      }
1762    }
1763
1764    get [Symbol.toStringTag]() {
1765      return 'Promise';
1766    }
1767
1768    get [Symbol.species]() {
1769      return ZoneAwarePromise;
1770    }
1771
1772    then(onFulfilled, onRejected) {
1773      var _a; // We must read `Symbol.species` safely because `this` may be anything. For instance, `this`
1774      // may be an object without a prototype (created through `Object.create(null)`); thus
1775      // `this.constructor` will be undefined. One of the use cases is SystemJS creating
1776      // prototype-less objects (modules) via `Object.create(null)`. The SystemJS creates an empty
1777      // object and copies promise properties into that object (within the `getOrCreateLoad`
1778      // function). The zone.js then checks if the resolved value has the `then` method and invokes
1779      // it with the `value` context. Otherwise, this will throw an error: `TypeError: Cannot read
1780      // properties of undefined (reading 'Symbol(Symbol.species)')`.
1781
1782
1783      let C = (_a = this.constructor) === null || _a === void 0 ? void 0 : _a[Symbol.species];
1784
1785      if (!C || typeof C !== 'function') {
1786        C = this.constructor || ZoneAwarePromise;
1787      }
1788
1789      const chainPromise = new C(noop);
1790      const zone = Zone.current;
1791
1792      if (this[symbolState] == UNRESOLVED) {
1793        this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected);
1794      } else {
1795        scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected);
1796      }
1797
1798      return chainPromise;
1799    }
1800
1801    catch(onRejected) {
1802      return this.then(null, onRejected);
1803    }
1804
1805    finally(onFinally) {
1806      var _a; // See comment on the call to `then` about why thee `Symbol.species` is safely accessed.
1807
1808
1809      let C = (_a = this.constructor) === null || _a === void 0 ? void 0 : _a[Symbol.species];
1810
1811      if (!C || typeof C !== 'function') {
1812        C = ZoneAwarePromise;
1813      }
1814
1815      const chainPromise = new C(noop);
1816      chainPromise[symbolFinally] = symbolFinally;
1817      const zone = Zone.current;
1818
1819      if (this[symbolState] == UNRESOLVED) {
1820        this[symbolValue].push(zone, chainPromise, onFinally, onFinally);
1821      } else {
1822        scheduleResolveOrReject(this, zone, chainPromise, onFinally, onFinally);
1823      }
1824
1825      return chainPromise;
1826    }
1827
1828  } // Protect against aggressive optimizers dropping seemingly unused properties.
1829  // E.g. Closure Compiler in advanced mode.
1830
1831
1832  ZoneAwarePromise['resolve'] = ZoneAwarePromise.resolve;
1833  ZoneAwarePromise['reject'] = ZoneAwarePromise.reject;
1834  ZoneAwarePromise['race'] = ZoneAwarePromise.race;
1835  ZoneAwarePromise['all'] = ZoneAwarePromise.all;
1836  const NativePromise = global[symbolPromise] = global['Promise'];
1837  global['Promise'] = ZoneAwarePromise;
1838
1839  const symbolThenPatched = __symbol__('thenPatched');
1840
1841  function patchThen(Ctor) {
1842    const proto = Ctor.prototype;
1843    const prop = ObjectGetOwnPropertyDescriptor(proto, 'then');
1844
1845    if (prop && (prop.writable === false || !prop.configurable)) {
1846      // check Ctor.prototype.then propertyDescriptor is writable or not
1847      // in meteor env, writable is false, we should ignore such case
1848      return;
1849    }
1850
1851    const originalThen = proto.then; // Keep a reference to the original method.
1852
1853    proto[symbolThen] = originalThen;
1854
1855    Ctor.prototype.then = function (onResolve, onReject) {
1856      const wrapped = new ZoneAwarePromise((resolve, reject) => {
1857        originalThen.call(this, resolve, reject);
1858      });
1859      return wrapped.then(onResolve, onReject);
1860    };
1861
1862    Ctor[symbolThenPatched] = true;
1863  }
1864
1865  api.patchThen = patchThen;
1866
1867  function zoneify(fn) {
1868    return function (self, args) {
1869      let resultPromise = fn.apply(self, args);
1870
1871      if (resultPromise instanceof ZoneAwarePromise) {
1872        return resultPromise;
1873      }
1874
1875      let ctor = resultPromise.constructor;
1876
1877      if (!ctor[symbolThenPatched]) {
1878        patchThen(ctor);
1879      }
1880
1881      return resultPromise;
1882    };
1883  }
1884
1885  if (NativePromise) {
1886    patchThen(NativePromise);
1887    patchMethod(global, 'fetch', delegate => zoneify(delegate));
1888  } // This is not part of public API, but it is useful for tests, so we expose it.
1889
1890
1891  Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;
1892  return ZoneAwarePromise;
1893});
1894/**
1895 * @license
1896 * Copyright Google LLC All Rights Reserved.
1897 *
1898 * Use of this source code is governed by an MIT-style license that can be
1899 * found in the LICENSE file at https://angular.io/license
1900 */
1901// override Function.prototype.toString to make zone.js patched function
1902// look like native function
1903
1904
1905Zone.__load_patch('toString', global => {
1906  // patch Func.prototype.toString to let them look like native
1907  const originalFunctionToString = Function.prototype.toString;
1908  const ORIGINAL_DELEGATE_SYMBOL = zoneSymbol('OriginalDelegate');
1909  const PROMISE_SYMBOL = zoneSymbol('Promise');
1910  const ERROR_SYMBOL = zoneSymbol('Error');
1911
1912  const newFunctionToString = function toString() {
1913    if (typeof this === 'function') {
1914      const originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL];
1915
1916      if (originalDelegate) {
1917        if (typeof originalDelegate === 'function') {
1918          return originalFunctionToString.call(originalDelegate);
1919        } else {
1920          return Object.prototype.toString.call(originalDelegate);
1921        }
1922      }
1923
1924      if (this === Promise) {
1925        const nativePromise = global[PROMISE_SYMBOL];
1926
1927        if (nativePromise) {
1928          return originalFunctionToString.call(nativePromise);
1929        }
1930      }
1931
1932      if (this === Error) {
1933        const nativeError = global[ERROR_SYMBOL];
1934
1935        if (nativeError) {
1936          return originalFunctionToString.call(nativeError);
1937        }
1938      }
1939    }
1940
1941    return originalFunctionToString.call(this);
1942  };
1943
1944  newFunctionToString[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString;
1945  Function.prototype.toString = newFunctionToString; // patch Object.prototype.toString to let them look like native
1946
1947  const originalObjectToString = Object.prototype.toString;
1948  const PROMISE_OBJECT_TO_STRING = '[object Promise]';
1949
1950  Object.prototype.toString = function () {
1951    if (typeof Promise === 'function' && this instanceof Promise) {
1952      return PROMISE_OBJECT_TO_STRING;
1953    }
1954
1955    return originalObjectToString.call(this);
1956  };
1957});
1958/**
1959 * @license
1960 * Copyright Google LLC All Rights Reserved.
1961 *
1962 * Use of this source code is governed by an MIT-style license that can be
1963 * found in the LICENSE file at https://angular.io/license
1964 */
1965
1966
1967let passiveSupported = false;
1968
1969if (typeof window !== 'undefined') {
1970  try {
1971    const options = Object.defineProperty({}, 'passive', {
1972      get: function () {
1973        passiveSupported = true;
1974      }
1975    }); // Note: We pass the `options` object as the event handler too. This is not compatible with the
1976    // signature of `addEventListener` or `removeEventListener` but enables us to remove the handler
1977    // without an actual handler.
1978
1979    window.addEventListener('test', options, options);
1980    window.removeEventListener('test', options, options);
1981  } catch (err) {
1982    passiveSupported = false;
1983  }
1984} // an identifier to tell ZoneTask do not create a new invoke closure
1985
1986
1987const OPTIMIZED_ZONE_EVENT_TASK_DATA = {
1988  useG: true
1989};
1990const zoneSymbolEventNames = {};
1991const globalSources = {};
1992const EVENT_NAME_SYMBOL_REGX = new RegExp('^' + ZONE_SYMBOL_PREFIX + '(\\w+)(true|false)$');
1993const IMMEDIATE_PROPAGATION_SYMBOL = zoneSymbol('propagationStopped');
1994
1995function prepareEventNames(eventName, eventNameToString) {
1996  const falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;
1997  const trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;
1998  const symbol = ZONE_SYMBOL_PREFIX + falseEventName;
1999  const symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
2000  zoneSymbolEventNames[eventName] = {};
2001  zoneSymbolEventNames[eventName][FALSE_STR] = symbol;
2002  zoneSymbolEventNames[eventName][TRUE_STR] = symbolCapture;
2003}
2004
2005function patchEventTarget(_global, api, apis, patchOptions) {
2006  const ADD_EVENT_LISTENER = patchOptions && patchOptions.add || ADD_EVENT_LISTENER_STR;
2007  const REMOVE_EVENT_LISTENER = patchOptions && patchOptions.rm || REMOVE_EVENT_LISTENER_STR;
2008  const LISTENERS_EVENT_LISTENER = patchOptions && patchOptions.listeners || 'eventListeners';
2009  const REMOVE_ALL_LISTENERS_EVENT_LISTENER = patchOptions && patchOptions.rmAll || 'removeAllListeners';
2010  const zoneSymbolAddEventListener = zoneSymbol(ADD_EVENT_LISTENER);
2011  const ADD_EVENT_LISTENER_SOURCE = '.' + ADD_EVENT_LISTENER + ':';
2012  const PREPEND_EVENT_LISTENER = 'prependListener';
2013  const PREPEND_EVENT_LISTENER_SOURCE = '.' + PREPEND_EVENT_LISTENER + ':';
2014
2015  const invokeTask = function (task, target, event) {
2016    // for better performance, check isRemoved which is set
2017    // by removeEventListener
2018    if (task.isRemoved) {
2019      return;
2020    }
2021
2022    const delegate = task.callback;
2023
2024    if (typeof delegate === 'object' && delegate.handleEvent) {
2025      // create the bind version of handleEvent when invoke
2026      task.callback = event => delegate.handleEvent(event);
2027
2028      task.originalDelegate = delegate;
2029    } // invoke static task.invoke
2030    // need to try/catch error here, otherwise, the error in one event listener
2031    // will break the executions of the other event listeners. Also error will
2032    // not remove the event listener when `once` options is true.
2033
2034
2035    let error;
2036
2037    try {
2038      task.invoke(task, target, [event]);
2039    } catch (err) {
2040      error = err;
2041    }
2042
2043    const options = task.options;
2044
2045    if (options && typeof options === 'object' && options.once) {
2046      // if options.once is true, after invoke once remove listener here
2047      // only browser need to do this, nodejs eventEmitter will cal removeListener
2048      // inside EventEmitter.once
2049      const delegate = task.originalDelegate ? task.originalDelegate : task.callback;
2050      target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate, options);
2051    }
2052
2053    return error;
2054  };
2055
2056  function globalCallback(context, event, isCapture) {
2057    // https://github.com/angular/zone.js/issues/911, in IE, sometimes
2058    // event will be undefined, so we need to use window.event
2059    event = event || _global.event;
2060
2061    if (!event) {
2062      return;
2063    } // event.target is needed for Samsung TV and SourceBuffer
2064    // || global is needed https://github.com/angular/zone.js/issues/190
2065
2066
2067    const target = context || event.target || _global;
2068    const tasks = target[zoneSymbolEventNames[event.type][isCapture ? TRUE_STR : FALSE_STR]];
2069
2070    if (tasks) {
2071      const errors = []; // invoke all tasks which attached to current target with given event.type and capture = false
2072      // for performance concern, if task.length === 1, just invoke
2073
2074      if (tasks.length === 1) {
2075        const err = invokeTask(tasks[0], target, event);
2076        err && errors.push(err);
2077      } else {
2078        // https://github.com/angular/zone.js/issues/836
2079        // copy the tasks array before invoke, to avoid
2080        // the callback will remove itself or other listener
2081        const copyTasks = tasks.slice();
2082
2083        for (let i = 0; i < copyTasks.length; i++) {
2084          if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {
2085            break;
2086          }
2087
2088          const err = invokeTask(copyTasks[i], target, event);
2089          err && errors.push(err);
2090        }
2091      } // Since there is only one error, we don't need to schedule microTask
2092      // to throw the error.
2093
2094
2095      if (errors.length === 1) {
2096        throw errors[0];
2097      } else {
2098        for (let i = 0; i < errors.length; i++) {
2099          const err = errors[i];
2100          api.nativeScheduleMicroTask(() => {
2101            throw err;
2102          });
2103        }
2104      }
2105    }
2106  } // global shared zoneAwareCallback to handle all event callback with capture = false
2107
2108
2109  const globalZoneAwareCallback = function (event) {
2110    return globalCallback(this, event, false);
2111  }; // global shared zoneAwareCallback to handle all event callback with capture = true
2112
2113
2114  const globalZoneAwareCaptureCallback = function (event) {
2115    return globalCallback(this, event, true);
2116  };
2117
2118  function patchEventTargetMethods(obj, patchOptions) {
2119    if (!obj) {
2120      return false;
2121    }
2122
2123    let useGlobalCallback = true;
2124
2125    if (patchOptions && patchOptions.useG !== undefined) {
2126      useGlobalCallback = patchOptions.useG;
2127    }
2128
2129    const validateHandler = patchOptions && patchOptions.vh;
2130    let checkDuplicate = true;
2131
2132    if (patchOptions && patchOptions.chkDup !== undefined) {
2133      checkDuplicate = patchOptions.chkDup;
2134    }
2135
2136    let returnTarget = false;
2137
2138    if (patchOptions && patchOptions.rt !== undefined) {
2139      returnTarget = patchOptions.rt;
2140    }
2141
2142    let proto = obj;
2143
2144    while (proto && !proto.hasOwnProperty(ADD_EVENT_LISTENER)) {
2145      proto = ObjectGetPrototypeOf(proto);
2146    }
2147
2148    if (!proto && obj[ADD_EVENT_LISTENER]) {
2149      // somehow we did not find it, but we can see it. This happens on IE for Window properties.
2150      proto = obj;
2151    }
2152
2153    if (!proto) {
2154      return false;
2155    }
2156
2157    if (proto[zoneSymbolAddEventListener]) {
2158      return false;
2159    }
2160
2161    const eventNameToString = patchOptions && patchOptions.eventNameToString; // a shared global taskData to pass data for scheduleEventTask
2162    // so we do not need to create a new object just for pass some data
2163
2164    const taskData = {};
2165    const nativeAddEventListener = proto[zoneSymbolAddEventListener] = proto[ADD_EVENT_LISTENER];
2166    const nativeRemoveEventListener = proto[zoneSymbol(REMOVE_EVENT_LISTENER)] = proto[REMOVE_EVENT_LISTENER];
2167    const nativeListeners = proto[zoneSymbol(LISTENERS_EVENT_LISTENER)] = proto[LISTENERS_EVENT_LISTENER];
2168    const nativeRemoveAllListeners = proto[zoneSymbol(REMOVE_ALL_LISTENERS_EVENT_LISTENER)] = proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER];
2169    let nativePrependEventListener;
2170
2171    if (patchOptions && patchOptions.prepend) {
2172      nativePrependEventListener = proto[zoneSymbol(patchOptions.prepend)] = proto[patchOptions.prepend];
2173    }
2174    /**
2175     * This util function will build an option object with passive option
2176     * to handle all possible input from the user.
2177     */
2178
2179
2180    function buildEventListenerOptions(options, passive) {
2181      if (!passiveSupported && typeof options === 'object' && options) {
2182        // doesn't support passive but user want to pass an object as options.
2183        // this will not work on some old browser, so we just pass a boolean
2184        // as useCapture parameter
2185        return !!options.capture;
2186      }
2187
2188      if (!passiveSupported || !passive) {
2189        return options;
2190      }
2191
2192      if (typeof options === 'boolean') {
2193        return {
2194          capture: options,
2195          passive: true
2196        };
2197      }
2198
2199      if (!options) {
2200        return {
2201          passive: true
2202        };
2203      }
2204
2205      if (typeof options === 'object' && options.passive !== false) {
2206        return Object.assign(Object.assign({}, options), {
2207          passive: true
2208        });
2209      }
2210
2211      return options;
2212    }
2213
2214    const customScheduleGlobal = function (task) {
2215      // if there is already a task for the eventName + capture,
2216      // just return, because we use the shared globalZoneAwareCallback here.
2217      if (taskData.isExisting) {
2218        return;
2219      }
2220
2221      return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);
2222    };
2223
2224    const customCancelGlobal = function (task) {
2225      // if task is not marked as isRemoved, this call is directly
2226      // from Zone.prototype.cancelTask, we should remove the task
2227      // from tasksList of target first
2228      if (!task.isRemoved) {
2229        const symbolEventNames = zoneSymbolEventNames[task.eventName];
2230        let symbolEventName;
2231
2232        if (symbolEventNames) {
2233          symbolEventName = symbolEventNames[task.capture ? TRUE_STR : FALSE_STR];
2234        }
2235
2236        const existingTasks = symbolEventName && task.target[symbolEventName];
2237
2238        if (existingTasks) {
2239          for (let i = 0; i < existingTasks.length; i++) {
2240            const existingTask = existingTasks[i];
2241
2242            if (existingTask === task) {
2243              existingTasks.splice(i, 1); // set isRemoved to data for faster invokeTask check
2244
2245              task.isRemoved = true;
2246
2247              if (existingTasks.length === 0) {
2248                // all tasks for the eventName + capture have gone,
2249                // remove globalZoneAwareCallback and remove the task cache from target
2250                task.allRemoved = true;
2251                task.target[symbolEventName] = null;
2252              }
2253
2254              break;
2255            }
2256          }
2257        }
2258      } // if all tasks for the eventName + capture have gone,
2259      // we will really remove the global event callback,
2260      // if not, return
2261
2262
2263      if (!task.allRemoved) {
2264        return;
2265      }
2266
2267      return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);
2268    };
2269
2270    const customScheduleNonGlobal = function (task) {
2271      return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);
2272    };
2273
2274    const customSchedulePrepend = function (task) {
2275      return nativePrependEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);
2276    };
2277
2278    const customCancelNonGlobal = function (task) {
2279      return nativeRemoveEventListener.call(task.target, task.eventName, task.invoke, task.options);
2280    };
2281
2282    const customSchedule = useGlobalCallback ? customScheduleGlobal : customScheduleNonGlobal;
2283    const customCancel = useGlobalCallback ? customCancelGlobal : customCancelNonGlobal;
2284
2285    const compareTaskCallbackVsDelegate = function (task, delegate) {
2286      const typeOfDelegate = typeof delegate;
2287      return typeOfDelegate === 'function' && task.callback === delegate || typeOfDelegate === 'object' && task.originalDelegate === delegate;
2288    };
2289
2290    const compare = patchOptions && patchOptions.diff ? patchOptions.diff : compareTaskCallbackVsDelegate;
2291    const unpatchedEvents = Zone[zoneSymbol('UNPATCHED_EVENTS')];
2292
2293    const passiveEvents = _global[zoneSymbol('PASSIVE_EVENTS')];
2294
2295    const makeAddListener = function (nativeListener, addSource, customScheduleFn, customCancelFn, returnTarget = false, prepend = false) {
2296      return function () {
2297        const target = this || _global;
2298        let eventName = arguments[0];
2299
2300        if (patchOptions && patchOptions.transferEventName) {
2301          eventName = patchOptions.transferEventName(eventName);
2302        }
2303
2304        let delegate = arguments[1];
2305
2306        if (!delegate) {
2307          return nativeListener.apply(this, arguments);
2308        }
2309
2310        if (isNode && eventName === 'uncaughtException') {
2311          // don't patch uncaughtException of nodejs to prevent endless loop
2312          return nativeListener.apply(this, arguments);
2313        } // don't create the bind delegate function for handleEvent
2314        // case here to improve addEventListener performance
2315        // we will create the bind delegate when invoke
2316
2317
2318        let isHandleEvent = false;
2319
2320        if (typeof delegate !== 'function') {
2321          if (!delegate.handleEvent) {
2322            return nativeListener.apply(this, arguments);
2323          }
2324
2325          isHandleEvent = true;
2326        }
2327
2328        if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {
2329          return;
2330        }
2331
2332        const passive = passiveSupported && !!passiveEvents && passiveEvents.indexOf(eventName) !== -1;
2333        const options = buildEventListenerOptions(arguments[2], passive);
2334
2335        if (unpatchedEvents) {
2336          // check unpatched list
2337          for (let i = 0; i < unpatchedEvents.length; i++) {
2338            if (eventName === unpatchedEvents[i]) {
2339              if (passive) {
2340                return nativeListener.call(target, eventName, delegate, options);
2341              } else {
2342                return nativeListener.apply(this, arguments);
2343              }
2344            }
2345          }
2346        }
2347
2348        const capture = !options ? false : typeof options === 'boolean' ? true : options.capture;
2349        const once = options && typeof options === 'object' ? options.once : false;
2350        const zone = Zone.current;
2351        let symbolEventNames = zoneSymbolEventNames[eventName];
2352
2353        if (!symbolEventNames) {
2354          prepareEventNames(eventName, eventNameToString);
2355          symbolEventNames = zoneSymbolEventNames[eventName];
2356        }
2357
2358        const symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];
2359        let existingTasks = target[symbolEventName];
2360        let isExisting = false;
2361
2362        if (existingTasks) {
2363          // already have task registered
2364          isExisting = true;
2365
2366          if (checkDuplicate) {
2367            for (let i = 0; i < existingTasks.length; i++) {
2368              if (compare(existingTasks[i], delegate)) {
2369                // same callback, same capture, same event name, just return
2370                return;
2371              }
2372            }
2373          }
2374        } else {
2375          existingTasks = target[symbolEventName] = [];
2376        }
2377
2378        let source;
2379        const constructorName = target.constructor['name'];
2380        const targetSource = globalSources[constructorName];
2381
2382        if (targetSource) {
2383          source = targetSource[eventName];
2384        }
2385
2386        if (!source) {
2387          source = constructorName + addSource + (eventNameToString ? eventNameToString(eventName) : eventName);
2388        } // do not create a new object as task.data to pass those things
2389        // just use the global shared one
2390
2391
2392        taskData.options = options;
2393
2394        if (once) {
2395          // if addEventListener with once options, we don't pass it to
2396          // native addEventListener, instead we keep the once setting
2397          // and handle ourselves.
2398          taskData.options.once = false;
2399        }
2400
2401        taskData.target = target;
2402        taskData.capture = capture;
2403        taskData.eventName = eventName;
2404        taskData.isExisting = isExisting;
2405        const data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : undefined; // keep taskData into data to allow onScheduleEventTask to access the task information
2406
2407        if (data) {
2408          data.taskData = taskData;
2409        }
2410
2411        const task = zone.scheduleEventTask(source, delegate, data, customScheduleFn, customCancelFn); // should clear taskData.target to avoid memory leak
2412        // issue, https://github.com/angular/angular/issues/20442
2413
2414        taskData.target = null; // need to clear up taskData because it is a global object
2415
2416        if (data) {
2417          data.taskData = null;
2418        } // have to save those information to task in case
2419        // application may call task.zone.cancelTask() directly
2420
2421
2422        if (once) {
2423          options.once = true;
2424        }
2425
2426        if (!(!passiveSupported && typeof task.options === 'boolean')) {
2427          // if not support passive, and we pass an option object
2428          // to addEventListener, we should save the options to task
2429          task.options = options;
2430        }
2431
2432        task.target = target;
2433        task.capture = capture;
2434        task.eventName = eventName;
2435
2436        if (isHandleEvent) {
2437          // save original delegate for compare to check duplicate
2438          task.originalDelegate = delegate;
2439        }
2440
2441        if (!prepend) {
2442          existingTasks.push(task);
2443        } else {
2444          existingTasks.unshift(task);
2445        }
2446
2447        if (returnTarget) {
2448          return target;
2449        }
2450      };
2451    };
2452
2453    proto[ADD_EVENT_LISTENER] = makeAddListener(nativeAddEventListener, ADD_EVENT_LISTENER_SOURCE, customSchedule, customCancel, returnTarget);
2454
2455    if (nativePrependEventListener) {
2456      proto[PREPEND_EVENT_LISTENER] = makeAddListener(nativePrependEventListener, PREPEND_EVENT_LISTENER_SOURCE, customSchedulePrepend, customCancel, returnTarget, true);
2457    }
2458
2459    proto[REMOVE_EVENT_LISTENER] = function () {
2460      const target = this || _global;
2461      let eventName = arguments[0];
2462
2463      if (patchOptions && patchOptions.transferEventName) {
2464        eventName = patchOptions.transferEventName(eventName);
2465      }
2466
2467      const options = arguments[2];
2468      const capture = !options ? false : typeof options === 'boolean' ? true : options.capture;
2469      const delegate = arguments[1];
2470
2471      if (!delegate) {
2472        return nativeRemoveEventListener.apply(this, arguments);
2473      }
2474
2475      if (validateHandler && !validateHandler(nativeRemoveEventListener, delegate, target, arguments)) {
2476        return;
2477      }
2478
2479      const symbolEventNames = zoneSymbolEventNames[eventName];
2480      let symbolEventName;
2481
2482      if (symbolEventNames) {
2483        symbolEventName = symbolEventNames[capture ? TRUE_STR : FALSE_STR];
2484      }
2485
2486      const existingTasks = symbolEventName && target[symbolEventName];
2487
2488      if (existingTasks) {
2489        for (let i = 0; i < existingTasks.length; i++) {
2490          const existingTask = existingTasks[i];
2491
2492          if (compare(existingTask, delegate)) {
2493            existingTasks.splice(i, 1); // set isRemoved to data for faster invokeTask check
2494
2495            existingTask.isRemoved = true;
2496
2497            if (existingTasks.length === 0) {
2498              // all tasks for the eventName + capture have gone,
2499              // remove globalZoneAwareCallback and remove the task cache from target
2500              existingTask.allRemoved = true;
2501              target[symbolEventName] = null; // in the target, we have an event listener which is added by on_property
2502              // such as target.onclick = function() {}, so we need to clear this internal
2503              // property too if all delegates all removed
2504
2505              if (typeof eventName === 'string') {
2506                const onPropertySymbol = ZONE_SYMBOL_PREFIX + 'ON_PROPERTY' + eventName;
2507                target[onPropertySymbol] = null;
2508              }
2509            }
2510
2511            existingTask.zone.cancelTask(existingTask);
2512
2513            if (returnTarget) {
2514              return target;
2515            }
2516
2517            return;
2518          }
2519        }
2520      } // issue 930, didn't find the event name or callback
2521      // from zone kept existingTasks, the callback maybe
2522      // added outside of zone, we need to call native removeEventListener
2523      // to try to remove it.
2524
2525
2526      return nativeRemoveEventListener.apply(this, arguments);
2527    };
2528
2529    proto[LISTENERS_EVENT_LISTENER] = function () {
2530      const target = this || _global;
2531      let eventName = arguments[0];
2532
2533      if (patchOptions && patchOptions.transferEventName) {
2534        eventName = patchOptions.transferEventName(eventName);
2535      }
2536
2537      const listeners = [];
2538      const tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);
2539
2540      for (let i = 0; i < tasks.length; i++) {
2541        const task = tasks[i];
2542        let delegate = task.originalDelegate ? task.originalDelegate : task.callback;
2543        listeners.push(delegate);
2544      }
2545
2546      return listeners;
2547    };
2548
2549    proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER] = function () {
2550      const target = this || _global;
2551      let eventName = arguments[0];
2552
2553      if (!eventName) {
2554        const keys = Object.keys(target);
2555
2556        for (let i = 0; i < keys.length; i++) {
2557          const prop = keys[i];
2558          const match = EVENT_NAME_SYMBOL_REGX.exec(prop);
2559          let evtName = match && match[1]; // in nodejs EventEmitter, removeListener event is
2560          // used for monitoring the removeListener call,
2561          // so just keep removeListener eventListener until
2562          // all other eventListeners are removed
2563
2564          if (evtName && evtName !== 'removeListener') {
2565            this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, evtName);
2566          }
2567        } // remove removeListener listener finally
2568
2569
2570        this[REMOVE_ALL_LISTENERS_EVENT_LISTENER].call(this, 'removeListener');
2571      } else {
2572        if (patchOptions && patchOptions.transferEventName) {
2573          eventName = patchOptions.transferEventName(eventName);
2574        }
2575
2576        const symbolEventNames = zoneSymbolEventNames[eventName];
2577
2578        if (symbolEventNames) {
2579          const symbolEventName = symbolEventNames[FALSE_STR];
2580          const symbolCaptureEventName = symbolEventNames[TRUE_STR];
2581          const tasks = target[symbolEventName];
2582          const captureTasks = target[symbolCaptureEventName];
2583
2584          if (tasks) {
2585            const removeTasks = tasks.slice();
2586
2587            for (let i = 0; i < removeTasks.length; i++) {
2588              const task = removeTasks[i];
2589              let delegate = task.originalDelegate ? task.originalDelegate : task.callback;
2590              this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);
2591            }
2592          }
2593
2594          if (captureTasks) {
2595            const removeTasks = captureTasks.slice();
2596
2597            for (let i = 0; i < removeTasks.length; i++) {
2598              const task = removeTasks[i];
2599              let delegate = task.originalDelegate ? task.originalDelegate : task.callback;
2600              this[REMOVE_EVENT_LISTENER].call(this, eventName, delegate, task.options);
2601            }
2602          }
2603        }
2604      }
2605
2606      if (returnTarget) {
2607        return this;
2608      }
2609    }; // for native toString patch
2610
2611
2612    attachOriginToPatched(proto[ADD_EVENT_LISTENER], nativeAddEventListener);
2613    attachOriginToPatched(proto[REMOVE_EVENT_LISTENER], nativeRemoveEventListener);
2614
2615    if (nativeRemoveAllListeners) {
2616      attachOriginToPatched(proto[REMOVE_ALL_LISTENERS_EVENT_LISTENER], nativeRemoveAllListeners);
2617    }
2618
2619    if (nativeListeners) {
2620      attachOriginToPatched(proto[LISTENERS_EVENT_LISTENER], nativeListeners);
2621    }
2622
2623    return true;
2624  }
2625
2626  let results = [];
2627
2628  for (let i = 0; i < apis.length; i++) {
2629    results[i] = patchEventTargetMethods(apis[i], patchOptions);
2630  }
2631
2632  return results;
2633}
2634
2635function findEventTasks(target, eventName) {
2636  if (!eventName) {
2637    const foundTasks = [];
2638
2639    for (let prop in target) {
2640      const match = EVENT_NAME_SYMBOL_REGX.exec(prop);
2641      let evtName = match && match[1];
2642
2643      if (evtName && (!eventName || evtName === eventName)) {
2644        const tasks = target[prop];
2645
2646        if (tasks) {
2647          for (let i = 0; i < tasks.length; i++) {
2648            foundTasks.push(tasks[i]);
2649          }
2650        }
2651      }
2652    }
2653
2654    return foundTasks;
2655  }
2656
2657  let symbolEventName = zoneSymbolEventNames[eventName];
2658
2659  if (!symbolEventName) {
2660    prepareEventNames(eventName);
2661    symbolEventName = zoneSymbolEventNames[eventName];
2662  }
2663
2664  const captureFalseTasks = target[symbolEventName[FALSE_STR]];
2665  const captureTrueTasks = target[symbolEventName[TRUE_STR]];
2666
2667  if (!captureFalseTasks) {
2668    return captureTrueTasks ? captureTrueTasks.slice() : [];
2669  } else {
2670    return captureTrueTasks ? captureFalseTasks.concat(captureTrueTasks) : captureFalseTasks.slice();
2671  }
2672}
2673
2674function patchEventPrototype(global, api) {
2675  const Event = global['Event'];
2676
2677  if (Event && Event.prototype) {
2678    api.patchMethod(Event.prototype, 'stopImmediatePropagation', delegate => function (self, args) {
2679      self[IMMEDIATE_PROPAGATION_SYMBOL] = true; // we need to call the native stopImmediatePropagation
2680      // in case in some hybrid application, some part of
2681      // application will be controlled by zone, some are not
2682
2683      delegate && delegate.apply(self, args);
2684    });
2685  }
2686}
2687/**
2688 * @license
2689 * Copyright Google LLC All Rights Reserved.
2690 *
2691 * Use of this source code is governed by an MIT-style license that can be
2692 * found in the LICENSE file at https://angular.io/license
2693 */
2694
2695
2696function patchCallbacks(api, target, targetName, method, callbacks) {
2697  const symbol = Zone.__symbol__(method);
2698
2699  if (target[symbol]) {
2700    return;
2701  }
2702
2703  const nativeDelegate = target[symbol] = target[method];
2704
2705  target[method] = function (name, opts, options) {
2706    if (opts && opts.prototype) {
2707      callbacks.forEach(function (callback) {
2708        const source = `${targetName}.${method}::` + callback;
2709        const prototype = opts.prototype; // Note: the `patchCallbacks` is used for patching the `document.registerElement` and
2710        // `customElements.define`. We explicitly wrap the patching code into try-catch since
2711        // callbacks may be already patched by other web components frameworks (e.g. LWC
2711), and they
2712        // make those properties non-writable. This means that patching callback will throw an error
2713        // `cannot assign to read-only property`. See this code as an example:
2714        // https://github.com/salesforce/lwc/blob/master/packages/@lwc/engine-core/src/framework/base-bridge-element.ts#L180-L186
2715        // We don't want to stop the application rendering if we couldn't patch some
2716        // callback, e.g. `attributeChangedCallback`.
2717
2718        try {
2719          if (prototype.hasOwnProperty(callback)) {
2720            const descriptor = api.ObjectGetOwnPropertyDescriptor(prototype, callback);
2721
2722            if (descriptor && descriptor.value) {
2723              descriptor.value = api.wrapWithCurrentZone(descriptor.value, source);
2724
2725              api._redefineProperty(opts.prototype, callback, descriptor);
2726            } else if (prototype[callback]) {
2727              prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);
2728            }
2729          } else if (prototype[callback]) {
2730            prototype[callback] = api.wrapWithCurrentZone(prototype[callback], source);
2731          }
2732        }
2732 catch (_a) {// Note: we leave the catch block empty since there's no way to handle the error related
2733          // to non-writable property.
2734        }
2735      });
2736    }
2737
2738    return nativeDelegate.call(target, name, opts, options);
2739  };
2740
2741  api.attachOriginToPatched(target[method], nativeDelegate);
2742}
2743/**
2744 * @license
2745 * Copyright Google LLC All Rights Reserved.
2746 *
2747 * Use of this source code is governed by an MIT-style license that can be
2748 * found in the LICENSE file at https://angular.io/license
2749 */
2750
2751
2752function filterProperties(target, onProperties, ignoreProperties) {
2753  if (!ignoreProperties || ignoreProperties.length === 0) {
2754    return onProperties;
2755  }
2756
2757  const tip = ignoreProperties.filter(ip => ip.target === target);
2758
2759  if (!tip || tip.length === 0) {
2760    return onProperties;
2761  }
2762
2763  const targetIgnoreProperties = tip[0].ignoreProperties;
2764  return onProperties.filter(op => targetIgnoreProperties.indexOf(op) === -1);
2765}
2766
2767function patchFilteredProperties(target, onProperties, ignoreProperties, prototype) {
2768  // check whether target is available, sometimes target will be undefined
2769  // because different browser or some 3rd party plugin.
2770  if (!target) {
2771    return;
2772  }
2773
2774  const filteredProperties = filterProperties(target, onProperties, ignoreProperties);
2775  patchOnProperties(target, filteredProperties, prototype);
2776}
2777/**
2778 * Get all event name properties which the event name startsWith `on`
2779 * from the target object itself, inherited properties are not considered.
2780 */
2781
2782
2783function getOnEventNames(target) {
2784  return Object.getOwnPropertyNames(target).filter(name => name.startsWith('on') && name.length > 2).map(name => name.substring(2));
2785}
2786
2787function propertyDescriptorPatch(api, _global) {
2788  if (isNode && !isMix) {
2789    return;
2790  }
2791
2792  if (Zone[api.symbol('patchEvents')]) {
2793    // events are already been patched by legacy patch.
2794    return;
2795  }
2796
2797  const ignoreProperties = _global['__Zone_ignore_on_properties']; // for browsers that we can patch the descriptor:  Chrome & Firefox
2798
2799  let patchTargets = [];
2800
2801  if (isBrowser) {
2802    const internalWindow = window;
2803    patchTargets = patchTargets.concat(['Document', 'SVGElement', 'Element', 'HTMLElement', 'HTMLBodyElement', 'HTMLMediaElement', 'HTMLFrameSetElement', 'HTMLFrameElement', 'HTMLIFrameElement', 'HTMLMarqueeElement', 'Worker']);
2804    const ignoreErrorProperties = isIE() ? [{
2805      target: internalWindow,
2806      ignoreProperties: ['error']
2807    }] : []; // in IE/Edge, onProp not exist in window object, but in WindowPrototype
2808    // so we need to pass WindowPrototype to check onProp exist or not
2809
2810    patchFilteredProperties(internalWindow, getOnEventNames(internalWindow), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow));
2811  }
2812
2813  patchTargets = patchTargets.concat(['XMLHttpRequest', 'XMLHttpRequestEventTarget', 'IDBIndex', 'IDBRequest', 'IDBOpenDBRequest', 'IDBDatabase', 'IDBTransaction', 'IDBCursor', 'WebSocket']);
2814
2815  for (let i = 0; i < patchTargets.length; i++) {
2816    const target = _global[patchTargets[i]];
2817    target && target.prototype && patchFilteredProperties(target.prototype, getOnEventNames(target.prototype), ignoreProperties);
2818  }
2819}
2820/**
2821 * @license
2822 * Copyright Google LLC All Rights Reserved.
2823 *
2824 * Use of this source code is governed by an MIT-style license that can be
2825 * found in the LICENSE file at https://angular.io/license
2826 */
2827
2828
2829Zone.__load_patch('util', (global, Zone, api) => {
2830  // Collect native event names by looking at properties
2831  // on the global namespace, e.g. 'onclick'.
2832  const eventNames = getOnEventNames(global);
2833  api.patchOnProperties = patchOnProperties;
2834  api.patchMethod = patchMethod;
2835  api.bindArguments = bindArguments;
2836  api.patchMacroTask = patchMacroTask; // In earlier version of zone.js (<0.9.0), we use env name `__zone_symbol__BLACK_LISTED_EVENTS` to
2837  // define which events will not be patched by `Zone.js`.
2838  // In newer version (>=0.9.0), we change the env name to `__zone_symbol__UNPATCHED_EVENTS` to keep
2839  // the name consistent with angular repo.
2840  // The  `__zone_symbol__BLACK_LISTED_EVENTS` is deprecated, but it is still be supported for
2841  // backwards compatibility.
2842
2843  const SYMBOL_BLACK_LISTED_EVENTS = Zone.__symbol__('BLACK_LISTED_EVENTS');
2844
2845  const SYMBOL_UNPATCHED_EVENTS = Zone.__symbol__('UNPATCHED_EVENTS');
2846
2847  if (global[SYMBOL_UNPATCHED_EVENTS]) {
2848    global[SYMBOL_BLACK_LISTED_EVENTS] = global[SYMBOL_UNPATCHED_EVENTS];
2849  }
2850
2851  if (global[SYMBOL_BLACK_LISTED_EVENTS]) {
2852    Zone[SYMBOL_BLACK_LISTED_EVENTS] = Zone[SYMBOL_UNPATCHED_EVENTS] = global[SYMBOL_BLACK_LISTED_EVENTS];
2853  }
2854
2855  api.patchEventPrototype = patchEventPrototype;
2856  api.patchEventTarget = patchEventTarget;
2857  api.isIEOrEdge = isIEOrEdge;
2858  api.ObjectDefineProperty = ObjectDefineProperty;
2859  api.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor;
2860  api.ObjectCreate = ObjectCreate;
2861  api.ArraySlice = ArraySlice;
2862  api.patchClass = patchClass;
2863  api.wrapWithCurrentZone = wrapWithCurrentZone;
2864  api.filterProperties = filterProperties;
2865  api.attachOriginToPatched = attachOriginToPatched;
2866  api._redefineProperty = Object.defineProperty;
2867  api.patchCallbacks = patchCallbacks;
2868
2869  api.getGlobalObjects = () => ({
2870    globalSources,
2871    zoneSymbolEventNames,
2872    eventNames,
2873    isBrowser,
2874    isMix,
2875    isNode,
2876    TRUE_STR,
2877    FALSE_STR,
2878    ZONE_SYMBOL_PREFIX,
2879    ADD_EVENT_LISTENER_STR,
2880    REMOVE_EVENT_LISTENER_STR
2881  });
2882});
2883/**
2884 * @license
2885 * Copyright Google LLC All Rights Reserved.
2886 *
2887 * Use of this source code is governed by an MIT-style license that can be
2888 * found in the LICENSE file at https://angular.io/license
2889 */
2890
2891
2892const taskSymbol = zoneSymbol('zoneTask');
2893
2894function patchTimer(window, setName, cancelName, nameSuffix) {
2895  let setNative = null;
2896  let clearNative = null;
2897  setName += nameSuffix;
2898  cancelName += nameSuffix;
2899  const tasksByHandleId = {};
2900
2901  function scheduleTask(task) {
2902    const data = task.data;
2903
2904    data.args[0] = function () {
2905      return task.invoke.apply(this, arguments);
2906    };
2907
2908    data.handleId = setNative.apply(window, data.args);
2909    return task;
2910  }
2911
2912  function clearTask(task) {
2913    return clearNative.call(window, task.data.handleId);
2914  }
2915
2916  setNative = patchMethod(window, setName, delegate => function (self, args) {
2917    if (typeof args[0] === 'function') {
2918      const options = {
2919        isPeriodic: nameSuffix === 'Interval',
2920        delay: nameSuffix === 'Timeout' || nameSuffix === 'Interval' ? args[1] || 0 : undefined,
2921        args: args
2922      };
2923      const callback = args[0];
2924
2925      args[0] = function timer() {
2926        try {
2927          return callback.apply(this, arguments);
2928        } finally {
2929          // issue-934, task will be cancelled
2930          // even it is a periodic task such as
2931          // setInterval
2932          // https://github.com/angular/angular/issues/40387
2933          // Cleanup tasksByHandleId should be handled before scheduleTask
2934          // Since some zoneSpec may intercept and doesn't trigger
2935          // scheduleFn(scheduleTask) provided here.
2936          if (!options.isPeriodic) {
2937            if (typeof options.handleId === 'number') {
2938              // in non-nodejs env, we remove timerId
2939              // from local cache
2940              delete tasksByHandleId[options.handleId];
2941            } else if (options.handleId) {
2942              // Node returns complex objects as handleIds
2943              // we remove task reference from timer object
2944              options.handleId[taskSymbol] = null;
2945            }
2946          }
2947        }
2948      };
2949
2950      const task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);
2951
2952      if (!task) {
2953        return task;
2954      } // Node.js must additionally support the ref and unref functions.
2955
2956
2957      const handle = task.data.handleId;
2958
2959      if (typeof handle === 'number') {
2960        // for non nodejs env, we save handleId: task
2961        // mapping in local cache for clearTimeout
2962        tasksByHandleId[handle] = task;
2963      } else if (handle) {
2964        // for nodejs env, we save task
2965        // reference in timerId Object for clearTimeout
2966        handle[taskSymbol] = task;
2967      } // check whether handle is null, because some polyfill or browser
2968      // may return undefined from setTimeout/setInterval/setImmediate/requestAnimationFrame
2969
2970
2971      if (handle && handle.ref && handle.unref && typeof handle.ref === 'function' && typeof handle.unref === 'function') {
2972        task.ref = handle.ref.bind(handle);
2973        task.unref = handle.unref.bind(handle);
2974      }
2975
2976      if (typeof handle === 'number' || handle) {
2977        return handle;
2978      }
2979
2980      return task;
2981    } else {
2982      // cause an error by calling it directly.
2983      return delegate.apply(window, args);
2984    }
2985  });
2986  clearNative = patchMethod(window, cancelName, delegate => function (self, args) {
2987    const id = args[0];
2988    let task;
2989
2990    if (typeof id === 'number') {
2991      // non nodejs env.
2992      task = tasksByHandleId[id];
2993    } else {
2994      // nodejs env.
2995      task = id && id[taskSymbol]; // other environments.
2996
2997      if (!task) {
2998        task = id;
2999      }
3000    }
3001
3002    if (task && typeof task.type === 'string') {
3003      if (task.state !== 'notScheduled' && (task.cancelFn && task.data.isPeriodic || task.runCount === 0)) {
3004        if (typeof id === 'number') {
3005          delete tasksByHandleId[id];
3006        } else if (id) {
3007          id[taskSymbol] = null;
3008        } // Do not cancel already canceled functions
3009
3010
3011        task.zone.cancelTask(task);
3012      }
3013    } else {
3014      // cause an error by calling it directly.
3015      delegate.apply(window, args);
3016    }
3017  });
3018}
3019/**
3020 * @license
3021 * Copyright Google LLC All Rights Reserved.
3022 *
3023 * Use of this source code is governed by an MIT-style license that can be
3024 * found in the LICENSE file at https://angular.io/license
3025 */
3026
3027
3028function patchCustomElements(_global, api) {
3029  const {
3030    isBrowser,
3031    isMix
3032  } = api.getGlobalObjects();
3033
3034  if (!isBrowser && !isMix || !_global['customElements'] || !('customElements' in _global)) {
3035    return;
3036  }
3037
3038  const callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback'];
3039  api.patchCallbacks(api, _global.customElements, 'customElements', 'define', callbacks);
3040}
3041/**
3042 * @license
3043 * Copyright Google LLC All Rights Reserved.
3044 *
3045 * Use of this source code is governed by an MIT-style license that can be
3046 * found in the LICENSE file at https://angular.io/license
3047 */
3048
3049
3050function eventTargetPatch(_global, api) {
3051  if (Zone[api.symbol('patchEventTarget')]) {
3052    // EventTarget is already patched.
3053    return;
3054  }
3055
3056  const {
3057    eventNames,
3058    zoneSymbolEventNames,
3059    TRUE_STR,
3060    FALSE_STR,
3061    ZONE_SYMBOL_PREFIX
3062  } = api.getGlobalObjects(); //  predefine all __zone_symbol__ + eventName + true/false string
3063
3064  for (let i = 0; i < eventNames.length; i++) {
3065    const eventName = eventNames[i];
3066    const falseEventName = eventName + FALSE_STR;
3067    const trueEventName = eventName + TRUE_STR;
3068    const symbol = ZONE_SYMBOL_PREFIX + falseEventName;
3069    const symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
3070    zoneSymbolEventNames[eventName] = {};
3071    zoneSymbolEventNames[eventName][FALSE_STR] = symbol;
3072    zoneSymbolEventNames[eventName][TRUE_STR] = symbolCapture;
3073  }
3074
3075  const EVENT_TARGET = _global['EventTarget'];
3076
3077  if (!EVENT_TARGET || !EVENT_TARGET.prototype) {
3078    return;
3079  }
3080
3081  api.patchEventTarget(_global, api, [EVENT_TARGET && EVENT_TARGET.prototype]);
3082  return true;
3083}
3084
3085function patchEvent(global, api) {
3086  api.patchEventPrototype(global, api);
3087}
3088/**
3089 * @license
3090 * Copyright Google LLC All Rights Reserved.
3091 *
3092 * Use of this source code is governed by an MIT-style license that can be
3093 * found in the LICENSE file at https://angular.io/license
3094 */
3095
3096
3097Zone.__load_patch('legacy', global => {
3098  const legacyPatch = global[Zone.__symbol__('legacyPatch')];
3099
3100  if (legacyPatch) {
3101    legacyPatch();
3102  }
3103});
3104
3105Zone.__load_patch('queueMicrotask', (global, Zone, api) => {
3106  api.patchMethod(global, 'queueMicrotask', delegate => {
3107    return function (self, args) {
3108      Zone.current.scheduleMicroTask('queueMicrotask', args[0]);
3109    };
3110  });
3111});
3112
3113Zone.__load_patch('timers', global => {
3114  const set = 'set';
3115  const clear = 'clear';
3116  patchTimer(global, set, clear, 'Timeout');
3117  patchTimer(global, set, clear, 'Interval');
3118  patchTimer(global, set, clear, 'Immediate');
3119});
3120
3121Zone.__load_patch('requestAnimationFrame', global => {
3122  patchTimer(global, 'request', 'cancel', 'AnimationFrame');
3123  patchTimer(global, 'mozRequest', 'mozCancel', 'AnimationFrame');
3124  patchTimer(global, 'webkitRequest', 'webkitCancel', 'AnimationFrame');
3125});
3126
3127Zone.__load_patch('blocking', (global, Zone) => {
3128  const blockingMethods = ['alert', 'prompt', 'confirm'];
3129
3130  for (let i = 0; i < blockingMethods.length; i++) {
3131    const name = blockingMethods[i];
3132    patchMethod(global, name, (delegate, symbol, name) => {
3133      return function (s, args) {
3134        return Zone.current.run(delegate, global, args, name);
3135      };
3136    });
3137  }
3138});
3139
3140Zone.__load_patch('EventTarget', (global, Zone, api) => {
3141  patchEvent(global, api);
3142  eventTargetPatch(global, api); // patch XMLHttpRequestEventTarget's addEventListener/removeEventListener
3143
3144  const XMLHttpRequestEventTarget = global['XMLHttpRequestEventTarget'];
3145
3146  if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) {
3147    api.patchEventTarget(global, api, [XMLHttpRequestEventTarget.prototype]);
3148  }
3149});
3150
3151Zone.__load_patch('MutationObserver', (global, Zone, api) => {
3152  patchClass('MutationObserver');
3153  patchClass('WebKitMutationObserver');
3154});
3155
3156Zone.__load_patch('IntersectionObserver', (global, Zone, api) => {
3157  patchClass('IntersectionObserver');
3158});
3159
3160Zone.__load_patch('FileReader', (global, Zone, api) => {
3161  patchClass('FileReader');
3162});
3163
3164Zone.__load_patch('on_property', (global, Zone, api) => {
3165  propertyDescriptorPatch(api, global);
3166});
3167
3168Zone.__load_patch('customElements', (global, Zone, api) => {
3169  patchCustomElements(global, api);
3170});
3171
3172Zone.__load_patch('XHR', (global, Zone) => {
3173  // Treat XMLHttpRequest as a macrotask.
3174  patchXHR(global);
3175  const XHR_TASK = zoneSymbol('xhrTask');
3176  const XHR_SYNC = zoneSymbol('xhrSync');
3177  const XHR_LISTENER = zoneSymbol('xhrListener');
3178  const XHR_SCHEDULED = zoneSymbol('xhrScheduled');
3179  const XHR_URL = zoneSymbol('xhrURL');
3180  const XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled');
3181
3182  function patchXHR(window) {
3183    const XMLHttpRequest = window['XMLHttpRequest'];
3184
3185    if (!XMLHttpRequest) {
3186      // XMLHttpRequest is not available in service worker
3187      return;
3188    }
3189
3190    const XMLHttpRequestPrototype = XMLHttpRequest.prototype;
3191
3192    function findPendingTask(target) {
3193      return target[XHR_TASK];
3194    }
3195
3196    let oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
3197    let oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_
3197EVENT_LISTENER];
3198
3199    if (!oriAddListener) {
3200      const XMLHttpRequestEventTarget = window['XMLHttpRequestEventTarget'];
3201
3202      if (XMLHttpRequestEventTarget) {
3203        const XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget.prototype;
3204        oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
3205        oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
3206      }
3207    }
3208
3209    const READY_STATE_CHANGE = 'readystatechange';
3210    const SCHEDULED = 'scheduled';
3211
3212    function scheduleTask(task) {
3213      const data = task.data;
3214      const target = data.target;
3215      target[XHR_SCHEDULED] = false;
3216      target[XHR_ERROR_BEFORE_SCHEDULED] = false; // remove existing event listener
3217
3218      const listener = target[XHR_LISTENER];
3219
3220      if (!oriAddListener) {
3221        oriAddListener = target[ZONE_SYMBOL_ADD_EVENT_LISTENER];
3222        oriRemoveListener = target[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
3223      }
3224
3225      if (listener) {
3226        oriRemoveListener.call(target, READY_STATE_CHANGE, listener);
3227      }
3228
3229      const newListener = target[XHR_LISTENER] = () => {
3230        if (target.readyState === target.DONE) {
3231          // sometimes on some browsers XMLHttpRequest will fire onreadystatechange with
3232          // readyState=4 multiple times, so we need to check task state here
3233          if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {
3234            // check whether the xhr has registered onload listener
3235            // if that is the case, the task should invoke after all
3236            // onload listeners finish.
3237            // Also if the request failed without response (status = 0), the load event handler
3238            // will not be triggered, in that case, we should also invoke the placeholder callback
3239            // to close the XMLHttpRequest::send macroTask.
3240            // https://github.com/angular/angular/issues/38795
3241            const loadTasks = target[Zone.__symbol__('loadfalse')];
3242
3243            if (target.status !== 0 && loadTasks && loadTasks.length > 0) {
3244              const oriInvoke = task.invoke;
3245
3246              task.invoke = function () {
3247                // need to load the tasks again, because in other
3248                // load listener, they may remove themselves
3249                const loadTasks = target[Zone.__symbol__('loadfalse')];
3250
3251                for (let i = 0; i < loadTasks.length; i++) {
3252                  if (loadTasks[i] === task) {
3253                    loadTasks.splice(i, 1);
3254                  }
3255                }
3256
3257                if (!data.aborted && task.state === SCHEDULED) {
3258                  oriInvoke.call(task);
3259                }
3260              };
3261
3262              loadTasks.push(task);
3263            } else {
3264              task.invoke();
3265            }
3266          } else if (!data.aborted && target[XHR_SCHEDULED] === false) {
3267            // error occurs when xhr.send()
3268            target[XHR_ERROR_BEFORE_SCHEDULED] = true;
3269          }
3270        }
3271      };
3272
3273      oriAddListener.call(target, READY_STATE_CHANGE, newListener);
3274      const storedTask = target[XHR_TASK];
3275
3276      if (!storedTask) {
3277        target[XHR_TASK] = task;
3278      }
3279
3280      sendNative.apply(target, data.args);
3281      target[XHR_SCHEDULED] = true;
3282      return task;
3283    }
3284
3285    function placeholderCallback() {}
3286
3287    function clearTask(task) {
3288      const data = task.data; // Note - ideally, we would call data.target.removeEventListener here, but it's too late
3289      // to prevent it from firing. So instead, we store info for the event listener.
3290
3291      data.aborted = true;
3292      return abortNative.apply(data.target, data.args);
3293    }
3294
3295    const openNative = patchMethod(XMLHttpRequestPrototype, 'open', () => function (self, args) {
3296      self[XHR_SYNC] = args[2] == false;
3297      self[XHR_URL] = args[1];
3298      return openNative.apply(self, args);
3299    });
3300    const XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send';
3301    const fetchTaskAborting = zoneSymbol('fetchTaskAborting');
3302    const fetchTaskScheduling = zoneSymbol('fetchTaskScheduling');
3303    const sendNative = patchMethod(XMLHttpRequestPrototype, 'send', () => function (self, args) {
3304      if (Zone.current[fetchTaskScheduling] === true) {
3305        // a fetch is scheduling, so we are using xhr to polyfill fetch
3306        // and because we already schedule macroTask for fetch, we should
3307        // not schedule a macroTask for xhr again
3308        return sendNative.apply(self, args);
3309      }
3310
3311      if (self[XHR_SYNC]) {
3312        // if the XHR is sync there is no task to schedule, just execute the code.
3313        return sendNative.apply(self, args);
3314      } else {
3315        const options = {
3316          target: self,
3317          url: self[XHR_URL],
3318          isPeriodic: false,
3319          args: args,
3320          aborted: false
3321        };
3322        const task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
3323
3324        if (self && self[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted && task.state === SCHEDULED) {
3325          // xhr request throw error when send
3326          // we should invoke task instead of leaving a scheduled
3327          // pending macroTask
3328          task.invoke();
3329        }
3330      }
3331    });
3332    const abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', () => function (self, args) {
3333      const task = findPendingTask(self);
3334
3335      if (task && typeof task.type == 'string') {
3336        // If the XHR has already completed, do nothing.
3337        // If the XHR has already been aborted, do nothing.
3338        // Fix #569, call abort multiple times before done will cause
3339        // macroTask task count be negative number
3340        if (task.cancelFn == null || task.data && task.data.aborted) {
3341          return;
3342        }
3343
3344        task.zone.cancelTask(task);
3345      } else if (Zone.current[fetchTaskAborting] === true) {
3346        // the abort is called from fetch polyfill, we need to call native abort of XHR.
3347        return abortNative.apply(self, args);
3348      } // Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no
3349      // task
3350      // to cancel. Do nothing.
3351
3352    });
3353  }
3354});
3355
3356Zone.__load_patch('geolocation', global => {
3357  /// GEO_LOCATION
3358  if (global['navigator'] && global['navigator'].geolocation) {
3359    patchPrototype(global['navigator'].geolocation, ['getCurrentPosition', 'watchPosition']);
3360  }
3361});
3362
3363Zone.__load_patch('PromiseRejectionEvent', (global, Zone) => {
3364  // handle unhandled promise rejection
3365  function findPromiseRejectionHandler(evtName) {
3366    return function (e) {
3367      const eventTasks = findEventTasks(global, evtName);
3368      eventTasks.forEach(eventTask => {
3369        // windows has added unhandledrejection event listener
3370        // trigger the event listener
3371        const PromiseRejectionEvent = global['PromiseRejectionEvent'];
3372
3373        if (PromiseRejectionEvent) {
3374          const evt = new PromiseRejectionEvent(evtName, {
3375            promise: e.promise,
3376            reason: e.rejection
3377          });
3378          eventTask.invoke(evt);
3379        }
3380      });
3381    };
3382  }
3383
3384  if (global['PromiseRejectionEvent']) {
3385    Zone[zoneSymbol('unhandledPromiseRejectionHandler')] = findPromiseRejectionHandler('unhandledrejection');
3386    Zone[zoneSymbol('rejectionHandledHandler')] = findPromiseRejectionHandler('rejectionhandled');
3387  }
3388});
3389
3390/***/ })
3391
3392},
3393/******/ __webpack_require__ => { // webpackRuntimeModules
3394/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
3395/******/ var __webpack_exports__ = (__webpack_exec__(7435));
3396/******/ }
3397]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.