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