source: trip-planner-front/node_modules/zone.js/bundles/zone-legacy.umd.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 21.6 KB
RevLine 
[6a3a178]1'use strict';
2/**
3 * @license Angular v12.0.0-next.0
4 * (c) 2010-2020 Google LLC. https://angular.io/
5 * License: MIT
6 */
7(function (factory) {
8 typeof define === 'function' && define.amd ? define(factory) :
9 factory();
10}((function () {
11 'use strict';
12 /**
13 * @license
14 * Copyright Google LLC All Rights Reserved.
15 *
16 * Use of this source code is governed by an MIT-style license that can be
17 * found in the LICENSE file at https://angular.io/license
18 */
19 /*
20 * This is necessary for Chrome and Chrome mobile, to enable
21 * things like redefining `createdCallback` on an element.
22 */
23 var zoneSymbol;
24 var _defineProperty;
25 var _getOwnPropertyDescriptor;
26 var _create;
27 var unconfigurablesKey;
28 function propertyPatch() {
29 zoneSymbol = Zone.__symbol__;
30 _defineProperty = Object[zoneSymbol('defineProperty')] = Object.defineProperty;
31 _getOwnPropertyDescriptor = Object[zoneSymbol('getOwnPropertyDescriptor')] =
32 Object.getOwnPropertyDescriptor;
33 _create = Object.create;
34 unconfigurablesKey = zoneSymbol('unconfigurables');
35 Object.defineProperty = function (obj, prop, desc) {
36 if (isUnconfigurable(obj, prop)) {
37 throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj);
38 }
39 var originalConfigurableFlag = desc.configurable;
40 if (prop !== 'prototype') {
41 desc = rewriteDescriptor(obj, prop, desc);
42 }
43 return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag);
44 };
45 Object.defineProperties = function (obj, props) {
46 Object.keys(props).forEach(function (prop) {
47 Object.defineProperty(obj, prop, props[prop]);
48 });
49 return obj;
50 };
51 Object.create = function (obj, proto) {
52 if (typeof proto === 'object' && !Object.isFrozen(proto)) {
53 Object.keys(proto).forEach(function (prop) {
54 proto[prop] = rewriteDescriptor(obj, prop, proto[prop]);
55 });
56 }
57 return _create(obj, proto);
58 };
59 Object.getOwnPropertyDescriptor = function (obj, prop) {
60 var desc = _getOwnPropertyDescriptor(obj, prop);
61 if (desc && isUnconfigurable(obj, prop)) {
62 desc.configurable = false;
63 }
64 return desc;
65 };
66 }
67 function _redefineProperty(obj, prop, desc) {
68 var originalConfigurableFlag = desc.configurable;
69 desc = rewriteDescriptor(obj, prop, desc);
70 return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag);
71 }
72 function isUnconfigurable(obj, prop) {
73 return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop];
74 }
75 function rewriteDescriptor(obj, prop, desc) {
76 // issue-927, if the desc is frozen, don't try to change the desc
77 if (!Object.isFrozen(desc)) {
78 desc.configurable = true;
79 }
80 if (!desc.configurable) {
81 // issue-927, if the obj is frozen, don't try to set the desc to obj
82 if (!obj[unconfigurablesKey] && !Object.isFrozen(obj)) {
83 _defineProperty(obj, unconfigurablesKey, { writable: true, value: {} });
84 }
85 if (obj[unconfigurablesKey]) {
86 obj[unconfigurablesKey][prop] = true;
87 }
88 }
89 return desc;
90 }
91 function _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) {
92 try {
93 return _defineProperty(obj, prop, desc);
94 }
95 catch (error) {
96 if (desc.configurable) {
97 // In case of errors, when the configurable flag was likely set by rewriteDescriptor(), let's
98 // retry with the original flag value
99 if (typeof originalConfigurableFlag == 'undefined') {
100 delete desc.configurable;
101 }
102 else {
103 desc.configurable = originalConfigurableFlag;
104 }
105 try {
106 return _defineProperty(obj, prop, desc);
107 }
108 catch (error) {
109 var swallowError = false;
110 if (prop === 'createdCallback' || prop === 'attachedCallback' ||
111 prop === 'detachedCallback' || prop === 'attributeChangedCallback') {
112 // We only swallow the error in registerElement patch
113 // this is the work around since some applications
114 // fail if we throw the error
115 swallowError = true;
116 }
117 if (!swallowError) {
118 throw error;
119 }
120 // TODO: @JiaLiPassion, Some application such as `registerElement` patch
121 // still need to swallow the error, in the future after these applications
122 // are updated, the following logic can be removed.
123 var descJson = null;
124 try {
125 descJson = JSON.stringify(desc);
126 }
127 catch (error) {
128 descJson = desc.toString();
129 }
130 console.log("Attempting to configure '" + prop + "' with descriptor '" + descJson + "' on object '" + obj + "' and got error, giving up: " + error);
131 }
132 }
133 else {
134 throw error;
135 }
136 }
137 }
138 /**
139 * @license
140 * Copyright Google LLC All Rights Reserved.
141 *
142 * Use of this source code is governed by an MIT-style license that can be
143 * found in the LICENSE file at https://angular.io/license
144 */
145 function eventTargetLegacyPatch(_global, api) {
146 var _a = api.getGlobalObjects(), eventNames = _a.eventNames, globalSources = _a.globalSources, zoneSymbolEventNames = _a.zoneSymbolEventNames, TRUE_STR = _a.TRUE_STR, FALSE_STR = _a.FALSE_STR, ZONE_SYMBOL_PREFIX = _a.ZONE_SYMBOL_PREFIX;
147 var WTF_ISSUE_555 = 'Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video';
148 var NO_EVENT_TARGET = 'ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket'
149 .split(',');
150 var EVENT_TARGET = 'EventTarget';
151 var apis = [];
152 var isWtf = _global['wtf'];
153 var WTF_ISSUE_555_ARRAY = WTF_ISSUE_555.split(',');
154 if (isWtf) {
155 // Workaround for: https://github.com/google/tracing-framework/issues/555
156 apis = WTF_ISSUE_555_ARRAY.map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET);
157 }
158 else if (_global[EVENT_TARGET]) {
159 apis.push(EVENT_TARGET);
160 }
161 else {
162 // Note: EventTarget is not available in all browsers,
163 // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget
164 apis = NO_EVENT_TARGET;
165 }
166 var isDisableIECheck = _global['__Zone_disable_IE_check'] || false;
167 var isEnableCrossContextCheck = _global['__Zone_enable_cross_context_check'] || false;
168 var ieOrEdge = api.isIEOrEdge();
169 var ADD_EVENT_LISTENER_SOURCE = '.addEventListener:';
170 var FUNCTION_WRAPPER = '[object FunctionWrapper]';
171 var BROWSER_TOOLS = 'function __BROWSERTOOLS_CONSOLE_SAFEFUNC() { [native code] }';
172 var pointerEventsMap = {
173 'MSPointerCancel': 'pointercancel',
174 'MSPointerDown': 'pointerdown',
175 'MSPointerEnter': 'pointerenter',
176 'MSPointerHover': 'pointerhover',
177 'MSPointerLeave': 'pointerleave',
178 'MSPointerMove': 'pointermove',
179 'MSPointerOut': 'pointerout',
180 'MSPointerOver': 'pointerover',
181 'MSPointerUp': 'pointerup'
182 };
183 // predefine all __zone_symbol__ + eventName + true/false string
184 for (var i = 0; i < eventNames.length; i++) {
185 var eventName = eventNames[i];
186 var falseEventName = eventName + FALSE_STR;
187 var trueEventName = eventName + TRUE_STR;
188 var symbol = ZONE_SYMBOL_PREFIX + falseEventName;
189 var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
190 zoneSymbolEventNames[eventName] = {};
191 zoneSymbolEventNames[eventName][FALSE_STR] = symbol;
192 zoneSymbolEventNames[eventName][TRUE_STR] = symbolCapture;
193 }
194 // predefine all task.source string
195 for (var i = 0; i < WTF_ISSUE_555_ARRAY.length; i++) {
196 var target = WTF_ISSUE_555_ARRAY[i];
197 var targets = globalSources[target] = {};
198 for (var j = 0; j < eventNames.length; j++) {
199 var eventName = eventNames[j];
200 targets[eventName] = target + ADD_EVENT_LISTENER_SOURCE + eventName;
201 }
202 }
203 var checkIEAndCrossContext = function (nativeDelegate, delegate, target, args) {
204 if (!isDisableIECheck && ieOrEdge) {
205 if (isEnableCrossContextCheck) {
206 try {
207 var testString = delegate.toString();
208 if ((testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS)) {
209 nativeDelegate.apply(target, args);
210 return false;
211 }
212 }
213 catch (error) {
214 nativeDelegate.apply(target, args);
215 return false;
216 }
217 }
218 else {
219 var testString = delegate.toString();
220 if ((testString === FUNCTION_WRAPPER || testString == BROWSER_TOOLS)) {
221 nativeDelegate.apply(target, args);
222 return false;
223 }
224 }
225 }
226 else if (isEnableCrossContextCheck) {
227 try {
228 delegate.toString();
229 }
230 catch (error) {
231 nativeDelegate.apply(target, args);
232 return false;
233 }
234 }
235 return true;
236 };
237 var apiTypes = [];
238 for (var i = 0; i < apis.length; i++) {
239 var type = _global[apis[i]];
240 apiTypes.push(type && type.prototype);
241 }
242 // vh is validateHandler to check event handler
243 // is valid or not(for security check)
244 api.patchEventTarget(_global, apiTypes, {
245 vh: checkIEAndCrossContext,
246 transferEventName: function (eventName) {
247 var pointerEventName = pointerEventsMap[eventName];
248 return pointerEventName || eventName;
249 }
250 });
251 Zone[api.symbol('patchEventTarget')] = !!_global[EVENT_TARGET];
252 return true;
253 }
254 /**
255 * @license
256 * Copyright Google LLC All Rights Reserved.
257 *
258 * Use of this source code is governed by an MIT-style license that can be
259 * found in the LICENSE file at https://angular.io/license
260 */
261 // we have to patch the instance since the proto is non-configurable
262 function apply(api, _global) {
263 var _a = api.getGlobalObjects(), ADD_EVENT_LISTENER_STR = _a.ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR = _a.REMOVE_EVENT_LISTENER_STR;
264 var WS = _global.WebSocket;
265 // On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener
266 // On older Chrome, no need since EventTarget was already patched
267 if (!_global.EventTarget) {
268 api.patchEventTarget(_global, [WS.prototype]);
269 }
270 _global.WebSocket = function (x, y) {
271 var socket = arguments.length > 1 ? new WS(x, y) : new WS(x);
272 var proxySocket;
273 var proxySocketProto;
274 // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance
275 var onmessageDesc = api.ObjectGetOwnPropertyDescriptor(socket, 'onmessage');
276 if (onmessageDesc && onmessageDesc.configurable === false) {
277 proxySocket = api.ObjectCreate(socket);
278 // socket have own property descriptor 'onopen', 'onmessage', 'onclose', 'onerror'
279 // but proxySocket not, so we will keep socket as prototype and pass it to
280 // patchOnProperties method
281 proxySocketProto = socket;
282 [ADD_EVENT_LISTENER_STR, REMOVE_EVENT_LISTENER_STR, 'send', 'close'].forEach(function (propName) {
283 proxySocket[propName] = function () {
284 var args = api.ArraySlice.call(arguments);
285 if (propName === ADD_EVENT_LISTENER_STR || propName === REMOVE_EVENT_LISTENER_STR) {
286 var eventName = args.length > 0 ? args[0] : undefined;
287 if (eventName) {
288 var propertySymbol = Zone.__symbol__('ON_PROPERTY' + eventName);
289 socket[propertySymbol] = proxySocket[propertySymbol];
290 }
291 }
292 return socket[propName].apply(socket, args);
293 };
294 });
295 }
296 else {
297 // we can patch the real socket
298 proxySocket = socket;
299 }
300 api.patchOnProperties(proxySocket, ['close', 'error', 'message', 'open'], proxySocketProto);
301 return proxySocket;
302 };
303 var globalWebSocket = _global['WebSocket'];
304 for (var prop in WS) {
305 globalWebSocket[prop] = WS[prop];
306 }
307 }
308 /**
309 * @license
310 * Copyright Google LLC All Rights Reserved.
311 *
312 * Use of this source code is governed by an MIT-style license that can be
313 * found in the LICENSE file at https://angular.io/license
314 */
315 function propertyDescriptorLegacyPatch(api, _global) {
316 var _a = api.getGlobalObjects(), isNode = _a.isNode, isMix = _a.isMix;
317 if (isNode && !isMix) {
318 return;
319 }
320 if (!canPatchViaPropertyDescriptor(api, _global)) {
321 var supportsWebSocket = typeof WebSocket !== 'undefined';
322 // Safari, Android browsers (Jelly Bean)
323 patchViaCapturingAllTheEvents(api);
324 api.patchClass('XMLHttpRequest');
325 if (supportsWebSocket) {
326 apply(api, _global);
327 }
328 Zone[api.symbol('patchEvents')] = true;
329 }
330 }
331 function canPatchViaPropertyDescriptor(api, _global) {
332 var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix;
333 if ((isBrowser || isMix) &&
334 !api.ObjectGetOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') &&
335 typeof Element !== 'undefined') {
336 // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364
337 // IDL interface attributes are not configurable
338 var desc = api.ObjectGetOwnPropertyDescriptor(Element.prototype, 'onclick');
339 if (desc && !desc.configurable)
340 return false;
341 // try to use onclick to detect whether we can patch via propertyDescriptor
342 // because XMLHttpRequest is not available in service worker
343 if (desc) {
344 api.ObjectDefineProperty(Element.prototype, 'onclick', {
345 enumerable: true,
346 configurable: true,
347 get: function () {
348 return true;
349 }
350 });
351 var div = document.createElement('div');
352 var result = !!div.onclick;
353 api.ObjectDefineProperty(Element.prototype, 'onclick', desc);
354 return result;
355 }
356 }
357 var XMLHttpRequest = _global['XMLHttpRequest'];
358 if (!XMLHttpRequest) {
359 // XMLHttpRequest is not available in service worker
360 return false;
361 }
362 var ON_READY_STATE_CHANGE = 'onreadystatechange';
363 var XMLHttpRequestPrototype = XMLHttpRequest.prototype;
364 var xhrDesc = api.ObjectGetOwnPropertyDescriptor(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE);
365 // add enumerable and configurable here because in opera
366 // by default XMLHttpRequest.prototype.onreadystatechange is undefined
367 // without adding enumerable and configurable will cause onreadystatechange
368 // non-configurable
369 // and if XMLHttpRequest.prototype.onreadystatechange is undefined,
370 // we should set a real desc instead a fake one
371 if (xhrDesc) {
372 api.ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, {
373 enumerable: true,
374 configurable: true,
375 get: function () {
376 return true;
377 }
378 });
379 var req = new XMLHttpRequest();
380 var result = !!req.onreadystatechange;
381 // restore original desc
382 api.ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, xhrDesc || {});
383 return result;
384 }
385 else {
386 var SYMBOL_FAKE_ONREADYSTATECHANGE_1 = api.symbol('fake');
387 api.ObjectDefineProperty(XMLHttpRequestPrototype, ON_READY_STATE_CHANGE, {
388 enumerable: true,
389 configurable: true,
390 get: function () {
391 return this[SYMBOL_FAKE_ONREADYSTATECHANGE_1];
392 },
393 set: function (value) {
394 this[SYMBOL_FAKE_ONREADYSTATECHANGE_1] = value;
395 }
396 });
397 var req = new XMLHttpRequest();
398 var detectFunc = function () { };
399 req.onreadystatechange = detectFunc;
400 var result = req[SYMBOL_FAKE_ONREADYSTATECHANGE_1] === detectFunc;
401 req.onreadystatechange = null;
402 return result;
403 }
404 }
405 // Whenever any eventListener fires, we check the eventListener target and all parents
406 // for `onwhatever` properties and replace them with zone-bound functions
407 // - Chrome (for now)
408 function patchViaCapturingAllTheEvents(api) {
409 var eventNames = api.getGlobalObjects().eventNames;
410 var unboundKey = api.symbol('unbound');
411 var _loop_1 = function (i) {
412 var property = eventNames[i];
413 var onproperty = 'on' + property;
414 self.addEventListener(property, function (event) {
415 var elt = event.target, bound, source;
416 if (elt) {
417 source = elt.constructor['name'] + '.' + onproperty;
418 }
419 else {
420 source = 'unknown.' + onproperty;
421 }
422 while (elt) {
423 if (elt[onproperty] && !elt[onproperty][unboundKey]) {
424 bound = api.wrapWithCurrentZone(elt[onproperty], source);
425 bound[unboundKey] = elt[onproperty];
426 elt[onproperty] = bound;
427 }
428 elt = elt.parentElement;
429 }
430 }, true);
431 };
432 for (var i = 0; i < eventNames.length; i++) {
433 _loop_1(i);
434 }
435 }
436 /**
437 * @license
438 * Copyright Google LLC All Rights Reserved.
439 *
440 * Use of this source code is governed by an MIT-style license that can be
441 * found in the LICENSE file at https://angular.io/license
442 */
443 function registerElementPatch(_global, api) {
444 var _a = api.getGlobalObjects(), isBrowser = _a.isBrowser, isMix = _a.isMix;
445 if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {
446 return;
447 }
448 var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];
449 api.patchCallbacks(api, document, 'Document', 'registerElement', callbacks);
450 }
451 /**
452 * @license
453 * Copyright Google LLC All Rights Reserved.
454 *
455 * Use of this source code is governed by an MIT-style license that can be
456 * found in the LICENSE file at https://angular.io/license
457 */
458 (function (_global) {
459 var symbolPrefix = _global['__Zone_symbol_prefix'] || '__zone_symbol__';
460 function __symbol__(name) {
461 return symbolPrefix + name;
462 }
463 _global[__symbol__('legacyPatch')] = function () {
464 var Zone = _global['Zone'];
465 Zone.__load_patch('defineProperty', function (global, Zone, api) {
466 api._redefineProperty = _redefineProperty;
467 propertyPatch();
468 });
469 Zone.__load_patch('registerElement', function (global, Zone, api) {
470 registerElementPatch(global, api);
471 });
472 Zone.__load_patch('EventTargetLegacy', function (global, Zone, api) {
473 eventTargetLegacyPatch(global, api);
474 propertyDescriptorLegacyPatch(api, global);
475 });
476 };
477 })(typeof window !== 'undefined' ?
478 window :
479 typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {});
480})));
Note: See TracBrowser for help on using the repository browser.