platform-browser-dynamic.umd.js 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. /**
  2. * @license Angular v5.2.11
  3. * (c) 2010-2018 Google, Inc. https://angular.io/
  4. * License: MIT
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/compiler'), require('@angular/core'), require('@angular/common'), require('@angular/platform-browser')) :
  8. typeof define === 'function' && define.amd ? define('@angular/platform-browser-dynamic', ['exports', '@angular/compiler', '@angular/core', '@angular/common', '@angular/platform-browser'], factory) :
  9. (factory((global.ng = global.ng || {}, global.ng.platformBrowserDynamic = {}),global.ng.compiler,global.ng.core,global.ng.common,global.ng.platformBrowser));
  10. }(this, (function (exports,_angular_compiler,_angular_core,_angular_common,_angular_platformBrowser) { 'use strict';
  11. /*! *****************************************************************************
  12. Copyright (c) Microsoft Corporation. All rights reserved.
  13. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  14. this file except in compliance with the License. You may obtain a copy of the
  15. License at http://www.apache.org/licenses/LICENSE-2.0
  16. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  17. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  18. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  19. MERCHANTABLITY OR NON-INFRINGEMENT.
  20. See the Apache Version 2.0 License for specific language governing permissions
  21. and limitations under the License.
  22. ***************************************************************************** */
  23. /* global Reflect, Promise */
  24. var extendStatics = Object.setPrototypeOf ||
  25. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  26. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  27. function __extends(d, b) {
  28. extendStatics(d, b);
  29. function __() { this.constructor = d; }
  30. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  31. }
  32. /**
  33. * @license Angular v5.2.11
  34. * (c) 2010-2018 Google, Inc. https://angular.io/
  35. * License: MIT
  36. */
  37. /**
  38. * @fileoverview added by tsickle
  39. * @suppress {checkTypes} checked by tsc
  40. */
  41. /**
  42. * @license
  43. * Copyright Google Inc. All Rights Reserved.
  44. *
  45. * Use of this source code is governed by an MIT-style license that can be
  46. * found in the LICENSE file at https://angular.io/license
  47. */
  48. var MODULE_SUFFIX = '';
  49. var builtinExternalReferences = createBuiltinExternalReferencesMap();
  50. var JitReflector = /** @class */ (function () {
  51. function JitReflector() {
  52. this.builtinExternalReferences = new Map();
  53. this.reflectionCapabilities = new _angular_core.ɵReflectionCapabilities();
  54. }
  55. /**
  56. * @param {?} type
  57. * @param {?} cmpMetadata
  58. * @return {?}
  59. */
  60. JitReflector.prototype.componentModuleUrl = /**
  61. * @param {?} type
  62. * @param {?} cmpMetadata
  63. * @return {?}
  64. */
  65. function (type, cmpMetadata) {
  66. var /** @type {?} */ moduleId = cmpMetadata.moduleId;
  67. if (typeof moduleId === 'string') {
  68. var /** @type {?} */ scheme = _angular_compiler.getUrlScheme(moduleId);
  69. return scheme ? moduleId : "package:" + moduleId + MODULE_SUFFIX;
  70. }
  71. else if (moduleId !== null && moduleId !== void 0) {
  72. throw _angular_compiler.syntaxError("moduleId should be a string in \"" + _angular_core.ɵstringify(type) + "\". See https://goo.gl/wIDDiL for more information.\n" +
  73. "If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.");
  74. }
  75. return "./" + _angular_core.ɵstringify(type);
  76. };
  77. /**
  78. * @param {?} typeOrFunc
  79. * @return {?}
  80. */
  81. JitReflector.prototype.parameters = /**
  82. * @param {?} typeOrFunc
  83. * @return {?}
  84. */
  85. function (typeOrFunc) {
  86. return this.reflectionCapabilities.parameters(typeOrFunc);
  87. };
  88. /**
  89. * @param {?} typeOrFunc
  90. * @return {?}
  91. */
  92. JitReflector.prototype.annotations = /**
  93. * @param {?} typeOrFunc
  94. * @return {?}
  95. */
  96. function (typeOrFunc) {
  97. return this.reflectionCapabilities.annotations(typeOrFunc);
  98. };
  99. /**
  100. * @param {?} typeOrFunc
  101. * @return {?}
  102. */
  103. JitReflector.prototype.propMetadata = /**
  104. * @param {?} typeOrFunc
  105. * @return {?}
  106. */
  107. function (typeOrFunc) {
  108. return this.reflectionCapabilities.propMetadata(typeOrFunc);
  109. };
  110. /**
  111. * @param {?} type
  112. * @param {?} lcProperty
  113. * @return {?}
  114. */
  115. JitReflector.prototype.hasLifecycleHook = /**
  116. * @param {?} type
  117. * @param {?} lcProperty
  118. * @return {?}
  119. */
  120. function (type, lcProperty) {
  121. return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
  122. };
  123. /**
  124. * @param {?} type
  125. * @return {?}
  126. */
  127. JitReflector.prototype.guards = /**
  128. * @param {?} type
  129. * @return {?}
  130. */
  131. function (type) { return this.reflectionCapabilities.guards(type); };
  132. /**
  133. * @param {?} ref
  134. * @return {?}
  135. */
  136. JitReflector.prototype.resolveExternalReference = /**
  137. * @param {?} ref
  138. * @return {?}
  139. */
  140. function (ref) {
  141. return builtinExternalReferences.get(ref) || ref.runtime;
  142. };
  143. return JitReflector;
  144. }());
  145. /**
  146. * @return {?}
  147. */
  148. function createBuiltinExternalReferencesMap() {
  149. var /** @type {?} */ map = new Map();
  150. map.set(_angular_compiler.Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS, _angular_core.ANALYZE_FOR_ENTRY_COMPONENTS);
  151. map.set(_angular_compiler.Identifiers.ElementRef, _angular_core.ElementRef);
  152. map.set(_angular_compiler.Identifiers.NgModuleRef, _angular_core.NgModuleRef);
  153. map.set(_angular_compiler.Identifiers.ViewContainerRef, _angular_core.ViewContainerRef);
  154. map.set(_angular_compiler.Identifiers.ChangeDetectorRef, _angular_core.ChangeDetectorRef);
  155. map.set(_angular_compiler.Identifiers.QueryList, _angular_core.QueryList);
  156. map.set(_angular_compiler.Identifiers.TemplateRef, _angular_core.TemplateRef);
  157. map.set(_angular_compiler.Identifiers.CodegenComponentFactoryResolver, _angular_core.ɵCodegenComponentFactoryResolver);
  158. map.set(_angular_compiler.Identifiers.ComponentFactoryResolver, _angular_core.ComponentFactoryResolver);
  159. map.set(_angular_compiler.Identifiers.ComponentFactory, _angular_core.ComponentFactory);
  160. map.set(_angular_compiler.Identifiers.ComponentRef, _angular_core.ComponentRef);
  161. map.set(_angular_compiler.Identifiers.NgModuleFactory, _angular_core.NgModuleFactory);
  162. map.set(_angular_compiler.Identifiers.createModuleFactory, _angular_core.ɵcmf);
  163. map.set(_angular_compiler.Identifiers.moduleDef, _angular_core.ɵmod);
  164. map.set(_angular_compiler.Identifiers.moduleProviderDef, _angular_core.ɵmpd);
  165. map.set(_angular_compiler.Identifiers.RegisterModuleFactoryFn, _angular_core.ɵregisterModuleFactory);
  166. map.set(_angular_compiler.Identifiers.Injector, _angular_core.Injector);
  167. map.set(_angular_compiler.Identifiers.ViewEncapsulation, _angular_core.ViewEncapsulation);
  168. map.set(_angular_compiler.Identifiers.ChangeDetectionStrategy, _angular_core.ChangeDetectionStrategy);
  169. map.set(_angular_compiler.Identifiers.SecurityContext, _angular_core.SecurityContext);
  170. map.set(_angular_compiler.Identifiers.LOCALE_ID, _angular_core.LOCALE_ID);
  171. map.set(_angular_compiler.Identifiers.TRANSLATIONS_FORMAT, _angular_core.TRANSLATIONS_FORMAT);
  172. map.set(_angular_compiler.Identifiers.inlineInterpolate, _angular_core.ɵinlineInterpolate);
  173. map.set(_angular_compiler.Identifiers.interpolate, _angular_core.ɵinterpolate);
  174. map.set(_angular_compiler.Identifiers.EMPTY_ARRAY, _angular_core.ɵEMPTY_ARRAY);
  175. map.set(_angular_compiler.Identifiers.EMPTY_MAP, _angular_core.ɵEMPTY_MAP);
  176. map.set(_angular_compiler.Identifiers.Renderer, _angular_core.Renderer);
  177. map.set(_angular_compiler.Identifiers.viewDef, _angular_core.ɵvid);
  178. map.set(_angular_compiler.Identifiers.elementDef, _angular_core.ɵeld);
  179. map.set(_angular_compiler.Identifiers.anchorDef, _angular_core.ɵand);
  180. map.set(_angular_compiler.Identifiers.textDef, _angular_core.ɵted);
  181. map.set(_angular_compiler.Identifiers.directiveDef, _angular_core.ɵdid);
  182. map.set(_angular_compiler.Identifiers.providerDef, _angular_core.ɵprd);
  183. map.set(_angular_compiler.Identifiers.queryDef, _angular_core.ɵqud);
  184. map.set(_angular_compiler.Identifiers.pureArrayDef, _angular_core.ɵpad);
  185. map.set(_angular_compiler.Identifiers.pureObjectDef, _angular_core.ɵpod);
  186. map.set(_angular_compiler.Identifiers.purePipeDef, _angular_core.ɵppd);
  187. map.set(_angular_compiler.Identifiers.pipeDef, _angular_core.ɵpid);
  188. map.set(_angular_compiler.Identifiers.nodeValue, _angular_core.ɵnov);
  189. map.set(_angular_compiler.Identifiers.ngContentDef, _angular_core.ɵncd);
  190. map.set(_angular_compiler.Identifiers.unwrapValue, _angular_core.ɵunv);
  191. map.set(_angular_compiler.Identifiers.createRendererType2, _angular_core.ɵcrt);
  192. map.set(_angular_compiler.Identifiers.createComponentFactory, _angular_core.ɵccf);
  193. return map;
  194. }
  195. /**
  196. * @fileoverview added by tsickle
  197. * @suppress {checkTypes} checked by tsc
  198. */
  199. /**
  200. * @license
  201. * Copyright Google Inc. All Rights Reserved.
  202. *
  203. * Use of this source code is governed by an MIT-style license that can be
  204. * found in the LICENSE file at https://angular.io/license
  205. */
  206. var ERROR_COLLECTOR_TOKEN = new _angular_core.InjectionToken('ErrorCollector');
  207. /**
  208. * A default provider for {\@link PACKAGE_ROOT_URL} that maps to '/'.
  209. */
  210. var DEFAULT_PACKAGE_URL_PROVIDER = {
  211. provide: _angular_core.PACKAGE_ROOT_URL,
  212. useValue: '/'
  213. };
  214. var _NO_RESOURCE_LOADER = {
  215. get: /**
  216. * @param {?} url
  217. * @return {?}
  218. */
  219. function (url) {
  220. throw new Error("No ResourceLoader implementation has been provided. Can't read the url \"" + url + "\"");
  221. }
  222. };
  223. var baseHtmlParser = new _angular_core.InjectionToken('HtmlParser');
  224. var CompilerImpl = /** @class */ (function () {
  225. function CompilerImpl(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console) {
  226. this._metadataResolver = _metadataResolver;
  227. this._delegate = new _angular_compiler.JitCompiler(_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console, this.getExtraNgModuleProviders.bind(this));
  228. this.injector = injector;
  229. }
  230. /**
  231. * @return {?}
  232. */
  233. CompilerImpl.prototype.getExtraNgModuleProviders = /**
  234. * @return {?}
  235. */
  236. function () {
  237. return [this._metadataResolver.getProviderMetadata(new _angular_compiler.ProviderMeta(_angular_core.Compiler, { useValue: this }))];
  238. };
  239. /**
  240. * @template T
  241. * @param {?} moduleType
  242. * @return {?}
  243. */
  244. CompilerImpl.prototype.compileModuleSync = /**
  245. * @template T
  246. * @param {?} moduleType
  247. * @return {?}
  248. */
  249. function (moduleType) {
  250. return /** @type {?} */ (this._delegate.compileModuleSync(moduleType));
  251. };
  252. /**
  253. * @template T
  254. * @param {?} moduleType
  255. * @return {?}
  256. */
  257. CompilerImpl.prototype.compileModuleAsync = /**
  258. * @template T
  259. * @param {?} moduleType
  260. * @return {?}
  261. */
  262. function (moduleType) {
  263. return /** @type {?} */ (this._delegate.compileModuleAsync(moduleType));
  264. };
  265. /**
  266. * @template T
  267. * @param {?} moduleType
  268. * @return {?}
  269. */
  270. CompilerImpl.prototype.compileModuleAndAllComponentsSync = /**
  271. * @template T
  272. * @param {?} moduleType
  273. * @return {?}
  274. */
  275. function (moduleType) {
  276. var /** @type {?} */ result = this._delegate.compileModuleAndAllComponentsSync(moduleType);
  277. return {
  278. ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
  279. componentFactories: /** @type {?} */ (result.componentFactories),
  280. };
  281. };
  282. /**
  283. * @template T
  284. * @param {?} moduleType
  285. * @return {?}
  286. */
  287. CompilerImpl.prototype.compileModuleAndAllComponentsAsync = /**
  288. * @template T
  289. * @param {?} moduleType
  290. * @return {?}
  291. */
  292. function (moduleType) {
  293. return this._delegate.compileModuleAndAllComponentsAsync(moduleType)
  294. .then(function (result) {
  295. return ({
  296. ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
  297. componentFactories: /** @type {?} */ (result.componentFactories),
  298. });
  299. });
  300. };
  301. /**
  302. * @param {?} summaries
  303. * @return {?}
  304. */
  305. CompilerImpl.prototype.loadAotSummaries = /**
  306. * @param {?} summaries
  307. * @return {?}
  308. */
  309. function (summaries) { this._delegate.loadAotSummaries(summaries); };
  310. /**
  311. * @param {?} ref
  312. * @return {?}
  313. */
  314. CompilerImpl.prototype.hasAotSummary = /**
  315. * @param {?} ref
  316. * @return {?}
  317. */
  318. function (ref) { return this._delegate.hasAotSummary(ref); };
  319. /**
  320. * @template T
  321. * @param {?} component
  322. * @return {?}
  323. */
  324. CompilerImpl.prototype.getComponentFactory = /**
  325. * @template T
  326. * @param {?} component
  327. * @return {?}
  328. */
  329. function (component) {
  330. return /** @type {?} */ (this._delegate.getComponentFactory(component));
  331. };
  332. /**
  333. * @return {?}
  334. */
  335. CompilerImpl.prototype.clearCache = /**
  336. * @return {?}
  337. */
  338. function () { this._delegate.clearCache(); };
  339. /**
  340. * @param {?} type
  341. * @return {?}
  342. */
  343. CompilerImpl.prototype.clearCacheFor = /**
  344. * @param {?} type
  345. * @return {?}
  346. */
  347. function (type) { this._delegate.clearCacheFor(type); };
  348. return CompilerImpl;
  349. }());
  350. /**
  351. * A set of providers that provide `JitCompiler` and its dependencies to use for
  352. * template compilation.
  353. */
  354. var COMPILER_PROVIDERS = /** @type {?} */ ([
  355. { provide: _angular_compiler.CompileReflector, useValue: new JitReflector() },
  356. { provide: _angular_compiler.ResourceLoader, useValue: _NO_RESOURCE_LOADER },
  357. { provide: _angular_compiler.JitSummaryResolver, deps: [] },
  358. { provide: _angular_compiler.SummaryResolver, useExisting: _angular_compiler.JitSummaryResolver },
  359. { provide: _angular_core.ɵConsole, deps: [] },
  360. { provide: _angular_compiler.Lexer, deps: [] },
  361. { provide: _angular_compiler.Parser, deps: [_angular_compiler.Lexer] },
  362. {
  363. provide: baseHtmlParser,
  364. useClass: _angular_compiler.HtmlParser,
  365. deps: [],
  366. },
  367. {
  368. provide: _angular_compiler.I18NHtmlParser,
  369. useFactory: function (parser, translations, format, config, console) {
  370. translations = translations || '';
  371. var /** @type {?} */ missingTranslation = translations ? /** @type {?} */ ((config.missingTranslation)) : _angular_core.MissingTranslationStrategy.Ignore;
  372. return new _angular_compiler.I18NHtmlParser(parser, translations, format, missingTranslation, console);
  373. },
  374. deps: [
  375. baseHtmlParser,
  376. [new _angular_core.Optional(), new _angular_core.Inject(_angular_core.TRANSLATIONS)],
  377. [new _angular_core.Optional(), new _angular_core.Inject(_angular_core.TRANSLATIONS_FORMAT)],
  378. [_angular_compiler.CompilerConfig],
  379. [_angular_core.ɵConsole],
  380. ]
  381. },
  382. {
  383. provide: _angular_compiler.HtmlParser,
  384. useExisting: _angular_compiler.I18NHtmlParser,
  385. },
  386. {
  387. provide: _angular_compiler.TemplateParser, deps: [_angular_compiler.CompilerConfig, _angular_compiler.CompileReflector,
  388. _angular_compiler.Parser, _angular_compiler.ElementSchemaRegistry,
  389. _angular_compiler.I18NHtmlParser, _angular_core.ɵConsole]
  390. },
  391. { provide: _angular_compiler.DirectiveNormalizer, deps: [_angular_compiler.ResourceLoader, _angular_compiler.UrlResolver, _angular_compiler.HtmlParser, _angular_compiler.CompilerConfig] },
  392. { provide: _angular_compiler.CompileMetadataResolver, deps: [_angular_compiler.CompilerConfig, _angular_compiler.HtmlParser, _angular_compiler.NgModuleResolver,
  393. _angular_compiler.DirectiveResolver, _angular_compiler.PipeResolver,
  394. _angular_compiler.SummaryResolver,
  395. _angular_compiler.ElementSchemaRegistry,
  396. _angular_compiler.DirectiveNormalizer, _angular_core.ɵConsole,
  397. [_angular_core.Optional, _angular_compiler.StaticSymbolCache],
  398. _angular_compiler.CompileReflector,
  399. [_angular_core.Optional, ERROR_COLLECTOR_TOKEN]] },
  400. DEFAULT_PACKAGE_URL_PROVIDER,
  401. { provide: _angular_compiler.StyleCompiler, deps: [_angular_compiler.UrlResolver] },
  402. { provide: _angular_compiler.ViewCompiler, deps: [_angular_compiler.CompileReflector] },
  403. { provide: _angular_compiler.NgModuleCompiler, deps: [_angular_compiler.CompileReflector] },
  404. { provide: _angular_compiler.CompilerConfig, useValue: new _angular_compiler.CompilerConfig() },
  405. { provide: _angular_core.Compiler, useClass: CompilerImpl, deps: [_angular_core.Injector, _angular_compiler.CompileMetadataResolver,
  406. _angular_compiler.TemplateParser, _angular_compiler.StyleCompiler,
  407. _angular_compiler.ViewCompiler, _angular_compiler.NgModuleCompiler,
  408. _angular_compiler.SummaryResolver, _angular_compiler.CompileReflector, _angular_compiler.CompilerConfig,
  409. _angular_core.ɵConsole] },
  410. { provide: _angular_compiler.DomElementSchemaRegistry, deps: [] },
  411. { provide: _angular_compiler.ElementSchemaRegistry, useExisting: _angular_compiler.DomElementSchemaRegistry },
  412. { provide: _angular_compiler.UrlResolver, deps: [_angular_core.PACKAGE_ROOT_URL] },
  413. { provide: _angular_compiler.DirectiveResolver, deps: [_angular_compiler.CompileReflector] },
  414. { provide: _angular_compiler.PipeResolver, deps: [_angular_compiler.CompileReflector] },
  415. { provide: _angular_compiler.NgModuleResolver, deps: [_angular_compiler.CompileReflector] },
  416. ]);
  417. /**
  418. * \@experimental
  419. */
  420. var JitCompilerFactory = /** @class */ (function () {
  421. /* @internal */
  422. function JitCompilerFactory(defaultOptions) {
  423. var /** @type {?} */ compilerOptions = {
  424. useJit: true,
  425. defaultEncapsulation: _angular_core.ViewEncapsulation.Emulated,
  426. missingTranslation: _angular_core.MissingTranslationStrategy.Warning,
  427. enableLegacyTemplate: false,
  428. };
  429. this._defaultOptions = [compilerOptions].concat(defaultOptions);
  430. }
  431. /**
  432. * @param {?=} options
  433. * @return {?}
  434. */
  435. JitCompilerFactory.prototype.createCompiler = /**
  436. * @param {?=} options
  437. * @return {?}
  438. */
  439. function (options) {
  440. if (options === void 0) { options = []; }
  441. var /** @type {?} */ opts = _mergeOptions(this._defaultOptions.concat(options));
  442. var /** @type {?} */ injector = _angular_core.Injector.create([
  443. COMPILER_PROVIDERS, {
  444. provide: _angular_compiler.CompilerConfig,
  445. useFactory: function () {
  446. return new _angular_compiler.CompilerConfig({
  447. // let explicit values from the compiler options overwrite options
  448. // from the app providers
  449. useJit: opts.useJit,
  450. jitDevMode: _angular_core.isDevMode(),
  451. // let explicit values from the compiler options overwrite options
  452. // from the app providers
  453. defaultEncapsulation: opts.defaultEncapsulation,
  454. missingTranslation: opts.missingTranslation,
  455. enableLegacyTemplate: opts.enableLegacyTemplate,
  456. preserveWhitespaces: opts.preserveWhitespaces,
  457. });
  458. },
  459. deps: []
  460. },
  461. /** @type {?} */ ((opts.providers))
  462. ]);
  463. return injector.get(_angular_core.Compiler);
  464. };
  465. return JitCompilerFactory;
  466. }());
  467. /**
  468. * @param {?} optionsArr
  469. * @return {?}
  470. */
  471. function _mergeOptions(optionsArr) {
  472. return {
  473. useJit: _lastDefined(optionsArr.map(function (options) { return options.useJit; })),
  474. defaultEncapsulation: _lastDefined(optionsArr.map(function (options) { return options.defaultEncapsulation; })),
  475. providers: _mergeArrays(optionsArr.map(function (options) { return ((options.providers)); })),
  476. missingTranslation: _lastDefined(optionsArr.map(function (options) { return options.missingTranslation; })),
  477. enableLegacyTemplate: _lastDefined(optionsArr.map(function (options) { return options.enableLegacyTemplate; })),
  478. preserveWhitespaces: _lastDefined(optionsArr.map(function (options) { return options.preserveWhitespaces; })),
  479. };
  480. }
  481. /**
  482. * @template T
  483. * @param {?} args
  484. * @return {?}
  485. */
  486. function _lastDefined(args) {
  487. for (var /** @type {?} */ i = args.length - 1; i >= 0; i--) {
  488. if (args[i] !== undefined) {
  489. return args[i];
  490. }
  491. }
  492. return undefined;
  493. }
  494. /**
  495. * @param {?} parts
  496. * @return {?}
  497. */
  498. function _mergeArrays(parts) {
  499. var /** @type {?} */ result = [];
  500. parts.forEach(function (part) { return part && result.push.apply(result, part); });
  501. return result;
  502. }
  503. /**
  504. * @fileoverview added by tsickle
  505. * @suppress {checkTypes} checked by tsc
  506. */
  507. /**
  508. * @license
  509. * Copyright Google Inc. All Rights Reserved.
  510. *
  511. * Use of this source code is governed by an MIT-style license that can be
  512. * found in the LICENSE file at https://angular.io/license
  513. */
  514. /**
  515. * A platform that included corePlatform and the compiler.
  516. *
  517. * \@experimental
  518. */
  519. var platformCoreDynamic = _angular_core.createPlatformFactory(_angular_core.platformCore, 'coreDynamic', [
  520. { provide: _angular_core.COMPILER_OPTIONS, useValue: {}, multi: true },
  521. { provide: _angular_core.CompilerFactory, useClass: JitCompilerFactory, deps: [_angular_core.COMPILER_OPTIONS] },
  522. ]);
  523. /**
  524. * @fileoverview added by tsickle
  525. * @suppress {checkTypes} checked by tsc
  526. */
  527. var ResourceLoaderImpl = /** @class */ (function (_super) {
  528. __extends(ResourceLoaderImpl, _super);
  529. function ResourceLoaderImpl() {
  530. return _super !== null && _super.apply(this, arguments) || this;
  531. }
  532. /**
  533. * @param {?} url
  534. * @return {?}
  535. */
  536. ResourceLoaderImpl.prototype.get = /**
  537. * @param {?} url
  538. * @return {?}
  539. */
  540. function (url) {
  541. var /** @type {?} */ resolve;
  542. var /** @type {?} */ reject;
  543. var /** @type {?} */ promise = new Promise(function (res, rej) {
  544. resolve = res;
  545. reject = rej;
  546. });
  547. var /** @type {?} */ xhr = new XMLHttpRequest();
  548. xhr.open('GET', url, true);
  549. xhr.responseType = 'text';
  550. xhr.onload = function () {
  551. // responseText is the old-school way of retrieving response (supported by IE8 & 9)
  552. // response/responseType properties were introduced in ResourceLoader Level2 spec (supported
  553. // by IE10)
  554. var /** @type {?} */ response = xhr.response || xhr.responseText;
  555. // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
  556. var /** @type {?} */ status = xhr.status === 1223 ? 204 : xhr.status;
  557. // fix status code when it is 0 (0 status is undocumented).
  558. // Occurs when accessing file resources or on Android 4.1 stock browser
  559. // while retrieving files from application cache.
  560. if (status === 0) {
  561. status = response ? 200 : 0;
  562. }
  563. if (200 <= status && status <= 300) {
  564. resolve(response);
  565. }
  566. else {
  567. reject("Failed to load " + url);
  568. }
  569. };
  570. xhr.onerror = function () { reject("Failed to load " + url); };
  571. xhr.send();
  572. return promise;
  573. };
  574. ResourceLoaderImpl.decorators = [
  575. { type: _angular_core.Injectable },
  576. ];
  577. /** @nocollapse */
  578. ResourceLoaderImpl.ctorParameters = function () { return []; };
  579. return ResourceLoaderImpl;
  580. }(_angular_compiler.ResourceLoader));
  581. /**
  582. * @fileoverview added by tsickle
  583. * @suppress {checkTypes} checked by tsc
  584. */
  585. /**
  586. * @license
  587. * Copyright Google Inc. All Rights Reserved.
  588. *
  589. * Use of this source code is governed by an MIT-style license that can be
  590. * found in the LICENSE file at https://angular.io/license
  591. */
  592. var INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [
  593. _angular_platformBrowser.ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS,
  594. {
  595. provide: _angular_core.COMPILER_OPTIONS,
  596. useValue: { providers: [{ provide: _angular_compiler.ResourceLoader, useClass: ResourceLoaderImpl, deps: [] }] },
  597. multi: true
  598. },
  599. { provide: _angular_core.PLATFORM_ID, useValue: _angular_common.ɵPLATFORM_BROWSER_ID },
  600. ];
  601. /**
  602. * @fileoverview added by tsickle
  603. * @suppress {checkTypes} checked by tsc
  604. */
  605. /**
  606. * @license
  607. * Copyright Google Inc. All Rights Reserved.
  608. *
  609. * Use of this source code is governed by an MIT-style license that can be
  610. * found in the LICENSE file at https://angular.io/license
  611. */
  612. /**
  613. * An implementation of ResourceLoader that uses a template cache to avoid doing an actual
  614. * ResourceLoader.
  615. *
  616. * The template cache needs to be built and loaded into window.$templateCache
  617. * via a separate mechanism.
  618. */
  619. var CachedResourceLoader = /** @class */ (function (_super) {
  620. __extends(CachedResourceLoader, _super);
  621. function CachedResourceLoader() {
  622. var _this = _super.call(this) || this;
  623. _this._cache = (/** @type {?} */ (_angular_core.ɵglobal)).$templateCache;
  624. if (_this._cache == null) {
  625. throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.');
  626. }
  627. return _this;
  628. }
  629. /**
  630. * @param {?} url
  631. * @return {?}
  632. */
  633. CachedResourceLoader.prototype.get = /**
  634. * @param {?} url
  635. * @return {?}
  636. */
  637. function (url) {
  638. if (this._cache.hasOwnProperty(url)) {
  639. return Promise.resolve(this._cache[url]);
  640. }
  641. else {
  642. return /** @type {?} */ (Promise.reject('CachedResourceLoader: Did not find cached template for ' + url));
  643. }
  644. };
  645. return CachedResourceLoader;
  646. }(_angular_compiler.ResourceLoader));
  647. /**
  648. * @fileoverview added by tsickle
  649. * @suppress {checkTypes} checked by tsc
  650. */
  651. /**
  652. * @license
  653. * Copyright Google Inc. All Rights Reserved.
  654. *
  655. * Use of this source code is governed by an MIT-style license that can be
  656. * found in the LICENSE file at https://angular.io/license
  657. */
  658. /**
  659. * @fileoverview added by tsickle
  660. * @suppress {checkTypes} checked by tsc
  661. */
  662. /**
  663. * @license
  664. * Copyright Google Inc. All Rights Reserved.
  665. *
  666. * Use of this source code is governed by an MIT-style license that can be
  667. * found in the LICENSE file at https://angular.io/license
  668. */
  669. /**
  670. * \@stable
  671. */
  672. var VERSION = new _angular_core.Version('5.2.11');
  673. /**
  674. * @fileoverview added by tsickle
  675. * @suppress {checkTypes} checked by tsc
  676. */
  677. /**
  678. * @license
  679. * Copyright Google Inc. All Rights Reserved.
  680. *
  681. * Use of this source code is governed by an MIT-style license that can be
  682. * found in the LICENSE file at https://angular.io/license
  683. */
  684. /**
  685. * \@experimental
  686. */
  687. var RESOURCE_CACHE_PROVIDER = [{ provide: _angular_compiler.ResourceLoader, useClass: CachedResourceLoader, deps: [] }];
  688. /**
  689. * \@stable
  690. */
  691. var platformBrowserDynamic = _angular_core.createPlatformFactory(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
  692. exports.VERSION = VERSION;
  693. exports.JitCompilerFactory = JitCompilerFactory;
  694. exports.RESOURCE_CACHE_PROVIDER = RESOURCE_CACHE_PROVIDER;
  695. exports.platformBrowserDynamic = platformBrowserDynamic;
  696. exports.ɵCompilerImpl = CompilerImpl;
  697. exports.ɵplatformCoreDynamic = platformCoreDynamic;
  698. exports.ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS;
  699. exports.ɵResourceLoaderImpl = ResourceLoaderImpl;
  700. exports.ɵa = CachedResourceLoader;
  701. Object.defineProperty(exports, '__esModule', { value: true });
  702. })));
  703. //# sourceMappingURL=platform-browser-dynamic.umd.js.map