source: trip-planner-front/node_modules/@angular/platform-browser-dynamic/fesm2015/platform-browser-dynamic.js@ 6a3a178

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

initial commit

  • Property mode set to 100644
File size: 19.3 KB
Line 
1/**
2 * @license Angular v12.2.9
3 * (c) 2010-2021 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7import { getUrlScheme, syntaxError, Identifiers, JitCompiler, ProviderMeta, I18NHtmlParser, CompilerConfig, CompileReflector, ResourceLoader, JitSummaryResolver, SummaryResolver, Lexer, Parser, HtmlParser, TemplateParser, ElementSchemaRegistry, JitEvaluator, DirectiveNormalizer, UrlResolver, CompileMetadataResolver, NgModuleResolver, DirectiveResolver, PipeResolver, StaticSymbolCache, StyleCompiler, ViewCompiler, NgModuleCompiler, DomElementSchemaRegistry } from '@angular/compiler';
8import { ɵReflectionCapabilities, ɵstringify, ANALYZE_FOR_ENTRY_COMPONENTS, ElementRef, NgModuleRef, ViewContainerRef, ChangeDetectorRef, Renderer2, QueryList, TemplateRef, ɵCodegenComponentFactoryResolver, ComponentFactoryResolver, ComponentFactory, ComponentRef, NgModuleFactory, ɵcmf, ɵmod, ɵmpd, ɵregisterModuleFactory, Injector, ViewEncapsulation, ChangeDetectionStrategy, SecurityContext, LOCALE_ID, TRANSLATIONS_FORMAT, ɵinlineInterpolate, ɵinterpolate, ɵEMPTY_ARRAY, ɵEMPTY_MAP, ɵvid, ɵeld, ɵand, ɵted, ɵdid, ɵprd, ɵqud, ɵpad, ɵpod, ɵppd, ɵpid, ɵnov, ɵncd, ɵunv, ɵcrt, ɵccf, InjectionToken, PACKAGE_ROOT_URL, Compiler, MissingTranslationStrategy, ɵConsole, Optional, Inject, TRANSLATIONS, isDevMode, createPlatformFactory, platformCore, COMPILER_OPTIONS, CompilerFactory, Injectable, PLATFORM_ID, ɵglobal, Version } from '@angular/core';
9import { ɵPLATFORM_BROWSER_ID } from '@angular/common';
10import { ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS } from '@angular/platform-browser';
11
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 */
19const MODULE_SUFFIX = '';
20const builtinExternalReferences = createBuiltinExternalReferencesMap();
21class JitReflector {
22 constructor() {
23 this.reflectionCapabilities = new ɵReflectionCapabilities();
24 }
25 componentModuleUrl(type, cmpMetadata) {
26 const moduleId = cmpMetadata.moduleId;
27 if (typeof moduleId === 'string') {
28 const scheme = getUrlScheme(moduleId);
29 return scheme ? moduleId : `package:${moduleId}${MODULE_SUFFIX}`;
30 }
31 else if (moduleId !== null && moduleId !== void 0) {
32 throw syntaxError(`moduleId should be a string in "${ɵstringify(type)}". See https://goo.gl/wIDDiL for more information.\n` +
33 `If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.`);
34 }
35 return `./${ɵstringify(type)}`;
36 }
37 parameters(typeOrFunc) {
38 return this.reflectionCapabilities.parameters(typeOrFunc);
39 }
40 tryAnnotations(typeOrFunc) {
41 return this.annotations(typeOrFunc);
42 }
43 annotations(typeOrFunc) {
44 return this.reflectionCapabilities.annotations(typeOrFunc);
45 }
46 shallowAnnotations(typeOrFunc) {
47 throw new Error('Not supported in JIT mode');
48 }
49 propMetadata(typeOrFunc) {
50 return this.reflectionCapabilities.propMetadata(typeOrFunc);
51 }
52 hasLifecycleHook(type, lcProperty) {
53 return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
54 }
55 guards(type) {
56 return this.reflectionCapabilities.guards(type);
57 }
58 resolveExternalReference(ref) {
59 return builtinExternalReferences.get(ref) || ref.runtime;
60 }
61}
62function createBuiltinExternalReferencesMap() {
63 const map = new Map();
64 map.set(Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS, ANALYZE_FOR_ENTRY_COMPONENTS);
65 map.set(Identifiers.ElementRef, ElementRef);
66 map.set(Identifiers.NgModuleRef, NgModuleRef);
67 map.set(Identifiers.ViewContainerRef, ViewContainerRef);
68 map.set(Identifiers.ChangeDetectorRef, ChangeDetectorRef);
69 map.set(Identifiers.Renderer2, Renderer2);
70 map.set(Identifiers.QueryList, QueryList);
71 map.set(Identifiers.TemplateRef, TemplateRef);
72 map.set(Identifiers.CodegenComponentFactoryResolver, ɵCodegenComponentFactoryResolver);
73 map.set(Identifiers.ComponentFactoryResolver, ComponentFactoryResolver);
74 map.set(Identifiers.ComponentFactory, ComponentFactory);
75 map.set(Identifiers.ComponentRef, ComponentRef);
76 map.set(Identifiers.NgModuleFactory, NgModuleFactory);
77 map.set(Identifiers.createModuleFactory, ɵcmf);
78 map.set(Identifiers.moduleDef, ɵmod);
79 map.set(Identifiers.moduleProviderDef, ɵmpd);
80 map.set(Identifiers.RegisterModuleFactoryFn, ɵregisterModuleFactory);
81 map.set(Identifiers.Injector, Injector);
82 map.set(Identifiers.ViewEncapsulation, ViewEncapsulation);
83 map.set(Identifiers.ChangeDetectionStrategy, ChangeDetectionStrategy);
84 map.set(Identifiers.SecurityContext, SecurityContext);
85 map.set(Identifiers.LOCALE_ID, LOCALE_ID);
86 map.set(Identifiers.TRANSLATIONS_FORMAT, TRANSLATIONS_FORMAT);
87 map.set(Identifiers.inlineInterpolate, ɵinlineInterpolate);
88 map.set(Identifiers.interpolate, ɵinterpolate);
89 map.set(Identifiers.EMPTY_ARRAY, ɵEMPTY_ARRAY);
90 map.set(Identifiers.EMPTY_MAP, ɵEMPTY_MAP);
91 map.set(Identifiers.viewDef, ɵvid);
92 map.set(Identifiers.elementDef, ɵeld);
93 map.set(Identifiers.anchorDef, ɵand);
94 map.set(Identifiers.textDef, ɵted);
95 map.set(Identifiers.directiveDef, ɵdid);
96 map.set(Identifiers.providerDef, ɵprd);
97 map.set(Identifiers.queryDef, ɵqud);
98 map.set(Identifiers.pureArrayDef, ɵpad);
99 map.set(Identifiers.pureObjectDef, ɵpod);
100 map.set(Identifiers.purePipeDef, ɵppd);
101 map.set(Identifiers.pipeDef, ɵpid);
102 map.set(Identifiers.nodeValue, ɵnov);
103 map.set(Identifiers.ngContentDef, ɵncd);
104 map.set(Identifiers.unwrapValue, ɵunv);
105 map.set(Identifiers.createRendererType2, ɵcrt);
106 map.set(Identifiers.createComponentFactory, ɵccf);
107 return map;
108}
109
110/**
111 * @license
112 * Copyright Google LLC All Rights Reserved.
113 *
114 * Use of this source code is governed by an MIT-style license that can be
115 * found in the LICENSE file at https://angular.io/license
116 */
117const ERROR_COLLECTOR_TOKEN = new InjectionToken('ErrorCollector');
118/**
119 * A default provider for {@link PACKAGE_ROOT_URL} that maps to '/'.
120 */
121const DEFAULT_PACKAGE_URL_PROVIDER = {
122 provide: PACKAGE_ROOT_URL,
123 useValue: '/'
124};
125const _NO_RESOURCE_LOADER = {
126 get(url) {
127 throw new Error(`No ResourceLoader implementation has been provided. Can't read the url "${url}"`);
128 }
129};
130const baseHtmlParser = new InjectionToken('HtmlParser');
131class CompilerImpl {
132 constructor(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, jitEvaluator, compilerConfig, console) {
133 this._metadataResolver = _metadataResolver;
134 this._delegate = new JitCompiler(_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, jitEvaluator, compilerConfig, console, this.getExtraNgModuleProviders.bind(this));
135 this.injector = injector;
136 }
137 getExtraNgModuleProviders() {
138 return [this._metadataResolver.getProviderMetadata(new ProviderMeta(Compiler, { useValue: this }))];
139 }
140 compileModuleSync(moduleType) {
141 return this._delegate.compileModuleSync(moduleType);
142 }
143 compileModuleAsync(moduleType) {
144 return this._delegate.compileModuleAsync(moduleType);
145 }
146 compileModuleAndAllComponentsSync(moduleType) {
147 const result = this._delegate.compileModuleAndAllComponentsSync(moduleType);
148 return {
149 ngModuleFactory: result.ngModuleFactory,
150 componentFactories: result.componentFactories,
151 };
152 }
153 compileModuleAndAllComponentsAsync(moduleType) {
154 return this._delegate.compileModuleAndAllComponentsAsync(moduleType)
155 .then((result) => ({
156 ngModuleFactory: result.ngModuleFactory,
157 componentFactories: result.componentFactories,
158 }));
159 }
160 loadAotSummaries(summaries) {
161 this._delegate.loadAotSummaries(summaries);
162 }
163 hasAotSummary(ref) {
164 return this._delegate.hasAotSummary(ref);
165 }
166 getComponentFactory(component) {
167 return this._delegate.getComponentFactory(component);
168 }
169 clearCache() {
170 this._delegate.clearCache();
171 }
172 clearCacheFor(type) {
173 this._delegate.clearCacheFor(type);
174 }
175 getModuleId(moduleType) {
176 const meta = this._metadataResolver.getNgModuleMetadata(moduleType);
177 return meta && meta.id || undefined;
178 }
179}
180const ɵ0 = new JitReflector(), ɵ1 = _NO_RESOURCE_LOADER, ɵ2 = (parser, translations, format, config, console) => {
181 translations = translations || '';
182 const missingTranslation = translations ? config.missingTranslation : MissingTranslationStrategy.Ignore;
183 return new I18NHtmlParser(parser, translations, format, missingTranslation, console);
184}, ɵ3 = new CompilerConfig();
185/**
186 * A set of providers that provide `JitCompiler` and its dependencies to use for
187 * template compilation.
188 */
189const COMPILER_PROVIDERS__PRE_R3__ = [
190 { provide: CompileReflector, useValue: ɵ0 },
191 { provide: ResourceLoader, useValue: ɵ1 },
192 { provide: JitSummaryResolver, deps: [] },
193 { provide: SummaryResolver, useExisting: JitSummaryResolver },
194 { provide: ɵConsole, deps: [] },
195 { provide: Lexer, deps: [] },
196 { provide: Parser, deps: [Lexer] },
197 {
198 provide: baseHtmlParser,
199 useClass: HtmlParser,
200 deps: [],
201 },
202 {
203 provide: I18NHtmlParser,
204 useFactory: ɵ2,
205 deps: [
206 baseHtmlParser,
207 [new Optional(), new Inject(TRANSLATIONS)],
208 [new Optional(), new Inject(TRANSLATIONS_FORMAT)],
209 [CompilerConfig],
210 [ɵConsole],
211 ]
212 },
213 {
214 provide: HtmlParser,
215 useExisting: I18NHtmlParser,
216 },
217 {
218 provide: TemplateParser,
219 deps: [CompilerConfig, CompileReflector, Parser, ElementSchemaRegistry, I18NHtmlParser, ɵConsole]
220 },
221 { provide: JitEvaluator, useClass: JitEvaluator, deps: [] },
222 { provide: DirectiveNormalizer, deps: [ResourceLoader, UrlResolver, HtmlParser, CompilerConfig] },
223 {
224 provide: CompileMetadataResolver,
225 deps: [
226 CompilerConfig, HtmlParser, NgModuleResolver, DirectiveResolver, PipeResolver,
227 SummaryResolver, ElementSchemaRegistry, DirectiveNormalizer, ɵConsole,
228 [Optional, StaticSymbolCache], CompileReflector, [Optional, ERROR_COLLECTOR_TOKEN]
229 ]
230 },
231 DEFAULT_PACKAGE_URL_PROVIDER,
232 { provide: StyleCompiler, deps: [UrlResolver] },
233 { provide: ViewCompiler, deps: [CompileReflector] },
234 { provide: NgModuleCompiler, deps: [CompileReflector] },
235 { provide: CompilerConfig, useValue: ɵ3 },
236 {
237 provide: Compiler,
238 useClass: CompilerImpl,
239 deps: [
240 Injector, CompileMetadataResolver, TemplateParser, StyleCompiler, ViewCompiler,
241 NgModuleCompiler, SummaryResolver, CompileReflector, JitEvaluator, CompilerConfig, ɵConsole
242 ]
243 },
244 { provide: DomElementSchemaRegistry, deps: [] },
245 { provide: ElementSchemaRegistry, useExisting: DomElementSchemaRegistry },
246 { provide: UrlResolver, deps: [PACKAGE_ROOT_URL] },
247 { provide: DirectiveResolver, deps: [CompileReflector] },
248 { provide: PipeResolver, deps: [CompileReflector] },
249 { provide: NgModuleResolver, deps: [CompileReflector] },
250];
251const COMPILER_PROVIDERS__POST_R3__ = [{ provide: Compiler, useFactory: () => new Compiler() }];
252const COMPILER_PROVIDERS = COMPILER_PROVIDERS__PRE_R3__;
253/**
254 * @publicApi
255 */
256class JitCompilerFactory {
257 /* @internal */
258 constructor(defaultOptions) {
259 const compilerOptions = {
260 useJit: true,
261 defaultEncapsulation: ViewEncapsulation.Emulated,
262 missingTranslation: MissingTranslationStrategy.Warning,
263 };
264 this._defaultOptions = [compilerOptions, ...defaultOptions];
265 }
266 createCompiler(options = []) {
267 const opts = _mergeOptions(this._defaultOptions.concat(options));
268 const injector = Injector.create([
269 COMPILER_PROVIDERS, {
270 provide: CompilerConfig,
271 useFactory: () => {
272 return new CompilerConfig({
273 // let explicit values from the compiler options overwrite options
274 // from the app providers
275 useJit: opts.useJit,
276 jitDevMode: isDevMode(),
277 // let explicit values from the compiler options overwrite options
278 // from the app providers
279 defaultEncapsulation: opts.defaultEncapsulation,
280 missingTranslation: opts.missingTranslation,
281 preserveWhitespaces: opts.preserveWhitespaces,
282 });
283 },
284 deps: []
285 },
286 opts.providers
287 ]);
288 return injector.get(Compiler);
289 }
290}
291function _mergeOptions(optionsArr) {
292 return {
293 useJit: _lastDefined(optionsArr.map(options => options.useJit)),
294 defaultEncapsulation: _lastDefined(optionsArr.map(options => options.defaultEncapsulation)),
295 providers: _mergeArrays(optionsArr.map(options => options.providers)),
296 missingTranslation: _lastDefined(optionsArr.map(options => options.missingTranslation)),
297 preserveWhitespaces: _lastDefined(optionsArr.map(options => options.preserveWhitespaces)),
298 };
299}
300function _lastDefined(args) {
301 for (let i = args.length - 1; i >= 0; i--) {
302 if (args[i] !== undefined) {
303 return args[i];
304 }
305 }
306 return undefined;
307}
308function _mergeArrays(parts) {
309 const result = [];
310 parts.forEach((part) => part && result.push(...part));
311 return result;
312}
313
314/**
315 * @license
316 * Copyright Google LLC All Rights Reserved.
317 *
318 * Use of this source code is governed by an MIT-style license that can be
319 * found in the LICENSE file at https://angular.io/license
320 */
321const ɵ0$1 = {};
322/**
323 * A platform that included corePlatform and the compiler.
324 *
325 * @publicApi
326 */
327const platformCoreDynamic = createPlatformFactory(platformCore, 'coreDynamic', [
328 { provide: COMPILER_OPTIONS, useValue: ɵ0$1, multi: true },
329 { provide: CompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS] },
330]);
331
332/**
333 * @license
334 * Copyright Google LLC All Rights Reserved.
335 *
336 * Use of this source code is governed by an MIT-style license that can be
337 * found in the LICENSE file at https://angular.io/license
338 */
339class ResourceLoaderImpl extends ResourceLoader {
340 get(url) {
341 let resolve;
342 let reject;
343 const promise = new Promise((res, rej) => {
344 resolve = res;
345 reject = rej;
346 });
347 const xhr = new XMLHttpRequest();
348 xhr.open('GET', url, true);
349 xhr.responseType = 'text';
350 xhr.onload = function () {
351 // responseText is the old-school way of retrieving response (supported by IE8 & 9)
352 // response/responseType properties were introduced in ResourceLoader Level2 spec (supported
353 // by IE10)
354 const response = xhr.response || xhr.responseText;
355 // normalize IE9 bug (https://bugs.jquery.com/ticket/1450)
356 let status = xhr.status === 1223 ? 204 : xhr.status;
357 // fix status code when it is 0 (0 status is undocumented).
358 // Occurs when accessing file resources or on Android 4.1 stock browser
359 // while retrieving files from application cache.
360 if (status === 0) {
361 status = response ? 200 : 0;
362 }
363 if (200 <= status && status <= 300) {
364 resolve(response);
365 }
366 else {
367 reject(`Failed to load ${url}`);
368 }
369 };
370 xhr.onerror = function () {
371 reject(`Failed to load ${url}`);
372 };
373 xhr.send();
374 return promise;
375 }
376}
377ResourceLoaderImpl.decorators = [
378 { type: Injectable }
379];
380
381/**
382 * @license
383 * Copyright Google LLC All Rights Reserved.
384 *
385 * Use of this source code is governed by an MIT-style license that can be
386 * found in the LICENSE file at https://angular.io/license
387 */
388const ɵ0$2 = { providers: [{ provide: ResourceLoader, useClass: ResourceLoaderImpl, deps: [] }] }, ɵ1$1 = ɵPLATFORM_BROWSER_ID;
389/**
390 * @publicApi
391 */
392const INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [
393 ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS,
394 {
395 provide: COMPILER_OPTIONS,
396 useValue: ɵ0$2,
397 multi: true
398 },
399 { provide: PLATFORM_ID, useValue: ɵ1$1 },
400];
401
402/**
403 * @license
404 * Copyright Google LLC All Rights Reserved.
405 *
406 * Use of this source code is governed by an MIT-style license that can be
407 * found in the LICENSE file at https://angular.io/license
408 */
409/**
410 * An implementation of ResourceLoader that uses a template cache to avoid doing an actual
411 * ResourceLoader.
412 *
413 * The template cache needs to be built and loaded into window.$templateCache
414 * via a separate mechanism.
415 *
416 * @publicApi
417 */
418class CachedResourceLoader extends ResourceLoader {
419 constructor() {
420 super();
421 this._cache = ɵglobal.$templateCache;
422 if (this._cache == null) {
423 throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.');
424 }
425 }
426 get(url) {
427 if (this._cache.hasOwnProperty(url)) {
428 return Promise.resolve(this._cache[url]);
429 }
430 else {
431 return Promise.reject('CachedResourceLoader: Did not find cached template for ' + url);
432 }
433 }
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
444/**
445 * @license
446 * Copyright Google LLC All Rights Reserved.
447 *
448 * Use of this source code is governed by an MIT-style license that can be
449 * found in the LICENSE file at https://angular.io/license
450 */
451/**
452 * @publicApi
453 */
454const VERSION = new Version('12.2.9');
455
456/**
457 * @license
458 * Copyright Google LLC All Rights Reserved.
459 *
460 * Use of this source code is governed by an MIT-style license that can be
461 * found in the LICENSE file at https://angular.io/license
462 */
463/**
464 * @publicApi
465 */
466const RESOURCE_CACHE_PROVIDER = [{ provide: ResourceLoader, useClass: CachedResourceLoader, deps: [] }];
467/**
468 * @publicApi
469 */
470const platformBrowserDynamic = createPlatformFactory(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
471
472/**
473 * @license
474 * Copyright Google LLC All Rights Reserved.
475 *
476 * Use of this source code is governed by an MIT-style license that can be
477 * found in the LICENSE file at https://angular.io/license
478 */
479// This file only reexports content of the `src` folder. Keep it that way.
480
481/**
482 * @license
483 * Copyright Google LLC All Rights Reserved.
484 *
485 * Use of this source code is governed by an MIT-style license that can be
486 * found in the LICENSE file at https://angular.io/license
487 */
488
489/**
490 * Generated bundle index. Do not edit.
491 */
492
493export { JitCompilerFactory, RESOURCE_CACHE_PROVIDER, VERSION, platformBrowserDynamic, COMPILER_PROVIDERS__POST_R3__ as ɵCOMPILER_PROVIDERS__POST_R3__, CompilerImpl as ɵCompilerImpl, INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS as ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, ResourceLoaderImpl as ɵResourceLoaderImpl, CachedResourceLoader as ɵangular_packages_platform_browser_dynamic_platform_browser_dynamic_a, platformCoreDynamic as ɵplatformCoreDynamic };
494//# sourceMappingURL=platform-browser-dynamic.js.map
Note: See TracBrowser for help on using the repository browser.