1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import { Subject, Subscription, Observable, merge as merge$1 } from 'rxjs';
|
8 | import { share } from 'rxjs/operators';
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | function noSideEffects(fn) {
|
27 | return { toString: fn }.toString();
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | const ANNOTATIONS = '__annotations__';
|
38 | const PARAMETERS = '__parameters__';
|
39 | const PROP_METADATA = '__prop__metadata__';
|
40 |
|
41 |
|
42 |
|
43 | function makeDecorator(name, props, parentClass, additionalProcessing, typeFn) {
|
44 | return noSideEffects(() => {
|
45 | const metaCtor = makeMetadataCtor(props);
|
46 | function DecoratorFactory(...args) {
|
47 | if (this instanceof DecoratorFactory) {
|
48 | metaCtor.call(this, ...args);
|
49 | return this;
|
50 | }
|
51 | const annotationInstance = new DecoratorFactory(...args);
|
52 | return function TypeDecorator(cls) {
|
53 | if (typeFn)
|
54 | typeFn(cls, ...args);
|
55 |
|
56 |
|
57 | const annotations = cls.hasOwnProperty(ANNOTATIONS) ?
|
58 | cls[ANNOTATIONS] :
|
59 | Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
|
60 | annotations.push(annotationInstance);
|
61 | if (additionalProcessing)
|
62 | additionalProcessing(cls);
|
63 | return cls;
|
64 | };
|
65 | }
|
66 | if (parentClass) {
|
67 | DecoratorFactory.prototype = Object.create(parentClass.prototype);
|
68 | }
|
69 | DecoratorFactory.prototype.ngMetadataName = name;
|
70 | DecoratorFactory.annotationCls = DecoratorFactory;
|
71 | return DecoratorFactory;
|
72 | });
|
73 | }
|
74 | function makeMetadataCtor(props) {
|
75 | return function ctor(...args) {
|
76 | if (props) {
|
77 | const values = props(...args);
|
78 | for (const propName in values) {
|
79 | this[propName] = values[propName];
|
80 | }
|
81 | }
|
82 | };
|
83 | }
|
84 | function makeParamDecorator(name, props, parentClass) {
|
85 | return noSideEffects(() => {
|
86 | const metaCtor = makeMetadataCtor(props);
|
87 | function ParamDecoratorFactory(...args) {
|
88 | if (this instanceof ParamDecoratorFactory) {
|
89 | metaCtor.apply(this, args);
|
90 | return this;
|
91 | }
|
92 | const annotationInstance = new ParamDecoratorFactory(...args);
|
93 | ParamDecorator.annotation = annotationInstance;
|
94 | return ParamDecorator;
|
95 | function ParamDecorator(cls, unusedKey, index) {
|
96 |
|
97 |
|
98 | const parameters = cls.hasOwnProperty(PARAMETERS) ?
|
99 | cls[PARAMETERS] :
|
100 | Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
|
101 |
|
102 |
|
103 | while (parameters.length <= index) {
|
104 | parameters.push(null);
|
105 | }
|
106 | (parameters[index] = parameters[index] || []).push(annotationInstance);
|
107 | return cls;
|
108 | }
|
109 | }
|
110 | if (parentClass) {
|
111 | ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
112 | }
|
113 | ParamDecoratorFactory.prototype.ngMetadataName = name;
|
114 | ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;
|
115 | return ParamDecoratorFactory;
|
116 | });
|
117 | }
|
118 | function makePropDecorator(name, props, parentClass, additionalProcessing) {
|
119 | return noSideEffects(() => {
|
120 | const metaCtor = makeMetadataCtor(props);
|
121 | function PropDecoratorFactory(...args) {
|
122 | if (this instanceof PropDecoratorFactory) {
|
123 | metaCtor.apply(this, args);
|
124 | return this;
|
125 | }
|
126 | const decoratorInstance = new PropDecoratorFactory(...args);
|
127 | function PropDecorator(target, name) {
|
128 | const constructor = target.constructor;
|
129 | // Use of Object.defineProperty is important because it creates a non-enumerable property
|
130 | // which prevents the property from being copied during subclassing.
|
131 | const meta = constructor.hasOwnProperty(PROP_METADATA) ?
|
132 | constructor[PROP_METADATA] :
|
133 | Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA];
|
134 | meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
|
135 | meta[name].unshift(decoratorInstance);
|
136 | if (additionalProcessing)
|
137 | additionalProcessing(target, name, ...args);
|
138 | }
|
139 | return PropDecorator;
|
140 | }
|
141 | if (parentClass) {
|
142 | PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
143 | }
|
144 | PropDecoratorFactory.prototype.ngMetadataName = name;
|
145 | PropDecoratorFactory.annotationCls = PropDecoratorFactory;
|
146 | return PropDecoratorFactory;
|
147 | });
|
148 | }
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 | const ɵ0 = (token) => ({ token });
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 | const Inject = makeParamDecorator('Inject', ɵ0);
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | const Optional = makeParamDecorator('Optional');
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | const Self = makeParamDecorator('Self');
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 | const SkipSelf = makeParamDecorator('SkipSelf');
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 | const Host = makeParamDecorator('Host');
|
193 | const ɵ1 = (attributeName) => ({ attributeName });
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | const Attribute = makeParamDecorator('Attribute', ɵ1);
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | var InjectFlags;
|
215 | (function (InjectFlags) {
|
216 |
|
217 |
|
218 | InjectFlags[InjectFlags["Default"] = 0] = "Default";
|
219 | |
220 |
|
221 |
|
222 |
|
223 | InjectFlags[InjectFlags["Host"] = 1] = "Host";
|
224 |
|
225 | InjectFlags[InjectFlags["Self"] = 2] = "Self";
|
226 |
|
227 | InjectFlags[InjectFlags["SkipSelf"] = 4] = "SkipSelf";
|
228 |
|
229 | InjectFlags[InjectFlags["Optional"] = 8] = "Optional";
|
230 | })(InjectFlags || (InjectFlags = {}));
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 | function getClosureSafeProperty(objWithPropertyToExtract) {
|
240 | for (let key in objWithPropertyToExtract) {
|
241 | if (objWithPropertyToExtract[key] === getClosureSafeProperty) {
|
242 | return key;
|
243 | }
|
244 | }
|
245 | throw Error('Could not find renamed property on target object.');
|
246 | }
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 | function fillProperties(target, source) {
|
254 | for (const key in source) {
|
255 | if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {
|
256 | target[key] = source[key];
|
257 | }
|
258 | }
|
259 | }
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 | function ɵɵdefineInjectable(opts) {
|
286 | return {
|
287 | token: opts.token,
|
288 | providedIn: opts.providedIn || null,
|
289 | factory: opts.factory,
|
290 | value: undefined,
|
291 | };
|
292 | }
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 | const defineInjectable = ɵɵdefineInjectable;
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 | function ɵɵdefineInjector(options) {
|
320 | return {
|
321 | factory: options.factory,
|
322 | providers: options.providers || [],
|
323 | imports: options.imports || [],
|
324 | };
|
325 | }
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 | function getInjectableDef(type) {
|
333 | return getOwnDefinition(type, type[NG_PROV_DEF]) ||
|
334 | getOwnDefinition(type, type[NG_INJECTABLE_DEF]);
|
335 | }
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 | function getOwnDefinition(type, def) {
|
348 | return def && def.token === type ? def : null;
|
349 | }
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 | function getInheritedInjectableDef(type) {
|
359 |
|
360 | const def = type &&
|
361 | (type[NG_PROV_DEF] || type[NG_INJECTABLE_DEF] ||
|
362 | (type[NG_PROV_DEF_FALLBACK] && type[NG_PROV_DEF_FALLBACK]()));
|
363 | if (def) {
|
364 | const typeName = getTypeName(type);
|
365 |
|
366 |
|
367 | console.warn(`DEPRECATED: DI is instantiating a token "${typeName}" that inherits its @Injectable decorator but does not provide one itself.\n` +
|
368 | `This will become an error in a future version of Angular. Please add @Injectable() to the "${typeName}" class.`);
|
369 | return def;
|
370 | }
|
371 | else {
|
372 | return null;
|
373 | }
|
374 | }
|
375 |
|
376 | function getTypeName(type) {
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 | if (type.hasOwnProperty('name')) {
|
384 | return type.name;
|
385 | }
|
386 | const match = ('' + type).match(/^function\s*([^\s(]+)/);
|
387 | return match === null ? '' : match[1];
|
388 | }
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 | function getInjectorDef(type) {
|
395 | return type && (type.hasOwnProperty(NG_INJ_DEF) || type.hasOwnProperty(NG_INJECTOR_DEF)) ?
|
396 | type[NG_INJ_DEF] :
|
397 | null;
|
398 | }
|
399 | const NG_PROV_DEF = getClosureSafeProperty({ ɵprov: getClosureSafeProperty });
|
400 | const NG_INJ_DEF = getClosureSafeProperty({ ɵinj: getClosureSafeProperty });
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 | const NG_PROV_DEF_FALLBACK = getClosureSafeProperty({ ɵprovFallback: getClosureSafeProperty });
|
408 |
|
409 | const NG_INJECTABLE_DEF = getClosureSafeProperty({ ngInjectableDef: getClosureSafeProperty });
|
410 | const NG_INJECTOR_DEF = getClosureSafeProperty({ ngInjectorDef: getClosureSafeProperty });
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 | function stringify(token) {
|
420 | if (typeof token === 'string') {
|
421 | return token;
|
422 | }
|
423 | if (Array.isArray(token)) {
|
424 | return '[' + token.map(stringify).join(', ') + ']';
|
425 | }
|
426 | if (token == null) {
|
427 | return '' + token;
|
428 | }
|
429 | if (token.overriddenName) {
|
430 | return `${token.overriddenName}`;
|
431 | }
|
432 | if (token.name) {
|
433 | return `${token.name}`;
|
434 | }
|
435 | const res = token.toString();
|
436 | if (res == null) {
|
437 | return '' + res;
|
438 | }
|
439 | const newLineIndex = res.indexOf('\n');
|
440 | return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
|
441 | }
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 | function concatStringsWithSpace(before, after) {
|
451 | return (before == null || before === '') ?
|
452 | (after === null ? '' : after) :
|
453 | ((after == null || after === '') ? before : before + ' ' + after);
|
454 | }
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 | const __forward_ref__ = getClosureSafeProperty({ __forward_ref__: getClosureSafeProperty });
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 | function forwardRef(forwardRefFn) {
|
477 | forwardRefFn.__forward_ref__ = forwardRef;
|
478 | forwardRefFn.toString = function () {
|
479 | return stringify(this());
|
480 | };
|
481 | return forwardRefFn;
|
482 | }
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 | function resolveForwardRef(type) {
|
497 | return isForwardRef(type) ? type() : type;
|
498 | }
|
499 |
|
500 | function isForwardRef(fn) {
|
501 | return typeof fn === 'function' && fn.hasOwnProperty(__forward_ref__) &&
|
502 | fn.__forward_ref__ === forwardRef;
|
503 | }
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 | const __globalThis = typeof globalThis !== 'undefined' && globalThis;
|
513 | const __window = typeof window !== 'undefined' && window;
|
514 | const __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
515 | self instanceof WorkerGlobalScope && self;
|
516 | const __global = typeof global !== 'undefined' && global;
|
517 |
|
518 |
|
519 |
|
520 | const _global = __globalThis || __global || __window || __self;
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 | var R3ResolvedDependencyType;
|
530 | (function (R3ResolvedDependencyType) {
|
531 | R3ResolvedDependencyType[R3ResolvedDependencyType["Token"] = 0] = "Token";
|
532 | R3ResolvedDependencyType[R3ResolvedDependencyType["Attribute"] = 1] = "Attribute";
|
533 | R3ResolvedDependencyType[R3ResolvedDependencyType["ChangeDetectorRef"] = 2] = "ChangeDetectorRef";
|
534 | R3ResolvedDependencyType[R3ResolvedDependencyType["Invalid"] = 3] = "Invalid";
|
535 | })(R3ResolvedDependencyType || (R3ResolvedDependencyType = {}));
|
536 | var R3FactoryTarget;
|
537 | (function (R3FactoryTarget) {
|
538 | R3FactoryTarget[R3FactoryTarget["Directive"] = 0] = "Directive";
|
539 | R3FactoryTarget[R3FactoryTarget["Component"] = 1] = "Component";
|
540 | R3FactoryTarget[R3FactoryTarget["Injectable"] = 2] = "Injectable";
|
541 | R3FactoryTarget[R3FactoryTarget["Pipe"] = 3] = "Pipe";
|
542 | R3FactoryTarget[R3FactoryTarget["NgModule"] = 4] = "NgModule";
|
543 | })(R3FactoryTarget || (R3FactoryTarget = {}));
|
544 | var ViewEncapsulation;
|
545 | (function (ViewEncapsulation) {
|
546 | ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
|
547 | ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native";
|
548 | ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
|
549 | ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
|
550 | })(ViewEncapsulation || (ViewEncapsulation = {}));
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 | function getCompilerFacade() {
|
560 | const globalNg = _global['ng'];
|
561 | if (!globalNg || !globalNg.ɵcompilerFacade) {
|
562 | throw new Error(`Angular JIT compilation failed: '@angular/compiler' not loaded!\n` +
|
563 | ` - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.\n` +
|
564 | ` - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?\n` +
|
565 | ` - Alternatively provide the compiler with 'import "@angular/compiler";' before bootstrapping.`);
|
566 | }
|
567 | return globalNg.ɵcompilerFacade;
|
568 | }
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 | const NG_COMP_DEF = getClosureSafeProperty({ ɵcmp: getClosureSafeProperty });
|
578 | const NG_DIR_DEF = getClosureSafeProperty({ ɵdir: getClosureSafeProperty });
|
579 | const NG_PIPE_DEF = getClosureSafeProperty({ ɵpipe: getClosureSafeProperty });
|
580 | const NG_MOD_DEF = getClosureSafeProperty({ ɵmod: getClosureSafeProperty });
|
581 | const NG_LOC_ID_DEF = getClosureSafeProperty({ ɵloc: getClosureSafeProperty });
|
582 | const NG_FACTORY_DEF = getClosureSafeProperty({ ɵfac: getClosureSafeProperty });
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 | const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty });
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 | function ngDevModeResetPerfCounters() {
|
599 | const locationString = typeof location !== 'undefined' ? location.toString() : '';
|
600 | const newCounters = {
|
601 | namedConstructors: locationString.indexOf('ngDevMode=namedConstructors') != -1,
|
602 | firstCreatePass: 0,
|
603 | tNode: 0,
|
604 | tView: 0,
|
605 | rendererCreateTextNode: 0,
|
606 | rendererSetText: 0,
|
607 | rendererCreateElement: 0,
|
608 | rendererAddEventListener: 0,
|
609 | rendererSetAttribute: 0,
|
610 | rendererRemoveAttribute: 0,
|
611 | rendererSetProperty: 0,
|
612 | rendererSetClassName: 0,
|
613 | rendererAddClass: 0,
|
614 | rendererRemoveClass: 0,
|
615 | rendererSetStyle: 0,
|
616 | rendererRemoveStyle: 0,
|
617 | rendererDestroy: 0,
|
618 | rendererDestroyNode: 0,
|
619 | rendererMoveNode: 0,
|
620 | rendererRemoveNode: 0,
|
621 | rendererAppendChild: 0,
|
622 | rendererInsertBefore: 0,
|
623 | rendererCreateComment: 0,
|
624 | };
|
625 |
|
626 | const allowNgDevModeTrue = locationString.indexOf('ngDevMode=false') === -1;
|
627 | _global['ngDevMode'] = allowNgDevModeTrue && newCounters;
|
628 | return newCounters;
|
629 | }
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 | function initNgDevMode() {
|
652 |
|
653 |
|
654 |
|
655 |
|
656 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
657 | if (typeof ngDevMode !== 'object') {
|
658 | ngDevModeResetPerfCounters();
|
659 | }
|
660 | return !!ngDevMode;
|
661 | }
|
662 | return false;
|
663 | }
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 | class InjectionToken {
|
713 | constructor(_desc, options) {
|
714 | this._desc = _desc;
|
715 |
|
716 | this.ngMetadataName = 'InjectionToken';
|
717 | this.ɵprov = undefined;
|
718 | if (typeof options == 'number') {
|
719 |
|
720 |
|
721 |
|
722 | this.__NG_ELEMENT_ID__ = options;
|
723 | }
|
724 | else if (options !== undefined) {
|
725 | this.ɵprov = ɵɵdefineInjectable({
|
726 | token: this,
|
727 | providedIn: options.providedIn || 'root',
|
728 | factory: options.factory,
|
729 | });
|
730 | }
|
731 | }
|
732 | toString() {
|
733 | return `InjectionToken ${this._desc}`;
|
734 | }
|
735 | }
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 | const INJECTOR = new InjectionToken('INJECTOR', -1
|
753 | );
|
754 | const _THROW_IF_NOT_FOUND = {};
|
755 | const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
756 | const NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';
|
757 | const NG_TOKEN_PATH = 'ngTokenPath';
|
758 | const NEW_LINE = /\n/gm;
|
759 | const NO_NEW_LINE = 'ɵ';
|
760 | const SOURCE = '__source';
|
761 | const ɵ0$1 = getClosureSafeProperty;
|
762 | const USE_VALUE = getClosureSafeProperty({ provide: String, useValue: ɵ0$1 });
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 | let _currentInjector = undefined;
|
770 | function setCurrentInjector(injector) {
|
771 | const former = _currentInjector;
|
772 | _currentInjector = injector;
|
773 | return former;
|
774 | }
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 | let _injectImplementation;
|
785 |
|
786 |
|
787 |
|
788 | function setInjectImplementation(impl) {
|
789 | const previous = _injectImplementation;
|
790 | _injectImplementation = impl;
|
791 | return previous;
|
792 | }
|
793 | function injectInjectorOnly(token, flags = InjectFlags.Default) {
|
794 | if (_currentInjector === undefined) {
|
795 | throw new Error(`inject() must be called from an injection context`);
|
796 | }
|
797 | else if (_currentInjector === null) {
|
798 | return injectRootLimpMode(token, undefined, flags);
|
799 | }
|
800 | else {
|
801 | return _currentInjector.get(token, flags & InjectFlags.Optional ? null : undefined, flags);
|
802 | }
|
803 | }
|
804 | function ɵɵinject(token, flags = InjectFlags.Default) {
|
805 | return (_injectImplementation || injectInjectorOnly)(resolveForwardRef(token), flags);
|
806 | }
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 | function ɵɵinvalidFactoryDep(index) {
|
820 | const msg = ngDevMode ?
|
821 | `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
|
822 | This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
|
823 |
|
824 | Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.` :
|
825 | 'invalid';
|
826 | throw new Error(msg);
|
827 | }
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 |
|
852 | const inject = ɵɵinject;
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 | function injectRootLimpMode(token, notFoundValue, flags) {
|
861 | const injectableDef = getInjectableDef(token);
|
862 | if (injectableDef && injectableDef.providedIn == 'root') {
|
863 | return injectableDef.value === undefined ? injectableDef.value = injectableDef.factory() :
|
864 | injectableDef.value;
|
865 | }
|
866 | if (flags & InjectFlags.Optional)
|
867 | return null;
|
868 | if (notFoundValue !== undefined)
|
869 | return notFoundValue;
|
870 | throw new Error(`Injector: NOT_FOUND [${stringify(token)}]`);
|
871 | }
|
872 | function injectArgs(types) {
|
873 | const args = [];
|
874 | for (let i = 0; i < types.length; i++) {
|
875 | const arg = resolveForwardRef(types[i]);
|
876 | if (Array.isArray(arg)) {
|
877 | if (arg.length === 0) {
|
878 | throw new Error('Arguments array must have arguments.');
|
879 | }
|
880 | let type = undefined;
|
881 | let flags = InjectFlags.Default;
|
882 | for (let j = 0; j < arg.length; j++) {
|
883 | const meta = arg[j];
|
884 | if (meta instanceof Optional || meta.ngMetadataName === 'Optional' || meta === Optional) {
|
885 | flags |= InjectFlags.Optional;
|
886 | }
|
887 | else if (meta instanceof SkipSelf || meta.ngMetadataName === 'SkipSelf' || meta === SkipSelf) {
|
888 | flags |= InjectFlags.SkipSelf;
|
889 | }
|
890 | else if (meta instanceof Self || meta.ngMetadataName === 'Self' || meta === Self) {
|
891 | flags |= InjectFlags.Self;
|
892 | }
|
893 | else if (meta instanceof Inject || meta === Inject) {
|
894 | type = meta.token;
|
895 | }
|
896 | else {
|
897 | type = meta;
|
898 | }
|
899 | }
|
900 | args.push(ɵɵinject(type, flags));
|
901 | }
|
902 | else {
|
903 | args.push(ɵɵinject(arg));
|
904 | }
|
905 | }
|
906 | return args;
|
907 | }
|
908 | class NullInjector {
|
909 | get(token, notFoundValue = THROW_IF_NOT_FOUND) {
|
910 | if (notFoundValue === THROW_IF_NOT_FOUND) {
|
911 |
|
912 |
|
913 |
|
914 |
|
915 | const error = new Error(`NullInjectorError: No provider for ${stringify(token)}!`);
|
916 | error.name = 'NullInjectorError';
|
917 | throw error;
|
918 | }
|
919 | return notFoundValue;
|
920 | }
|
921 | }
|
922 | function catchInjectorError(e, token, injectorErrorName, source) {
|
923 | const tokenPath = e[NG_TEMP_TOKEN_PATH];
|
924 | if (token[SOURCE]) {
|
925 | tokenPath.unshift(token[SOURCE]);
|
926 | }
|
927 | e.message = formatError('\n' + e.message, tokenPath, injectorErrorName, source);
|
928 | e[NG_TOKEN_PATH] = tokenPath;
|
929 | e[NG_TEMP_TOKEN_PATH] = null;
|
930 | throw e;
|
931 | }
|
932 | function formatError(text, obj, injectorErrorName, source = null) {
|
933 | text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.substr(2) : text;
|
934 | let context = stringify(obj);
|
935 | if (Array.isArray(obj)) {
|
936 | context = obj.map(stringify).join(' -> ');
|
937 | }
|
938 | else if (typeof obj === 'object') {
|
939 | let parts = [];
|
940 | for (let key in obj) {
|
941 | if (obj.hasOwnProperty(key)) {
|
942 | let value = obj[key];
|
943 | parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));
|
944 | }
|
945 | }
|
946 | context = `{${parts.join(', ')}}`;
|
947 | }
|
948 | return `${injectorErrorName}${source ? '(' + source + ')' : ''}[${context}]: ${text.replace(NEW_LINE, '\n ')}`;
|
949 | }
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 | const angularCoreDiEnv = {
|
964 | 'ɵɵdefineInjectable': ɵɵdefineInjectable,
|
965 | 'ɵɵdefineInjector': ɵɵdefineInjector,
|
966 | 'ɵɵinject': ɵɵinject,
|
967 | 'ɵɵgetFactoryOf': getFactoryOf,
|
968 | 'ɵɵinvalidFactoryDep': ɵɵinvalidFactoryDep,
|
969 | };
|
970 | function getFactoryOf(type) {
|
971 | const typeAny = type;
|
972 | if (isForwardRef(type)) {
|
973 | return (() => {
|
974 | const factory = getFactoryOf(resolveForwardRef(typeAny));
|
975 | return factory ? factory() : null;
|
976 | });
|
977 | }
|
978 | const def = getInjectableDef(typeAny) || getInjectorDef(typeAny);
|
979 | if (!def || def.factory === undefined) {
|
980 | return null;
|
981 | }
|
982 | return def.factory;
|
983 | }
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 | class NgModuleRef {
|
999 | }
|
1000 |
|
1001 |
|
1002 |
|
1003 | class NgModuleFactory {
|
1004 | }
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 | function assertNumber(actual, msg) {
|
1014 | if (!(typeof actual === 'number')) {
|
1015 | throwError(msg, typeof actual, 'number', '===');
|
1016 | }
|
1017 | }
|
1018 | function assertNumberInRange(actual, minInclusive, maxInclusive) {
|
1019 | assertNumber(actual, 'Expected a number');
|
1020 | assertLessThanOrEqual(actual, maxInclusive, 'Expected number to be less than or equal to');
|
1021 | assertGreaterThanOrEqual(actual, minInclusive, 'Expected number to be greater than or equal to');
|
1022 | }
|
1023 | function assertString(actual, msg) {
|
1024 | if (!(typeof actual === 'string')) {
|
1025 | throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
|
1026 | }
|
1027 | }
|
1028 | function assertEqual(actual, expected, msg) {
|
1029 | if (!(actual == expected)) {
|
1030 | throwError(msg, actual, expected, '==');
|
1031 | }
|
1032 | }
|
1033 | function assertNotEqual(actual, expected, msg) {
|
1034 | if (!(actual != expected)) {
|
1035 | throwError(msg, actual, expected, '!=');
|
1036 | }
|
1037 | }
|
1038 | function assertSame(actual, expected, msg) {
|
1039 | if (!(actual === expected)) {
|
1040 | throwError(msg, actual, expected, '===');
|
1041 | }
|
1042 | }
|
1043 | function assertNotSame(actual, expected, msg) {
|
1044 | if (!(actual !== expected)) {
|
1045 | throwError(msg, actual, expected, '!==');
|
1046 | }
|
1047 | }
|
1048 | function assertLessThan(actual, expected, msg) {
|
1049 | if (!(actual < expected)) {
|
1050 | throwError(msg, actual, expected, '<');
|
1051 | }
|
1052 | }
|
1053 | function assertLessThanOrEqual(actual, expected, msg) {
|
1054 | if (!(actual <= expected)) {
|
1055 | throwError(msg, actual, expected, '<=');
|
1056 | }
|
1057 | }
|
1058 | function assertGreaterThan(actual, expected, msg) {
|
1059 | if (!(actual > expected)) {
|
1060 | throwError(msg, actual, expected, '>');
|
1061 | }
|
1062 | }
|
1063 | function assertGreaterThanOrEqual(actual, expected, msg) {
|
1064 | if (!(actual >= expected)) {
|
1065 | throwError(msg, actual, expected, '>=');
|
1066 | }
|
1067 | }
|
1068 | function assertNotDefined(actual, msg) {
|
1069 | if (actual != null) {
|
1070 | throwError(msg, actual, null, '==');
|
1071 | }
|
1072 | }
|
1073 | function assertDefined(actual, msg) {
|
1074 | if (actual == null) {
|
1075 | throwError(msg, actual, null, '!=');
|
1076 | }
|
1077 | }
|
1078 | function throwError(msg, actual, expected, comparison) {
|
1079 | throw new Error(`ASSERTION ERROR: ${msg}` +
|
1080 | (comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));
|
1081 | }
|
1082 | function assertDomNode(node) {
|
1083 |
|
1084 | assertEqual((typeof Node !== 'undefined' && node instanceof Node) ||
|
1085 | (typeof node === 'object' && node != null &&
|
1086 | node.constructor.name === 'WebWorkerRenderNode'), true, `The provided value must be an instance of a DOM Node but got ${stringify(node)}`);
|
1087 | }
|
1088 | function assertIndexInRange(arr, index) {
|
1089 | const maxLen = arr ? arr.length : 0;
|
1090 | assertLessThan(index, maxLen, `Index expected to be less than ${maxLen} but got ${index}`);
|
1091 | }
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 | function addAllToArray(items, arr) {
|
1107 | for (let i = 0; i < items.length; i++) {
|
1108 | arr.push(items[i]);
|
1109 | }
|
1110 | }
|
1111 |
|
1112 |
|
1113 |
|
1114 | function flatten(list, dst) {
|
1115 | if (dst === undefined)
|
1116 | dst = list;
|
1117 | for (let i = 0; i < list.length; i++) {
|
1118 | let item = list[i];
|
1119 | if (Array.isArray(item)) {
|
1120 |
|
1121 | if (dst === list) {
|
1122 |
|
1123 |
|
1124 | dst = list.slice(0, i);
|
1125 | }
|
1126 | flatten(item, dst);
|
1127 | }
|
1128 | else if (dst !== list) {
|
1129 | dst.push(item);
|
1130 | }
|
1131 | }
|
1132 | return dst;
|
1133 | }
|
1134 | function deepForEach(input, fn) {
|
1135 | input.forEach(value => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
|
1136 | }
|
1137 | function addToArray(arr, index, value) {
|
1138 |
|
1139 | if (index >= arr.length) {
|
1140 | arr.push(value);
|
1141 | }
|
1142 | else {
|
1143 | arr.splice(index, 0, value);
|
1144 | }
|
1145 | }
|
1146 | function removeFromArray(arr, index) {
|
1147 |
|
1148 | if (index >= arr.length - 1) {
|
1149 | return arr.pop();
|
1150 | }
|
1151 | else {
|
1152 | return arr.splice(index, 1)[0];
|
1153 | }
|
1154 | }
|
1155 | function newArray(size, value) {
|
1156 | const list = [];
|
1157 | for (let i = 0; i < size; i++) {
|
1158 | list.push(value);
|
1159 | }
|
1160 | return list;
|
1161 | }
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 | function arraySplice(array, index, count) {
|
1176 | const length = array.length - count;
|
1177 | while (index < length) {
|
1178 | array[index] = array[index + count];
|
1179 | index++;
|
1180 | }
|
1181 | while (count--) {
|
1182 | array.pop();
|
1183 | }
|
1184 | }
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 | function arrayInsert(array, index, value) {
|
1197 | ngDevMode && assertLessThanOrEqual(index, array.length, 'Can\'t insert past array end.');
|
1198 | let end = array.length;
|
1199 | while (end > index) {
|
1200 | const previousEnd = end - 1;
|
1201 | array[end] = array[previousEnd];
|
1202 | end = previousEnd;
|
1203 | }
|
1204 | array[index] = value;
|
1205 | }
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 | function arrayInsert2(array, index, value1, value2) {
|
1219 | ngDevMode && assertLessThanOrEqual(index, array.length, 'Can\'t insert past array end.');
|
1220 | let end = array.length;
|
1221 | if (end == index) {
|
1222 |
|
1223 | array.push(value1, value2);
|
1224 | }
|
1225 | else if (end === 1) {
|
1226 |
|
1227 | array.push(value2, array[0]);
|
1228 | array[0] = value1;
|
1229 | }
|
1230 | else {
|
1231 | end--;
|
1232 | array.push(array[end - 1], array[end]);
|
1233 | while (end > index) {
|
1234 | const previousEnd = end - 2;
|
1235 | array[end] = array[previousEnd];
|
1236 | end--;
|
1237 | }
|
1238 | array[index] = value1;
|
1239 | array[index + 1] = value2;
|
1240 | }
|
1241 | }
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 | function arrayInsertSorted(array, value) {
|
1254 | let index = arrayIndexOfSorted(array, value);
|
1255 | if (index < 0) {
|
1256 |
|
1257 | index = ~index;
|
1258 | arrayInsert(array, index, value);
|
1259 | }
|
1260 | return index;
|
1261 | }
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 | function arrayRemoveSorted(array, value) {
|
1276 | const index = arrayIndexOfSorted(array, value);
|
1277 | if (index >= 0) {
|
1278 | arraySplice(array, index, 1);
|
1279 | }
|
1280 | return index;
|
1281 | }
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 | function arrayIndexOfSorted(array, value) {
|
1296 | return _arrayIndexOfSorted(array, value, 0);
|
1297 | }
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 | function keyValueArraySet(keyValueArray, key, value) {
|
1307 | let index = keyValueArrayIndexOf(keyValueArray, key);
|
1308 | if (index >= 0) {
|
1309 |
|
1310 | keyValueArray[index | 1] = value;
|
1311 | }
|
1312 | else {
|
1313 | index = ~index;
|
1314 | arrayInsert2(keyValueArray, index, key, value);
|
1315 | }
|
1316 | return index;
|
1317 | }
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 | function keyValueArrayGet(keyValueArray, key) {
|
1326 | const index = keyValueArrayIndexOf(keyValueArray, key);
|
1327 | if (index >= 0) {
|
1328 |
|
1329 | return keyValueArray[index | 1];
|
1330 | }
|
1331 | return undefined;
|
1332 | }
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 | function keyValueArrayIndexOf(keyValueArray, key) {
|
1344 | return _arrayIndexOfSorted(keyValueArray, key, 1);
|
1345 | }
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 | function keyValueArrayDelete(keyValueArray, key) {
|
1357 | const index = keyValueArrayIndexOf(keyValueArray, key);
|
1358 | if (index >= 0) {
|
1359 |
|
1360 | arraySplice(keyValueArray, index, 2);
|
1361 | }
|
1362 | return index;
|
1363 | }
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 | function _arrayIndexOfSorted(array, value, shift) {
|
1382 | ngDevMode && assertEqual(Array.isArray(array), true, 'Expecting an array');
|
1383 | let start = 0;
|
1384 | let end = array.length >> shift;
|
1385 | while (end !== start) {
|
1386 | const middle = start + ((end - start) >> 1);
|
1387 | const current = array[middle << shift];
|
1388 | if (value === current) {
|
1389 | return (middle << shift);
|
1390 | }
|
1391 | else if (current > value) {
|
1392 | end = middle;
|
1393 | }
|
1394 | else {
|
1395 | start = middle + 1;
|
1396 | }
|
1397 | }
|
1398 | return ~(end << shift);
|
1399 | }
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 | var ChangeDetectionStrategy;
|
1417 | (function (ChangeDetectionStrategy) {
|
1418 | |
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 | ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
|
1425 | |
1426 |
|
1427 |
|
1428 |
|
1429 | ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
|
1430 | })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 | var ChangeDetectorStatus;
|
1436 | (function (ChangeDetectorStatus) {
|
1437 | |
1438 |
|
1439 |
|
1440 |
|
1441 | ChangeDetectorStatus[ChangeDetectorStatus["CheckOnce"] = 0] = "CheckOnce";
|
1442 | |
1443 |
|
1444 |
|
1445 |
|
1446 | ChangeDetectorStatus[ChangeDetectorStatus["Checked"] = 1] = "Checked";
|
1447 | |
1448 |
|
1449 |
|
1450 |
|
1451 | ChangeDetectorStatus[ChangeDetectorStatus["CheckAlways"] = 2] = "CheckAlways";
|
1452 | |
1453 |
|
1454 |
|
1455 |
|
1456 | ChangeDetectorStatus[ChangeDetectorStatus["Detached"] = 3] = "Detached";
|
1457 | |
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 | ChangeDetectorStatus[ChangeDetectorStatus["Errored"] = 4] = "Errored";
|
1463 | |
1464 |
|
1465 |
|
1466 | ChangeDetectorStatus[ChangeDetectorStatus["Destroyed"] = 5] = "Destroyed";
|
1467 | })(ChangeDetectorStatus || (ChangeDetectorStatus = {}));
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 | function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
|
1476 | return changeDetectionStrategy == null ||
|
1477 | changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
1478 | }
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 | var ViewEncapsulation$1;
|
1500 | (function (ViewEncapsulation) {
|
1501 | |
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 | ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
|
1510 | |
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 | ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native";
|
1519 | |
1520 |
|
1521 |
|
1522 | ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
|
1523 | |
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 | ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
|
1531 | })(ViewEncapsulation$1 || (ViewEncapsulation$1 = {}));
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 | const EMPTY_OBJ = {};
|
1547 | const EMPTY_ARRAY = [];
|
1548 |
|
1549 | if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
|
1550 |
|
1551 |
|
1552 |
|
1553 | Object.freeze(EMPTY_OBJ);
|
1554 |
|
1555 | Object.freeze(EMPTY_ARRAY);
|
1556 | }
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 | let _renderCompCount = 0;
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 | function ɵɵdefineComponent(componentDefinition) {
|
1583 | return noSideEffects(() => {
|
1584 |
|
1585 |
|
1586 | (typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();
|
1587 | const type = componentDefinition.type;
|
1588 | const typePrototype = type.prototype;
|
1589 | const declaredInputs = {};
|
1590 | const def = {
|
1591 | type: type,
|
1592 | providersResolver: null,
|
1593 | decls: componentDefinition.decls,
|
1594 | vars: componentDefinition.vars,
|
1595 | factory: null,
|
1596 | template: componentDefinition.template || null,
|
1597 | consts: componentDefinition.consts || null,
|
1598 | ngContentSelectors: componentDefinition.ngContentSelectors,
|
1599 | hostBindings: componentDefinition.hostBindings || null,
|
1600 | hostVars: componentDefinition.hostVars || 0,
|
1601 | hostAttrs: componentDefinition.hostAttrs || null,
|
1602 | contentQueries: componentDefinition.contentQueries || null,
|
1603 | declaredInputs: declaredInputs,
|
1604 | inputs: null,
|
1605 | outputs: null,
|
1606 | exportAs: componentDefinition.exportAs || null,
|
1607 | onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
|
1608 | directiveDefs: null,
|
1609 | pipeDefs: null,
|
1610 | selectors: componentDefinition.selectors || EMPTY_ARRAY,
|
1611 | viewQuery: componentDefinition.viewQuery || null,
|
1612 | features: componentDefinition.features || null,
|
1613 | data: componentDefinition.data || {},
|
1614 |
|
1615 |
|
1616 | encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,
|
1617 | id: 'c',
|
1618 | styles: componentDefinition.styles || EMPTY_ARRAY,
|
1619 | _: null,
|
1620 | setInput: null,
|
1621 | schemas: componentDefinition.schemas || null,
|
1622 | tView: null,
|
1623 | };
|
1624 | const directiveTypes = componentDefinition.directives;
|
1625 | const feature = componentDefinition.features;
|
1626 | const pipeTypes = componentDefinition.pipes;
|
1627 | def.id += _renderCompCount++;
|
1628 | def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
|
1629 | def.outputs = invertObject(componentDefinition.outputs),
|
1630 | feature && feature.forEach((fn) => fn(def));
|
1631 | def.directiveDefs = directiveTypes ?
|
1632 | () => (typeof directiveTypes === 'function' ? directiveTypes() : directiveTypes)
|
1633 | .map(extractDirectiveDef) :
|
1634 | null;
|
1635 | def.pipeDefs = pipeTypes ?
|
1636 | () => (typeof pipeTypes === 'function' ? pipeTypes() : pipeTypes).map(extractPipeDef) :
|
1637 | null;
|
1638 | return def;
|
1639 | });
|
1640 | }
|
1641 |
|
1642 |
|
1643 |
|
1644 | function ɵɵsetComponentScope(type, directives, pipes) {
|
1645 | const def = type.ɵcmp;
|
1646 | def.directiveDefs = () => directives.map(extractDirectiveDef);
|
1647 | def.pipeDefs = () => pipes.map(extractPipeDef);
|
1648 | }
|
1649 | function extractDirectiveDef(type) {
|
1650 | const def = getComponentDef(type) || getDirectiveDef(type);
|
1651 | if (ngDevMode && !def) {
|
1652 | throw new Error(`'${type.name}' is neither 'ComponentType' or 'DirectiveType'.`);
|
1653 | }
|
1654 | return def;
|
1655 | }
|
1656 | function extractPipeDef(type) {
|
1657 | const def = getPipeDef(type);
|
1658 | if (ngDevMode && !def) {
|
1659 | throw new Error(`'${type.name}' is not a 'PipeType'.`);
|
1660 | }
|
1661 | return def;
|
1662 | }
|
1663 | const autoRegisterModuleById = {};
|
1664 |
|
1665 |
|
1666 |
|
1667 | function ɵɵdefineNgModule(def) {
|
1668 | const res = {
|
1669 | type: def.type,
|
1670 | bootstrap: def.bootstrap || EMPTY_ARRAY,
|
1671 | declarations: def.declarations || EMPTY_ARRAY,
|
1672 | imports: def.imports || EMPTY_ARRAY,
|
1673 | exports: def.exports || EMPTY_ARRAY,
|
1674 | transitiveCompileScopes: null,
|
1675 | schemas: def.schemas || null,
|
1676 | id: def.id || null,
|
1677 | };
|
1678 | if (def.id != null) {
|
1679 | noSideEffects(() => {
|
1680 | autoRegisterModuleById[def.id] = def.type;
|
1681 | });
|
1682 | }
|
1683 | return res;
|
1684 | }
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 | function ɵɵsetNgModuleScope(type, scope) {
|
1696 | return noSideEffects(() => {
|
1697 | const ngModuleDef = getNgModuleDef(type, true);
|
1698 | ngModuleDef.declarations = scope.declarations || EMPTY_ARRAY;
|
1699 | ngModuleDef.imports = scope.imports || EMPTY_ARRAY;
|
1700 | ngModuleDef.exports = scope.exports || EMPTY_ARRAY;
|
1701 | });
|
1702 | }
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 | function invertObject(obj, secondary) {
|
1759 | if (obj == null)
|
1760 | return EMPTY_OBJ;
|
1761 | const newLookup = {};
|
1762 | for (const minifiedKey in obj) {
|
1763 | if (obj.hasOwnProperty(minifiedKey)) {
|
1764 | let publicName = obj[minifiedKey];
|
1765 | let declaredName = publicName;
|
1766 | if (Array.isArray(publicName)) {
|
1767 | declaredName = publicName[1];
|
1768 | publicName = publicName[0];
|
1769 | }
|
1770 | newLookup[publicName] = minifiedKey;
|
1771 | if (secondary) {
|
1772 | (secondary[publicName] = declaredName);
|
1773 | }
|
1774 | }
|
1775 | }
|
1776 | return newLookup;
|
1777 | }
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 | const ɵɵdefineDirective = ɵɵdefineComponent;
|
1795 |
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 | function ɵɵdefinePipe(pipeDef) {
|
1812 | return {
|
1813 | type: pipeDef.type,
|
1814 | name: pipeDef.name,
|
1815 | factory: null,
|
1816 | pure: pipeDef.pure !== false,
|
1817 | onDestroy: pipeDef.type.prototype.ngOnDestroy || null
|
1818 | };
|
1819 | }
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 | function getComponentDef(type) {
|
1826 | return type[NG_COMP_DEF] || null;
|
1827 | }
|
1828 | function getDirectiveDef(type) {
|
1829 | return type[NG_DIR_DEF] || null;
|
1830 | }
|
1831 | function getPipeDef(type) {
|
1832 | return type[NG_PIPE_DEF] || null;
|
1833 | }
|
1834 | function getFactoryDef(type, throwNotFound) {
|
1835 | const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF);
|
1836 | if (!hasFactoryDef && throwNotFound === true && ngDevMode) {
|
1837 | throw new Error(`Type ${stringify(type)} does not have 'ɵfac' property.`);
|
1838 | }
|
1839 | return hasFactoryDef ? type[NG_FACTORY_DEF] : null;
|
1840 | }
|
1841 | function getNgModuleDef(type, throwNotFound) {
|
1842 | const ngModuleDef = type[NG_MOD_DEF] || null;
|
1843 | if (!ngModuleDef && throwNotFound === true) {
|
1844 | throw new Error(`Type ${stringify(type)} does not have 'ɵmod' property.`);
|
1845 | }
|
1846 | return ngModuleDef;
|
1847 | }
|
1848 | function getNgLocaleIdDef(type) {
|
1849 | return type[NG_LOC_ID_DEF] || null;
|
1850 | }
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 | const HOST = 0;
|
1863 | const TVIEW = 1;
|
1864 | const FLAGS = 2;
|
1865 | const PARENT = 3;
|
1866 | const NEXT = 4;
|
1867 | const TRANSPLANTED_VIEWS_TO_REFRESH = 5;
|
1868 | const T_HOST = 6;
|
1869 | const CLEANUP = 7;
|
1870 | const CONTEXT = 8;
|
1871 | const INJECTOR$1 = 9;
|
1872 | const RENDERER_FACTORY = 10;
|
1873 | const RENDERER = 11;
|
1874 | const SANITIZER = 12;
|
1875 | const CHILD_HEAD = 13;
|
1876 | const CHILD_TAIL = 14;
|
1877 | const DECLARATION_VIEW = 15;
|
1878 | const DECLARATION_COMPONENT_VIEW = 16;
|
1879 | const DECLARATION_LCONTAINER = 17;
|
1880 | const PREORDER_HOOK_FLAGS = 18;
|
1881 | const QUERIES = 19;
|
1882 |
|
1883 | const HEADER_OFFSET = 20;
|
1884 |
|
1885 |
|
1886 | const unusedValueExportToPlacateAjd = 1;
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 | const TYPE = 1;
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 | const HAS_TRANSPLANTED_VIEWS = 2;
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 | const NATIVE = 7;
|
1920 | const VIEW_REFS = 8;
|
1921 | const MOVED_VIEWS = 9;
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 | const CONTAINER_HEADER_OFFSET = 10;
|
1929 |
|
1930 |
|
1931 | const unusedValueExportToPlacateAjd$1 = 1;
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 | function isLView(value) {
|
1945 | return Array.isArray(value) && typeof value[TYPE] === 'object';
|
1946 | }
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 | function isLContainer(value) {
|
1952 | return Array.isArray(value) && value[TYPE] === true;
|
1953 | }
|
1954 | function isContentQueryHost(tNode) {
|
1955 | return (tNode.flags & 8 ) !== 0;
|
1956 | }
|
1957 | function isComponentHost(tNode) {
|
1958 | return (tNode.flags & 2 ) === 2 ;
|
1959 | }
|
1960 | function isDirectiveHost(tNode) {
|
1961 | return (tNode.flags & 1 ) === 1 ;
|
1962 | }
|
1963 | function isComponentDef(def) {
|
1964 | return def.template !== null;
|
1965 | }
|
1966 | function isRootView(target) {
|
1967 | return (target[FLAGS] & 512 ) !== 0;
|
1968 | }
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 |
|
1978 |
|
1979 | function assertTNodeForLView(tNode, lView) {
|
1980 | tNode.hasOwnProperty('tView_') &&
|
1981 | assertEqual(tNode.tView_, lView[TVIEW], 'This TNode does not belong to this LView.');
|
1982 | }
|
1983 | function assertComponentType(actual, msg = 'Type passed in is not ComponentType, it does not have \'ɵcmp\' property.') {
|
1984 | if (!getComponentDef(actual)) {
|
1985 | throwError(msg);
|
1986 | }
|
1987 | }
|
1988 | function assertNgModuleType(actual, msg = 'Type passed in is not NgModuleType, it does not have \'ɵmod\' property.') {
|
1989 | if (!getNgModuleDef(actual)) {
|
1990 | throwError(msg);
|
1991 | }
|
1992 | }
|
1993 | function assertPreviousIsParent(isParent) {
|
1994 | assertEqual(isParent, true, 'previousOrParentTNode should be a parent');
|
1995 | }
|
1996 | function assertHasParent(tNode) {
|
1997 | assertDefined(tNode, 'previousOrParentTNode should exist!');
|
1998 | assertDefined(tNode.parent, 'previousOrParentTNode should have a parent');
|
1999 | }
|
2000 | function assertDataNext(lView, index, arr) {
|
2001 | if (arr == null)
|
2002 | arr = lView;
|
2003 | assertEqual(arr.length, index, `index ${index} expected to be at the end of arr (length ${arr.length})`);
|
2004 | }
|
2005 | function assertLContainer(value) {
|
2006 | assertDefined(value, 'LContainer must be defined');
|
2007 | assertEqual(isLContainer(value), true, 'Expecting LContainer');
|
2008 | }
|
2009 | function assertLViewOrUndefined(value) {
|
2010 | value && assertEqual(isLView(value), true, 'Expecting LView or undefined or null');
|
2011 | }
|
2012 | function assertLView(value) {
|
2013 | assertDefined(value, 'LView must be defined');
|
2014 | assertEqual(isLView(value), true, 'Expecting LView');
|
2015 | }
|
2016 | function assertFirstCreatePass(tView, errMessage) {
|
2017 | assertEqual(tView.firstCreatePass, true, errMessage || 'Should only be called in first create pass.');
|
2018 | }
|
2019 | function assertFirstUpdatePass(tView, errMessage) {
|
2020 | assertEqual(tView.firstUpdatePass, true, errMessage || 'Should only be called in first update pass.');
|
2021 | }
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 | function assertDirectiveDef(obj) {
|
2027 | if (obj.type === undefined || obj.selectors == undefined || obj.inputs === undefined) {
|
2028 | throwError(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);
|
2029 | }
|
2030 | }
|
2031 |
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 | class SimpleChange {
|
2049 | constructor(previousValue, currentValue, firstChange) {
|
2050 | this.previousValue = previousValue;
|
2051 | this.currentValue = currentValue;
|
2052 | this.firstChange = firstChange;
|
2053 | }
|
2054 | |
2055 |
|
2056 |
|
2057 | isFirstChange() {
|
2058 | return this.firstChange;
|
2059 | }
|
2060 | }
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 | function ɵɵNgOnChangesFeature() {
|
2092 | return NgOnChangesFeatureImpl;
|
2093 | }
|
2094 | function NgOnChangesFeatureImpl(definition) {
|
2095 | if (definition.type.prototype.ngOnChanges) {
|
2096 | definition.setInput = ngOnChangesSetInput;
|
2097 | }
|
2098 | return rememberChangeHistoryAndInvokeOnChangesHook;
|
2099 | }
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 | ɵɵNgOnChangesFeature.ngInherit = true;
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 | function rememberChangeHistoryAndInvokeOnChangesHook() {
|
2116 | const simpleChangesStore = getSimpleChangesStore(this);
|
2117 | const current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;
|
2118 | if (current) {
|
2119 | const previous = simpleChangesStore.previous;
|
2120 | if (previous === EMPTY_OBJ) {
|
2121 | simpleChangesStore.previous = current;
|
2122 | }
|
2123 | else {
|
2124 |
|
2125 |
|
2126 | for (let key in current) {
|
2127 | previous[key] = current[key];
|
2128 | }
|
2129 | }
|
2130 | simpleChangesStore.current = null;
|
2131 | this.ngOnChanges(current);
|
2132 | }
|
2133 | }
|
2134 | function ngOnChangesSetInput(instance, value, publicName, privateName) {
|
2135 | const simpleChangesStore = getSimpleChangesStore(instance) ||
|
2136 | setSimpleChangesStore(instance, { previous: EMPTY_OBJ, current: null });
|
2137 | const current = simpleChangesStore.current || (simpleChangesStore.current = {});
|
2138 | const previous = simpleChangesStore.previous;
|
2139 | const declaredName = this.declaredInputs[publicName];
|
2140 | const previousChange = previous[declaredName];
|
2141 | current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ);
|
2142 | instance[privateName] = value;
|
2143 | }
|
2144 | const SIMPLE_CHANGES_STORE = '__ngSimpleChanges__';
|
2145 | function getSimpleChangesStore(instance) {
|
2146 | return instance[SIMPLE_CHANGES_STORE] || null;
|
2147 | }
|
2148 | function setSimpleChangesStore(instance, store) {
|
2149 | return instance[SIMPLE_CHANGES_STORE] = store;
|
2150 | }
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 | const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
2160 | const MATH_ML_NAMESPACE = 'http://www.w3.org/1998/MathML/';
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 | const MONKEY_PATCH_KEY_NAME = '__ngContext__';
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 | let DOCUMENT = undefined;
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 | function setDocument(document) {
|
2206 | DOCUMENT = document;
|
2207 | }
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 | function getDocument() {
|
2215 | if (DOCUMENT !== undefined) {
|
2216 | return DOCUMENT;
|
2217 | }
|
2218 | else if (typeof document !== 'undefined') {
|
2219 | return document;
|
2220 | }
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 | return undefined;
|
2227 | }
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 | var RendererStyleFlags3;
|
2238 | (function (RendererStyleFlags3) {
|
2239 | RendererStyleFlags3[RendererStyleFlags3["Important"] = 1] = "Important";
|
2240 | RendererStyleFlags3[RendererStyleFlags3["DashCase"] = 2] = "DashCase";
|
2241 | })(RendererStyleFlags3 || (RendererStyleFlags3 = {}));
|
2242 |
|
2243 | function isProceduralRenderer(renderer) {
|
2244 | return !!(renderer.listen);
|
2245 | }
|
2246 | const ɵ0$2 = (hostElement, rendererType) => {
|
2247 | return getDocument();
|
2248 | };
|
2249 | const domRendererFactory3 = {
|
2250 | createRenderer: ɵ0$2
|
2251 | };
|
2252 |
|
2253 |
|
2254 | const unusedValueExportToPlacateAjd$2 = 1;
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 |
|
2283 | function unwrapRNode(value) {
|
2284 | while (Array.isArray(value)) {
|
2285 | value = value[HOST];
|
2286 | }
|
2287 | return value;
|
2288 | }
|
2289 |
|
2290 |
|
2291 |
|
2292 |
|
2293 | function unwrapLView(value) {
|
2294 | while (Array.isArray(value)) {
|
2295 |
|
2296 |
|
2297 | if (typeof value[TYPE] === 'object')
|
2298 | return value;
|
2299 | value = value[HOST];
|
2300 | }
|
2301 | return null;
|
2302 | }
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 | function unwrapLContainer(value) {
|
2308 | while (Array.isArray(value)) {
|
2309 |
|
2310 |
|
2311 | if (value[TYPE] === true)
|
2312 | return value;
|
2313 | value = value[HOST];
|
2314 | }
|
2315 | return null;
|
2316 | }
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 | function getNativeByIndex(index, lView) {
|
2322 | return unwrapRNode(lView[index + HEADER_OFFSET]);
|
2323 | }
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 | function getNativeByTNode(tNode, lView) {
|
2333 | ngDevMode && assertTNodeForLView(tNode, lView);
|
2334 | ngDevMode && assertIndexInRange(lView, tNode.index);
|
2335 | const node = unwrapRNode(lView[tNode.index]);
|
2336 | ngDevMode && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
|
2337 | return node;
|
2338 | }
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 | function getNativeByTNodeOrNull(tNode, lView) {
|
2348 | const index = tNode.index;
|
2349 | if (index !== -1) {
|
2350 | ngDevMode && assertTNodeForLView(tNode, lView);
|
2351 | const node = unwrapRNode(lView[index]);
|
2352 | ngDevMode && node !== null && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
|
2353 | return node;
|
2354 | }
|
2355 | return null;
|
2356 | }
|
2357 | function getTNode(tView, index) {
|
2358 | ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');
|
2359 | ngDevMode && assertLessThan(index, tView.data.length, 'wrong index for TNode');
|
2360 | return tView.data[index + HEADER_OFFSET];
|
2361 | }
|
2362 |
|
2363 | function load(view, index) {
|
2364 | ngDevMode && assertIndexInRange(view, index + HEADER_OFFSET);
|
2365 | return view[index + HEADER_OFFSET];
|
2366 | }
|
2367 | function getComponentLViewByIndex(nodeIndex, hostView) {
|
2368 |
|
2369 | ngDevMode && assertIndexInRange(hostView, nodeIndex);
|
2370 | const slotValue = hostView[nodeIndex];
|
2371 | const lView = isLView(slotValue) ? slotValue : slotValue[HOST];
|
2372 | return lView;
|
2373 | }
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 | function readPatchedData(target) {
|
2379 | ngDevMode && assertDefined(target, 'Target expected');
|
2380 | return target[MONKEY_PATCH_KEY_NAME] || null;
|
2381 | }
|
2382 | function readPatchedLView(target) {
|
2383 | const value = readPatchedData(target);
|
2384 | if (value) {
|
2385 | return Array.isArray(value) ? value : value.lView;
|
2386 | }
|
2387 | return null;
|
2388 | }
|
2389 |
|
2390 | function isCreationMode(view) {
|
2391 | return (view[FLAGS] & 4 ) === 4 ;
|
2392 | }
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 | function viewAttachedToChangeDetector(view) {
|
2400 | return (view[FLAGS] & 128 ) === 128 ;
|
2401 | }
|
2402 |
|
2403 | function viewAttachedToContainer(view) {
|
2404 | return isLContainer(view[PARENT]);
|
2405 | }
|
2406 |
|
2407 | function getConstant(consts, index) {
|
2408 | return consts === null || index == null ? null : consts[index];
|
2409 | }
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 | function resetPreOrderHookFlags(lView) {
|
2415 | lView[PREORDER_HOOK_FLAGS] = 0;
|
2416 | }
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 | function updateTransplantedViewCount(lContainer, amount) {
|
2425 | lContainer[TRANSPLANTED_VIEWS_TO_REFRESH] += amount;
|
2426 | let viewOrContainer = lContainer;
|
2427 | let parent = lContainer[PARENT];
|
2428 | while (parent !== null &&
|
2429 | ((amount === 1 && viewOrContainer[TRANSPLANTED_VIEWS_TO_REFRESH] === 1) ||
|
2430 | (amount === -1 && viewOrContainer[TRANSPLANTED_VIEWS_TO_REFRESH] === 0))) {
|
2431 | parent[TRANSPLANTED_VIEWS_TO_REFRESH] += amount;
|
2432 | viewOrContainer = parent;
|
2433 | parent = parent[PARENT];
|
2434 | }
|
2435 | }
|
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 | const instructionState = {
|
2445 | lFrame: createLFrame(null),
|
2446 | bindingsEnabled: true,
|
2447 | checkNoChangesMode: false,
|
2448 | };
|
2449 | function getElementDepthCount() {
|
2450 | return instructionState.lFrame.elementDepthCount;
|
2451 | }
|
2452 | function increaseElementDepthCount() {
|
2453 | instructionState.lFrame.elementDepthCount++;
|
2454 | }
|
2455 | function decreaseElementDepthCount() {
|
2456 | instructionState.lFrame.elementDepthCount--;
|
2457 | }
|
2458 | function getBindingsEnabled() {
|
2459 | return instructionState.bindingsEnabled;
|
2460 | }
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 | function ɵɵenableBindings() {
|
2481 | instructionState.bindingsEnabled = true;
|
2482 | }
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 | function ɵɵdisableBindings() {
|
2503 | instructionState.bindingsEnabled = false;
|
2504 | }
|
2505 |
|
2506 |
|
2507 |
|
2508 | function getLView() {
|
2509 | return instructionState.lFrame.lView;
|
2510 | }
|
2511 |
|
2512 |
|
2513 |
|
2514 | function getTView() {
|
2515 | return instructionState.lFrame.tView;
|
2516 | }
|
2517 |
|
2518 |
|
2519 |
|
2520 |
|
2521 |
|
2522 |
|
2523 |
|
2524 |
|
2525 |
|
2526 |
|
2527 |
|
2528 | function ɵɵrestoreView(viewToRestore) {
|
2529 | instructionState.lFrame.contextLView = viewToRestore;
|
2530 | }
|
2531 | function getPreviousOrParentTNode() {
|
2532 | return instructionState.lFrame.previousOrParentTNode;
|
2533 | }
|
2534 | function setPreviousOrParentTNode(tNode, isParent) {
|
2535 | instructionState.lFrame.previousOrParentTNode = tNode;
|
2536 | instructionState.lFrame.isParent = isParent;
|
2537 | }
|
2538 | function getIsParent() {
|
2539 | return instructionState.lFrame.isParent;
|
2540 | }
|
2541 | function setIsNotParent() {
|
2542 | instructionState.lFrame.isParent = false;
|
2543 | }
|
2544 | function setIsParent() {
|
2545 | instructionState.lFrame.isParent = true;
|
2546 | }
|
2547 | function getContextLView() {
|
2548 | return instructionState.lFrame.contextLView;
|
2549 | }
|
2550 | function getCheckNoChangesMode() {
|
2551 |
|
2552 | return instructionState.checkNoChangesMode;
|
2553 | }
|
2554 | function setCheckNoChangesMode(mode) {
|
2555 | instructionState.checkNoChangesMode = mode;
|
2556 | }
|
2557 |
|
2558 | function getBindingRoot() {
|
2559 | const lFrame = instructionState.lFrame;
|
2560 | let index = lFrame.bindingRootIndex;
|
2561 | if (index === -1) {
|
2562 | index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex;
|
2563 | }
|
2564 | return index;
|
2565 | }
|
2566 | function getBindingIndex() {
|
2567 | return instructionState.lFrame.bindingIndex;
|
2568 | }
|
2569 | function setBindingIndex(value) {
|
2570 | return instructionState.lFrame.bindingIndex = value;
|
2571 | }
|
2572 | function nextBindingIndex() {
|
2573 | return instructionState.lFrame.bindingIndex++;
|
2574 | }
|
2575 | function incrementBindingIndex(count) {
|
2576 | const lFrame = instructionState.lFrame;
|
2577 | const index = lFrame.bindingIndex;
|
2578 | lFrame.bindingIndex = lFrame.bindingIndex + count;
|
2579 | return index;
|
2580 | }
|
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 | function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
|
2593 | const lFrame = instructionState.lFrame;
|
2594 | lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
|
2595 | setCurrentDirectiveIndex(currentDirectiveIndex);
|
2596 | }
|
2597 |
|
2598 |
|
2599 |
|
2600 |
|
2601 |
|
2602 | function getCurrentDirectiveIndex() {
|
2603 | return instructionState.lFrame.currentDirectiveIndex;
|
2604 | }
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 |
|
2610 | function setCurrentDirectiveIndex(currentDirectiveIndex) {
|
2611 | instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;
|
2612 | }
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 | function getCurrentDirectiveDef(tData) {
|
2620 | const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;
|
2621 | return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
|
2622 | }
|
2623 | function getCurrentQueryIndex() {
|
2624 | return instructionState.lFrame.currentQueryIndex;
|
2625 | }
|
2626 | function setCurrentQueryIndex(value) {
|
2627 | instructionState.lFrame.currentQueryIndex = value;
|
2628 | }
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 | function enterDI(newView, tNode) {
|
2635 | ngDevMode && assertLViewOrUndefined(newView);
|
2636 | const newLFrame = allocLFrame();
|
2637 | instructionState.lFrame = newLFrame;
|
2638 | newLFrame.previousOrParentTNode = tNode;
|
2639 | newLFrame.lView = newView;
|
2640 | }
|
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 | function enterView(newView, tNode) {
|
2654 | ngDevMode && assertLViewOrUndefined(newView);
|
2655 | const newLFrame = allocLFrame();
|
2656 | if (ngDevMode) {
|
2657 | assertEqual(newLFrame.isParent, true, 'Expected clean LFrame');
|
2658 | assertEqual(newLFrame.lView, null, 'Expected clean LFrame');
|
2659 | assertEqual(newLFrame.tView, null, 'Expected clean LFrame');
|
2660 | assertEqual(newLFrame.selectedIndex, 0, 'Expected clean LFrame');
|
2661 | assertEqual(newLFrame.elementDepthCount, 0, 'Expected clean LFrame');
|
2662 | assertEqual(newLFrame.currentDirectiveIndex, -1, 'Expected clean LFrame');
|
2663 | assertEqual(newLFrame.currentNamespace, null, 'Expected clean LFrame');
|
2664 | assertEqual(newLFrame.bindingRootIndex, -1, 'Expected clean LFrame');
|
2665 | assertEqual(newLFrame.currentQueryIndex, 0, 'Expected clean LFrame');
|
2666 | }
|
2667 | const tView = newView[TVIEW];
|
2668 | instructionState.lFrame = newLFrame;
|
2669 | newLFrame.previousOrParentTNode = tNode;
|
2670 | newLFrame.lView = newView;
|
2671 | newLFrame.tView = tView;
|
2672 | newLFrame.contextLView = newView;
|
2673 | newLFrame.bindingIndex = tView.bindingStartIndex;
|
2674 | }
|
2675 |
|
2676 |
|
2677 |
|
2678 | function allocLFrame() {
|
2679 | const currentLFrame = instructionState.lFrame;
|
2680 | const childLFrame = currentLFrame === null ? null : currentLFrame.child;
|
2681 | const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame;
|
2682 | return newLFrame;
|
2683 | }
|
2684 | function createLFrame(parent) {
|
2685 | const lFrame = {
|
2686 | previousOrParentTNode: null,
|
2687 | isParent: true,
|
2688 | lView: null,
|
2689 | tView: null,
|
2690 | selectedIndex: 0,
|
2691 | contextLView: null,
|
2692 | elementDepthCount: 0,
|
2693 | currentNamespace: null,
|
2694 | currentDirectiveIndex: -1,
|
2695 | bindingRootIndex: -1,
|
2696 | bindingIndex: -1,
|
2697 | currentQueryIndex: 0,
|
2698 | parent: parent,
|
2699 | child: null,
|
2700 | };
|
2701 | parent !== null && (parent.child = lFrame);
|
2702 | return lFrame;
|
2703 | }
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 | function leaveViewLight() {
|
2714 | const oldLFrame = instructionState.lFrame;
|
2715 | instructionState.lFrame = oldLFrame.parent;
|
2716 | oldLFrame.previousOrParentTNode = null;
|
2717 | oldLFrame.lView = null;
|
2718 | return oldLFrame;
|
2719 | }
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 | const leaveDI = leaveViewLight;
|
2727 |
|
2728 |
|
2729 |
|
2730 |
|
2731 |
|
2732 |
|
2733 |
|
2734 |
|
2735 | function leaveView() {
|
2736 | const oldLFrame = leaveViewLight();
|
2737 | oldLFrame.isParent = true;
|
2738 | oldLFrame.tView = null;
|
2739 | oldLFrame.selectedIndex = 0;
|
2740 | oldLFrame.contextLView = null;
|
2741 | oldLFrame.elementDepthCount = 0;
|
2742 | oldLFrame.currentDirectiveIndex = -1;
|
2743 | oldLFrame.currentNamespace = null;
|
2744 | oldLFrame.bindingRootIndex = -1;
|
2745 | oldLFrame.bindingIndex = -1;
|
2746 | oldLFrame.currentQueryIndex = 0;
|
2747 | }
|
2748 | function nextContextImpl(level) {
|
2749 | const contextLView = instructionState.lFrame.contextLView =
|
2750 | walkUpViews(level, instructionState.lFrame.contextLView);
|
2751 | return contextLView[CONTEXT];
|
2752 | }
|
2753 | function walkUpViews(nestingLevel, currentView) {
|
2754 | while (nestingLevel > 0) {
|
2755 | ngDevMode &&
|
2756 | assertDefined(currentView[DECLARATION_VIEW], 'Declaration view should be defined if nesting level is greater than 0.');
|
2757 | currentView = currentView[DECLARATION_VIEW];
|
2758 | nestingLevel--;
|
2759 | }
|
2760 | return currentView;
|
2761 | }
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 | function getSelectedIndex() {
|
2769 | return instructionState.lFrame.selectedIndex;
|
2770 | }
|
2771 |
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 | function setSelectedIndex(index) {
|
2781 | instructionState.lFrame.selectedIndex = index;
|
2782 | }
|
2783 |
|
2784 |
|
2785 |
|
2786 | function getSelectedTNode() {
|
2787 | const lFrame = instructionState.lFrame;
|
2788 | return getTNode(lFrame.tView, lFrame.selectedIndex);
|
2789 | }
|
2790 |
|
2791 |
|
2792 |
|
2793 |
|
2794 |
|
2795 | function ɵɵnamespaceSVG() {
|
2796 | instructionState.lFrame.currentNamespace = SVG_NAMESPACE;
|
2797 | }
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 | function ɵɵnamespaceMathML() {
|
2804 | instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE;
|
2805 | }
|
2806 |
|
2807 |
|
2808 |
|
2809 |
|
2810 |
|
2811 |
|
2812 | function ɵɵnamespaceHTML() {
|
2813 | namespaceHTMLInternal();
|
2814 | }
|
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 | function namespaceHTMLInternal() {
|
2820 | instructionState.lFrame.currentNamespace = null;
|
2821 | }
|
2822 | function getNamespace() {
|
2823 | return instructionState.lFrame.currentNamespace;
|
2824 | }
|
2825 |
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 | function registerPreOrderHooks(directiveIndex, directiveDef, tView) {
|
2846 | ngDevMode && assertFirstCreatePass(tView);
|
2847 | const { ngOnChanges, ngOnInit, ngDoCheck } = directiveDef.type.prototype;
|
2848 | if (ngOnChanges) {
|
2849 | const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef);
|
2850 | (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, wrappedOnChanges);
|
2851 | (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = []))
|
2852 | .push(directiveIndex, wrappedOnChanges);
|
2853 | }
|
2854 | if (ngOnInit) {
|
2855 | (tView.preOrderHooks || (tView.preOrderHooks = [])).push(0 - directiveIndex, ngOnInit);
|
2856 | }
|
2857 | if (ngDoCheck) {
|
2858 | (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, ngDoCheck);
|
2859 | (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(directiveIndex, ngDoCheck);
|
2860 | }
|
2861 | }
|
2862 |
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 | function registerPostOrderHooks(tView, tNode) {
|
2881 | ngDevMode && assertFirstCreatePass(tView);
|
2882 |
|
2883 |
|
2884 |
|
2885 | for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) {
|
2886 | const directiveDef = tView.data[i];
|
2887 | const lifecycleHooks = directiveDef.type.prototype;
|
2888 | const { ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy } = lifecycleHooks;
|
2889 | if (ngAfterContentInit) {
|
2890 | (tView.contentHooks || (tView.contentHooks = [])).push(-i, ngAfterContentInit);
|
2891 | }
|
2892 | if (ngAfterContentChecked) {
|
2893 | (tView.contentHooks || (tView.contentHooks = [])).push(i, ngAfterContentChecked);
|
2894 | (tView.contentCheckHooks || (tView.contentCheckHooks = [])).push(i, ngAfterContentChecked);
|
2895 | }
|
2896 | if (ngAfterViewInit) {
|
2897 | (tView.viewHooks || (tView.viewHooks = [])).push(-i, ngAfterViewInit);
|
2898 | }
|
2899 | if (ngAfterViewChecked) {
|
2900 | (tView.viewHooks || (tView.viewHooks = [])).push(i, ngAfterViewChecked);
|
2901 | (tView.viewCheckHooks || (tView.viewCheckHooks = [])).push(i, ngAfterViewChecked);
|
2902 | }
|
2903 | if (ngOnDestroy != null) {
|
2904 | (tView.destroyHooks || (tView.destroyHooks = [])).push(i, ngOnDestroy);
|
2905 | }
|
2906 | }
|
2907 | }
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 |
|
2928 |
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 | function executeCheckHooks(lView, hooks, nodeIndex) {
|
2941 | callHooks(lView, hooks, 3 , nodeIndex);
|
2942 | }
|
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 |
|
2955 |
|
2956 | function executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) {
|
2957 | ngDevMode &&
|
2958 | assertNotEqual(initPhase, 3 , 'Init pre-order hooks should not be called more than once');
|
2959 | if ((lView[FLAGS] & 3 ) === initPhase) {
|
2960 | callHooks(lView, hooks, initPhase, nodeIndex);
|
2961 | }
|
2962 | }
|
2963 | function incrementInitPhaseFlags(lView, initPhase) {
|
2964 | ngDevMode &&
|
2965 | assertNotEqual(initPhase, 3 , 'Init hooks phase should not be incremented after all init hooks have been run.');
|
2966 | let flags = lView[FLAGS];
|
2967 | if ((flags & 3 ) === initPhase) {
|
2968 | flags &= 2047 ;
|
2969 | flags += 1 ;
|
2970 | lView[FLAGS] = flags;
|
2971 | }
|
2972 | }
|
2973 |
|
2974 |
|
2975 |
|
2976 |
|
2977 |
|
2978 |
|
2979 |
|
2980 |
|
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 | function callHooks(currentView, arr, initPhase, currentNodeIndex) {
|
2988 | ngDevMode &&
|
2989 | assertEqual(getCheckNoChangesMode(), false, 'Hooks should never be run in the check no changes mode.');
|
2990 | const startIndex = currentNodeIndex !== undefined ?
|
2991 | (currentView[PREORDER_HOOK_FLAGS] & 65535 ) :
|
2992 | 0;
|
2993 | const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;
|
2994 | let lastNodeIndexFound = 0;
|
2995 | for (let i = startIndex; i < arr.length; i++) {
|
2996 | const hook = arr[i + 1];
|
2997 | if (typeof hook === 'number') {
|
2998 | lastNodeIndexFound = arr[i];
|
2999 | if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {
|
3000 | break;
|
3001 | }
|
3002 | }
|
3003 | else {
|
3004 | const isInitHook = arr[i] < 0;
|
3005 | if (isInitHook)
|
3006 | currentView[PREORDER_HOOK_FLAGS] += 65536 ;
|
3007 | if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {
|
3008 | callHook(currentView, initPhase, arr, i);
|
3009 | currentView[PREORDER_HOOK_FLAGS] =
|
3010 | (currentView[PREORDER_HOOK_FLAGS] & 4294901760 ) + i +
|
3011 | 2;
|
3012 | }
|
3013 | i++;
|
3014 | }
|
3015 | }
|
3016 | }
|
3017 |
|
3018 |
|
3019 |
|
3020 |
|
3021 |
|
3022 |
|
3023 |
|
3024 |
|
3025 | function callHook(currentView, initPhase, arr, i) {
|
3026 | const isInitHook = arr[i] < 0;
|
3027 | const hook = arr[i + 1];
|
3028 | const directiveIndex = isInitHook ? -arr[i] : arr[i];
|
3029 | const directive = currentView[directiveIndex];
|
3030 | if (isInitHook) {
|
3031 | const indexWithintInitPhase = currentView[FLAGS] >> 11 ;
|
3032 |
|
3033 |
|
3034 | if (indexWithintInitPhase <
|
3035 | (currentView[PREORDER_HOOK_FLAGS] >> 16 ) &&
|
3036 | (currentView[FLAGS] & 3 ) === initPhase) {
|
3037 | currentView[FLAGS] += 2048 ;
|
3038 | hook.call(directive);
|
3039 | }
|
3040 | }
|
3041 | else {
|
3042 | hook.call(directive);
|
3043 | }
|
3044 | }
|
3045 |
|
3046 |
|
3047 |
|
3048 |
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 | const TNODE = 8;
|
3054 | const PARENT_INJECTOR = 8;
|
3055 | const INJECTOR_BLOOM_PARENT_SIZE = 9;
|
3056 | const NO_PARENT_INJECTOR = -1;
|
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 |
|
3064 |
|
3065 |
|
3066 |
|
3067 |
|
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 |
|
3078 |
|
3079 |
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 | class NodeInjectorFactory {
|
3152 | constructor(
|
3153 | /**
|
3154 | * Factory to invoke in order to create a new instance.
|
3155 | */
|
3156 | factory,
|
3157 | /**
|
3158 | * Set to `true` if the token is declared in `viewProviders` (or if it is component).
|
3159 | */
|
3160 | isViewProvider, injectImplementation) {
|
3161 | this.factory = factory;
|
3162 | |
3163 |
|
3164 |
|
3165 |
|
3166 | this.resolving = false;
|
3167 | this.canSeeViewProviders = isViewProvider;
|
3168 | this.injectImpl = injectImplementation;
|
3169 | }
|
3170 | }
|
3171 | function isFactory(obj) {
|
3172 | return obj instanceof NodeInjectorFactory;
|
3173 | }
|
3174 |
|
3175 |
|
3176 | const unusedValueExportToPlacateAjd$3 = 1;
|
3177 |
|
3178 |
|
3179 |
|
3180 |
|
3181 |
|
3182 |
|
3183 |
|
3184 |
|
3185 | function assertNodeType(tNode, type) {
|
3186 | assertDefined(tNode, 'should be called with a TNode');
|
3187 | assertEqual(tNode.type, type, `should be a ${typeName(type)}`);
|
3188 | }
|
3189 | function assertNodeOfPossibleTypes(tNode, types, message) {
|
3190 | assertDefined(tNode, 'should be called with a TNode');
|
3191 | const found = types.some(type => tNode.type === type);
|
3192 | assertEqual(found, true, message !== null && message !== void 0 ? message : `Should be one of ${types.map(typeName).join(', ')} but got ${typeName(tNode.type)}`);
|
3193 | }
|
3194 | function assertNodeNotOfTypes(tNode, types, message) {
|
3195 | assertDefined(tNode, 'should be called with a TNode');
|
3196 | const found = types.some(type => tNode.type === type);
|
3197 | assertEqual(found, false, message !== null && message !== void 0 ? message : `Should not be one of ${types.map(typeName).join(', ')} but got ${typeName(tNode.type)}`);
|
3198 | }
|
3199 | function typeName(type) {
|
3200 | if (type == 1 )
|
3201 | return 'Projection';
|
3202 | if (type == 0 )
|
3203 | return 'Container';
|
3204 | if (type == 5 )
|
3205 | return 'IcuContainer';
|
3206 | if (type == 2 )
|
3207 | return 'View';
|
3208 | if (type == 3 )
|
3209 | return 'Element';
|
3210 | if (type == 4 )
|
3211 | return 'ElementContainer';
|
3212 | return '<unknown>';
|
3213 | }
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 | function setUpAttributes(renderer, native, attrs) {
|
3243 | const isProc = isProceduralRenderer(renderer);
|
3244 | let i = 0;
|
3245 | while (i < attrs.length) {
|
3246 | const value = attrs[i];
|
3247 | if (typeof value === 'number') {
|
3248 |
|
3249 |
|
3250 | if (value !== 0 ) {
|
3251 | break;
|
3252 | }
|
3253 |
|
3254 |
|
3255 | i++;
|
3256 | const namespaceURI = attrs[i++];
|
3257 | const attrName = attrs[i++];
|
3258 | const attrVal = attrs[i++];
|
3259 | ngDevMode && ngDevMode.rendererSetAttribute++;
|
3260 | isProc ?
|
3261 | renderer.setAttribute(native, attrName, attrVal, namespaceURI) :
|
3262 | native.setAttributeNS(namespaceURI, attrName, attrVal);
|
3263 | }
|
3264 | else {
|
3265 |
|
3266 | const attrName = value;
|
3267 | const attrVal = attrs[++i];
|
3268 |
|
3269 | ngDevMode && ngDevMode.rendererSetAttribute++;
|
3270 | if (isAnimationProp(attrName)) {
|
3271 | if (isProc) {
|
3272 | renderer.setProperty(native, attrName, attrVal);
|
3273 | }
|
3274 | }
|
3275 | else {
|
3276 | isProc ?
|
3277 | renderer.setAttribute(native, attrName, attrVal) :
|
3278 | native.setAttribute(attrName, attrVal);
|
3279 | }
|
3280 | i++;
|
3281 | }
|
3282 | }
|
3283 |
|
3284 |
|
3285 |
|
3286 |
|
3287 | return i;
|
3288 | }
|
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 |
|
3295 |
|
3296 | function isNameOnlyAttributeMarker(marker) {
|
3297 | return marker === 3 || marker === 4 ||
|
3298 | marker === 6 ;
|
3299 | }
|
3300 | function isAnimationProp(name) {
|
3301 |
|
3302 |
|
3303 |
|
3304 | return name.charCodeAt(0) === 64 ;
|
3305 | }
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 |
|
3311 |
|
3312 |
|
3313 |
|
3314 | function mergeHostAttrs(dst, src) {
|
3315 | if (src === null || src.length === 0) {
|
3316 |
|
3317 | }
|
3318 | else if (dst === null || dst.length === 0) {
|
3319 |
|
3320 | dst = src.slice();
|
3321 | }
|
3322 | else {
|
3323 | let srcMarker = -1 ;
|
3324 | for (let i = 0; i < src.length; i++) {
|
3325 | const item = src[i];
|
3326 | if (typeof item === 'number') {
|
3327 | srcMarker = item;
|
3328 | }
|
3329 | else {
|
3330 | if (srcMarker === 0 ) {
|
3331 |
|
3332 | }
|
3333 | else if (srcMarker === -1 ||
|
3334 | srcMarker === 2 ) {
|
3335 |
|
3336 | mergeHostAttribute(dst, srcMarker, item, null, src[++i]);
|
3337 | }
|
3338 | else {
|
3339 |
|
3340 | mergeHostAttribute(dst, srcMarker, item, null, null);
|
3341 | }
|
3342 | }
|
3343 | }
|
3344 | }
|
3345 | return dst;
|
3346 | }
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 |
|
3354 |
|
3355 |
|
3356 | function mergeHostAttribute(dst, marker, key1, key2, value) {
|
3357 | let i = 0;
|
3358 |
|
3359 | let markerInsertPosition = dst.length;
|
3360 |
|
3361 | if (marker === -1 ) {
|
3362 | markerInsertPosition = -1;
|
3363 | }
|
3364 | else {
|
3365 | while (i < dst.length) {
|
3366 | const dstValue = dst[i++];
|
3367 | if (typeof dstValue === 'number') {
|
3368 | if (dstValue === marker) {
|
3369 | markerInsertPosition = -1;
|
3370 | break;
|
3371 | }
|
3372 | else if (dstValue > marker) {
|
3373 |
|
3374 | markerInsertPosition = i - 1;
|
3375 | break;
|
3376 | }
|
3377 | }
|
3378 | }
|
3379 | }
|
3380 |
|
3381 | while (i < dst.length) {
|
3382 | const item = dst[i];
|
3383 | if (typeof item === 'number') {
|
3384 |
|
3385 |
|
3386 | break;
|
3387 | }
|
3388 | else if (item === key1) {
|
3389 |
|
3390 | if (key2 === null) {
|
3391 | if (value !== null) {
|
3392 | dst[i + 1] = value;
|
3393 | }
|
3394 | return;
|
3395 | }
|
3396 | else if (key2 === dst[i + 1]) {
|
3397 | dst[i + 2] = value;
|
3398 | return;
|
3399 | }
|
3400 | }
|
3401 |
|
3402 | i++;
|
3403 | if (key2 !== null)
|
3404 | i++;
|
3405 | if (value !== null)
|
3406 | i++;
|
3407 | }
|
3408 |
|
3409 | if (markerInsertPosition !== -1) {
|
3410 | dst.splice(markerInsertPosition, 0, marker);
|
3411 | i = markerInsertPosition + 1;
|
3412 | }
|
3413 | dst.splice(i++, 0, key1);
|
3414 | if (key2 !== null) {
|
3415 | dst.splice(i++, 0, key2);
|
3416 | }
|
3417 | if (value !== null) {
|
3418 | dst.splice(i++, 0, value);
|
3419 | }
|
3420 | }
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 | function hasParentInjector(parentLocation) {
|
3431 | return parentLocation !== NO_PARENT_INJECTOR;
|
3432 | }
|
3433 | function getParentInjectorIndex(parentLocation) {
|
3434 | return parentLocation & 32767 ;
|
3435 | }
|
3436 | function getParentInjectorViewOffset(parentLocation) {
|
3437 | return parentLocation >> 16 ;
|
3438 | }
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 | function getParentInjectorView(location, startView) {
|
3449 | let viewOffset = getParentInjectorViewOffset(location);
|
3450 | let parentView = startView;
|
3451 |
|
3452 |
|
3453 |
|
3454 |
|
3455 | while (viewOffset > 0) {
|
3456 | parentView = parentView[DECLARATION_VIEW];
|
3457 | viewOffset--;
|
3458 | }
|
3459 | return parentView;
|
3460 | }
|
3461 |
|
3462 |
|
3463 |
|
3464 |
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 | function renderStringify(value) {
|
3475 | if (typeof value === 'string')
|
3476 | return value;
|
3477 | if (value == null)
|
3478 | return '';
|
3479 | return '' + value;
|
3480 | }
|
3481 |
|
3482 |
|
3483 |
|
3484 |
|
3485 |
|
3486 | function stringifyForError(value) {
|
3487 | if (typeof value === 'function')
|
3488 | return value.name || value.toString();
|
3489 | if (typeof value === 'object' && value != null && typeof value.type === 'function') {
|
3490 | return value.type.name || value.type.toString();
|
3491 | }
|
3492 | return renderStringify(value);
|
3493 | }
|
3494 | const ɵ0$3 = () => (typeof requestAnimationFrame !== 'undefined' &&
|
3495 | requestAnimationFrame ||
|
3496 | setTimeout
|
3497 | )
|
3498 | .bind(_global);
|
3499 | const defaultScheduler = (ɵ0$3)();
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 | function ɵɵresolveWindow(element) {
|
3505 | return { name: 'window', target: element.ownerDocument.defaultView };
|
3506 | }
|
3507 |
|
3508 |
|
3509 |
|
3510 |
|
3511 | function ɵɵresolveDocument(element) {
|
3512 | return { name: 'document', target: element.ownerDocument };
|
3513 | }
|
3514 |
|
3515 |
|
3516 |
|
3517 |
|
3518 | function ɵɵresolveBody(element) {
|
3519 | return { name: 'body', target: element.ownerDocument.body };
|
3520 | }
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 | const INTERPOLATION_DELIMITER = `�`;
|
3536 |
|
3537 |
|
3538 |
|
3539 | function maybeUnwrapFn(value) {
|
3540 | if (value instanceof Function) {
|
3541 | return value();
|
3542 | }
|
3543 | else {
|
3544 | return value;
|
3545 | }
|
3546 | }
|
3547 |
|
3548 |
|
3549 |
|
3550 |
|
3551 |
|
3552 |
|
3553 |
|
3554 |
|
3555 |
|
3556 |
|
3557 |
|
3558 |
|
3559 |
|
3560 |
|
3561 |
|
3562 |
|
3563 |
|
3564 |
|
3565 |
|
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 |
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 |
|
3590 |
|
3591 | let includeViewProviders = true;
|
3592 | function setIncludeViewProviders(v) {
|
3593 | const oldValue = includeViewProviders;
|
3594 | includeViewProviders = v;
|
3595 | return oldValue;
|
3596 | }
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 |
|
3602 | const BLOOM_SIZE = 256;
|
3603 | const BLOOM_MASK = BLOOM_SIZE - 1;
|
3604 |
|
3605 | let nextNgElementId = 0;
|
3606 |
|
3607 |
|
3608 |
|
3609 |
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 | function bloomAdd(injectorIndex, tView, type) {
|
3615 | ngDevMode && assertEqual(tView.firstCreatePass, true, 'expected firstCreatePass to be true');
|
3616 | let id;
|
3617 | if (typeof type === 'string') {
|
3618 | id = type.charCodeAt(0) || 0;
|
3619 | }
|
3620 | else if (type.hasOwnProperty(NG_ELEMENT_ID)) {
|
3621 | id = type[NG_ELEMENT_ID];
|
3622 | }
|
3623 |
|
3624 |
|
3625 | if (id == null) {
|
3626 | id = type[NG_ELEMENT_ID] = nextNgElementId++;
|
3627 | }
|
3628 |
|
3629 |
|
3630 | const bloomBit = id & BLOOM_MASK;
|
3631 |
|
3632 |
|
3633 |
|
3634 | const mask = 1 << bloomBit;
|
3635 |
|
3636 |
|
3637 | const b7 = bloomBit & 0x80;
|
3638 | const b6 = bloomBit & 0x40;
|
3639 | const b5 = bloomBit & 0x20;
|
3640 | const tData = tView.data;
|
3641 | if (b7) {
|
3642 | b6 ? (b5 ? (tData[injectorIndex + 7] |= mask) : (tData[injectorIndex + 6] |= mask)) :
|
3643 | (b5 ? (tData[injectorIndex + 5] |= mask) : (tData[injectorIndex + 4] |= mask));
|
3644 | }
|
3645 | else {
|
3646 | b6 ? (b5 ? (tData[injectorIndex + 3] |= mask) : (tData[injectorIndex + 2] |= mask)) :
|
3647 | (b5 ? (tData[injectorIndex + 1] |= mask) : (tData[injectorIndex] |= mask));
|
3648 | }
|
3649 | }
|
3650 |
|
3651 |
|
3652 |
|
3653 |
|
3654 |
|
3655 |
|
3656 |
|
3657 | function getOrCreateNodeInjectorForNode(tNode, hostView) {
|
3658 | const existingInjectorIndex = getInjectorIndex(tNode, hostView);
|
3659 | if (existingInjectorIndex !== -1) {
|
3660 | return existingInjectorIndex;
|
3661 | }
|
3662 | const tView = hostView[TVIEW];
|
3663 | if (tView.firstCreatePass) {
|
3664 | tNode.injectorIndex = hostView.length;
|
3665 | insertBloom(tView.data, tNode);
|
3666 | insertBloom(hostView, null);
|
3667 | insertBloom(tView.blueprint, null);
|
3668 | }
|
3669 | const parentLoc = getParentInjectorLocation(tNode, hostView);
|
3670 | const injectorIndex = tNode.injectorIndex;
|
3671 |
|
3672 |
|
3673 | if (hasParentInjector(parentLoc)) {
|
3674 | const parentIndex = getParentInjectorIndex(parentLoc);
|
3675 | const parentLView = getParentInjectorView(parentLoc, hostView);
|
3676 | const parentData = parentLView[TVIEW].data;
|
3677 |
|
3678 |
|
3679 | for (let i = 0; i < 8; i++) {
|
3680 | hostView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i];
|
3681 | }
|
3682 | }
|
3683 | hostView[injectorIndex + PARENT_INJECTOR] = parentLoc;
|
3684 | return injectorIndex;
|
3685 | }
|
3686 | function insertBloom(arr, footer) {
|
3687 | arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer);
|
3688 | }
|
3689 | function getInjectorIndex(tNode, hostView) {
|
3690 | if (tNode.injectorIndex === -1 ||
|
3691 |
|
3692 |
|
3693 | (tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex) ||
|
3694 |
|
3695 |
|
3696 | hostView[tNode.injectorIndex + PARENT_INJECTOR] == null) {
|
3697 | return -1;
|
3698 | }
|
3699 | else {
|
3700 | return tNode.injectorIndex;
|
3701 | }
|
3702 | }
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 |
|
3709 | function getParentInjectorLocation(tNode, view) {
|
3710 | if (tNode.parent && tNode.parent.injectorIndex !== -1) {
|
3711 | return tNode.parent.injectorIndex;
|
3712 | }
|
3713 |
|
3714 |
|
3715 |
|
3716 | let hostTNode = view[T_HOST];
|
3717 | let viewOffset = 1;
|
3718 | while (hostTNode && hostTNode.injectorIndex === -1) {
|
3719 | view = view[DECLARATION_VIEW];
|
3720 | hostTNode = view ? view[T_HOST] : null;
|
3721 | viewOffset++;
|
3722 | }
|
3723 | return hostTNode ?
|
3724 | hostTNode.injectorIndex | (viewOffset << 16 ) :
|
3725 | -1;
|
3726 | }
|
3727 |
|
3728 |
|
3729 |
|
3730 |
|
3731 |
|
3732 |
|
3733 |
|
3734 | function diPublicInInjector(injectorIndex, tView, token) {
|
3735 | bloomAdd(injectorIndex, tView, token);
|
3736 | }
|
3737 |
|
3738 |
|
3739 |
|
3740 |
|
3741 |
|
3742 |
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 |
|
3766 |
|
3767 |
|
3768 | function injectAttributeImpl(tNode, attrNameToInject) {
|
3769 | ngDevMode &&
|
3770 | assertNodeOfPossibleTypes(tNode, [0 , 3 , 4 ]);
|
3771 | ngDevMode && assertDefined(tNode, 'expecting tNode');
|
3772 | if (attrNameToInject === 'class') {
|
3773 | return tNode.classes;
|
3774 | }
|
3775 | if (attrNameToInject === 'style') {
|
3776 | return tNode.styles;
|
3777 | }
|
3778 | const attrs = tNode.attrs;
|
3779 | if (attrs) {
|
3780 | const attrsLength = attrs.length;
|
3781 | let i = 0;
|
3782 | while (i < attrsLength) {
|
3783 | const value = attrs[i];
|
3784 |
|
3785 | if (isNameOnlyAttributeMarker(value))
|
3786 | break;
|
3787 |
|
3788 | if (value === 0 ) {
|
3789 |
|
3790 |
|
3791 |
|
3792 |
|
3793 | i = i + 2;
|
3794 | }
|
3795 | else if (typeof value === 'number') {
|
3796 |
|
3797 | i++;
|
3798 | while (i < attrsLength && typeof attrs[i] === 'string') {
|
3799 | i++;
|
3800 | }
|
3801 | }
|
3802 | else if (value === attrNameToInject) {
|
3803 | return attrs[i + 1];
|
3804 | }
|
3805 | else {
|
3806 | i = i + 2;
|
3807 | }
|
3808 | }
|
3809 | }
|
3810 | return null;
|
3811 | }
|
3812 |
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 |
|
3819 |
|
3820 |
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 | function getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default, notFoundValue) {
|
3830 | if (tNode !== null) {
|
3831 | const bloomHash = bloomHashBitOrFactory(token);
|
3832 |
|
3833 |
|
3834 | if (typeof bloomHash === 'function') {
|
3835 | enterDI(lView, tNode);
|
3836 | try {
|
3837 | const value = bloomHash();
|
3838 | if (value == null && !(flags & InjectFlags.Optional)) {
|
3839 | throw new Error(`No provider for ${stringifyForError(token)}!`);
|
3840 | }
|
3841 | else {
|
3842 | return value;
|
3843 | }
|
3844 | }
|
3845 | finally {
|
3846 | leaveDI();
|
3847 | }
|
3848 | }
|
3849 | else if (typeof bloomHash == 'number') {
|
3850 | if (bloomHash === -1) {
|
3851 |
|
3852 | return new NodeInjector(tNode, lView);
|
3853 | }
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 | let previousTView = null;
|
3859 | let injectorIndex = getInjectorIndex(tNode, lView);
|
3860 | let parentLocation = NO_PARENT_INJECTOR;
|
3861 | let hostTElementNode = flags & InjectFlags.Host ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null;
|
3862 |
|
3863 |
|
3864 |
|
3865 | if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {
|
3866 | parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) :
|
3867 | lView[injectorIndex + PARENT_INJECTOR];
|
3868 | if (!shouldSearchParent(flags, false)) {
|
3869 | injectorIndex = -1;
|
3870 | }
|
3871 | else {
|
3872 | previousTView = lView[TVIEW];
|
3873 | injectorIndex = getParentInjectorIndex(parentLocation);
|
3874 | lView = getParentInjectorView(parentLocation, lView);
|
3875 | }
|
3876 | }
|
3877 |
|
3878 |
|
3879 | while (injectorIndex !== -1) {
|
3880 | parentLocation = lView[injectorIndex + PARENT_INJECTOR];
|
3881 |
|
3882 | const tView = lView[TVIEW];
|
3883 | if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {
|
3884 |
|
3885 |
|
3886 |
|
3887 | const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode);
|
3888 | if (instance !== NOT_FOUND) {
|
3889 | return instance;
|
3890 | }
|
3891 | }
|
3892 | if (shouldSearchParent(flags, lView[TVIEW].data[injectorIndex + TNODE] === hostTElementNode) &&
|
3893 | bloomHasToken(bloomHash, injectorIndex, lView)) {
|
3894 |
|
3895 |
|
3896 | previousTView = tView;
|
3897 | injectorIndex = getParentInjectorIndex(parentLocation);
|
3898 | lView = getParentInjectorView(parentLocation, lView);
|
3899 | }
|
3900 | else {
|
3901 |
|
3902 |
|
3903 |
|
3904 | injectorIndex = -1;
|
3905 | }
|
3906 | }
|
3907 | }
|
3908 | }
|
3909 | if (flags & InjectFlags.Optional && notFoundValue === undefined) {
|
3910 |
|
3911 | notFoundValue = null;
|
3912 | }
|
3913 | if ((flags & (InjectFlags.Self | InjectFlags.Host)) === 0) {
|
3914 | const moduleInjector = lView[INJECTOR$1];
|
3915 |
|
3916 |
|
3917 |
|
3918 | const previousInjectImplementation = setInjectImplementation(undefined);
|
3919 | try {
|
3920 | if (moduleInjector) {
|
3921 | return moduleInjector.get(token, notFoundValue, flags & InjectFlags.Optional);
|
3922 | }
|
3923 | else {
|
3924 | return injectRootLimpMode(token, notFoundValue, flags & InjectFlags.Optional);
|
3925 | }
|
3926 | }
|
3927 | finally {
|
3928 | setInjectImplementation(previousInjectImplementation);
|
3929 | }
|
3930 | }
|
3931 | if (flags & InjectFlags.Optional) {
|
3932 | return notFoundValue;
|
3933 | }
|
3934 | else {
|
3935 | throw new Error(`NodeInjector: NOT_FOUND [${stringifyForError(token)}]`);
|
3936 | }
|
3937 | }
|
3938 | const NOT_FOUND = {};
|
3939 | function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) {
|
3940 | const currentTView = lView[TVIEW];
|
3941 | const tNode = currentTView.data[injectorIndex + TNODE];
|
3942 |
|
3943 |
|
3944 | const canAccessViewProviders = previousTView == null ?
|
3945 |
|
3946 |
|
3947 |
|
3948 |
|
3949 |
|
3950 |
|
3951 |
|
3952 | (isComponentHost(tNode) && includeViewProviders) :
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 | (previousTView != currentTView && (tNode.type === 3 ));
|
3960 |
|
3961 |
|
3962 | const isHostSpecialCase = (flags & InjectFlags.Host) && hostTElementNode === tNode;
|
3963 | const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase);
|
3964 | if (injectableIdx !== null) {
|
3965 | return getNodeInjectable(lView, currentTView, injectableIdx, tNode);
|
3966 | }
|
3967 | else {
|
3968 | return NOT_FOUND;
|
3969 | }
|
3970 | }
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 |
|
3976 |
|
3977 |
|
3978 |
|
3979 |
|
3980 |
|
3981 | function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) {
|
3982 | const nodeProviderIndexes = tNode.providerIndexes;
|
3983 | const tInjectables = tView.data;
|
3984 | const injectablesStart = nodeProviderIndexes & 1048575 ;
|
3985 | const directivesStart = tNode.directiveStart;
|
3986 | const directiveEnd = tNode.directiveEnd;
|
3987 | const cptViewProvidersCount = nodeProviderIndexes >> 20 ;
|
3988 | const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount;
|
3989 |
|
3990 | const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd;
|
3991 | for (let i = startingIndex; i < endIndex; i++) {
|
3992 | const providerTokenOrDef = tInjectables[i];
|
3993 | if (i < directivesStart && token === providerTokenOrDef ||
|
3994 | i >= directivesStart && providerTokenOrDef.type === token) {
|
3995 | return i;
|
3996 | }
|
3997 | }
|
3998 | if (isHostSpecialCase) {
|
3999 | const dirDef = tInjectables[directivesStart];
|
4000 | if (dirDef && isComponentDef(dirDef) && dirDef.type === token) {
|
4001 | return directivesStart;
|
4002 | }
|
4003 | }
|
4004 | return null;
|
4005 | }
|
4006 |
|
4007 |
|
4008 |
|
4009 |
|
4010 |
|
4011 |
|
4012 |
|
4013 | function getNodeInjectable(lView, tView, index, tNode) {
|
4014 | let value = lView[index];
|
4015 | const tData = tView.data;
|
4016 | if (isFactory(value)) {
|
4017 | const factory = value;
|
4018 | if (factory.resolving) {
|
4019 | throw new Error(`Circular dep for ${stringifyForError(tData[index])}`);
|
4020 | }
|
4021 | const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);
|
4022 | factory.resolving = true;
|
4023 | let previousInjectImplementation;
|
4024 | if (factory.injectImpl) {
|
4025 | previousInjectImplementation = setInjectImplementation(factory.injectImpl);
|
4026 | }
|
4027 | enterDI(lView, tNode);
|
4028 | try {
|
4029 | value = lView[index] = factory.factory(undefined, tData, lView, tNode);
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 |
|
4036 | if (tView.firstCreatePass && index >= tNode.directiveStart) {
|
4037 | ngDevMode && assertDirectiveDef(tData[index]);
|
4038 | registerPreOrderHooks(index, tData[index], tView);
|
4039 | }
|
4040 | }
|
4041 | finally {
|
4042 | if (factory.injectImpl)
|
4043 | setInjectImplementation(previousInjectImplementation);
|
4044 | setIncludeViewProviders(previousIncludeViewProviders);
|
4045 | factory.resolving = false;
|
4046 | leaveDI();
|
4047 | }
|
4048 | }
|
4049 | return value;
|
4050 | }
|
4051 |
|
4052 |
|
4053 |
|
4054 |
|
4055 |
|
4056 |
|
4057 |
|
4058 |
|
4059 |
|
4060 |
|
4061 |
|
4062 |
|
4063 | function bloomHashBitOrFactory(token) {
|
4064 | ngDevMode && assertDefined(token, 'token must be defined');
|
4065 | if (typeof token === 'string') {
|
4066 | return token.charCodeAt(0) || 0;
|
4067 | }
|
4068 | const tokenId =
|
4069 |
|
4070 | token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : undefined;
|
4071 |
|
4072 | return (typeof tokenId === 'number' && tokenId > 0) ? tokenId & BLOOM_MASK : tokenId;
|
4073 | }
|
4074 | function bloomHasToken(bloomHash, injectorIndex, injectorView) {
|
4075 |
|
4076 |
|
4077 |
|
4078 | const mask = 1 << bloomHash;
|
4079 | const b7 = bloomHash & 0x80;
|
4080 | const b6 = bloomHash & 0x40;
|
4081 | const b5 = bloomHash & 0x20;
|
4082 |
|
4083 |
|
4084 |
|
4085 | let value;
|
4086 | if (b7) {
|
4087 | value = b6 ? (b5 ? injectorView[injectorIndex + 7] : injectorView[injectorIndex + 6]) :
|
4088 | (b5 ? injectorView[injectorIndex + 5] : injectorView[injectorIndex + 4]);
|
4089 | }
|
4090 | else {
|
4091 | value = b6 ? (b5 ? injectorView[injectorIndex + 3] : injectorView[injectorIndex + 2]) :
|
4092 | (b5 ? injectorView[injectorIndex + 1] : injectorView[injectorIndex]);
|
4093 | }
|
4094 |
|
4095 |
|
4096 | return !!(value & mask);
|
4097 | }
|
4098 |
|
4099 | function shouldSearchParent(flags, isFirstHostTNode) {
|
4100 | return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode);
|
4101 | }
|
4102 | class NodeInjector {
|
4103 | constructor(_tNode, _lView) {
|
4104 | this._tNode = _tNode;
|
4105 | this._lView = _lView;
|
4106 | }
|
4107 | get(token, notFoundValue) {
|
4108 | return getOrCreateInjectable(this._tNode, this._lView, token, undefined, notFoundValue);
|
4109 | }
|
4110 | }
|
4111 |
|
4112 |
|
4113 |
|
4114 | function ɵɵgetFactoryOf(type) {
|
4115 | const typeAny = type;
|
4116 | if (isForwardRef(type)) {
|
4117 | return (() => {
|
4118 | const factory = ɵɵgetFactoryOf(resolveForwardRef(typeAny));
|
4119 | return factory ? factory() : null;
|
4120 | });
|
4121 | }
|
4122 | let factory = getFactoryDef(typeAny);
|
4123 | if (factory === null) {
|
4124 | const injectorDef = getInjectorDef(typeAny);
|
4125 | factory = injectorDef && injectorDef.factory;
|
4126 | }
|
4127 | return factory || null;
|
4128 | }
|
4129 |
|
4130 |
|
4131 |
|
4132 | function ɵɵgetInheritedFactory(type) {
|
4133 | return noSideEffects(() => {
|
4134 | const ownConstructor = type.prototype.constructor;
|
4135 | const ownFactory = ownConstructor[NG_FACTORY_DEF] || ɵɵgetFactoryOf(ownConstructor);
|
4136 | const objectPrototype = Object.prototype;
|
4137 | let parent = Object.getPrototypeOf(type.prototype).constructor;
|
4138 |
|
4139 | while (parent && parent !== objectPrototype) {
|
4140 | const factory = parent[NG_FACTORY_DEF] || ɵɵgetFactoryOf(parent);
|
4141 |
|
4142 |
|
4143 |
|
4144 |
|
4145 |
|
4146 | if (factory && factory !== ownFactory) {
|
4147 | return factory;
|
4148 | }
|
4149 | parent = Object.getPrototypeOf(parent);
|
4150 | }
|
4151 |
|
4152 |
|
4153 |
|
4154 |
|
4155 | return t => new t();
|
4156 | });
|
4157 | }
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 |
|
4166 | const ERROR_TYPE = 'ngType';
|
4167 | const ERROR_DEBUG_CONTEXT = 'ngDebugContext';
|
4168 | const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
4169 | const ERROR_LOGGER = 'ngErrorLogger';
|
4170 | function wrappedError(message, originalError) {
|
4171 | const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
4172 | const error = Error(msg);
|
4173 | error[ERROR_ORIGINAL_ERROR] = originalError;
|
4174 | return error;
|
4175 | }
|
4176 |
|
4177 |
|
4178 |
|
4179 |
|
4180 |
|
4181 |
|
4182 |
|
4183 |
|
4184 | function getType(error) {
|
4185 | return error[ERROR_TYPE];
|
4186 | }
|
4187 | function getDebugContext(error) {
|
4188 | return error[ERROR_DEBUG_CONTEXT];
|
4189 | }
|
4190 | function getOriginalError(error) {
|
4191 | return error[ERROR_ORIGINAL_ERROR];
|
4192 | }
|
4193 | function getErrorLogger(error) {
|
4194 | return error[ERROR_LOGGER] || defaultErrorLogger;
|
4195 | }
|
4196 | function defaultErrorLogger(console, ...values) {
|
4197 | console.error(...values);
|
4198 | }
|
4199 |
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 |
|
4215 |
|
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 | class ErrorHandler {
|
4233 | constructor() {
|
4234 | |
4235 |
|
4236 |
|
4237 | this._console = console;
|
4238 | }
|
4239 | handleError(error) {
|
4240 | const originalError = this._findOriginalError(error);
|
4241 | const context = this._findContext(error);
|
4242 |
|
4243 |
|
4244 | const errorLogger = getErrorLogger(error);
|
4245 | errorLogger(this._console, `ERROR`, error);
|
4246 | if (originalError) {
|
4247 | errorLogger(this._console, `ORIGINAL ERROR`, originalError);
|
4248 | }
|
4249 | if (context) {
|
4250 | errorLogger(this._console, 'ERROR CONTEXT', context);
|
4251 | }
|
4252 | }
|
4253 |
|
4254 | _findContext(error) {
|
4255 | if (error) {
|
4256 | return getDebugContext(error) ? getDebugContext(error) :
|
4257 | this._findContext(getOriginalError(error));
|
4258 | }
|
4259 | return null;
|
4260 | }
|
4261 |
|
4262 | _findOriginalError(error) {
|
4263 | let e = getOriginalError(error);
|
4264 | while (e && getOriginalError(e)) {
|
4265 | e = getOriginalError(e);
|
4266 | }
|
4267 | return e;
|
4268 | }
|
4269 | }
|
4270 |
|
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 |
|
4276 |
|
4277 |
|
4278 |
|
4279 |
|
4280 |
|
4281 |
|
4282 |
|
4283 |
|
4284 |
|
4285 |
|
4286 | const CUSTOM_ELEMENTS_SCHEMA = {
|
4287 | name: 'custom-elements'
|
4288 | };
|
4289 |
|
4290 |
|
4291 |
|
4292 |
|
4293 |
|
4294 | const NO_ERRORS_SCHEMA = {
|
4295 | name: 'no-errors-schema'
|
4296 | };
|
4297 |
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 |
|
4305 | class SafeValueImpl {
|
4306 | constructor(changingThisBreaksApplicationSecurity) {
|
4307 | this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
|
4308 | }
|
4309 | toString() {
|
4310 | return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity}` +
|
4311 | ` (see http://g.co/ng/security#xss)`;
|
4312 | }
|
4313 | }
|
4314 | class SafeHtmlImpl extends SafeValueImpl {
|
4315 | getTypeName() {
|
4316 | return "HTML" ;
|
4317 | }
|
4318 | }
|
4319 | class SafeStyleImpl extends SafeValueImpl {
|
4320 | getTypeName() {
|
4321 | return "Style" ;
|
4322 | }
|
4323 | }
|
4324 | class SafeScriptImpl extends SafeValueImpl {
|
4325 | getTypeName() {
|
4326 | return "Script" ;
|
4327 | }
|
4328 | }
|
4329 | class SafeUrlImpl extends SafeValueImpl {
|
4330 | getTypeName() {
|
4331 | return "URL" ;
|
4332 | }
|
4333 | }
|
4334 | class SafeResourceUrlImpl extends SafeValueImpl {
|
4335 | getTypeName() {
|
4336 | return "ResourceURL" ;
|
4337 | }
|
4338 | }
|
4339 | function unwrapSafeValue(value) {
|
4340 | return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity :
|
4341 | value;
|
4342 | }
|
4343 | function allowSanitizationBypassAndThrow(value, type) {
|
4344 | const actualType = getSanitizationBypassType(value);
|
4345 | if (actualType != null && actualType !== type) {
|
4346 |
|
4347 | if (actualType === "ResourceURL" && type === "URL" )
|
4348 | return true;
|
4349 | throw new Error(`Required a safe ${type}, got a ${actualType} (see http://g.co/ng/security#xss)`);
|
4350 | }
|
4351 | return actualType === type;
|
4352 | }
|
4353 | function getSanitizationBypassType(value) {
|
4354 | return value instanceof SafeValueImpl && value.getTypeName() || null;
|
4355 | }
|
4356 |
|
4357 |
|
4358 |
|
4359 |
|
4360 |
|
4361 |
|
4362 |
|
4363 |
|
4364 |
|
4365 | function bypassSanitizationTrustHtml(trustedHtml) {
|
4366 | return new SafeHtmlImpl(trustedHtml);
|
4367 | }
|
4368 |
|
4369 |
|
4370 |
|
4371 |
|
4372 |
|
4373 |
|
4374 |
|
4375 |
|
4376 |
|
4377 | function bypassSanitizationTrustStyle(trustedStyle) {
|
4378 | return new SafeStyleImpl(trustedStyle);
|
4379 | }
|
4380 |
|
4381 |
|
4382 |
|
4383 |
|
4384 |
|
4385 |
|
4386 |
|
4387 |
|
4388 |
|
4389 | function bypassSanitizationTrustScript(trustedScript) {
|
4390 | return new SafeScriptImpl(trustedScript);
|
4391 | }
|
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 |
|
4400 |
|
4401 | function bypassSanitizationTrustUrl(trustedUrl) {
|
4402 | return new SafeUrlImpl(trustedUrl);
|
4403 | }
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 |
|
4410 |
|
4411 |
|
4412 |
|
4413 | function bypassSanitizationTrustResourceUrl(trustedResourceUrl) {
|
4414 | return new SafeResourceUrlImpl(trustedResourceUrl);
|
4415 | }
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 |
|
4421 |
|
4422 |
|
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 |
|
4428 |
|
4429 |
|
4430 | let _devMode = true;
|
4431 | let _runModeLocked = false;
|
4432 |
|
4433 |
|
4434 |
|
4435 |
|
4436 |
|
4437 |
|
4438 |
|
4439 |
|
4440 | function isDevMode() {
|
4441 | _runModeLocked = true;
|
4442 | return _devMode;
|
4443 | }
|
4444 |
|
4445 |
|
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 |
|
4452 |
|
4453 |
|
4454 | function enableProdMode() {
|
4455 | if (_runModeLocked) {
|
4456 | throw new Error('Cannot enable prod mode after platform setup.');
|
4457 | }
|
4458 | _devMode = false;
|
4459 | }
|
4460 |
|
4461 |
|
4462 |
|
4463 |
|
4464 |
|
4465 |
|
4466 |
|
4467 |
|
4468 |
|
4469 |
|
4470 |
|
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 | function getInertBodyHelper(defaultDoc) {
|
4476 | return isDOMParserAvailable() ? new DOMParserHelper() : new InertDocumentHelper(defaultDoc);
|
4477 | }
|
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 | class DOMParserHelper {
|
4483 | getInertBodyElement(html) {
|
4484 |
|
4485 |
|
4486 |
|
4487 | html = '<body><remove></remove>' + html + '</body>';
|
4488 | try {
|
4489 | const body = new window.DOMParser().parseFromString(html, 'text/html').body;
|
4490 | body.removeChild(body.firstChild);
|
4491 | return body;
|
4492 | }
|
4493 | catch (_a) {
|
4494 | return null;
|
4495 | }
|
4496 | }
|
4497 | }
|
4498 |
|
4499 |
|
4500 |
|
4501 |
|
4502 |
|
4503 | class InertDocumentHelper {
|
4504 | constructor(defaultDoc) {
|
4505 | this.defaultDoc = defaultDoc;
|
4506 | this.inertDocument = this.defaultDoc.implementation.createHTMLDocument('sanitization-inert');
|
4507 | if (this.inertDocument.body == null) {
|
4508 |
|
4509 |
|
4510 | const inertHtml = this.inertDocument.createElement('html');
|
4511 | this.inertDocument.appendChild(inertHtml);
|
4512 | const inertBodyElement = this.inertDocument.createElement('body');
|
4513 | inertHtml.appendChild(inertBodyElement);
|
4514 | }
|
4515 | }
|
4516 | getInertBodyElement(html) {
|
4517 |
|
4518 | const templateEl = this.inertDocument.createElement('template');
|
4519 | if ('content' in templateEl) {
|
4520 | templateEl.innerHTML = html;
|
4521 | return templateEl;
|
4522 | }
|
4523 |
|
4524 |
|
4525 |
|
4526 |
|
4527 |
|
4528 |
|
4529 |
|
4530 | const inertBody = this.inertDocument.createElement('body');
|
4531 | inertBody.innerHTML = html;
|
4532 |
|
4533 |
|
4534 | if (this.defaultDoc.documentMode) {
|
4535 | this.stripCustomNsAttrs(inertBody);
|
4536 | }
|
4537 | return inertBody;
|
4538 | }
|
4539 | |
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 | stripCustomNsAttrs(el) {
|
4548 | const elAttrs = el.attributes;
|
4549 |
|
4550 | for (let i = elAttrs.length - 1; 0 < i; i--) {
|
4551 | const attrib = elAttrs.item(i);
|
4552 | const attrName = attrib.name;
|
4553 | if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
|
4554 | el.removeAttribute(attrName);
|
4555 | }
|
4556 | }
|
4557 | let childNode = el.firstChild;
|
4558 | while (childNode) {
|
4559 | if (childNode.nodeType === Node.ELEMENT_NODE)
|
4560 | this.stripCustomNsAttrs(childNode);
|
4561 | childNode = childNode.nextSibling;
|
4562 | }
|
4563 | }
|
4564 | }
|
4565 |
|
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 |
|
4572 | function isDOMParserAvailable() {
|
4573 | try {
|
4574 | return !!new window.DOMParser().parseFromString('', 'text/html');
|
4575 | }
|
4576 | catch (_a) {
|
4577 | return false;
|
4578 | }
|
4579 | }
|
4580 |
|
4581 |
|
4582 |
|
4583 |
|
4584 |
|
4585 |
|
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 |
|
4591 |
|
4592 |
|
4593 |
|
4594 |
|
4595 |
|
4596 |
|
4597 |
|
4598 |
|
4599 |
|
4600 |
|
4601 |
|
4602 |
|
4603 |
|
4604 |
|
4605 |
|
4606 |
|
4607 |
|
4608 |
|
4609 |
|
4610 |
|
4611 |
|
4612 |
|
4613 |
|
4614 | const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
|
4615 |
|
4616 | const SAFE_SRCSET_PATTERN = /^(?:(?:https?|file):|[^&:/?#]*(?:[/?#]|$))/gi;
|
4617 |
|
4618 | const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i;
|
4619 | function _sanitizeUrl(url) {
|
4620 | url = String(url);
|
4621 | if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN))
|
4622 | return url;
|
4623 | if (isDevMode()) {
|
4624 | console.warn(`WARNING: sanitizing unsafe URL value ${url} (see http://g.co/ng/security#xss)`);
|
4625 | }
|
4626 | return 'unsafe:' + url;
|
4627 | }
|
4628 | function sanitizeSrcset(srcset) {
|
4629 | srcset = String(srcset);
|
4630 | return srcset.split(',').map((srcset) => _sanitizeUrl(srcset.trim())).join(', ');
|
4631 | }
|
4632 |
|
4633 |
|
4634 |
|
4635 |
|
4636 |
|
4637 |
|
4638 |
|
4639 |
|
4640 | function tagSet(tags) {
|
4641 | const res = {};
|
4642 | for (const t of tags.split(','))
|
4643 | res[t] = true;
|
4644 | return res;
|
4645 | }
|
4646 | function merge(...sets) {
|
4647 | const res = {};
|
4648 | for (const s of sets) {
|
4649 | for (const v in s) {
|
4650 | if (s.hasOwnProperty(v))
|
4651 | res[v] = true;
|
4652 | }
|
4653 | }
|
4654 | return res;
|
4655 | }
|
4656 |
|
4657 |
|
4658 |
|
4659 |
|
4660 |
|
4661 | const VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr');
|
4662 |
|
4663 |
|
4664 | const OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr');
|
4665 | const OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt');
|
4666 | const OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
|
4667 |
|
4668 | const BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' +
|
4669 | 'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
|
4670 | 'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul'));
|
4671 |
|
4672 | const INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' +
|
4673 | 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' +
|
4674 | 'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video'));
|
4675 | const VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
|
4676 |
|
4677 | const URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href');
|
4678 |
|
4679 | const SRCSET_ATTRS = tagSet('srcset');
|
4680 | const HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +
|
4681 | 'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +
|
4682 | 'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +
|
4683 | 'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +
|
4684 | 'valign,value,vspace,width');
|
4685 |
|
4686 | const ARIA_ATTRS = tagSet('aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,' +
|
4687 | 'aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,' +
|
4688 | 'aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,' +
|
4689 | 'aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,' +
|
4690 | 'aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,' +
|
4691 | 'aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,' +
|
4692 | 'aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext');
|
4693 |
|
4694 |
|
4695 |
|
4696 |
|
4697 |
|
4698 |
|
4699 | const VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS, ARIA_ATTRS);
|
4700 |
|
4701 |
|
4702 |
|
4703 |
|
4704 |
|
4705 | const SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS = tagSet('script,style,template');
|
4706 |
|
4707 |
|
4708 |
|
4709 |
|
4710 | class SanitizingHtmlSerializer {
|
4711 | constructor() {
|
4712 |
|
4713 |
|
4714 | this.sanitizedSomething = false;
|
4715 | this.buf = [];
|
4716 | }
|
4717 | sanitizeChildren(el) {
|
4718 |
|
4719 |
|
4720 |
|
4721 | let current = el.firstChild;
|
4722 | let traverseContent = true;
|
4723 | while (current) {
|
4724 | if (current.nodeType === Node.ELEMENT_NODE) {
|
4725 | traverseContent = this.startElement(current);
|
4726 | }
|
4727 | else if (current.nodeType === Node.TEXT_NODE) {
|
4728 | this.chars(current.nodeValue);
|
4729 | }
|
4730 | else {
|
4731 |
|
4732 | this.sanitizedSomething = true;
|
4733 | }
|
4734 | if (traverseContent && current.firstChild) {
|
4735 | current = current.firstChild;
|
4736 | continue;
|
4737 | }
|
4738 | while (current) {
|
4739 |
|
4740 | if (current.nodeType === Node.ELEMENT_NODE) {
|
4741 | this.endElement(current);
|
4742 | }
|
4743 | let next = this.checkClobberedElement(current, current.nextSibling);
|
4744 | if (next) {
|
4745 | current = next;
|
4746 | break;
|
4747 | }
|
4748 | current = this.checkClobberedElement(current, current.parentNode);
|
4749 | }
|
4750 | }
|
4751 | return this.buf.join('');
|
4752 | }
|
4753 | |
4754 |
|
4755 |
|
4756 |
|
4757 |
|
4758 |
|
4759 |
|
4760 |
|
4761 | startElement(element) {
|
4762 | const tagName = element.nodeName.toLowerCase();
|
4763 | if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
|
4764 | this.sanitizedSomething = true;
|
4765 | return !SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS.hasOwnProperty(tagName);
|
4766 | }
|
4767 | this.buf.push('<');
|
4768 | this.buf.push(tagName);
|
4769 | const elAttrs = element.attributes;
|
4770 | for (let i = 0; i < elAttrs.length; i++) {
|
4771 | const elAttr = elAttrs.item(i);
|
4772 | const attrName = elAttr.name;
|
4773 | const lower = attrName.toLowerCase();
|
4774 | if (!VALID_ATTRS.hasOwnProperty(lower)) {
|
4775 | this.sanitizedSomething = true;
|
4776 | continue;
|
4777 | }
|
4778 | let value = elAttr.value;
|
4779 |
|
4780 | if (URI_ATTRS[lower])
|
4781 | value = _sanitizeUrl(value);
|
4782 | if (SRCSET_ATTRS[lower])
|
4783 | value = sanitizeSrcset(value);
|
4784 | this.buf.push(' ', attrName, '="', encodeEntities(value), '"');
|
4785 | }
|
4786 | this.buf.push('>');
|
4787 | return true;
|
4788 | }
|
4789 | endElement(current) {
|
4790 | const tagName = current.nodeName.toLowerCase();
|
4791 | if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
|
4792 | this.buf.push('</');
|
4793 | this.buf.push(tagName);
|
4794 | this.buf.push('>');
|
4795 | }
|
4796 | }
|
4797 | chars(chars) {
|
4798 | this.buf.push(encodeEntities(chars));
|
4799 | }
|
4800 | checkClobberedElement(node, nextNode) {
|
4801 | if (nextNode &&
|
4802 | (node.compareDocumentPosition(nextNode) &
|
4803 | Node.DOCUMENT_POSITION_CONTAINED_BY) === Node.DOCUMENT_POSITION_CONTAINED_BY) {
|
4804 | throw new Error(`Failed to sanitize html because the element is clobbered: ${node.outerHTML}`);
|
4805 | }
|
4806 | return nextNode;
|
4807 | }
|
4808 | }
|
4809 |
|
4810 | const SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
4811 |
|
4812 | const NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
|
4813 |
|
4814 |
|
4815 |
|
4816 |
|
4817 |
|
4818 |
|
4819 | function encodeEntities(value) {
|
4820 | return value.replace(/&/g, '&')
|
4821 | .replace(SURROGATE_PAIR_REGEXP, function (match) {
|
4822 | const hi = match.charCodeAt(0);
|
4823 | const low = match.charCodeAt(1);
|
4824 | return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
4825 | })
|
4826 | .replace(NON_ALPHANUMERIC_REGEXP, function (match) {
|
4827 | return '&#' + match.charCodeAt(0) + ';';
|
4828 | })
|
4829 | .replace(/</g, '<')
|
4830 | .replace(/>/g, '>');
|
4831 | }
|
4832 | let inertBodyHelper;
|
4833 |
|
4834 |
|
4835 |
|
4836 |
|
4837 | function _sanitizeHtml(defaultDoc, unsafeHtmlInput) {
|
4838 | let inertBodyElement = null;
|
4839 | try {
|
4840 | inertBodyHelper = inertBodyHelper || getInertBodyHelper(defaultDoc);
|
4841 |
|
4842 | let unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : '';
|
4843 | inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
|
4844 |
|
4845 |
|
4846 | let mXSSAttempts = 5;
|
4847 | let parsedHtml = unsafeHtml;
|
4848 | do {
|
4849 | if (mXSSAttempts === 0) {
|
4850 | throw new Error('Failed to sanitize html because the input is unstable');
|
4851 | }
|
4852 | mXSSAttempts--;
|
4853 | unsafeHtml = parsedHtml;
|
4854 | parsedHtml = inertBodyElement.innerHTML;
|
4855 | inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
|
4856 | } while (unsafeHtml !== parsedHtml);
|
4857 | const sanitizer = new SanitizingHtmlSerializer();
|
4858 | const safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement);
|
4859 | if (isDevMode() && sanitizer.sanitizedSomething) {
|
4860 | console.warn('WARNING: sanitizing HTML stripped some content, see http://g.co/ng/security#xss');
|
4861 | }
|
4862 | return safeHtml;
|
4863 | }
|
4864 | finally {
|
4865 |
|
4866 | if (inertBodyElement) {
|
4867 | const parent = getTemplateContent(inertBodyElement) || inertBodyElement;
|
4868 | while (parent.firstChild) {
|
4869 | parent.removeChild(parent.firstChild);
|
4870 | }
|
4871 | }
|
4872 | }
|
4873 | }
|
4874 | function getTemplateContent(el) {
|
4875 | return 'content' in el && isTemplateElement(el) ?
|
4876 | el.content :
|
4877 | null;
|
4878 | }
|
4879 | function isTemplateElement(el) {
|
4880 | return el.nodeType === Node.ELEMENT_NODE && el.nodeName === 'TEMPLATE';
|
4881 | }
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 | var SecurityContext;
|
4900 | (function (SecurityContext) {
|
4901 | SecurityContext[SecurityContext["NONE"] = 0] = "NONE";
|
4902 | SecurityContext[SecurityContext["HTML"] = 1] = "HTML";
|
4903 | SecurityContext[SecurityContext["STYLE"] = 2] = "STYLE";
|
4904 | SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
|
4905 | SecurityContext[SecurityContext["URL"] = 4] = "URL";
|
4906 | SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
|
4907 | })(SecurityContext || (SecurityContext = {}));
|
4908 |
|
4909 |
|
4910 |
|
4911 |
|
4912 |
|
4913 |
|
4914 |
|
4915 |
|
4916 |
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 |
|
4926 |
|
4927 |
|
4928 |
|
4929 |
|
4930 |
|
4931 | function ɵɵsanitizeHtml(unsafeHtml) {
|
4932 | const sanitizer = getSanitizer();
|
4933 | if (sanitizer) {
|
4934 | return sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || '';
|
4935 | }
|
4936 | if (allowSanitizationBypassAndThrow(unsafeHtml, "HTML" )) {
|
4937 | return unwrapSafeValue(unsafeHtml);
|
4938 | }
|
4939 | return _sanitizeHtml(getDocument(), renderStringify(unsafeHtml));
|
4940 | }
|
4941 |
|
4942 |
|
4943 |
|
4944 |
|
4945 |
|
4946 |
|
4947 |
|
4948 |
|
4949 |
|
4950 |
|
4951 |
|
4952 | function ɵɵsanitizeStyle(unsafeStyle) {
|
4953 | const sanitizer = getSanitizer();
|
4954 | if (sanitizer) {
|
4955 | return sanitizer.sanitize(SecurityContext.STYLE, unsafeStyle) || '';
|
4956 | }
|
4957 | if (allowSanitizationBypassAndThrow(unsafeStyle, "Style" )) {
|
4958 | return unwrapSafeValue(unsafeStyle);
|
4959 | }
|
4960 | return renderStringify(unsafeStyle);
|
4961 | }
|
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 |
|
4967 |
|
4968 |
|
4969 |
|
4970 |
|
4971 |
|
4972 |
|
4973 |
|
4974 |
|
4975 |
|
4976 |
|
4977 |
|
4978 | function ɵɵsanitizeUrl(unsafeUrl) {
|
4979 | const sanitizer = getSanitizer();
|
4980 | if (sanitizer) {
|
4981 | return sanitizer.sanitize(SecurityContext.URL, unsafeUrl) || '';
|
4982 | }
|
4983 | if (allowSanitizationBypassAndThrow(unsafeUrl, "URL" )) {
|
4984 | return unwrapSafeValue(unsafeUrl);
|
4985 | }
|
4986 | return _sanitizeUrl(renderStringify(unsafeUrl));
|
4987 | }
|
4988 |
|
4989 |
|
4990 |
|
4991 |
|
4992 |
|
4993 |
|
4994 |
|
4995 |
|
4996 |
|
4997 |
|
4998 |
|
4999 | function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
|
5000 | const sanitizer = getSanitizer();
|
5001 | if (sanitizer) {
|
5002 | return sanitizer.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || '';
|
5003 | }
|
5004 | if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" )) {
|
5005 | return unwrapSafeValue(unsafeResourceUrl);
|
5006 | }
|
5007 | throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)');
|
5008 | }
|
5009 |
|
5010 |
|
5011 |
|
5012 |
|
5013 |
|
5014 |
|
5015 |
|
5016 |
|
5017 |
|
5018 |
|
5019 |
|
5020 |
|
5021 | function ɵɵsanitizeScript(unsafeScript) {
|
5022 | const sanitizer = getSanitizer();
|
5023 | if (sanitizer) {
|
5024 | return sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || '';
|
5025 | }
|
5026 | if (allowSanitizationBypassAndThrow(unsafeScript, "Script" )) {
|
5027 | return unwrapSafeValue(unsafeScript);
|
5028 | }
|
5029 | throw new Error('unsafe value used in a script context');
|
5030 | }
|
5031 |
|
5032 |
|
5033 |
|
5034 |
|
5035 |
|
5036 |
|
5037 |
|
5038 | function getUrlSanitizer(tag, prop) {
|
5039 | if ((prop === 'src' &&
|
5040 | (tag === 'embed' || tag === 'frame' || tag === 'iframe' || tag === 'media' ||
|
5041 | tag === 'script')) ||
|
5042 | (prop === 'href' && (tag === 'base' || tag === 'link'))) {
|
5043 | return ɵɵsanitizeResourceUrl;
|
5044 | }
|
5045 | return ɵɵsanitizeUrl;
|
5046 | }
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 |
|
5055 |
|
5056 |
|
5057 |
|
5058 |
|
5059 |
|
5060 |
|
5061 |
|
5062 | function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) {
|
5063 | return getUrlSanitizer(tag, prop)(unsafeUrl);
|
5064 | }
|
5065 | function validateAgainstEventProperties(name) {
|
5066 | if (name.toLowerCase().startsWith('on')) {
|
5067 | const msg = `Binding to event property '${name}' is disallowed for security reasons, ` +
|
5068 | `please use (${name.slice(2)})=...` +
|
5069 | `\nIf '${name}' is a directive input, make sure the directive is imported by the` +
|
5070 | ` current module.`;
|
5071 | throw new Error(msg);
|
5072 | }
|
5073 | }
|
5074 | function validateAgainstEventAttributes(name) {
|
5075 | if (name.toLowerCase().startsWith('on')) {
|
5076 | const msg = `Binding to event attribute '${name}' is disallowed for security reasons, ` +
|
5077 | `please use (${name.slice(2)})=...`;
|
5078 | throw new Error(msg);
|
5079 | }
|
5080 | }
|
5081 | function getSanitizer() {
|
5082 | const lView = getLView();
|
5083 | return lView && lView[SANITIZER];
|
5084 | }
|
5085 |
|
5086 |
|
5087 |
|
5088 |
|
5089 |
|
5090 |
|
5091 |
|
5092 |
|
5093 |
|
5094 |
|
5095 |
|
5096 |
|
5097 |
|
5098 |
|
5099 |
|
5100 |
|
5101 |
|
5102 |
|
5103 |
|
5104 |
|
5105 | function createNamedArrayType(name) {
|
5106 |
|
5107 | if (ngDevMode) {
|
5108 | try {
|
5109 |
|
5110 | const FunctionConstructor = createNamedArrayType.constructor;
|
5111 | return (new FunctionConstructor('Array', `return class ${name} extends Array{}`))(Array);
|
5112 | }
|
5113 | catch (e) {
|
5114 |
|
5115 | return Array;
|
5116 | }
|
5117 | }
|
5118 | else {
|
5119 | throw new Error('Looks like we are in \'prod mode\', but we are creating a named Array type, which is wrong! Check your code');
|
5120 | }
|
5121 | }
|
5122 |
|
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 |
|
5128 |
|
5129 |
|
5130 | function normalizeDebugBindingName(name) {
|
5131 |
|
5132 | name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
5133 | return `ng-reflect-${name}`;
|
5134 | }
|
5135 | const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
5136 | function camelCaseToDashCase(input) {
|
5137 | return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
5138 | }
|
5139 | function normalizeDebugBindingValue(value) {
|
5140 | try {
|
5141 |
|
5142 | return value != null ? value.toString().slice(0, 30) : value;
|
5143 | }
|
5144 | catch (e) {
|
5145 | return '[ERROR] Exception while trying to serialize the value';
|
5146 | }
|
5147 | }
|
5148 |
|
5149 |
|
5150 |
|
5151 |
|
5152 |
|
5153 |
|
5154 |
|
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 |
|
5166 |
|
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 |
|
5175 |
|
5176 | function getLContext(target) {
|
5177 | let mpValue = readPatchedData(target);
|
5178 | if (mpValue) {
|
5179 |
|
5180 |
|
5181 | if (Array.isArray(mpValue)) {
|
5182 | const lView = mpValue;
|
5183 | let nodeIndex;
|
5184 | let component = undefined;
|
5185 | let directives = undefined;
|
5186 | if (isComponentInstance(target)) {
|
5187 | nodeIndex = findViaComponent(lView, target);
|
5188 | if (nodeIndex == -1) {
|
5189 | throw new Error('The provided component was not found in the application');
|
5190 | }
|
5191 | component = target;
|
5192 | }
|
5193 | else if (isDirectiveInstance(target)) {
|
5194 | nodeIndex = findViaDirective(lView, target);
|
5195 | if (nodeIndex == -1) {
|
5196 | throw new Error('The provided directive was not found in the application');
|
5197 | }
|
5198 | directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
|
5199 | }
|
5200 | else {
|
5201 | nodeIndex = findViaNativeElement(lView, target);
|
5202 | if (nodeIndex == -1) {
|
5203 | return null;
|
5204 | }
|
5205 | }
|
5206 |
|
5207 |
|
5208 |
|
5209 |
|
5210 | const native = unwrapRNode(lView[nodeIndex]);
|
5211 | const existingCtx = readPatchedData(native);
|
5212 | const context = (existingCtx && !Array.isArray(existingCtx)) ?
|
5213 | existingCtx :
|
5214 | createLContext(lView, nodeIndex, native);
|
5215 |
|
5216 | if (component && context.component === undefined) {
|
5217 | context.component = component;
|
5218 | attachPatchData(context.component, context);
|
5219 | }
|
5220 |
|
5221 | if (directives && context.directives === undefined) {
|
5222 | context.directives = directives;
|
5223 | for (let i = 0; i < directives.length; i++) {
|
5224 | attachPatchData(directives[i], context);
|
5225 | }
|
5226 | }
|
5227 | attachPatchData(context.native, context);
|
5228 | mpValue = context;
|
5229 | }
|
5230 | }
|
5231 | else {
|
5232 | const rElement = target;
|
5233 | ngDevMode && assertDomNode(rElement);
|
5234 |
|
5235 |
|
5236 | let parent = rElement;
|
5237 | while (parent = parent.parentNode) {
|
5238 | const parentContext = readPatchedData(parent);
|
5239 | if (parentContext) {
|
5240 | let lView;
|
5241 | if (Array.isArray(parentContext)) {
|
5242 | lView = parentContext;
|
5243 | }
|
5244 | else {
|
5245 | lView = parentContext.lView;
|
5246 | }
|
5247 |
|
5248 |
|
5249 | if (!lView) {
|
5250 | return null;
|
5251 | }
|
5252 | const index = findViaNativeElement(lView, rElement);
|
5253 | if (index >= 0) {
|
5254 | const native = unwrapRNode(lView[index]);
|
5255 | const context = createLContext(lView, index, native);
|
5256 | attachPatchData(native, context);
|
5257 | mpValue = context;
|
5258 | break;
|
5259 | }
|
5260 | }
|
5261 | }
|
5262 | }
|
5263 | return mpValue || null;
|
5264 | }
|
5265 |
|
5266 |
|
5267 |
|
5268 | function createLContext(lView, nodeIndex, native) {
|
5269 | return {
|
5270 | lView,
|
5271 | nodeIndex,
|
5272 | native,
|
5273 | component: undefined,
|
5274 | directives: undefined,
|
5275 | localRefs: undefined,
|
5276 | };
|
5277 | }
|
5278 |
|
5279 |
|
5280 |
|
5281 |
|
5282 |
|
5283 |
|
5284 | function getComponentViewByInstance(componentInstance) {
|
5285 | let lView = readPatchedData(componentInstance);
|
5286 | let view;
|
5287 | if (Array.isArray(lView)) {
|
5288 | const nodeIndex = findViaComponent(lView, componentInstance);
|
5289 | view = getComponentLViewByIndex(nodeIndex, lView);
|
5290 | const context = createLContext(lView, nodeIndex, view[HOST]);
|
5291 | context.component = componentInstance;
|
5292 | attachPatchData(componentInstance, context);
|
5293 | attachPatchData(context.native, context);
|
5294 | }
|
5295 | else {
|
5296 | const context = lView;
|
5297 | view = getComponentLViewByIndex(context.nodeIndex, context.lView);
|
5298 | }
|
5299 | return view;
|
5300 | }
|
5301 |
|
5302 |
|
5303 |
|
5304 |
|
5305 | function attachPatchData(target, data) {
|
5306 | target[MONKEY_PATCH_KEY_NAME] = data;
|
5307 | }
|
5308 | function isComponentInstance(instance) {
|
5309 | return instance && instance.constructor && instance.constructor.ɵcmp;
|
5310 | }
|
5311 | function isDirectiveInstance(instance) {
|
5312 | return instance && instance.constructor && instance.constructor.ɵdir;
|
5313 | }
|
5314 |
|
5315 |
|
5316 |
|
5317 | function findViaNativeElement(lView, target) {
|
5318 | let tNode = lView[TVIEW].firstChild;
|
5319 | while (tNode) {
|
5320 | const native = getNativeByTNodeOrNull(tNode, lView);
|
5321 | if (native === target) {
|
5322 | return tNode.index;
|
5323 | }
|
5324 | tNode = traverseNextElement(tNode);
|
5325 | }
|
5326 | return -1;
|
5327 | }
|
5328 |
|
5329 |
|
5330 |
|
5331 | function traverseNextElement(tNode) {
|
5332 | if (tNode.child) {
|
5333 | return tNode.child;
|
5334 | }
|
5335 | else if (tNode.next) {
|
5336 | return tNode.next;
|
5337 | }
|
5338 | else {
|
5339 |
|
5340 |
|
5341 |
|
5342 | while (tNode.parent && !tNode.parent.next) {
|
5343 | tNode = tNode.parent;
|
5344 | }
|
5345 | return tNode.parent && tNode.parent.next;
|
5346 | }
|
5347 | }
|
5348 |
|
5349 |
|
5350 |
|
5351 | function findViaComponent(lView, componentInstance) {
|
5352 | const componentIndices = lView[TVIEW].components;
|
5353 | if (componentIndices) {
|
5354 | for (let i = 0; i < componentIndices.length; i++) {
|
5355 | const elementComponentIndex = componentIndices[i];
|
5356 | const componentView = getComponentLViewByIndex(elementComponentIndex, lView);
|
5357 | if (componentView[CONTEXT] === componentInstance) {
|
5358 | return elementComponentIndex;
|
5359 | }
|
5360 | }
|
5361 | }
|
5362 | else {
|
5363 | const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);
|
5364 | const rootComponent = rootComponentView[CONTEXT];
|
5365 | if (rootComponent === componentInstance) {
|
5366 |
|
5367 |
|
5368 | return HEADER_OFFSET;
|
5369 | }
|
5370 | }
|
5371 | return -1;
|
5372 | }
|
5373 |
|
5374 |
|
5375 |
|
5376 | function findViaDirective(lView, directiveInstance) {
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 |
|
5382 | let tNode = lView[TVIEW].firstChild;
|
5383 | while (tNode) {
|
5384 | const directiveIndexStart = tNode.directiveStart;
|
5385 | const directiveIndexEnd = tNode.directiveEnd;
|
5386 | for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {
|
5387 | if (lView[i] === directiveInstance) {
|
5388 | return tNode.index;
|
5389 | }
|
5390 | }
|
5391 | tNode = traverseNextElement(tNode);
|
5392 | }
|
5393 | return -1;
|
5394 | }
|
5395 |
|
5396 |
|
5397 |
|
5398 |
|
5399 |
|
5400 |
|
5401 |
|
5402 |
|
5403 | function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
|
5404 | const tNode = lView[TVIEW].data[nodeIndex];
|
5405 | let directiveStartIndex = tNode.directiveStart;
|
5406 | if (directiveStartIndex == 0)
|
5407 | return EMPTY_ARRAY;
|
5408 | const directiveEndIndex = tNode.directiveEnd;
|
5409 | if (!includeComponents && tNode.flags & 2 )
|
5410 | directiveStartIndex++;
|
5411 | return lView.slice(directiveStartIndex, directiveEndIndex);
|
5412 | }
|
5413 | function getComponentAtNodeIndex(nodeIndex, lView) {
|
5414 | const tNode = lView[TVIEW].data[nodeIndex];
|
5415 | let directiveStartIndex = tNode.directiveStart;
|
5416 | return tNode.flags & 2 ? lView[directiveStartIndex] : null;
|
5417 | }
|
5418 |
|
5419 |
|
5420 |
|
5421 |
|
5422 | function discoverLocalRefs(lView, nodeIndex) {
|
5423 | const tNode = lView[TVIEW].data[nodeIndex];
|
5424 | if (tNode && tNode.localNames) {
|
5425 | const result = {};
|
5426 | let localIndex = tNode.index + 1;
|
5427 | for (let i = 0; i < tNode.localNames.length; i += 2) {
|
5428 | result[tNode.localNames[i]] = lView[localIndex];
|
5429 | localIndex++;
|
5430 | }
|
5431 | return result;
|
5432 | }
|
5433 | return null;
|
5434 | }
|
5435 |
|
5436 |
|
5437 | function throwCyclicDependencyError(token) {
|
5438 | throw new Error(`Cannot instantiate cyclic dependency! ${token}`);
|
5439 | }
|
5440 |
|
5441 | function throwMultipleComponentError(tNode) {
|
5442 | throw new Error(`Multiple components match node with tagname ${tNode.tagName}`);
|
5443 | }
|
5444 | function throwMixedMultiProviderError() {
|
5445 | throw new Error(`Cannot mix multi providers and regular providers`);
|
5446 | }
|
5447 | function throwInvalidProviderError(ngModuleType, providers, provider) {
|
5448 | let ngModuleDetail = '';
|
5449 | if (ngModuleType && providers) {
|
5450 | const providerDetail = providers.map(v => v == provider ? '?' + provider + '?' : '...');
|
5451 | ngModuleDetail =
|
5452 | ` - only instances of Provider and Type are allowed, got: [${providerDetail.join(', ')}]`;
|
5453 | }
|
5454 | throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}'` + ngModuleDetail);
|
5455 | }
|
5456 |
|
5457 | function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName) {
|
5458 | const field = propName ? ` for '${propName}'` : '';
|
5459 | let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value${field}: '${oldValue}'. Current value: '${currValue}'.`;
|
5460 | if (creationMode) {
|
5461 | msg +=
|
5462 | ` It seems like the view has been created after its parent and its children have been dirty checked.` +
|
5463 | ` Has it been created in a change detection hook?`;
|
5464 | }
|
5465 |
|
5466 |
|
5467 | throw new Error(msg);
|
5468 | }
|
5469 | function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) {
|
5470 | const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER);
|
5471 | let oldValue = prefix, newValue = prefix;
|
5472 | for (let i = 0; i < chunks.length; i++) {
|
5473 | const slotIdx = rootIndex + i;
|
5474 | oldValue += `${lView[slotIdx]}${chunks[i]}`;
|
5475 | newValue += `${slotIdx === expressionIndex ? changedValue : lView[slotIdx]}${chunks[i]}`;
|
5476 | }
|
5477 | return { propName, oldValue, newValue };
|
5478 | }
|
5479 |
|
5480 |
|
5481 |
|
5482 |
|
5483 |
|
5484 |
|
5485 |
|
5486 |
|
5487 | function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValue) {
|
5488 | const tData = lView[TVIEW].data;
|
5489 | const metadata = tData[bindingIndex];
|
5490 | if (typeof metadata === 'string') {
|
5491 |
|
5492 | if (metadata.indexOf(INTERPOLATION_DELIMITER) > -1) {
|
5493 | return constructDetailsForInterpolation(lView, bindingIndex, bindingIndex, metadata, newValue);
|
5494 | }
|
5495 |
|
5496 | return { propName: metadata, oldValue, newValue };
|
5497 | }
|
5498 |
|
5499 |
|
5500 |
|
5501 |
|
5502 | if (metadata === null) {
|
5503 | let idx = bindingIndex - 1;
|
5504 | while (typeof tData[idx] !== 'string' && tData[idx + 1] === null) {
|
5505 | idx--;
|
5506 | }
|
5507 | const meta = tData[idx];
|
5508 | if (typeof meta === 'string') {
|
5509 | const matches = meta.match(new RegExp(INTERPOLATION_DELIMITER, 'g'));
|
5510 |
|
5511 |
|
5512 | if (matches && (matches.length - 1) > bindingIndex - idx) {
|
5513 | return constructDetailsForInterpolation(lView, idx, bindingIndex, meta, newValue);
|
5514 | }
|
5515 | }
|
5516 | }
|
5517 | return { propName: undefined, oldValue, newValue };
|
5518 | }
|
5519 |
|
5520 |
|
5521 |
|
5522 |
|
5523 |
|
5524 | const TNodeTypeAsString = [
|
5525 | 'Container',
|
5526 | 'Projection',
|
5527 | 'View',
|
5528 | 'Element',
|
5529 | 'ElementContainer',
|
5530 | 'IcuContainer'
|
5531 | ];
|
5532 |
|
5533 |
|
5534 | const unusedValueExportToPlacateAjd$4 = 1;
|
5535 |
|
5536 |
|
5537 |
|
5538 |
|
5539 |
|
5540 |
|
5541 |
|
5542 |
|
5543 |
|
5544 |
|
5545 |
|
5546 |
|
5547 |
|
5548 |
|
5549 |
|
5550 |
|
5551 |
|
5552 |
|
5553 |
|
5554 |
|
5555 |
|
5556 | function hasClassInput(tNode) {
|
5557 | return (tNode.flags & 16 ) !== 0;
|
5558 | }
|
5559 |
|
5560 |
|
5561 |
|
5562 |
|
5563 |
|
5564 |
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 |
|
5570 |
|
5571 |
|
5572 |
|
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 | function hasStyleInput(tNode) {
|
5581 | return (tNode.flags & 32 ) !== 0;
|
5582 | }
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 |
|
5592 |
|
5593 | const unusedValueExportToPlacateAjd$5 = 1;
|
5594 |
|
5595 |
|
5596 |
|
5597 |
|
5598 |
|
5599 |
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 |
|
5608 |
|
5609 |
|
5610 |
|
5611 |
|
5612 | function classIndexOf(className, classToSearch, startingIndex) {
|
5613 | ngDevMode && assertNotEqual(classToSearch, '', 'can not look for "" string.');
|
5614 | let end = className.length;
|
5615 | while (true) {
|
5616 | const foundIndex = className.indexOf(classToSearch, startingIndex);
|
5617 | if (foundIndex === -1)
|
5618 | return foundIndex;
|
5619 | if (foundIndex === 0 || className.charCodeAt(foundIndex - 1) <= 32 ) {
|
5620 |
|
5621 | const length = classToSearch.length;
|
5622 | if (foundIndex + length === end ||
|
5623 | className.charCodeAt(foundIndex + length) <= 32 ) {
|
5624 |
|
5625 | return foundIndex;
|
5626 | }
|
5627 | }
|
5628 |
|
5629 | startingIndex = foundIndex + 1;
|
5630 | }
|
5631 | }
|
5632 |
|
5633 |
|
5634 |
|
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 |
|
5640 | const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$5;
|
5641 | const NG_TEMPLATE_SELECTOR = 'ng-template';
|
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 |
|
5647 |
|
5648 |
|
5649 |
|
5650 | function isCssClassMatching(attrs, cssClassToMatch, isProjectionMode) {
|
5651 |
|
5652 |
|
5653 |
|
5654 |
|
5655 | ngDevMode &&
|
5656 | assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), 'Class name expected to be lowercase.');
|
5657 | let i = 0;
|
5658 | while (i < attrs.length) {
|
5659 | let item = attrs[i++];
|
5660 | if (isProjectionMode && item === 'class') {
|
5661 | item = attrs[i];
|
5662 | if (classIndexOf(item.toLowerCase(), cssClassToMatch, 0) !== -1) {
|
5663 | return true;
|
5664 | }
|
5665 | }
|
5666 | else if (item === 1 ) {
|
5667 |
|
5668 | while (i < attrs.length && typeof (item = attrs[i++]) == 'string') {
|
5669 |
|
5670 | if (item.toLowerCase() === cssClassToMatch)
|
5671 | return true;
|
5672 | }
|
5673 | return false;
|
5674 | }
|
5675 | }
|
5676 | return false;
|
5677 | }
|
5678 |
|
5679 |
|
5680 |
|
5681 |
|
5682 |
|
5683 | function isInlineTemplate(tNode) {
|
5684 | return tNode.type === 0 && tNode.tagName !== NG_TEMPLATE_SELECTOR;
|
5685 | }
|
5686 |
|
5687 |
|
5688 |
|
5689 |
|
5690 |
|
5691 |
|
5692 |
|
5693 |
|
5694 |
|
5695 |
|
5696 |
|
5697 | function hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) {
|
5698 | const tagNameToCompare = tNode.type === 0 && !isProjectionMode ?
|
5699 | NG_TEMPLATE_SELECTOR :
|
5700 | tNode.tagName;
|
5701 | return currentSelector === tagNameToCompare;
|
5702 | }
|
5703 |
|
5704 |
|
5705 |
|
5706 |
|
5707 |
|
5708 |
|
5709 |
|
5710 |
|
5711 |
|
5712 | function isNodeMatchingSelector(tNode, selector, isProjectionMode) {
|
5713 | ngDevMode && assertDefined(selector[0], 'Selector should have a tag name');
|
5714 | let mode = 4 ;
|
5715 | const nodeAttrs = tNode.attrs || [];
|
5716 |
|
5717 | const nameOnlyMarkerIdx = getNameOnlyMarkerIndex(nodeAttrs);
|
5718 |
|
5719 |
|
5720 | let skipToNextSelector = false;
|
5721 | for (let i = 0; i < selector.length; i++) {
|
5722 | const current = selector[i];
|
5723 | if (typeof current === 'number') {
|
5724 |
|
5725 | if (!skipToNextSelector && !isPositive(mode) && !isPositive(current)) {
|
5726 | return false;
|
5727 | }
|
5728 |
|
5729 |
|
5730 | if (skipToNextSelector && isPositive(current))
|
5731 | continue;
|
5732 | skipToNextSelector = false;
|
5733 | mode = current | (mode & 1 );
|
5734 | continue;
|
5735 | }
|
5736 | if (skipToNextSelector)
|
5737 | continue;
|
5738 | if (mode & 4 ) {
|
5739 | mode = 2 | mode & 1 ;
|
5740 | if (current !== '' && !hasTagAndTypeMatch(tNode, current, isProjectionMode) ||
|
5741 | current === '' && selector.length === 1) {
|
5742 | if (isPositive(mode))
|
5743 | return false;
|
5744 | skipToNextSelector = true;
|
5745 | }
|
5746 | }
|
5747 | else {
|
5748 | const selectorAttrValue = mode & 8 ? current : selector[++i];
|
5749 |
|
5750 |
|
5751 | if ((mode & 8 ) && tNode.attrs !== null) {
|
5752 | if (!isCssClassMatching(tNode.attrs, selectorAttrValue, isProjectionMode)) {
|
5753 | if (isPositive(mode))
|
5754 | return false;
|
5755 | skipToNextSelector = true;
|
5756 | }
|
5757 | continue;
|
5758 | }
|
5759 | const attrName = (mode & 8 ) ? 'class' : current;
|
5760 | const attrIndexInNode = findAttrIndexInNode(attrName, nodeAttrs, isInlineTemplate(tNode), isProjectionMode);
|
5761 | if (attrIndexInNode === -1) {
|
5762 | if (isPositive(mode))
|
5763 | return false;
|
5764 | skipToNextSelector = true;
|
5765 | continue;
|
5766 | }
|
5767 | if (selectorAttrValue !== '') {
|
5768 | let nodeAttrValue;
|
5769 | if (attrIndexInNode > nameOnlyMarkerIdx) {
|
5770 | nodeAttrValue = '';
|
5771 | }
|
5772 | else {
|
5773 | ngDevMode &&
|
5774 | assertNotEqual(nodeAttrs[attrIndexInNode], 0 , 'We do not match directives on namespaced attributes');
|
5775 |
|
5776 |
|
5777 |
|
5778 | nodeAttrValue = nodeAttrs[attrIndexInNode + 1].toLowerCase();
|
5779 | }
|
5780 | const compareAgainstClassName = mode & 8 ? nodeAttrValue : null;
|
5781 | if (compareAgainstClassName &&
|
5782 | classIndexOf(compareAgainstClassName, selectorAttrValue, 0) !== -1 ||
|
5783 | mode & 2 && selectorAttrValue !== nodeAttrValue) {
|
5784 | if (isPositive(mode))
|
5785 | return false;
|
5786 | skipToNextSelector = true;
|
5787 | }
|
5788 | }
|
5789 | }
|
5790 | }
|
5791 | return isPositive(mode) || skipToNextSelector;
|
5792 | }
|
5793 | function isPositive(mode) {
|
5794 | return (mode & 1 ) === 0;
|
5795 | }
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 |
|
5801 |
|
5802 |
|
5803 |
|
5804 |
|
5805 |
|
5806 |
|
5807 |
|
5808 |
|
5809 |
|
5810 |
|
5811 |
|
5812 |
|
5813 |
|
5814 |
|
5815 |
|
5816 |
|
5817 |
|
5818 |
|
5819 |
|
5820 |
|
5821 |
|
5822 |
|
5823 |
|
5824 |
|
5825 | function findAttrIndexInNode(name, attrs, isInlineTemplate, isProjectionMode) {
|
5826 | if (attrs === null)
|
5827 | return -1;
|
5828 | let i = 0;
|
5829 | if (isProjectionMode || !isInlineTemplate) {
|
5830 | let bindingsMode = false;
|
5831 | while (i < attrs.length) {
|
5832 | const maybeAttrName = attrs[i];
|
5833 | if (maybeAttrName === name) {
|
5834 | return i;
|
5835 | }
|
5836 | else if (maybeAttrName === 3 || maybeAttrName === 6 ) {
|
5837 | bindingsMode = true;
|
5838 | }
|
5839 | else if (maybeAttrName === 1 || maybeAttrName === 2 ) {
|
5840 | let value = attrs[++i];
|
5841 |
|
5842 |
|
5843 | while (typeof value === 'string') {
|
5844 | value = attrs[++i];
|
5845 | }
|
5846 | continue;
|
5847 | }
|
5848 | else if (maybeAttrName === 4 ) {
|
5849 |
|
5850 | break;
|
5851 | }
|
5852 | else if (maybeAttrName === 0 ) {
|
5853 |
|
5854 | i += 4;
|
5855 | continue;
|
5856 | }
|
5857 |
|
5858 | i += bindingsMode ? 1 : 2;
|
5859 | }
|
5860 |
|
5861 | return -1;
|
5862 | }
|
5863 | else {
|
5864 | return matchTemplateAttribute(attrs, name);
|
5865 | }
|
5866 | }
|
5867 | function isNodeMatchingSelectorList(tNode, selector, isProjectionMode = false) {
|
5868 | for (let i = 0; i < selector.length; i++) {
|
5869 | if (isNodeMatchingSelector(tNode, selector[i], isProjectionMode)) {
|
5870 | return true;
|
5871 | }
|
5872 | }
|
5873 | return false;
|
5874 | }
|
5875 | function getProjectAsAttrValue(tNode) {
|
5876 | const nodeAttrs = tNode.attrs;
|
5877 | if (nodeAttrs != null) {
|
5878 | const ngProjectAsAttrIdx = nodeAttrs.indexOf(5 );
|
5879 |
|
5880 |
|
5881 | if ((ngProjectAsAttrIdx & 1) === 0) {
|
5882 | return nodeAttrs[ngProjectAsAttrIdx + 1];
|
5883 | }
|
5884 | }
|
5885 | return null;
|
5886 | }
|
5887 | function getNameOnlyMarkerIndex(nodeAttrs) {
|
5888 | for (let i = 0; i < nodeAttrs.length; i++) {
|
5889 | const nodeAttr = nodeAttrs[i];
|
5890 | if (isNameOnlyAttributeMarker(nodeAttr)) {
|
5891 | return i;
|
5892 | }
|
5893 | }
|
5894 | return nodeAttrs.length;
|
5895 | }
|
5896 | function matchTemplateAttribute(attrs, name) {
|
5897 | let i = attrs.indexOf(4 );
|
5898 | if (i > -1) {
|
5899 | i++;
|
5900 | while (i < attrs.length) {
|
5901 | const attr = attrs[i];
|
5902 |
|
5903 |
|
5904 | if (typeof attr === 'number')
|
5905 | return -1;
|
5906 | if (attr === name)
|
5907 | return i;
|
5908 | i++;
|
5909 | }
|
5910 | }
|
5911 | return -1;
|
5912 | }
|
5913 |
|
5914 |
|
5915 |
|
5916 |
|
5917 |
|
5918 | function isSelectorInSelectorList(selector, list) {
|
5919 | selectorListLoop: for (let i = 0; i < list.length; i++) {
|
5920 | const currentSelectorInList = list[i];
|
5921 | if (selector.length !== currentSelectorInList.length) {
|
5922 | continue;
|
5923 | }
|
5924 | for (let j = 0; j < selector.length; j++) {
|
5925 | if (selector[j] !== currentSelectorInList[j]) {
|
5926 | continue selectorListLoop;
|
5927 | }
|
5928 | }
|
5929 | return true;
|
5930 | }
|
5931 | return false;
|
5932 | }
|
5933 | function maybeWrapInNotSelector(isNegativeMode, chunk) {
|
5934 | return isNegativeMode ? ':not(' + chunk.trim() + ')' : chunk;
|
5935 | }
|
5936 | function stringifyCSSSelector(selector) {
|
5937 | let result = selector[0];
|
5938 | let i = 1;
|
5939 | let mode = 2 ;
|
5940 | let currentChunk = '';
|
5941 | let isNegativeMode = false;
|
5942 | while (i < selector.length) {
|
5943 | let valueOrMarker = selector[i];
|
5944 | if (typeof valueOrMarker === 'string') {
|
5945 | if (mode & 2 ) {
|
5946 | const attrValue = selector[++i];
|
5947 | currentChunk +=
|
5948 | '[' + valueOrMarker + (attrValue.length > 0 ? '="' + attrValue + '"' : '') + ']';
|
5949 | }
|
5950 | else if (mode & 8 ) {
|
5951 | currentChunk += '.' + valueOrMarker;
|
5952 | }
|
5953 | else if (mode & 4 ) {
|
5954 | currentChunk += ' ' + valueOrMarker;
|
5955 | }
|
5956 | }
|
5957 | else {
|
5958 |
|
5959 |
|
5960 |
|
5961 |
|
5962 |
|
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 |
|
5968 |
|
5969 |
|
5970 |
|
5971 |
|
5972 |
|
5973 |
|
5974 |
|
5975 | if (currentChunk !== '' && !isPositive(valueOrMarker)) {
|
5976 | result += maybeWrapInNotSelector(isNegativeMode, currentChunk);
|
5977 | currentChunk = '';
|
5978 | }
|
5979 | mode = valueOrMarker;
|
5980 |
|
5981 |
|
5982 | isNegativeMode = isNegativeMode || !isPositive(mode);
|
5983 | }
|
5984 | i++;
|
5985 | }
|
5986 | if (currentChunk !== '') {
|
5987 | result += maybeWrapInNotSelector(isNegativeMode, currentChunk);
|
5988 | }
|
5989 | return result;
|
5990 | }
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 |
|
5998 |
|
5999 |
|
6000 |
|
6001 |
|
6002 |
|
6003 | function stringifyCSSSelectorList(selectorList) {
|
6004 | return selectorList.map(stringifyCSSSelector).join(',');
|
6005 | }
|
6006 |
|
6007 |
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 |
|
6015 |
|
6016 | function extractAttrsAndClassesFromSelector(selector) {
|
6017 | const attrs = [];
|
6018 | const classes = [];
|
6019 | let i = 1;
|
6020 | let mode = 2 ;
|
6021 | while (i < selector.length) {
|
6022 | let valueOrMarker = selector[i];
|
6023 | if (typeof valueOrMarker === 'string') {
|
6024 | if (mode === 2 ) {
|
6025 | if (valueOrMarker !== '') {
|
6026 | attrs.push(valueOrMarker, selector[++i]);
|
6027 | }
|
6028 | }
|
6029 | else if (mode === 8 ) {
|
6030 | classes.push(valueOrMarker);
|
6031 | }
|
6032 | }
|
6033 | else {
|
6034 |
|
6035 |
|
6036 |
|
6037 | if (!isPositive(mode))
|
6038 | break;
|
6039 | mode = valueOrMarker;
|
6040 | }
|
6041 | i++;
|
6042 | }
|
6043 | return { attrs, classes };
|
6044 | }
|
6045 |
|
6046 |
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 |
|
6052 |
|
6053 |
|
6054 | const NO_CHANGE = (typeof ngDevMode === 'undefined' || ngDevMode) ? { __brand__: 'NO_CHANGE' } : {};
|
6055 |
|
6056 |
|
6057 |
|
6058 |
|
6059 |
|
6060 |
|
6061 |
|
6062 |
|
6063 |
|
6064 |
|
6065 |
|
6066 |
|
6067 |
|
6068 | function getLViewParent(lView) {
|
6069 | ngDevMode && assertLView(lView);
|
6070 | const parent = lView[PARENT];
|
6071 | return isLContainer(parent) ? parent[PARENT] : parent;
|
6072 | }
|
6073 |
|
6074 |
|
6075 |
|
6076 |
|
6077 |
|
6078 |
|
6079 | function getRootView(componentOrLView) {
|
6080 | ngDevMode && assertDefined(componentOrLView, 'component');
|
6081 | let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);
|
6082 | while (lView && !(lView[FLAGS] & 512 )) {
|
6083 | lView = getLViewParent(lView);
|
6084 | }
|
6085 | ngDevMode && assertLView(lView);
|
6086 | return lView;
|
6087 | }
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 |
|
6095 | function getRootContext(viewOrComponent) {
|
6096 | const rootView = getRootView(viewOrComponent);
|
6097 | ngDevMode &&
|
6098 | assertDefined(rootView[CONTEXT], 'RootView has no context. Perhaps it is disconnected?');
|
6099 | return rootView[CONTEXT];
|
6100 | }
|
6101 |
|
6102 |
|
6103 |
|
6104 | function getFirstLContainer(lView) {
|
6105 | return getNearestLContainer(lView[CHILD_HEAD]);
|
6106 | }
|
6107 |
|
6108 |
|
6109 |
|
6110 | function getNextLContainer(container) {
|
6111 | return getNearestLContainer(container[NEXT]);
|
6112 | }
|
6113 | function getNearestLContainer(viewOrContainer) {
|
6114 | while (viewOrContainer !== null && !isLContainer(viewOrContainer)) {
|
6115 | viewOrContainer = viewOrContainer[NEXT];
|
6116 | }
|
6117 | return viewOrContainer;
|
6118 | }
|
6119 |
|
6120 |
|
6121 |
|
6122 |
|
6123 |
|
6124 |
|
6125 |
|
6126 |
|
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 |
|
6132 |
|
6133 |
|
6134 |
|
6135 |
|
6136 |
|
6137 |
|
6138 |
|
6139 |
|
6140 |
|
6141 |
|
6142 |
|
6143 |
|
6144 |
|
6145 |
|
6146 |
|
6147 |
|
6148 |
|
6149 |
|
6150 | function ɵɵadvance(delta) {
|
6151 | ngDevMode && assertGreaterThan(delta, 0, 'Can only advance forward');
|
6152 | selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, getCheckNoChangesMode());
|
6153 | }
|
6154 |
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 | function ɵɵselect(index) {
|
6160 |
|
6161 | selectIndexInternal(getTView(), getLView(), index, getCheckNoChangesMode());
|
6162 | }
|
6163 | function selectIndexInternal(tView, lView, index, checkNoChangesMode) {
|
6164 | ngDevMode && assertGreaterThan(index, -1, 'Invalid index');
|
6165 | ngDevMode && assertIndexInRange(lView, index + HEADER_OFFSET);
|
6166 |
|
6167 |
|
6168 | if (!checkNoChangesMode) {
|
6169 | const hooksInitPhaseCompleted = (lView[FLAGS] & 3 ) === 3 ;
|
6170 | if (hooksInitPhaseCompleted) {
|
6171 | const preOrderCheckHooks = tView.preOrderCheckHooks;
|
6172 | if (preOrderCheckHooks !== null) {
|
6173 | executeCheckHooks(lView, preOrderCheckHooks, index);
|
6174 | }
|
6175 | }
|
6176 | else {
|
6177 | const preOrderHooks = tView.preOrderHooks;
|
6178 | if (preOrderHooks !== null) {
|
6179 | executeInitAndCheckHooks(lView, preOrderHooks, 0 , index);
|
6180 | }
|
6181 | }
|
6182 | }
|
6183 |
|
6184 |
|
6185 |
|
6186 |
|
6187 | setSelectedIndex(index);
|
6188 | }
|
6189 |
|
6190 |
|
6191 |
|
6192 |
|
6193 |
|
6194 |
|
6195 |
|
6196 |
|
6197 | function toTStylingRange(prev, next) {
|
6198 | ngDevMode && assertNumberInRange(prev, 0, 32767 );
|
6199 | ngDevMode && assertNumberInRange(next, 0, 32767 );
|
6200 | return (prev << 17 | next << 2 );
|
6201 | }
|
6202 | function getTStylingRangePrev(tStylingRange) {
|
6203 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
6204 | return (tStylingRange >> 17 ) & 32767 ;
|
6205 | }
|
6206 | function getTStylingRangePrevDuplicate(tStylingRange) {
|
6207 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
6208 | return (tStylingRange & 2 ) ==
|
6209 | 2 ;
|
6210 | }
|
6211 | function setTStylingRangePrev(tStylingRange, previous) {
|
6212 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
6213 | ngDevMode && assertNumberInRange(previous, 0, 32767 );
|
6214 | return ((tStylingRange & ~4294836224 ) |
|
6215 | (previous << 17 ));
|
6216 | }
|
6217 | function setTStylingRangePrevDuplicate(tStylingRange) {
|
6218 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
6219 | return (tStylingRange | 2 );
|
6220 | }
|
6221 | function getTStylingRangeNext(tStylingRange) {
|
6222 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
6223 | return (tStylingRange & 131068 ) >> 2 ;
|
6224 | }
|
6225 | function setTStylingRangeNext(tStylingRange, next) {
|
6226 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
6227 | ngDevMode && assertNumberInRange(next, 0, 32767 );
|
6228 | return ((tStylingRange & ~131068 ) |
|
6229 | next << 2 );
|
6230 | }
|
6231 | function getTStylingRangeNextDuplicate(tStylingRange) {
|
6232 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
6233 | return (tStylingRange & 1 ) ===
|
6234 | 1 ;
|
6235 | }
|
6236 | function setTStylingRangeNextDuplicate(tStylingRange) {
|
6237 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
6238 | return (tStylingRange | 1 );
|
6239 | }
|
6240 | function getTStylingRangeTail(tStylingRange) {
|
6241 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
6242 | const next = getTStylingRangeNext(tStylingRange);
|
6243 | return next === 0 ? getTStylingRangePrev(tStylingRange) : next;
|
6244 | }
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 |
|
6253 |
|
6254 |
|
6255 |
|
6256 |
|
6257 |
|
6258 |
|
6259 |
|
6260 |
|
6261 | function attachDebugObject(obj, debug) {
|
6262 | if (ngDevMode) {
|
6263 | Object.defineProperty(obj, 'debug', { value: debug, enumerable: false });
|
6264 | }
|
6265 | else {
|
6266 | throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
|
6267 | }
|
6268 | }
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 | function attachDebugGetter(obj, debugGetter) {
|
6278 | if (ngDevMode) {
|
6279 | Object.defineProperty(obj, 'debug', { get: debugGetter, enumerable: false });
|
6280 | }
|
6281 | else {
|
6282 | throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
|
6283 | }
|
6284 | }
|
6285 |
|
6286 |
|
6287 |
|
6288 |
|
6289 |
|
6290 |
|
6291 |
|
6292 |
|
6293 | const NG_DEV_MODE = ((typeof ngDevMode === 'undefined' || !!ngDevMode) && initNgDevMode());
|
6294 |
|
6295 |
|
6296 |
|
6297 |
|
6298 |
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 |
|
6321 |
|
6322 | let LVIEW_COMPONENT_CACHE;
|
6323 | let LVIEW_EMBEDDED_CACHE;
|
6324 | let LVIEW_ROOT;
|
6325 |
|
6326 |
|
6327 |
|
6328 |
|
6329 |
|
6330 | function cloneToLViewFromTViewBlueprint(tView) {
|
6331 | const debugTView = tView;
|
6332 | const lView = getLViewToClone(debugTView.type, tView.template && tView.template.name);
|
6333 | return lView.concat(tView.blueprint);
|
6334 | }
|
6335 | function getLViewToClone(type, name) {
|
6336 | switch (type) {
|
6337 | case 0 :
|
6338 | if (LVIEW_ROOT === undefined)
|
6339 | LVIEW_ROOT = new (createNamedArrayType('LRootView'))();
|
6340 | return LVIEW_ROOT;
|
6341 | case 1 :
|
6342 | if (LVIEW_COMPONENT_CACHE === undefined)
|
6343 | LVIEW_COMPONENT_CACHE = new Map();
|
6344 | let componentArray = LVIEW_COMPONENT_CACHE.get(name);
|
6345 | if (componentArray === undefined) {
|
6346 | componentArray = new (createNamedArrayType('LComponentView' + nameSuffix(name)))();
|
6347 | LVIEW_COMPONENT_CACHE.set(name, componentArray);
|
6348 | }
|
6349 | return componentArray;
|
6350 | case 2 :
|
6351 | if (LVIEW_EMBEDDED_CACHE === undefined)
|
6352 | LVIEW_EMBEDDED_CACHE = new Map();
|
6353 | let embeddedArray = LVIEW_EMBEDDED_CACHE.get(name);
|
6354 | if (embeddedArray === undefined) {
|
6355 | embeddedArray = new (createNamedArrayType('LEmbeddedView' + nameSuffix(name)))();
|
6356 | LVIEW_EMBEDDED_CACHE.set(name, embeddedArray);
|
6357 | }
|
6358 | return embeddedArray;
|
6359 | }
|
6360 | throw new Error('unreachable code');
|
6361 | }
|
6362 | function nameSuffix(text) {
|
6363 | if (text == null)
|
6364 | return '';
|
6365 | const index = text.lastIndexOf('_Template');
|
6366 | return '_' + (index === -1 ? text : text.substr(0, index));
|
6367 | }
|
6368 |
|
6369 |
|
6370 |
|
6371 |
|
6372 |
|
6373 | const TViewConstructor = class TView {
|
6374 | constructor(type, //
|
6375 | id, //
|
6376 | blueprint, //
|
6377 | template, //
|
6378 | queries, //
|
6379 | viewQuery, //
|
6380 | node, //
|
6381 | data, //
|
6382 | bindingStartIndex, //
|
6383 | expandoStartIndex, //
|
6384 | expandoInstructions, //
|
6385 | firstCreatePass, //
|
6386 | firstUpdatePass, //
|
6387 | staticViewQueries, //
|
6388 | staticContentQueries, //
|
6389 | preOrderHooks, //
|
6390 | preOrderCheckHooks, //
|
6391 | contentHooks, //
|
6392 | contentCheckHooks, //
|
6393 | viewHooks, //
|
6394 | viewCheckHooks, //
|
6395 | destroyHooks, //
|
6396 | cleanup, //
|
6397 | contentQueries, //
|
6398 | components, //
|
6399 | directiveRegistry, //
|
6400 | pipeRegistry, //
|
6401 | firstChild, //
|
6402 | schemas, //
|
6403 | consts, //
|
6404 | incompleteFirstPass, //
|
6405 | _decls, //
|
6406 | _vars) {
|
6407 | this.type = type;
|
6408 | this.id = id;
|
6409 | this.blueprint = blueprint;
|
6410 | this.template = template;
|
6411 | this.queries = queries;
|
6412 | this.viewQuery = viewQuery;
|
6413 | this.node = node;
|
6414 | this.data = data;
|
6415 | this.bindingStartIndex = bindingStartIndex;
|
6416 | this.expandoStartIndex = expandoStartIndex;
|
6417 | this.expandoInstructions = expandoInstructions;
|
6418 | this.firstCreatePass = firstCreatePass;
|
6419 | this.firstUpdatePass = firstUpdatePass;
|
6420 | this.staticViewQueries = staticViewQueries;
|
6421 | this.staticContentQueries = staticContentQueries;
|
6422 | this.preOrderHooks = preOrderHooks;
|
6423 | this.preOrderCheckHooks = preOrderCheckHooks;
|
6424 | this.contentHooks = contentHooks;
|
6425 | this.contentCheckHooks = contentCheckHooks;
|
6426 | this.viewHooks = viewHooks;
|
6427 | this.viewCheckHooks = viewCheckHooks;
|
6428 | this.destroyHooks = destroyHooks;
|
6429 | this.cleanup = cleanup;
|
6430 | this.contentQueries = contentQueries;
|
6431 | this.components = components;
|
6432 | this.directiveRegistry = directiveRegistry;
|
6433 | this.pipeRegistry = pipeRegistry;
|
6434 | this.firstChild = firstChild;
|
6435 | this.schemas = schemas;
|
6436 | this.consts = consts;
|
6437 | this.incompleteFirstPass = incompleteFirstPass;
|
6438 | this._decls = _decls;
|
6439 | this._vars = _vars;
|
6440 | }
|
6441 | get template_() {
|
6442 | const buf = [];
|
6443 | processTNodeChildren(this.firstChild, buf);
|
6444 | return buf.join('');
|
6445 | }
|
6446 | };
|
6447 | class TNode {
|
6448 | constructor(tView_, //
|
6449 | type, //
|
6450 | index, //
|
6451 | injectorIndex, //
|
6452 | directiveStart, //
|
6453 | directiveEnd, //
|
6454 | directiveStylingLast, //
|
6455 | propertyBindings, //
|
6456 | flags, //
|
6457 | providerIndexes, //
|
6458 | tagName, //
|
6459 | attrs, //
|
6460 | mergedAttrs, //
|
6461 | localNames, //
|
6462 | initialInputs, //
|
6463 | inputs, //
|
6464 | outputs, //
|
6465 | tViews, //
|
6466 | next, //
|
6467 | projectionNext, //
|
6468 | child, //
|
6469 | parent, //
|
6470 | projection, //
|
6471 | styles, //
|
6472 | stylesWithoutHost, //
|
6473 | residualStyles, //
|
6474 | classes, //
|
6475 | classesWithoutHost, //
|
6476 | residualClasses, //
|
6477 | classBindings, //
|
6478 | styleBindings) {
|
6479 | this.tView_ = tView_;
|
6480 | this.type = type;
|
6481 | this.index = index;
|
6482 | this.injectorIndex = injectorIndex;
|
6483 | this.directiveStart = directiveStart;
|
6484 | this.directiveEnd = directiveEnd;
|
6485 | this.directiveStylingLast = directiveStylingLast;
|
6486 | this.propertyBindings = propertyBindings;
|
6487 | this.flags = flags;
|
6488 | this.providerIndexes = providerIndexes;
|
6489 | this.tagName = tagName;
|
6490 | this.attrs = attrs;
|
6491 | this.mergedAttrs = mergedAttrs;
|
6492 | this.localNames = localNames;
|
6493 | this.initialInputs = initialInputs;
|
6494 | this.inputs = inputs;
|
6495 | this.outputs = outputs;
|
6496 | this.tViews = tViews;
|
6497 | this.next = next;
|
6498 | this.projectionNext = projectionNext;
|
6499 | this.child = child;
|
6500 | this.parent = parent;
|
6501 | this.projection = projection;
|
6502 | this.styles = styles;
|
6503 | this.stylesWithoutHost = stylesWithoutHost;
|
6504 | this.residualStyles = residualStyles;
|
6505 | this.classes = classes;
|
6506 | this.classesWithoutHost = classesWithoutHost;
|
6507 | this.residualClasses = residualClasses;
|
6508 | this.classBindings = classBindings;
|
6509 | this.styleBindings = styleBindings;
|
6510 | }
|
6511 | get type_() {
|
6512 | switch (this.type) {
|
6513 | case 0 :
|
6514 | return 'TNodeType.Container';
|
6515 | case 3 :
|
6516 | return 'TNodeType.Element';
|
6517 | case 4 :
|
6518 | return 'TNodeType.ElementContainer';
|
6519 | case 5 :
|
6520 | return 'TNodeType.IcuContainer';
|
6521 | case 1 :
|
6522 | return 'TNodeType.Projection';
|
6523 | case 2 :
|
6524 | return 'TNodeType.View';
|
6525 | default:
|
6526 | return 'TNodeType.???';
|
6527 | }
|
6528 | }
|
6529 | get flags_() {
|
6530 | const flags = [];
|
6531 | if (this.flags & 16 )
|
6532 | flags.push('TNodeFlags.hasClassInput');
|
6533 | if (this.flags & 8 )
|
6534 | flags.push('TNodeFlags.hasContentQuery');
|
6535 | if (this.flags & 32 )
|
6536 | flags.push('TNodeFlags.hasStyleInput');
|
6537 | if (this.flags & 128 )
|
6538 | flags.push('TNodeFlags.hasHostBindings');
|
6539 | if (this.flags & 2 )
|
6540 | flags.push('TNodeFlags.isComponentHost');
|
6541 | if (this.flags & 1 )
|
6542 | flags.push('TNodeFlags.isDirectiveHost');
|
6543 | if (this.flags & 64 )
|
6544 | flags.push('TNodeFlags.isDetached');
|
6545 | if (this.flags & 4 )
|
6546 | flags.push('TNodeFlags.isProjected');
|
6547 | return flags.join('|');
|
6548 | }
|
6549 | get template_() {
|
6550 | const buf = [];
|
6551 | buf.push('<', this.tagName || this.type_);
|
6552 | if (this.attrs) {
|
6553 | for (let i = 0; i < this.attrs.length;) {
|
6554 | const attrName = this.attrs[i++];
|
6555 | if (typeof attrName == 'number') {
|
6556 | break;
|
6557 | }
|
6558 | const attrValue = this.attrs[i++];
|
6559 | buf.push(' ', attrName, '="', attrValue, '"');
|
6560 | }
|
6561 | }
|
6562 | buf.push('>');
|
6563 | processTNodeChildren(this.child, buf);
|
6564 | buf.push('</', this.tagName || this.type_, '>');
|
6565 | return buf.join('');
|
6566 | }
|
6567 | get styleBindings_() {
|
6568 | return toDebugStyleBinding(this, false);
|
6569 | }
|
6570 | get classBindings_() {
|
6571 | return toDebugStyleBinding(this, true);
|
6572 | }
|
6573 | }
|
6574 | const TNodeDebug = TNode;
|
6575 | function toDebugStyleBinding(tNode, isClassBased) {
|
6576 | const tData = tNode.tView_.data;
|
6577 | const bindings = [];
|
6578 | const range = isClassBased ? tNode.classBindings : tNode.styleBindings;
|
6579 | const prev = getTStylingRangePrev(range);
|
6580 | const next = getTStylingRangeNext(range);
|
6581 | let isTemplate = next !== 0;
|
6582 | let cursor = isTemplate ? next : prev;
|
6583 | while (cursor !== 0) {
|
6584 | const itemKey = tData[cursor];
|
6585 | const itemRange = tData[cursor + 1];
|
6586 | bindings.unshift({
|
6587 | key: itemKey,
|
6588 | index: cursor,
|
6589 | isTemplate: isTemplate,
|
6590 | prevDuplicate: getTStylingRangePrevDuplicate(itemRange),
|
6591 | nextDuplicate: getTStylingRangeNextDuplicate(itemRange),
|
6592 | nextIndex: getTStylingRangeNext(itemRange),
|
6593 | prevIndex: getTStylingRangePrev(itemRange),
|
6594 | });
|
6595 | if (cursor === prev)
|
6596 | isTemplate = false;
|
6597 | cursor = getTStylingRangePrev(itemRange);
|
6598 | }
|
6599 | bindings.push((isClassBased ? tNode.residualClasses : tNode.residualStyles) || null);
|
6600 | return bindings;
|
6601 | }
|
6602 | function processTNodeChildren(tNode, buf) {
|
6603 | while (tNode) {
|
6604 | buf.push(tNode.template_);
|
6605 | tNode = tNode.next;
|
6606 | }
|
6607 | }
|
6608 | const TViewData = NG_DEV_MODE && createNamedArrayType('TViewData') || null;
|
6609 | let TVIEWDATA_EMPTY;
|
6610 |
|
6611 |
|
6612 |
|
6613 |
|
6614 |
|
6615 |
|
6616 | function cloneToTViewData(list) {
|
6617 | if (TVIEWDATA_EMPTY === undefined)
|
6618 | TVIEWDATA_EMPTY = new TViewData();
|
6619 | return TVIEWDATA_EMPTY.concat(list);
|
6620 | }
|
6621 | const LViewBlueprint = NG_DEV_MODE && createNamedArrayType('LViewBlueprint') || null;
|
6622 | const MatchesArray = NG_DEV_MODE && createNamedArrayType('MatchesArray') || null;
|
6623 | const TViewComponents = NG_DEV_MODE && createNamedArrayType('TViewComponents') || null;
|
6624 | const TNodeLocalNames = NG_DEV_MODE && createNamedArrayType('TNodeLocalNames') || null;
|
6625 | const TNodeInitialInputs = NG_DEV_MODE && createNamedArrayType('TNodeInitialInputs') || null;
|
6626 | const TNodeInitialData = NG_DEV_MODE && createNamedArrayType('TNodeInitialData') || null;
|
6627 | const LCleanup = NG_DEV_MODE && createNamedArrayType('LCleanup') || null;
|
6628 | const TCleanup = NG_DEV_MODE && createNamedArrayType('TCleanup') || null;
|
6629 | function attachLViewDebug(lView) {
|
6630 | attachDebugObject(lView, new LViewDebug(lView));
|
6631 | }
|
6632 | function attachLContainerDebug(lContainer) {
|
6633 | attachDebugObject(lContainer, new LContainerDebug(lContainer));
|
6634 | }
|
6635 | function toDebug(obj) {
|
6636 | if (obj) {
|
6637 | const debug = obj.debug;
|
6638 | assertDefined(debug, 'Object does not have a debug representation.');
|
6639 | return debug;
|
6640 | }
|
6641 | else {
|
6642 | return obj;
|
6643 | }
|
6644 | }
|
6645 |
|
6646 |
|
6647 |
|
6648 |
|
6649 |
|
6650 |
|
6651 |
|
6652 |
|
6653 |
|
6654 |
|
6655 |
|
6656 | function toHtml(value, includeChildren = false) {
|
6657 | const node = unwrapRNode(value);
|
6658 | if (node) {
|
6659 | switch (node.nodeType) {
|
6660 | case Node.TEXT_NODE:
|
6661 | return node.textContent;
|
6662 | case Node.COMMENT_NODE:
|
6663 | return `<!--${node.textContent}-->`;
|
6664 | case Node.ELEMENT_NODE:
|
6665 | const outerHTML = node.outerHTML;
|
6666 | if (includeChildren) {
|
6667 | return outerHTML;
|
6668 | }
|
6669 | else {
|
6670 | const innerHTML = '>' + node.innerHTML + '<';
|
6671 | return (outerHTML.split(innerHTML)[0]) + '>';
|
6672 | }
|
6673 | }
|
6674 | }
|
6675 | return null;
|
6676 | }
|
6677 | class LViewDebug {
|
6678 | constructor(_raw_lView) {
|
6679 | this._raw_lView = _raw_lView;
|
6680 | }
|
6681 | |
6682 |
|
6683 |
|
6684 | get flags() {
|
6685 | const flags = this._raw_lView[FLAGS];
|
6686 | return {
|
6687 | __raw__flags__: flags,
|
6688 | initPhaseState: flags & 3 ,
|
6689 | creationMode: !!(flags & 4 ),
|
6690 | firstViewPass: !!(flags & 8 ),
|
6691 | checkAlways: !!(flags & 16 ),
|
6692 | dirty: !!(flags & 64 ),
|
6693 | attached: !!(flags & 128 ),
|
6694 | destroyed: !!(flags & 256 ),
|
6695 | isRoot: !!(flags & 512 ),
|
6696 | indexWithinInitPhase: flags >> 11 ,
|
6697 | };
|
6698 | }
|
6699 | get parent() {
|
6700 | return toDebug(this._raw_lView[PARENT]);
|
6701 | }
|
6702 | get hostHTML() {
|
6703 | return toHtml(this._raw_lView[HOST], true);
|
6704 | }
|
6705 | get html() {
|
6706 | return (this.nodes || []).map(node => toHtml(node.native, true)).join('');
|
6707 | }
|
6708 | get context() {
|
6709 | return this._raw_lView[CONTEXT];
|
6710 | }
|
6711 | |
6712 |
|
6713 |
|
6714 |
|
6715 | get nodes() {
|
6716 | const lView = this._raw_lView;
|
6717 | const tNode = lView[TVIEW].firstChild;
|
6718 | return toDebugNodes(tNode, lView);
|
6719 | }
|
6720 | get tView() {
|
6721 | return this._raw_lView[TVIEW];
|
6722 | }
|
6723 | get cleanup() {
|
6724 | return this._raw_lView[CLEANUP];
|
6725 | }
|
6726 | get injector() {
|
6727 | return this._raw_lView[INJECTOR$1];
|
6728 | }
|
6729 | get rendererFactory() {
|
6730 | return this._raw_lView[RENDERER_FACTORY];
|
6731 | }
|
6732 | get renderer() {
|
6733 | return this._raw_lView[RENDERER];
|
6734 | }
|
6735 | get sanitizer() {
|
6736 | return this._raw_lView[SANITIZER];
|
6737 | }
|
6738 | get childHead() {
|
6739 | return toDebug(this._raw_lView[CHILD_HEAD]);
|
6740 | }
|
6741 | get next() {
|
6742 | return toDebug(this._raw_lView[NEXT]);
|
6743 | }
|
6744 | get childTail() {
|
6745 | return toDebug(this._raw_lView[CHILD_TAIL]);
|
6746 | }
|
6747 | get declarationView() {
|
6748 | return toDebug(this._raw_lView[DECLARATION_VIEW]);
|
6749 | }
|
6750 | get queries() {
|
6751 | return this._raw_lView[QUERIES];
|
6752 | }
|
6753 | get tHost() {
|
6754 | return this._raw_lView[T_HOST];
|
6755 | }
|
6756 | get decls() {
|
6757 | const tView = this.tView;
|
6758 | const start = HEADER_OFFSET;
|
6759 | return toLViewRange(this.tView, this._raw_lView, start, start + tView._decls);
|
6760 | }
|
6761 | get vars() {
|
6762 | const tView = this.tView;
|
6763 | const start = HEADER_OFFSET + tView._decls;
|
6764 | return toLViewRange(this.tView, this._raw_lView, start, start + tView._vars);
|
6765 | }
|
6766 | get i18n() {
|
6767 | const tView = this.tView;
|
6768 | const start = HEADER_OFFSET + tView._decls + tView._vars;
|
6769 | return toLViewRange(this.tView, this._raw_lView, start, this.tView.expandoStartIndex);
|
6770 | }
|
6771 | get expando() {
|
6772 | const tView = this.tView;
|
6773 | return toLViewRange(this.tView, this._raw_lView, this.tView.expandoStartIndex, this._raw_lView.length);
|
6774 | }
|
6775 | |
6776 |
|
6777 |
|
6778 | get childViews() {
|
6779 | const childViews = [];
|
6780 | let child = this.childHead;
|
6781 | while (child) {
|
6782 | childViews.push(child);
|
6783 | child = child.next;
|
6784 | }
|
6785 | return childViews;
|
6786 | }
|
6787 | }
|
6788 | function toLViewRange(tView, lView, start, end) {
|
6789 | let content = [];
|
6790 | for (let index = start; index < end; index++) {
|
6791 | content.push({ index: index, t: tView.data[index], l: lView[index] });
|
6792 | }
|
6793 | return { start: start, end: end, length: end - start, content: content };
|
6794 | }
|
6795 |
|
6796 |
|
6797 |
|
6798 |
|
6799 |
|
6800 |
|
6801 | function toDebugNodes(tNode, lView) {
|
6802 | if (tNode) {
|
6803 | const debugNodes = [];
|
6804 | let tNodeCursor = tNode;
|
6805 | while (tNodeCursor) {
|
6806 | debugNodes.push(buildDebugNode(tNodeCursor, lView, tNodeCursor.index));
|
6807 | tNodeCursor = tNodeCursor.next;
|
6808 | }
|
6809 | return debugNodes;
|
6810 | }
|
6811 | else {
|
6812 | return [];
|
6813 | }
|
6814 | }
|
6815 | function buildDebugNode(tNode, lView, nodeIndex) {
|
6816 | const rawValue = lView[nodeIndex];
|
6817 | const native = unwrapRNode(rawValue);
|
6818 | return {
|
6819 | html: toHtml(native),
|
6820 | type: TNodeTypeAsString[tNode.type],
|
6821 | native: native,
|
6822 | children: toDebugNodes(tNode.child, lView),
|
6823 | };
|
6824 | }
|
6825 | class LContainerDebug {
|
6826 | constructor(_raw_lContainer) {
|
6827 | this._raw_lContainer = _raw_lContainer;
|
6828 | }
|
6829 | get hasTransplantedViews() {
|
6830 | return this._raw_lContainer[HAS_TRANSPLANTED_VIEWS];
|
6831 | }
|
6832 | get views() {
|
6833 | return this._raw_lContainer.slice(CONTAINER_HEADER_OFFSET)
|
6834 | .map(toDebug);
|
6835 | }
|
6836 | get parent() {
|
6837 | return toDebug(this._raw_lContainer[PARENT]);
|
6838 | }
|
6839 | get movedViews() {
|
6840 | return this._raw_lContainer[MOVED_VIEWS];
|
6841 | }
|
6842 | get host() {
|
6843 | return this._raw_lContainer[HOST];
|
6844 | }
|
6845 | get native() {
|
6846 | return this._raw_lContainer[NATIVE];
|
6847 | }
|
6848 | get next() {
|
6849 | return toDebug(this._raw_lContainer[NEXT]);
|
6850 | }
|
6851 | }
|
6852 |
|
6853 |
|
6854 |
|
6855 |
|
6856 |
|
6857 | function readLViewValue(value) {
|
6858 | while (Array.isArray(value)) {
|
6859 |
|
6860 |
|
6861 | if (value.length >= HEADER_OFFSET - 1)
|
6862 | return value;
|
6863 | value = value[HOST];
|
6864 | }
|
6865 | return null;
|
6866 | }
|
6867 |
|
6868 | const ɵ0$4 = () => Promise.resolve(null);
|
6869 |
|
6870 |
|
6871 |
|
6872 |
|
6873 | const _CLEAN_PROMISE = (ɵ0$4)();
|
6874 |
|
6875 |
|
6876 |
|
6877 |
|
6878 |
|
6879 |
|
6880 | function setHostBindingsByExecutingExpandoInstructions(tView, lView) {
|
6881 | ngDevMode && assertSame(tView, lView[TVIEW], '`LView` is not associated with the `TView`!');
|
6882 | try {
|
6883 | const expandoInstructions = tView.expandoInstructions;
|
6884 | if (expandoInstructions !== null) {
|
6885 | let bindingRootIndex = tView.expandoStartIndex;
|
6886 | let currentDirectiveIndex = -1;
|
6887 | let currentElementIndex = -1;
|
6888 |
|
6889 |
|
6890 |
|
6891 |
|
6892 |
|
6893 |
|
6894 |
|
6895 | for (let i = 0; i < expandoInstructions.length; i++) {
|
6896 | const instruction = expandoInstructions[i];
|
6897 | if (typeof instruction === 'number') {
|
6898 | if (instruction <= 0) {
|
6899 |
|
6900 |
|
6901 |
|
6902 |
|
6903 |
|
6904 |
|
6905 |
|
6906 | currentElementIndex = 0 - instruction;
|
6907 | setSelectedIndex(currentElementIndex);
|
6908 |
|
6909 | const providerCount = expandoInstructions[++i];
|
6910 | bindingRootIndex += INJECTOR_BLOOM_PARENT_SIZE + providerCount;
|
6911 | currentDirectiveIndex = bindingRootIndex;
|
6912 | }
|
6913 | else {
|
6914 |
|
6915 |
|
6916 |
|
6917 | bindingRootIndex += instruction;
|
6918 | }
|
6919 | }
|
6920 | else {
|
6921 |
|
6922 | if (instruction !== null) {
|
6923 | ngDevMode &&
|
6924 | assertLessThan(currentDirectiveIndex, 1048576 , 'Reached the max number of host bindings');
|
6925 | setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex);
|
6926 | const hostCtx = lView[currentDirectiveIndex];
|
6927 | instruction(2 , hostCtx);
|
6928 | }
|
6929 |
|
6930 |
|
6931 |
|
6932 |
|
6933 |
|
6934 |
|
6935 | currentDirectiveIndex++;
|
6936 | }
|
6937 | }
|
6938 | }
|
6939 | }
|
6940 | finally {
|
6941 | setSelectedIndex(-1);
|
6942 | }
|
6943 | }
|
6944 |
|
6945 | function refreshContentQueries(tView, lView) {
|
6946 | const contentQueries = tView.contentQueries;
|
6947 | if (contentQueries !== null) {
|
6948 | for (let i = 0; i < contentQueries.length; i += 2) {
|
6949 | const queryStartIdx = contentQueries[i];
|
6950 | const directiveDefIdx = contentQueries[i + 1];
|
6951 | if (directiveDefIdx !== -1) {
|
6952 | const directiveDef = tView.data[directiveDefIdx];
|
6953 | ngDevMode &&
|
6954 | assertDefined(directiveDef.contentQueries, 'contentQueries function should be defined');
|
6955 | setCurrentQueryIndex(queryStartIdx);
|
6956 | directiveDef.contentQueries(2 , lView[directiveDefIdx], directiveDefIdx);
|
6957 | }
|
6958 | }
|
6959 | }
|
6960 | }
|
6961 |
|
6962 | function refreshChildComponents(hostLView, components) {
|
6963 | for (let i = 0; i < components.length; i++) {
|
6964 | refreshComponent(hostLView, components[i]);
|
6965 | }
|
6966 | }
|
6967 |
|
6968 | function renderChildComponents(hostLView, components) {
|
6969 | for (let i = 0; i < components.length; i++) {
|
6970 | renderComponent(hostLView, components[i]);
|
6971 | }
|
6972 | }
|
6973 |
|
6974 |
|
6975 |
|
6976 |
|
6977 |
|
6978 |
|
6979 | function elementCreate(name, renderer, namespace) {
|
6980 | if (isProceduralRenderer(renderer)) {
|
6981 | return renderer.createElement(name, namespace);
|
6982 | }
|
6983 | else {
|
6984 | return namespace === null ? renderer.createElement(name) :
|
6985 | renderer.createElementNS(namespace, name);
|
6986 | }
|
6987 | }
|
6988 | function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector) {
|
6989 | const lView = ngDevMode ? cloneToLViewFromTViewBlueprint(tView) : tView.blueprint.slice();
|
6990 | lView[HOST] = host;
|
6991 | lView[FLAGS] = flags | 4 | 128 | 8 ;
|
6992 | resetPreOrderHookFlags(lView);
|
6993 | lView[PARENT] = lView[DECLARATION_VIEW] = parentLView;
|
6994 | lView[CONTEXT] = context;
|
6995 | lView[RENDERER_FACTORY] = (rendererFactory || parentLView && parentLView[RENDERER_FACTORY]);
|
6996 | ngDevMode && assertDefined(lView[RENDERER_FACTORY], 'RendererFactory is required');
|
6997 | lView[RENDERER] = (renderer || parentLView && parentLView[RENDERER]);
|
6998 | ngDevMode && assertDefined(lView[RENDERER], 'Renderer is required');
|
6999 | lView[SANITIZER] = sanitizer || parentLView && parentLView[SANITIZER] || null;
|
7000 | lView[INJECTOR$1] = injector || parentLView && parentLView[INJECTOR$1] || null;
|
7001 | lView[T_HOST] = tHostNode;
|
7002 | ngDevMode &&
|
7003 | assertEqual(tView.type == 2 ? parentLView !== null : true, true, 'Embedded views must have parentLView');
|
7004 | lView[DECLARATION_COMPONENT_VIEW] =
|
7005 | tView.type == 2 ? parentLView[DECLARATION_COMPONENT_VIEW] : lView;
|
7006 | ngDevMode && attachLViewDebug(lView);
|
7007 | return lView;
|
7008 | }
|
7009 | function getOrCreateTNode(tView, tHostNode, index, type, name, attrs) {
|
7010 |
|
7011 | const adjustedIndex = index + HEADER_OFFSET;
|
7012 | const tNode = tView.data[adjustedIndex] ||
|
7013 | createTNodeAtIndex(tView, tHostNode, adjustedIndex, type, name, attrs);
|
7014 | setPreviousOrParentTNode(tNode, true);
|
7015 | return tNode;
|
7016 | }
|
7017 | function createTNodeAtIndex(tView, tHostNode, adjustedIndex, type, name, attrs) {
|
7018 | const previousOrParentTNode = getPreviousOrParentTNode();
|
7019 | const isParent = getIsParent();
|
7020 | const parent = isParent ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent;
|
7021 |
|
7022 |
|
7023 | const parentInSameView = parent && parent !== tHostNode;
|
7024 | const tParentNode = parentInSameView ? parent : null;
|
7025 | const tNode = tView.data[adjustedIndex] =
|
7026 | createTNode(tView, tParentNode, type, adjustedIndex, name, attrs);
|
7027 |
|
7028 |
|
7029 |
|
7030 | if (tView.firstChild === null) {
|
7031 | tView.firstChild = tNode;
|
7032 | }
|
7033 | if (previousOrParentTNode) {
|
7034 | if (isParent && previousOrParentTNode.child == null &&
|
7035 | (tNode.parent !== null || previousOrParentTNode.type === 2 )) {
|
7036 |
|
7037 | previousOrParentTNode.child = tNode;
|
7038 | }
|
7039 | else if (!isParent) {
|
7040 | previousOrParentTNode.next = tNode;
|
7041 | }
|
7042 | }
|
7043 | return tNode;
|
7044 | }
|
7045 | function assignTViewNodeToLView(tView, tParentNode, index, lView) {
|
7046 |
|
7047 |
|
7048 | let tNode = tView.node;
|
7049 | if (tNode == null) {
|
7050 | ngDevMode && tParentNode &&
|
7051 | assertNodeOfPossibleTypes(tParentNode, [3 , 0 ]);
|
7052 | tView.node = tNode = createTNode(tView, tParentNode,
|
7053 | 2 , index, null, null);
|
7054 | }
|
7055 | lView[T_HOST] = tNode;
|
7056 | }
|
7057 |
|
7058 |
|
7059 |
|
7060 |
|
7061 |
|
7062 |
|
7063 |
|
7064 |
|
7065 |
|
7066 | function allocExpando(tView, lView, numSlotsToAlloc) {
|
7067 | ngDevMode &&
|
7068 | assertGreaterThan(numSlotsToAlloc, 0, 'The number of slots to alloc should be greater than 0');
|
7069 | if (numSlotsToAlloc > 0) {
|
7070 | if (tView.firstCreatePass) {
|
7071 | for (let i = 0; i < numSlotsToAlloc; i++) {
|
7072 | tView.blueprint.push(null);
|
7073 | tView.data.push(null);
|
7074 | lView.push(null);
|
7075 | }
|
7076 |
|
7077 |
|
7078 | if (!tView.expandoInstructions) {
|
7079 | tView.expandoStartIndex += numSlotsToAlloc;
|
7080 | }
|
7081 | else {
|
7082 |
|
7083 |
|
7084 | tView.expandoInstructions.push(numSlotsToAlloc);
|
7085 | }
|
7086 | }
|
7087 | }
|
7088 | }
|
7089 |
|
7090 |
|
7091 |
|
7092 |
|
7093 |
|
7094 |
|
7095 |
|
7096 |
|
7097 |
|
7098 |
|
7099 | function renderView(tView, lView, context) {
|
7100 | ngDevMode && assertEqual(isCreationMode(lView), true, 'Should be run in creation mode');
|
7101 | enterView(lView, lView[T_HOST]);
|
7102 | try {
|
7103 | const viewQuery = tView.viewQuery;
|
7104 | if (viewQuery !== null) {
|
7105 | executeViewQueryFn(1 , viewQuery, context);
|
7106 | }
|
7107 |
|
7108 |
|
7109 | const templateFn = tView.template;
|
7110 | if (templateFn !== null) {
|
7111 | executeTemplate(tView, lView, templateFn, 1 , context);
|
7112 | }
|
7113 |
|
7114 |
|
7115 |
|
7116 |
|
7117 |
|
7118 | if (tView.firstCreatePass) {
|
7119 | tView.firstCreatePass = false;
|
7120 | }
|
7121 |
|
7122 |
|
7123 |
|
7124 | if (tView.staticContentQueries) {
|
7125 | refreshContentQueries(tView, lView);
|
7126 | }
|
7127 |
|
7128 |
|
7129 |
|
7130 | if (tView.staticViewQueries) {
|
7131 | executeViewQueryFn(2 , tView.viewQuery, context);
|
7132 | }
|
7133 |
|
7134 | const components = tView.components;
|
7135 | if (components !== null) {
|
7136 | renderChildComponents(lView, components);
|
7137 | }
|
7138 | }
|
7139 | catch (error) {
|
7140 |
|
7141 |
|
7142 | if (tView.firstCreatePass) {
|
7143 | tView.incompleteFirstPass = true;
|
7144 | }
|
7145 | throw error;
|
7146 | }
|
7147 | finally {
|
7148 | lView[FLAGS] &= ~4 ;
|
7149 | leaveView();
|
7150 | }
|
7151 | }
|
7152 |
|
7153 |
|
7154 |
|
7155 |
|
7156 |
|
7157 |
|
7158 |
|
7159 |
|
7160 | function refreshView(tView, lView, templateFn, context) {
|
7161 | ngDevMode && assertEqual(isCreationMode(lView), false, 'Should be run in update mode');
|
7162 | const flags = lView[FLAGS];
|
7163 | if ((flags & 256 ) === 256 )
|
7164 | return;
|
7165 | enterView(lView, lView[T_HOST]);
|
7166 | const checkNoChangesMode = getCheckNoChangesMode();
|
7167 | try {
|
7168 | resetPreOrderHookFlags(lView);
|
7169 | setBindingIndex(tView.bindingStartIndex);
|
7170 | if (templateFn !== null) {
|
7171 | executeTemplate(tView, lView, templateFn, 2 , context);
|
7172 | }
|
7173 | const hooksInitPhaseCompleted = (flags & 3 ) === 3 ;
|
7174 |
|
7175 |
|
7176 | if (!checkNoChangesMode) {
|
7177 | if (hooksInitPhaseCompleted) {
|
7178 | const preOrderCheckHooks = tView.preOrderCheckHooks;
|
7179 | if (preOrderCheckHooks !== null) {
|
7180 | executeCheckHooks(lView, preOrderCheckHooks, null);
|
7181 | }
|
7182 | }
|
7183 | else {
|
7184 | const preOrderHooks = tView.preOrderHooks;
|
7185 | if (preOrderHooks !== null) {
|
7186 | executeInitAndCheckHooks(lView, preOrderHooks, 0 , null);
|
7187 | }
|
7188 | incrementInitPhaseFlags(lView, 0 );
|
7189 | }
|
7190 | }
|
7191 |
|
7192 |
|
7193 |
|
7194 | markTransplantedViewsForRefresh(lView);
|
7195 | refreshEmbeddedViews(lView);
|
7196 |
|
7197 | if (tView.contentQueries !== null) {
|
7198 | refreshContentQueries(tView, lView);
|
7199 | }
|
7200 |
|
7201 |
|
7202 | if (!checkNoChangesMode) {
|
7203 | if (hooksInitPhaseCompleted) {
|
7204 | const contentCheckHooks = tView.contentCheckHooks;
|
7205 | if (contentCheckHooks !== null) {
|
7206 | executeCheckHooks(lView, contentCheckHooks);
|
7207 | }
|
7208 | }
|
7209 | else {
|
7210 | const contentHooks = tView.contentHooks;
|
7211 | if (contentHooks !== null) {
|
7212 | executeInitAndCheckHooks(lView, contentHooks, 1 );
|
7213 | }
|
7214 | incrementInitPhaseFlags(lView, 1 );
|
7215 | }
|
7216 | }
|
7217 | setHostBindingsByExecutingExpandoInstructions(tView, lView);
|
7218 |
|
7219 | const components = tView.components;
|
7220 | if (components !== null) {
|
7221 | refreshChildComponents(lView, components);
|
7222 | }
|
7223 |
|
7224 |
|
7225 |
|
7226 | const viewQuery = tView.viewQuery;
|
7227 | if (viewQuery !== null) {
|
7228 | executeViewQueryFn(2 , viewQuery, context);
|
7229 | }
|
7230 |
|
7231 |
|
7232 | if (!checkNoChangesMode) {
|
7233 | if (hooksInitPhaseCompleted) {
|
7234 | const viewCheckHooks = tView.viewCheckHooks;
|
7235 | if (viewCheckHooks !== null) {
|
7236 | executeCheckHooks(lView, viewCheckHooks);
|
7237 | }
|
7238 | }
|
7239 | else {
|
7240 | const viewHooks = tView.viewHooks;
|
7241 | if (viewHooks !== null) {
|
7242 | executeInitAndCheckHooks(lView, viewHooks, 2 );
|
7243 | }
|
7244 | incrementInitPhaseFlags(lView, 2 );
|
7245 | }
|
7246 | }
|
7247 | if (tView.firstUpdatePass === true) {
|
7248 |
|
7249 |
|
7250 |
|
7251 |
|
7252 |
|
7253 |
|
7254 | tView.firstUpdatePass = false;
|
7255 | }
|
7256 |
|
7257 |
|
7258 |
|
7259 |
|
7260 |
|
7261 |
|
7262 | if (!checkNoChangesMode) {
|
7263 | lView[FLAGS] &= ~(64 | 8 );
|
7264 | }
|
7265 | if (lView[FLAGS] & 1024 ) {
|
7266 | lView[FLAGS] &= ~1024 ;
|
7267 | updateTransplantedViewCount(lView[PARENT], -1);
|
7268 | }
|
7269 | }
|
7270 | finally {
|
7271 | leaveView();
|
7272 | }
|
7273 | }
|
7274 | function renderComponentOrTemplate(tView, lView, templateFn, context) {
|
7275 | const rendererFactory = lView[RENDERER_FACTORY];
|
7276 | const normalExecutionPath = !getCheckNoChangesMode();
|
7277 | const creationModeIsActive = isCreationMode(lView);
|
7278 | try {
|
7279 | if (normalExecutionPath && !creationModeIsActive && rendererFactory.begin) {
|
7280 | rendererFactory.begin();
|
7281 | }
|
7282 | if (creationModeIsActive) {
|
7283 | renderView(tView, lView, context);
|
7284 | }
|
7285 | refreshView(tView, lView, templateFn, context);
|
7286 | }
|
7287 | finally {
|
7288 | if (normalExecutionPath && !creationModeIsActive && rendererFactory.end) {
|
7289 | rendererFactory.end();
|
7290 | }
|
7291 | }
|
7292 | }
|
7293 | function executeTemplate(tView, lView, templateFn, rf, context) {
|
7294 | const prevSelectedIndex = getSelectedIndex();
|
7295 | try {
|
7296 | setSelectedIndex(-1);
|
7297 | if (rf & 2 && lView.length > HEADER_OFFSET) {
|
7298 |
|
7299 |
|
7300 | selectIndexInternal(tView, lView, 0, getCheckNoChangesMode());
|
7301 | }
|
7302 | templateFn(rf, context);
|
7303 | }
|
7304 | finally {
|
7305 | setSelectedIndex(prevSelectedIndex);
|
7306 | }
|
7307 | }
|
7308 |
|
7309 |
|
7310 |
|
7311 | function executeContentQueries(tView, tNode, lView) {
|
7312 | if (isContentQueryHost(tNode)) {
|
7313 | const start = tNode.directiveStart;
|
7314 | const end = tNode.directiveEnd;
|
7315 | for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
|
7316 | const def = tView.data[directiveIndex];
|
7317 | if (def.contentQueries) {
|
7318 | def.contentQueries(1 , lView[directiveIndex], directiveIndex);
|
7319 | }
|
7320 | }
|
7321 | }
|
7322 | }
|
7323 |
|
7324 |
|
7325 |
|
7326 | function createDirectivesInstances(tView, lView, tNode) {
|
7327 | if (!getBindingsEnabled())
|
7328 | return;
|
7329 | instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView));
|
7330 | if ((tNode.flags & 128 ) === 128 ) {
|
7331 | invokeDirectivesHostBindings(tView, lView, tNode);
|
7332 | }
|
7333 | }
|
7334 |
|
7335 |
|
7336 |
|
7337 |
|
7338 | function saveResolvedLocalsInData(viewData, tNode, localRefExtractor = getNativeByTNode) {
|
7339 | const localNames = tNode.localNames;
|
7340 | if (localNames !== null) {
|
7341 | let localIndex = tNode.index + 1;
|
7342 | for (let i = 0; i < localNames.length; i += 2) {
|
7343 | const index = localNames[i + 1];
|
7344 | const value = index === -1 ?
|
7345 | localRefExtractor(tNode, viewData) :
|
7346 | viewData[index];
|
7347 | viewData[localIndex++] = value;
|
7348 | }
|
7349 | }
|
7350 | }
|
7351 |
|
7352 |
|
7353 |
|
7354 |
|
7355 |
|
7356 |
|
7357 |
|
7358 | function getOrCreateTComponentView(def) {
|
7359 | const tView = def.tView;
|
7360 |
|
7361 |
|
7362 | if (tView === null || tView.incompleteFirstPass) {
|
7363 | return def.tView = createTView(1 , -1, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts);
|
7364 | }
|
7365 | return tView;
|
7366 | }
|
7367 |
|
7368 |
|
7369 |
|
7370 |
|
7371 |
|
7372 |
|
7373 |
|
7374 |
|
7375 |
|
7376 |
|
7377 |
|
7378 |
|
7379 | function createTView(type, viewIndex, templateFn, decls, vars, directives, pipes, viewQuery, schemas, consts) {
|
7380 | ngDevMode && ngDevMode.tView++;
|
7381 | const bindingStartIndex = HEADER_OFFSET + decls;
|
7382 |
|
7383 |
|
7384 |
|
7385 | const initialViewLength = bindingStartIndex + vars;
|
7386 | const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength);
|
7387 | const tView = blueprint[TVIEW] = ngDevMode ?
|
7388 | new TViewConstructor(type, viewIndex,
|
7389 | blueprint,
|
7390 | templateFn,
|
7391 | null,
|
7392 | viewQuery,
|
7393 | null,
|
7394 | cloneToTViewData(blueprint).fill(null, bindingStartIndex),
|
7395 | bindingStartIndex,
|
7396 | initialViewLength,
|
7397 | null,
|
7398 | true,
|
7399 | true,
|
7400 | false,
|
7401 | false,
|
7402 | null,
|
7403 | null,
|
7404 | null,
|
7405 | null,
|
7406 | null,
|
7407 | null,
|
7408 | null,
|
7409 | null,
|
7410 | null,
|
7411 | null,
|
7412 | typeof directives === 'function' ?
|
7413 | directives() :
|
7414 | directives,
|
7415 | typeof pipes === 'function' ? pipes() : pipes,
|
7416 | null,
|
7417 | schemas,
|
7418 | consts,
|
7419 | false,
|
7420 | decls,
|
7421 | vars) :
|
7422 | {
|
7423 | type: type,
|
7424 | id: viewIndex,
|
7425 | blueprint: blueprint,
|
7426 | template: templateFn,
|
7427 | queries: null,
|
7428 | viewQuery: viewQuery,
|
7429 | node: null,
|
7430 | data: blueprint.slice().fill(null, bindingStartIndex),
|
7431 | bindingStartIndex: bindingStartIndex,
|
7432 | expandoStartIndex: initialViewLength,
|
7433 | expandoInstructions: null,
|
7434 | firstCreatePass: true,
|
7435 | firstUpdatePass: true,
|
7436 | staticViewQueries: false,
|
7437 | staticContentQueries: false,
|
7438 | preOrderHooks: null,
|
7439 | preOrderCheckHooks: null,
|
7440 | contentHooks: null,
|
7441 | contentCheckHooks: null,
|
7442 | viewHooks: null,
|
7443 | viewCheckHooks: null,
|
7444 | destroyHooks: null,
|
7445 | cleanup: null,
|
7446 | contentQueries: null,
|
7447 | components: null,
|
7448 | directiveRegistry: typeof directives === 'function' ? directives() : directives,
|
7449 | pipeRegistry: typeof pipes === 'function' ? pipes() : pipes,
|
7450 | firstChild: null,
|
7451 | schemas: schemas,
|
7452 | consts: consts,
|
7453 | incompleteFirstPass: false
|
7454 | };
|
7455 | if (ngDevMode) {
|
7456 |
|
7457 |
|
7458 |
|
7459 | Object.seal(tView);
|
7460 | }
|
7461 | return tView;
|
7462 | }
|
7463 | function createViewBlueprint(bindingStartIndex, initialViewLength) {
|
7464 | const blueprint = ngDevMode ? new LViewBlueprint() : [];
|
7465 | for (let i = 0; i < initialViewLength; i++) {
|
7466 | blueprint.push(i < bindingStartIndex ? null : NO_CHANGE);
|
7467 | }
|
7468 | return blueprint;
|
7469 | }
|
7470 | function createError(text, token) {
|
7471 | return new Error(`Renderer: ${text} [${stringifyForError(token)}]`);
|
7472 | }
|
7473 | function assertHostNodeExists(rElement, elementOrSelector) {
|
7474 | if (!rElement) {
|
7475 | if (typeof elementOrSelector === 'string') {
|
7476 | throw createError('Host node with selector not found:', elementOrSelector);
|
7477 | }
|
7478 | else {
|
7479 | throw createError('Host node is required:', elementOrSelector);
|
7480 | }
|
7481 | }
|
7482 | }
|
7483 |
|
7484 |
|
7485 |
|
7486 |
|
7487 |
|
7488 |
|
7489 |
|
7490 | function locateHostElement(renderer, elementOrSelector, encapsulation) {
|
7491 | if (isProceduralRenderer(renderer)) {
|
7492 |
|
7493 | const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
|
7494 | return renderer.selectRootElement(elementOrSelector, preserveContent);
|
7495 | }
|
7496 | let rElement = typeof elementOrSelector === 'string' ?
|
7497 | renderer.querySelector(elementOrSelector) :
|
7498 | elementOrSelector;
|
7499 | ngDevMode && assertHostNodeExists(rElement, elementOrSelector);
|
7500 |
|
7501 |
|
7502 |
|
7503 |
|
7504 | rElement.textContent = '';
|
7505 | return rElement;
|
7506 | }
|
7507 |
|
7508 |
|
7509 |
|
7510 |
|
7511 |
|
7512 |
|
7513 |
|
7514 | function storeCleanupWithContext(tView, lView, context, cleanupFn) {
|
7515 | const lCleanup = getLCleanup(lView);
|
7516 | lCleanup.push(context);
|
7517 | if (tView.firstCreatePass) {
|
7518 | getTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
|
7519 | }
|
7520 | }
|
7521 |
|
7522 |
|
7523 |
|
7524 |
|
7525 |
|
7526 |
|
7527 |
|
7528 |
|
7529 |
|
7530 |
|
7531 |
|
7532 | function createTNode(tView, tParent, type, adjustedIndex, tagName, attrs) {
|
7533 | ngDevMode && ngDevMode.tNode++;
|
7534 | let injectorIndex = tParent ? tParent.injectorIndex : -1;
|
7535 | const tNode = ngDevMode ?
|
7536 | new TNodeDebug(tView,
|
7537 | type,
|
7538 | adjustedIndex,
|
7539 | injectorIndex,
|
7540 | -1,
|
7541 | -1,
|
7542 | -1,
|
7543 | null,
|
7544 | 0,
|
7545 | 0,
|
7546 | tagName,
|
7547 | attrs,
|
7548 | null,
|
7549 | null,
|
7550 | undefined,
|
7551 | null,
|
7552 | null,
|
7553 | null,
|
7554 | null,
|
7555 | null,
|
7556 | null,
|
7557 | tParent,
|
7558 | null,
|
7559 | null,
|
7560 | null,
|
7561 | undefined,
|
7562 | null,
|
7563 | null,
|
7564 | undefined,
|
7565 | 0,
|
7566 | 0) :
|
7567 | {
|
7568 | type: type,
|
7569 | index: adjustedIndex,
|
7570 | injectorIndex: injectorIndex,
|
7571 | directiveStart: -1,
|
7572 | directiveEnd: -1,
|
7573 | directiveStylingLast: -1,
|
7574 | propertyBindings: null,
|
7575 | flags: 0,
|
7576 | providerIndexes: 0,
|
7577 | tagName: tagName,
|
7578 | attrs: attrs,
|
7579 | mergedAttrs: null,
|
7580 | localNames: null,
|
7581 | initialInputs: undefined,
|
7582 | inputs: null,
|
7583 | outputs: null,
|
7584 | tViews: null,
|
7585 | next: null,
|
7586 | projectionNext: null,
|
7587 | child: null,
|
7588 | parent: tParent,
|
7589 | projection: null,
|
7590 | styles: null,
|
7591 | stylesWithoutHost: null,
|
7592 | residualStyles: undefined,
|
7593 | classes: null,
|
7594 | classesWithoutHost: null,
|
7595 | residualClasses: undefined,
|
7596 | classBindings: 0,
|
7597 | styleBindings: 0,
|
7598 | };
|
7599 | if (ngDevMode) {
|
7600 |
|
7601 |
|
7602 |
|
7603 | Object.seal(tNode);
|
7604 | }
|
7605 | return tNode;
|
7606 | }
|
7607 | function generatePropertyAliases(inputAliasMap, directiveDefIdx, propStore) {
|
7608 | for (let publicName in inputAliasMap) {
|
7609 | if (inputAliasMap.hasOwnProperty(publicName)) {
|
7610 | propStore = propStore === null ? {} : propStore;
|
7611 | const internalName = inputAliasMap[publicName];
|
7612 | if (propStore.hasOwnProperty(publicName)) {
|
7613 | propStore[publicName].push(directiveDefIdx, internalName);
|
7614 | }
|
7615 | else {
|
7616 | (propStore[publicName] = [directiveDefIdx, internalName]);
|
7617 | }
|
7618 | }
|
7619 | }
|
7620 | return propStore;
|
7621 | }
|
7622 |
|
7623 |
|
7624 |
|
7625 |
|
7626 | function initializeInputAndOutputAliases(tView, tNode) {
|
7627 | ngDevMode && assertFirstCreatePass(tView);
|
7628 | const start = tNode.directiveStart;
|
7629 | const end = tNode.directiveEnd;
|
7630 | const defs = tView.data;
|
7631 | const tNodeAttrs = tNode.attrs;
|
7632 | const inputsFromAttrs = ngDevMode ? new TNodeInitialInputs() : [];
|
7633 | let inputsStore = null;
|
7634 | let outputsStore = null;
|
7635 | for (let i = start; i < end; i++) {
|
7636 | const directiveDef = defs[i];
|
7637 | const directiveInputs = directiveDef.inputs;
|
7638 |
|
7639 |
|
7640 |
|
7641 |
|
7642 | const initialInputs = (tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
|
7643 | generateInitialInputs(directiveInputs, tNodeAttrs) :
|
7644 | null;
|
7645 | inputsFromAttrs.push(initialInputs);
|
7646 | inputsStore = generatePropertyAliases(directiveInputs, i, inputsStore);
|
7647 | outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
|
7648 | }
|
7649 | if (inputsStore !== null) {
|
7650 | if (inputsStore.hasOwnProperty('class')) {
|
7651 | tNode.flags |= 16 ;
|
7652 | }
|
7653 | if (inputsStore.hasOwnProperty('style')) {
|
7654 | tNode.flags |= 32 ;
|
7655 | }
|
7656 | }
|
7657 | tNode.initialInputs = inputsFromAttrs;
|
7658 | tNode.inputs = inputsStore;
|
7659 | tNode.outputs = outputsStore;
|
7660 | }
|
7661 |
|
7662 |
|
7663 |
|
7664 |
|
7665 |
|
7666 |
|
7667 |
|
7668 |
|
7669 |
|
7670 |
|
7671 | function mapPropName(name) {
|
7672 | if (name === 'class')
|
7673 | return 'className';
|
7674 | if (name === 'for')
|
7675 | return 'htmlFor';
|
7676 | if (name === 'formaction')
|
7677 | return 'formAction';
|
7678 | if (name === 'innerHtml')
|
7679 | return 'innerHTML';
|
7680 | if (name === 'readonly')
|
7681 | return 'readOnly';
|
7682 | if (name === 'tabindex')
|
7683 | return 'tabIndex';
|
7684 | return name;
|
7685 | }
|
7686 | function elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, nativeOnly) {
|
7687 | ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
|
7688 | const element = getNativeByTNode(tNode, lView);
|
7689 | let inputData = tNode.inputs;
|
7690 | let dataValue;
|
7691 | if (!nativeOnly && inputData != null && (dataValue = inputData[propName])) {
|
7692 | setInputsForProperty(tView, lView, dataValue, propName, value);
|
7693 | if (isComponentHost(tNode))
|
7694 | markDirtyIfOnPush(lView, tNode.index);
|
7695 | if (ngDevMode) {
|
7696 | setNgReflectProperties(lView, element, tNode.type, dataValue, value);
|
7697 | }
|
7698 | }
|
7699 | else if (tNode.type === 3 ) {
|
7700 | propName = mapPropName(propName);
|
7701 | if (ngDevMode) {
|
7702 | validateAgainstEventProperties(propName);
|
7703 | if (!validateProperty(tView, element, propName, tNode)) {
|
7704 |
|
7705 | logUnknownPropertyError(propName, tNode);
|
7706 | return;
|
7707 | }
|
7708 | ngDevMode.rendererSetProperty++;
|
7709 | }
|
7710 |
|
7711 |
|
7712 | value = sanitizer != null ? sanitizer(value, tNode.tagName || '', propName) : value;
|
7713 | if (isProceduralRenderer(renderer)) {
|
7714 | renderer.setProperty(element, propName, value);
|
7715 | }
|
7716 | else if (!isAnimationProp(propName)) {
|
7717 | element.setProperty ? element.setProperty(propName, value) :
|
7718 | element[propName] = value;
|
7719 | }
|
7720 | }
|
7721 | else if (tNode.type === 0 || tNode.type === 4 ) {
|
7722 |
|
7723 |
|
7724 | if (ngDevMode && !matchingSchemas(tView, tNode.tagName)) {
|
7725 | logUnknownPropertyError(propName, tNode);
|
7726 | }
|
7727 | }
|
7728 | }
|
7729 |
|
7730 | function markDirtyIfOnPush(lView, viewIndex) {
|
7731 | ngDevMode && assertLView(lView);
|
7732 | const childComponentLView = getComponentLViewByIndex(viewIndex, lView);
|
7733 | if (!(childComponentLView[FLAGS] & 16 )) {
|
7734 | childComponentLView[FLAGS] |= 64 ;
|
7735 | }
|
7736 | }
|
7737 | function setNgReflectProperty(lView, element, type, attrName, value) {
|
7738 | const renderer = lView[RENDERER];
|
7739 | attrName = normalizeDebugBindingName(attrName);
|
7740 | const debugValue = normalizeDebugBindingValue(value);
|
7741 | if (type === 3 ) {
|
7742 | if (value == null) {
|
7743 | isProceduralRenderer(renderer) ? renderer.removeAttribute(element, attrName) :
|
7744 | element.removeAttribute(attrName);
|
7745 | }
|
7746 | else {
|
7747 | isProceduralRenderer(renderer) ?
|
7748 | renderer.setAttribute(element, attrName, debugValue) :
|
7749 | element.setAttribute(attrName, debugValue);
|
7750 | }
|
7751 | }
|
7752 | else {
|
7753 | const textContent = `bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`;
|
7754 | if (isProceduralRenderer(renderer)) {
|
7755 | renderer.setValue(element, textContent);
|
7756 | }
|
7757 | else {
|
7758 | element.textContent = textContent;
|
7759 | }
|
7760 | }
|
7761 | }
|
7762 | function setNgReflectProperties(lView, element, type, dataValue, value) {
|
7763 | if (type === 3 || type === 0 ) {
|
7764 | |
7765 |
|
7766 |
|
7767 |
|
7768 |
|
7769 |
|
7770 |
|
7771 |
|
7772 | for (let i = 0; i < dataValue.length; i += 2) {
|
7773 | setNgReflectProperty(lView, element, type, dataValue[i + 1], value);
|
7774 | }
|
7775 | }
|
7776 | }
|
7777 | function validateProperty(tView, element, propName, tNode) {
|
7778 |
|
7779 |
|
7780 |
|
7781 |
|
7782 | if (tView.schemas === null)
|
7783 | return true;
|
7784 |
|
7785 |
|
7786 | if (matchingSchemas(tView, tNode.tagName) || propName in element || isAnimationProp(propName)) {
|
7787 | return true;
|
7788 | }
|
7789 |
|
7790 |
|
7791 | return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
7792 | }
|
7793 | function matchingSchemas(tView, tagName) {
|
7794 | const schemas = tView.schemas;
|
7795 | if (schemas !== null) {
|
7796 | for (let i = 0; i < schemas.length; i++) {
|
7797 | const schema = schemas[i];
|
7798 | if (schema === NO_ERRORS_SCHEMA ||
|
7799 | schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
7800 | return true;
|
7801 | }
|
7802 | }
|
7803 | }
|
7804 | return false;
|
7805 | }
|
7806 |
|
7807 |
|
7808 |
|
7809 |
|
7810 |
|
7811 | function logUnknownPropertyError(propName, tNode) {
|
7812 | console.error(`Can't bind to '${propName}' since it isn't a known property of '${tNode.tagName}'.`);
|
7813 | }
|
7814 |
|
7815 |
|
7816 |
|
7817 | function instantiateRootComponent(tView, lView, def) {
|
7818 | const rootTNode = getPreviousOrParentTNode();
|
7819 | if (tView.firstCreatePass) {
|
7820 | if (def.providersResolver)
|
7821 | def.providersResolver(def);
|
7822 | generateExpandoInstructionBlock(tView, rootTNode, 1);
|
7823 | baseResolveDirective(tView, lView, def);
|
7824 | }
|
7825 | const directive = getNodeInjectable(lView, tView, lView.length - 1, rootTNode);
|
7826 | attachPatchData(directive, lView);
|
7827 | const native = getNativeByTNode(rootTNode, lView);
|
7828 | if (native) {
|
7829 | attachPatchData(native, lView);
|
7830 | }
|
7831 | return directive;
|
7832 | }
|
7833 |
|
7834 |
|
7835 |
|
7836 | function resolveDirectives(tView, lView, tNode, localRefs) {
|
7837 |
|
7838 |
|
7839 | ngDevMode && assertFirstCreatePass(tView);
|
7840 | let hasDirectives = false;
|
7841 | if (getBindingsEnabled()) {
|
7842 | const directiveDefs = findDirectiveDefMatches(tView, lView, tNode);
|
7843 | const exportsMap = localRefs === null ? null : { '': -1 };
|
7844 | if (directiveDefs !== null) {
|
7845 | let totalDirectiveHostVars = 0;
|
7846 | hasDirectives = true;
|
7847 | initTNodeFlags(tNode, tView.data.length, directiveDefs.length);
|
7848 |
|
7849 |
|
7850 |
|
7851 |
|
7852 |
|
7853 |
|
7854 | for (let i = 0; i < directiveDefs.length; i++) {
|
7855 | const def = directiveDefs[i];
|
7856 | if (def.providersResolver)
|
7857 | def.providersResolver(def);
|
7858 | }
|
7859 | generateExpandoInstructionBlock(tView, tNode, directiveDefs.length);
|
7860 | let preOrderHooksFound = false;
|
7861 | let preOrderCheckHooksFound = false;
|
7862 | for (let i = 0; i < directiveDefs.length; i++) {
|
7863 | const def = directiveDefs[i];
|
7864 |
|
7865 |
|
7866 | tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
|
7867 | baseResolveDirective(tView, lView, def);
|
7868 | saveNameToExportMap(tView.data.length - 1, def, exportsMap);
|
7869 | if (def.contentQueries !== null)
|
7870 | tNode.flags |= 8 ;
|
7871 | if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
|
7872 | tNode.flags |= 128 ;
|
7873 | const lifeCycleHooks = def.type.prototype;
|
7874 |
|
7875 |
|
7876 | if (!preOrderHooksFound &&
|
7877 | (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
|
7878 |
|
7879 |
|
7880 |
|
7881 | (tView.preOrderHooks || (tView.preOrderHooks = [])).push(tNode.index - HEADER_OFFSET);
|
7882 | preOrderHooksFound = true;
|
7883 | }
|
7884 | if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
|
7885 | (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = []))
|
7886 | .push(tNode.index - HEADER_OFFSET);
|
7887 | preOrderCheckHooksFound = true;
|
7888 | }
|
7889 | addHostBindingsToExpandoInstructions(tView, def);
|
7890 | totalDirectiveHostVars += def.hostVars;
|
7891 | }
|
7892 | initializeInputAndOutputAliases(tView, tNode);
|
7893 | growHostVarsSpace(tView, lView, totalDirectiveHostVars);
|
7894 | }
|
7895 | if (exportsMap)
|
7896 | cacheMatchingLocalNames(tNode, localRefs, exportsMap);
|
7897 | }
|
7898 |
|
7899 | tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
|
7900 | return hasDirectives;
|
7901 | }
|
7902 |
|
7903 |
|
7904 |
|
7905 |
|
7906 |
|
7907 |
|
7908 | function addHostBindingsToExpandoInstructions(tView, def) {
|
7909 | ngDevMode && assertFirstCreatePass(tView);
|
7910 | const expando = tView.expandoInstructions;
|
7911 |
|
7912 |
|
7913 |
|
7914 |
|
7915 |
|
7916 |
|
7917 |
|
7918 |
|
7919 | expando.push(def.hostBindings);
|
7920 | const hostVars = def.hostVars;
|
7921 | if (hostVars !== 0) {
|
7922 | expando.push(def.hostVars);
|
7923 | }
|
7924 | }
|
7925 |
|
7926 |
|
7927 |
|
7928 |
|
7929 |
|
7930 |
|
7931 |
|
7932 |
|
7933 |
|
7934 |
|
7935 |
|
7936 | function growHostVarsSpace(tView, lView, count) {
|
7937 | ngDevMode && assertFirstCreatePass(tView);
|
7938 | ngDevMode && assertSame(tView, lView[TVIEW], '`LView` must be associated with `TView`!');
|
7939 | for (let i = 0; i < count; i++) {
|
7940 | lView.push(NO_CHANGE);
|
7941 | tView.blueprint.push(NO_CHANGE);
|
7942 | tView.data.push(null);
|
7943 | }
|
7944 | }
|
7945 |
|
7946 |
|
7947 |
|
7948 | function instantiateAllDirectives(tView, lView, tNode, native) {
|
7949 | const start = tNode.directiveStart;
|
7950 | const end = tNode.directiveEnd;
|
7951 | if (!tView.firstCreatePass) {
|
7952 | getOrCreateNodeInjectorForNode(tNode, lView);
|
7953 | }
|
7954 | attachPatchData(native, lView);
|
7955 | const initialInputs = tNode.initialInputs;
|
7956 | for (let i = start; i < end; i++) {
|
7957 | const def = tView.data[i];
|
7958 | const isComponent = isComponentDef(def);
|
7959 | if (isComponent) {
|
7960 | ngDevMode && assertNodeOfPossibleTypes(tNode, [3 ]);
|
7961 | addComponentLogic(lView, tNode, def);
|
7962 | }
|
7963 | const directive = getNodeInjectable(lView, tView, i, tNode);
|
7964 | attachPatchData(directive, lView);
|
7965 | if (initialInputs !== null) {
|
7966 | setInputsFromAttrs(lView, i - start, directive, def, tNode, initialInputs);
|
7967 | }
|
7968 | if (isComponent) {
|
7969 | const componentView = getComponentLViewByIndex(tNode.index, lView);
|
7970 | componentView[CONTEXT] = directive;
|
7971 | }
|
7972 | }
|
7973 | }
|
7974 | function invokeDirectivesHostBindings(tView, lView, tNode) {
|
7975 | const start = tNode.directiveStart;
|
7976 | const end = tNode.directiveEnd;
|
7977 | const expando = tView.expandoInstructions;
|
7978 | const firstCreatePass = tView.firstCreatePass;
|
7979 | const elementIndex = tNode.index - HEADER_OFFSET;
|
7980 | const currentDirectiveIndex = getCurrentDirectiveIndex();
|
7981 | try {
|
7982 | setSelectedIndex(elementIndex);
|
7983 | for (let dirIndex = start; dirIndex < end; dirIndex++) {
|
7984 | const def = tView.data[dirIndex];
|
7985 | const directive = lView[dirIndex];
|
7986 | setCurrentDirectiveIndex(dirIndex);
|
7987 | if (def.hostBindings !== null || def.hostVars !== 0 || def.hostAttrs !== null) {
|
7988 | invokeHostBindingsInCreationMode(def, directive);
|
7989 | }
|
7990 | else if (firstCreatePass) {
|
7991 | expando.push(null);
|
7992 | }
|
7993 | }
|
7994 | }
|
7995 | finally {
|
7996 | setSelectedIndex(-1);
|
7997 | setCurrentDirectiveIndex(currentDirectiveIndex);
|
7998 | }
|
7999 | }
|
8000 |
|
8001 |
|
8002 |
|
8003 |
|
8004 |
|
8005 |
|
8006 | function invokeHostBindingsInCreationMode(def, directive) {
|
8007 | if (def.hostBindings !== null) {
|
8008 | def.hostBindings(1 , directive);
|
8009 | }
|
8010 | }
|
8011 |
|
8012 |
|
8013 |
|
8014 |
|
8015 |
|
8016 |
|
8017 | function generateExpandoInstructionBlock(tView, tNode, directiveCount) {
|
8018 | ngDevMode &&
|
8019 | assertEqual(tView.firstCreatePass, true, 'Expando block should only be generated on first create pass.');
|
8020 |
|
8021 |
|
8022 |
|
8023 | const elementIndex = HEADER_OFFSET - tNode.index;
|
8024 | const providerStartIndex = tNode.providerIndexes & 1048575 ;
|
8025 | const providerCount = tView.data.length - providerStartIndex;
|
8026 | (tView.expandoInstructions || (tView.expandoInstructions = []))
|
8027 | .push(elementIndex, providerCount, directiveCount);
|
8028 | }
|
8029 |
|
8030 |
|
8031 |
|
8032 |
|
8033 | function findDirectiveDefMatches(tView, viewData, tNode) {
|
8034 | ngDevMode && assertFirstCreatePass(tView);
|
8035 | ngDevMode &&
|
8036 | assertNodeOfPossibleTypes(tNode, [3 , 4 , 0 ]);
|
8037 | const registry = tView.directiveRegistry;
|
8038 | let matches = null;
|
8039 | if (registry) {
|
8040 | for (let i = 0; i < registry.length; i++) {
|
8041 | const def = registry[i];
|
8042 | if (isNodeMatchingSelectorList(tNode, def.selectors, false)) {
|
8043 | matches || (matches = ngDevMode ? new MatchesArray() : []);
|
8044 | diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, viewData), tView, def.type);
|
8045 | if (isComponentDef(def)) {
|
8046 | ngDevMode &&
|
8047 | assertNodeOfPossibleTypes(tNode, [3 ], `"${tNode.tagName}" tags cannot be used as component hosts. ` +
|
8048 | `Please use a different tag to activate the ${stringify(def.type)} component.`);
|
8049 | if (tNode.flags & 2 )
|
8050 | throwMultipleComponentError(tNode);
|
8051 | markAsComponentHost(tView, tNode);
|
8052 |
|
8053 | matches.unshift(def);
|
8054 | }
|
8055 | else {
|
8056 | matches.push(def);
|
8057 | }
|
8058 | }
|
8059 | }
|
8060 | }
|
8061 | return matches;
|
8062 | }
|
8063 |
|
8064 |
|
8065 |
|
8066 |
|
8067 |
|
8068 | function markAsComponentHost(tView, hostTNode) {
|
8069 | ngDevMode && assertFirstCreatePass(tView);
|
8070 | hostTNode.flags |= 2 ;
|
8071 | (tView.components || (tView.components = ngDevMode ? new TViewComponents() : []))
|
8072 | .push(hostTNode.index);
|
8073 | }
|
8074 |
|
8075 | function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
8076 | if (localRefs) {
|
8077 | const localNames = tNode.localNames = ngDevMode ? new TNodeLocalNames() : [];
|
8078 |
|
8079 |
|
8080 |
|
8081 | for (let i = 0; i < localRefs.length; i += 2) {
|
8082 | const index = exportsMap[localRefs[i + 1]];
|
8083 | if (index == null)
|
8084 | throw new Error(`Export of name '${localRefs[i + 1]}' not found!`);
|
8085 | localNames.push(localRefs[i], index);
|
8086 | }
|
8087 | }
|
8088 | }
|
8089 |
|
8090 |
|
8091 |
|
8092 |
|
8093 | function saveNameToExportMap(index, def, exportsMap) {
|
8094 | if (exportsMap) {
|
8095 | if (def.exportAs) {
|
8096 | for (let i = 0; i < def.exportAs.length; i++) {
|
8097 | exportsMap[def.exportAs[i]] = index;
|
8098 | }
|
8099 | }
|
8100 | if (isComponentDef(def))
|
8101 | exportsMap[''] = index;
|
8102 | }
|
8103 | }
|
8104 |
|
8105 |
|
8106 |
|
8107 |
|
8108 |
|
8109 | function initTNodeFlags(tNode, index, numberOfDirectives) {
|
8110 | ngDevMode &&
|
8111 | assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, 'Reached the max number of directives');
|
8112 | tNode.flags |= 1 ;
|
8113 |
|
8114 | tNode.directiveStart = index;
|
8115 | tNode.directiveEnd = index + numberOfDirectives;
|
8116 | tNode.providerIndexes = index;
|
8117 | }
|
8118 | function baseResolveDirective(tView, viewData, def) {
|
8119 | tView.data.push(def);
|
8120 | const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true));
|
8121 | const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), null);
|
8122 | tView.blueprint.push(nodeInjectorFactory);
|
8123 | viewData.push(nodeInjectorFactory);
|
8124 | }
|
8125 | function addComponentLogic(lView, hostTNode, def) {
|
8126 | const native = getNativeByTNode(hostTNode, lView);
|
8127 | const tView = getOrCreateTComponentView(def);
|
8128 |
|
8129 |
|
8130 | const rendererFactory = lView[RENDERER_FACTORY];
|
8131 | const componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 64 : 16 , native, hostTNode, rendererFactory, rendererFactory.createRenderer(native, def)));
|
8132 |
|
8133 |
|
8134 | lView[hostTNode.index] = componentView;
|
8135 | }
|
8136 | function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace) {
|
8137 | if (ngDevMode) {
|
8138 | assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
|
8139 | validateAgainstEventAttributes(name);
|
8140 | assertNodeNotOfTypes(tNode, [0 , 4 ], `Attempted to set attribute \`${name}\` on a container node. ` +
|
8141 | `Host bindings are not valid on ng-container or ng-template.`);
|
8142 | }
|
8143 | const element = getNativeByTNode(tNode, lView);
|
8144 | const renderer = lView[RENDERER];
|
8145 | if (value == null) {
|
8146 | ngDevMode && ngDevMode.rendererRemoveAttribute++;
|
8147 | isProceduralRenderer(renderer) ? renderer.removeAttribute(element, name, namespace) :
|
8148 | element.removeAttribute(name);
|
8149 | }
|
8150 | else {
|
8151 | ngDevMode && ngDevMode.rendererSetAttribute++;
|
8152 | const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tNode.tagName || '', name);
|
8153 | if (isProceduralRenderer(renderer)) {
|
8154 | renderer.setAttribute(element, name, strValue, namespace);
|
8155 | }
|
8156 | else {
|
8157 | namespace ? element.setAttributeNS(namespace, name, strValue) :
|
8158 | element.setAttribute(name, strValue);
|
8159 | }
|
8160 | }
|
8161 | }
|
8162 |
|
8163 |
|
8164 |
|
8165 |
|
8166 |
|
8167 |
|
8168 |
|
8169 |
|
8170 |
|
8171 | function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initialInputData) {
|
8172 | const initialInputs = initialInputData[directiveIndex];
|
8173 | if (initialInputs !== null) {
|
8174 | const setInput = def.setInput;
|
8175 | for (let i = 0; i < initialInputs.length;) {
|
8176 | const publicName = initialInputs[i++];
|
8177 | const privateName = initialInputs[i++];
|
8178 | const value = initialInputs[i++];
|
8179 | if (setInput !== null) {
|
8180 | def.setInput(instance, value, publicName, privateName);
|
8181 | }
|
8182 | else {
|
8183 | instance[privateName] = value;
|
8184 | }
|
8185 | if (ngDevMode) {
|
8186 | const nativeElement = getNativeByTNode(tNode, lView);
|
8187 | setNgReflectProperty(lView, nativeElement, tNode.type, privateName, value);
|
8188 | }
|
8189 | }
|
8190 | }
|
8191 | }
|
8192 |
|
8193 |
|
8194 |
|
8195 |
|
8196 |
|
8197 |
|
8198 |
|
8199 |
|
8200 |
|
8201 |
|
8202 |
|
8203 |
|
8204 |
|
8205 |
|
8206 | function generateInitialInputs(inputs, attrs) {
|
8207 | let inputsToStore = null;
|
8208 | let i = 0;
|
8209 | while (i < attrs.length) {
|
8210 | const attrName = attrs[i];
|
8211 | if (attrName === 0 ) {
|
8212 |
|
8213 | i += 4;
|
8214 | continue;
|
8215 | }
|
8216 | else if (attrName === 5 ) {
|
8217 |
|
8218 | i += 2;
|
8219 | continue;
|
8220 | }
|
8221 |
|
8222 | if (typeof attrName === 'number')
|
8223 | break;
|
8224 | if (inputs.hasOwnProperty(attrName)) {
|
8225 | if (inputsToStore === null)
|
8226 | inputsToStore = [];
|
8227 | inputsToStore.push(attrName, inputs[attrName], attrs[i + 1]);
|
8228 | }
|
8229 | i += 2;
|
8230 | }
|
8231 | return inputsToStore;
|
8232 | }
|
8233 |
|
8234 |
|
8235 |
|
8236 |
|
8237 | const LContainerArray = ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) &&
|
8238 | createNamedArrayType('LContainer');
|
8239 |
|
8240 |
|
8241 |
|
8242 |
|
8243 |
|
8244 |
|
8245 |
|
8246 |
|
8247 |
|
8248 |
|
8249 | function createLContainer(hostNative, currentView, native, tNode) {
|
8250 | ngDevMode && assertLView(currentView);
|
8251 | ngDevMode && !isProceduralRenderer(currentView[RENDERER]) && assertDomNode(native);
|
8252 |
|
8253 | const lContainer = new (ngDevMode ? LContainerArray : Array)(hostNative,
|
8254 | true,
|
8255 | false,
|
8256 | currentView,
|
8257 | null,
|
8258 | 0,
|
8259 | tNode,
|
8260 | native,
|
8261 | null,
|
8262 | null);
|
8263 | ngDevMode &&
|
8264 | assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, 'Should allocate correct number of slots for LContainer header.');
|
8265 | ngDevMode && attachLContainerDebug(lContainer);
|
8266 | return lContainer;
|
8267 | }
|
8268 |
|
8269 |
|
8270 |
|
8271 |
|
8272 | function refreshEmbeddedViews(lView) {
|
8273 | for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
|
8274 | for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
8275 | const embeddedLView = lContainer[i];
|
8276 | const embeddedTView = embeddedLView[TVIEW];
|
8277 | ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
|
8278 | if (viewAttachedToChangeDetector(embeddedLView)) {
|
8279 | refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
|
8280 | }
|
8281 | }
|
8282 | }
|
8283 | }
|
8284 |
|
8285 |
|
8286 |
|
8287 |
|
8288 |
|
8289 | function markTransplantedViewsForRefresh(lView) {
|
8290 | for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
|
8291 | if (!lContainer[HAS_TRANSPLANTED_VIEWS])
|
8292 | continue;
|
8293 | const movedViews = lContainer[MOVED_VIEWS];
|
8294 | ngDevMode && assertDefined(movedViews, 'Transplanted View flags set but missing MOVED_VIEWS');
|
8295 | for (let i = 0; i < movedViews.length; i++) {
|
8296 | const movedLView = movedViews[i];
|
8297 | const insertionLContainer = movedLView[PARENT];
|
8298 | ngDevMode && assertLContainer(insertionLContainer);
|
8299 |
|
8300 |
|
8301 | if ((movedLView[FLAGS] & 1024 ) === 0) {
|
8302 | updateTransplantedViewCount(insertionLContainer, 1);
|
8303 | }
|
8304 |
|
8305 |
|
8306 |
|
8307 |
|
8308 | movedLView[FLAGS] |= 1024 ;
|
8309 | }
|
8310 | }
|
8311 | }
|
8312 |
|
8313 |
|
8314 |
|
8315 |
|
8316 |
|
8317 |
|
8318 | function refreshComponent(hostLView, componentHostIdx) {
|
8319 | ngDevMode && assertEqual(isCreationMode(hostLView), false, 'Should be run in update mode');
|
8320 | const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
|
8321 |
|
8322 | if (viewAttachedToChangeDetector(componentView)) {
|
8323 | const tView = componentView[TVIEW];
|
8324 | if (componentView[FLAGS] & (16 | 64 )) {
|
8325 | refreshView(tView, componentView, tView.template, componentView[CONTEXT]);
|
8326 | }
|
8327 | else if (componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
|
8328 |
|
8329 | refreshContainsDirtyView(componentView);
|
8330 | }
|
8331 | }
|
8332 | }
|
8333 |
|
8334 |
|
8335 |
|
8336 |
|
8337 |
|
8338 |
|
8339 | function refreshContainsDirtyView(lView) {
|
8340 | for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
|
8341 | for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
8342 | const embeddedLView = lContainer[i];
|
8343 | if (embeddedLView[FLAGS] & 1024 ) {
|
8344 | const embeddedTView = embeddedLView[TVIEW];
|
8345 | ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
|
8346 | refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
|
8347 | }
|
8348 | else if (embeddedLView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
|
8349 | refreshContainsDirtyView(embeddedLView);
|
8350 | }
|
8351 | }
|
8352 | }
|
8353 | const tView = lView[TVIEW];
|
8354 |
|
8355 | const components = tView.components;
|
8356 | if (components !== null) {
|
8357 | for (let i = 0; i < components.length; i++) {
|
8358 | const componentView = getComponentLViewByIndex(components[i], lView);
|
8359 |
|
8360 | if (viewAttachedToChangeDetector(componentView) &&
|
8361 | componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
|
8362 | refreshContainsDirtyView(componentView);
|
8363 | }
|
8364 | }
|
8365 | }
|
8366 | }
|
8367 | function renderComponent(hostLView, componentHostIdx) {
|
8368 | ngDevMode && assertEqual(isCreationMode(hostLView), true, 'Should be run in creation mode');
|
8369 | const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
|
8370 | const componentTView = componentView[TVIEW];
|
8371 | syncViewWithBlueprint(componentTView, componentView);
|
8372 | renderView(componentTView, componentView, componentView[CONTEXT]);
|
8373 | }
|
8374 |
|
8375 |
|
8376 |
|
8377 |
|
8378 |
|
8379 |
|
8380 |
|
8381 |
|
8382 |
|
8383 |
|
8384 |
|
8385 |
|
8386 |
|
8387 |
|
8388 |
|
8389 |
|
8390 |
|
8391 |
|
8392 |
|
8393 |
|
8394 |
|
8395 |
|
8396 |
|
8397 |
|
8398 |
|
8399 |
|
8400 |
|
8401 | function syncViewWithBlueprint(tView, lView) {
|
8402 | for (let i = lView.length; i < tView.blueprint.length; i++) {
|
8403 | lView.push(tView.blueprint[i]);
|
8404 | }
|
8405 | }
|
8406 |
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 |
|
8414 |
|
8415 |
|
8416 |
|
8417 | function addToViewTree(lView, lViewOrLContainer) {
|
8418 |
|
8419 |
|
8420 |
|
8421 |
|
8422 | if (lView[CHILD_HEAD]) {
|
8423 | lView[CHILD_TAIL][NEXT] = lViewOrLContainer;
|
8424 | }
|
8425 | else {
|
8426 | lView[CHILD_HEAD] = lViewOrLContainer;
|
8427 | }
|
8428 | lView[CHILD_TAIL] = lViewOrLContainer;
|
8429 | return lViewOrLContainer;
|
8430 | }
|
8431 |
|
8432 |
|
8433 |
|
8434 |
|
8435 |
|
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 |
|
8443 |
|
8444 |
|
8445 | function markViewDirty(lView) {
|
8446 | while (lView) {
|
8447 | lView[FLAGS] |= 64 ;
|
8448 | const parent = getLViewParent(lView);
|
8449 |
|
8450 | if (isRootView(lView) && !parent) {
|
8451 | return lView;
|
8452 | }
|
8453 |
|
8454 | lView = parent;
|
8455 | }
|
8456 | return null;
|
8457 | }
|
8458 |
|
8459 |
|
8460 |
|
8461 |
|
8462 |
|
8463 |
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 |
|
8469 | function scheduleTick(rootContext, flags) {
|
8470 | const nothingScheduled = rootContext.flags === 0 ;
|
8471 | rootContext.flags |= flags;
|
8472 | if (nothingScheduled && rootContext.clean == _CLEAN_PROMISE) {
|
8473 | let res;
|
8474 | rootContext.clean = new Promise((r) => res = r);
|
8475 | rootContext.scheduler(() => {
|
8476 | if (rootContext.flags & 1 ) {
|
8477 | rootContext.flags &= ~1 ;
|
8478 | tickRootContext(rootContext);
|
8479 | }
|
8480 | if (rootContext.flags & 2 ) {
|
8481 | rootContext.flags &= ~2 ;
|
8482 | const playerHandler = rootContext.playerHandler;
|
8483 | if (playerHandler) {
|
8484 | playerHandler.flushPlayers();
|
8485 | }
|
8486 | }
|
8487 | rootContext.clean = _CLEAN_PROMISE;
|
8488 | res(null);
|
8489 | });
|
8490 | }
|
8491 | }
|
8492 | function tickRootContext(rootContext) {
|
8493 | for (let i = 0; i < rootContext.components.length; i++) {
|
8494 | const rootComponent = rootContext.components[i];
|
8495 | const lView = readPatchedLView(rootComponent);
|
8496 | const tView = lView[TVIEW];
|
8497 | renderComponentOrTemplate(tView, lView, tView.template, rootComponent);
|
8498 | }
|
8499 | }
|
8500 | function detectChangesInternal(tView, lView, context) {
|
8501 | const rendererFactory = lView[RENDERER_FACTORY];
|
8502 | if (rendererFactory.begin)
|
8503 | rendererFactory.begin();
|
8504 | try {
|
8505 | refreshView(tView, lView, tView.template, context);
|
8506 | }
|
8507 | catch (error) {
|
8508 | handleError(lView, error);
|
8509 | throw error;
|
8510 | }
|
8511 | finally {
|
8512 | if (rendererFactory.end)
|
8513 | rendererFactory.end();
|
8514 | }
|
8515 | }
|
8516 |
|
8517 |
|
8518 |
|
8519 |
|
8520 |
|
8521 | function detectChangesInRootView(lView) {
|
8522 | tickRootContext(lView[CONTEXT]);
|
8523 | }
|
8524 | function checkNoChangesInternal(tView, view, context) {
|
8525 | setCheckNoChangesMode(true);
|
8526 | try {
|
8527 | detectChangesInternal(tView, view, context);
|
8528 | }
|
8529 | finally {
|
8530 | setCheckNoChangesMode(false);
|
8531 | }
|
8532 | }
|
8533 |
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 |
|
8540 |
|
8541 |
|
8542 | function checkNoChangesInRootView(lView) {
|
8543 | setCheckNoChangesMode(true);
|
8544 | try {
|
8545 | detectChangesInRootView(lView);
|
8546 | }
|
8547 | finally {
|
8548 | setCheckNoChangesMode(false);
|
8549 | }
|
8550 | }
|
8551 | function executeViewQueryFn(flags, viewQueryFn, component) {
|
8552 | ngDevMode && assertDefined(viewQueryFn, 'View queries function to execute must be defined.');
|
8553 | setCurrentQueryIndex(0);
|
8554 | viewQueryFn(flags, component);
|
8555 | }
|
8556 |
|
8557 |
|
8558 |
|
8559 |
|
8560 |
|
8561 |
|
8562 |
|
8563 |
|
8564 |
|
8565 |
|
8566 |
|
8567 |
|
8568 |
|
8569 |
|
8570 |
|
8571 |
|
8572 |
|
8573 |
|
8574 |
|
8575 |
|
8576 |
|
8577 |
|
8578 |
|
8579 |
|
8580 | function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex, ...interpolationParts) {
|
8581 |
|
8582 |
|
8583 |
|
8584 | if (tData[bindingIndex] === null) {
|
8585 | if (tNode.inputs == null || !tNode.inputs[propertyName]) {
|
8586 | const propBindingIdxs = tNode.propertyBindings || (tNode.propertyBindings = []);
|
8587 | propBindingIdxs.push(bindingIndex);
|
8588 | let bindingMetadata = propertyName;
|
8589 | if (interpolationParts.length > 0) {
|
8590 | bindingMetadata +=
|
8591 | INTERPOLATION_DELIMITER + interpolationParts.join(INTERPOLATION_DELIMITER);
|
8592 | }
|
8593 | tData[bindingIndex] = bindingMetadata;
|
8594 | }
|
8595 | }
|
8596 | }
|
8597 | const CLEAN_PROMISE = _CLEAN_PROMISE;
|
8598 | function getLCleanup(view) {
|
8599 |
|
8600 | return view[CLEANUP] || (view[CLEANUP] = ngDevMode ? new LCleanup() : []);
|
8601 | }
|
8602 | function getTViewCleanup(tView) {
|
8603 | return tView.cleanup || (tView.cleanup = ngDevMode ? new TCleanup() : []);
|
8604 | }
|
8605 |
|
8606 |
|
8607 |
|
8608 |
|
8609 | function loadComponentRenderer(currentDef, tNode, lView) {
|
8610 |
|
8611 |
|
8612 |
|
8613 |
|
8614 |
|
8615 |
|
8616 | if (currentDef === null || isComponentDef(currentDef)) {
|
8617 | lView = unwrapLView(lView[tNode.index]);
|
8618 | }
|
8619 | return lView[RENDERER];
|
8620 | }
|
8621 |
|
8622 | function handleError(lView, error) {
|
8623 | const injector = lView[INJECTOR$1];
|
8624 | const errorHandler = injector ? injector.get(ErrorHandler, null) : null;
|
8625 | errorHandler && errorHandler.handleError(error);
|
8626 | }
|
8627 |
|
8628 |
|
8629 |
|
8630 |
|
8631 |
|
8632 |
|
8633 |
|
8634 |
|
8635 |
|
8636 | function setInputsForProperty(tView, lView, inputs, publicName, value) {
|
8637 | for (let i = 0; i < inputs.length;) {
|
8638 | const index = inputs[i++];
|
8639 | const privateName = inputs[i++];
|
8640 | const instance = lView[index];
|
8641 | ngDevMode && assertIndexInRange(lView, index);
|
8642 | const def = tView.data[index];
|
8643 | if (def.setInput !== null) {
|
8644 | def.setInput(instance, value, publicName, privateName);
|
8645 | }
|
8646 | else {
|
8647 | instance[privateName] = value;
|
8648 | }
|
8649 | }
|
8650 | }
|
8651 |
|
8652 |
|
8653 |
|
8654 | function textBindingInternal(lView, index, value) {
|
8655 | ngDevMode && assertNotSame(value, NO_CHANGE, 'value should not be NO_CHANGE');
|
8656 | ngDevMode && assertIndexInRange(lView, index + HEADER_OFFSET);
|
8657 | const element = getNativeByIndex(index, lView);
|
8658 | ngDevMode && assertDefined(element, 'native element should exist');
|
8659 | ngDevMode && ngDevMode.rendererSetText++;
|
8660 | const renderer = lView[RENDERER];
|
8661 | isProceduralRenderer(renderer) ? renderer.setValue(element, value) : element.textContent = value;
|
8662 | }
|
8663 |
|
8664 |
|
8665 |
|
8666 |
|
8667 |
|
8668 |
|
8669 |
|
8670 |
|
8671 | const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$2 + unusedValueExportToPlacateAjd;
|
8672 | function getLContainer(tNode, embeddedView) {
|
8673 | ngDevMode && assertLView(embeddedView);
|
8674 | const container = embeddedView[PARENT];
|
8675 | if (tNode.index === -1) {
|
8676 |
|
8677 |
|
8678 | return isLContainer(container) ? container : null;
|
8679 | }
|
8680 | else {
|
8681 | ngDevMode && assertLContainer(container);
|
8682 |
|
8683 | return container;
|
8684 | }
|
8685 | }
|
8686 |
|
8687 |
|
8688 |
|
8689 |
|
8690 | function getContainerRenderParent(tViewNode, view) {
|
8691 | const container = getLContainer(tViewNode, view);
|
8692 | return container ? nativeParentNode(view[RENDERER], container[NATIVE]) : null;
|
8693 | }
|
8694 |
|
8695 |
|
8696 |
|
8697 |
|
8698 | function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, beforeNode) {
|
8699 |
|
8700 |
|
8701 |
|
8702 |
|
8703 | if (lNodeToHandle != null) {
|
8704 | let lContainer;
|
8705 | let isComponent = false;
|
8706 |
|
8707 |
|
8708 |
|
8709 | if (isLContainer(lNodeToHandle)) {
|
8710 | lContainer = lNodeToHandle;
|
8711 | }
|
8712 | else if (isLView(lNodeToHandle)) {
|
8713 | isComponent = true;
|
8714 | ngDevMode && assertDefined(lNodeToHandle[HOST], 'HOST must be defined for a component LView');
|
8715 | lNodeToHandle = lNodeToHandle[HOST];
|
8716 | }
|
8717 | const rNode = unwrapRNode(lNodeToHandle);
|
8718 | ngDevMode && !isProceduralRenderer(renderer) && assertDomNode(rNode);
|
8719 | if (action === 0 && parent !== null) {
|
8720 | if (beforeNode == null) {
|
8721 | nativeAppendChild(renderer, parent, rNode);
|
8722 | }
|
8723 | else {
|
8724 | nativeInsertBefore(renderer, parent, rNode, beforeNode || null);
|
8725 | }
|
8726 | }
|
8727 | else if (action === 1 && parent !== null) {
|
8728 | nativeInsertBefore(renderer, parent, rNode, beforeNode || null);
|
8729 | }
|
8730 | else if (action === 2 ) {
|
8731 | nativeRemoveNode(renderer, rNode, isComponent);
|
8732 | }
|
8733 | else if (action === 3 ) {
|
8734 | ngDevMode && ngDevMode.rendererDestroyNode++;
|
8735 | renderer.destroyNode(rNode);
|
8736 | }
|
8737 | if (lContainer != null) {
|
8738 | applyContainer(renderer, action, lContainer, parent, beforeNode);
|
8739 | }
|
8740 | }
|
8741 | }
|
8742 | function createTextNode(value, renderer) {
|
8743 | ngDevMode && ngDevMode.rendererCreateTextNode++;
|
8744 | ngDevMode && ngDevMode.rendererSetText++;
|
8745 | return isProceduralRenderer(renderer) ? renderer.createText(value) :
|
8746 | renderer.createTextNode(value);
|
8747 | }
|
8748 | function addRemoveViewFromContainer(tView, lView, insertMode, beforeNode) {
|
8749 | const renderParent = getContainerRenderParent(tView.node, lView);
|
8750 | ngDevMode && assertNodeType(tView.node, 2 );
|
8751 | if (renderParent) {
|
8752 | const renderer = lView[RENDERER];
|
8753 | const action = insertMode ? 1 : 2 ;
|
8754 | applyView(tView, lView, renderer, action, renderParent, beforeNode);
|
8755 | }
|
8756 | }
|
8757 |
|
8758 |
|
8759 |
|
8760 |
|
8761 |
|
8762 |
|
8763 | function renderDetachView(tView, lView) {
|
8764 | applyView(tView, lView, lView[RENDERER], 2 , null, null);
|
8765 | }
|
8766 |
|
8767 |
|
8768 |
|
8769 |
|
8770 |
|
8771 |
|
8772 |
|
8773 |
|
8774 |
|
8775 |
|
8776 |
|
8777 |
|
8778 |
|
8779 | function destroyViewTree(rootView) {
|
8780 |
|
8781 | let lViewOrLContainer = rootView[CHILD_HEAD];
|
8782 | if (!lViewOrLContainer) {
|
8783 | return cleanUpView(rootView[TVIEW], rootView);
|
8784 | }
|
8785 | while (lViewOrLContainer) {
|
8786 | let next = null;
|
8787 | if (isLView(lViewOrLContainer)) {
|
8788 |
|
8789 | next = lViewOrLContainer[CHILD_HEAD];
|
8790 | }
|
8791 | else {
|
8792 | ngDevMode && assertLContainer(lViewOrLContainer);
|
8793 |
|
8794 | const firstView = lViewOrLContainer[CONTAINER_HEADER_OFFSET];
|
8795 | if (firstView)
|
8796 | next = firstView;
|
8797 | }
|
8798 | if (!next) {
|
8799 |
|
8800 |
|
8801 | while (lViewOrLContainer && !lViewOrLContainer[NEXT] && lViewOrLContainer !== rootView) {
|
8802 | isLView(lViewOrLContainer) && cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
|
8803 | lViewOrLContainer = getParentState(lViewOrLContainer, rootView);
|
8804 | }
|
8805 | if (lViewOrLContainer === null)
|
8806 | lViewOrLContainer = rootView;
|
8807 | isLView(lViewOrLContainer) && cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
|
8808 | next = lViewOrLContainer && lViewOrLContainer[NEXT];
|
8809 | }
|
8810 | lViewOrLContainer = next;
|
8811 | }
|
8812 | }
|
8813 |
|
8814 |
|
8815 |
|
8816 |
|
8817 |
|
8818 |
|
8819 |
|
8820 |
|
8821 |
|
8822 |
|
8823 |
|
8824 |
|
8825 |
|
8826 | function insertView(tView, lView, lContainer, index) {
|
8827 | ngDevMode && assertLView(lView);
|
8828 | ngDevMode && assertLContainer(lContainer);
|
8829 | const indexInContainer = CONTAINER_HEADER_OFFSET + index;
|
8830 | const containerLength = lContainer.length;
|
8831 | if (index > 0) {
|
8832 |
|
8833 | lContainer[indexInContainer - 1][NEXT] = lView;
|
8834 | }
|
8835 | if (index < containerLength - CONTAINER_HEADER_OFFSET) {
|
8836 | lView[NEXT] = lContainer[indexInContainer];
|
8837 | addToArray(lContainer, CONTAINER_HEADER_OFFSET + index, lView);
|
8838 | }
|
8839 | else {
|
8840 | lContainer.push(lView);
|
8841 | lView[NEXT] = null;
|
8842 | }
|
8843 | lView[PARENT] = lContainer;
|
8844 |
|
8845 | const declarationLContainer = lView[DECLARATION_LCONTAINER];
|
8846 | if (declarationLContainer !== null && lContainer !== declarationLContainer) {
|
8847 | trackMovedView(declarationLContainer, lView);
|
8848 | }
|
8849 |
|
8850 | const lQueries = lView[QUERIES];
|
8851 | if (lQueries !== null) {
|
8852 | lQueries.insertView(tView);
|
8853 | }
|
8854 |
|
8855 | lView[FLAGS] |= 128 ;
|
8856 | }
|
8857 |
|
8858 |
|
8859 |
|
8860 |
|
8861 | function trackMovedView(declarationContainer, lView) {
|
8862 | ngDevMode && assertDefined(lView, 'LView required');
|
8863 | ngDevMode && assertLContainer(declarationContainer);
|
8864 | const movedViews = declarationContainer[MOVED_VIEWS];
|
8865 | const insertedLContainer = lView[PARENT];
|
8866 | ngDevMode && assertLContainer(insertedLContainer);
|
8867 | const insertedComponentLView = insertedLContainer[PARENT][DECLARATION_COMPONENT_VIEW];
|
8868 | ngDevMode && assertDefined(insertedComponentLView, 'Missing insertedComponentLView');
|
8869 | const declaredComponentLView = lView[DECLARATION_COMPONENT_VIEW];
|
8870 | ngDevMode && assertDefined(declaredComponentLView, 'Missing declaredComponentLView');
|
8871 | if (declaredComponentLView !== insertedComponentLView) {
|
8872 |
|
8873 |
|
8874 |
|
8875 | declarationContainer[HAS_TRANSPLANTED_VIEWS] = true;
|
8876 | }
|
8877 | if (movedViews === null) {
|
8878 | declarationContainer[MOVED_VIEWS] = [lView];
|
8879 | }
|
8880 | else {
|
8881 | movedViews.push(lView);
|
8882 | }
|
8883 | }
|
8884 | function detachMovedView(declarationContainer, lView) {
|
8885 | ngDevMode && assertLContainer(declarationContainer);
|
8886 | ngDevMode &&
|
8887 | assertDefined(declarationContainer[MOVED_VIEWS], 'A projected view should belong to a non-empty projected views collection');
|
8888 | const movedViews = declarationContainer[MOVED_VIEWS];
|
8889 | const declarationViewIndex = movedViews.indexOf(lView);
|
8890 | const insertionLContainer = lView[PARENT];
|
8891 | ngDevMode && assertLContainer(insertionLContainer);
|
8892 |
|
8893 |
|
8894 |
|
8895 | if (lView[FLAGS] & 1024 ) {
|
8896 | updateTransplantedViewCount(insertionLContainer, -1);
|
8897 | }
|
8898 | movedViews.splice(declarationViewIndex, 1);
|
8899 | }
|
8900 |
|
8901 |
|
8902 |
|
8903 |
|
8904 |
|
8905 |
|
8906 |
|
8907 |
|
8908 |
|
8909 |
|
8910 | function detachView(lContainer, removeIndex) {
|
8911 | if (lContainer.length <= CONTAINER_HEADER_OFFSET)
|
8912 | return;
|
8913 | const indexInContainer = CONTAINER_HEADER_OFFSET + removeIndex;
|
8914 | const viewToDetach = lContainer[indexInContainer];
|
8915 | if (viewToDetach) {
|
8916 | const declarationLContainer = viewToDetach[DECLARATION_LCONTAINER];
|
8917 | if (declarationLContainer !== null && declarationLContainer !== lContainer) {
|
8918 | detachMovedView(declarationLContainer, viewToDetach);
|
8919 | }
|
8920 | if (removeIndex > 0) {
|
8921 | lContainer[indexInContainer - 1][NEXT] = viewToDetach[NEXT];
|
8922 | }
|
8923 | const removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex);
|
8924 | addRemoveViewFromContainer(viewToDetach[TVIEW], viewToDetach, false, null);
|
8925 |
|
8926 | const lQueries = removedLView[QUERIES];
|
8927 | if (lQueries !== null) {
|
8928 | lQueries.detachView(removedLView[TVIEW]);
|
8929 | }
|
8930 | viewToDetach[PARENT] = null;
|
8931 | viewToDetach[NEXT] = null;
|
8932 |
|
8933 | viewToDetach[FLAGS] &= ~128 ;
|
8934 | }
|
8935 | return viewToDetach;
|
8936 | }
|
8937 |
|
8938 |
|
8939 |
|
8940 |
|
8941 |
|
8942 |
|
8943 |
|
8944 | function destroyLView(tView, lView) {
|
8945 | if (!(lView[FLAGS] & 256 )) {
|
8946 | const renderer = lView[RENDERER];
|
8947 | if (isProceduralRenderer(renderer) && renderer.destroyNode) {
|
8948 | applyView(tView, lView, renderer, 3 , null, null);
|
8949 | }
|
8950 | destroyViewTree(lView);
|
8951 | }
|
8952 | }
|
8953 |
|
8954 |
|
8955 |
|
8956 |
|
8957 |
|
8958 |
|
8959 |
|
8960 |
|
8961 |
|
8962 |
|
8963 |
|
8964 |
|
8965 | function getParentState(lViewOrLContainer, rootView) {
|
8966 | let tNode;
|
8967 | if (isLView(lViewOrLContainer) && (tNode = lViewOrLContainer[T_HOST]) &&
|
8968 | tNode.type === 2 ) {
|
8969 |
|
8970 |
|
8971 | return getLContainer(tNode, lViewOrLContainer);
|
8972 | }
|
8973 | else {
|
8974 |
|
8975 | return lViewOrLContainer[PARENT] === rootView ? null : lViewOrLContainer[PARENT];
|
8976 | }
|
8977 | }
|
8978 |
|
8979 |
|
8980 |
|
8981 |
|
8982 |
|
8983 |
|
8984 |
|
8985 |
|
8986 | function cleanUpView(tView, lView) {
|
8987 | if (!(lView[FLAGS] & 256 )) {
|
8988 |
|
8989 |
|
8990 | lView[FLAGS] &= ~128 ;
|
8991 |
|
8992 |
|
8993 |
|
8994 |
|
8995 |
|
8996 | lView[FLAGS] |= 256 ;
|
8997 | executeOnDestroys(tView, lView);
|
8998 | removeListeners(tView, lView);
|
8999 | const hostTNode = lView[T_HOST];
|
9000 |
|
9001 | if (hostTNode && hostTNode.type === 3 &&
|
9002 | isProceduralRenderer(lView[RENDERER])) {
|
9003 | ngDevMode && ngDevMode.rendererDestroy++;
|
9004 | lView[RENDERER].destroy();
|
9005 | }
|
9006 | const declarationContainer = lView[DECLARATION_LCONTAINER];
|
9007 |
|
9008 | if (declarationContainer !== null && isLContainer(lView[PARENT])) {
|
9009 |
|
9010 | if (declarationContainer !== lView[PARENT]) {
|
9011 | detachMovedView(declarationContainer, lView);
|
9012 | }
|
9013 |
|
9014 | const lQueries = lView[QUERIES];
|
9015 | if (lQueries !== null) {
|
9016 | lQueries.detachView(tView);
|
9017 | }
|
9018 | }
|
9019 | }
|
9020 | }
|
9021 |
|
9022 | function removeListeners(tView, lView) {
|
9023 | const tCleanup = tView.cleanup;
|
9024 | if (tCleanup !== null) {
|
9025 | const lCleanup = lView[CLEANUP];
|
9026 | for (let i = 0; i < tCleanup.length - 1; i += 2) {
|
9027 | if (typeof tCleanup[i] === 'string') {
|
9028 |
|
9029 | const idxOrTargetGetter = tCleanup[i + 1];
|
9030 | const target = typeof idxOrTargetGetter === 'function' ?
|
9031 | idxOrTargetGetter(lView) :
|
9032 | unwrapRNode(lView[idxOrTargetGetter]);
|
9033 | const listener = lCleanup[tCleanup[i + 2]];
|
9034 | const useCaptureOrSubIdx = tCleanup[i + 3];
|
9035 | if (typeof useCaptureOrSubIdx === 'boolean') {
|
9036 |
|
9037 | target.removeEventListener(tCleanup[i], listener, useCaptureOrSubIdx);
|
9038 | }
|
9039 | else {
|
9040 | if (useCaptureOrSubIdx >= 0) {
|
9041 |
|
9042 | lCleanup[useCaptureOrSubIdx]();
|
9043 | }
|
9044 | else {
|
9045 |
|
9046 | lCleanup[-useCaptureOrSubIdx].unsubscribe();
|
9047 | }
|
9048 | }
|
9049 | i += 2;
|
9050 | }
|
9051 | else {
|
9052 |
|
9053 | const context = lCleanup[tCleanup[i + 1]];
|
9054 | tCleanup[i].call(context);
|
9055 | }
|
9056 | }
|
9057 | lView[CLEANUP] = null;
|
9058 | }
|
9059 | }
|
9060 |
|
9061 | function executeOnDestroys(tView, lView) {
|
9062 | let destroyHooks;
|
9063 | if (tView != null && (destroyHooks = tView.destroyHooks) != null) {
|
9064 | for (let i = 0; i < destroyHooks.length; i += 2) {
|
9065 | const context = lView[destroyHooks[i]];
|
9066 |
|
9067 | if (!(context instanceof NodeInjectorFactory)) {
|
9068 | const toCall = destroyHooks[i + 1];
|
9069 | if (Array.isArray(toCall)) {
|
9070 | for (let j = 0; j < toCall.length; j += 2) {
|
9071 | toCall[j + 1].call(context[toCall[j]]);
|
9072 | }
|
9073 | }
|
9074 | else {
|
9075 | toCall.call(context);
|
9076 | }
|
9077 | }
|
9078 | }
|
9079 | }
|
9080 | }
|
9081 |
|
9082 |
|
9083 |
|
9084 |
|
9085 |
|
9086 |
|
9087 |
|
9088 |
|
9089 |
|
9090 |
|
9091 |
|
9092 |
|
9093 | function getRenderParent(tView, tNode, currentView) {
|
9094 |
|
9095 |
|
9096 | let parentTNode = tNode.parent;
|
9097 | while (parentTNode != null &&
|
9098 | (parentTNode.type === 4 ||
|
9099 | parentTNode.type === 5 )) {
|
9100 | tNode = parentTNode;
|
9101 | parentTNode = tNode.parent;
|
9102 | }
|
9103 |
|
9104 |
|
9105 | if (parentTNode == null) {
|
9106 | const hostTNode = currentView[T_HOST];
|
9107 | if (hostTNode.type === 2 ) {
|
9108 |
|
9109 |
|
9110 |
|
9111 |
|
9112 |
|
9113 |
|
9114 |
|
9115 | return getContainerRenderParent(hostTNode, currentView);
|
9116 | }
|
9117 | else {
|
9118 |
|
9119 |
|
9120 | ngDevMode && assertNodeOfPossibleTypes(hostTNode, [3 ]);
|
9121 | return currentView[HOST];
|
9122 | }
|
9123 | }
|
9124 | else {
|
9125 | const isIcuCase = tNode && tNode.type === 5 ;
|
9126 |
|
9127 |
|
9128 | if (isIcuCase && tNode.flags & 4 ) {
|
9129 | return getNativeByTNode(tNode, currentView).parentNode;
|
9130 | }
|
9131 | ngDevMode && assertNodeType(parentTNode, 3 );
|
9132 | if (parentTNode.flags & 2 ) {
|
9133 | const tData = tView.data;
|
9134 | const tNode = tData[parentTNode.index];
|
9135 | const encapsulation = tData[tNode.directiveStart].encapsulation;
|
9136 |
|
9137 |
|
9138 |
|
9139 |
|
9140 |
|
9141 |
|
9142 | if (encapsulation !== ViewEncapsulation$1.ShadowDom &&
|
9143 | encapsulation !== ViewEncapsulation$1.Native) {
|
9144 | return null;
|
9145 | }
|
9146 | }
|
9147 | return getNativeByTNode(parentTNode, currentView);
|
9148 | }
|
9149 | }
|
9150 |
|
9151 |
|
9152 |
|
9153 |
|
9154 |
|
9155 | function nativeInsertBefore(renderer, parent, child, beforeNode) {
|
9156 | ngDevMode && ngDevMode.rendererInsertBefore++;
|
9157 | if (isProceduralRenderer(renderer)) {
|
9158 | renderer.insertBefore(parent, child, beforeNode);
|
9159 | }
|
9160 | else {
|
9161 | parent.insertBefore(child, beforeNode, true);
|
9162 | }
|
9163 | }
|
9164 | function nativeAppendChild(renderer, parent, child) {
|
9165 | ngDevMode && ngDevMode.rendererAppendChild++;
|
9166 | ngDevMode && assertDefined(parent, 'parent node must be defined');
|
9167 | if (isProceduralRenderer(renderer)) {
|
9168 | renderer.appendChild(parent, child);
|
9169 | }
|
9170 | else {
|
9171 | parent.appendChild(child);
|
9172 | }
|
9173 | }
|
9174 | function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode) {
|
9175 | if (beforeNode !== null) {
|
9176 | nativeInsertBefore(renderer, parent, child, beforeNode);
|
9177 | }
|
9178 | else {
|
9179 | nativeAppendChild(renderer, parent, child);
|
9180 | }
|
9181 | }
|
9182 |
|
9183 | function nativeRemoveChild(renderer, parent, child, isHostElement) {
|
9184 | if (isProceduralRenderer(renderer)) {
|
9185 | renderer.removeChild(parent, child, isHostElement);
|
9186 | }
|
9187 | else {
|
9188 | parent.removeChild(child);
|
9189 | }
|
9190 | }
|
9191 |
|
9192 |
|
9193 |
|
9194 | function nativeParentNode(renderer, node) {
|
9195 | return (isProceduralRenderer(renderer) ? renderer.parentNode(node) : node.parentNode);
|
9196 | }
|
9197 |
|
9198 |
|
9199 |
|
9200 | function nativeNextSibling(renderer, node) {
|
9201 | return isProceduralRenderer(renderer) ? renderer.nextSibling(node) : node.nextSibling;
|
9202 | }
|
9203 |
|
9204 |
|
9205 |
|
9206 |
|
9207 |
|
9208 |
|
9209 | function getNativeAnchorNode(parentTNode, lView) {
|
9210 | if (parentTNode.type === 2 ) {
|
9211 | const lContainer = getLContainer(parentTNode, lView);
|
9212 | if (lContainer === null)
|
9213 | return null;
|
9214 | const index = lContainer.indexOf(lView, CONTAINER_HEADER_OFFSET) - CONTAINER_HEADER_OFFSET;
|
9215 | return getBeforeNodeForView(index, lContainer);
|
9216 | }
|
9217 | else if (parentTNode.type === 4 ||
|
9218 | parentTNode.type === 5 ) {
|
9219 | return getNativeByTNode(parentTNode, lView);
|
9220 | }
|
9221 | return null;
|
9222 | }
|
9223 |
|
9224 |
|
9225 |
|
9226 |
|
9227 |
|
9228 |
|
9229 |
|
9230 |
|
9231 |
|
9232 |
|
9233 |
|
9234 | function appendChild(tView, lView, childEl, childTNode) {
|
9235 | const renderParent = getRenderParent(tView, childTNode, lView);
|
9236 | if (renderParent != null) {
|
9237 | const renderer = lView[RENDERER];
|
9238 | const parentTNode = childTNode.parent || lView[T_HOST];
|
9239 | const anchorNode = getNativeAnchorNode(parentTNode, lView);
|
9240 | if (Array.isArray(childEl)) {
|
9241 | for (let i = 0; i < childEl.length; i++) {
|
9242 | nativeAppendOrInsertBefore(renderer, renderParent, childEl[i], anchorNode);
|
9243 | }
|
9244 | }
|
9245 | else {
|
9246 | nativeAppendOrInsertBefore(renderer, renderParent, childEl, anchorNode);
|
9247 | }
|
9248 | }
|
9249 | }
|
9250 |
|
9251 |
|
9252 |
|
9253 |
|
9254 |
|
9255 | function getFirstNativeNode(lView, tNode) {
|
9256 | if (tNode !== null) {
|
9257 | ngDevMode && assertNodeOfPossibleTypes(tNode, [
|
9258 | 3 , 0 , 4 , 5 ,
|
9259 | 1
|
9260 | ]);
|
9261 | const tNodeType = tNode.type;
|
9262 | if (tNodeType === 3 ) {
|
9263 | return getNativeByTNode(tNode, lView);
|
9264 | }
|
9265 | else if (tNodeType === 0 ) {
|
9266 | return getBeforeNodeForView(-1, lView[tNode.index]);
|
9267 | }
|
9268 | else if (tNodeType === 4 || tNodeType === 5 ) {
|
9269 | const elIcuContainerChild = tNode.child;
|
9270 | if (elIcuContainerChild !== null) {
|
9271 | return getFirstNativeNode(lView, elIcuContainerChild);
|
9272 | }
|
9273 | else {
|
9274 | const rNodeOrLContainer = lView[tNode.index];
|
9275 | if (isLContainer(rNodeOrLContainer)) {
|
9276 | return getBeforeNodeForView(-1, rNodeOrLContainer);
|
9277 | }
|
9278 | else {
|
9279 | return unwrapRNode(rNodeOrLContainer);
|
9280 | }
|
9281 | }
|
9282 | }
|
9283 | else {
|
9284 | const componentView = lView[DECLARATION_COMPONENT_VIEW];
|
9285 | const componentHost = componentView[T_HOST];
|
9286 | const parentView = getLViewParent(componentView);
|
9287 | const firstProjectedTNode = componentHost.projection[tNode.projection];
|
9288 | if (firstProjectedTNode != null) {
|
9289 | return getFirstNativeNode(parentView, firstProjectedTNode);
|
9290 | }
|
9291 | else {
|
9292 | return getFirstNativeNode(lView, tNode.next);
|
9293 | }
|
9294 | }
|
9295 | }
|
9296 | return null;
|
9297 | }
|
9298 | function getBeforeNodeForView(viewIndexInContainer, lContainer) {
|
9299 | const nextViewIndex = CONTAINER_HEADER_OFFSET + viewIndexInContainer + 1;
|
9300 | if (nextViewIndex < lContainer.length) {
|
9301 | const lView = lContainer[nextViewIndex];
|
9302 | const firstTNodeOfView = lView[TVIEW].firstChild;
|
9303 | if (firstTNodeOfView !== null) {
|
9304 | return getFirstNativeNode(lView, firstTNodeOfView);
|
9305 | }
|
9306 | }
|
9307 | return lContainer[NATIVE];
|
9308 | }
|
9309 |
|
9310 |
|
9311 |
|
9312 |
|
9313 |
|
9314 |
|
9315 |
|
9316 |
|
9317 |
|
9318 | function nativeRemoveNode(renderer, rNode, isHostElement) {
|
9319 | const nativeParent = nativeParentNode(renderer, rNode);
|
9320 | if (nativeParent) {
|
9321 | nativeRemoveChild(renderer, nativeParent, rNode, isHostElement);
|
9322 | }
|
9323 | }
|
9324 |
|
9325 |
|
9326 |
|
9327 |
|
9328 | function applyNodes(renderer, action, tNode, lView, renderParent, beforeNode, isProjection) {
|
9329 | while (tNode != null) {
|
9330 | ngDevMode && assertTNodeForLView(tNode, lView);
|
9331 | ngDevMode && assertNodeOfPossibleTypes(tNode, [
|
9332 | 0 , 3 , 4 , 1 ,
|
9333 | 5
|
9334 | ]);
|
9335 | const rawSlotValue = lView[tNode.index];
|
9336 | const tNodeType = tNode.type;
|
9337 | if (isProjection) {
|
9338 | if (action === 0 ) {
|
9339 | rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
|
9340 | tNode.flags |= 4 ;
|
9341 | }
|
9342 | }
|
9343 | if ((tNode.flags & 64 ) !== 64 ) {
|
9344 | if (tNodeType === 4 || tNodeType === 5 ) {
|
9345 | applyNodes(renderer, action, tNode.child, lView, renderParent, beforeNode, false);
|
9346 | applyToElementOrContainer(action, renderer, renderParent, rawSlotValue, beforeNode);
|
9347 | }
|
9348 | else if (tNodeType === 1 ) {
|
9349 | applyProjectionRecursive(renderer, action, lView, tNode, renderParent, beforeNode);
|
9350 | }
|
9351 | else {
|
9352 | ngDevMode && assertNodeOfPossibleTypes(tNode, [3 , 0 ]);
|
9353 | applyToElementOrContainer(action, renderer, renderParent, rawSlotValue, beforeNode);
|
9354 | }
|
9355 | }
|
9356 | tNode = isProjection ? tNode.projectionNext : tNode.next;
|
9357 | }
|
9358 | }
|
9359 |
|
9360 |
|
9361 |
|
9362 |
|
9363 |
|
9364 |
|
9365 |
|
9366 |
|
9367 |
|
9368 |
|
9369 |
|
9370 |
|
9371 |
|
9372 |
|
9373 |
|
9374 |
|
9375 |
|
9376 |
|
9377 |
|
9378 |
|
9379 |
|
9380 |
|
9381 |
|
9382 | function applyView(tView, lView, renderer, action, renderParent, beforeNode) {
|
9383 | ngDevMode && assertNodeType(tView.node, 2 );
|
9384 | const viewRootTNode = tView.node.child;
|
9385 | applyNodes(renderer, action, viewRootTNode, lView, renderParent, beforeNode, false);
|
9386 | }
|
9387 |
|
9388 |
|
9389 |
|
9390 |
|
9391 |
|
9392 |
|
9393 |
|
9394 |
|
9395 |
|
9396 |
|
9397 | function applyProjection(tView, lView, tProjectionNode) {
|
9398 | const renderer = lView[RENDERER];
|
9399 | const renderParent = getRenderParent(tView, tProjectionNode, lView);
|
9400 | const parentTNode = tProjectionNode.parent || lView[T_HOST];
|
9401 | let beforeNode = getNativeAnchorNode(parentTNode, lView);
|
9402 | applyProjectionRecursive(renderer, 0 , lView, tProjectionNode, renderParent, beforeNode);
|
9403 | }
|
9404 |
|
9405 |
|
9406 |
|
9407 |
|
9408 |
|
9409 |
|
9410 |
|
9411 |
|
9412 |
|
9413 |
|
9414 |
|
9415 |
|
9416 |
|
9417 |
|
9418 | function applyProjectionRecursive(renderer, action, lView, tProjectionNode, renderParent, beforeNode) {
|
9419 | const componentLView = lView[DECLARATION_COMPONENT_VIEW];
|
9420 | const componentNode = componentLView[T_HOST];
|
9421 | ngDevMode &&
|
9422 | assertEqual(typeof tProjectionNode.projection, 'number', 'expecting projection index');
|
9423 | const nodeToProjectOrRNodes = componentNode.projection[tProjectionNode.projection];
|
9424 | if (Array.isArray(nodeToProjectOrRNodes)) {
|
9425 |
|
9426 |
|
9427 |
|
9428 |
|
9429 |
|
9430 | for (let i = 0; i < nodeToProjectOrRNodes.length; i++) {
|
9431 | const rNode = nodeToProjectOrRNodes[i];
|
9432 | applyToElementOrContainer(action, renderer, renderParent, rNode, beforeNode);
|
9433 | }
|
9434 | }
|
9435 | else {
|
9436 | let nodeToProject = nodeToProjectOrRNodes;
|
9437 | const projectedComponentLView = componentLView[PARENT];
|
9438 | applyNodes(renderer, action, nodeToProject, projectedComponentLView, renderParent, beforeNode, true);
|
9439 | }
|
9440 | }
|
9441 |
|
9442 |
|
9443 |
|
9444 |
|
9445 |
|
9446 |
|
9447 |
|
9448 |
|
9449 |
|
9450 |
|
9451 |
|
9452 |
|
9453 |
|
9454 | function applyContainer(renderer, action, lContainer, renderParent, beforeNode) {
|
9455 | ngDevMode && assertLContainer(lContainer);
|
9456 | const anchor = lContainer[NATIVE];
|
9457 | const native = unwrapRNode(lContainer);
|
9458 |
|
9459 |
|
9460 |
|
9461 |
|
9462 |
|
9463 |
|
9464 | if (anchor !== native) {
|
9465 |
|
9466 |
|
9467 |
|
9468 |
|
9469 | applyToElementOrContainer(action, renderer, renderParent, anchor, beforeNode);
|
9470 | }
|
9471 | for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
9472 | const lView = lContainer[i];
|
9473 | applyView(lView[TVIEW], lView, renderer, action, renderParent, anchor);
|
9474 | }
|
9475 | }
|
9476 |
|
9477 |
|
9478 |
|
9479 |
|
9480 |
|
9481 |
|
9482 |
|
9483 |
|
9484 |
|
9485 |
|
9486 | function applyStyling(renderer, isClassBased, rNode, prop, value) {
|
9487 | const isProcedural = isProceduralRenderer(renderer);
|
9488 | if (isClassBased) {
|
9489 |
|
9490 | if (!value) {
|
9491 | ngDevMode && ngDevMode.rendererRemoveClass++;
|
9492 | if (isProcedural) {
|
9493 | renderer.removeClass(rNode, prop);
|
9494 | }
|
9495 | else {
|
9496 | rNode.classList.remove(prop);
|
9497 | }
|
9498 | }
|
9499 | else {
|
9500 | ngDevMode && ngDevMode.rendererAddClass++;
|
9501 | if (isProcedural) {
|
9502 | renderer.addClass(rNode, prop);
|
9503 | }
|
9504 | else {
|
9505 | ngDevMode && assertDefined(rNode.classList, 'HTMLElement expected');
|
9506 | rNode.classList.add(prop);
|
9507 | }
|
9508 | }
|
9509 | }
|
9510 | else {
|
9511 |
|
9512 |
|
9513 | const flags = prop.indexOf('-') == -1 ? undefined : 2 ;
|
9514 | if (value == null ) {
|
9515 | ngDevMode && ngDevMode.rendererRemoveStyle++;
|
9516 | if (isProcedural) {
|
9517 | renderer.removeStyle(rNode, prop, flags);
|
9518 | }
|
9519 | else {
|
9520 | rNode.style.removeProperty(prop);
|
9521 | }
|
9522 | }
|
9523 | else {
|
9524 | ngDevMode && ngDevMode.rendererSetStyle++;
|
9525 | if (isProcedural) {
|
9526 | renderer.setStyle(rNode, prop, value, flags);
|
9527 | }
|
9528 | else {
|
9529 | ngDevMode && assertDefined(rNode.style, 'HTMLElement expected');
|
9530 | rNode.style.setProperty(prop, value);
|
9531 | }
|
9532 | }
|
9533 | }
|
9534 | }
|
9535 |
|
9536 |
|
9537 |
|
9538 |
|
9539 |
|
9540 |
|
9541 |
|
9542 |
|
9543 |
|
9544 |
|
9545 | function writeDirectStyle(renderer, element, newValue) {
|
9546 | ngDevMode && assertString(newValue, '\'newValue\' should be a string');
|
9547 | if (isProceduralRenderer(renderer)) {
|
9548 | renderer.setAttribute(element, 'style', newValue);
|
9549 | }
|
9550 | else {
|
9551 | element.style.cssText = newValue;
|
9552 | }
|
9553 | ngDevMode && ngDevMode.rendererSetStyle++;
|
9554 | }
|
9555 |
|
9556 |
|
9557 |
|
9558 |
|
9559 |
|
9560 |
|
9561 |
|
9562 |
|
9563 |
|
9564 |
|
9565 | function writeDirectClass(renderer, element, newValue) {
|
9566 | ngDevMode && assertString(newValue, '\'newValue\' should be a string');
|
9567 | if (isProceduralRenderer(renderer)) {
|
9568 | if (newValue === '') {
|
9569 |
|
9570 | renderer.removeAttribute(element, 'class');
|
9571 | }
|
9572 | else {
|
9573 | renderer.setAttribute(element, 'class', newValue);
|
9574 | }
|
9575 | }
|
9576 | else {
|
9577 | element.className = newValue;
|
9578 | }
|
9579 | ngDevMode && ngDevMode.rendererSetClassName++;
|
9580 | }
|
9581 |
|
9582 |
|
9583 |
|
9584 |
|
9585 |
|
9586 |
|
9587 |
|
9588 |
|
9589 |
|
9590 |
|
9591 |
|
9592 |
|
9593 |
|
9594 |
|
9595 |
|
9596 |
|
9597 |
|
9598 |
|
9599 |
|
9600 | function getParentInjectorTNode(location, startView, startTNode) {
|
9601 |
|
9602 | if (startTNode.parent && startTNode.parent.injectorIndex !== -1) {
|
9603 |
|
9604 | const injectorIndex = startTNode.parent.injectorIndex;
|
9605 | let tNode = startTNode.parent;
|
9606 |
|
9607 |
|
9608 | while (tNode.parent != null && injectorIndex == tNode.parent.injectorIndex) {
|
9609 | tNode = tNode.parent;
|
9610 | }
|
9611 | return tNode;
|
9612 | }
|
9613 | let viewOffset = getParentInjectorViewOffset(location);
|
9614 |
|
9615 | let parentView = startView;
|
9616 | let parentTNode = startView[T_HOST];
|
9617 |
|
9618 | while (viewOffset > 1) {
|
9619 | parentView = parentView[DECLARATION_VIEW];
|
9620 | parentTNode = parentView[T_HOST];
|
9621 | viewOffset--;
|
9622 | }
|
9623 | return parentTNode;
|
9624 | }
|
9625 |
|
9626 |
|
9627 |
|
9628 |
|
9629 |
|
9630 |
|
9631 |
|
9632 |
|
9633 | class ViewRef {
|
9634 | constructor(
|
9635 | /**
|
9636 | * This represents `LView` associated with the component when ViewRef is a ChangeDetectorRef.
|
9637 | *
|
9638 | * When ViewRef is created for a dynamic component, this also represents the `LView` for the
|
9639 | * component.
|
9640 | *
|
9641 | * For a "regular" ViewRef created for an embedded view, this is the `LView` for the embedded
|
9642 | * view.
|
9643 | *
|
9644 | * @internal
|
9645 | */
|
9646 | _lView,
|
9647 | /**
|
9648 | * This represents the `LView` associated with the point where `ChangeDetectorRef` was
|
9649 | * requested.
|
9650 | *
|
9651 | * This may be different from `_lView` if the `_cdRefInjectingView` is an embedded view.
|
9652 | */
|
9653 | _cdRefInjectingView) {
|
9654 | this._lView = _lView;
|
9655 | this._cdRefInjectingView = _cdRefInjectingView;
|
9656 | this._appRef = null;
|
9657 | this._viewContainerRef = null;
|
9658 | }
|
9659 | get rootNodes() {
|
9660 | const lView = this._lView;
|
9661 | if (lView[HOST] == null) {
|
9662 | const hostTView = lView[T_HOST];
|
9663 | return collectNativeNodes(lView[TVIEW], lView, hostTView.child, []);
|
9664 | }
|
9665 | return [];
|
9666 | }
|
9667 | get context() {
|
9668 | return this._lView[CONTEXT];
|
9669 | }
|
9670 | get destroyed() {
|
9671 | return (this._lView[FLAGS] & 256 ) === 256 ;
|
9672 | }
|
9673 | destroy() {
|
9674 | if (this._appRef) {
|
9675 | this._appRef.detachView(this);
|
9676 | }
|
9677 | else if (this._viewContainerRef) {
|
9678 | const index = this._viewContainerRef.indexOf(this);
|
9679 | if (index > -1) {
|
9680 | this._viewContainerRef.detach(index);
|
9681 | }
|
9682 | this._viewContainerRef = null;
|
9683 | }
|
9684 | destroyLView(this._lView[TVIEW], this._lView);
|
9685 | }
|
9686 | onDestroy(callback) {
|
9687 | storeCleanupWithContext(this._lView[TVIEW], this._lView, null, callback);
|
9688 | }
|
9689 | |
9690 |
|
9691 |
|
9692 |
|
9693 |
|
9694 |
|
9695 |
|
9696 |
|
9697 |
|
9698 |
|
9699 |
|
9700 |
|
9701 |
|
9702 |
|
9703 |
|
9704 |
|
9705 |
|
9706 |
|
9707 |
|
9708 |
|
9709 |
|
9710 |
|
9711 |
|
9712 |
|
9713 |
|
9714 |
|
9715 |
|
9716 |
|
9717 |
|
9718 |
|
9719 |
|
9720 |
|
9721 |
|
9722 |
|
9723 | markForCheck() {
|
9724 | markViewDirty(this._cdRefInjectingView || this._lView);
|
9725 | }
|
9726 | |
9727 |
|
9728 |
|
9729 |
|
9730 |
|
9731 |
|
9732 |
|
9733 |
|
9734 |
|
9735 |
|
9736 |
|
9737 |
|
9738 |
|
9739 |
|
9740 |
|
9741 |
|
9742 |
|
9743 |
|
9744 |
|
9745 |
|
9746 |
|
9747 |
|
9748 |
|
9749 |
|
9750 |
|
9751 |
|
9752 |
|
9753 |
|
9754 |
|
9755 |
|
9756 |
|
9757 |
|
9758 |
|
9759 |
|
9760 |
|
9761 |
|
9762 |
|
9763 |
|
9764 |
|
9765 |
|
9766 |
|
9767 |
|
9768 |
|
9769 |
|
9770 |
|
9771 |
|
9772 |
|
9773 |
|
9774 |
|
9775 |
|
9776 |
|
9777 |
|
9778 |
|
9779 | detach() {
|
9780 | this._lView[FLAGS] &= ~128 ;
|
9781 | }
|
9782 | |
9783 |
|
9784 |
|
9785 |
|
9786 |
|
9787 |
|
9788 |
|
9789 |
|
9790 |
|
9791 |
|
9792 |
|
9793 |
|
9794 |
|
9795 |
|
9796 |
|
9797 |
|
9798 |
|
9799 |
|
9800 |
|
9801 |
|
9802 |
|
9803 |
|
9804 |
|
9805 |
|
9806 |
|
9807 |
|
9808 |
|
9809 |
|
9810 |
|
9811 |
|
9812 |
|
9813 |
|
9814 |
|
9815 |
|
9816 |
|
9817 |
|
9818 |
|
9819 |
|
9820 |
|
9821 |
|
9822 |
|
9823 |
|
9824 |
|
9825 |
|
9826 |
|
9827 |
|
9828 |
|
9829 |
|
9830 |
|
9831 |
|
9832 |
|
9833 |
|
9834 |
|
9835 |
|
9836 |
|
9837 |
|
9838 | reattach() {
|
9839 | this._lView[FLAGS] |= 128 ;
|
9840 | }
|
9841 | |
9842 |
|
9843 |
|
9844 |
|
9845 |
|
9846 |
|
9847 |
|
9848 |
|
9849 |
|
9850 |
|
9851 |
|
9852 |
|
9853 |
|
9854 |
|
9855 |
|
9856 |
|
9857 |
|
9858 |
|
9859 |
|
9860 |
|
9861 |
|
9862 | detectChanges() {
|
9863 | detectChangesInternal(this._lView[TVIEW], this._lView, this.context);
|
9864 | }
|
9865 | |
9866 |
|
9867 |
|
9868 |
|
9869 |
|
9870 |
|
9871 | checkNoChanges() {
|
9872 | checkNoChangesInternal(this._lView[TVIEW], this._lView, this.context);
|
9873 | }
|
9874 | attachToViewContainerRef(vcRef) {
|
9875 | if (this._appRef) {
|
9876 | throw new Error('This view is already attached directly to the ApplicationRef!');
|
9877 | }
|
9878 | this._viewContainerRef = vcRef;
|
9879 | }
|
9880 | detachFromAppRef() {
|
9881 | this._appRef = null;
|
9882 | renderDetachView(this._lView[TVIEW], this._lView);
|
9883 | }
|
9884 | attachToAppRef(appRef) {
|
9885 | if (this._viewContainerRef) {
|
9886 | throw new Error('This view is already attached to a ViewContainer!');
|
9887 | }
|
9888 | this._appRef = appRef;
|
9889 | }
|
9890 | }
|
9891 |
|
9892 | class RootViewRef extends ViewRef {
|
9893 | constructor(_view) {
|
9894 | super(_view);
|
9895 | this._view = _view;
|
9896 | }
|
9897 | detectChanges() {
|
9898 | detectChangesInRootView(this._view);
|
9899 | }
|
9900 | checkNoChanges() {
|
9901 | checkNoChangesInRootView(this._view);
|
9902 | }
|
9903 | get context() {
|
9904 | return null;
|
9905 | }
|
9906 | }
|
9907 | function collectNativeNodes(tView, lView, tNode, result, isProjection = false) {
|
9908 | while (tNode !== null) {
|
9909 | ngDevMode && assertNodeOfPossibleTypes(tNode, [
|
9910 | 3 , 0 , 1 , 4 ,
|
9911 | 5
|
9912 | ]);
|
9913 | const lNode = lView[tNode.index];
|
9914 | if (lNode !== null) {
|
9915 | result.push(unwrapRNode(lNode));
|
9916 | }
|
9917 |
|
9918 |
|
9919 |
|
9920 | if (isLContainer(lNode)) {
|
9921 | for (let i = CONTAINER_HEADER_OFFSET; i < lNode.length; i++) {
|
9922 | const lViewInAContainer = lNode[i];
|
9923 | const lViewFirstChildTNode = lViewInAContainer[TVIEW].firstChild;
|
9924 | if (lViewFirstChildTNode !== null) {
|
9925 | collectNativeNodes(lViewInAContainer[TVIEW], lViewInAContainer, lViewFirstChildTNode, result);
|
9926 | }
|
9927 | }
|
9928 | }
|
9929 | const tNodeType = tNode.type;
|
9930 | if (tNodeType === 4 || tNodeType === 5 ) {
|
9931 | collectNativeNodes(tView, lView, tNode.child, result);
|
9932 | }
|
9933 | else if (tNodeType === 1 ) {
|
9934 | const componentView = lView[DECLARATION_COMPONENT_VIEW];
|
9935 | const componentHost = componentView[T_HOST];
|
9936 | const slotIdx = tNode.projection;
|
9937 | ngDevMode &&
|
9938 | assertDefined(componentHost.projection, 'Components with projection nodes (<ng-content>) must have projection slots defined.');
|
9939 | const nodesInSlot = componentHost.projection[slotIdx];
|
9940 | if (Array.isArray(nodesInSlot)) {
|
9941 | result.push(...nodesInSlot);
|
9942 | }
|
9943 | else {
|
9944 | const parentView = getLViewParent(componentView);
|
9945 | ngDevMode &&
|
9946 | assertDefined(parentView, 'Component views should always have a parent view (component\'s host view)');
|
9947 | collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true);
|
9948 | }
|
9949 | }
|
9950 | tNode = isProjection ? tNode.projectionNext : tNode.next;
|
9951 | }
|
9952 | return result;
|
9953 | }
|
9954 |
|
9955 |
|
9956 |
|
9957 |
|
9958 |
|
9959 |
|
9960 |
|
9961 |
|
9962 |
|
9963 |
|
9964 |
|
9965 |
|
9966 |
|
9967 | function injectElementRef(ElementRefToken) {
|
9968 | return createElementRef(ElementRefToken, getPreviousOrParentTNode(), getLView());
|
9969 | }
|
9970 | let R3ElementRef;
|
9971 |
|
9972 |
|
9973 |
|
9974 |
|
9975 |
|
9976 |
|
9977 |
|
9978 |
|
9979 | function createElementRef(ElementRefToken, tNode, view) {
|
9980 | if (!R3ElementRef) {
|
9981 | R3ElementRef = class ElementRef extends ElementRefToken {
|
9982 | };
|
9983 | }
|
9984 | return new R3ElementRef(getNativeByTNode(tNode, view));
|
9985 | }
|
9986 | let R3TemplateRef;
|
9987 |
|
9988 |
|
9989 |
|
9990 |
|
9991 |
|
9992 | function injectTemplateRef(TemplateRefToken, ElementRefToken) {
|
9993 | return createTemplateRef(TemplateRefToken, ElementRefToken, getPreviousOrParentTNode(), getLView());
|
9994 | }
|
9995 |
|
9996 |
|
9997 |
|
9998 |
|
9999 |
|
10000 |
|
10001 |
|
10002 |
|
10003 |
|
10004 | function createTemplateRef(TemplateRefToken, ElementRefToken, hostTNode, hostView) {
|
10005 | if (!R3TemplateRef) {
|
10006 | R3TemplateRef = class TemplateRef extends TemplateRefToken {
|
10007 | constructor(_declarationView, _declarationTContainer, elementRef) {
|
10008 | super();
|
10009 | this._declarationView = _declarationView;
|
10010 | this._declarationTContainer = _declarationTContainer;
|
10011 | this.elementRef = elementRef;
|
10012 | }
|
10013 | createEmbeddedView(context) {
|
10014 | const embeddedTView = this._declarationTContainer.tViews;
|
10015 | const embeddedLView = createLView(this._declarationView, embeddedTView, context, 16 , null, embeddedTView.node);
|
10016 | const declarationLContainer = this._declarationView[this._declarationTContainer.index];
|
10017 | ngDevMode && assertLContainer(declarationLContainer);
|
10018 | embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
|
10019 | const declarationViewLQueries = this._declarationView[QUERIES];
|
10020 | if (declarationViewLQueries !== null) {
|
10021 | embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView);
|
10022 | }
|
10023 | renderView(embeddedTView, embeddedLView, context);
|
10024 | return new ViewRef(embeddedLView);
|
10025 | }
|
10026 | };
|
10027 | }
|
10028 | if (hostTNode.type === 0 ) {
|
10029 | ngDevMode && assertDefined(hostTNode.tViews, 'TView must be allocated');
|
10030 | return new R3TemplateRef(hostView, hostTNode, createElementRef(ElementRefToken, hostTNode, hostView));
|
10031 | }
|
10032 | else {
|
10033 | return null;
|
10034 | }
|
10035 | }
|
10036 | let R3ViewContainerRef;
|
10037 |
|
10038 |
|
10039 |
|
10040 |
|
10041 |
|
10042 |
|
10043 | function injectViewContainerRef(ViewContainerRefToken, ElementRefToken) {
|
10044 | const previousTNode = getPreviousOrParentTNode();
|
10045 | return createContainerRef(ViewContainerRefToken, ElementRefToken, previousTNode, getLView());
|
10046 | }
|
10047 |
|
10048 |
|
10049 |
|
10050 |
|
10051 |
|
10052 |
|
10053 |
|
10054 |
|
10055 |
|
10056 | function createContainerRef(ViewContainerRefToken, ElementRefToken, hostTNode, hostView) {
|
10057 | if (!R3ViewContainerRef) {
|
10058 | R3ViewContainerRef = class ViewContainerRef extends ViewContainerRefToken {
|
10059 | constructor(_lContainer, _hostTNode, _hostView) {
|
10060 | super();
|
10061 | this._lContainer = _lContainer;
|
10062 | this._hostTNode = _hostTNode;
|
10063 | this._hostView = _hostView;
|
10064 | }
|
10065 | get element() {
|
10066 | return createElementRef(ElementRefToken, this._hostTNode, this._hostView);
|
10067 | }
|
10068 | get injector() {
|
10069 | return new NodeInjector(this._hostTNode, this._hostView);
|
10070 | }
|
10071 |
|
10072 | get parentInjector() {
|
10073 | const parentLocation = getParentInjectorLocation(this._hostTNode, this._hostView);
|
10074 | const parentView = getParentInjectorView(parentLocation, this._hostView);
|
10075 | const parentTNode = getParentInjectorTNode(parentLocation, this._hostView, this._hostTNode);
|
10076 | return !hasParentInjector(parentLocation) || parentTNode == null ?
|
10077 | new NodeInjector(null, this._hostView) :
|
10078 | new NodeInjector(parentTNode, parentView);
|
10079 | }
|
10080 | clear() {
|
10081 | while (this.length > 0) {
|
10082 | this.remove(this.length - 1);
|
10083 | }
|
10084 | }
|
10085 | get(index) {
|
10086 | return this._lContainer[VIEW_REFS] !== null && this._lContainer[VIEW_REFS][index] || null;
|
10087 | }
|
10088 | get length() {
|
10089 | return this._lContainer.length - CONTAINER_HEADER_OFFSET;
|
10090 | }
|
10091 | createEmbeddedView(templateRef, context, index) {
|
10092 | const viewRef = templateRef.createEmbeddedView(context || {});
|
10093 | this.insert(viewRef, index);
|
10094 | return viewRef;
|
10095 | }
|
10096 | createComponent(componentFactory, index, injector, projectableNodes, ngModuleRef) {
|
10097 | const contextInjector = injector || this.parentInjector;
|
10098 | if (!ngModuleRef && componentFactory.ngModule == null && contextInjector) {
|
10099 |
|
10100 |
|
10101 |
|
10102 | const result = contextInjector.get(NgModuleRef, null);
|
10103 | if (result) {
|
10104 | ngModuleRef = result;
|
10105 | }
|
10106 | }
|
10107 | const componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
|
10108 | this.insert(componentRef.hostView, index);
|
10109 | return componentRef;
|
10110 | }
|
10111 | insert(viewRef, index) {
|
10112 | const lView = viewRef._lView;
|
10113 | const tView = lView[TVIEW];
|
10114 | if (viewRef.destroyed) {
|
10115 | throw new Error('Cannot insert a destroyed View in a ViewContainer!');
|
10116 | }
|
10117 | this.allocateContainerIfNeeded();
|
10118 | if (viewAttachedToContainer(lView)) {
|
10119 |
|
10120 | const prevIdx = this.indexOf(viewRef);
|
10121 |
|
10122 |
|
10123 |
|
10124 |
|
10125 | if (prevIdx !== -1) {
|
10126 | this.detach(prevIdx);
|
10127 | }
|
10128 | else {
|
10129 | const prevLContainer = lView[PARENT];
|
10130 | ngDevMode &&
|
10131 | assertEqual(isLContainer(prevLContainer), true, 'An attached view should have its PARENT point to a container.');
|
10132 |
|
10133 |
|
10134 | const prevVCRef = new R3ViewContainerRef(prevLContainer, prevLContainer[T_HOST], prevLContainer[PARENT]);
|
10135 | prevVCRef.detach(prevVCRef.indexOf(viewRef));
|
10136 | }
|
10137 | }
|
10138 | const adjustedIdx = this._adjustIndex(index);
|
10139 | insertView(tView, lView, this._lContainer, adjustedIdx);
|
10140 | const beforeNode = getBeforeNodeForView(adjustedIdx, this._lContainer);
|
10141 | addRemoveViewFromContainer(tView, lView, true, beforeNode);
|
10142 | viewRef.attachToViewContainerRef(this);
|
10143 | addToArray(this._lContainer[VIEW_REFS], adjustedIdx, viewRef);
|
10144 | return viewRef;
|
10145 | }
|
10146 | move(viewRef, newIndex) {
|
10147 | if (viewRef.destroyed) {
|
10148 | throw new Error('Cannot move a destroyed View in a ViewContainer!');
|
10149 | }
|
10150 | return this.insert(viewRef, newIndex);
|
10151 | }
|
10152 | indexOf(viewRef) {
|
10153 | const viewRefsArr = this._lContainer[VIEW_REFS];
|
10154 | return viewRefsArr !== null ? viewRefsArr.indexOf(viewRef) : -1;
|
10155 | }
|
10156 | remove(index) {
|
10157 | this.allocateContainerIfNeeded();
|
10158 | const adjustedIdx = this._adjustIndex(index, -1);
|
10159 | const detachedView = detachView(this._lContainer, adjustedIdx);
|
10160 | if (detachedView) {
|
10161 |
|
10162 |
|
10163 |
|
10164 |
|
10165 |
|
10166 |
|
10167 | removeFromArray(this._lContainer[VIEW_REFS], adjustedIdx);
|
10168 | destroyLView(detachedView[TVIEW], detachedView);
|
10169 | }
|
10170 | }
|
10171 | detach(index) {
|
10172 | this.allocateContainerIfNeeded();
|
10173 | const adjustedIdx = this._adjustIndex(index, -1);
|
10174 | const view = detachView(this._lContainer, adjustedIdx);
|
10175 | const wasDetached = view && removeFromArray(this._lContainer[VIEW_REFS], adjustedIdx) != null;
|
10176 | return wasDetached ? new ViewRef(view) : null;
|
10177 | }
|
10178 | _adjustIndex(index, shift = 0) {
|
10179 | if (index == null) {
|
10180 | return this.length + shift;
|
10181 | }
|
10182 | if (ngDevMode) {
|
10183 | assertGreaterThan(index, -1, `ViewRef index must be positive, got ${index}`);
|
10184 |
|
10185 | assertLessThan(index, this.length + 1 + shift, 'index');
|
10186 | }
|
10187 | return index;
|
10188 | }
|
10189 | allocateContainerIfNeeded() {
|
10190 | if (this._lContainer[VIEW_REFS] === null) {
|
10191 | this._lContainer[VIEW_REFS] = [];
|
10192 | }
|
10193 | }
|
10194 | };
|
10195 | }
|
10196 | ngDevMode &&
|
10197 | assertNodeOfPossibleTypes(hostTNode, [0 , 3 , 4 ]);
|
10198 | let lContainer;
|
10199 | const slotValue = hostView[hostTNode.index];
|
10200 | if (isLContainer(slotValue)) {
|
10201 |
|
10202 | lContainer = slotValue;
|
10203 | }
|
10204 | else {
|
10205 | let commentNode;
|
10206 |
|
10207 |
|
10208 |
|
10209 |
|
10210 | if (hostTNode.type === 4 ) {
|
10211 | commentNode = unwrapRNode(slotValue);
|
10212 | }
|
10213 | else {
|
10214 | ngDevMode && ngDevMode.rendererCreateComment++;
|
10215 | commentNode = hostView[RENDERER].createComment(ngDevMode ? 'container' : '');
|
10216 |
|
10217 |
|
10218 |
|
10219 |
|
10220 |
|
10221 | if (isRootView(hostView)) {
|
10222 | const renderer = hostView[RENDERER];
|
10223 | const hostNative = getNativeByTNode(hostTNode, hostView);
|
10224 | const parentOfHostNative = nativeParentNode(renderer, hostNative);
|
10225 | nativeInsertBefore(renderer, parentOfHostNative, commentNode, nativeNextSibling(renderer, hostNative));
|
10226 | }
|
10227 | else {
|
10228 | appendChild(hostView[TVIEW], hostView, commentNode, hostTNode);
|
10229 | }
|
10230 | }
|
10231 | hostView[hostTNode.index] = lContainer =
|
10232 | createLContainer(slotValue, hostView, commentNode, hostTNode);
|
10233 | addToViewTree(hostView, lContainer);
|
10234 | }
|
10235 | return new R3ViewContainerRef(lContainer, hostTNode, hostView);
|
10236 | }
|
10237 |
|
10238 | function injectChangeDetectorRef(isPipe = false) {
|
10239 | return createViewRef(getPreviousOrParentTNode(), getLView(), isPipe);
|
10240 | }
|
10241 |
|
10242 |
|
10243 |
|
10244 |
|
10245 |
|
10246 |
|
10247 |
|
10248 |
|
10249 | function createViewRef(tNode, lView, isPipe) {
|
10250 |
|
10251 |
|
10252 | const isComponentView = !isPipe && isComponentHost(tNode);
|
10253 | if (isComponentView) {
|
10254 |
|
10255 |
|
10256 | const componentView = getComponentLViewByIndex(tNode.index, lView);
|
10257 | return new ViewRef(componentView, componentView);
|
10258 | }
|
10259 | else if (tNode.type === 3 || tNode.type === 0 ||
|
10260 | tNode.type === 4 || tNode.type === 5 ) {
|
10261 |
|
10262 |
|
10263 | const hostComponentView = lView[DECLARATION_COMPONENT_VIEW];
|
10264 | return new ViewRef(hostComponentView, lView);
|
10265 | }
|
10266 | return null;
|
10267 | }
|
10268 |
|
10269 | function getOrCreateRenderer2(view) {
|
10270 | const renderer = view[RENDERER];
|
10271 | if (isProceduralRenderer(renderer)) {
|
10272 | return renderer;
|
10273 | }
|
10274 | else {
|
10275 | throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');
|
10276 | }
|
10277 | }
|
10278 |
|
10279 | function injectRenderer2() {
|
10280 |
|
10281 |
|
10282 | const lView = getLView();
|
10283 | const tNode = getPreviousOrParentTNode();
|
10284 | const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
|
10285 | return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);
|
10286 | }
|
10287 |
|
10288 |
|
10289 |
|
10290 |
|
10291 |
|
10292 |
|
10293 |
|
10294 |
|
10295 |
|
10296 |
|
10297 |
|
10298 |
|
10299 |
|
10300 |
|
10301 |
|
10302 |
|
10303 |
|
10304 |
|
10305 |
|
10306 |
|
10307 |
|
10308 |
|
10309 |
|
10310 |
|
10311 |
|
10312 |
|
10313 |
|
10314 |
|
10315 |
|
10316 |
|
10317 |
|
10318 |
|
10319 |
|
10320 |
|
10321 |
|
10322 |
|
10323 |
|
10324 |
|
10325 |
|
10326 |
|
10327 |
|
10328 |
|
10329 |
|
10330 |
|
10331 |
|
10332 |
|
10333 |
|
10334 |
|
10335 |
|
10336 |
|
10337 |
|
10338 |
|
10339 |
|
10340 | class ChangeDetectorRef {
|
10341 | }
|
10342 |
|
10343 |
|
10344 |
|
10345 |
|
10346 | ChangeDetectorRef.__NG_ELEMENT_ID__ = () => SWITCH_CHANGE_DETECTOR_REF_FACTORY();
|
10347 | const SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__ = injectChangeDetectorRef;
|
10348 | const SWITCH_CHANGE_DETECTOR_REF_FACTORY__PRE_R3__ = (...args) => { };
|
10349 | const ɵ0$5 = SWITCH_CHANGE_DETECTOR_REF_FACTORY__PRE_R3__;
|
10350 | const SWITCH_CHANGE_DETECTOR_REF_FACTORY = SWITCH_CHANGE_DETECTOR_REF_FACTORY__PRE_R3__;
|
10351 |
|
10352 |
|
10353 |
|
10354 |
|
10355 |
|
10356 |
|
10357 |
|
10358 |
|
10359 |
|
10360 |
|
10361 |
|
10362 |
|
10363 |
|
10364 |
|
10365 |
|
10366 |
|
10367 |
|
10368 |
|
10369 | const Type = Function;
|
10370 | function isType(v) {
|
10371 | return typeof v === 'function';
|
10372 | }
|
10373 |
|
10374 |
|
10375 |
|
10376 |
|
10377 |
|
10378 |
|
10379 |
|
10380 |
|
10381 |
|
10382 |
|
10383 |
|
10384 |
|
10385 |
|
10386 |
|
10387 |
|
10388 |
|
10389 |
|
10390 |
|
10391 |
|
10392 |
|
10393 |
|
10394 |
|
10395 |
|
10396 |
|
10397 |
|
10398 |
|
10399 |
|
10400 |
|
10401 |
|
10402 |
|
10403 |
|
10404 | const ES5_DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*(arguments|[^()]+\(arguments\))\)/;
|
10405 |
|
10406 | const ES2015_INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/;
|
10407 |
|
10408 |
|
10409 |
|
10410 |
|
10411 | const ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(/;
|
10412 |
|
10413 |
|
10414 |
|
10415 |
|
10416 | const ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{\s*super\(\.\.\.arguments\)/;
|
10417 |
|
10418 |
|
10419 |
|
10420 |
|
10421 |
|
10422 |
|
10423 |
|
10424 |
|
10425 | function isDelegateCtor(typeStr) {
|
10426 | return ES5_DELEGATE_CTOR.test(typeStr) ||
|
10427 | ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||
|
10428 | (ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr));
|
10429 | }
|
10430 | class ReflectionCapabilities {
|
10431 | constructor(reflect) {
|
10432 | this._reflect = reflect || _global['Reflect'];
|
10433 | }
|
10434 | isReflectionEnabled() {
|
10435 | return true;
|
10436 | }
|
10437 | factory(t) {
|
10438 | return (...args) => new t(...args);
|
10439 | }
|
10440 |
|
10441 | _zipTypesAndAnnotations(paramTypes, paramAnnotations) {
|
10442 | let result;
|
10443 | if (typeof paramTypes === 'undefined') {
|
10444 | result = newArray(paramAnnotations.length);
|
10445 | }
|
10446 | else {
|
10447 | result = newArray(paramTypes.length);
|
10448 | }
|
10449 | for (let i = 0; i < result.length; i++) {
|
10450 |
|
10451 |
|
10452 |
|
10453 | if (typeof paramTypes === 'undefined') {
|
10454 | result[i] = [];
|
10455 | }
|
10456 | else if (paramTypes[i] && paramTypes[i] != Object) {
|
10457 | result[i] = [paramTypes[i]];
|
10458 | }
|
10459 | else {
|
10460 | result[i] = [];
|
10461 | }
|
10462 | if (paramAnnotations && paramAnnotations[i] != null) {
|
10463 | result[i] = result[i].concat(paramAnnotations[i]);
|
10464 | }
|
10465 | }
|
10466 | return result;
|
10467 | }
|
10468 | _ownParameters(type, parentCtor) {
|
10469 | const typeStr = type.toString();
|
10470 |
|
10471 |
|
10472 |
|
10473 |
|
10474 |
|
10475 |
|
10476 |
|
10477 | if (isDelegateCtor(typeStr)) {
|
10478 | return null;
|
10479 | }
|
10480 |
|
10481 | if (type.parameters && type.parameters !== parentCtor.parameters) {
|
10482 | return type.parameters;
|
10483 | }
|
10484 |
|
10485 | const tsickleCtorParams = type.ctorParameters;
|
10486 | if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
|
10487 |
|
10488 |
|
10489 | const ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
|
10490 | const paramTypes = ctorParameters.map((ctorParam) => ctorParam && ctorParam.type);
|
10491 | const paramAnnotations = ctorParameters.map((ctorParam) => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators));
|
10492 | return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
10493 | }
|
10494 |
|
10495 | const paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS];
|
10496 | const paramTypes = this._reflect && this._reflect.getOwnMetadata &&
|
10497 | this._reflect.getOwnMetadata('design:paramtypes', type);
|
10498 | if (paramTypes || paramAnnotations) {
|
10499 | return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
10500 | }
|
10501 |
|
10502 |
|
10503 |
|
10504 |
|
10505 | return newArray(type.length);
|
10506 | }
|
10507 | parameters(type) {
|
10508 |
|
10509 |
|
10510 | if (!isType(type)) {
|
10511 | return [];
|
10512 | }
|
10513 | const parentCtor = getParentCtor(type);
|
10514 | let parameters = this._ownParameters(type, parentCtor);
|
10515 | if (!parameters && parentCtor !== Object) {
|
10516 | parameters = this.parameters(parentCtor);
|
10517 | }
|
10518 | return parameters || [];
|
10519 | }
|
10520 | _ownAnnotations(typeOrFunc, parentCtor) {
|
10521 |
|
10522 | if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) {
|
10523 | let annotations = typeOrFunc.annotations;
|
10524 | if (typeof annotations === 'function' && annotations.annotations) {
|
10525 | annotations = annotations.annotations;
|
10526 | }
|
10527 | return annotations;
|
10528 | }
|
10529 |
|
10530 | if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) {
|
10531 | return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators);
|
10532 | }
|
10533 |
|
10534 | if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {
|
10535 | return typeOrFunc[ANNOTATIONS];
|
10536 | }
|
10537 | return null;
|
10538 | }
|
10539 | annotations(typeOrFunc) {
|
10540 | if (!isType(typeOrFunc)) {
|
10541 | return [];
|
10542 | }
|
10543 | const parentCtor = getParentCtor(typeOrFunc);
|
10544 | const ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
|
10545 | const parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
|
10546 | return parentAnnotations.concat(ownAnnotations);
|
10547 | }
|
10548 | _ownPropMetadata(typeOrFunc, parentCtor) {
|
10549 |
|
10550 | if (typeOrFunc.propMetadata &&
|
10551 | typeOrFunc.propMetadata !== parentCtor.propMetadata) {
|
10552 | let propMetadata = typeOrFunc.propMetadata;
|
10553 | if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
|
10554 | propMetadata = propMetadata.propMetadata;
|
10555 | }
|
10556 | return propMetadata;
|
10557 | }
|
10558 |
|
10559 | if (typeOrFunc.propDecorators &&
|
10560 | typeOrFunc.propDecorators !== parentCtor.propDecorators) {
|
10561 | const propDecorators = typeOrFunc.propDecorators;
|
10562 | const propMetadata = {};
|
10563 | Object.keys(propDecorators).forEach(prop => {
|
10564 | propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
|
10565 | });
|
10566 | return propMetadata;
|
10567 | }
|
10568 |
|
10569 | if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
|
10570 | return typeOrFunc[PROP_METADATA];
|
10571 | }
|
10572 | return null;
|
10573 | }
|
10574 | propMetadata(typeOrFunc) {
|
10575 | if (!isType(typeOrFunc)) {
|
10576 | return {};
|
10577 | }
|
10578 | const parentCtor = getParentCtor(typeOrFunc);
|
10579 | const propMetadata = {};
|
10580 | if (parentCtor !== Object) {
|
10581 | const parentPropMetadata = this.propMetadata(parentCtor);
|
10582 | Object.keys(parentPropMetadata).forEach((propName) => {
|
10583 | propMetadata[propName] = parentPropMetadata[propName];
|
10584 | });
|
10585 | }
|
10586 | const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
|
10587 | if (ownPropMetadata) {
|
10588 | Object.keys(ownPropMetadata).forEach((propName) => {
|
10589 | const decorators = [];
|
10590 | if (propMetadata.hasOwnProperty(propName)) {
|
10591 | decorators.push(...propMetadata[propName]);
|
10592 | }
|
10593 | decorators.push(...ownPropMetadata[propName]);
|
10594 | propMetadata[propName] = decorators;
|
10595 | });
|
10596 | }
|
10597 | return propMetadata;
|
10598 | }
|
10599 | ownPropMetadata(typeOrFunc) {
|
10600 | if (!isType(typeOrFunc)) {
|
10601 | return {};
|
10602 | }
|
10603 | return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};
|
10604 | }
|
10605 | hasLifecycleHook(type, lcProperty) {
|
10606 | return type instanceof Type && lcProperty in type.prototype;
|
10607 | }
|
10608 | guards(type) {
|
10609 | return {};
|
10610 | }
|
10611 | getter(name) {
|
10612 | return new Function('o', 'return o.' + name + ';');
|
10613 | }
|
10614 | setter(name) {
|
10615 | return new Function('o', 'v', 'return o.' + name + ' = v;');
|
10616 | }
|
10617 | method(name) {
|
10618 | const functionBody = `if (!o.${name}) throw new Error('"${name}" is undefined');
|
10619 | return o.${name}.apply(o, args);`;
|
10620 | return new Function('o', 'args', functionBody);
|
10621 | }
|
10622 |
|
10623 | importUri(type) {
|
10624 |
|
10625 | if (typeof type === 'object' && type['filePath']) {
|
10626 | return type['filePath'];
|
10627 | }
|
10628 |
|
10629 | return `./${stringify(type)}`;
|
10630 | }
|
10631 | resourceUri(type) {
|
10632 | return `./${stringify(type)}`;
|
10633 | }
|
10634 | resolveIdentifier(name, moduleUrl, members, runtime) {
|
10635 | return runtime;
|
10636 | }
|
10637 | resolveEnum(enumIdentifier, name) {
|
10638 | return enumIdentifier[name];
|
10639 | }
|
10640 | }
|
10641 | function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
|
10642 | if (!decoratorInvocations) {
|
10643 | return [];
|
10644 | }
|
10645 | return decoratorInvocations.map(decoratorInvocation => {
|
10646 | const decoratorType = decoratorInvocation.type;
|
10647 | const annotationCls = decoratorType.annotationCls;
|
10648 | const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
|
10649 | return new annotationCls(...annotationArgs);
|
10650 | });
|
10651 | }
|
10652 | function getParentCtor(ctor) {
|
10653 | const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
|
10654 | const parentCtor = parentProto ? parentProto.constructor : null;
|
10655 |
|
10656 |
|
10657 | return parentCtor || Object;
|
10658 | }
|
10659 |
|
10660 |
|
10661 |
|
10662 |
|
10663 |
|
10664 |
|
10665 |
|
10666 |
|
10667 | let _reflect = null;
|
10668 | function getReflect() {
|
10669 | return (_reflect = _reflect || new ReflectionCapabilities());
|
10670 | }
|
10671 | function reflectDependencies(type) {
|
10672 | return convertDependencies(getReflect().parameters(type));
|
10673 | }
|
10674 | function convertDependencies(deps) {
|
10675 | const compiler = getCompilerFacade();
|
10676 | return deps.map(dep => reflectDependency(compiler, dep));
|
10677 | }
|
10678 | function reflectDependency(compiler, dep) {
|
10679 | const meta = {
|
10680 | token: null,
|
10681 | host: false,
|
10682 | optional: false,
|
10683 | resolved: compiler.R3ResolvedDependencyType.Token,
|
10684 | self: false,
|
10685 | skipSelf: false,
|
10686 | };
|
10687 | function setTokenAndResolvedType(token) {
|
10688 | meta.resolved = compiler.R3ResolvedDependencyType.Token;
|
10689 | meta.token = token;
|
10690 | }
|
10691 | if (Array.isArray(dep) && dep.length > 0) {
|
10692 | for (let j = 0; j < dep.length; j++) {
|
10693 | const param = dep[j];
|
10694 | if (param === undefined) {
|
10695 |
|
10696 | continue;
|
10697 | }
|
10698 | const proto = Object.getPrototypeOf(param);
|
10699 | if (param instanceof Optional || proto.ngMetadataName === 'Optional') {
|
10700 | meta.optional = true;
|
10701 | }
|
10702 | else if (param instanceof SkipSelf || proto.ngMetadataName === 'SkipSelf') {
|
10703 | meta.skipSelf = true;
|
10704 | }
|
10705 | else if (param instanceof Self || proto.ngMetadataName === 'Self') {
|
10706 | meta.self = true;
|
10707 | }
|
10708 | else if (param instanceof Host || proto.ngMetadataName === 'Host') {
|
10709 | meta.host = true;
|
10710 | }
|
10711 | else if (param instanceof Inject) {
|
10712 | meta.token = param.token;
|
10713 | }
|
10714 | else if (param instanceof Attribute) {
|
10715 | if (param.attributeName === undefined) {
|
10716 | throw new Error(`Attribute name must be defined.`);
|
10717 | }
|
10718 | meta.token = param.attributeName;
|
10719 | meta.resolved = compiler.R3ResolvedDependencyType.Attribute;
|
10720 | }
|
10721 | else if (param === ChangeDetectorRef) {
|
10722 | meta.token = param;
|
10723 | meta.resolved = compiler.R3ResolvedDependencyType.ChangeDetectorRef;
|
10724 | }
|
10725 | else {
|
10726 | setTokenAndResolvedType(param);
|
10727 | }
|
10728 | }
|
10729 | }
|
10730 | else if (dep === undefined || (Array.isArray(dep) && dep.length === 0)) {
|
10731 | meta.token = undefined;
|
10732 | meta.resolved = R3ResolvedDependencyType.Invalid;
|
10733 | }
|
10734 | else {
|
10735 | setTokenAndResolvedType(dep);
|
10736 | }
|
10737 | return meta;
|
10738 | }
|
10739 |
|
10740 |
|
10741 |
|
10742 |
|
10743 |
|
10744 |
|
10745 |
|
10746 |
|
10747 |
|
10748 |
|
10749 |
|
10750 |
|
10751 | function compileInjectable(type, srcMeta) {
|
10752 | let ngInjectableDef = null;
|
10753 | let ngFactoryDef = null;
|
10754 |
|
10755 | if (!type.hasOwnProperty(NG_PROV_DEF)) {
|
10756 | Object.defineProperty(type, NG_PROV_DEF, {
|
10757 | get: () => {
|
10758 | if (ngInjectableDef === null) {
|
10759 | ngInjectableDef = getCompilerFacade().compileInjectable(angularCoreDiEnv, `ng:///${type.name}/ɵprov.js`, getInjectableMetadata(type, srcMeta));
|
10760 | }
|
10761 | return ngInjectableDef;
|
10762 | },
|
10763 | });
|
10764 |
|
10765 |
|
10766 |
|
10767 |
|
10768 |
|
10769 |
|
10770 | if (!type.hasOwnProperty(NG_PROV_DEF_FALLBACK)) {
|
10771 | type[NG_PROV_DEF_FALLBACK] = () => type[NG_PROV_DEF];
|
10772 | }
|
10773 | }
|
10774 |
|
10775 | if (!type.hasOwnProperty(NG_FACTORY_DEF)) {
|
10776 | Object.defineProperty(type, NG_FACTORY_DEF, {
|
10777 | get: () => {
|
10778 | if (ngFactoryDef === null) {
|
10779 | const metadata = getInjectableMetadata(type, srcMeta);
|
10780 | const compiler = getCompilerFacade();
|
10781 | ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/ɵfac.js`, {
|
10782 | name: metadata.name,
|
10783 | type: metadata.type,
|
10784 | typeArgumentCount: metadata.typeArgumentCount,
|
10785 | deps: reflectDependencies(type),
|
10786 | injectFn: 'inject',
|
10787 | target: compiler.R3FactoryTarget.Injectable
|
10788 | });
|
10789 | }
|
10790 | return ngFactoryDef;
|
10791 | },
|
10792 |
|
10793 | configurable: true
|
10794 | });
|
10795 | }
|
10796 | }
|
10797 | const ɵ0$6 = getClosureSafeProperty;
|
10798 | const USE_VALUE$1 = getClosureSafeProperty({ provide: String, useValue: ɵ0$6 });
|
10799 | function isUseClassProvider(meta) {
|
10800 | return meta.useClass !== undefined;
|
10801 | }
|
10802 | function isUseValueProvider(meta) {
|
10803 | return USE_VALUE$1 in meta;
|
10804 | }
|
10805 | function isUseFactoryProvider(meta) {
|
10806 | return meta.useFactory !== undefined;
|
10807 | }
|
10808 | function isUseExistingProvider(meta) {
|
10809 | return meta.useExisting !== undefined;
|
10810 | }
|
10811 | function getInjectableMetadata(type, srcMeta) {
|
10812 |
|
10813 | const meta = srcMeta || { providedIn: null };
|
10814 | const compilerMeta = {
|
10815 | name: type.name,
|
10816 | type: type,
|
10817 | typeArgumentCount: 0,
|
10818 | providedIn: meta.providedIn,
|
10819 | userDeps: undefined,
|
10820 | };
|
10821 | if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== undefined) {
|
10822 | compilerMeta.userDeps = convertDependencies(meta.deps);
|
10823 | }
|
10824 | if (isUseClassProvider(meta)) {
|
10825 |
|
10826 | compilerMeta.useClass = resolveForwardRef(meta.useClass);
|
10827 | }
|
10828 | else if (isUseValueProvider(meta)) {
|
10829 |
|
10830 | compilerMeta.useValue = resolveForwardRef(meta.useValue);
|
10831 | }
|
10832 | else if (isUseFactoryProvider(meta)) {
|
10833 |
|
10834 | compilerMeta.useFactory = meta.useFactory;
|
10835 | }
|
10836 | else if (isUseExistingProvider(meta)) {
|
10837 |
|
10838 | compilerMeta.useExisting = resolveForwardRef(meta.useExisting);
|
10839 | }
|
10840 | return compilerMeta;
|
10841 | }
|
10842 |
|
10843 |
|
10844 |
|
10845 |
|
10846 |
|
10847 |
|
10848 |
|
10849 |
|
10850 | const ɵ0$7 = getClosureSafeProperty;
|
10851 | const USE_VALUE$2 = getClosureSafeProperty({ provide: String, useValue: ɵ0$7 });
|
10852 | const EMPTY_ARRAY$1 = [];
|
10853 | function convertInjectableProviderToFactory(type, provider) {
|
10854 | if (!provider) {
|
10855 | const reflectionCapabilities = new ReflectionCapabilities();
|
10856 | const deps = reflectionCapabilities.parameters(type);
|
10857 |
|
10858 | return () => new type(...injectArgs(deps));
|
10859 | }
|
10860 | if (USE_VALUE$2 in provider) {
|
10861 | const valueProvider = provider;
|
10862 | return () => valueProvider.useValue;
|
10863 | }
|
10864 | else if (provider.useExisting) {
|
10865 | const existingProvider = provider;
|
10866 | return () => ɵɵinject(resolveForwardRef(existingProvider.useExisting));
|
10867 | }
|
10868 | else if (provider.useFactory) {
|
10869 | const factoryProvider = provider;
|
10870 | return () => factoryProvider.useFactory(...injectArgs(factoryProvider.deps || EMPTY_ARRAY$1));
|
10871 | }
|
10872 | else if (provider.useClass) {
|
10873 | const classProvider = provider;
|
10874 | let deps = provider.deps;
|
10875 | if (!deps) {
|
10876 | const reflectionCapabilities = new ReflectionCapabilities();
|
10877 | deps = reflectionCapabilities.parameters(type);
|
10878 | }
|
10879 | return () => new (resolveForwardRef(classProvider.useClass))(...injectArgs(deps));
|
10880 | }
|
10881 | else {
|
10882 | let deps = provider.deps;
|
10883 | if (!deps) {
|
10884 | const reflectionCapabilities = new ReflectionCapabilities();
|
10885 | deps = reflectionCapabilities.parameters(type);
|
10886 | }
|
10887 | return () => new type(...injectArgs(deps));
|
10888 | }
|
10889 | }
|
10890 |
|
10891 |
|
10892 |
|
10893 |
|
10894 |
|
10895 |
|
10896 |
|
10897 |
|
10898 | const ɵ0$8 = (type, meta) => SWITCH_COMPILE_INJECTABLE(type, meta);
|
10899 |
|
10900 |
|
10901 |
|
10902 |
|
10903 |
|
10904 |
|
10905 | const Injectable = makeDecorator('Injectable', undefined, undefined, undefined, ɵ0$8);
|
10906 |
|
10907 |
|
10908 |
|
10909 | function render2CompileInjectable(injectableType, options) {
|
10910 | if (options && options.providedIn !== undefined && !getInjectableDef(injectableType)) {
|
10911 | injectableType.ɵprov = ɵɵdefineInjectable({
|
10912 | token: injectableType,
|
10913 | providedIn: options.providedIn,
|
10914 | factory: convertInjectableProviderToFactory(injectableType, options),
|
10915 | });
|
10916 | }
|
10917 | }
|
10918 | const SWITCH_COMPILE_INJECTABLE__POST_R3__ = compileInjectable;
|
10919 | const SWITCH_COMPILE_INJECTABLE__PRE_R3__ = render2CompileInjectable;
|
10920 | const SWITCH_COMPILE_INJECTABLE = SWITCH_COMPILE_INJECTABLE__PRE_R3__;
|
10921 |
|
10922 |
|
10923 |
|
10924 |
|
10925 |
|
10926 |
|
10927 |
|
10928 |
|
10929 |
|
10930 |
|
10931 |
|
10932 |
|
10933 |
|
10934 | const INJECTOR_SCOPE = new InjectionToken('Set Injector scope.');
|
10935 |
|
10936 |
|
10937 |
|
10938 |
|
10939 |
|
10940 |
|
10941 |
|
10942 |
|
10943 |
|
10944 |
|
10945 |
|
10946 | const NOT_YET = {};
|
10947 |
|
10948 |
|
10949 |
|
10950 |
|
10951 |
|
10952 |
|
10953 |
|
10954 | const CIRCULAR = {};
|
10955 | const EMPTY_ARRAY$2 = [];
|
10956 |
|
10957 |
|
10958 |
|
10959 | let NULL_INJECTOR = undefined;
|
10960 | function getNullInjector() {
|
10961 | if (NULL_INJECTOR === undefined) {
|
10962 | NULL_INJECTOR = new NullInjector();
|
10963 | }
|
10964 | return NULL_INJECTOR;
|
10965 | }
|
10966 |
|
10967 |
|
10968 |
|
10969 |
|
10970 |
|
10971 | function createInjector(defType, parent = null, additionalProviders = null, name) {
|
10972 | const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name);
|
10973 | injector._resolveInjectorDefTypes();
|
10974 | return injector;
|
10975 | }
|
10976 |
|
10977 |
|
10978 |
|
10979 |
|
10980 |
|
10981 | function createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name) {
|
10982 | return new R3Injector(defType, additionalProviders, parent || getNullInjector(), name);
|
10983 | }
|
10984 | class R3Injector {
|
10985 | constructor(def, additionalProviders, parent, source = null) {
|
10986 | this.parent = parent;
|
10987 | |
10988 |
|
10989 |
|
10990 |
|
10991 |
|
10992 | this.records = new Map();
|
10993 | |
10994 |
|
10995 |
|
10996 | this.injectorDefTypes = new Set();
|
10997 | |
10998 |
|
10999 |
|
11000 | this.onDestroy = new Set();
|
11001 | this._destroyed = false;
|
11002 | const dedupStack = [];
|
11003 |
|
11004 |
|
11005 |
|
11006 | additionalProviders &&
|
11007 | deepForEach(additionalProviders, provider => this.processProvider(provider, def, additionalProviders));
|
11008 | deepForEach([def], injectorDef => this.processInjectorType(injectorDef, [], dedupStack));
|
11009 |
|
11010 | this.records.set(INJECTOR, makeRecord(undefined, this));
|
11011 |
|
11012 |
|
11013 | const record = this.records.get(INJECTOR_SCOPE);
|
11014 | this.scope = record != null ? record.value : null;
|
11015 |
|
11016 | this.source = source || (typeof def === 'object' ? null : stringify(def));
|
11017 | }
|
11018 | |
11019 |
|
11020 |
|
11021 | get destroyed() {
|
11022 | return this._destroyed;
|
11023 | }
|
11024 | |
11025 |
|
11026 |
|
11027 |
|
11028 |
|
11029 |
|
11030 | destroy() {
|
11031 | this.assertNotDestroyed();
|
11032 |
|
11033 | this._destroyed = true;
|
11034 | try {
|
11035 |
|
11036 | this.onDestroy.forEach(service => service.ngOnDestroy());
|
11037 | }
|
11038 | finally {
|
11039 |
|
11040 | this.records.clear();
|
11041 | this.onDestroy.clear();
|
11042 | this.injectorDefTypes.clear();
|
11043 | }
|
11044 | }
|
11045 | get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {
|
11046 | this.assertNotDestroyed();
|
11047 |
|
11048 | const previousInjector = setCurrentInjector(this);
|
11049 | try {
|
11050 |
|
11051 | if (!(flags & InjectFlags.SkipSelf)) {
|
11052 |
|
11053 | let record = this.records.get(token);
|
11054 | if (record === undefined) {
|
11055 |
|
11056 |
|
11057 | const def = couldBeInjectableType(token) && getInjectableDef(token);
|
11058 | if (def && this.injectableDefInScope(def)) {
|
11059 |
|
11060 |
|
11061 | record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET);
|
11062 | }
|
11063 | else {
|
11064 | record = null;
|
11065 | }
|
11066 | this.records.set(token, record);
|
11067 | }
|
11068 |
|
11069 | if (record != null ) {
|
11070 | return this.hydrate(token, record);
|
11071 | }
|
11072 | }
|
11073 |
|
11074 |
|
11075 | const nextInjector = !(flags & InjectFlags.Self) ? this.parent : getNullInjector();
|
11076 |
|
11077 |
|
11078 | notFoundValue = (flags & InjectFlags.Optional) && notFoundValue === THROW_IF_NOT_FOUND ?
|
11079 | null :
|
11080 | notFoundValue;
|
11081 | return nextInjector.get(token, notFoundValue);
|
11082 | }
|
11083 | catch (e) {
|
11084 | if (e.name === 'NullInjectorError') {
|
11085 | const path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
|
11086 | path.unshift(stringify(token));
|
11087 | if (previousInjector) {
|
11088 |
|
11089 | throw e;
|
11090 | }
|
11091 | else {
|
11092 |
|
11093 | return catchInjectorError(e, token, 'R3InjectorError', this.source);
|
11094 | }
|
11095 | }
|
11096 | else {
|
11097 | throw e;
|
11098 | }
|
11099 | }
|
11100 | finally {
|
11101 |
|
11102 | setCurrentInjector(previousInjector);
|
11103 | }
|
11104 | }
|
11105 |
|
11106 | _resolveInjectorDefTypes() {
|
11107 | this.injectorDefTypes.forEach(defType => this.get(defType));
|
11108 | }
|
11109 | toString() {
|
11110 | const tokens = [], records = this.records;
|
11111 | records.forEach((v, token) => tokens.push(stringify(token)));
|
11112 | return `R3Injector[${tokens.join(', ')}]`;
|
11113 | }
|
11114 | assertNotDestroyed() {
|
11115 | if (this._destroyed) {
|
11116 | throw new Error('Injector has already been destroyed.');
|
11117 | }
|
11118 | }
|
11119 | |
11120 |
|
11121 |
|
11122 |
|
11123 |
|
11124 |
|
11125 |
|
11126 |
|
11127 |
|
11128 | processInjectorType(defOrWrappedDef, parents, dedupStack) {
|
11129 | defOrWrappedDef = resolveForwardRef(defOrWrappedDef);
|
11130 | if (!defOrWrappedDef)
|
11131 | return false;
|
11132 |
|
11133 |
|
11134 |
|
11135 |
|
11136 | let def = getInjectorDef(defOrWrappedDef);
|
11137 |
|
11138 | const ngModule = (def == null) && defOrWrappedDef.ngModule || undefined;
|
11139 |
|
11140 |
|
11141 |
|
11142 | const defType = (ngModule === undefined) ? defOrWrappedDef : ngModule;
|
11143 |
|
11144 | if (ngDevMode && parents.indexOf(defType) !== -1) {
|
11145 | const defName = stringify(defType);
|
11146 | throw new Error(`Circular dependency in DI detected for type ${defName}. Dependency path: ${parents.map(defType => stringify(defType)).join(' > ')} > ${defName}.`);
|
11147 | }
|
11148 |
|
11149 | const isDuplicate = dedupStack.indexOf(defType) !== -1;
|
11150 |
|
11151 |
|
11152 | if (ngModule !== undefined) {
|
11153 | def = getInjectorDef(ngModule);
|
11154 | }
|
11155 |
|
11156 | if (def == null) {
|
11157 | return false;
|
11158 | }
|
11159 |
|
11160 |
|
11161 | if (def.imports != null && !isDuplicate) {
|
11162 |
|
11163 |
|
11164 | ngDevMode && parents.push(defType);
|
11165 |
|
11166 | dedupStack.push(defType);
|
11167 | let importTypesWithProviders;
|
11168 | try {
|
11169 | deepForEach(def.imports, imported => {
|
11170 | if (this.processInjectorType(imported, parents, dedupStack)) {
|
11171 | if (importTypesWithProviders === undefined)
|
11172 | importTypesWithProviders = [];
|
11173 |
|
11174 |
|
11175 | importTypesWithProviders.push(imported);
|
11176 | }
|
11177 | });
|
11178 | }
|
11179 | finally {
|
11180 |
|
11181 | ngDevMode && parents.pop();
|
11182 | }
|
11183 |
|
11184 |
|
11185 |
|
11186 | if (importTypesWithProviders !== undefined) {
|
11187 | for (let i = 0; i < importTypesWithProviders.length; i++) {
|
11188 | const { ngModule, providers } = importTypesWithProviders[i];
|
11189 | deepForEach(providers, provider => this.processProvider(provider, ngModule, providers || EMPTY_ARRAY$2));
|
11190 | }
|
11191 | }
|
11192 | }
|
11193 |
|
11194 |
|
11195 | this.injectorDefTypes.add(defType);
|
11196 | this.records.set(defType, makeRecord(def.factory, NOT_YET));
|
11197 |
|
11198 | const defProviders = def.providers;
|
11199 | if (defProviders != null && !isDuplicate) {
|
11200 | const injectorType = defOrWrappedDef;
|
11201 | deepForEach(defProviders, provider => this.processProvider(provider, injectorType, defProviders));
|
11202 | }
|
11203 | return (ngModule !== undefined &&
|
11204 | defOrWrappedDef.providers !== undefined);
|
11205 | }
|
11206 | |
11207 |
|
11208 |
|
11209 | processProvider(provider, ngModuleType, providers) {
|
11210 |
|
11211 |
|
11212 | provider = resolveForwardRef(provider);
|
11213 | let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide);
|
11214 |
|
11215 | const record = providerToRecord(provider, ngModuleType, providers);
|
11216 | if (!isTypeProvider(provider) && provider.multi === true) {
|
11217 |
|
11218 |
|
11219 | let multiRecord = this.records.get(token);
|
11220 | if (multiRecord) {
|
11221 |
|
11222 | if (multiRecord.multi === undefined) {
|
11223 | throwMixedMultiProviderError();
|
11224 | }
|
11225 | }
|
11226 | else {
|
11227 | multiRecord = makeRecord(undefined, NOT_YET, true);
|
11228 | multiRecord.factory = () => injectArgs(multiRecord.multi);
|
11229 | this.records.set(token, multiRecord);
|
11230 | }
|
11231 | token = provider;
|
11232 | multiRecord.multi.push(provider);
|
11233 | }
|
11234 | else {
|
11235 | const existing = this.records.get(token);
|
11236 | if (existing && existing.multi !== undefined) {
|
11237 | throwMixedMultiProviderError();
|
11238 | }
|
11239 | }
|
11240 | this.records.set(token, record);
|
11241 | }
|
11242 | hydrate(token, record) {
|
11243 | if (record.value === CIRCULAR) {
|
11244 | throwCyclicDependencyError(stringify(token));
|
11245 | }
|
11246 | else if (record.value === NOT_YET) {
|
11247 | record.value = CIRCULAR;
|
11248 | record.value = record.factory();
|
11249 | }
|
11250 | if (typeof record.value === 'object' && record.value && hasOnDestroy(record.value)) {
|
11251 | this.onDestroy.add(record.value);
|
11252 | }
|
11253 | return record.value;
|
11254 | }
|
11255 | injectableDefInScope(def) {
|
11256 | if (!def.providedIn) {
|
11257 | return false;
|
11258 | }
|
11259 | else if (typeof def.providedIn === 'string') {
|
11260 | return def.providedIn === 'any' || (def.providedIn === this.scope);
|
11261 | }
|
11262 | else {
|
11263 | return this.injectorDefTypes.has(def.providedIn);
|
11264 | }
|
11265 | }
|
11266 | }
|
11267 | function injectableDefOrInjectorDefFactory(token) {
|
11268 |
|
11269 | const injectableDef = getInjectableDef(token);
|
11270 | const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token);
|
11271 | if (factory !== null) {
|
11272 | return factory;
|
11273 | }
|
11274 |
|
11275 |
|
11276 | const injectorDef = getInjectorDef(token);
|
11277 | if (injectorDef !== null) {
|
11278 | return injectorDef.factory;
|
11279 | }
|
11280 |
|
11281 |
|
11282 | if (token instanceof InjectionToken) {
|
11283 | throw new Error(`Token ${stringify(token)} is missing a ɵprov definition.`);
|
11284 | }
|
11285 |
|
11286 | if (token instanceof Function) {
|
11287 | return getUndecoratedInjectableFactory(token);
|
11288 | }
|
11289 |
|
11290 | throw new Error('unreachable');
|
11291 | }
|
11292 | function getUndecoratedInjectableFactory(token) {
|
11293 |
|
11294 | const paramLength = token.length;
|
11295 | if (paramLength > 0) {
|
11296 | const args = newArray(paramLength, '?');
|
11297 | throw new Error(`Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).`);
|
11298 | }
|
11299 |
|
11300 |
|
11301 |
|
11302 |
|
11303 |
|
11304 | const inheritedInjectableDef = getInheritedInjectableDef(token);
|
11305 | if (inheritedInjectableDef !== null) {
|
11306 | return () => inheritedInjectableDef.factory(token);
|
11307 | }
|
11308 | else {
|
11309 | return () => new token();
|
11310 | }
|
11311 | }
|
11312 | function providerToRecord(provider, ngModuleType, providers) {
|
11313 | if (isValueProvider(provider)) {
|
11314 | return makeRecord(undefined, provider.useValue);
|
11315 | }
|
11316 | else {
|
11317 | const factory = providerToFactory(provider, ngModuleType, providers);
|
11318 | return makeRecord(factory, NOT_YET);
|
11319 | }
|
11320 | }
|
11321 |
|
11322 |
|
11323 |
|
11324 |
|
11325 |
|
11326 | function providerToFactory(provider, ngModuleType, providers) {
|
11327 | let factory = undefined;
|
11328 | if (isTypeProvider(provider)) {
|
11329 | const unwrappedProvider = resolveForwardRef(provider);
|
11330 | return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider);
|
11331 | }
|
11332 | else {
|
11333 | if (isValueProvider(provider)) {
|
11334 | factory = () => resolveForwardRef(provider.useValue);
|
11335 | }
|
11336 | else if (isFactoryProvider(provider)) {
|
11337 | factory = () => provider.useFactory(...injectArgs(provider.deps || []));
|
11338 | }
|
11339 | else if (isExistingProvider(provider)) {
|
11340 | factory = () => ɵɵinject(resolveForwardRef(provider.useExisting));
|
11341 | }
|
11342 | else {
|
11343 | const classRef = resolveForwardRef(provider &&
|
11344 | (provider.useClass || provider.provide));
|
11345 | if (!classRef) {
|
11346 | throwInvalidProviderError(ngModuleType, providers, provider);
|
11347 | }
|
11348 | if (hasDeps(provider)) {
|
11349 | factory = () => new (classRef)(...injectArgs(provider.deps));
|
11350 | }
|
11351 | else {
|
11352 | return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef);
|
11353 | }
|
11354 | }
|
11355 | }
|
11356 | return factory;
|
11357 | }
|
11358 | function makeRecord(factory, value, multi = false) {
|
11359 | return {
|
11360 | factory: factory,
|
11361 | value: value,
|
11362 | multi: multi ? [] : undefined,
|
11363 | };
|
11364 | }
|
11365 | function isValueProvider(value) {
|
11366 | return value !== null && typeof value == 'object' && USE_VALUE in value;
|
11367 | }
|
11368 | function isExistingProvider(value) {
|
11369 | return !!(value && value.useExisting);
|
11370 | }
|
11371 | function isFactoryProvider(value) {
|
11372 | return !!(value && value.useFactory);
|
11373 | }
|
11374 | function isTypeProvider(value) {
|
11375 | return typeof value === 'function';
|
11376 | }
|
11377 | function isClassProvider(value) {
|
11378 | return !!value.useClass;
|
11379 | }
|
11380 | function hasDeps(value) {
|
11381 | return !!value.deps;
|
11382 | }
|
11383 | function hasOnDestroy(value) {
|
11384 | return value !== null && typeof value === 'object' &&
|
11385 | typeof value.ngOnDestroy === 'function';
|
11386 | }
|
11387 | function couldBeInjectableType(value) {
|
11388 | return (typeof value === 'function') ||
|
11389 | (typeof value === 'object' && value instanceof InjectionToken);
|
11390 | }
|
11391 |
|
11392 |
|
11393 |
|
11394 |
|
11395 |
|
11396 |
|
11397 |
|
11398 |
|
11399 | function INJECTOR_IMPL__PRE_R3__(providers, parent, name) {
|
11400 | return new StaticInjector(providers, parent, name);
|
11401 | }
|
11402 | function INJECTOR_IMPL__POST_R3__(providers, parent, name) {
|
11403 | return createInjector({ name: name }, parent, providers, name);
|
11404 | }
|
11405 | const INJECTOR_IMPL = INJECTOR_IMPL__PRE_R3__;
|
11406 |
|
11407 |
|
11408 |
|
11409 |
|
11410 |
|
11411 |
|
11412 |
|
11413 |
|
11414 |
|
11415 |
|
11416 |
|
11417 |
|
11418 |
|
11419 |
|
11420 |
|
11421 |
|
11422 |
|
11423 |
|
11424 |
|
11425 |
|
11426 |
|
11427 |
|
11428 |
|
11429 |
|
11430 | class Injector {
|
11431 | static create(options, parent) {
|
11432 | if (Array.isArray(options)) {
|
11433 | return INJECTOR_IMPL(options, parent, '');
|
11434 | }
|
11435 | else {
|
11436 | return INJECTOR_IMPL(options.providers, options.parent, options.name || '');
|
11437 | }
|
11438 | }
|
11439 | }
|
11440 | Injector.THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;
|
11441 | Injector.NULL = new NullInjector();
|
11442 |
|
11443 | Injector.ɵprov = ɵɵdefineInjectable({
|
11444 | token: Injector,
|
11445 | providedIn: 'any',
|
11446 | factory: () => ɵɵinject(INJECTOR),
|
11447 | });
|
11448 |
|
11449 |
|
11450 |
|
11451 |
|
11452 | Injector.__NG_ELEMENT_ID__ = -1;
|
11453 | const IDENT = function (value) {
|
11454 | return value;
|
11455 | };
|
11456 | const ɵ0$9 = IDENT;
|
11457 | const EMPTY = [];
|
11458 | const CIRCULAR$1 = IDENT;
|
11459 | const MULTI_PROVIDER_FN = function () {
|
11460 | return Array.prototype.slice.call(arguments);
|
11461 | };
|
11462 | const ɵ1$1 = MULTI_PROVIDER_FN;
|
11463 | const NO_NEW_LINE$1 = 'ɵ';
|
11464 | class StaticInjector {
|
11465 | constructor(providers, parent = Injector.NULL, source = null) {
|
11466 | this.parent = parent;
|
11467 | this.source = source;
|
11468 | const records = this._records = new Map();
|
11469 | records.set(Injector, { token: Injector, fn: IDENT, deps: EMPTY, value: this, useNew: false });
|
11470 | records.set(INJECTOR, { token: INJECTOR, fn: IDENT, deps: EMPTY, value: this, useNew: false });
|
11471 | this.scope = recursivelyProcessProviders(records, providers);
|
11472 | }
|
11473 | get(token, notFoundValue, flags = InjectFlags.Default) {
|
11474 | const records = this._records;
|
11475 | let record = records.get(token);
|
11476 | if (record === undefined) {
|
11477 |
|
11478 | const injectableDef = getInjectableDef(token);
|
11479 | if (injectableDef) {
|
11480 | const providedIn = injectableDef && injectableDef.providedIn;
|
11481 | if (providedIn === 'any' || providedIn != null && providedIn === this.scope) {
|
11482 | records.set(token, record = resolveProvider({ provide: token, useFactory: injectableDef.factory, deps: EMPTY }));
|
11483 | }
|
11484 | }
|
11485 | if (record === undefined) {
|
11486 |
|
11487 | records.set(token, null);
|
11488 | }
|
11489 | }
|
11490 | let lastInjector = setCurrentInjector(this);
|
11491 | try {
|
11492 | return tryResolveToken(token, record, records, this.parent, notFoundValue, flags);
|
11493 | }
|
11494 | catch (e) {
|
11495 | return catchInjectorError(e, token, 'StaticInjectorError', this.source);
|
11496 | }
|
11497 | finally {
|
11498 | setCurrentInjector(lastInjector);
|
11499 | }
|
11500 | }
|
11501 | toString() {
|
11502 | const tokens = [], records = this._records;
|
11503 | records.forEach((v, token) => tokens.push(stringify(token)));
|
11504 | return `StaticInjector[${tokens.join(', ')}]`;
|
11505 | }
|
11506 | }
|
11507 | function resolveProvider(provider) {
|
11508 | const deps = computeDeps(provider);
|
11509 | let fn = IDENT;
|
11510 | let value = EMPTY;
|
11511 | let useNew = false;
|
11512 | let provide = resolveForwardRef(provider.provide);
|
11513 | if (USE_VALUE in provider) {
|
11514 |
|
11515 | value = provider.useValue;
|
11516 | }
|
11517 | else if (provider.useFactory) {
|
11518 | fn = provider.useFactory;
|
11519 | }
|
11520 | else if (provider.useExisting) {
|
11521 |
|
11522 | }
|
11523 | else if (provider.useClass) {
|
11524 | useNew = true;
|
11525 | fn = resolveForwardRef(provider.useClass);
|
11526 | }
|
11527 | else if (typeof provide == 'function') {
|
11528 | useNew = true;
|
11529 | fn = provide;
|
11530 | }
|
11531 | else {
|
11532 | throw staticError('StaticProvider does not have [useValue|useFactory|useExisting|useClass] or [provide] is not newable', provider);
|
11533 | }
|
11534 | return { deps, fn, useNew, value };
|
11535 | }
|
11536 | function multiProviderMixError(token) {
|
11537 | return staticError('Cannot mix multi providers and regular providers', token);
|
11538 | }
|
11539 | function recursivelyProcessProviders(records, provider) {
|
11540 | let scope = null;
|
11541 | if (provider) {
|
11542 | provider = resolveForwardRef(provider);
|
11543 | if (Array.isArray(provider)) {
|
11544 |
|
11545 | for (let i = 0; i < provider.length; i++) {
|
11546 | scope = recursivelyProcessProviders(records, provider[i]) || scope;
|
11547 | }
|
11548 | }
|
11549 | else if (typeof provider === 'function') {
|
11550 |
|
11551 |
|
11552 | throw staticError('Function/Class not supported', provider);
|
11553 | }
|
11554 | else if (provider && typeof provider === 'object' && provider.provide) {
|
11555 |
|
11556 | let token = resolveForwardRef(provider.provide);
|
11557 | const resolvedProvider = resolveProvider(provider);
|
11558 | if (provider.multi === true) {
|
11559 |
|
11560 | let multiProvider = records.get(token);
|
11561 | if (multiProvider) {
|
11562 | if (multiProvider.fn !== MULTI_PROVIDER_FN) {
|
11563 | throw multiProviderMixError(token);
|
11564 | }
|
11565 | }
|
11566 | else {
|
11567 |
|
11568 | records.set(token, multiProvider = {
|
11569 | token: provider.provide,
|
11570 | deps: [],
|
11571 | useNew: false,
|
11572 | fn: MULTI_PROVIDER_FN,
|
11573 | value: EMPTY
|
11574 | });
|
11575 | }
|
11576 |
|
11577 | token = provider;
|
11578 | multiProvider.deps.push({ token, options: 6 });
|
11579 | }
|
11580 | const record = records.get(token);
|
11581 | if (record && record.fn == MULTI_PROVIDER_FN) {
|
11582 | throw multiProviderMixError(token);
|
11583 | }
|
11584 | if (token === INJECTOR_SCOPE) {
|
11585 | scope = resolvedProvider.value;
|
11586 | }
|
11587 | records.set(token, resolvedProvider);
|
11588 | }
|
11589 | else {
|
11590 | throw staticError('Unexpected provider', provider);
|
11591 | }
|
11592 | }
|
11593 | return scope;
|
11594 | }
|
11595 | function tryResolveToken(token, record, records, parent, notFoundValue, flags) {
|
11596 | try {
|
11597 | return resolveToken(token, record, records, parent, notFoundValue, flags);
|
11598 | }
|
11599 | catch (e) {
|
11600 |
|
11601 | if (!(e instanceof Error)) {
|
11602 | e = new Error(e);
|
11603 | }
|
11604 | const path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
|
11605 | path.unshift(token);
|
11606 | if (record && record.value == CIRCULAR$1) {
|
11607 |
|
11608 | record.value = EMPTY;
|
11609 | }
|
11610 | throw e;
|
11611 | }
|
11612 | }
|
11613 | function resolveToken(token, record, records, parent, notFoundValue, flags) {
|
11614 | let value;
|
11615 | if (record && !(flags & InjectFlags.SkipSelf)) {
|
11616 |
|
11617 |
|
11618 | value = record.value;
|
11619 | if (value == CIRCULAR$1) {
|
11620 | throw Error(NO_NEW_LINE$1 + 'Circular dependency');
|
11621 | }
|
11622 | else if (value === EMPTY) {
|
11623 | record.value = CIRCULAR$1;
|
11624 | let obj = undefined;
|
11625 | let useNew = record.useNew;
|
11626 | let fn = record.fn;
|
11627 | let depRecords = record.deps;
|
11628 | let deps = EMPTY;
|
11629 | if (depRecords.length) {
|
11630 | deps = [];
|
11631 | for (let i = 0; i < depRecords.length; i++) {
|
11632 | const depRecord = depRecords[i];
|
11633 | const options = depRecord.options;
|
11634 | const childRecord = options & 2 ? records.get(depRecord.token) : undefined;
|
11635 | deps.push(tryResolveToken(
|
11636 |
|
11637 | depRecord.token,
|
11638 |
|
11639 |
|
11640 | childRecord,
|
11641 |
|
11642 | records,
|
11643 |
|
11644 |
|
11645 | !childRecord && !(options & 4 ) ? Injector.NULL : parent, options & 1 ? null : Injector.THROW_IF_NOT_FOUND, InjectFlags.Default));
|
11646 | }
|
11647 | }
|
11648 | record.value = value = useNew ? new fn(...deps) : fn.apply(obj, deps);
|
11649 | }
|
11650 | }
|
11651 | else if (!(flags & InjectFlags.Self)) {
|
11652 | value = parent.get(token, notFoundValue, InjectFlags.Default);
|
11653 | }
|
11654 | else if (!(flags & InjectFlags.Optional)) {
|
11655 | value = Injector.NULL.get(token, notFoundValue);
|
11656 | }
|
11657 | else {
|
11658 | value = Injector.NULL.get(token, typeof notFoundValue !== 'undefined' ? notFoundValue : null);
|
11659 | }
|
11660 | return value;
|
11661 | }
|
11662 | function computeDeps(provider) {
|
11663 | let deps = EMPTY;
|
11664 | const providerDeps = provider.deps;
|
11665 | if (providerDeps && providerDeps.length) {
|
11666 | deps = [];
|
11667 | for (let i = 0; i < providerDeps.length; i++) {
|
11668 | let options = 6 ;
|
11669 | let token = resolveForwardRef(providerDeps[i]);
|
11670 | if (Array.isArray(token)) {
|
11671 | for (let j = 0, annotations = token; j < annotations.length; j++) {
|
11672 | const annotation = annotations[j];
|
11673 | if (annotation instanceof Optional || annotation == Optional) {
|
11674 | options = options | 1 ;
|
11675 | }
|
11676 | else if (annotation instanceof SkipSelf || annotation == SkipSelf) {
|
11677 | options = options & ~2 ;
|
11678 | }
|
11679 | else if (annotation instanceof Self || annotation == Self) {
|
11680 | options = options & ~4 ;
|
11681 | }
|
11682 | else if (annotation instanceof Inject) {
|
11683 | token = annotation.token;
|
11684 | }
|
11685 | else {
|
11686 | token = resolveForwardRef(annotation);
|
11687 | }
|
11688 | }
|
11689 | }
|
11690 | deps.push({ token, options });
|
11691 | }
|
11692 | }
|
11693 | else if (provider.useExisting) {
|
11694 | const token = resolveForwardRef(provider.useExisting);
|
11695 | deps = [{ token, options: 6 }];
|
11696 | }
|
11697 | else if (!providerDeps && !(USE_VALUE in provider)) {
|
11698 |
|
11699 | throw staticError('\'deps\' required', provider);
|
11700 | }
|
11701 | return deps;
|
11702 | }
|
11703 | function staticError(text, obj) {
|
11704 | return new Error(formatError(text, obj, 'StaticInjectorError'));
|
11705 | }
|
11706 |
|
11707 |
|
11708 |
|
11709 |
|
11710 |
|
11711 |
|
11712 |
|
11713 |
|
11714 | function findFirstClosedCycle(keys) {
|
11715 | const res = [];
|
11716 | for (let i = 0; i < keys.length; ++i) {
|
11717 | if (res.indexOf(keys[i]) > -1) {
|
11718 | res.push(keys[i]);
|
11719 | return res;
|
11720 | }
|
11721 | res.push(keys[i]);
|
11722 | }
|
11723 | return res;
|
11724 | }
|
11725 | function constructResolvingPath(keys) {
|
11726 | if (keys.length > 1) {
|
11727 | const reversed = findFirstClosedCycle(keys.slice().reverse());
|
11728 | const tokenStrs = reversed.map(k => stringify(k.token));
|
11729 | return ' (' + tokenStrs.join(' -> ') + ')';
|
11730 | }
|
11731 | return '';
|
11732 | }
|
11733 | function injectionError(injector, key, constructResolvingMessage, originalError) {
|
11734 | const keys = [key];
|
11735 | const errMsg = constructResolvingMessage(keys);
|
11736 | const error = (originalError ? wrappedError(errMsg, originalError) : Error(errMsg));
|
11737 | error.addKey = addKey;
|
11738 | error.keys = keys;
|
11739 | error.injectors = [injector];
|
11740 | error.constructResolvingMessage = constructResolvingMessage;
|
11741 | error[ERROR_ORIGINAL_ERROR] = originalError;
|
11742 | return error;
|
11743 | }
|
11744 | function addKey(injector, key) {
|
11745 | this.injectors.push(injector);
|
11746 | this.keys.push(key);
|
11747 |
|
11748 | this.message = this.constructResolvingMessage(this.keys);
|
11749 | }
|
11750 |
|
11751 |
|
11752 |
|
11753 |
|
11754 |
|
11755 |
|
11756 |
|
11757 |
|
11758 |
|
11759 |
|
11760 |
|
11761 |
|
11762 |
|
11763 |
|
11764 |
|
11765 | function noProviderError(injector, key) {
|
11766 | return injectionError(injector, key, function (keys) {
|
11767 | const first = stringify(keys[0].token);
|
11768 | return `No provider for ${first}!${constructResolvingPath(keys)}`;
|
11769 | });
|
11770 | }
|
11771 |
|
11772 |
|
11773 |
|
11774 |
|
11775 |
|
11776 |
|
11777 |
|
11778 |
|
11779 |
|
11780 |
|
11781 |
|
11782 |
|
11783 |
|
11784 |
|
11785 |
|
11786 |
|
11787 |
|
11788 | function cyclicDependencyError(injector, key) {
|
11789 | return injectionError(injector, key, function (keys) {
|
11790 | return `Cannot instantiate cyclic dependency!${constructResolvingPath(keys)}`;
|
11791 | });
|
11792 | }
|
11793 |
|
11794 |
|
11795 |
|
11796 |
|
11797 |
|
11798 |
|
11799 |
|
11800 |
|
11801 |
|
11802 |
|
11803 |
|
11804 |
|
11805 |
|
11806 |
|
11807 |
|
11808 |
|
11809 |
|
11810 |
|
11811 |
|
11812 |
|
11813 |
|
11814 |
|
11815 |
|
11816 |
|
11817 |
|
11818 |
|
11819 |
|
11820 | function instantiationError(injector, originalException, originalStack, key) {
|
11821 | return injectionError(injector, key, function (keys) {
|
11822 | const first = stringify(keys[0].token);
|
11823 | return `${originalException.message}: Error during instantiation of ${first}!${constructResolvingPath(keys)}.`;
|
11824 | }, originalException);
|
11825 | }
|
11826 |
|
11827 |
|
11828 |
|
11829 |
|
11830 |
|
11831 |
|
11832 |
|
11833 |
|
11834 |
|
11835 |
|
11836 |
|
11837 | function invalidProviderError(provider) {
|
11838 | return Error(`Invalid provider - only instances of Provider and Type are allowed, got: ${provider}`);
|
11839 | }
|
11840 |
|
11841 |
|
11842 |
|
11843 |
|
11844 |
|
11845 |
|
11846 |
|
11847 |
|
11848 |
|
11849 |
|
11850 |
|
11851 |
|
11852 |
|
11853 |
|
11854 |
|
11855 |
|
11856 |
|
11857 |
|
11858 |
|
11859 |
|
11860 |
|
11861 |
|
11862 |
|
11863 |
|
11864 |
|
11865 |
|
11866 |
|
11867 |
|
11868 |
|
11869 |
|
11870 | function noAnnotationError(typeOrFunc, params) {
|
11871 | const signature = [];
|
11872 | for (let i = 0, ii = params.length; i < ii; i++) {
|
11873 | const parameter = params[i];
|
11874 | if (!parameter || parameter.length == 0) {
|
11875 | signature.push('?');
|
11876 | }
|
11877 | else {
|
11878 | signature.push(parameter.map(stringify).join(' '));
|
11879 | }
|
11880 | }
|
11881 | return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
|
11882 | signature.join(', ') + '). ' +
|
11883 | 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
|
11884 | stringify(typeOrFunc) + '\' is decorated with Injectable.');
|
11885 | }
|
11886 |
|
11887 |
|
11888 |
|
11889 |
|
11890 |
|
11891 |
|
11892 |
|
11893 |
|
11894 |
|
11895 |
|
11896 |
|
11897 |
|
11898 |
|
11899 |
|
11900 |
|
11901 | function outOfBoundsError(index) {
|
11902 | return Error(`Index ${index} is out-of-bounds.`);
|
11903 | }
|
11904 |
|
11905 |
|
11906 |
|
11907 |
|
11908 |
|
11909 |
|
11910 |
|
11911 |
|
11912 |
|
11913 |
|
11914 |
|
11915 |
|
11916 |
|
11917 |
|
11918 | function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
|
11919 | return Error(`Cannot mix multi providers and regular providers, got: ${provider1} ${provider2}`);
|
11920 | }
|
11921 |
|
11922 |
|
11923 |
|
11924 |
|
11925 |
|
11926 |
|
11927 |
|
11928 |
|
11929 |
|
11930 |
|
11931 |
|
11932 |
|
11933 |
|
11934 |
|
11935 |
|
11936 |
|
11937 |
|
11938 |
|
11939 |
|
11940 |
|
11941 |
|
11942 |
|
11943 |
|
11944 |
|
11945 |
|
11946 |
|
11947 | class ReflectiveKey {
|
11948 | |
11949 |
|
11950 |
|
11951 | constructor(token, id) {
|
11952 | this.token = token;
|
11953 | this.id = id;
|
11954 | if (!token) {
|
11955 | throw new Error('Token must be defined!');
|
11956 | }
|
11957 | this.displayName = stringify(this.token);
|
11958 | }
|
11959 | |
11960 |
|
11961 |
|
11962 | static get(token) {
|
11963 | return _globalKeyRegistry.get(resolveForwardRef(token));
|
11964 | }
|
11965 | |
11966 |
|
11967 |
|
11968 | static get numberOfKeys() {
|
11969 | return _globalKeyRegistry.numberOfKeys;
|
11970 | }
|
11971 | }
|
11972 | class KeyRegistry {
|
11973 | constructor() {
|
11974 | this._allKeys = new Map();
|
11975 | }
|
11976 | get(token) {
|
11977 | if (token instanceof ReflectiveKey)
|
11978 | return token;
|
11979 | if (this._allKeys.has(token)) {
|
11980 | return this._allKeys.get(token);
|
11981 | }
|
11982 | const newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
|
11983 | this._allKeys.set(token, newKey);
|
11984 | return newKey;
|
11985 | }
|
11986 | get numberOfKeys() {
|
11987 | return this._allKeys.size;
|
11988 | }
|
11989 | }
|
11990 | const _globalKeyRegistry = new KeyRegistry();
|
11991 |
|
11992 |
|
11993 |
|
11994 |
|
11995 |
|
11996 |
|
11997 |
|
11998 |
|
11999 |
|
12000 |
|
12001 |
|
12002 |
|
12003 | class Reflector {
|
12004 | constructor(reflectionCapabilities) {
|
12005 | this.reflectionCapabilities = reflectionCapabilities;
|
12006 | }
|
12007 | updateCapabilities(caps) {
|
12008 | this.reflectionCapabilities = caps;
|
12009 | }
|
12010 | factory(type) {
|
12011 | return this.reflectionCapabilities.factory(type);
|
12012 | }
|
12013 | parameters(typeOrFunc) {
|
12014 | return this.reflectionCapabilities.parameters(typeOrFunc);
|
12015 | }
|
12016 | annotations(typeOrFunc) {
|
12017 | return this.reflectionCapabilities.annotations(typeOrFunc);
|
12018 | }
|
12019 | propMetadata(typeOrFunc) {
|
12020 | return this.reflectionCapabilities.propMetadata(typeOrFunc);
|
12021 | }
|
12022 | hasLifecycleHook(type, lcProperty) {
|
12023 | return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
|
12024 | }
|
12025 | getter(name) {
|
12026 | return this.reflectionCapabilities.getter(name);
|
12027 | }
|
12028 | setter(name) {
|
12029 | return this.reflectionCapabilities.setter(name);
|
12030 | }
|
12031 | method(name) {
|
12032 | return this.reflectionCapabilities.method(name);
|
12033 | }
|
12034 | importUri(type) {
|
12035 | return this.reflectionCapabilities.importUri(type);
|
12036 | }
|
12037 | resourceUri(type) {
|
12038 | return this.reflectionCapabilities.resourceUri(type);
|
12039 | }
|
12040 | resolveIdentifier(name, moduleUrl, members, runtime) {
|
12041 | return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
|
12042 | }
|
12043 | resolveEnum(identifier, name) {
|
12044 | return this.reflectionCapabilities.resolveEnum(identifier, name);
|
12045 | }
|
12046 | }
|
12047 |
|
12048 |
|
12049 |
|
12050 |
|
12051 |
|
12052 |
|
12053 |
|
12054 |
|
12055 |
|
12056 |
|
12057 |
|
12058 |
|
12059 | const reflector = new Reflector(new ReflectionCapabilities());
|
12060 |
|
12061 |
|
12062 |
|
12063 |
|
12064 |
|
12065 |
|
12066 |
|
12067 |
|
12068 |
|
12069 |
|
12070 |
|
12071 |
|
12072 | class ReflectiveDependency {
|
12073 | constructor(key, optional, visibility) {
|
12074 | this.key = key;
|
12075 | this.optional = optional;
|
12076 | this.visibility = visibility;
|
12077 | }
|
12078 | static fromKey(key) {
|
12079 | return new ReflectiveDependency(key, false, null);
|
12080 | }
|
12081 | }
|
12082 | const _EMPTY_LIST = [];
|
12083 | class ResolvedReflectiveProvider_ {
|
12084 | constructor(key, resolvedFactories, multiProvider) {
|
12085 | this.key = key;
|
12086 | this.resolvedFactories = resolvedFactories;
|
12087 | this.multiProvider = multiProvider;
|
12088 | this.resolvedFactory = this.resolvedFactories[0];
|
12089 | }
|
12090 | }
|
12091 |
|
12092 |
|
12093 |
|
12094 |
|
12095 | class ResolvedReflectiveFactory {
|
12096 | constructor(
|
12097 | /**
|
12098 | * Factory function which can return an instance of an object represented by a key.
|
12099 | */
|
12100 | factory,
|
12101 | /**
|
12102 | * Arguments (dependencies) to the `factory` function.
|
12103 | */
|
12104 | dependencies) {
|
12105 | this.factory = factory;
|
12106 | this.dependencies = dependencies;
|
12107 | }
|
12108 | }
|
12109 |
|
12110 |
|
12111 |
|
12112 | function resolveReflectiveFactory(provider) {
|
12113 | let factoryFn;
|
12114 | let resolvedDeps;
|
12115 | if (provider.useClass) {
|
12116 | const useClass = resolveForwardRef(provider.useClass);
|
12117 | factoryFn = reflector.factory(useClass);
|
12118 | resolvedDeps = _dependenciesFor(useClass);
|
12119 | }
|
12120 | else if (provider.useExisting) {
|
12121 | factoryFn = (aliasInstance) => aliasInstance;
|
12122 | resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
|
12123 | }
|
12124 | else if (provider.useFactory) {
|
12125 | factoryFn = provider.useFactory;
|
12126 | resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
|
12127 | }
|
12128 | else {
|
12129 | factoryFn = () => provider.useValue;
|
12130 | resolvedDeps = _EMPTY_LIST;
|
12131 | }
|
12132 | return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
|
12133 | }
|
12134 |
|
12135 |
|
12136 |
|
12137 |
|
12138 |
|
12139 |
|
12140 | function resolveReflectiveProvider(provider) {
|
12141 | return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
|
12142 | }
|
12143 |
|
12144 |
|
12145 |
|
12146 | function resolveReflectiveProviders(providers) {
|
12147 | const normalized = _normalizeProviders(providers, []);
|
12148 | const resolved = normalized.map(resolveReflectiveProvider);
|
12149 | const resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
|
12150 | return Array.from(resolvedProviderMap.values());
|
12151 | }
|
12152 |
|
12153 |
|
12154 |
|
12155 |
|
12156 | function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
|
12157 | for (let i = 0; i < providers.length; i++) {
|
12158 | const provider = providers[i];
|
12159 | const existing = normalizedProvidersMap.get(provider.key.id);
|
12160 | if (existing) {
|
12161 | if (provider.multiProvider !== existing.multiProvider) {
|
12162 | throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
|
12163 | }
|
12164 | if (provider.multiProvider) {
|
12165 | for (let j = 0; j < provider.resolvedFactories.length; j++) {
|
12166 | existing.resolvedFactories.push(provider.resolvedFactories[j]);
|
12167 | }
|
12168 | }
|
12169 | else {
|
12170 | normalizedProvidersMap.set(provider.key.id, provider);
|
12171 | }
|
12172 | }
|
12173 | else {
|
12174 | let resolvedProvider;
|
12175 | if (provider.multiProvider) {
|
12176 | resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
|
12177 | }
|
12178 | else {
|
12179 | resolvedProvider = provider;
|
12180 | }
|
12181 | normalizedProvidersMap.set(provider.key.id, resolvedProvider);
|
12182 | }
|
12183 | }
|
12184 | return normalizedProvidersMap;
|
12185 | }
|
12186 | function _normalizeProviders(providers, res) {
|
12187 | providers.forEach(b => {
|
12188 | if (b instanceof Type) {
|
12189 | res.push({ provide: b, useClass: b });
|
12190 | }
|
12191 | else if (b && typeof b == 'object' && b.provide !== undefined) {
|
12192 | res.push(b);
|
12193 | }
|
12194 | else if (Array.isArray(b)) {
|
12195 | _normalizeProviders(b, res);
|
12196 | }
|
12197 | else {
|
12198 | throw invalidProviderError(b);
|
12199 | }
|
12200 | });
|
12201 | return res;
|
12202 | }
|
12203 | function constructDependencies(typeOrFunc, dependencies) {
|
12204 | if (!dependencies) {
|
12205 | return _dependenciesFor(typeOrFunc);
|
12206 | }
|
12207 | else {
|
12208 | const params = dependencies.map(t => [t]);
|
12209 | return dependencies.map(t => _extractToken(typeOrFunc, t, params));
|
12210 | }
|
12211 | }
|
12212 | function _dependenciesFor(typeOrFunc) {
|
12213 | const params = reflector.parameters(typeOrFunc);
|
12214 | if (!params)
|
12215 | return [];
|
12216 | if (params.some(p => p == null)) {
|
12217 | throw noAnnotationError(typeOrFunc, params);
|
12218 | }
|
12219 | return params.map(p => _extractToken(typeOrFunc, p, params));
|
12220 | }
|
12221 | function _extractToken(typeOrFunc, metadata, params) {
|
12222 | let token = null;
|
12223 | let optional = false;
|
12224 | if (!Array.isArray(metadata)) {
|
12225 | if (metadata instanceof Inject) {
|
12226 | return _createDependency(metadata.token, optional, null);
|
12227 | }
|
12228 | else {
|
12229 | return _createDependency(metadata, optional, null);
|
12230 | }
|
12231 | }
|
12232 | let visibility = null;
|
12233 | for (let i = 0; i < metadata.length; ++i) {
|
12234 | const paramMetadata = metadata[i];
|
12235 | if (paramMetadata instanceof Type) {
|
12236 | token = paramMetadata;
|
12237 | }
|
12238 | else if (paramMetadata instanceof Inject) {
|
12239 | token = paramMetadata.token;
|
12240 | }
|
12241 | else if (paramMetadata instanceof Optional) {
|
12242 | optional = true;
|
12243 | }
|
12244 | else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
|
12245 | visibility = paramMetadata;
|
12246 | }
|
12247 | else if (paramMetadata instanceof InjectionToken) {
|
12248 | token = paramMetadata;
|
12249 | }
|
12250 | }
|
12251 | token = resolveForwardRef(token);
|
12252 | if (token != null) {
|
12253 | return _createDependency(token, optional, visibility);
|
12254 | }
|
12255 | else {
|
12256 | throw noAnnotationError(typeOrFunc, params);
|
12257 | }
|
12258 | }
|
12259 | function _createDependency(token, optional, visibility) {
|
12260 | return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
|
12261 | }
|
12262 |
|
12263 |
|
12264 |
|
12265 |
|
12266 |
|
12267 |
|
12268 |
|
12269 |
|
12270 |
|
12271 | const UNDEFINED = {};
|
12272 |
|
12273 |
|
12274 |
|
12275 |
|
12276 |
|
12277 |
|
12278 |
|
12279 |
|
12280 |
|
12281 |
|
12282 |
|
12283 |
|
12284 |
|
12285 |
|
12286 |
|
12287 |
|
12288 |
|
12289 |
|
12290 |
|
12291 |
|
12292 |
|
12293 |
|
12294 |
|
12295 |
|
12296 |
|
12297 |
|
12298 |
|
12299 |
|
12300 |
|
12301 |
|
12302 |
|
12303 |
|
12304 |
|
12305 |
|
12306 |
|
12307 |
|
12308 |
|
12309 | class ReflectiveInjector {
|
12310 | |
12311 |
|
12312 |
|
12313 |
|
12314 |
|
12315 |
|
12316 |
|
12317 |
|
12318 |
|
12319 |
|
12320 |
|
12321 |
|
12322 |
|
12323 |
|
12324 |
|
12325 |
|
12326 |
|
12327 |
|
12328 |
|
12329 |
|
12330 |
|
12331 |
|
12332 |
|
12333 |
|
12334 |
|
12335 |
|
12336 |
|
12337 |
|
12338 |
|
12339 |
|
12340 |
|
12341 |
|
12342 |
|
12343 | static resolve(providers) {
|
12344 | return resolveReflectiveProviders(providers);
|
12345 | }
|
12346 | |
12347 |
|
12348 |
|
12349 |
|
12350 |
|
12351 |
|
12352 |
|
12353 |
|
12354 |
|
12355 |
|
12356 |
|
12357 |
|
12358 |
|
12359 |
|
12360 |
|
12361 |
|
12362 |
|
12363 |
|
12364 |
|
12365 |
|
12366 |
|
12367 |
|
12368 |
|
12369 | static resolveAndCreate(providers, parent) {
|
12370 | const ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
12371 | return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
12372 | }
|
12373 | |
12374 |
|
12375 |
|
12376 |
|
12377 |
|
12378 |
|
12379 |
|
12380 |
|
12381 |
|
12382 |
|
12383 |
|
12384 |
|
12385 |
|
12386 |
|
12387 |
|
12388 |
|
12389 |
|
12390 |
|
12391 |
|
12392 |
|
12393 |
|
12394 |
|
12395 |
|
12396 | static fromResolvedProviders(providers, parent) {
|
12397 | return new ReflectiveInjector_(providers, parent);
|
12398 | }
|
12399 | }
|
12400 | class ReflectiveInjector_ {
|
12401 | |
12402 |
|
12403 |
|
12404 | constructor(_providers, _parent) {
|
12405 |
|
12406 | this._constructionCounter = 0;
|
12407 | this._providers = _providers;
|
12408 | this.parent = _parent || null;
|
12409 | const len = _providers.length;
|
12410 | this.keyIds = [];
|
12411 | this.objs = [];
|
12412 | for (let i = 0; i < len; i++) {
|
12413 | this.keyIds[i] = _providers[i].key.id;
|
12414 | this.objs[i] = UNDEFINED;
|
12415 | }
|
12416 | }
|
12417 | get(token, notFoundValue = THROW_IF_NOT_FOUND) {
|
12418 | return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
|
12419 | }
|
12420 | resolveAndCreateChild(providers) {
|
12421 | const ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
12422 | return this.createChildFromResolved(ResolvedReflectiveProviders);
|
12423 | }
|
12424 | createChildFromResolved(providers) {
|
12425 | const inj = new ReflectiveInjector_(providers);
|
12426 | inj.parent = this;
|
12427 | return inj;
|
12428 | }
|
12429 | resolveAndInstantiate(provider) {
|
12430 | return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
12431 | }
|
12432 | instantiateResolved(provider) {
|
12433 | return this._instantiateProvider(provider);
|
12434 | }
|
12435 | getProviderAtIndex(index) {
|
12436 | if (index < 0 || index >= this._providers.length) {
|
12437 | throw outOfBoundsError(index);
|
12438 | }
|
12439 | return this._providers[index];
|
12440 | }
|
12441 |
|
12442 | _new(provider) {
|
12443 | if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
|
12444 | throw cyclicDependencyError(this, provider.key);
|
12445 | }
|
12446 | return this._instantiateProvider(provider);
|
12447 | }
|
12448 | _getMaxNumberOfObjects() {
|
12449 | return this.objs.length;
|
12450 | }
|
12451 | _instantiateProvider(provider) {
|
12452 | if (provider.multiProvider) {
|
12453 | const res = [];
|
12454 | for (let i = 0; i < provider.resolvedFactories.length; ++i) {
|
12455 | res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
|
12456 | }
|
12457 | return res;
|
12458 | }
|
12459 | else {
|
12460 | return this._instantiate(provider, provider.resolvedFactories[0]);
|
12461 | }
|
12462 | }
|
12463 | _instantiate(provider, ResolvedReflectiveFactory) {
|
12464 | const factory = ResolvedReflectiveFactory.factory;
|
12465 | let deps;
|
12466 | try {
|
12467 | deps =
|
12468 | ResolvedReflectiveFactory.dependencies.map(dep => this._getByReflectiveDependency(dep));
|
12469 | }
|
12470 | catch (e) {
|
12471 | if (e.addKey) {
|
12472 | e.addKey(this, provider.key);
|
12473 | }
|
12474 | throw e;
|
12475 | }
|
12476 | let obj;
|
12477 | try {
|
12478 | obj = factory(...deps);
|
12479 | }
|
12480 | catch (e) {
|
12481 | throw instantiationError(this, e, e.stack, provider.key);
|
12482 | }
|
12483 | return obj;
|
12484 | }
|
12485 | _getByReflectiveDependency(dep) {
|
12486 | return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
|
12487 | }
|
12488 | _getByKey(key, visibility, notFoundValue) {
|
12489 | if (key === ReflectiveInjector_.INJECTOR_KEY) {
|
12490 | return this;
|
12491 | }
|
12492 | if (visibility instanceof Self) {
|
12493 | return this._getByKeySelf(key, notFoundValue);
|
12494 | }
|
12495 | else {
|
12496 | return this._getByKeyDefault(key, notFoundValue, visibility);
|
12497 | }
|
12498 | }
|
12499 | _getObjByKeyId(keyId) {
|
12500 | for (let i = 0; i < this.keyIds.length; i++) {
|
12501 | if (this.keyIds[i] === keyId) {
|
12502 | if (this.objs[i] === UNDEFINED) {
|
12503 | this.objs[i] = this._new(this._providers[i]);
|
12504 | }
|
12505 | return this.objs[i];
|
12506 | }
|
12507 | }
|
12508 | return UNDEFINED;
|
12509 | }
|
12510 |
|
12511 | _throwOrNull(key, notFoundValue) {
|
12512 | if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
12513 | return notFoundValue;
|
12514 | }
|
12515 | else {
|
12516 | throw noProviderError(this, key);
|
12517 | }
|
12518 | }
|
12519 |
|
12520 | _getByKeySelf(key, notFoundValue) {
|
12521 | const obj = this._getObjByKeyId(key.id);
|
12522 | return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
12523 | }
|
12524 |
|
12525 | _getByKeyDefault(key, notFoundValue, visibility) {
|
12526 | let inj;
|
12527 | if (visibility instanceof SkipSelf) {
|
12528 | inj = this.parent;
|
12529 | }
|
12530 | else {
|
12531 | inj = this;
|
12532 | }
|
12533 | while (inj instanceof ReflectiveInjector_) {
|
12534 | const inj_ = inj;
|
12535 | const obj = inj_._getObjByKeyId(key.id);
|
12536 | if (obj !== UNDEFINED)
|
12537 | return obj;
|
12538 | inj = inj_.parent;
|
12539 | }
|
12540 | if (inj !== null) {
|
12541 | return inj.get(key.token, notFoundValue);
|
12542 | }
|
12543 | else {
|
12544 | return this._throwOrNull(key, notFoundValue);
|
12545 | }
|
12546 | }
|
12547 | get displayName() {
|
12548 | const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
|
12549 | .join(', ');
|
12550 | return `ReflectiveInjector(providers: [${providers}])`;
|
12551 | }
|
12552 | toString() {
|
12553 | return this.displayName;
|
12554 | }
|
12555 | }
|
12556 | ReflectiveInjector_.INJECTOR_KEY = ReflectiveKey.get(Injector);
|
12557 | function _mapProviders(injector, fn) {
|
12558 | const res = [];
|
12559 | for (let i = 0; i < injector._providers.length; ++i) {
|
12560 | res[i] = fn(injector.getProviderAtIndex(i));
|
12561 | }
|
12562 | return res;
|
12563 | }
|
12564 |
|
12565 |
|
12566 |
|
12567 |
|
12568 |
|
12569 |
|
12570 |
|
12571 |
|
12572 |
|
12573 |
|
12574 |
|
12575 |
|
12576 |
|
12577 |
|
12578 |
|
12579 |
|
12580 |
|
12581 |
|
12582 |
|
12583 |
|
12584 |
|
12585 |
|
12586 |
|
12587 |
|
12588 |
|
12589 |
|
12590 |
|
12591 |
|
12592 |
|
12593 |
|
12594 |
|
12595 |
|
12596 |
|
12597 |
|
12598 |
|
12599 |
|
12600 |
|
12601 |
|
12602 |
|
12603 |
|
12604 |
|
12605 |
|
12606 |
|
12607 |
|
12608 |
|
12609 |
|
12610 |
|
12611 |
|
12612 |
|
12613 |
|
12614 |
|
12615 |
|
12616 |
|
12617 |
|
12618 |
|
12619 |
|
12620 |
|
12621 |
|
12622 |
|
12623 |
|
12624 |
|
12625 | const ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
|
12626 |
|
12627 |
|
12628 |
|
12629 |
|
12630 |
|
12631 |
|
12632 |
|
12633 |
|
12634 |
|
12635 |
|
12636 | class Query {
|
12637 | }
|
12638 | const ɵ0$a = (selector, data = {}) => (Object.assign({ selector, first: false, isViewQuery: false, descendants: false }, data));
|
12639 |
|
12640 |
|
12641 |
|
12642 |
|
12643 |
|
12644 |
|
12645 |
|
12646 | const ContentChildren = makePropDecorator('ContentChildren', ɵ0$a, Query);
|
12647 | const ɵ1$2 = (selector, data = {}) => (Object.assign({ selector, first: true, isViewQuery: false, descendants: true }, data));
|
12648 |
|
12649 |
|
12650 |
|
12651 |
|
12652 |
|
12653 |
|
12654 |
|
12655 |
|
12656 | const ContentChild = makePropDecorator('ContentChild', ɵ1$2, Query);
|
12657 | const ɵ2 = (selector, data = {}) => (Object.assign({ selector, first: false, isViewQuery: true, descendants: true }, data));
|
12658 |
|
12659 |
|
12660 |
|
12661 |
|
12662 |
|
12663 |
|
12664 | const ViewChildren = makePropDecorator('ViewChildren', ɵ2, Query);
|
12665 | const ɵ3 = (selector, data) => (Object.assign({ selector, first: true, isViewQuery: true, descendants: true }, data));
|
12666 |
|
12667 |
|
12668 |
|
12669 |
|
12670 |
|
12671 |
|
12672 | const ViewChild = makePropDecorator('ViewChild', ɵ3, Query);
|
12673 |
|
12674 |
|
12675 |
|
12676 |
|
12677 |
|
12678 |
|
12679 |
|
12680 |
|
12681 |
|
12682 |
|
12683 |
|
12684 |
|
12685 |
|
12686 |
|
12687 |
|
12688 |
|
12689 |
|
12690 |
|
12691 |
|
12692 |
|
12693 |
|
12694 |
|
12695 |
|
12696 |
|
12697 |
|
12698 |
|
12699 |
|
12700 |
|
12701 |
|
12702 |
|
12703 |
|
12704 |
|
12705 |
|
12706 |
|
12707 |
|
12708 |
|
12709 |
|
12710 |
|
12711 |
|
12712 |
|
12713 | function resolveComponentResources(resourceResolver) {
|
12714 |
|
12715 | const componentResolved = [];
|
12716 |
|
12717 | const urlMap = new Map();
|
12718 | function cachedResourceResolve(url) {
|
12719 | let promise = urlMap.get(url);
|
12720 | if (!promise) {
|
12721 | const resp = resourceResolver(url);
|
12722 | urlMap.set(url, promise = resp.then(unwrapResponse));
|
12723 | }
|
12724 | return promise;
|
12725 | }
|
12726 | componentResourceResolutionQueue.forEach((component, type) => {
|
12727 | const promises = [];
|
12728 | if (component.templateUrl) {
|
12729 | promises.push(cachedResourceResolve(component.templateUrl).then((template) => {
|
12730 | component.template = template;
|
12731 | }));
|
12732 | }
|
12733 | const styleUrls = component.styleUrls;
|
12734 | const styles = component.styles || (component.styles = []);
|
12735 | const styleOffset = component.styles.length;
|
12736 | styleUrls && styleUrls.forEach((styleUrl, index) => {
|
12737 | styles.push('');
|
12738 | promises.push(cachedResourceResolve(styleUrl).then((style) => {
|
12739 | styles[styleOffset + index] = style;
|
12740 | styleUrls.splice(styleUrls.indexOf(styleUrl), 1);
|
12741 | if (styleUrls.length == 0) {
|
12742 | component.styleUrls = undefined;
|
12743 | }
|
12744 | }));
|
12745 | });
|
12746 | const fullyResolved = Promise.all(promises).then(() => componentDefResolved(type));
|
12747 | componentResolved.push(fullyResolved);
|
12748 | });
|
12749 | clearResolutionOfComponentResourcesQueue();
|
12750 | return Promise.all(componentResolved).then(() => undefined);
|
12751 | }
|
12752 | let componentResourceResolutionQueue = new Map();
|
12753 |
|
12754 | const componentDefPendingResolution = new Set();
|
12755 | function maybeQueueResolutionOfComponentResources(type, metadata) {
|
12756 | if (componentNeedsResolution(metadata)) {
|
12757 | componentResourceResolutionQueue.set(type, metadata);
|
12758 | componentDefPendingResolution.add(type);
|
12759 | }
|
12760 | }
|
12761 | function isComponentDefPendingResolution(type) {
|
12762 | return componentDefPendingResolution.has(type);
|
12763 | }
|
12764 | function componentNeedsResolution(component) {
|
12765 | return !!((component.templateUrl && !component.hasOwnProperty('template')) ||
|
12766 | component.styleUrls && component.styleUrls.length);
|
12767 | }
|
12768 | function clearResolutionOfComponentResourcesQueue() {
|
12769 | const old = componentResourceResolutionQueue;
|
12770 | componentResourceResolutionQueue = new Map();
|
12771 | return old;
|
12772 | }
|
12773 | function restoreComponentResolutionQueue(queue) {
|
12774 | componentDefPendingResolution.clear();
|
12775 | queue.forEach((_, type) => componentDefPendingResolution.add(type));
|
12776 | componentResourceResolutionQueue = queue;
|
12777 | }
|
12778 | function isComponentResourceResolutionQueueEmpty() {
|
12779 | return componentResourceResolutionQueue.size === 0;
|
12780 | }
|
12781 | function unwrapResponse(response) {
|
12782 | return typeof response == 'string' ? response : response.text();
|
12783 | }
|
12784 | function componentDefResolved(type) {
|
12785 | componentDefPendingResolution.delete(type);
|
12786 | }
|
12787 |
|
12788 |
|
12789 |
|
12790 |
|
12791 |
|
12792 |
|
12793 |
|
12794 |
|
12795 |
|
12796 |
|
12797 |
|
12798 |
|
12799 |
|
12800 |
|
12801 |
|
12802 |
|
12803 |
|
12804 |
|
12805 |
|
12806 | function computeStaticStyling(tNode, attrs, writeToHost) {
|
12807 | ngDevMode &&
|
12808 | assertFirstCreatePass(getTView(), 'Expecting to be called in first template pass only');
|
12809 | let styles = writeToHost ? tNode.styles : null;
|
12810 | let classes = writeToHost ? tNode.classes : null;
|
12811 | let mode = 0;
|
12812 | if (attrs !== null) {
|
12813 | for (let i = 0; i < attrs.length; i++) {
|
12814 | const value = attrs[i];
|
12815 | if (typeof value === 'number') {
|
12816 | mode = value;
|
12817 | }
|
12818 | else if (mode == 1 ) {
|
12819 | classes = concatStringsWithSpace(classes, value);
|
12820 | }
|
12821 | else if (mode == 2 ) {
|
12822 | const style = value;
|
12823 | const styleValue = attrs[++i];
|
12824 | styles = concatStringsWithSpace(styles, style + ': ' + styleValue + ';');
|
12825 | }
|
12826 | }
|
12827 | }
|
12828 | writeToHost ? tNode.styles = styles : tNode.stylesWithoutHost = styles;
|
12829 | writeToHost ? tNode.classes = classes : tNode.classesWithoutHost = classes;
|
12830 | }
|
12831 |
|
12832 |
|
12833 |
|
12834 |
|
12835 |
|
12836 |
|
12837 |
|
12838 |
|
12839 | let _symbolIterator = null;
|
12840 | function getSymbolIterator() {
|
12841 | if (!_symbolIterator) {
|
12842 | const Symbol = _global['Symbol'];
|
12843 | if (Symbol && Symbol.iterator) {
|
12844 | _symbolIterator = Symbol.iterator;
|
12845 | }
|
12846 | else {
|
12847 |
|
12848 | const keys = Object.getOwnPropertyNames(Map.prototype);
|
12849 | for (let i = 0; i < keys.length; ++i) {
|
12850 | const key = keys[i];
|
12851 | if (key !== 'entries' && key !== 'size' &&
|
12852 | Map.prototype[key] === Map.prototype['entries']) {
|
12853 | _symbolIterator = key;
|
12854 | }
|
12855 | }
|
12856 | }
|
12857 | }
|
12858 | return _symbolIterator;
|
12859 | }
|
12860 |
|
12861 |
|
12862 |
|
12863 |
|
12864 |
|
12865 |
|
12866 |
|
12867 |
|
12868 | function devModeEqual(a, b) {
|
12869 | const isListLikeIterableA = isListLikeIterable(a);
|
12870 | const isListLikeIterableB = isListLikeIterable(b);
|
12871 | if (isListLikeIterableA && isListLikeIterableB) {
|
12872 | return areIterablesEqual(a, b, devModeEqual);
|
12873 | }
|
12874 | else {
|
12875 | const isAObject = a && (typeof a === 'object' || typeof a === 'function');
|
12876 | const isBObject = b && (typeof b === 'object' || typeof b === 'function');
|
12877 | if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
|
12878 | return true;
|
12879 | }
|
12880 | else {
|
12881 | return Object.is(a, b);
|
12882 | }
|
12883 | }
|
12884 | }
|
12885 |
|
12886 |
|
12887 |
|
12888 |
|
12889 |
|
12890 |
|
12891 |
|
12892 |
|
12893 |
|
12894 |
|
12895 |
|
12896 |
|
12897 |
|
12898 |
|
12899 |
|
12900 |
|
12901 |
|
12902 |
|
12903 |
|
12904 |
|
12905 |
|
12906 | class WrappedValue {
|
12907 | constructor(value) {
|
12908 | this.wrapped = value;
|
12909 | }
|
12910 |
|
12911 | static wrap(value) {
|
12912 | return new WrappedValue(value);
|
12913 | }
|
12914 | |
12915 |
|
12916 |
|
12917 |
|
12918 | static unwrap(value) {
|
12919 | return WrappedValue.isWrapped(value) ? value.wrapped : value;
|
12920 | }
|
12921 |
|
12922 | static isWrapped(value) {
|
12923 | return value instanceof WrappedValue;
|
12924 | }
|
12925 | }
|
12926 | function isListLikeIterable(obj) {
|
12927 | if (!isJsObject(obj))
|
12928 | return false;
|
12929 | return Array.isArray(obj) ||
|
12930 | (!(obj instanceof Map) &&
|
12931 | getSymbolIterator() in obj);
|
12932 | }
|
12933 | function areIterablesEqual(a, b, comparator) {
|
12934 | const iterator1 = a[getSymbolIterator()]();
|
12935 | const iterator2 = b[getSymbolIterator()]();
|
12936 | while (true) {
|
12937 | const item1 = iterator1.next();
|
12938 | const item2 = iterator2.next();
|
12939 | if (item1.done && item2.done)
|
12940 | return true;
|
12941 | if (item1.done || item2.done)
|
12942 | return false;
|
12943 | if (!comparator(item1.value, item2.value))
|
12944 | return false;
|
12945 | }
|
12946 | }
|
12947 | function iterateListLike(obj, fn) {
|
12948 | if (Array.isArray(obj)) {
|
12949 | for (let i = 0; i < obj.length; i++) {
|
12950 | fn(obj[i]);
|
12951 | }
|
12952 | }
|
12953 | else {
|
12954 | const iterator = obj[getSymbolIterator()]();
|
12955 | let item;
|
12956 | while (!((item = iterator.next()).done)) {
|
12957 | fn(item.value);
|
12958 | }
|
12959 | }
|
12960 | }
|
12961 | function isJsObject(o) {
|
12962 | return o !== null && (typeof o === 'function' || typeof o === 'object');
|
12963 | }
|
12964 |
|
12965 |
|
12966 |
|
12967 |
|
12968 |
|
12969 |
|
12970 |
|
12971 |
|
12972 |
|
12973 |
|
12974 | function updateBinding(lView, bindingIndex, value) {
|
12975 | return lView[bindingIndex] = value;
|
12976 | }
|
12977 |
|
12978 | function getBinding(lView, bindingIndex) {
|
12979 | ngDevMode && assertIndexInRange(lView, bindingIndex);
|
12980 | ngDevMode &&
|
12981 | assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
|
12982 | return lView[bindingIndex];
|
12983 | }
|
12984 |
|
12985 |
|
12986 |
|
12987 |
|
12988 |
|
12989 |
|
12990 |
|
12991 |
|
12992 |
|
12993 |
|
12994 |
|
12995 |
|
12996 |
|
12997 | function bindingUpdated(lView, bindingIndex, value) {
|
12998 | ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
|
12999 | ngDevMode &&
|
13000 | assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
|
13001 | const oldValue = lView[bindingIndex];
|
13002 | if (Object.is(oldValue, value)) {
|
13003 | return false;
|
13004 | }
|
13005 | else {
|
13006 | if (ngDevMode && getCheckNoChangesMode()) {
|
13007 |
|
13008 |
|
13009 | const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
|
13010 | if (!devModeEqual(oldValueToCompare, value)) {
|
13011 | const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
|
13012 | throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
|
13013 | }
|
13014 |
|
13015 |
|
13016 |
|
13017 |
|
13018 | return false;
|
13019 | }
|
13020 | lView[bindingIndex] = value;
|
13021 | return true;
|
13022 | }
|
13023 | }
|
13024 |
|
13025 | function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
|
13026 | const different = bindingUpdated(lView, bindingIndex, exp1);
|
13027 | return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
|
13028 | }
|
13029 |
|
13030 | function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
|
13031 | const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
|
13032 | return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
|
13033 | }
|
13034 |
|
13035 | function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
|
13036 | const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
|
13037 | return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
|
13038 | }
|
13039 |
|
13040 |
|
13041 |
|
13042 |
|
13043 |
|
13044 |
|
13045 |
|
13046 |
|
13047 |
|
13048 |
|
13049 |
|
13050 |
|
13051 |
|
13052 |
|
13053 |
|
13054 |
|
13055 |
|
13056 |
|
13057 |
|
13058 |
|
13059 |
|
13060 | function ɵɵattribute(name, value, sanitizer, namespace) {
|
13061 | const lView = getLView();
|
13062 | const bindingIndex = nextBindingIndex();
|
13063 | if (bindingUpdated(lView, bindingIndex, value)) {
|
13064 | const tView = getTView();
|
13065 | const tNode = getSelectedTNode();
|
13066 | elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
|
13067 | ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
|
13068 | }
|
13069 | return ɵɵattribute;
|
13070 | }
|
13071 |
|
13072 |
|
13073 |
|
13074 |
|
13075 |
|
13076 |
|
13077 |
|
13078 |
|
13079 |
|
13080 |
|
13081 |
|
13082 |
|
13083 |
|
13084 |
|
13085 |
|
13086 |
|
13087 |
|
13088 |
|
13089 |
|
13090 |
|
13091 | function interpolationV(lView, values) {
|
13092 | ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
|
13093 | ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
|
13094 | let isBindingUpdated = false;
|
13095 | let bindingIndex = getBindingIndex();
|
13096 | for (let i = 1; i < values.length; i += 2) {
|
13097 |
|
13098 | isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
|
13099 | }
|
13100 | setBindingIndex(bindingIndex);
|
13101 | if (!isBindingUpdated) {
|
13102 | return NO_CHANGE;
|
13103 | }
|
13104 |
|
13105 | let content = values[0];
|
13106 | for (let i = 1; i < values.length; i += 2) {
|
13107 | content += renderStringify(values[i]) + values[i + 1];
|
13108 | }
|
13109 | return content;
|
13110 | }
|
13111 |
|
13112 |
|
13113 |
|
13114 |
|
13115 |
|
13116 |
|
13117 |
|
13118 | function interpolation1(lView, prefix, v0, suffix) {
|
13119 | const different = bindingUpdated(lView, nextBindingIndex(), v0);
|
13120 | return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
|
13121 | }
|
13122 |
|
13123 |
|
13124 |
|
13125 | function interpolation2(lView, prefix, v0, i0, v1, suffix) {
|
13126 | const bindingIndex = getBindingIndex();
|
13127 | const different = bindingUpdated2(lView, bindingIndex, v0, v1);
|
13128 | incrementBindingIndex(2);
|
13129 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
|
13130 | }
|
13131 |
|
13132 |
|
13133 |
|
13134 | function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
|
13135 | const bindingIndex = getBindingIndex();
|
13136 | const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
|
13137 | incrementBindingIndex(3);
|
13138 | return different ?
|
13139 | prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
|
13140 | NO_CHANGE;
|
13141 | }
|
13142 |
|
13143 |
|
13144 |
|
13145 | function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
|
13146 | const bindingIndex = getBindingIndex();
|
13147 | const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13148 | incrementBindingIndex(4);
|
13149 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
|
13150 | renderStringify(v2) + i2 + renderStringify(v3) + suffix :
|
13151 | NO_CHANGE;
|
13152 | }
|
13153 |
|
13154 |
|
13155 |
|
13156 | function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
|
13157 | const bindingIndex = getBindingIndex();
|
13158 | let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13159 | different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
|
13160 | incrementBindingIndex(5);
|
13161 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
|
13162 | renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
|
13163 | NO_CHANGE;
|
13164 | }
|
13165 |
|
13166 |
|
13167 |
|
13168 | function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
|
13169 | const bindingIndex = getBindingIndex();
|
13170 | let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13171 | different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
|
13172 | incrementBindingIndex(6);
|
13173 | return different ?
|
13174 | prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
|
13175 | renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
|
13176 | NO_CHANGE;
|
13177 | }
|
13178 |
|
13179 |
|
13180 |
|
13181 | function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
|
13182 | const bindingIndex = getBindingIndex();
|
13183 | let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13184 | different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
|
13185 | incrementBindingIndex(7);
|
13186 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
|
13187 | renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
|
13188 | renderStringify(v5) + i5 + renderStringify(v6) + suffix :
|
13189 | NO_CHANGE;
|
13190 | }
|
13191 |
|
13192 |
|
13193 |
|
13194 | function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
|
13195 | const bindingIndex = getBindingIndex();
|
13196 | let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13197 | different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
|
13198 | incrementBindingIndex(8);
|
13199 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
|
13200 | renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
|
13201 | renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix :
|
13202 | NO_CHANGE;
|
13203 | }
|
13204 |
|
13205 |
|
13206 |
|
13207 |
|
13208 |
|
13209 |
|
13210 |
|
13211 |
|
13212 |
|
13213 |
|
13214 |
|
13215 |
|
13216 |
|
13217 |
|
13218 |
|
13219 |
|
13220 |
|
13221 |
|
13222 |
|
13223 |
|
13224 |
|
13225 |
|
13226 |
|
13227 |
|
13228 |
|
13229 | function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
|
13230 | const lView = getLView();
|
13231 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
13232 | if (interpolatedValue !== NO_CHANGE) {
|
13233 | const tNode = getSelectedTNode();
|
13234 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13235 | ngDevMode &&
|
13236 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
|
13237 | }
|
13238 | return ɵɵattributeInterpolate1;
|
13239 | }
|
13240 |
|
13241 |
|
13242 |
|
13243 |
|
13244 |
|
13245 |
|
13246 |
|
13247 |
|
13248 |
|
13249 |
|
13250 |
|
13251 |
|
13252 |
|
13253 |
|
13254 |
|
13255 |
|
13256 |
|
13257 |
|
13258 |
|
13259 |
|
13260 |
|
13261 |
|
13262 |
|
13263 |
|
13264 |
|
13265 |
|
13266 | function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
|
13267 | const lView = getLView();
|
13268 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
13269 | if (interpolatedValue !== NO_CHANGE) {
|
13270 | const tNode = getSelectedTNode();
|
13271 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13272 | ngDevMode &&
|
13273 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
|
13274 | }
|
13275 | return ɵɵattributeInterpolate2;
|
13276 | }
|
13277 |
|
13278 |
|
13279 |
|
13280 |
|
13281 |
|
13282 |
|
13283 |
|
13284 |
|
13285 |
|
13286 |
|
13287 |
|
13288 |
|
13289 |
|
13290 |
|
13291 |
|
13292 |
|
13293 |
|
13294 |
|
13295 |
|
13296 |
|
13297 |
|
13298 |
|
13299 |
|
13300 |
|
13301 |
|
13302 |
|
13303 |
|
13304 |
|
13305 |
|
13306 | function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
|
13307 | const lView = getLView();
|
13308 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
13309 | if (interpolatedValue !== NO_CHANGE) {
|
13310 | const tNode = getSelectedTNode();
|
13311 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13312 | ngDevMode &&
|
13313 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 3, prefix, i0, i1, suffix);
|
13314 | }
|
13315 | return ɵɵattributeInterpolate3;
|
13316 | }
|
13317 |
|
13318 |
|
13319 |
|
13320 |
|
13321 |
|
13322 |
|
13323 |
|
13324 |
|
13325 |
|
13326 |
|
13327 |
|
13328 |
|
13329 |
|
13330 |
|
13331 |
|
13332 |
|
13333 |
|
13334 |
|
13335 |
|
13336 |
|
13337 |
|
13338 |
|
13339 |
|
13340 |
|
13341 |
|
13342 |
|
13343 |
|
13344 |
|
13345 |
|
13346 |
|
13347 |
|
13348 | function ɵɵattributeInterpolate4(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer, namespace) {
|
13349 | const lView = getLView();
|
13350 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
13351 | if (interpolatedValue !== NO_CHANGE) {
|
13352 | const tNode = getSelectedTNode();
|
13353 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13354 | ngDevMode &&
|
13355 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
|
13356 | }
|
13357 | return ɵɵattributeInterpolate4;
|
13358 | }
|
13359 |
|
13360 |
|
13361 |
|
13362 |
|
13363 |
|
13364 |
|
13365 |
|
13366 |
|
13367 |
|
13368 |
|
13369 |
|
13370 |
|
13371 |
|
13372 |
|
13373 |
|
13374 |
|
13375 |
|
13376 |
|
13377 |
|
13378 |
|
13379 |
|
13380 |
|
13381 |
|
13382 |
|
13383 |
|
13384 |
|
13385 |
|
13386 |
|
13387 |
|
13388 |
|
13389 |
|
13390 |
|
13391 |
|
13392 | function ɵɵattributeInterpolate5(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer, namespace) {
|
13393 | const lView = getLView();
|
13394 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
13395 | if (interpolatedValue !== NO_CHANGE) {
|
13396 | const tNode = getSelectedTNode();
|
13397 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13398 | ngDevMode &&
|
13399 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
|
13400 | }
|
13401 | return ɵɵattributeInterpolate5;
|
13402 | }
|
13403 |
|
13404 |
|
13405 |
|
13406 |
|
13407 |
|
13408 |
|
13409 |
|
13410 |
|
13411 |
|
13412 |
|
13413 |
|
13414 |
|
13415 |
|
13416 |
|
13417 |
|
13418 |
|
13419 |
|
13420 |
|
13421 |
|
13422 |
|
13423 |
|
13424 |
|
13425 |
|
13426 |
|
13427 |
|
13428 |
|
13429 |
|
13430 |
|
13431 |
|
13432 |
|
13433 |
|
13434 |
|
13435 |
|
13436 |
|
13437 |
|
13438 | function ɵɵattributeInterpolate6(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer, namespace) {
|
13439 | const lView = getLView();
|
13440 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
13441 | if (interpolatedValue !== NO_CHANGE) {
|
13442 | const tNode = getSelectedTNode();
|
13443 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13444 | ngDevMode &&
|
13445 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 6, prefix, i0, i1, i2, i3, i4, suffix);
|
13446 | }
|
13447 | return ɵɵattributeInterpolate6;
|
13448 | }
|
13449 |
|
13450 |
|
13451 |
|
13452 |
|
13453 |
|
13454 |
|
13455 |
|
13456 |
|
13457 |
|
13458 |
|
13459 |
|
13460 |
|
13461 |
|
13462 |
|
13463 |
|
13464 |
|
13465 |
|
13466 |
|
13467 |
|
13468 |
|
13469 |
|
13470 |
|
13471 |
|
13472 |
|
13473 |
|
13474 |
|
13475 |
|
13476 |
|
13477 |
|
13478 |
|
13479 |
|
13480 |
|
13481 |
|
13482 |
|
13483 |
|
13484 |
|
13485 |
|
13486 | function ɵɵattributeInterpolate7(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer, namespace) {
|
13487 | const lView = getLView();
|
13488 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
13489 | if (interpolatedValue !== NO_CHANGE) {
|
13490 | const tNode = getSelectedTNode();
|
13491 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13492 | ngDevMode &&
|
13493 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 7, prefix, i0, i1, i2, i3, i4, i5, suffix);
|
13494 | }
|
13495 | return ɵɵattributeInterpolate7;
|
13496 | }
|
13497 |
|
13498 |
|
13499 |
|
13500 |
|
13501 |
|
13502 |
|
13503 |
|
13504 |
|
13505 |
|
13506 |
|
13507 |
|
13508 |
|
13509 |
|
13510 |
|
13511 |
|
13512 |
|
13513 |
|
13514 |
|
13515 |
|
13516 |
|
13517 |
|
13518 |
|
13519 |
|
13520 |
|
13521 |
|
13522 |
|
13523 |
|
13524 |
|
13525 |
|
13526 |
|
13527 |
|
13528 |
|
13529 |
|
13530 |
|
13531 |
|
13532 |
|
13533 |
|
13534 |
|
13535 |
|
13536 | function ɵɵattributeInterpolate8(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer, namespace) {
|
13537 | const lView = getLView();
|
13538 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
13539 | if (interpolatedValue !== NO_CHANGE) {
|
13540 | const tNode = getSelectedTNode();
|
13541 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13542 | ngDevMode &&
|
13543 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 8, prefix, i0, i1, i2, i3, i4, i5, i6, suffix);
|
13544 | }
|
13545 | return ɵɵattributeInterpolate8;
|
13546 | }
|
13547 |
|
13548 |
|
13549 |
|
13550 |
|
13551 |
|
13552 |
|
13553 |
|
13554 |
|
13555 |
|
13556 |
|
13557 |
|
13558 |
|
13559 |
|
13560 |
|
13561 |
|
13562 |
|
13563 |
|
13564 |
|
13565 |
|
13566 |
|
13567 |
|
13568 |
|
13569 |
|
13570 |
|
13571 |
|
13572 |
|
13573 | function ɵɵattributeInterpolateV(attrName, values, sanitizer, namespace) {
|
13574 | const lView = getLView();
|
13575 | const interpolated = interpolationV(lView, values);
|
13576 | if (interpolated !== NO_CHANGE) {
|
13577 | const tNode = getSelectedTNode();
|
13578 | elementAttributeInternal(tNode, lView, attrName, interpolated, sanitizer, namespace);
|
13579 | if (ngDevMode) {
|
13580 | const interpolationInBetween = [values[0]];
|
13581 | for (let i = 2; i < values.length; i += 2) {
|
13582 | interpolationInBetween.push(values[i]);
|
13583 | }
|
13584 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - interpolationInBetween.length + 1, ...interpolationInBetween);
|
13585 | }
|
13586 | }
|
13587 | return ɵɵattributeInterpolateV;
|
13588 | }
|
13589 |
|
13590 |
|
13591 |
|
13592 |
|
13593 |
|
13594 |
|
13595 |
|
13596 |
|
13597 |
|
13598 |
|
13599 |
|
13600 |
|
13601 |
|
13602 |
|
13603 |
|
13604 | function detectChanges(component) {
|
13605 | const view = getComponentViewByInstance(component);
|
13606 | detectChangesInternal(view[TVIEW], view, component);
|
13607 | }
|
13608 |
|
13609 |
|
13610 |
|
13611 |
|
13612 |
|
13613 |
|
13614 |
|
13615 |
|
13616 |
|
13617 | function markDirty(component) {
|
13618 | ngDevMode && assertDefined(component, 'component');
|
13619 | const rootView = markViewDirty(getComponentViewByInstance(component));
|
13620 | ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
|
13621 | scheduleTick(rootView[CONTEXT], 1 );
|
13622 | }
|
13623 |
|
13624 |
|
13625 |
|
13626 |
|
13627 |
|
13628 |
|
13629 |
|
13630 |
|
13631 |
|
13632 |
|
13633 |
|
13634 |
|
13635 | function tick(component) {
|
13636 | const rootView = getRootView(component);
|
13637 | const rootContext = rootView[CONTEXT];
|
13638 | tickRootContext(rootContext);
|
13639 | }
|
13640 |
|
13641 |
|
13642 |
|
13643 |
|
13644 |
|
13645 |
|
13646 |
|
13647 |
|
13648 | function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) {
|
13649 | ngDevMode && assertFirstCreatePass(tView);
|
13650 | ngDevMode && ngDevMode.firstCreatePass++;
|
13651 | const tViewConsts = tView.consts;
|
13652 |
|
13653 | const tNode = getOrCreateTNode(tView, lView[T_HOST], index, 0 , tagName || null, getConstant(tViewConsts, attrsIndex));
|
13654 | resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
|
13655 | registerPostOrderHooks(tView, tNode);
|
13656 | const embeddedTView = tNode.tViews = createTView(2 , -1, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
|
13657 | const embeddedTViewNode = createTNode(tView, null, 2 , -1, null, null);
|
13658 | embeddedTViewNode.injectorIndex = tNode.injectorIndex;
|
13659 | embeddedTView.node = embeddedTViewNode;
|
13660 | if (tView.queries !== null) {
|
13661 | tView.queries.template(tView, tNode);
|
13662 | embeddedTView.queries = tView.queries.embeddedTView(tNode);
|
13663 | }
|
13664 | return tNode;
|
13665 | }
|
13666 |
|
13667 |
|
13668 |
|
13669 |
|
13670 |
|
13671 |
|
13672 |
|
13673 |
|
13674 |
|
13675 |
|
13676 |
|
13677 |
|
13678 |
|
13679 |
|
13680 |
|
13681 |
|
13682 |
|
13683 |
|
13684 |
|
13685 | function ɵɵtemplate(index, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex, localRefExtractor) {
|
13686 | const lView = getLView();
|
13687 | const tView = getTView();
|
13688 | const adjustedIndex = index + HEADER_OFFSET;
|
13689 | const tNode = tView.firstCreatePass ?
|
13690 | templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) :
|
13691 | tView.data[adjustedIndex];
|
13692 | setPreviousOrParentTNode(tNode, false);
|
13693 | const comment = lView[RENDERER].createComment(ngDevMode ? 'container' : '');
|
13694 | appendChild(tView, lView, comment, tNode);
|
13695 | attachPatchData(comment, lView);
|
13696 | addToViewTree(lView, lView[adjustedIndex] = createLContainer(comment, lView, comment, tNode));
|
13697 | if (isDirectiveHost(tNode)) {
|
13698 | createDirectivesInstances(tView, lView, tNode);
|
13699 | }
|
13700 | if (localRefsIndex != null) {
|
13701 | saveResolvedLocalsInData(lView, tNode, localRefExtractor);
|
13702 | }
|
13703 | }
|
13704 |
|
13705 |
|
13706 |
|
13707 |
|
13708 |
|
13709 |
|
13710 |
|
13711 |
|
13712 |
|
13713 | function store(tView, lView, index, value) {
|
13714 |
|
13715 |
|
13716 | const adjustedIndex = index + HEADER_OFFSET;
|
13717 | if (adjustedIndex >= tView.data.length) {
|
13718 | tView.data[adjustedIndex] = null;
|
13719 | tView.blueprint[adjustedIndex] = null;
|
13720 | }
|
13721 | lView[adjustedIndex] = value;
|
13722 | }
|
13723 |
|
13724 |
|
13725 |
|
13726 |
|
13727 |
|
13728 |
|
13729 |
|
13730 |
|
13731 |
|
13732 |
|
13733 | function ɵɵreference(index) {
|
13734 | const contextLView = getContextLView();
|
13735 | return load(contextLView, index);
|
13736 | }
|
13737 |
|
13738 |
|
13739 |
|
13740 |
|
13741 |
|
13742 |
|
13743 |
|
13744 |
|
13745 | function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
|
13746 | const lView = getLView();
|
13747 |
|
13748 |
|
13749 | if (lView == null)
|
13750 | return ɵɵinject(token, flags);
|
13751 | const tNode = getPreviousOrParentTNode();
|
13752 | return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
13753 | }
|
13754 |
|
13755 |
|
13756 |
|
13757 |
|
13758 |
|
13759 | function ɵɵinjectAttribute(attrNameToInject) {
|
13760 | return injectAttributeImpl(getPreviousOrParentTNode(), attrNameToInject);
|
13761 | }
|
13762 |
|
13763 |
|
13764 |
|
13765 |
|
13766 |
|
13767 |
|
13768 |
|
13769 |
|
13770 |
|
13771 |
|
13772 |
|
13773 |
|
13774 | function ɵɵinvalidFactory() {
|
13775 | const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
|
13776 | throw new Error(msg);
|
13777 | }
|
13778 |
|
13779 |
|
13780 |
|
13781 |
|
13782 |
|
13783 |
|
13784 |
|
13785 |
|
13786 |
|
13787 |
|
13788 |
|
13789 |
|
13790 |
|
13791 |
|
13792 |
|
13793 |
|
13794 |
|
13795 |
|
13796 |
|
13797 |
|
13798 |
|
13799 |
|
13800 |
|
13801 |
|
13802 |
|
13803 |
|
13804 | function ɵɵproperty(propName, value, sanitizer) {
|
13805 | const lView = getLView();
|
13806 | const bindingIndex = nextBindingIndex();
|
13807 | if (bindingUpdated(lView, bindingIndex, value)) {
|
13808 | const tView = getTView();
|
13809 | const tNode = getSelectedTNode();
|
13810 | elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, false);
|
13811 | ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
|
13812 | }
|
13813 | return ɵɵproperty;
|
13814 | }
|
13815 |
|
13816 |
|
13817 |
|
13818 |
|
13819 | function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased) {
|
13820 | const inputs = tNode.inputs;
|
13821 | const property = isClassBased ? 'class' : 'style';
|
13822 |
|
13823 | setInputsForProperty(tView, lView, inputs[property], property, value);
|
13824 | }
|
13825 |
|
13826 |
|
13827 |
|
13828 |
|
13829 |
|
13830 |
|
13831 |
|
13832 |
|
13833 | function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
|
13834 | ngDevMode && assertFirstCreatePass(tView);
|
13835 | ngDevMode && ngDevMode.firstCreatePass++;
|
13836 | const tViewConsts = tView.consts;
|
13837 | const attrs = getConstant(tViewConsts, attrsIndex);
|
13838 | const tNode = getOrCreateTNode(tView, lView[T_HOST], index, 3 , name, attrs);
|
13839 | const hasDirectives = resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
|
13840 | ngDevMode && logUnknownElementError(tView, native, tNode, hasDirectives);
|
13841 | if (tNode.attrs !== null) {
|
13842 | computeStaticStyling(tNode, tNode.attrs, false);
|
13843 | }
|
13844 | if (tNode.mergedAttrs !== null) {
|
13845 | computeStaticStyling(tNode, tNode.mergedAttrs, true);
|
13846 | }
|
13847 | if (tView.queries !== null) {
|
13848 | tView.queries.elementStart(tView, tNode);
|
13849 | }
|
13850 | return tNode;
|
13851 | }
|
13852 |
|
13853 |
|
13854 |
|
13855 |
|
13856 |
|
13857 |
|
13858 |
|
13859 |
|
13860 |
|
13861 |
|
13862 |
|
13863 |
|
13864 |
|
13865 |
|
13866 | function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
13867 | const lView = getLView();
|
13868 | const tView = getTView();
|
13869 | const adjustedIndex = HEADER_OFFSET + index;
|
13870 | ngDevMode &&
|
13871 | assertEqual(getBindingIndex(), tView.bindingStartIndex, 'elements should be created before any bindings');
|
13872 | ngDevMode && ngDevMode.rendererCreateElement++;
|
13873 | ngDevMode && assertIndexInRange(lView, adjustedIndex);
|
13874 | const renderer = lView[RENDERER];
|
13875 | const native = lView[adjustedIndex] = elementCreate(name, renderer, getNamespace());
|
13876 | const tNode = tView.firstCreatePass ?
|
13877 | elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) :
|
13878 | tView.data[adjustedIndex];
|
13879 | setPreviousOrParentTNode(tNode, true);
|
13880 | const mergedAttrs = tNode.mergedAttrs;
|
13881 | if (mergedAttrs !== null) {
|
13882 | setUpAttributes(renderer, native, mergedAttrs);
|
13883 | }
|
13884 | const classes = tNode.classes;
|
13885 | if (classes !== null) {
|
13886 | writeDirectClass(renderer, native, classes);
|
13887 | }
|
13888 | const styles = tNode.styles;
|
13889 | if (styles !== null) {
|
13890 | writeDirectStyle(renderer, native, styles);
|
13891 | }
|
13892 | appendChild(tView, lView, native, tNode);
|
13893 |
|
13894 |
|
13895 |
|
13896 | if (getElementDepthCount() === 0) {
|
13897 | attachPatchData(native, lView);
|
13898 | }
|
13899 | increaseElementDepthCount();
|
13900 | if (isDirectiveHost(tNode)) {
|
13901 | createDirectivesInstances(tView, lView, tNode);
|
13902 | executeContentQueries(tView, tNode, lView);
|
13903 | }
|
13904 | if (localRefsIndex !== null) {
|
13905 | saveResolvedLocalsInData(lView, tNode);
|
13906 | }
|
13907 | }
|
13908 |
|
13909 |
|
13910 |
|
13911 |
|
13912 |
|
13913 | function ɵɵelementEnd() {
|
13914 | let previousOrParentTNode = getPreviousOrParentTNode();
|
13915 | ngDevMode && assertDefined(previousOrParentTNode, 'No parent node to close.');
|
13916 | if (getIsParent()) {
|
13917 | setIsNotParent();
|
13918 | }
|
13919 | else {
|
13920 | ngDevMode && assertHasParent(getPreviousOrParentTNode());
|
13921 | previousOrParentTNode = previousOrParentTNode.parent;
|
13922 | setPreviousOrParentTNode(previousOrParentTNode, false);
|
13923 | }
|
13924 | const tNode = previousOrParentTNode;
|
13925 | ngDevMode && assertNodeType(tNode, 3 );
|
13926 | decreaseElementDepthCount();
|
13927 | const tView = getTView();
|
13928 | if (tView.firstCreatePass) {
|
13929 | registerPostOrderHooks(tView, previousOrParentTNode);
|
13930 | if (isContentQueryHost(previousOrParentTNode)) {
|
13931 | tView.queries.elementEnd(previousOrParentTNode);
|
13932 | }
|
13933 | }
|
13934 | if (tNode.classesWithoutHost != null && hasClassInput(tNode)) {
|
13935 | setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.classesWithoutHost, true);
|
13936 | }
|
13937 | if (tNode.stylesWithoutHost != null && hasStyleInput(tNode)) {
|
13938 | setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.stylesWithoutHost, false);
|
13939 | }
|
13940 | }
|
13941 |
|
13942 |
|
13943 |
|
13944 |
|
13945 |
|
13946 |
|
13947 |
|
13948 |
|
13949 |
|
13950 |
|
13951 | function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
13952 | ɵɵelementStart(index, name, attrsIndex, localRefsIndex);
|
13953 | ɵɵelementEnd();
|
13954 | }
|
13955 | function logUnknownElementError(tView, element, tNode, hasDirectives) {
|
13956 | const schemas = tView.schemas;
|
13957 |
|
13958 |
|
13959 |
|
13960 |
|
13961 | if (schemas === null)
|
13962 | return;
|
13963 | const tagName = tNode.tagName;
|
13964 |
|
13965 | if (!hasDirectives && tagName !== null) {
|
13966 |
|
13967 |
|
13968 |
|
13969 | const isUnknown =
|
13970 |
|
13971 |
|
13972 | (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
13973 | element instanceof HTMLUnknownElement) ||
|
13974 | (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
13975 | !customElements.get(tagName));
|
13976 | if (isUnknown && !matchingSchemas(tView, tagName)) {
|
13977 | let message = `'${tagName}' is not a known element:\n`;
|
13978 | message += `1. If '${tagName}' is an Angular component, then verify that it is part of this module.\n`;
|
13979 | if (tagName && tagName.indexOf('-') > -1) {
|
13980 | message += `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.`;
|
13981 | }
|
13982 | else {
|
13983 | message +=
|
13984 | `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
13985 | }
|
13986 | console.error(message);
|
13987 | }
|
13988 | }
|
13989 | }
|
13990 |
|
13991 |
|
13992 |
|
13993 |
|
13994 |
|
13995 |
|
13996 |
|
13997 |
|
13998 | function elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, localRefsIndex) {
|
13999 | ngDevMode && ngDevMode.firstCreatePass++;
|
14000 | const tViewConsts = tView.consts;
|
14001 | const attrs = getConstant(tViewConsts, attrsIndex);
|
14002 | const tNode = getOrCreateTNode(tView, lView[T_HOST], index, 4 , 'ng-container', attrs);
|
14003 |
|
14004 |
|
14005 | if (attrs !== null) {
|
14006 | computeStaticStyling(tNode, attrs, true);
|
14007 | }
|
14008 | const localRefs = getConstant(tViewConsts, localRefsIndex);
|
14009 | resolveDirectives(tView, lView, tNode, localRefs);
|
14010 | if (tView.queries !== null) {
|
14011 | tView.queries.elementStart(tView, tNode);
|
14012 | }
|
14013 | return tNode;
|
14014 | }
|
14015 |
|
14016 |
|
14017 |
|
14018 |
|
14019 |
|
14020 |
|
14021 |
|
14022 |
|
14023 |
|
14024 |
|
14025 |
|
14026 |
|
14027 |
|
14028 |
|
14029 | function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
|
14030 | const lView = getLView();
|
14031 | const tView = getTView();
|
14032 | const adjustedIndex = index + HEADER_OFFSET;
|
14033 | ngDevMode && assertIndexInRange(lView, adjustedIndex);
|
14034 | ngDevMode &&
|
14035 | assertEqual(getBindingIndex(), tView.bindingStartIndex, 'element containers should be created before any bindings');
|
14036 | const tNode = tView.firstCreatePass ?
|
14037 | elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, localRefsIndex) :
|
14038 | tView.data[adjustedIndex];
|
14039 | setPreviousOrParentTNode(tNode, true);
|
14040 | ngDevMode && ngDevMode.rendererCreateComment++;
|
14041 | const native = lView[adjustedIndex] =
|
14042 | lView[RENDERER].createComment(ngDevMode ? 'ng-container' : '');
|
14043 | appendChild(tView, lView, native, tNode);
|
14044 | attachPatchData(native, lView);
|
14045 | if (isDirectiveHost(tNode)) {
|
14046 | createDirectivesInstances(tView, lView, tNode);
|
14047 | executeContentQueries(tView, tNode, lView);
|
14048 | }
|
14049 | if (localRefsIndex != null) {
|
14050 | saveResolvedLocalsInData(lView, tNode);
|
14051 | }
|
14052 | }
|
14053 |
|
14054 |
|
14055 |
|
14056 |
|
14057 |
|
14058 | function ɵɵelementContainerEnd() {
|
14059 | let previousOrParentTNode = getPreviousOrParentTNode();
|
14060 | const tView = getTView();
|
14061 | if (getIsParent()) {
|
14062 | setIsNotParent();
|
14063 | }
|
14064 | else {
|
14065 | ngDevMode && assertHasParent(previousOrParentTNode);
|
14066 | previousOrParentTNode = previousOrParentTNode.parent;
|
14067 | setPreviousOrParentTNode(previousOrParentTNode, false);
|
14068 | }
|
14069 | ngDevMode && assertNodeType(previousOrParentTNode, 4 );
|
14070 | if (tView.firstCreatePass) {
|
14071 | registerPostOrderHooks(tView, previousOrParentTNode);
|
14072 | if (isContentQueryHost(previousOrParentTNode)) {
|
14073 | tView.queries.elementEnd(previousOrParentTNode);
|
14074 | }
|
14075 | }
|
14076 | }
|
14077 |
|
14078 |
|
14079 |
|
14080 |
|
14081 |
|
14082 |
|
14083 |
|
14084 |
|
14085 |
|
14086 |
|
14087 | function ɵɵelementContainer(index, attrsIndex, localRefsIndex) {
|
14088 | ɵɵelementContainerStart(index, attrsIndex, localRefsIndex);
|
14089 | ɵɵelementContainerEnd();
|
14090 | }
|
14091 |
|
14092 |
|
14093 |
|
14094 |
|
14095 |
|
14096 |
|
14097 |
|
14098 |
|
14099 |
|
14100 |
|
14101 | function ɵɵgetCurrentView() {
|
14102 | return getLView();
|
14103 | }
|
14104 |
|
14105 |
|
14106 |
|
14107 |
|
14108 |
|
14109 |
|
14110 |
|
14111 |
|
14112 |
|
14113 |
|
14114 |
|
14115 | function isPromise(obj) {
|
14116 |
|
14117 |
|
14118 | return !!obj && typeof obj.then === 'function';
|
14119 | }
|
14120 |
|
14121 |
|
14122 |
|
14123 | function isObservable(obj) {
|
14124 |
|
14125 |
|
14126 | return !!obj && typeof obj.subscribe === 'function';
|
14127 | }
|
14128 |
|
14129 |
|
14130 |
|
14131 |
|
14132 |
|
14133 |
|
14134 |
|
14135 |
|
14136 |
|
14137 |
|
14138 |
|
14139 |
|
14140 |
|
14141 |
|
14142 |
|
14143 |
|
14144 |
|
14145 |
|
14146 |
|
14147 |
|
14148 |
|
14149 |
|
14150 | function ɵɵlistener(eventName, listenerFn, useCapture = false, eventTargetResolver) {
|
14151 | const lView = getLView();
|
14152 | const tView = getTView();
|
14153 | const tNode = getPreviousOrParentTNode();
|
14154 | listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn, useCapture, eventTargetResolver);
|
14155 | return ɵɵlistener;
|
14156 | }
|
14157 |
|
14158 |
|
14159 |
|
14160 |
|
14161 |
|
14162 |
|
14163 |
|
14164 |
|
14165 |
|
14166 |
|
14167 |
|
14168 |
|
14169 |
|
14170 |
|
14171 |
|
14172 |
|
14173 |
|
14174 |
|
14175 |
|
14176 |
|
14177 |
|
14178 | function ɵɵsyntheticHostListener(eventName, listenerFn, useCapture = false, eventTargetResolver) {
|
14179 | const tNode = getPreviousOrParentTNode();
|
14180 | const lView = getLView();
|
14181 | const tView = getTView();
|
14182 | const currentDef = getCurrentDirectiveDef(tView.data);
|
14183 | const renderer = loadComponentRenderer(currentDef, tNode, lView);
|
14184 | listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, useCapture, eventTargetResolver);
|
14185 | return ɵɵsyntheticHostListener;
|
14186 | }
|
14187 |
|
14188 |
|
14189 |
|
14190 |
|
14191 |
|
14192 | function findExistingListener(tView, lView, eventName, tNodeIdx) {
|
14193 | const tCleanup = tView.cleanup;
|
14194 | if (tCleanup != null) {
|
14195 | for (let i = 0; i < tCleanup.length - 1; i += 2) {
|
14196 | const cleanupEventName = tCleanup[i];
|
14197 | if (cleanupEventName === eventName && tCleanup[i + 1] === tNodeIdx) {
|
14198 |
|
14199 |
|
14200 |
|
14201 | const lCleanup = lView[CLEANUP];
|
14202 | const listenerIdxInLCleanup = tCleanup[i + 2];
|
14203 | return lCleanup.length > listenerIdxInLCleanup ? lCleanup[listenerIdxInLCleanup] : null;
|
14204 | }
|
14205 |
|
14206 |
|
14207 |
|
14208 |
|
14209 |
|
14210 | if (typeof cleanupEventName === 'string') {
|
14211 | i += 2;
|
14212 | }
|
14213 | }
|
14214 | }
|
14215 | return null;
|
14216 | }
|
14217 | function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, useCapture = false, eventTargetResolver) {
|
14218 | const isTNodeDirectiveHost = isDirectiveHost(tNode);
|
14219 | const firstCreatePass = tView.firstCreatePass;
|
14220 | const tCleanup = firstCreatePass && (tView.cleanup || (tView.cleanup = []));
|
14221 |
|
14222 |
|
14223 |
|
14224 | const lCleanup = getLCleanup(lView);
|
14225 | ngDevMode &&
|
14226 | assertNodeOfPossibleTypes(tNode, [3 , 0 , 4 ]);
|
14227 | let processOutputs = true;
|
14228 |
|
14229 | if (tNode.type === 3 ) {
|
14230 | const native = getNativeByTNode(tNode, lView);
|
14231 | const resolved = eventTargetResolver ? eventTargetResolver(native) : EMPTY_OBJ;
|
14232 | const target = resolved.target || native;
|
14233 | const lCleanupIndex = lCleanup.length;
|
14234 | const idxOrTargetGetter = eventTargetResolver ?
|
14235 | (_lView) => eventTargetResolver(unwrapRNode(_lView[tNode.index])).target :
|
14236 | tNode.index;
|
14237 |
|
14238 |
|
14239 | if (isProceduralRenderer(renderer)) {
|
14240 |
|
14241 |
|
14242 |
|
14243 |
|
14244 |
|
14245 |
|
14246 |
|
14247 |
|
14248 |
|
14249 |
|
14250 | let existingListener = null;
|
14251 |
|
14252 |
|
14253 |
|
14254 |
|
14255 |
|
14256 |
|
14257 | if (!eventTargetResolver && isTNodeDirectiveHost) {
|
14258 | existingListener = findExistingListener(tView, lView, eventName, tNode.index);
|
14259 | }
|
14260 | if (existingListener !== null) {
|
14261 |
|
14262 |
|
14263 |
|
14264 |
|
14265 | const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
|
14266 | lastListenerFn.__ngNextListenerFn__ = listenerFn;
|
14267 | existingListener.__ngLastListenerFn__ = listenerFn;
|
14268 | processOutputs = false;
|
14269 | }
|
14270 | else {
|
14271 |
|
14272 |
|
14273 |
|
14274 | listenerFn = wrapListener(tNode, lView, listenerFn, false );
|
14275 | const cleanupFn = renderer.listen(resolved.name || target, eventName, listenerFn);
|
14276 | ngDevMode && ngDevMode.rendererAddEventListener++;
|
14277 | lCleanup.push(listenerFn, cleanupFn);
|
14278 | tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
|
14279 | }
|
14280 | }
|
14281 | else {
|
14282 | listenerFn = wrapListener(tNode, lView, listenerFn, true );
|
14283 | target.addEventListener(eventName, listenerFn, useCapture);
|
14284 | ngDevMode && ngDevMode.rendererAddEventListener++;
|
14285 | lCleanup.push(listenerFn);
|
14286 | tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, useCapture);
|
14287 | }
|
14288 | }
|
14289 |
|
14290 | const outputs = tNode.outputs;
|
14291 | let props;
|
14292 | if (processOutputs && outputs !== null && (props = outputs[eventName])) {
|
14293 | const propsLength = props.length;
|
14294 | if (propsLength) {
|
14295 | for (let i = 0; i < propsLength; i += 2) {
|
14296 | const index = props[i];
|
14297 | ngDevMode && assertIndexInRange(lView, index);
|
14298 | const minifiedName = props[i + 1];
|
14299 | const directiveInstance = lView[index];
|
14300 | const output = directiveInstance[minifiedName];
|
14301 | if (ngDevMode && !isObservable(output)) {
|
14302 | throw new Error(`@Output ${minifiedName} not initialized in '${directiveInstance.constructor.name}'.`);
|
14303 | }
|
14304 | const subscription = output.subscribe(listenerFn);
|
14305 | const idx = lCleanup.length;
|
14306 | lCleanup.push(listenerFn, subscription);
|
14307 | tCleanup && tCleanup.push(eventName, tNode.index, idx, -(idx + 1));
|
14308 | }
|
14309 | }
|
14310 | }
|
14311 | }
|
14312 | function executeListenerWithErrorHandling(lView, listenerFn, e) {
|
14313 | try {
|
14314 |
|
14315 | return listenerFn(e) !== false;
|
14316 | }
|
14317 | catch (error) {
|
14318 | handleError(lView, error);
|
14319 | return false;
|
14320 | }
|
14321 | }
|
14322 |
|
14323 |
|
14324 |
|
14325 |
|
14326 |
|
14327 |
|
14328 |
|
14329 |
|
14330 |
|
14331 |
|
14332 | function wrapListener(tNode, lView, listenerFn, wrapWithPreventDefault) {
|
14333 |
|
14334 |
|
14335 | return function wrapListenerIn_markDirtyAndPreventDefault(e) {
|
14336 |
|
14337 |
|
14338 | if (e === Function) {
|
14339 | return listenerFn;
|
14340 | }
|
14341 |
|
14342 |
|
14343 | const startView = tNode.flags & 2 ?
|
14344 | getComponentLViewByIndex(tNode.index, lView) :
|
14345 | lView;
|
14346 |
|
14347 | if ((lView[FLAGS] & 32 ) === 0) {
|
14348 | markViewDirty(startView);
|
14349 | }
|
14350 | let result = executeListenerWithErrorHandling(lView, listenerFn, e);
|
14351 |
|
14352 |
|
14353 | let nextListenerFn = wrapListenerIn_markDirtyAndPreventDefault.__ngNextListenerFn__;
|
14354 | while (nextListenerFn) {
|
14355 |
|
14356 | result = executeListenerWithErrorHandling(lView, nextListenerFn, e) && result;
|
14357 | nextListenerFn = nextListenerFn.__ngNextListenerFn__;
|
14358 | }
|
14359 | if (wrapWithPreventDefault && result === false) {
|
14360 | e.preventDefault();
|
14361 |
|
14362 | e.returnValue = false;
|
14363 | }
|
14364 | return result;
|
14365 | };
|
14366 | }
|
14367 |
|
14368 |
|
14369 |
|
14370 |
|
14371 |
|
14372 |
|
14373 |
|
14374 |
|
14375 |
|
14376 |
|
14377 |
|
14378 |
|
14379 |
|
14380 |
|
14381 |
|
14382 |
|
14383 |
|
14384 |
|
14385 |
|
14386 |
|
14387 |
|
14388 |
|
14389 |
|
14390 |
|
14391 |
|
14392 |
|
14393 |
|
14394 |
|
14395 | function ɵɵnextContext(level = 1) {
|
14396 | return nextContextImpl(level);
|
14397 | }
|
14398 |
|
14399 |
|
14400 |
|
14401 |
|
14402 |
|
14403 |
|
14404 |
|
14405 |
|
14406 |
|
14407 |
|
14408 |
|
14409 |
|
14410 |
|
14411 |
|
14412 |
|
14413 |
|
14414 | function matchingProjectionSlotIndex(tNode, projectionSlots) {
|
14415 | let wildcardNgContentIndex = null;
|
14416 | const ngProjectAsAttrVal = getProjectAsAttrValue(tNode);
|
14417 | for (let i = 0; i < projectionSlots.length; i++) {
|
14418 | const slotValue = projectionSlots[i];
|
14419 |
|
14420 |
|
14421 | if (slotValue === '*') {
|
14422 | wildcardNgContentIndex = i;
|
14423 | continue;
|
14424 | }
|
14425 |
|
14426 |
|
14427 | if (ngProjectAsAttrVal === null ?
|
14428 | isNodeMatchingSelectorList(tNode, slotValue, true) :
|
14429 | isSelectorInSelectorList(ngProjectAsAttrVal, slotValue)) {
|
14430 | return i;
|
14431 | }
|
14432 | }
|
14433 | return wildcardNgContentIndex;
|
14434 | }
|
14435 |
|
14436 |
|
14437 |
|
14438 |
|
14439 |
|
14440 |
|
14441 |
|
14442 |
|
14443 |
|
14444 |
|
14445 |
|
14446 |
|
14447 |
|
14448 |
|
14449 |
|
14450 |
|
14451 |
|
14452 |
|
14453 |
|
14454 |
|
14455 |
|
14456 |
|
14457 |
|
14458 |
|
14459 |
|
14460 | function ɵɵprojectionDef(projectionSlots) {
|
14461 | const componentNode = getLView()[DECLARATION_COMPONENT_VIEW][T_HOST];
|
14462 | if (!componentNode.projection) {
|
14463 |
|
14464 |
|
14465 | const numProjectionSlots = projectionSlots ? projectionSlots.length : 1;
|
14466 | const projectionHeads = componentNode.projection =
|
14467 | newArray(numProjectionSlots, null);
|
14468 | const tails = projectionHeads.slice();
|
14469 | let componentChild = componentNode.child;
|
14470 | while (componentChild !== null) {
|
14471 | const slotIndex = projectionSlots ? matchingProjectionSlotIndex(componentChild, projectionSlots) : 0;
|
14472 | if (slotIndex !== null) {
|
14473 | if (tails[slotIndex]) {
|
14474 | tails[slotIndex].projectionNext = componentChild;
|
14475 | }
|
14476 | else {
|
14477 | projectionHeads[slotIndex] = componentChild;
|
14478 | }
|
14479 | tails[slotIndex] = componentChild;
|
14480 | }
|
14481 | componentChild = componentChild.next;
|
14482 | }
|
14483 | }
|
14484 | }
|
14485 | let delayProjection = false;
|
14486 | function setDelayProjection(value) {
|
14487 | delayProjection = value;
|
14488 | }
|
14489 |
|
14490 |
|
14491 |
|
14492 |
|
14493 |
|
14494 |
|
14495 |
|
14496 |
|
14497 |
|
14498 |
|
14499 |
|
14500 | function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs) {
|
14501 | const lView = getLView();
|
14502 | const tView = getTView();
|
14503 | const tProjectionNode = getOrCreateTNode(tView, lView[T_HOST], nodeIndex, 1 , null, attrs || null);
|
14504 |
|
14505 | if (tProjectionNode.projection === null)
|
14506 | tProjectionNode.projection = selectorIndex;
|
14507 |
|
14508 | setIsNotParent();
|
14509 |
|
14510 | if (!delayProjection) {
|
14511 |
|
14512 | applyProjection(tView, lView, tProjectionNode);
|
14513 | }
|
14514 | }
|
14515 |
|
14516 |
|
14517 |
|
14518 |
|
14519 |
|
14520 |
|
14521 |
|
14522 |
|
14523 |
|
14524 |
|
14525 |
|
14526 |
|
14527 |
|
14528 |
|
14529 |
|
14530 |
|
14531 |
|
14532 |
|
14533 |
|
14534 |
|
14535 |
|
14536 |
|
14537 |
|
14538 |
|
14539 |
|
14540 |
|
14541 |
|
14542 |
|
14543 |
|
14544 |
|
14545 | function ɵɵpropertyInterpolate(propName, v0, sanitizer) {
|
14546 | ɵɵpropertyInterpolate1(propName, '', v0, '', sanitizer);
|
14547 | return ɵɵpropertyInterpolate;
|
14548 | }
|
14549 |
|
14550 |
|
14551 |
|
14552 |
|
14553 |
|
14554 |
|
14555 |
|
14556 |
|
14557 |
|
14558 |
|
14559 |
|
14560 |
|
14561 |
|
14562 |
|
14563 |
|
14564 |
|
14565 |
|
14566 |
|
14567 |
|
14568 |
|
14569 |
|
14570 |
|
14571 |
|
14572 |
|
14573 |
|
14574 |
|
14575 |
|
14576 |
|
14577 | function ɵɵpropertyInterpolate1(propName, prefix, v0, suffix, sanitizer) {
|
14578 | const lView = getLView();
|
14579 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
14580 | if (interpolatedValue !== NO_CHANGE) {
|
14581 | const tView = getTView();
|
14582 | const tNode = getSelectedTNode();
|
14583 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
14584 | ngDevMode &&
|
14585 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 1, prefix, suffix);
|
14586 | }
|
14587 | return ɵɵpropertyInterpolate1;
|
14588 | }
|
14589 |
|
14590 |
|
14591 |
|
14592 |
|
14593 |
|
14594 |
|
14595 |
|
14596 |
|
14597 |
|
14598 |
|
14599 |
|
14600 |
|
14601 |
|
14602 |
|
14603 |
|
14604 |
|
14605 |
|
14606 |
|
14607 |
|
14608 |
|
14609 |
|
14610 |
|
14611 |
|
14612 |
|
14613 |
|
14614 |
|
14615 |
|
14616 |
|
14617 |
|
14618 |
|
14619 | function ɵɵpropertyInterpolate2(propName, prefix, v0, i0, v1, suffix, sanitizer) {
|
14620 | const lView = getLView();
|
14621 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
14622 | if (interpolatedValue !== NO_CHANGE) {
|
14623 | const tView = getTView();
|
14624 | const tNode = getSelectedTNode();
|
14625 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
14626 | ngDevMode &&
|
14627 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 2, prefix, i0, suffix);
|
14628 | }
|
14629 | return ɵɵpropertyInterpolate2;
|
14630 | }
|
14631 |
|
14632 |
|
14633 |
|
14634 |
|
14635 |
|
14636 |
|
14637 |
|
14638 |
|
14639 |
|
14640 |
|
14641 |
|
14642 |
|
14643 |
|
14644 |
|
14645 |
|
14646 |
|
14647 |
|
14648 |
|
14649 |
|
14650 |
|
14651 |
|
14652 |
|
14653 |
|
14654 |
|
14655 |
|
14656 |
|
14657 |
|
14658 |
|
14659 |
|
14660 |
|
14661 |
|
14662 |
|
14663 |
|
14664 | function ɵɵpropertyInterpolate3(propName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer) {
|
14665 | const lView = getLView();
|
14666 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
14667 | if (interpolatedValue !== NO_CHANGE) {
|
14668 | const tView = getTView();
|
14669 | const tNode = getSelectedTNode();
|
14670 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
14671 | ngDevMode &&
|
14672 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 3, prefix, i0, i1, suffix);
|
14673 | }
|
14674 | return ɵɵpropertyInterpolate3;
|
14675 | }
|
14676 |
|
14677 |
|
14678 |
|
14679 |
|
14680 |
|
14681 |
|
14682 |
|
14683 |
|
14684 |
|
14685 |
|
14686 |
|
14687 |
|
14688 |
|
14689 |
|
14690 |
|
14691 |
|
14692 |
|
14693 |
|
14694 |
|
14695 |
|
14696 |
|
14697 |
|
14698 |
|
14699 |
|
14700 |
|
14701 |
|
14702 |
|
14703 |
|
14704 |
|
14705 |
|
14706 |
|
14707 |
|
14708 |
|
14709 |
|
14710 |
|
14711 | function ɵɵpropertyInterpolate4(propName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer) {
|
14712 | const lView = getLView();
|
14713 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
14714 | if (interpolatedValue !== NO_CHANGE) {
|
14715 | const tView = getTView();
|
14716 | const tNode = getSelectedTNode();
|
14717 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
14718 | ngDevMode &&
|
14719 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
|
14720 | }
|
14721 | return ɵɵpropertyInterpolate4;
|
14722 | }
|
14723 |
|
14724 |
|
14725 |
|
14726 |
|
14727 |
|
14728 |
|
14729 |
|
14730 |
|
14731 |
|
14732 |
|
14733 |
|
14734 |
|
14735 |
|
14736 |
|
14737 |
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 |
|
14749 |
|
14750 |
|
14751 |
|
14752 |
|
14753 |
|
14754 |
|
14755 |
|
14756 |
|
14757 |
|
14758 |
|
14759 |
|
14760 | function ɵɵpropertyInterpolate5(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer) {
|
14761 | const lView = getLView();
|
14762 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
14763 | if (interpolatedValue !== NO_CHANGE) {
|
14764 | const tView = getTView();
|
14765 | const tNode = getSelectedTNode();
|
14766 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
14767 | ngDevMode &&
|
14768 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
|
14769 | }
|
14770 | return ɵɵpropertyInterpolate5;
|
14771 | }
|
14772 |
|
14773 |
|
14774 |
|
14775 |
|
14776 |
|
14777 |
|
14778 |
|
14779 |
|
14780 |
|
14781 |
|
14782 |
|
14783 |
|
14784 |
|
14785 |
|
14786 |
|
14787 |
|
14788 |
|
14789 |
|
14790 |
|
14791 |
|
14792 |
|
14793 |
|
14794 |
|
14795 |
|
14796 |
|
14797 |
|
14798 |
|
14799 |
|
14800 |
|
14801 |
|
14802 |
|
14803 |
|
14804 |
|
14805 |
|
14806 |
|
14807 |
|
14808 |
|
14809 |
|
14810 |
|
14811 | function ɵɵpropertyInterpolate6(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer) {
|
14812 | const lView = getLView();
|
14813 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
14814 | if (interpolatedValue !== NO_CHANGE) {
|
14815 | const tView = getTView();
|
14816 | const tNode = getSelectedTNode();
|
14817 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
14818 | ngDevMode &&
|
14819 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 6, prefix, i0, i1, i2, i3, i4, suffix);
|
14820 | }
|
14821 | return ɵɵpropertyInterpolate6;
|
14822 | }
|
14823 |
|
14824 |
|
14825 |
|
14826 |
|
14827 |
|
14828 |
|
14829 |
|
14830 |
|
14831 |
|
14832 |
|
14833 |
|
14834 |
|
14835 |
|
14836 |
|
14837 |
|
14838 |
|
14839 |
|
14840 |
|
14841 |
|
14842 |
|
14843 |
|
14844 |
|
14845 |
|
14846 |
|
14847 |
|
14848 |
|
14849 |
|
14850 |
|
14851 |
|
14852 |
|
14853 |
|
14854 |
|
14855 |
|
14856 |
|
14857 |
|
14858 |
|
14859 |
|
14860 |
|
14861 |
|
14862 |
|
14863 |
|
14864 | function ɵɵpropertyInterpolate7(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer) {
|
14865 | const lView = getLView();
|
14866 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
14867 | if (interpolatedValue !== NO_CHANGE) {
|
14868 | const tView = getTView();
|
14869 | const tNode = getSelectedTNode();
|
14870 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
14871 | ngDevMode &&
|
14872 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 7, prefix, i0, i1, i2, i3, i4, i5, suffix);
|
14873 | }
|
14874 | return ɵɵpropertyInterpolate7;
|
14875 | }
|
14876 |
|
14877 |
|
14878 |
|
14879 |
|
14880 |
|
14881 |
|
14882 |
|
14883 |
|
14884 |
|
14885 |
|
14886 |
|
14887 |
|
14888 |
|
14889 |
|
14890 |
|
14891 |
|
14892 |
|
14893 |
|
14894 |
|
14895 |
|
14896 |
|
14897 |
|
14898 |
|
14899 |
|
14900 |
|
14901 |
|
14902 |
|
14903 |
|
14904 |
|
14905 |
|
14906 |
|
14907 |
|
14908 |
|
14909 |
|
14910 |
|
14911 |
|
14912 |
|
14913 |
|
14914 |
|
14915 |
|
14916 |
|
14917 |
|
14918 |
|
14919 | function ɵɵpropertyInterpolate8(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer) {
|
14920 | const lView = getLView();
|
14921 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
14922 | if (interpolatedValue !== NO_CHANGE) {
|
14923 | const tView = getTView();
|
14924 | const tNode = getSelectedTNode();
|
14925 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
14926 | ngDevMode &&
|
14927 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 8, prefix, i0, i1, i2, i3, i4, i5, i6, suffix);
|
14928 | }
|
14929 | return ɵɵpropertyInterpolate8;
|
14930 | }
|
14931 |
|
14932 |
|
14933 |
|
14934 |
|
14935 |
|
14936 |
|
14937 |
|
14938 |
|
14939 |
|
14940 |
|
14941 |
|
14942 |
|
14943 |
|
14944 |
|
14945 |
|
14946 |
|
14947 |
|
14948 |
|
14949 |
|
14950 |
|
14951 |
|
14952 |
|
14953 |
|
14954 |
|
14955 |
|
14956 |
|
14957 |
|
14958 |
|
14959 |
|
14960 |
|
14961 | function ɵɵpropertyInterpolateV(propName, values, sanitizer) {
|
14962 | const lView = getLView();
|
14963 | const interpolatedValue = interpolationV(lView, values);
|
14964 | if (interpolatedValue !== NO_CHANGE) {
|
14965 | const tView = getTView();
|
14966 | const tNode = getSelectedTNode();
|
14967 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
14968 | if (ngDevMode) {
|
14969 | const interpolationInBetween = [values[0]];
|
14970 | for (let i = 2; i < values.length; i += 2) {
|
14971 | interpolationInBetween.push(values[i]);
|
14972 | }
|
14973 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - interpolationInBetween.length + 1, ...interpolationInBetween);
|
14974 | }
|
14975 | }
|
14976 | return ɵɵpropertyInterpolateV;
|
14977 | }
|
14978 |
|
14979 |
|
14980 |
|
14981 |
|
14982 |
|
14983 |
|
14984 |
|
14985 |
|
14986 |
|
14987 |
|
14988 |
|
14989 |
|
14990 |
|
14991 |
|
14992 | const EMPTY_OBJ$1 = {};
|
14993 | const EMPTY_ARRAY$3 = [];
|
14994 |
|
14995 | if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
|
14996 |
|
14997 |
|
14998 |
|
14999 | Object.freeze(EMPTY_OBJ$1);
|
15000 |
|
15001 | Object.freeze(EMPTY_ARRAY$3);
|
15002 | }
|
15003 |
|
15004 |
|
15005 |
|
15006 |
|
15007 |
|
15008 |
|
15009 |
|
15010 |
|
15011 |
|
15012 |
|
15013 |
|
15014 |
|
15015 |
|
15016 |
|
15017 |
|
15018 |
|
15019 |
|
15020 |
|
15021 |
|
15022 |
|
15023 |
|
15024 |
|
15025 |
|
15026 |
|
15027 |
|
15028 |
|
15029 |
|
15030 |
|
15031 |
|
15032 |
|
15033 |
|
15034 |
|
15035 |
|
15036 |
|
15037 |
|
15038 |
|
15039 |
|
15040 |
|
15041 |
|
15042 |
|
15043 |
|
15044 |
|
15045 |
|
15046 |
|
15047 |
|
15048 |
|
15049 |
|
15050 |
|
15051 |
|
15052 |
|
15053 |
|
15054 |
|
15055 |
|
15056 |
|
15057 |
|
15058 |
|
15059 |
|
15060 |
|
15061 |
|
15062 |
|
15063 |
|
15064 |
|
15065 |
|
15066 |
|
15067 |
|
15068 |
|
15069 |
|
15070 |
|
15071 |
|
15072 |
|
15073 |
|
15074 |
|
15075 |
|
15076 |
|
15077 |
|
15078 |
|
15079 |
|
15080 |
|
15081 |
|
15082 |
|
15083 |
|
15084 |
|
15085 |
|
15086 |
|
15087 |
|
15088 |
|
15089 |
|
15090 |
|
15091 |
|
15092 |
|
15093 |
|
15094 |
|
15095 |
|
15096 |
|
15097 |
|
15098 |
|
15099 |
|
15100 |
|
15101 |
|
15102 |
|
15103 |
|
15104 |
|
15105 |
|
15106 |
|
15107 |
|
15108 |
|
15109 |
|
15110 |
|
15111 |
|
15112 |
|
15113 |
|
15114 |
|
15115 |
|
15116 |
|
15117 |
|
15118 |
|
15119 |
|
15120 |
|
15121 |
|
15122 |
|
15123 |
|
15124 |
|
15125 |
|
15126 |
|
15127 |
|
15128 |
|
15129 |
|
15130 |
|
15131 |
|
15132 |
|
15133 |
|
15134 |
|
15135 |
|
15136 |
|
15137 |
|
15138 |
|
15139 |
|
15140 |
|
15141 |
|
15142 |
|
15143 |
|
15144 |
|
15145 |
|
15146 |
|
15147 |
|
15148 |
|
15149 |
|
15150 |
|
15151 |
|
15152 |
|
15153 |
|
15154 |
|
15155 |
|
15156 |
|
15157 |
|
15158 |
|
15159 |
|
15160 |
|
15161 |
|
15162 |
|
15163 |
|
15164 | let __unused_const_as_closure_does_not_like_standalone_comment_blocks__;
|
15165 |
|
15166 |
|
15167 |
|
15168 |
|
15169 |
|
15170 |
|
15171 |
|
15172 |
|
15173 |
|
15174 |
|
15175 |
|
15176 |
|
15177 |
|
15178 |
|
15179 |
|
15180 |
|
15181 |
|
15182 |
|
15183 |
|
15184 |
|
15185 | function insertTStylingBinding(tData, tNode, tStylingKeyWithStatic, index, isHostBinding, isClassBinding) {
|
15186 | ngDevMode && assertFirstUpdatePass(getTView());
|
15187 | let tBindings = isClassBinding ? tNode.classBindings : tNode.styleBindings;
|
15188 | let tmplHead = getTStylingRangePrev(tBindings);
|
15189 | let tmplTail = getTStylingRangeNext(tBindings);
|
15190 | tData[index] = tStylingKeyWithStatic;
|
15191 | let isKeyDuplicateOfStatic = false;
|
15192 | let tStylingKey;
|
15193 | if (Array.isArray(tStylingKeyWithStatic)) {
|
15194 |
|
15195 | const staticKeyValueArray = tStylingKeyWithStatic;
|
15196 | tStylingKey = staticKeyValueArray[1];
|
15197 |
|
15198 | if (tStylingKey === null ||
|
15199 | keyValueArrayIndexOf(staticKeyValueArray, tStylingKey) > 0) {
|
15200 |
|
15201 | isKeyDuplicateOfStatic = true;
|
15202 | }
|
15203 | }
|
15204 | else {
|
15205 | tStylingKey = tStylingKeyWithStatic;
|
15206 | }
|
15207 | if (isHostBinding) {
|
15208 |
|
15209 |
|
15210 | const hasTemplateBindings = tmplTail !== 0;
|
15211 |
|
15212 |
|
15213 | if (hasTemplateBindings) {
|
15214 |
|
15215 | const previousNode = getTStylingRangePrev(tData[tmplHead + 1]);
|
15216 | tData[index + 1] = toTStylingRange(previousNode, tmplHead);
|
15217 |
|
15218 |
|
15219 | if (previousNode !== 0) {
|
15220 |
|
15221 | tData[previousNode + 1] =
|
15222 | setTStylingRangeNext(tData[previousNode + 1], index);
|
15223 | }
|
15224 |
|
15225 | tData[tmplHead + 1] = setTStylingRangePrev(tData[tmplHead + 1], index);
|
15226 | }
|
15227 | else {
|
15228 | tData[index + 1] = toTStylingRange(tmplHead, 0);
|
15229 |
|
15230 |
|
15231 | if (tmplHead !== 0) {
|
15232 |
|
15233 | tData[tmplHead + 1] = setTStylingRangeNext(tData[tmplHead + 1], index);
|
15234 | }
|
15235 |
|
15236 | tmplHead = index;
|
15237 | }
|
15238 | }
|
15239 | else {
|
15240 |
|
15241 |
|
15242 | tData[index + 1] = toTStylingRange(tmplTail, 0);
|
15243 | ngDevMode &&
|
15244 | assertEqual(tmplHead !== 0 && tmplTail === 0, false, 'Adding template bindings after hostBindings is not allowed.');
|
15245 | if (tmplHead === 0) {
|
15246 | tmplHead = index;
|
15247 | }
|
15248 | else {
|
15249 |
|
15250 | tData[tmplTail + 1] = setTStylingRangeNext(tData[tmplTail + 1], index);
|
15251 | }
|
15252 | tmplTail = index;
|
15253 | }
|
15254 |
|
15255 |
|
15256 | if (isKeyDuplicateOfStatic) {
|
15257 | tData[index + 1] = setTStylingRangePrevDuplicate(tData[index + 1]);
|
15258 | }
|
15259 | markDuplicates(tData, tStylingKey, index, true, isClassBinding);
|
15260 | markDuplicates(tData, tStylingKey, index, false, isClassBinding);
|
15261 | markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding);
|
15262 | tBindings = toTStylingRange(tmplHead, tmplTail);
|
15263 | if (isClassBinding) {
|
15264 | tNode.classBindings = tBindings;
|
15265 | }
|
15266 | else {
|
15267 | tNode.styleBindings = tBindings;
|
15268 | }
|
15269 | }
|
15270 |
|
15271 |
|
15272 |
|
15273 |
|
15274 |
|
15275 |
|
15276 |
|
15277 |
|
15278 |
|
15279 |
|
15280 | function markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding) {
|
15281 | const residual = isClassBinding ? tNode.residualClasses : tNode.residualStyles;
|
15282 | if (residual != null && typeof tStylingKey == 'string' &&
|
15283 | keyValueArrayIndexOf(residual, tStylingKey) >= 0) {
|
15284 |
|
15285 | tData[index + 1] = setTStylingRangeNextDuplicate(tData[index + 1]);
|
15286 | }
|
15287 | }
|
15288 |
|
15289 |
|
15290 |
|
15291 |
|
15292 |
|
15293 |
|
15294 |
|
15295 |
|
15296 |
|
15297 |
|
15298 |
|
15299 |
|
15300 |
|
15301 |
|
15302 |
|
15303 |
|
15304 |
|
15305 |
|
15306 |
|
15307 |
|
15308 |
|
15309 |
|
15310 |
|
15311 |
|
15312 |
|
15313 |
|
15314 |
|
15315 |
|
15316 |
|
15317 |
|
15318 |
|
15319 |
|
15320 |
|
15321 |
|
15322 |
|
15323 |
|
15324 |
|
15325 |
|
15326 |
|
15327 |
|
15328 |
|
15329 |
|
15330 |
|
15331 |
|
15332 |
|
15333 |
|
15334 |
|
15335 |
|
15336 |
|
15337 |
|
15338 |
|
15339 |
|
15340 |
|
15341 |
|
15342 |
|
15343 |
|
15344 | function markDuplicates(tData, tStylingKey, index, isPrevDir, isClassBinding) {
|
15345 | const tStylingAtIndex = tData[index + 1];
|
15346 | const isMap = tStylingKey === null;
|
15347 | let cursor = isPrevDir ? getTStylingRangePrev(tStylingAtIndex) : getTStylingRangeNext(tStylingAtIndex);
|
15348 | let foundDuplicate = false;
|
15349 |
|
15350 |
|
15351 |
|
15352 |
|
15353 |
|
15354 | while (cursor !== 0 && (foundDuplicate === false || isMap)) {
|
15355 | ngDevMode && assertIndexInRange(tData, cursor);
|
15356 | const tStylingValueAtCursor = tData[cursor];
|
15357 | const tStyleRangeAtCursor = tData[cursor + 1];
|
15358 | if (isStylingMatch(tStylingValueAtCursor, tStylingKey)) {
|
15359 | foundDuplicate = true;
|
15360 | tData[cursor + 1] = isPrevDir ? setTStylingRangeNextDuplicate(tStyleRangeAtCursor) :
|
15361 | setTStylingRangePrevDuplicate(tStyleRangeAtCursor);
|
15362 | }
|
15363 | cursor = isPrevDir ? getTStylingRangePrev(tStyleRangeAtCursor) :
|
15364 | getTStylingRangeNext(tStyleRangeAtCursor);
|
15365 | }
|
15366 | if (foundDuplicate) {
|
15367 |
|
15368 | tData[index + 1] = isPrevDir ? setTStylingRangePrevDuplicate(tStylingAtIndex) :
|
15369 | setTStylingRangeNextDuplicate(tStylingAtIndex);
|
15370 | }
|
15371 | }
|
15372 |
|
15373 |
|
15374 |
|
15375 |
|
15376 |
|
15377 |
|
15378 |
|
15379 |
|
15380 |
|
15381 |
|
15382 |
|
15383 |
|
15384 |
|
15385 |
|
15386 |
|
15387 |
|
15388 |
|
15389 |
|
15390 | function isStylingMatch(tStylingKeyCursor, tStylingKey) {
|
15391 | ngDevMode &&
|
15392 | assertNotEqual(Array.isArray(tStylingKey), true, 'Expected that \'tStylingKey\' has been unwrapped');
|
15393 | if (tStylingKeyCursor === null ||
|
15394 |
|
15395 | tStylingKey == null ||
|
15396 |
|
15397 | (Array.isArray(tStylingKeyCursor) ? tStylingKeyCursor[1] : tStylingKeyCursor) ===
|
15398 | tStylingKey
|
15399 | ) {
|
15400 | return true;
|
15401 | }
|
15402 | else if (Array.isArray(tStylingKeyCursor) && typeof tStylingKey === 'string') {
|
15403 |
|
15404 |
|
15405 | return keyValueArrayIndexOf(tStylingKeyCursor, tStylingKey) >=
|
15406 | 0;
|
15407 | }
|
15408 | return false;
|
15409 | }
|
15410 |
|
15411 |
|
15412 |
|
15413 |
|
15414 |
|
15415 |
|
15416 |
|
15417 |
|
15418 |
|
15419 | const parserState = {
|
15420 | textEnd: 0,
|
15421 | key: 0,
|
15422 | keyEnd: 0,
|
15423 | value: 0,
|
15424 | valueEnd: 0,
|
15425 | };
|
15426 |
|
15427 |
|
15428 |
|
15429 |
|
15430 | function getLastParsedKey(text) {
|
15431 | return text.substring(parserState.key, parserState.keyEnd);
|
15432 | }
|
15433 |
|
15434 |
|
15435 |
|
15436 |
|
15437 | function getLastParsedValue(text) {
|
15438 | return text.substring(parserState.value, parserState.valueEnd);
|
15439 | }
|
15440 |
|
15441 |
|
15442 |
|
15443 |
|
15444 |
|
15445 |
|
15446 |
|
15447 |
|
15448 |
|
15449 |
|
15450 |
|
15451 |
|
15452 |
|
15453 | function parseClassName(text) {
|
15454 | resetParserState(text);
|
15455 | return parseClassNameNext(text, consumeWhitespace(text, 0, parserState.textEnd));
|
15456 | }
|
15457 |
|
15458 |
|
15459 |
|
15460 |
|
15461 |
|
15462 |
|
15463 |
|
15464 |
|
15465 |
|
15466 |
|
15467 |
|
15468 |
|
15469 |
|
15470 |
|
15471 |
|
15472 | function parseClassNameNext(text, index) {
|
15473 | const end = parserState.textEnd;
|
15474 | if (end === index) {
|
15475 | return -1;
|
15476 | }
|
15477 | index = parserState.keyEnd = consumeClassToken(text, parserState.key = index, end);
|
15478 | return consumeWhitespace(text, index, end);
|
15479 | }
|
15480 |
|
15481 |
|
15482 |
|
15483 |
|
15484 |
|
15485 |
|
15486 |
|
15487 |
|
15488 |
|
15489 |
|
15490 |
|
15491 |
|
15492 |
|
15493 |
|
15494 | function parseStyle(text) {
|
15495 | resetParserState(text);
|
15496 | return parseStyleNext(text, consumeWhitespace(text, 0, parserState.textEnd));
|
15497 | }
|
15498 |
|
15499 |
|
15500 |
|
15501 |
|
15502 |
|
15503 |
|
15504 |
|
15505 |
|
15506 |
|
15507 |
|
15508 |
|
15509 |
|
15510 |
|
15511 |
|
15512 |
|
15513 | function parseStyleNext(text, startIndex) {
|
15514 | const end = parserState.textEnd;
|
15515 | let index = parserState.key = consumeWhitespace(text, startIndex, end);
|
15516 | if (end === index) {
|
15517 |
|
15518 | return -1;
|
15519 | }
|
15520 | index = parserState.keyEnd = consumeStyleKey(text, index, end);
|
15521 | index = consumeSeparator(text, index, end, 58 );
|
15522 | index = parserState.value = consumeWhitespace(text, index, end);
|
15523 | index = parserState.valueEnd = consumeStyleValue(text, index, end);
|
15524 | return consumeSeparator(text, index, end, 59 );
|
15525 | }
|
15526 |
|
15527 |
|
15528 |
|
15529 |
|
15530 | function resetParserState(text) {
|
15531 | parserState.key = 0;
|
15532 | parserState.keyEnd = 0;
|
15533 | parserState.value = 0;
|
15534 | parserState.valueEnd = 0;
|
15535 | parserState.textEnd = text.length;
|
15536 | }
|
15537 |
|
15538 |
|
15539 |
|
15540 |
|
15541 |
|
15542 |
|
15543 |
|
15544 |
|
15545 |
|
15546 | function consumeWhitespace(text, startIndex, endIndex) {
|
15547 | while (startIndex < endIndex && text.charCodeAt(startIndex) <= 32 ) {
|
15548 | startIndex++;
|
15549 | }
|
15550 | return startIndex;
|
15551 | }
|
15552 |
|
15553 |
|
15554 |
|
15555 |
|
15556 |
|
15557 |
|
15558 |
|
15559 |
|
15560 | function consumeClassToken(text, startIndex, endIndex) {
|
15561 | while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 ) {
|
15562 | startIndex++;
|
15563 | }
|
15564 | return startIndex;
|
15565 | }
|
15566 |
|
15567 |
|
15568 |
|
15569 |
|
15570 |
|
15571 |
|
15572 |
|
15573 |
|
15574 | function consumeStyleKey(text, startIndex, endIndex) {
|
15575 | let ch;
|
15576 | while (startIndex < endIndex &&
|
15577 | ((ch = text.charCodeAt(startIndex)) === 45 || ch === 95 ||
|
15578 | ((ch & -33 ) >= 65 && (ch & -33 ) <= 90 ) ||
|
15579 | (ch >= 48 && ch <= 57 ))) {
|
15580 | startIndex++;
|
15581 | }
|
15582 | return startIndex;
|
15583 | }
|
15584 |
|
15585 |
|
15586 |
|
15587 |
|
15588 |
|
15589 |
|
15590 |
|
15591 |
|
15592 | function consumeSeparator(text, startIndex, endIndex, separator) {
|
15593 | startIndex = consumeWhitespace(text, startIndex, endIndex);
|
15594 | if (startIndex < endIndex) {
|
15595 | if (ngDevMode && text.charCodeAt(startIndex) !== separator) {
|
15596 | malformedStyleError(text, String.fromCharCode(separator), startIndex);
|
15597 | }
|
15598 | startIndex++;
|
15599 | }
|
15600 | return startIndex;
|
15601 | }
|
15602 |
|
15603 |
|
15604 |
|
15605 |
|
15606 |
|
15607 |
|
15608 |
|
15609 |
|
15610 | function consumeStyleValue(text, startIndex, endIndex) {
|
15611 | let ch1 = -1;
|
15612 | let ch2 = -1;
|
15613 | let ch3 = -1;
|
15614 | let i = startIndex;
|
15615 | let lastChIndex = i;
|
15616 | while (i < endIndex) {
|
15617 | const ch = text.charCodeAt(i++);
|
15618 | if (ch === 59 ) {
|
15619 | return lastChIndex;
|
15620 | }
|
15621 | else if (ch === 34 || ch === 39 ) {
|
15622 | lastChIndex = i = consumeQuotedText(text, ch, i, endIndex);
|
15623 | }
|
15624 | else if (startIndex ===
|
15625 | i - 4 &&
|
15626 | ch3 === 85 &&
|
15627 | ch2 === 82 && ch1 === 76 && ch === 40 ) {
|
15628 | lastChIndex = i = consumeQuotedText(text, 41 , i, endIndex);
|
15629 | }
|
15630 | else if (ch > 32 ) {
|
15631 |
|
15632 | lastChIndex = i;
|
15633 | }
|
15634 | ch3 = ch2;
|
15635 | ch2 = ch1;
|
15636 | ch1 = ch & -33 ;
|
15637 | }
|
15638 | return lastChIndex;
|
15639 | }
|
15640 |
|
15641 |
|
15642 |
|
15643 |
|
15644 |
|
15645 |
|
15646 |
|
15647 |
|
15648 |
|
15649 | function consumeQuotedText(text, quoteCharCode, startIndex, endIndex) {
|
15650 | let ch1 = -1;
|
15651 | let index = startIndex;
|
15652 | while (index < endIndex) {
|
15653 | const ch = text.charCodeAt(index++);
|
15654 | if (ch == quoteCharCode && ch1 !== 92 ) {
|
15655 | return index;
|
15656 | }
|
15657 | if (ch == 92 && ch1 === 92 ) {
|
15658 |
|
15659 |
|
15660 | ch1 = 0;
|
15661 | }
|
15662 | else {
|
15663 | ch1 = ch;
|
15664 | }
|
15665 | }
|
15666 | throw ngDevMode ? malformedStyleError(text, String.fromCharCode(quoteCharCode), endIndex) :
|
15667 | new Error();
|
15668 | }
|
15669 | function malformedStyleError(text, expecting, index) {
|
15670 | ngDevMode && assertEqual(typeof text === 'string', true, 'String expected here');
|
15671 | throw throwError(`Malformed style at location ${index} in string '` + text.substring(0, index) + '[>>' +
|
15672 | text.substring(index, index + 1) + '<<]' + text.substr(index + 1) +
|
15673 | `'. Expecting '${expecting}'.`);
|
15674 | }
|
15675 |
|
15676 |
|
15677 |
|
15678 |
|
15679 |
|
15680 |
|
15681 |
|
15682 |
|
15683 |
|
15684 |
|
15685 |
|
15686 |
|
15687 |
|
15688 |
|
15689 |
|
15690 |
|
15691 |
|
15692 |
|
15693 |
|
15694 |
|
15695 |
|
15696 |
|
15697 |
|
15698 |
|
15699 |
|
15700 |
|
15701 |
|
15702 | function ɵɵstyleProp(prop, value, suffix) {
|
15703 | checkStylingProperty(prop, value, suffix, false);
|
15704 | return ɵɵstyleProp;
|
15705 | }
|
15706 |
|
15707 |
|
15708 |
|
15709 |
|
15710 |
|
15711 |
|
15712 |
|
15713 |
|
15714 |
|
15715 |
|
15716 |
|
15717 |
|
15718 |
|
15719 |
|
15720 |
|
15721 | function ɵɵclassProp(className, value) {
|
15722 | checkStylingProperty(className, value, null, true);
|
15723 | return ɵɵclassProp;
|
15724 | }
|
15725 |
|
15726 |
|
15727 |
|
15728 |
|
15729 |
|
15730 |
|
15731 |
|
15732 |
|
15733 |
|
15734 |
|
15735 |
|
15736 |
|
15737 |
|
15738 |
|
15739 |
|
15740 |
|
15741 |
|
15742 |
|
15743 |
|
15744 | function ɵɵstyleMap(styles) {
|
15745 | checkStylingMap(styleKeyValueArraySet, styleStringParser, styles, false);
|
15746 | }
|
15747 |
|
15748 |
|
15749 |
|
15750 |
|
15751 |
|
15752 |
|
15753 |
|
15754 |
|
15755 |
|
15756 | function styleStringParser(keyValueArray, text) {
|
15757 | for (let i = parseStyle(text); i >= 0; i = parseStyleNext(text, i)) {
|
15758 | styleKeyValueArraySet(keyValueArray, getLastParsedKey(text), getLastParsedValue(text));
|
15759 | }
|
15760 | }
|
15761 |
|
15762 |
|
15763 |
|
15764 |
|
15765 |
|
15766 |
|
15767 |
|
15768 |
|
15769 |
|
15770 |
|
15771 |
|
15772 |
|
15773 |
|
15774 |
|
15775 |
|
15776 |
|
15777 |
|
15778 |
|
15779 | function ɵɵclassMap(classes) {
|
15780 | checkStylingMap(keyValueArraySet, classStringParser, classes, true);
|
15781 | }
|
15782 |
|
15783 |
|
15784 |
|
15785 |
|
15786 |
|
15787 |
|
15788 |
|
15789 |
|
15790 |
|
15791 | function classStringParser(keyValueArray, text) {
|
15792 | for (let i = parseClassName(text); i >= 0; i = parseClassNameNext(text, i)) {
|
15793 | keyValueArraySet(keyValueArray, getLastParsedKey(text), true);
|
15794 | }
|
15795 | }
|
15796 |
|
15797 |
|
15798 |
|
15799 |
|
15800 |
|
15801 |
|
15802 |
|
15803 |
|
15804 | function checkStylingProperty(prop, value, suffix, isClassBased) {
|
15805 | const lView = getLView();
|
15806 | const tView = getTView();
|
15807 |
|
15808 |
|
15809 |
|
15810 | const bindingIndex = incrementBindingIndex(2);
|
15811 | if (tView.firstUpdatePass) {
|
15812 | stylingFirstUpdatePass(tView, prop, bindingIndex, isClassBased);
|
15813 | }
|
15814 | if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
|
15815 | const tNode = tView.data[getSelectedIndex() + HEADER_OFFSET];
|
15816 | updateStyling(tView, tNode, lView, lView[RENDERER], prop, lView[bindingIndex + 1] = normalizeSuffix(value, suffix), isClassBased, bindingIndex);
|
15817 | }
|
15818 | }
|
15819 |
|
15820 |
|
15821 |
|
15822 |
|
15823 |
|
15824 |
|
15825 |
|
15826 |
|
15827 |
|
15828 |
|
15829 | function checkStylingMap(keyValueArraySet, stringParser, value, isClassBased) {
|
15830 | const tView = getTView();
|
15831 | const bindingIndex = incrementBindingIndex(2);
|
15832 | if (tView.firstUpdatePass) {
|
15833 | stylingFirstUpdatePass(tView, null, bindingIndex, isClassBased);
|
15834 | }
|
15835 | const lView = getLView();
|
15836 | if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
|
15837 |
|
15838 |
|
15839 | const tNode = tView.data[getSelectedIndex() + HEADER_OFFSET];
|
15840 | if (hasStylingInputShadow(tNode, isClassBased) && !isInHostBindings(tView, bindingIndex)) {
|
15841 | if (ngDevMode) {
|
15842 |
|
15843 |
|
15844 | const tStylingKey = tView.data[bindingIndex];
|
15845 | assertEqual(Array.isArray(tStylingKey) ? tStylingKey[1] : tStylingKey, false, 'Styling linked list shadow input should be marked as \'false\'');
|
15846 | }
|
15847 |
|
15848 |
|
15849 |
|
15850 |
|
15851 |
|
15852 |
|
15853 |
|
15854 | let staticPrefix = isClassBased ? tNode.classesWithoutHost : tNode.stylesWithoutHost;
|
15855 | ngDevMode && isClassBased === false && staticPrefix !== null &&
|
15856 | assertEqual(staticPrefix.endsWith(';'), true, 'Expecting static portion to end with \';\'');
|
15857 | if (staticPrefix !== null) {
|
15858 |
|
15859 | value = concatStringsWithSpace(staticPrefix, value ? value : '');
|
15860 | }
|
15861 |
|
15862 |
|
15863 | setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased);
|
15864 | }
|
15865 | else {
|
15866 | updateStylingMap(tView, tNode, lView, lView[RENDERER], lView[bindingIndex + 1], lView[bindingIndex + 1] = toStylingKeyValueArray(keyValueArraySet, stringParser, value), isClassBased, bindingIndex);
|
15867 | }
|
15868 | }
|
15869 | }
|
15870 |
|
15871 |
|
15872 |
|
15873 |
|
15874 |
|
15875 |
|
15876 | function isInHostBindings(tView, bindingIndex) {
|
15877 |
|
15878 | return bindingIndex >= tView.expandoStartIndex;
|
15879 | }
|
15880 |
|
15881 |
|
15882 |
|
15883 |
|
15884 |
|
15885 |
|
15886 |
|
15887 |
|
15888 |
|
15889 | function stylingFirstUpdatePass(tView, tStylingKey, bindingIndex, isClassBased) {
|
15890 | ngDevMode && assertFirstUpdatePass(tView);
|
15891 | const tData = tView.data;
|
15892 | if (tData[bindingIndex + 1] === null) {
|
15893 |
|
15894 |
|
15895 |
|
15896 |
|
15897 |
|
15898 | const tNode = tData[getSelectedIndex() + HEADER_OFFSET];
|
15899 | const isHostBindings = isInHostBindings(tView, bindingIndex);
|
15900 | if (hasStylingInputShadow(tNode, isClassBased) && tStylingKey === null && !isHostBindings) {
|
15901 |
|
15902 |
|
15903 |
|
15904 |
|
15905 | tStylingKey = false;
|
15906 | }
|
15907 | tStylingKey = wrapInStaticStylingKey(tData, tNode, tStylingKey, isClassBased);
|
15908 | insertTStylingBinding(tData, tNode, tStylingKey, bindingIndex, isHostBindings, isClassBased);
|
15909 | }
|
15910 | }
|
15911 |
|
15912 |
|
15913 |
|
15914 |
|
15915 |
|
15916 |
|
15917 |
|
15918 |
|
15919 |
|
15920 |
|
15921 |
|
15922 |
|
15923 |
|
15924 |
|
15925 | function wrapInStaticStylingKey(tData, tNode, stylingKey, isClassBased) {
|
15926 | const hostDirectiveDef = getCurrentDirectiveDef(tData);
|
15927 | let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
|
15928 | if (hostDirectiveDef === null) {
|
15929 |
|
15930 |
|
15931 |
|
15932 |
|
15933 | const isFirstStylingInstructionInTemplate = (isClassBased ? tNode.classBindings : tNode.styleBindings) === 0;
|
15934 | if (isFirstStylingInstructionInTemplate) {
|
15935 |
|
15936 |
|
15937 |
|
15938 | stylingKey = collectStylingFromDirectives(null, tData, tNode, stylingKey, isClassBased);
|
15939 | stylingKey = collectStylingFromTAttrs(stylingKey, tNode.attrs, isClassBased);
|
15940 |
|
15941 | residual = null;
|
15942 | }
|
15943 | }
|
15944 | else {
|
15945 |
|
15946 |
|
15947 | const directiveStylingLast = tNode.directiveStylingLast;
|
15948 | const isFirstStylingInstructionInHostBinding = directiveStylingLast === -1 || tData[directiveStylingLast] !== hostDirectiveDef;
|
15949 | if (isFirstStylingInstructionInHostBinding) {
|
15950 | stylingKey =
|
15951 | collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased);
|
15952 | if (residual === null) {
|
15953 |
|
15954 |
|
15955 |
|
15956 |
|
15957 |
|
15958 |
|
15959 | let templateStylingKey = getTemplateHeadTStylingKey(tData, tNode, isClassBased);
|
15960 | if (templateStylingKey !== undefined && Array.isArray(templateStylingKey)) {
|
15961 |
|
15962 |
|
15963 |
|
15964 | templateStylingKey = collectStylingFromDirectives(null, tData, tNode, templateStylingKey[1] , isClassBased);
|
15965 | templateStylingKey =
|
15966 | collectStylingFromTAttrs(templateStylingKey, tNode.attrs, isClassBased);
|
15967 | setTemplateHeadTStylingKey(tData, tNode, isClassBased, templateStylingKey);
|
15968 | }
|
15969 | }
|
15970 | else {
|
15971 |
|
15972 |
|
15973 |
|
15974 |
|
15975 |
|
15976 | residual = collectResidual(tData, tNode, isClassBased);
|
15977 | }
|
15978 | }
|
15979 | }
|
15980 | if (residual !== undefined) {
|
15981 | isClassBased ? (tNode.residualClasses = residual) : (tNode.residualStyles = residual);
|
15982 | }
|
15983 | return stylingKey;
|
15984 | }
|
15985 |
|
15986 |
|
15987 |
|
15988 |
|
15989 |
|
15990 |
|
15991 |
|
15992 |
|
15993 |
|
15994 |
|
15995 |
|
15996 |
|
15997 |
|
15998 | function getTemplateHeadTStylingKey(tData, tNode, isClassBased) {
|
15999 | const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
|
16000 | if (getTStylingRangeNext(bindings) === 0) {
|
16001 |
|
16002 | return undefined;
|
16003 | }
|
16004 | return tData[getTStylingRangePrev(bindings)];
|
16005 | }
|
16006 |
|
16007 |
|
16008 |
|
16009 |
|
16010 |
|
16011 |
|
16012 |
|
16013 |
|
16014 |
|
16015 |
|
16016 |
|
16017 |
|
16018 |
|
16019 |
|
16020 |
|
16021 |
|
16022 |
|
16023 |
|
16024 |
|
16025 |
|
16026 |
|
16027 |
|
16028 |
|
16029 |
|
16030 |
|
16031 |
|
16032 |
|
16033 |
|
16034 |
|
16035 |
|
16036 |
|
16037 |
|
16038 |
|
16039 |
|
16040 |
|
16041 |
|
16042 |
|
16043 |
|
16044 |
|
16045 |
|
16046 |
|
16047 |
|
16048 |
|
16049 |
|
16050 |
|
16051 |
|
16052 |
|
16053 |
|
16054 |
|
16055 |
|
16056 |
|
16057 |
|
16058 | function setTemplateHeadTStylingKey(tData, tNode, isClassBased, tStylingKey) {
|
16059 | const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
|
16060 | ngDevMode &&
|
16061 | assertNotEqual(getTStylingRangeNext(bindings), 0, 'Expecting to have at least one template styling binding.');
|
16062 | tData[getTStylingRangePrev(bindings)] = tStylingKey;
|
16063 | }
|
16064 |
|
16065 |
|
16066 |
|
16067 |
|
16068 |
|
16069 |
|
16070 |
|
16071 |
|
16072 |
|
16073 |
|
16074 | function collectResidual(tData, tNode, isClassBased) {
|
16075 | let residual = undefined;
|
16076 | const directiveEnd = tNode.directiveEnd;
|
16077 | ngDevMode &&
|
16078 | assertNotEqual(tNode.directiveStylingLast, -1, 'By the time this function gets called at least one hostBindings-node styling instruction must have executed.');
|
16079 |
|
16080 |
|
16081 | for (let i = 1 + tNode.directiveStylingLast; i < directiveEnd; i++) {
|
16082 | const attrs = tData[i].hostAttrs;
|
16083 | residual = collectStylingFromTAttrs(residual, attrs, isClassBased);
|
16084 | }
|
16085 | return collectStylingFromTAttrs(residual, tNode.attrs, isClassBased);
|
16086 | }
|
16087 |
|
16088 |
|
16089 |
|
16090 |
|
16091 |
|
16092 |
|
16093 |
|
16094 |
|
16095 |
|
16096 |
|
16097 |
|
16098 |
|
16099 | function collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased) {
|
16100 |
|
16101 |
|
16102 | let currentDirective = null;
|
16103 | const directiveEnd = tNode.directiveEnd;
|
16104 | let directiveStylingLast = tNode.directiveStylingLast;
|
16105 | if (directiveStylingLast === -1) {
|
16106 | directiveStylingLast = tNode.directiveStart;
|
16107 | }
|
16108 | else {
|
16109 | directiveStylingLast++;
|
16110 | }
|
16111 | while (directiveStylingLast < directiveEnd) {
|
16112 | currentDirective = tData[directiveStylingLast];
|
16113 | ngDevMode && assertDefined(currentDirective, 'expected to be defined');
|
16114 | stylingKey = collectStylingFromTAttrs(stylingKey, currentDirective.hostAttrs, isClassBased);
|
16115 | if (currentDirective === hostDirectiveDef)
|
16116 | break;
|
16117 | directiveStylingLast++;
|
16118 | }
|
16119 | if (hostDirectiveDef !== null) {
|
16120 |
|
16121 |
|
16122 |
|
16123 | tNode.directiveStylingLast = directiveStylingLast;
|
16124 | }
|
16125 | return stylingKey;
|
16126 | }
|
16127 |
|
16128 |
|
16129 |
|
16130 |
|
16131 |
|
16132 |
|
16133 |
|
16134 | function collectStylingFromTAttrs(stylingKey, attrs, isClassBased) {
|
16135 | const desiredMarker = isClassBased ? 1 : 2 ;
|
16136 | let currentMarker = -1 ;
|
16137 | if (attrs !== null) {
|
16138 | for (let i = 0; i < attrs.length; i++) {
|
16139 | const item = attrs[i];
|
16140 | if (typeof item === 'number') {
|
16141 | currentMarker = item;
|
16142 | }
|
16143 | else {
|
16144 | if (currentMarker === desiredMarker) {
|
16145 | if (!Array.isArray(stylingKey)) {
|
16146 | stylingKey = stylingKey === undefined ? [] : ['', stylingKey];
|
16147 | }
|
16148 | keyValueArraySet(stylingKey, item, isClassBased ? true : attrs[++i]);
|
16149 | }
|
16150 | }
|
16151 | }
|
16152 | }
|
16153 | return stylingKey === undefined ? null : stylingKey;
|
16154 | }
|
16155 |
|
16156 |
|
16157 |
|
16158 |
|
16159 |
|
16160 |
|
16161 |
|
16162 |
|
16163 |
|
16164 |
|
16165 |
|
16166 |
|
16167 |
|
16168 |
|
16169 |
|
16170 |
|
16171 |
|
16172 |
|
16173 |
|
16174 |
|
16175 |
|
16176 |
|
16177 |
|
16178 |
|
16179 |
|
16180 |
|
16181 |
|
16182 |
|
16183 | function toStylingKeyValueArray(keyValueArraySet, stringParser, value) {
|
16184 | if (value == null || value === '')
|
16185 | return EMPTY_ARRAY$3;
|
16186 | const styleKeyValueArray = [];
|
16187 | const unwrappedValue = unwrapSafeValue(value);
|
16188 | if (Array.isArray(unwrappedValue)) {
|
16189 | for (let i = 0; i < unwrappedValue.length; i++) {
|
16190 | keyValueArraySet(styleKeyValueArray, unwrappedValue[i], true);
|
16191 | }
|
16192 | }
|
16193 | else if (typeof unwrappedValue === 'object') {
|
16194 | for (const key in unwrappedValue) {
|
16195 | if (unwrappedValue.hasOwnProperty(key)) {
|
16196 | keyValueArraySet(styleKeyValueArray, key, unwrappedValue[key]);
|
16197 | }
|
16198 | }
|
16199 | }
|
16200 | else if (typeof unwrappedValue === 'string') {
|
16201 | stringParser(styleKeyValueArray, unwrappedValue);
|
16202 | }
|
16203 | else {
|
16204 | ngDevMode &&
|
16205 | throwError('Unsupported styling type ' + typeof unwrappedValue + ': ' + unwrappedValue);
|
16206 | }
|
16207 | return styleKeyValueArray;
|
16208 | }
|
16209 |
|
16210 |
|
16211 |
|
16212 |
|
16213 |
|
16214 |
|
16215 |
|
16216 |
|
16217 |
|
16218 | function styleKeyValueArraySet(keyValueArray, key, value) {
|
16219 | keyValueArraySet(keyValueArray, key, unwrapSafeValue(value));
|
16220 | }
|
16221 |
|
16222 |
|
16223 |
|
16224 |
|
16225 |
|
16226 |
|
16227 |
|
16228 |
|
16229 |
|
16230 |
|
16231 |
|
16232 |
|
16233 |
|
16234 |
|
16235 |
|
16236 |
|
16237 |
|
16238 |
|
16239 | function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {
|
16240 | if (oldKeyValueArray === NO_CHANGE) {
|
16241 |
|
16242 | oldKeyValueArray = EMPTY_ARRAY$3;
|
16243 | }
|
16244 | let oldIndex = 0;
|
16245 | let newIndex = 0;
|
16246 | let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;
|
16247 | let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;
|
16248 | while (oldKey !== null || newKey !== null) {
|
16249 | ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');
|
16250 | ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');
|
16251 | const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;
|
16252 | const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;
|
16253 | let setKey = null;
|
16254 | let setValue = undefined;
|
16255 | if (oldKey === newKey) {
|
16256 |
|
16257 | oldIndex += 2;
|
16258 | newIndex += 2;
|
16259 | if (oldValue !== newValue) {
|
16260 | setKey = newKey;
|
16261 | setValue = newValue;
|
16262 | }
|
16263 | }
|
16264 | else if (newKey === null || oldKey !== null && oldKey < newKey) {
|
16265 |
|
16266 |
|
16267 |
|
16268 |
|
16269 | oldIndex += 2;
|
16270 | setKey = oldKey;
|
16271 | }
|
16272 | else {
|
16273 |
|
16274 |
|
16275 |
|
16276 | ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');
|
16277 | newIndex += 2;
|
16278 | setKey = newKey;
|
16279 | setValue = newValue;
|
16280 | }
|
16281 | if (setKey !== null) {
|
16282 | updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);
|
16283 | }
|
16284 | oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;
|
16285 | newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;
|
16286 | }
|
16287 | }
|
16288 |
|
16289 |
|
16290 |
|
16291 |
|
16292 |
|
16293 |
|
16294 |
|
16295 |
|
16296 |
|
16297 |
|
16298 |
|
16299 |
|
16300 |
|
16301 |
|
16302 |
|
16303 |
|
16304 |
|
16305 | function updateStyling(tView, tNode, lView, renderer, prop, value, isClassBased, bindingIndex) {
|
16306 | if (tNode.type !== 3 ) {
|
16307 |
|
16308 |
|
16309 | return;
|
16310 | }
|
16311 | const tData = tView.data;
|
16312 | const tRange = tData[bindingIndex + 1];
|
16313 | const higherPriorityValue = getTStylingRangeNextDuplicate(tRange) ?
|
16314 | findStylingValue(tData, tNode, lView, prop, getTStylingRangeNext(tRange), isClassBased) :
|
16315 | undefined;
|
16316 | if (!isStylingValuePresent(higherPriorityValue)) {
|
16317 |
|
16318 | if (!isStylingValuePresent(value)) {
|
16319 |
|
16320 | if (getTStylingRangePrevDuplicate(tRange)) {
|
16321 |
|
16322 | value = findStylingValue(tData, null, lView, prop, bindingIndex, isClassBased);
|
16323 | }
|
16324 | }
|
16325 | const rNode = getNativeByIndex(getSelectedIndex(), lView);
|
16326 | applyStyling(renderer, isClassBased, rNode, prop, value);
|
16327 | }
|
16328 | }
|
16329 |
|
16330 |
|
16331 |
|
16332 |
|
16333 |
|
16334 |
|
16335 |
|
16336 |
|
16337 |
|
16338 |
|
16339 |
|
16340 |
|
16341 |
|
16342 |
|
16343 |
|
16344 |
|
16345 |
|
16346 |
|
16347 |
|
16348 |
|
16349 |
|
16350 |
|
16351 |
|
16352 |
|
16353 |
|
16354 |
|
16355 |
|
16356 |
|
16357 | function findStylingValue(tData, tNode, lView, prop, index, isClassBased) {
|
16358 |
|
16359 |
|
16360 |
|
16361 |
|
16362 |
|
16363 | const isPrevDirection = tNode === null;
|
16364 | let value = undefined;
|
16365 | while (index > 0) {
|
16366 | const rawKey = tData[index];
|
16367 | const containsStatics = Array.isArray(rawKey);
|
16368 |
|
16369 | const key = containsStatics ? rawKey[1] : rawKey;
|
16370 | const isStylingMap = key === null;
|
16371 | let valueAtLViewIndex = lView[index + 1];
|
16372 | if (valueAtLViewIndex === NO_CHANGE) {
|
16373 |
|
16374 |
|
16375 |
|
16376 |
|
16377 |
|
16378 |
|
16379 |
|
16380 | valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY$3 : undefined;
|
16381 | }
|
16382 | let currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) :
|
16383 | key === prop ? valueAtLViewIndex : undefined;
|
16384 | if (containsStatics && !isStylingValuePresent(currentValue)) {
|
16385 | currentValue = keyValueArrayGet(rawKey, prop);
|
16386 | }
|
16387 | if (isStylingValuePresent(currentValue)) {
|
16388 | value = currentValue;
|
16389 | if (isPrevDirection) {
|
16390 | return value;
|
16391 | }
|
16392 | }
|
16393 | const tRange = tData[index + 1];
|
16394 | index = isPrevDirection ? getTStylingRangePrev(tRange) : getTStylingRangeNext(tRange);
|
16395 | }
|
16396 | if (tNode !== null) {
|
16397 |
|
16398 |
|
16399 | let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
|
16400 | if (residual != null ) {
|
16401 | value = keyValueArrayGet(residual, prop);
|
16402 | }
|
16403 | }
|
16404 | return value;
|
16405 | }
|
16406 |
|
16407 |
|
16408 |
|
16409 |
|
16410 |
|
16411 |
|
16412 | function isStylingValuePresent(value) {
|
16413 |
|
16414 |
|
16415 |
|
16416 |
|
16417 | return value !== undefined;
|
16418 | }
|
16419 |
|
16420 |
|
16421 |
|
16422 |
|
16423 |
|
16424 |
|
16425 |
|
16426 | function normalizeSuffix(value, suffix) {
|
16427 | if (value == null ) {
|
16428 |
|
16429 | }
|
16430 | else if (typeof suffix === 'string') {
|
16431 | value = value + suffix;
|
16432 | }
|
16433 | else if (typeof value === 'object') {
|
16434 | value = stringify(unwrapSafeValue(value));
|
16435 | }
|
16436 | return value;
|
16437 | }
|
16438 |
|
16439 |
|
16440 |
|
16441 |
|
16442 |
|
16443 |
|
16444 |
|
16445 |
|
16446 |
|
16447 | function hasStylingInputShadow(tNode, isClassBased) {
|
16448 | return (tNode.flags & (isClassBased ? 16 : 32 )) !== 0;
|
16449 | }
|
16450 |
|
16451 |
|
16452 |
|
16453 |
|
16454 |
|
16455 |
|
16456 |
|
16457 |
|
16458 |
|
16459 |
|
16460 |
|
16461 |
|
16462 |
|
16463 |
|
16464 |
|
16465 |
|
16466 | function ɵɵtext(index, value = '') {
|
16467 | const lView = getLView();
|
16468 | const tView = getTView();
|
16469 | const adjustedIndex = index + HEADER_OFFSET;
|
16470 | ngDevMode &&
|
16471 | assertEqual(getBindingIndex(), tView.bindingStartIndex, 'text nodes should be created before any bindings');
|
16472 | ngDevMode && assertIndexInRange(lView, adjustedIndex);
|
16473 | const tNode = tView.firstCreatePass ?
|
16474 | getOrCreateTNode(tView, lView[T_HOST], index, 3 , null, null) :
|
16475 | tView.data[adjustedIndex];
|
16476 | const textNative = lView[adjustedIndex] = createTextNode(value, lView[RENDERER]);
|
16477 | appendChild(tView, lView, textNative, tNode);
|
16478 |
|
16479 | setPreviousOrParentTNode(tNode, false);
|
16480 | }
|
16481 |
|
16482 |
|
16483 |
|
16484 |
|
16485 |
|
16486 |
|
16487 |
|
16488 |
|
16489 |
|
16490 |
|
16491 |
|
16492 |
|
16493 |
|
16494 |
|
16495 |
|
16496 |
|
16497 |
|
16498 |
|
16499 |
|
16500 |
|
16501 |
|
16502 |
|
16503 |
|
16504 |
|
16505 |
|
16506 |
|
16507 |
|
16508 |
|
16509 | function ɵɵtextInterpolate(v0) {
|
16510 | ɵɵtextInterpolate1('', v0, '');
|
16511 | return ɵɵtextInterpolate;
|
16512 | }
|
16513 |
|
16514 |
|
16515 |
|
16516 |
|
16517 |
|
16518 |
|
16519 |
|
16520 |
|
16521 |
|
16522 |
|
16523 |
|
16524 |
|
16525 |
|
16526 |
|
16527 |
|
16528 |
|
16529 |
|
16530 |
|
16531 |
|
16532 | function ɵɵtextInterpolate1(prefix, v0, suffix) {
|
16533 | const lView = getLView();
|
16534 | const interpolated = interpolation1(lView, prefix, v0, suffix);
|
16535 | if (interpolated !== NO_CHANGE) {
|
16536 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
16537 | }
|
16538 | return ɵɵtextInterpolate1;
|
16539 | }
|
16540 |
|
16541 |
|
16542 |
|
16543 |
|
16544 |
|
16545 |
|
16546 |
|
16547 |
|
16548 |
|
16549 |
|
16550 |
|
16551 |
|
16552 |
|
16553 |
|
16554 |
|
16555 |
|
16556 |
|
16557 |
|
16558 |
|
16559 | function ɵɵtextInterpolate2(prefix, v0, i0, v1, suffix) {
|
16560 | const lView = getLView();
|
16561 | const interpolated = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
16562 | if (interpolated !== NO_CHANGE) {
|
16563 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
16564 | }
|
16565 | return ɵɵtextInterpolate2;
|
16566 | }
|
16567 |
|
16568 |
|
16569 |
|
16570 |
|
16571 |
|
16572 |
|
16573 |
|
16574 |
|
16575 |
|
16576 |
|
16577 |
|
16578 |
|
16579 |
|
16580 |
|
16581 |
|
16582 |
|
16583 |
|
16584 |
|
16585 |
|
16586 |
|
16587 | function ɵɵtextInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
|
16588 | const lView = getLView();
|
16589 | const interpolated = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
16590 | if (interpolated !== NO_CHANGE) {
|
16591 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
16592 | }
|
16593 | return ɵɵtextInterpolate3;
|
16594 | }
|
16595 |
|
16596 |
|
16597 |
|
16598 |
|
16599 |
|
16600 |
|
16601 |
|
16602 |
|
16603 |
|
16604 |
|
16605 |
|
16606 |
|
16607 |
|
16608 |
|
16609 |
|
16610 |
|
16611 |
|
16612 |
|
16613 |
|
16614 |
|
16615 | function ɵɵtextInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
|
16616 | const lView = getLView();
|
16617 | const interpolated = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
16618 | if (interpolated !== NO_CHANGE) {
|
16619 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
16620 | }
|
16621 | return ɵɵtextInterpolate4;
|
16622 | }
|
16623 |
|
16624 |
|
16625 |
|
16626 |
|
16627 |
|
16628 |
|
16629 |
|
16630 |
|
16631 |
|
16632 |
|
16633 |
|
16634 |
|
16635 |
|
16636 |
|
16637 |
|
16638 |
|
16639 |
|
16640 |
|
16641 |
|
16642 |
|
16643 | function ɵɵtextInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
|
16644 | const lView = getLView();
|
16645 | const interpolated = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
16646 | if (interpolated !== NO_CHANGE) {
|
16647 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
16648 | }
|
16649 | return ɵɵtextInterpolate5;
|
16650 | }
|
16651 |
|
16652 |
|
16653 |
|
16654 |
|
16655 |
|
16656 |
|
16657 |
|
16658 |
|
16659 |
|
16660 |
|
16661 |
|
16662 |
|
16663 |
|
16664 |
|
16665 |
|
16666 |
|
16667 |
|
16668 |
|
16669 |
|
16670 |
|
16671 |
|
16672 |
|
16673 | function ɵɵtextInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
|
16674 | const lView = getLView();
|
16675 | const interpolated = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
16676 | if (interpolated !== NO_CHANGE) {
|
16677 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
16678 | }
|
16679 | return ɵɵtextInterpolate6;
|
16680 | }
|
16681 |
|
16682 |
|
16683 |
|
16684 |
|
16685 |
|
16686 |
|
16687 |
|
16688 |
|
16689 |
|
16690 |
|
16691 |
|
16692 |
|
16693 |
|
16694 |
|
16695 |
|
16696 |
|
16697 |
|
16698 |
|
16699 |
|
16700 |
|
16701 | function ɵɵtextInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
|
16702 | const lView = getLView();
|
16703 | const interpolated = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
16704 | if (interpolated !== NO_CHANGE) {
|
16705 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
16706 | }
|
16707 | return ɵɵtextInterpolate7;
|
16708 | }
|
16709 |
|
16710 |
|
16711 |
|
16712 |
|
16713 |
|
16714 |
|
16715 |
|
16716 |
|
16717 |
|
16718 |
|
16719 |
|
16720 |
|
16721 |
|
16722 |
|
16723 |
|
16724 |
|
16725 |
|
16726 |
|
16727 |
|
16728 |
|
16729 | function ɵɵtextInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
|
16730 | const lView = getLView();
|
16731 | const interpolated = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
16732 | if (interpolated !== NO_CHANGE) {
|
16733 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
16734 | }
|
16735 | return ɵɵtextInterpolate8;
|
16736 | }
|
16737 |
|
16738 |
|
16739 |
|
16740 |
|
16741 |
|
16742 |
|
16743 |
|
16744 |
|
16745 |
|
16746 |
|
16747 |
|
16748 |
|
16749 |
|
16750 |
|
16751 |
|
16752 |
|
16753 |
|
16754 |
|
16755 |
|
16756 |
|
16757 |
|
16758 |
|
16759 |
|
16760 |
|
16761 | function ɵɵtextInterpolateV(values) {
|
16762 | const lView = getLView();
|
16763 | const interpolated = interpolationV(lView, values);
|
16764 | if (interpolated !== NO_CHANGE) {
|
16765 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
16766 | }
|
16767 | return ɵɵtextInterpolateV;
|
16768 | }
|
16769 |
|
16770 |
|
16771 |
|
16772 |
|
16773 |
|
16774 |
|
16775 |
|
16776 |
|
16777 |
|
16778 |
|
16779 |
|
16780 |
|
16781 |
|
16782 |
|
16783 |
|
16784 |
|
16785 |
|
16786 |
|
16787 |
|
16788 |
|
16789 |
|
16790 |
|
16791 |
|
16792 |
|
16793 |
|
16794 |
|
16795 |
|
16796 |
|
16797 |
|
16798 | function ɵɵclassMapInterpolate1(prefix, v0, suffix) {
|
16799 | const lView = getLView();
|
16800 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
16801 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
16802 | }
|
16803 |
|
16804 |
|
16805 |
|
16806 |
|
16807 |
|
16808 |
|
16809 |
|
16810 |
|
16811 |
|
16812 |
|
16813 |
|
16814 |
|
16815 |
|
16816 |
|
16817 |
|
16818 |
|
16819 |
|
16820 |
|
16821 |
|
16822 |
|
16823 |
|
16824 |
|
16825 |
|
16826 | function ɵɵclassMapInterpolate2(prefix, v0, i0, v1, suffix) {
|
16827 | const lView = getLView();
|
16828 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
16829 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
16830 | }
|
16831 |
|
16832 |
|
16833 |
|
16834 |
|
16835 |
|
16836 |
|
16837 |
|
16838 |
|
16839 |
|
16840 |
|
16841 |
|
16842 |
|
16843 |
|
16844 |
|
16845 |
|
16846 |
|
16847 |
|
16848 |
|
16849 |
|
16850 |
|
16851 |
|
16852 |
|
16853 |
|
16854 |
|
16855 |
|
16856 |
|
16857 | function ɵɵclassMapInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
|
16858 | const lView = getLView();
|
16859 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
16860 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
16861 | }
|
16862 |
|
16863 |
|
16864 |
|
16865 |
|
16866 |
|
16867 |
|
16868 |
|
16869 |
|
16870 |
|
16871 |
|
16872 |
|
16873 |
|
16874 |
|
16875 |
|
16876 |
|
16877 |
|
16878 |
|
16879 |
|
16880 |
|
16881 |
|
16882 |
|
16883 |
|
16884 |
|
16885 |
|
16886 |
|
16887 |
|
16888 |
|
16889 |
|
16890 | function ɵɵclassMapInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
|
16891 | const lView = getLView();
|
16892 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
16893 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
16894 | }
|
16895 |
|
16896 |
|
16897 |
|
16898 |
|
16899 |
|
16900 |
|
16901 |
|
16902 |
|
16903 |
|
16904 |
|
16905 |
|
16906 |
|
16907 |
|
16908 |
|
16909 |
|
16910 |
|
16911 |
|
16912 |
|
16913 |
|
16914 |
|
16915 |
|
16916 |
|
16917 |
|
16918 |
|
16919 |
|
16920 |
|
16921 |
|
16922 |
|
16923 |
|
16924 |
|
16925 | function ɵɵclassMapInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
|
16926 | const lView = getLView();
|
16927 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
16928 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
16929 | }
|
16930 |
|
16931 |
|
16932 |
|
16933 |
|
16934 |
|
16935 |
|
16936 |
|
16937 |
|
16938 |
|
16939 |
|
16940 |
|
16941 |
|
16942 |
|
16943 |
|
16944 |
|
16945 |
|
16946 |
|
16947 |
|
16948 |
|
16949 |
|
16950 |
|
16951 |
|
16952 |
|
16953 |
|
16954 |
|
16955 |
|
16956 |
|
16957 |
|
16958 |
|
16959 |
|
16960 |
|
16961 |
|
16962 | function ɵɵclassMapInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
|
16963 | const lView = getLView();
|
16964 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
16965 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
16966 | }
|
16967 |
|
16968 |
|
16969 |
|
16970 |
|
16971 |
|
16972 |
|
16973 |
|
16974 |
|
16975 |
|
16976 |
|
16977 |
|
16978 |
|
16979 |
|
16980 |
|
16981 |
|
16982 |
|
16983 |
|
16984 |
|
16985 |
|
16986 |
|
16987 |
|
16988 |
|
16989 |
|
16990 |
|
16991 |
|
16992 |
|
16993 |
|
16994 |
|
16995 |
|
16996 |
|
16997 |
|
16998 |
|
16999 |
|
17000 |
|
17001 | function ɵɵclassMapInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
|
17002 | const lView = getLView();
|
17003 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
17004 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17005 | }
|
17006 |
|
17007 |
|
17008 |
|
17009 |
|
17010 |
|
17011 |
|
17012 |
|
17013 |
|
17014 |
|
17015 |
|
17016 |
|
17017 |
|
17018 |
|
17019 |
|
17020 |
|
17021 |
|
17022 |
|
17023 |
|
17024 |
|
17025 |
|
17026 |
|
17027 |
|
17028 |
|
17029 |
|
17030 |
|
17031 |
|
17032 |
|
17033 |
|
17034 |
|
17035 |
|
17036 |
|
17037 |
|
17038 |
|
17039 |
|
17040 |
|
17041 |
|
17042 | function ɵɵclassMapInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
|
17043 | const lView = getLView();
|
17044 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
17045 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17046 | }
|
17047 |
|
17048 |
|
17049 |
|
17050 |
|
17051 |
|
17052 |
|
17053 |
|
17054 |
|
17055 |
|
17056 |
|
17057 |
|
17058 |
|
17059 |
|
17060 |
|
17061 |
|
17062 |
|
17063 |
|
17064 |
|
17065 |
|
17066 |
|
17067 |
|
17068 |
|
17069 |
|
17070 | function ɵɵclassMapInterpolateV(values) {
|
17071 | const lView = getLView();
|
17072 | const interpolatedValue = interpolationV(lView, values);
|
17073 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17074 | }
|
17075 |
|
17076 |
|
17077 |
|
17078 |
|
17079 |
|
17080 |
|
17081 |
|
17082 |
|
17083 |
|
17084 |
|
17085 |
|
17086 |
|
17087 |
|
17088 |
|
17089 |
|
17090 |
|
17091 |
|
17092 |
|
17093 |
|
17094 |
|
17095 |
|
17096 |
|
17097 |
|
17098 |
|
17099 |
|
17100 |
|
17101 |
|
17102 |
|
17103 |
|
17104 | function ɵɵstyleMapInterpolate1(prefix, v0, suffix) {
|
17105 | const lView = getLView();
|
17106 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
17107 | ɵɵstyleMap(interpolatedValue);
|
17108 | }
|
17109 |
|
17110 |
|
17111 |
|
17112 |
|
17113 |
|
17114 |
|
17115 |
|
17116 |
|
17117 |
|
17118 |
|
17119 |
|
17120 |
|
17121 |
|
17122 |
|
17123 |
|
17124 |
|
17125 |
|
17126 |
|
17127 |
|
17128 |
|
17129 |
|
17130 |
|
17131 |
|
17132 | function ɵɵstyleMapInterpolate2(prefix, v0, i0, v1, suffix) {
|
17133 | const lView = getLView();
|
17134 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
17135 | ɵɵstyleMap(interpolatedValue);
|
17136 | }
|
17137 |
|
17138 |
|
17139 |
|
17140 |
|
17141 |
|
17142 |
|
17143 |
|
17144 |
|
17145 |
|
17146 |
|
17147 |
|
17148 |
|
17149 |
|
17150 |
|
17151 |
|
17152 |
|
17153 |
|
17154 |
|
17155 |
|
17156 |
|
17157 |
|
17158 |
|
17159 |
|
17160 |
|
17161 |
|
17162 |
|
17163 | function ɵɵstyleMapInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
|
17164 | const lView = getLView();
|
17165 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
17166 | ɵɵstyleMap(interpolatedValue);
|
17167 | }
|
17168 |
|
17169 |
|
17170 |
|
17171 |
|
17172 |
|
17173 |
|
17174 |
|
17175 |
|
17176 |
|
17177 |
|
17178 |
|
17179 |
|
17180 |
|
17181 |
|
17182 |
|
17183 |
|
17184 |
|
17185 |
|
17186 |
|
17187 |
|
17188 |
|
17189 |
|
17190 |
|
17191 |
|
17192 |
|
17193 |
|
17194 |
|
17195 |
|
17196 | function ɵɵstyleMapInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
|
17197 | const lView = getLView();
|
17198 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
17199 | ɵɵstyleMap(interpolatedValue);
|
17200 | }
|
17201 |
|
17202 |
|
17203 |
|
17204 |
|
17205 |
|
17206 |
|
17207 |
|
17208 |
|
17209 |
|
17210 |
|
17211 |
|
17212 |
|
17213 |
|
17214 |
|
17215 |
|
17216 |
|
17217 |
|
17218 |
|
17219 |
|
17220 |
|
17221 |
|
17222 |
|
17223 |
|
17224 |
|
17225 |
|
17226 |
|
17227 |
|
17228 |
|
17229 |
|
17230 |
|
17231 | function ɵɵstyleMapInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
|
17232 | const lView = getLView();
|
17233 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
17234 | ɵɵstyleMap(interpolatedValue);
|
17235 | }
|
17236 |
|
17237 |
|
17238 |
|
17239 |
|
17240 |
|
17241 |
|
17242 |
|
17243 |
|
17244 |
|
17245 |
|
17246 |
|
17247 |
|
17248 |
|
17249 |
|
17250 |
|
17251 |
|
17252 |
|
17253 |
|
17254 |
|
17255 |
|
17256 |
|
17257 |
|
17258 |
|
17259 |
|
17260 |
|
17261 |
|
17262 |
|
17263 |
|
17264 |
|
17265 |
|
17266 |
|
17267 |
|
17268 |
|
17269 |
|
17270 | function ɵɵstyleMapInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
|
17271 | const lView = getLView();
|
17272 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
17273 | ɵɵstyleMap(interpolatedValue);
|
17274 | }
|
17275 |
|
17276 |
|
17277 |
|
17278 |
|
17279 |
|
17280 |
|
17281 |
|
17282 |
|
17283 |
|
17284 |
|
17285 |
|
17286 |
|
17287 |
|
17288 |
|
17289 |
|
17290 |
|
17291 |
|
17292 |
|
17293 |
|
17294 |
|
17295 |
|
17296 |
|
17297 |
|
17298 |
|
17299 |
|
17300 |
|
17301 |
|
17302 |
|
17303 |
|
17304 |
|
17305 |
|
17306 |
|
17307 |
|
17308 |
|
17309 |
|
17310 |
|
17311 | function ɵɵstyleMapInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
|
17312 | const lView = getLView();
|
17313 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
17314 | ɵɵstyleMap(interpolatedValue);
|
17315 | }
|
17316 |
|
17317 |
|
17318 |
|
17319 |
|
17320 |
|
17321 |
|
17322 |
|
17323 |
|
17324 |
|
17325 |
|
17326 |
|
17327 |
|
17328 |
|
17329 |
|
17330 |
|
17331 |
|
17332 |
|
17333 |
|
17334 |
|
17335 |
|
17336 |
|
17337 |
|
17338 |
|
17339 |
|
17340 |
|
17341 |
|
17342 |
|
17343 |
|
17344 |
|
17345 |
|
17346 |
|
17347 |
|
17348 |
|
17349 |
|
17350 |
|
17351 |
|
17352 |
|
17353 |
|
17354 | function ɵɵstyleMapInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
|
17355 | const lView = getLView();
|
17356 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
17357 | ɵɵstyleMap(interpolatedValue);
|
17358 | }
|
17359 |
|
17360 |
|
17361 |
|
17362 |
|
17363 |
|
17364 |
|
17365 |
|
17366 |
|
17367 |
|
17368 |
|
17369 |
|
17370 |
|
17371 |
|
17372 |
|
17373 |
|
17374 |
|
17375 |
|
17376 |
|
17377 |
|
17378 |
|
17379 |
|
17380 |
|
17381 |
|
17382 |
|
17383 | function ɵɵstyleMapInterpolateV(values) {
|
17384 | const lView = getLView();
|
17385 | const interpolatedValue = interpolationV(lView, values);
|
17386 | ɵɵstyleMap(interpolatedValue);
|
17387 | }
|
17388 |
|
17389 |
|
17390 |
|
17391 |
|
17392 |
|
17393 |
|
17394 |
|
17395 |
|
17396 |
|
17397 |
|
17398 |
|
17399 |
|
17400 |
|
17401 |
|
17402 |
|
17403 |
|
17404 |
|
17405 |
|
17406 |
|
17407 |
|
17408 |
|
17409 |
|
17410 |
|
17411 |
|
17412 |
|
17413 |
|
17414 |
|
17415 |
|
17416 |
|
17417 |
|
17418 |
|
17419 |
|
17420 |
|
17421 |
|
17422 | function ɵɵstylePropInterpolate1(prop, prefix, v0, suffix, valueSuffix) {
|
17423 | const lView = getLView();
|
17424 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
17425 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
17426 | return ɵɵstylePropInterpolate1;
|
17427 | }
|
17428 |
|
17429 |
|
17430 |
|
17431 |
|
17432 |
|
17433 |
|
17434 |
|
17435 |
|
17436 |
|
17437 |
|
17438 |
|
17439 |
|
17440 |
|
17441 |
|
17442 |
|
17443 |
|
17444 |
|
17445 |
|
17446 |
|
17447 |
|
17448 |
|
17449 |
|
17450 |
|
17451 |
|
17452 |
|
17453 |
|
17454 |
|
17455 |
|
17456 | function ɵɵstylePropInterpolate2(prop, prefix, v0, i0, v1, suffix, valueSuffix) {
|
17457 | const lView = getLView();
|
17458 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
17459 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
17460 | return ɵɵstylePropInterpolate2;
|
17461 | }
|
17462 |
|
17463 |
|
17464 |
|
17465 |
|
17466 |
|
17467 |
|
17468 |
|
17469 |
|
17470 |
|
17471 |
|
17472 |
|
17473 |
|
17474 |
|
17475 |
|
17476 |
|
17477 |
|
17478 |
|
17479 |
|
17480 |
|
17481 |
|
17482 |
|
17483 |
|
17484 |
|
17485 |
|
17486 |
|
17487 |
|
17488 |
|
17489 |
|
17490 |
|
17491 |
|
17492 | function ɵɵstylePropInterpolate3(prop, prefix, v0, i0, v1, i1, v2, suffix, valueSuffix) {
|
17493 | const lView = getLView();
|
17494 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
17495 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
17496 | return ɵɵstylePropInterpolate3;
|
17497 | }
|
17498 |
|
17499 |
|
17500 |
|
17501 |
|
17502 |
|
17503 |
|
17504 |
|
17505 |
|
17506 |
|
17507 |
|
17508 |
|
17509 |
|
17510 |
|
17511 |
|
17512 |
|
17513 |
|
17514 |
|
17515 |
|
17516 |
|
17517 |
|
17518 |
|
17519 |
|
17520 |
|
17521 |
|
17522 |
|
17523 |
|
17524 |
|
17525 |
|
17526 |
|
17527 |
|
17528 |
|
17529 |
|
17530 | function ɵɵstylePropInterpolate4(prop, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, valueSuffix) {
|
17531 | const lView = getLView();
|
17532 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
17533 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
17534 | return ɵɵstylePropInterpolate4;
|
17535 | }
|
17536 |
|
17537 |
|
17538 |
|
17539 |
|
17540 |
|
17541 |
|
17542 |
|
17543 |
|
17544 |
|
17545 |
|
17546 |
|
17547 |
|
17548 |
|
17549 |
|
17550 |
|
17551 |
|
17552 |
|
17553 |
|
17554 |
|
17555 |
|
17556 |
|
17557 |
|
17558 |
|
17559 |
|
17560 |
|
17561 |
|
17562 |
|
17563 |
|
17564 |
|
17565 |
|
17566 |
|
17567 |
|
17568 |
|
17569 |
|
17570 | function ɵɵstylePropInterpolate5(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, valueSuffix) {
|
17571 | const lView = getLView();
|
17572 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
17573 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
17574 | return ɵɵstylePropInterpolate5;
|
17575 | }
|
17576 |
|
17577 |
|
17578 |
|
17579 |
|
17580 |
|
17581 |
|
17582 |
|
17583 |
|
17584 |
|
17585 |
|
17586 |
|
17587 |
|
17588 |
|
17589 |
|
17590 |
|
17591 |
|
17592 |
|
17593 |
|
17594 |
|
17595 |
|
17596 |
|
17597 |
|
17598 |
|
17599 |
|
17600 |
|
17601 |
|
17602 |
|
17603 |
|
17604 |
|
17605 |
|
17606 |
|
17607 |
|
17608 |
|
17609 |
|
17610 |
|
17611 |
|
17612 | function ɵɵstylePropInterpolate6(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, valueSuffix) {
|
17613 | const lView = getLView();
|
17614 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
17615 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
17616 | return ɵɵstylePropInterpolate6;
|
17617 | }
|
17618 |
|
17619 |
|
17620 |
|
17621 |
|
17622 |
|
17623 |
|
17624 |
|
17625 |
|
17626 |
|
17627 |
|
17628 |
|
17629 |
|
17630 |
|
17631 |
|
17632 |
|
17633 |
|
17634 |
|
17635 |
|
17636 |
|
17637 |
|
17638 |
|
17639 |
|
17640 |
|
17641 |
|
17642 |
|
17643 |
|
17644 |
|
17645 |
|
17646 |
|
17647 |
|
17648 |
|
17649 |
|
17650 |
|
17651 |
|
17652 |
|
17653 |
|
17654 |
|
17655 |
|
17656 |
|
17657 | function ɵɵstylePropInterpolate7(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, valueSuffix) {
|
17658 | const lView = getLView();
|
17659 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
17660 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
17661 | return ɵɵstylePropInterpolate7;
|
17662 | }
|
17663 |
|
17664 |
|
17665 |
|
17666 |
|
17667 |
|
17668 |
|
17669 |
|
17670 |
|
17671 |
|
17672 |
|
17673 |
|
17674 |
|
17675 |
|
17676 |
|
17677 |
|
17678 |
|
17679 |
|
17680 |
|
17681 |
|
17682 |
|
17683 |
|
17684 |
|
17685 |
|
17686 |
|
17687 |
|
17688 |
|
17689 |
|
17690 |
|
17691 |
|
17692 |
|
17693 |
|
17694 |
|
17695 |
|
17696 |
|
17697 |
|
17698 |
|
17699 |
|
17700 |
|
17701 |
|
17702 |
|
17703 |
|
17704 | function ɵɵstylePropInterpolate8(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, valueSuffix) {
|
17705 | const lView = getLView();
|
17706 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
17707 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
17708 | return ɵɵstylePropInterpolate8;
|
17709 | }
|
17710 |
|
17711 |
|
17712 |
|
17713 |
|
17714 |
|
17715 |
|
17716 |
|
17717 |
|
17718 |
|
17719 |
|
17720 |
|
17721 |
|
17722 |
|
17723 |
|
17724 |
|
17725 |
|
17726 |
|
17727 |
|
17728 |
|
17729 |
|
17730 |
|
17731 |
|
17732 |
|
17733 |
|
17734 |
|
17735 |
|
17736 |
|
17737 |
|
17738 |
|
17739 |
|
17740 | function ɵɵstylePropInterpolateV(prop, values, valueSuffix) {
|
17741 | const lView = getLView();
|
17742 | const interpolatedValue = interpolationV(lView, values);
|
17743 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
17744 | return ɵɵstylePropInterpolateV;
|
17745 | }
|
17746 |
|
17747 |
|
17748 |
|
17749 |
|
17750 |
|
17751 |
|
17752 |
|
17753 |
|
17754 |
|
17755 |
|
17756 |
|
17757 |
|
17758 |
|
17759 |
|
17760 |
|
17761 |
|
17762 |
|
17763 |
|
17764 |
|
17765 |
|
17766 |
|
17767 |
|
17768 | function ɵɵhostProperty(propName, value, sanitizer) {
|
17769 | const lView = getLView();
|
17770 | const bindingIndex = nextBindingIndex();
|
17771 | if (bindingUpdated(lView, bindingIndex, value)) {
|
17772 | const tView = getTView();
|
17773 | const tNode = getSelectedTNode();
|
17774 | elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, true);
|
17775 | ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
|
17776 | }
|
17777 | return ɵɵhostProperty;
|
17778 | }
|
17779 |
|
17780 |
|
17781 |
|
17782 |
|
17783 |
|
17784 |
|
17785 |
|
17786 |
|
17787 |
|
17788 |
|
17789 |
|
17790 |
|
17791 |
|
17792 |
|
17793 |
|
17794 |
|
17795 |
|
17796 |
|
17797 |
|
17798 |
|
17799 |
|
17800 | function ɵɵsyntheticHostProperty(propName, value, sanitizer) {
|
17801 | const lView = getLView();
|
17802 | const bindingIndex = nextBindingIndex();
|
17803 | if (bindingUpdated(lView, bindingIndex, value)) {
|
17804 | const tView = getTView();
|
17805 | const tNode = getSelectedTNode();
|
17806 | const currentDef = getCurrentDirectiveDef(tView.data);
|
17807 | const renderer = loadComponentRenderer(currentDef, tNode, lView);
|
17808 | elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, true);
|
17809 | ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
|
17810 | }
|
17811 | return ɵɵsyntheticHostProperty;
|
17812 | }
|
17813 |
|
17814 |
|
17815 |
|
17816 |
|
17817 |
|
17818 |
|
17819 |
|
17820 |
|
17821 |
|
17822 |
|
17823 |
|
17824 |
|
17825 |
|
17826 |
|
17827 |
|
17828 |
|
17829 |
|
17830 |
|
17831 |
|
17832 |
|
17833 |
|
17834 |
|
17835 |
|
17836 |
|
17837 |
|
17838 |
|
17839 |
|
17840 |
|
17841 |
|
17842 |
|
17843 |
|
17844 |
|
17845 |
|
17846 |
|
17847 |
|
17848 |
|
17849 |
|
17850 |
|
17851 |
|
17852 |
|
17853 |
|
17854 | function getComponent(element) {
|
17855 | assertDomElement(element);
|
17856 | const context = loadLContext(element, false);
|
17857 | if (context === null)
|
17858 | return null;
|
17859 | if (context.component === undefined) {
|
17860 | context.component = getComponentAtNodeIndex(context.nodeIndex, context.lView);
|
17861 | }
|
17862 | return context.component;
|
17863 | }
|
17864 |
|
17865 |
|
17866 |
|
17867 |
|
17868 |
|
17869 |
|
17870 |
|
17871 |
|
17872 |
|
17873 |
|
17874 |
|
17875 |
|
17876 | function getContext(element) {
|
17877 | assertDomElement(element);
|
17878 | const context = loadLContext(element, false);
|
17879 | return context === null ? null : context.lView[CONTEXT];
|
17880 | }
|
17881 |
|
17882 |
|
17883 |
|
17884 |
|
17885 |
|
17886 |
|
17887 |
|
17888 |
|
17889 |
|
17890 |
|
17891 |
|
17892 |
|
17893 |
|
17894 |
|
17895 |
|
17896 | function getOwningComponent(elementOrDir) {
|
17897 | const context = loadLContext(elementOrDir, false);
|
17898 | if (context === null)
|
17899 | return null;
|
17900 | let lView = context.lView;
|
17901 | let parent;
|
17902 | ngDevMode && assertLView(lView);
|
17903 | while (lView[HOST] === null && (parent = getLViewParent(lView))) {
|
17904 |
|
17905 | lView = parent;
|
17906 | }
|
17907 | return lView[FLAGS] & 512 ? null : lView[CONTEXT];
|
17908 | }
|
17909 |
|
17910 |
|
17911 |
|
17912 |
|
17913 |
|
17914 |
|
17915 |
|
17916 |
|
17917 |
|
17918 |
|
17919 |
|
17920 | function getRootComponents(elementOrDir) {
|
17921 | return [...getRootContext(elementOrDir).components];
|
17922 | }
|
17923 |
|
17924 |
|
17925 |
|
17926 |
|
17927 |
|
17928 |
|
17929 |
|
17930 |
|
17931 |
|
17932 |
|
17933 | function getInjector(elementOrDir) {
|
17934 | const context = loadLContext(elementOrDir, false);
|
17935 | if (context === null)
|
17936 | return Injector.NULL;
|
17937 | const tNode = context.lView[TVIEW].data[context.nodeIndex];
|
17938 | return new NodeInjector(tNode, context.lView);
|
17939 | }
|
17940 |
|
17941 |
|
17942 |
|
17943 |
|
17944 |
|
17945 | function getInjectionTokens(element) {
|
17946 | const context = loadLContext(element, false);
|
17947 | if (context === null)
|
17948 | return [];
|
17949 | const lView = context.lView;
|
17950 | const tView = lView[TVIEW];
|
17951 | const tNode = tView.data[context.nodeIndex];
|
17952 | const providerTokens = [];
|
17953 | const startIndex = tNode.providerIndexes & 1048575 ;
|
17954 | const endIndex = tNode.directiveEnd;
|
17955 | for (let i = startIndex; i < endIndex; i++) {
|
17956 | let value = tView.data[i];
|
17957 | if (isDirectiveDefHack(value)) {
|
17958 |
|
17959 |
|
17960 |
|
17961 |
|
17962 | value = value.type;
|
17963 | }
|
17964 | providerTokens.push(value);
|
17965 | }
|
17966 | return providerTokens;
|
17967 | }
|
17968 |
|
17969 |
|
17970 |
|
17971 |
|
17972 |
|
17973 |
|
17974 |
|
17975 |
|
17976 |
|
17977 |
|
17978 |
|
17979 |
|
17980 |
|
17981 |
|
17982 |
|
17983 |
|
17984 |
|
17985 |
|
17986 |
|
17987 |
|
17988 |
|
17989 |
|
17990 |
|
17991 | function getDirectives(element) {
|
17992 | const context = loadLContext(element);
|
17993 | if (context.directives === undefined) {
|
17994 | context.directives = getDirectivesAtNodeIndex(context.nodeIndex, context.lView, false);
|
17995 | }
|
17996 |
|
17997 |
|
17998 | return context.directives === null ? [] : [...context.directives];
|
17999 | }
|
18000 | function loadLContext(target, throwOnNotFound = true) {
|
18001 | const context = getLContext(target);
|
18002 | if (!context && throwOnNotFound) {
|
18003 | throw new Error(ngDevMode ? `Unable to find context associated with ${stringifyForError(target)}` :
|
18004 | 'Invalid ng target');
|
18005 | }
|
18006 | return context;
|
18007 | }
|
18008 |
|
18009 |
|
18010 |
|
18011 |
|
18012 |
|
18013 |
|
18014 |
|
18015 |
|
18016 | function getLocalRefs(target) {
|
18017 | const context = loadLContext(target, false);
|
18018 | if (context === null)
|
18019 | return {};
|
18020 | if (context.localRefs === undefined) {
|
18021 | context.localRefs = discoverLocalRefs(context.lView, context.nodeIndex);
|
18022 | }
|
18023 | return context.localRefs || {};
|
18024 | }
|
18025 |
|
18026 |
|
18027 |
|
18028 |
|
18029 |
|
18030 |
|
18031 |
|
18032 |
|
18033 |
|
18034 |
|
18035 |
|
18036 | function getHostElement(componentOrDirective) {
|
18037 | return getLContext(componentOrDirective).native;
|
18038 | }
|
18039 |
|
18040 |
|
18041 |
|
18042 |
|
18043 |
|
18044 |
|
18045 |
|
18046 |
|
18047 |
|
18048 |
|
18049 | function getRenderedText(component) {
|
18050 | const hostElement = getHostElement(component);
|
18051 | return hostElement.textContent || '';
|
18052 | }
|
18053 | function loadLContextFromNode(node) {
|
18054 | if (!(node instanceof Node))
|
18055 | throw new Error('Expecting instance of DOM Element');
|
18056 | return loadLContext(node);
|
18057 | }
|
18058 |
|
18059 |
|
18060 |
|
18061 |
|
18062 |
|
18063 |
|
18064 |
|
18065 |
|
18066 |
|
18067 |
|
18068 |
|
18069 |
|
18070 |
|
18071 |
|
18072 |
|
18073 |
|
18074 |
|
18075 |
|
18076 |
|
18077 |
|
18078 |
|
18079 |
|
18080 |
|
18081 |
|
18082 |
|
18083 |
|
18084 |
|
18085 |
|
18086 |
|
18087 | function getListeners(element) {
|
18088 | assertDomElement(element);
|
18089 | const lContext = loadLContext(element, false);
|
18090 | if (lContext === null)
|
18091 | return [];
|
18092 | const lView = lContext.lView;
|
18093 | const tView = lView[TVIEW];
|
18094 | const lCleanup = lView[CLEANUP];
|
18095 | const tCleanup = tView.cleanup;
|
18096 | const listeners = [];
|
18097 | if (tCleanup && lCleanup) {
|
18098 | for (let i = 0; i < tCleanup.length;) {
|
18099 | const firstParam = tCleanup[i++];
|
18100 | const secondParam = tCleanup[i++];
|
18101 | if (typeof firstParam === 'string') {
|
18102 | const name = firstParam;
|
18103 | const listenerElement = unwrapRNode(lView[secondParam]);
|
18104 | const callback = lCleanup[tCleanup[i++]];
|
18105 | const useCaptureOrIndx = tCleanup[i++];
|
18106 |
|
18107 |
|
18108 |
|
18109 | const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
|
18110 | const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
|
18111 | if (element == listenerElement) {
|
18112 | listeners.push({ element, name, callback, useCapture, type });
|
18113 | }
|
18114 | }
|
18115 | }
|
18116 | }
|
18117 | listeners.sort(sortListeners);
|
18118 | return listeners;
|
18119 | }
|
18120 | function sortListeners(a, b) {
|
18121 | if (a.name == b.name)
|
18122 | return 0;
|
18123 | return a.name < b.name ? -1 : 1;
|
18124 | }
|
18125 |
|
18126 |
|
18127 |
|
18128 |
|
18129 |
|
18130 | function isDirectiveDefHack(obj) {
|
18131 | return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
|
18132 | }
|
18133 |
|
18134 |
|
18135 |
|
18136 |
|
18137 |
|
18138 | function getDebugNode(element) {
|
18139 | let debugNode = null;
|
18140 | const lContext = loadLContextFromNode(element);
|
18141 | const lView = lContext.lView;
|
18142 | const nodeIndex = lContext.nodeIndex;
|
18143 | if (nodeIndex !== -1) {
|
18144 | const valueInLView = lView[nodeIndex];
|
18145 |
|
18146 |
|
18147 | const tNode = isLView(valueInLView) ? valueInLView[T_HOST] :
|
18148 | getTNode(lView[TVIEW], nodeIndex - HEADER_OFFSET);
|
18149 | debugNode = buildDebugNode(tNode, lView, nodeIndex);
|
18150 | }
|
18151 | return debugNode;
|
18152 | }
|
18153 |
|
18154 |
|
18155 |
|
18156 |
|
18157 |
|
18158 |
|
18159 |
|
18160 |
|
18161 | function getComponentLView(target) {
|
18162 | const lContext = loadLContext(target);
|
18163 | const nodeIndx = lContext.nodeIndex;
|
18164 | const lView = lContext.lView;
|
18165 | const componentLView = lView[nodeIndx];
|
18166 | ngDevMode && assertLView(componentLView);
|
18167 | return componentLView;
|
18168 | }
|
18169 |
|
18170 | function assertDomElement(value) {
|
18171 | if (typeof Element !== 'undefined' && !(value instanceof Element)) {
|
18172 | throw new Error('Expecting instance of DOM Element');
|
18173 | }
|
18174 | }
|
18175 |
|
18176 |
|
18177 |
|
18178 |
|
18179 |
|
18180 |
|
18181 |
|
18182 |
|
18183 |
|
18184 |
|
18185 |
|
18186 |
|
18187 |
|
18188 |
|
18189 |
|
18190 |
|
18191 |
|
18192 | function applyChanges(component) {
|
18193 | markDirty(component);
|
18194 | getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
|
18195 | }
|
18196 |
|
18197 |
|
18198 |
|
18199 |
|
18200 |
|
18201 |
|
18202 |
|
18203 |
|
18204 |
|
18205 |
|
18206 |
|
18207 |
|
18208 |
|
18209 |
|
18210 |
|
18211 |
|
18212 |
|
18213 |
|
18214 |
|
18215 |
|
18216 |
|
18217 |
|
18218 |
|
18219 | const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
|
18220 | let _published = false;
|
18221 |
|
18222 |
|
18223 |
|
18224 |
|
18225 |
|
18226 |
|
18227 | function publishDefaultGlobalUtils() {
|
18228 | if (!_published) {
|
18229 | _published = true;
|
18230 | publishGlobalUtil('getComponent', getComponent);
|
18231 | publishGlobalUtil('getContext', getContext);
|
18232 | publishGlobalUtil('getListeners', getListeners);
|
18233 | publishGlobalUtil('getOwningComponent', getOwningComponent);
|
18234 | publishGlobalUtil('getHostElement', getHostElement);
|
18235 | publishGlobalUtil('getInjector', getInjector);
|
18236 | publishGlobalUtil('getRootComponents', getRootComponents);
|
18237 | publishGlobalUtil('getDirectives', getDirectives);
|
18238 | publishGlobalUtil('applyChanges', applyChanges);
|
18239 | }
|
18240 | }
|
18241 |
|
18242 |
|
18243 |
|
18244 |
|
18245 | function publishGlobalUtil(name, fn) {
|
18246 | if (typeof COMPILED === 'undefined' || !COMPILED) {
|
18247 |
|
18248 |
|
18249 |
|
18250 |
|
18251 | const w = _global;
|
18252 | ngDevMode && assertDefined(fn, 'function not defined');
|
18253 | if (w) {
|
18254 | let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
|
18255 | if (!container) {
|
18256 | container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
|
18257 | }
|
18258 | container[name] = fn;
|
18259 | }
|
18260 | }
|
18261 | }
|
18262 |
|
18263 |
|
18264 |
|
18265 |
|
18266 |
|
18267 |
|
18268 |
|
18269 |
|
18270 | const ɵ0$b = (token, notFoundValue) => {
|
18271 | throw new Error('NullInjector: Not found: ' + stringifyForError(token));
|
18272 | };
|
18273 |
|
18274 | const NULL_INJECTOR$1 = {
|
18275 | get: ɵ0$b
|
18276 | };
|
18277 | /**
|
18278 | * Bootstraps a Component into an existing host element and returns an instance
|
18279 | * of the component.
|
18280 | *
|
18281 | * Use this function to bootstrap a component into the DOM tree. Each invocation
|
18282 | * of this function will create a separate tree of components, injectors and
|
18283 | * change detection cycles and lifetimes. To dynamically insert a new component
|
18284 | * into an existing tree such that it shares the same injection, change detection
|
18285 | * and object lifetime, use {@link ViewContainer#createComponent}.
|
18286 | *
|
18287 | * @param componentType Component to bootstrap
|
18288 | * @param options Optional parameters which control bootstrapping
|
18289 | */
|
18290 | function renderComponent$1(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
|
18291 | ngDevMode && publishDefaultGlobalUtils();
|
18292 | ngDevMode && assertComponentType(componentType);
|
18293 | const rendererFactory = opts.rendererFactory || domRendererFactory3;
|
18294 | const sanitizer = opts.sanitizer || null;
|
18295 | const componentDef = getComponentDef(componentType);
|
18296 | if (componentDef.type != componentType)
|
18297 | componentDef.type = componentType;
|
18298 |
|
18299 | const componentTag = componentDef.selectors[0][0];
|
18300 | const hostRenderer = rendererFactory.createRenderer(null, null);
|
18301 | const hostRNode = locateHostElement(hostRenderer, opts.host || componentTag, componentDef.encapsulation);
|
18302 | const rootFlags = componentDef.onPush ? 64 | 512 :
|
18303 | 16 | 512 ;
|
18304 | const rootContext = createRootContext(opts.scheduler, opts.playerHandler);
|
18305 | const renderer = rendererFactory.createRenderer(hostRNode, componentDef);
|
18306 | const rootTView = createTView(0 , -1, null, 1, 0, null, null, null, null, null);
|
18307 | const rootView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, renderer, undefined, opts.injector || null);
|
18308 | enterView(rootView, null);
|
18309 | let component;
|
18310 | try {
|
18311 | if (rendererFactory.begin)
|
18312 | rendererFactory.begin();
|
18313 | const componentView = createRootComponentView(hostRNode, componentDef, rootView, rendererFactory, renderer, sanitizer);
|
18314 | component = createRootComponent(componentView, componentDef, rootView, rootContext, opts.hostFeatures || null);
|
18315 |
|
18316 | renderView(rootTView, rootView, null);
|
18317 |
|
18318 | refreshView(rootTView, rootView, null, null);
|
18319 | }
|
18320 | finally {
|
18321 | leaveView();
|
18322 | if (rendererFactory.end)
|
18323 | rendererFactory.end();
|
18324 | }
|
18325 | return component;
|
18326 | }
|
18327 |
|
18328 |
|
18329 |
|
18330 |
|
18331 |
|
18332 |
|
18333 |
|
18334 |
|
18335 |
|
18336 |
|
18337 |
|
18338 | function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
|
18339 | const tView = rootView[TVIEW];
|
18340 | ngDevMode && assertIndexInRange(rootView, 0 + HEADER_OFFSET);
|
18341 | rootView[0 + HEADER_OFFSET] = rNode;
|
18342 | const tNode = getOrCreateTNode(tView, null, 0, 3 , null, null);
|
18343 | const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
|
18344 | if (mergedAttrs !== null) {
|
18345 | computeStaticStyling(tNode, mergedAttrs, true);
|
18346 | if (rNode !== null) {
|
18347 | setUpAttributes(hostRenderer, rNode, mergedAttrs);
|
18348 | if (tNode.classes !== null) {
|
18349 | writeDirectClass(hostRenderer, rNode, tNode.classes);
|
18350 | }
|
18351 | if (tNode.styles !== null) {
|
18352 | writeDirectStyle(hostRenderer, rNode, tNode.styles);
|
18353 | }
|
18354 | }
|
18355 | }
|
18356 | const viewRenderer = rendererFactory.createRenderer(rNode, def);
|
18357 | const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 64 : 16 , rootView[HEADER_OFFSET], tNode, rendererFactory, viewRenderer, sanitizer);
|
18358 | if (tView.firstCreatePass) {
|
18359 | diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
|
18360 | markAsComponentHost(tView, tNode);
|
18361 | initTNodeFlags(tNode, rootView.length, 1);
|
18362 | }
|
18363 | addToViewTree(rootView, componentView);
|
18364 |
|
18365 | return rootView[HEADER_OFFSET] = componentView;
|
18366 | }
|
18367 |
|
18368 |
|
18369 |
|
18370 |
|
18371 | function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
|
18372 | const tView = rootLView[TVIEW];
|
18373 |
|
18374 | const component = instantiateRootComponent(tView, rootLView, componentDef);
|
18375 | rootContext.components.push(component);
|
18376 | componentView[CONTEXT] = component;
|
18377 | hostFeatures && hostFeatures.forEach((feature) => feature(component, componentDef));
|
18378 |
|
18379 |
|
18380 | if (componentDef.contentQueries) {
|
18381 | componentDef.contentQueries(1 , component, rootLView.length - 1);
|
18382 | }
|
18383 | const rootTNode = getPreviousOrParentTNode();
|
18384 | if (tView.firstCreatePass &&
|
18385 | (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
|
18386 | const elementIndex = rootTNode.index - HEADER_OFFSET;
|
18387 | setSelectedIndex(elementIndex);
|
18388 | const rootTView = rootLView[TVIEW];
|
18389 | addHostBindingsToExpandoInstructions(rootTView, componentDef);
|
18390 | growHostVarsSpace(rootTView, rootLView, componentDef.hostVars);
|
18391 | invokeHostBindingsInCreationMode(componentDef, component);
|
18392 | }
|
18393 | return component;
|
18394 | }
|
18395 | function createRootContext(scheduler, playerHandler) {
|
18396 | return {
|
18397 | components: [],
|
18398 | scheduler: scheduler || defaultScheduler,
|
18399 | clean: CLEAN_PROMISE,
|
18400 | playerHandler: playerHandler || null,
|
18401 | flags: 0
|
18402 | };
|
18403 | }
|
18404 |
|
18405 |
|
18406 |
|
18407 |
|
18408 |
|
18409 |
|
18410 |
|
18411 |
|
18412 |
|
18413 |
|
18414 |
|
18415 |
|
18416 |
|
18417 | function LifecycleHooksFeature(component, def) {
|
18418 | const rootTView = readPatchedLView(component)[TVIEW];
|
18419 | const dirIndex = rootTView.data.length - 1;
|
18420 |
|
18421 |
|
18422 | registerPostOrderHooks(rootTView, { directiveStart: dirIndex, directiveEnd: dirIndex + 1 });
|
18423 | }
|
18424 |
|
18425 |
|
18426 |
|
18427 |
|
18428 |
|
18429 |
|
18430 |
|
18431 |
|
18432 |
|
18433 |
|
18434 |
|
18435 |
|
18436 |
|
18437 |
|
18438 |
|
18439 |
|
18440 | function whenRendered(component) {
|
18441 | return getRootContext(component).clean;
|
18442 | }
|
18443 |
|
18444 |
|
18445 |
|
18446 |
|
18447 |
|
18448 |
|
18449 |
|
18450 |
|
18451 | function getSuperType(type) {
|
18452 | return Object.getPrototypeOf(type.prototype).constructor;
|
18453 | }
|
18454 |
|
18455 |
|
18456 |
|
18457 |
|
18458 |
|
18459 |
|
18460 | function ɵɵInheritDefinitionFeature(definition) {
|
18461 | let superType = getSuperType(definition.type);
|
18462 | let shouldInheritFields = true;
|
18463 | const inheritanceChain = [definition];
|
18464 | while (superType) {
|
18465 | let superDef = undefined;
|
18466 | if (isComponentDef(definition)) {
|
18467 |
|
18468 | superDef = superType.ɵcmp || superType.ɵdir;
|
18469 | }
|
18470 | else {
|
18471 | if (superType.ɵcmp) {
|
18472 | throw new Error('Directives cannot inherit Components');
|
18473 | }
|
18474 |
|
18475 | superDef = superType.ɵdir;
|
18476 | }
|
18477 | if (superDef) {
|
18478 | if (shouldInheritFields) {
|
18479 | inheritanceChain.push(superDef);
|
18480 |
|
18481 |
|
18482 | const writeableDef = definition;
|
18483 | writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
|
18484 | writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
|
18485 | writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
|
18486 |
|
18487 | const superHostBindings = superDef.hostBindings;
|
18488 | superHostBindings && inheritHostBindings(definition, superHostBindings);
|
18489 |
|
18490 | const superViewQuery = superDef.viewQuery;
|
18491 | const superContentQueries = superDef.contentQueries;
|
18492 | superViewQuery && inheritViewQuery(definition, superViewQuery);
|
18493 | superContentQueries && inheritContentQueries(definition, superContentQueries);
|
18494 |
|
18495 | fillProperties(definition.inputs, superDef.inputs);
|
18496 | fillProperties(definition.declaredInputs, superDef.declaredInputs);
|
18497 | fillProperties(definition.outputs, superDef.outputs);
|
18498 |
|
18499 |
|
18500 | if (isComponentDef(superDef) && superDef.data.animation) {
|
18501 |
|
18502 |
|
18503 | const defData = definition.data;
|
18504 | defData.animation = (defData.animation || []).concat(superDef.data.animation);
|
18505 | }
|
18506 | }
|
18507 |
|
18508 | const features = superDef.features;
|
18509 | if (features) {
|
18510 | for (let i = 0; i < features.length; i++) {
|
18511 | const feature = features[i];
|
18512 | if (feature && feature.ngInherit) {
|
18513 | feature(definition);
|
18514 | }
|
18515 |
|
18516 |
|
18517 |
|
18518 |
|
18519 |
|
18520 |
|
18521 |
|
18522 | if (feature === ɵɵInheritDefinitionFeature) {
|
18523 | shouldInheritFields = false;
|
18524 | }
|
18525 | }
|
18526 | }
|
18527 | }
|
18528 | superType = Object.getPrototypeOf(superType);
|
18529 | }
|
18530 | mergeHostAttrsAcrossInheritance(inheritanceChain);
|
18531 | }
|
18532 |
|
18533 |
|
18534 |
|
18535 |
|
18536 |
|
18537 |
|
18538 |
|
18539 | function mergeHostAttrsAcrossInheritance(inheritanceChain) {
|
18540 | let hostVars = 0;
|
18541 | let hostAttrs = null;
|
18542 |
|
18543 | for (let i = inheritanceChain.length - 1; i >= 0; i--) {
|
18544 | const def = inheritanceChain[i];
|
18545 |
|
18546 | def.hostVars = (hostVars += def.hostVars);
|
18547 |
|
18548 | def.hostAttrs =
|
18549 | mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
|
18550 | }
|
18551 | }
|
18552 | function maybeUnwrapEmpty(value) {
|
18553 | if (value === EMPTY_OBJ) {
|
18554 | return {};
|
18555 | }
|
18556 | else if (value === EMPTY_ARRAY) {
|
18557 | return [];
|
18558 | }
|
18559 | else {
|
18560 | return value;
|
18561 | }
|
18562 | }
|
18563 | function inheritViewQuery(definition, superViewQuery) {
|
18564 | const prevViewQuery = definition.viewQuery;
|
18565 | if (prevViewQuery) {
|
18566 | definition.viewQuery = (rf, ctx) => {
|
18567 | superViewQuery(rf, ctx);
|
18568 | prevViewQuery(rf, ctx);
|
18569 | };
|
18570 | }
|
18571 | else {
|
18572 | definition.viewQuery = superViewQuery;
|
18573 | }
|
18574 | }
|
18575 | function inheritContentQueries(definition, superContentQueries) {
|
18576 | const prevContentQueries = definition.contentQueries;
|
18577 | if (prevContentQueries) {
|
18578 | definition.contentQueries = (rf, ctx, directiveIndex) => {
|
18579 | superContentQueries(rf, ctx, directiveIndex);
|
18580 | prevContentQueries(rf, ctx, directiveIndex);
|
18581 | };
|
18582 | }
|
18583 | else {
|
18584 | definition.contentQueries = superContentQueries;
|
18585 | }
|
18586 | }
|
18587 | function inheritHostBindings(definition, superHostBindings) {
|
18588 | const prevHostBindings = definition.hostBindings;
|
18589 | if (prevHostBindings) {
|
18590 | definition.hostBindings = (rf, ctx) => {
|
18591 | superHostBindings(rf, ctx);
|
18592 | prevHostBindings(rf, ctx);
|
18593 | };
|
18594 | }
|
18595 | else {
|
18596 | definition.hostBindings = superHostBindings;
|
18597 | }
|
18598 | }
|
18599 |
|
18600 |
|
18601 |
|
18602 |
|
18603 |
|
18604 |
|
18605 |
|
18606 |
|
18607 |
|
18608 |
|
18609 |
|
18610 |
|
18611 | const COPY_DIRECTIVE_FIELDS = [
|
18612 |
|
18613 | 'providersResolver',
|
18614 | ];
|
18615 |
|
18616 |
|
18617 |
|
18618 |
|
18619 |
|
18620 |
|
18621 |
|
18622 | const COPY_COMPONENT_FIELDS = [
|
18623 |
|
18624 |
|
18625 | 'template',
|
18626 | 'decls',
|
18627 | 'consts',
|
18628 | 'vars',
|
18629 | 'onPush',
|
18630 | 'ngContentSelectors',
|
18631 |
|
18632 | 'styles',
|
18633 | 'encapsulation',
|
18634 |
|
18635 | 'schemas',
|
18636 | ];
|
18637 |
|
18638 |
|
18639 |
|
18640 |
|
18641 |
|
18642 |
|
18643 |
|
18644 |
|
18645 |
|
18646 |
|
18647 |
|
18648 |
|
18649 |
|
18650 |
|
18651 |
|
18652 |
|
18653 | function ɵɵCopyDefinitionFeature(definition) {
|
18654 | let superType = getSuperType(definition.type);
|
18655 | let superDef = undefined;
|
18656 | if (isComponentDef(definition)) {
|
18657 |
|
18658 | superDef = superType.ɵcmp;
|
18659 | }
|
18660 | else {
|
18661 |
|
18662 | superDef = superType.ɵdir;
|
18663 | }
|
18664 |
|
18665 | const defAny = definition;
|
18666 |
|
18667 | for (const field of COPY_DIRECTIVE_FIELDS) {
|
18668 | defAny[field] = superDef[field];
|
18669 | }
|
18670 | if (isComponentDef(superDef)) {
|
18671 |
|
18672 | for (const field of COPY_COMPONENT_FIELDS) {
|
18673 | defAny[field] = superDef[field];
|
18674 | }
|
18675 | }
|
18676 | }
|
18677 |
|
18678 |
|
18679 |
|
18680 |
|
18681 |
|
18682 |
|
18683 |
|
18684 |
|
18685 |
|
18686 |
|
18687 |
|
18688 |
|
18689 |
|
18690 |
|
18691 |
|
18692 |
|
18693 |
|
18694 |
|
18695 |
|
18696 |
|
18697 |
|
18698 |
|
18699 |
|
18700 |
|
18701 |
|
18702 |
|
18703 | function providersResolver(def, providers, viewProviders) {
|
18704 | const tView = getTView();
|
18705 | if (tView.firstCreatePass) {
|
18706 | const isComponent = isComponentDef(def);
|
18707 |
|
18708 | resolveProvider$1(viewProviders, tView.data, tView.blueprint, isComponent, true);
|
18709 |
|
18710 | resolveProvider$1(providers, tView.data, tView.blueprint, isComponent, false);
|
18711 | }
|
18712 | }
|
18713 |
|
18714 |
|
18715 |
|
18716 | function resolveProvider$1(provider, tInjectables, lInjectablesBlueprint, isComponent, isViewProvider) {
|
18717 | provider = resolveForwardRef(provider);
|
18718 | if (Array.isArray(provider)) {
|
18719 |
|
18720 |
|
18721 |
|
18722 | for (let i = 0; i < provider.length; i++) {
|
18723 | resolveProvider$1(provider[i], tInjectables, lInjectablesBlueprint, isComponent, isViewProvider);
|
18724 | }
|
18725 | }
|
18726 | else {
|
18727 | const tView = getTView();
|
18728 | const lView = getLView();
|
18729 | let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
|
18730 | let providerFactory = providerToFactory(provider);
|
18731 | const tNode = getPreviousOrParentTNode();
|
18732 | const beginIndex = tNode.providerIndexes & 1048575 ;
|
18733 | const endIndex = tNode.directiveStart;
|
18734 | const cptViewProvidersCount = tNode.providerIndexes >> 20 ;
|
18735 | if (isTypeProvider(provider) || !provider.multi) {
|
18736 |
|
18737 | const factory = new NodeInjectorFactory(providerFactory, isViewProvider, ɵɵdirectiveInject);
|
18738 | const existingFactoryIndex = indexOf(token, tInjectables, isViewProvider ? beginIndex : beginIndex + cptViewProvidersCount, endIndex);
|
18739 | if (existingFactoryIndex === -1) {
|
18740 | diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
|
18741 | registerDestroyHooksIfSupported(tView, provider, tInjectables.length);
|
18742 | tInjectables.push(token);
|
18743 | tNode.directiveStart++;
|
18744 | tNode.directiveEnd++;
|
18745 | if (isViewProvider) {
|
18746 | tNode.providerIndexes += 1048576 ;
|
18747 | }
|
18748 | lInjectablesBlueprint.push(factory);
|
18749 | lView.push(factory);
|
18750 | }
|
18751 | else {
|
18752 | lInjectablesBlueprint[existingFactoryIndex] = factory;
|
18753 | lView[existingFactoryIndex] = factory;
|
18754 | }
|
18755 | }
|
18756 | else {
|
18757 |
|
18758 |
|
18759 |
|
18760 |
|
18761 |
|
18762 |
|
18763 |
|
18764 |
|
18765 |
|
18766 |
|
18767 |
|
18768 |
|
18769 |
|
18770 |
|
18771 |
|
18772 |
|
18773 |
|
18774 |
|
18775 |
|
18776 |
|
18777 | const existingProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex + cptViewProvidersCount, endIndex);
|
18778 | const existingViewProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex, beginIndex + cptViewProvidersCount);
|
18779 | const doesProvidersFactoryExist = existingProvidersFactoryIndex >= 0 &&
|
18780 | lInjectablesBlueprint[existingProvidersFactoryIndex];
|
18781 | const doesViewProvidersFactoryExist = existingViewProvidersFactoryIndex >= 0 &&
|
18782 | lInjectablesBlueprint[existingViewProvidersFactoryIndex];
|
18783 | if (isViewProvider && !doesViewProvidersFactoryExist ||
|
18784 | !isViewProvider && !doesProvidersFactoryExist) {
|
18785 |
|
18786 | diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
|
18787 | const factory = multiFactory(isViewProvider ? multiViewProvidersFactoryResolver : multiProvidersFactoryResolver, lInjectablesBlueprint.length, isViewProvider, isComponent, providerFactory);
|
18788 | if (!isViewProvider && doesViewProvidersFactoryExist) {
|
18789 | lInjectablesBlueprint[existingViewProvidersFactoryIndex].providerFactory = factory;
|
18790 | }
|
18791 | registerDestroyHooksIfSupported(tView, provider, tInjectables.length, 0);
|
18792 | tInjectables.push(token);
|
18793 | tNode.directiveStart++;
|
18794 | tNode.directiveEnd++;
|
18795 | if (isViewProvider) {
|
18796 | tNode.providerIndexes += 1048576 ;
|
18797 | }
|
18798 | lInjectablesBlueprint.push(factory);
|
18799 | lView.push(factory);
|
18800 | }
|
18801 | else {
|
18802 |
|
18803 | const indexInFactory = multiFactoryAdd(lInjectablesBlueprint[isViewProvider ? existingViewProvidersFactoryIndex :
|
18804 | existingProvidersFactoryIndex], providerFactory, !isViewProvider && isComponent);
|
18805 | registerDestroyHooksIfSupported(tView, provider, existingProvidersFactoryIndex > -1 ? existingProvidersFactoryIndex :
|
18806 | existingViewProvidersFactoryIndex, indexInFactory);
|
18807 | }
|
18808 | if (!isViewProvider && isComponent && doesViewProvidersFactoryExist) {
|
18809 | lInjectablesBlueprint[existingViewProvidersFactoryIndex].componentProviders++;
|
18810 | }
|
18811 | }
|
18812 | }
|
18813 | }
|
18814 |
|
18815 |
|
18816 |
|
18817 |
|
18818 |
|
18819 |
|
18820 |
|
18821 |
|
18822 | function registerDestroyHooksIfSupported(tView, provider, contextIndex, indexInFactory) {
|
18823 | const providerIsTypeProvider = isTypeProvider(provider);
|
18824 | if (providerIsTypeProvider || isClassProvider(provider)) {
|
18825 | const prototype = (provider.useClass || provider).prototype;
|
18826 | const ngOnDestroy = prototype.ngOnDestroy;
|
18827 | if (ngOnDestroy) {
|
18828 | const hooks = tView.destroyHooks || (tView.destroyHooks = []);
|
18829 | if (!providerIsTypeProvider && provider.multi) {
|
18830 | ngDevMode &&
|
18831 | assertDefined(indexInFactory, 'indexInFactory when registering multi factory destroy hook');
|
18832 | const existingCallbacksIndex = hooks.indexOf(contextIndex);
|
18833 | if (existingCallbacksIndex === -1) {
|
18834 | hooks.push(contextIndex, [indexInFactory, ngOnDestroy]);
|
18835 | }
|
18836 | else {
|
18837 | hooks[existingCallbacksIndex + 1].push(indexInFactory, ngOnDestroy);
|
18838 | }
|
18839 | }
|
18840 | else {
|
18841 | hooks.push(contextIndex, ngOnDestroy);
|
18842 | }
|
18843 | }
|
18844 | }
|
18845 | }
|
18846 |
|
18847 |
|
18848 |
|
18849 |
|
18850 | function multiFactoryAdd(multiFactory, factory, isComponentProvider) {
|
18851 | if (isComponentProvider) {
|
18852 | multiFactory.componentProviders++;
|
18853 | }
|
18854 | return multiFactory.multi.push(factory) - 1;
|
18855 | }
|
18856 |
|
18857 |
|
18858 |
|
18859 | function indexOf(item, arr, begin, end) {
|
18860 | for (let i = begin; i < end; i++) {
|
18861 | if (arr[i] === item)
|
18862 | return i;
|
18863 | }
|
18864 | return -1;
|
18865 | }
|
18866 |
|
18867 |
|
18868 |
|
18869 | function multiProvidersFactoryResolver(_, tData, lData, tNode) {
|
18870 | return multiResolve(this.multi, []);
|
18871 | }
|
18872 |
|
18873 |
|
18874 |
|
18875 |
|
18876 |
|
18877 | function multiViewProvidersFactoryResolver(_, tData, lView, tNode) {
|
18878 | const factories = this.multi;
|
18879 | let result;
|
18880 | if (this.providerFactory) {
|
18881 | const componentCount = this.providerFactory.componentProviders;
|
18882 | const multiProviders = getNodeInjectable(lView, lView[TVIEW], this.providerFactory.index, tNode);
|
18883 |
|
18884 | result = multiProviders.slice(0, componentCount);
|
18885 |
|
18886 | multiResolve(factories, result);
|
18887 |
|
18888 | for (let i = componentCount; i < multiProviders.length; i++) {
|
18889 | result.push(multiProviders[i]);
|
18890 | }
|
18891 | }
|
18892 | else {
|
18893 | result = [];
|
18894 |
|
18895 | multiResolve(factories, result);
|
18896 | }
|
18897 | return result;
|
18898 | }
|
18899 |
|
18900 |
|
18901 |
|
18902 | function multiResolve(factories, result) {
|
18903 | for (let i = 0; i < factories.length; i++) {
|
18904 | const factory = factories[i];
|
18905 | result.push(factory());
|
18906 | }
|
18907 | return result;
|
18908 | }
|
18909 |
|
18910 |
|
18911 |
|
18912 | function multiFactory(factoryFn, index, isViewProvider, isComponent, f) {
|
18913 | const factory = new NodeInjectorFactory(factoryFn, isViewProvider, ɵɵdirectiveInject);
|
18914 | factory.multi = [];
|
18915 | factory.index = index;
|
18916 | factory.componentProviders = 0;
|
18917 | multiFactoryAdd(factory, f, isComponent && !isViewProvider);
|
18918 | return factory;
|
18919 | }
|
18920 |
|
18921 |
|
18922 |
|
18923 |
|
18924 |
|
18925 |
|
18926 |
|
18927 |
|
18928 |
|
18929 |
|
18930 |
|
18931 |
|
18932 |
|
18933 |
|
18934 |
|
18935 |
|
18936 |
|
18937 |
|
18938 |
|
18939 |
|
18940 |
|
18941 |
|
18942 |
|
18943 |
|
18944 |
|
18945 |
|
18946 |
|
18947 |
|
18948 |
|
18949 |
|
18950 |
|
18951 |
|
18952 |
|
18953 | function ɵɵProvidersFeature(providers, viewProviders = []) {
|
18954 | return (definition) => {
|
18955 | definition.providersResolver =
|
18956 | (def, processProvidersFn) => {
|
18957 | return providersResolver(def,
|
18958 | processProvidersFn ? processProvidersFn(providers) : providers,
|
18959 | viewProviders);
|
18960 | };
|
18961 | };
|
18962 | }
|
18963 |
|
18964 |
|
18965 |
|
18966 |
|
18967 |
|
18968 |
|
18969 |
|
18970 |
|
18971 |
|
18972 |
|
18973 |
|
18974 |
|
18975 |
|
18976 |
|
18977 |
|
18978 | class ComponentRef {
|
18979 | }
|
18980 |
|
18981 |
|
18982 |
|
18983 |
|
18984 |
|
18985 |
|
18986 |
|
18987 |
|
18988 |
|
18989 | class ComponentFactory {
|
18990 | }
|
18991 |
|
18992 |
|
18993 |
|
18994 |
|
18995 |
|
18996 |
|
18997 |
|
18998 |
|
18999 | function noComponentFactoryError(component) {
|
19000 | const error = Error(`No component factory found for ${stringify(component)}. Did you add it to @NgModule.entryComponents?`);
|
19001 | error[ERROR_COMPONENT] = component;
|
19002 | return error;
|
19003 | }
|
19004 | const ERROR_COMPONENT = 'ngComponent';
|
19005 | function getComponent$1(error) {
|
19006 | return error[ERROR_COMPONENT];
|
19007 | }
|
19008 | class _NullComponentFactoryResolver {
|
19009 | resolveComponentFactory(component) {
|
19010 | throw noComponentFactoryError(component);
|
19011 | }
|
19012 | }
|
19013 |
|
19014 |
|
19015 |
|
19016 |
|
19017 |
|
19018 |
|
19019 |
|
19020 |
|
19021 |
|
19022 | class ComponentFactoryResolver {
|
19023 | }
|
19024 | ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
|
19025 | class CodegenComponentFactoryResolver {
|
19026 | constructor(factories, _parent, _ngModule) {
|
19027 | this._parent = _parent;
|
19028 | this._ngModule = _ngModule;
|
19029 | this._factories = new Map();
|
19030 | for (let i = 0; i < factories.length; i++) {
|
19031 | const factory = factories[i];
|
19032 | this._factories.set(factory.componentType, factory);
|
19033 | }
|
19034 | }
|
19035 | resolveComponentFactory(component) {
|
19036 | let factory = this._factories.get(component);
|
19037 | if (!factory && this._parent) {
|
19038 | factory = this._parent.resolveComponentFactory(component);
|
19039 | }
|
19040 | if (!factory) {
|
19041 | throw noComponentFactoryError(component);
|
19042 | }
|
19043 | return new ComponentFactoryBoundToModule(factory, this._ngModule);
|
19044 | }
|
19045 | }
|
19046 | class ComponentFactoryBoundToModule extends ComponentFactory {
|
19047 | constructor(factory, ngModule) {
|
19048 | super();
|
19049 | this.factory = factory;
|
19050 | this.ngModule = ngModule;
|
19051 | this.selector = factory.selector;
|
19052 | this.componentType = factory.componentType;
|
19053 | this.ngContentSelectors = factory.ngContentSelectors;
|
19054 | this.inputs = factory.inputs;
|
19055 | this.outputs = factory.outputs;
|
19056 | }
|
19057 | create(injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
19058 | return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
|
19059 | }
|
19060 | }
|
19061 |
|
19062 |
|
19063 |
|
19064 |
|
19065 |
|
19066 |
|
19067 |
|
19068 |
|
19069 | function noop(...args) {
|
19070 |
|
19071 | }
|
19072 |
|
19073 |
|
19074 |
|
19075 |
|
19076 |
|
19077 |
|
19078 |
|
19079 |
|
19080 |
|
19081 |
|
19082 |
|
19083 |
|
19084 |
|
19085 |
|
19086 |
|
19087 |
|
19088 |
|
19089 |
|
19090 |
|
19091 |
|
19092 |
|
19093 |
|
19094 |
|
19095 | class ElementRef {
|
19096 | constructor(nativeElement) {
|
19097 | this.nativeElement = nativeElement;
|
19098 | }
|
19099 | }
|
19100 |
|
19101 |
|
19102 |
|
19103 |
|
19104 | ElementRef.__NG_ELEMENT_ID__ = () => SWITCH_ELEMENT_REF_FACTORY(ElementRef);
|
19105 | const SWITCH_ELEMENT_REF_FACTORY__POST_R3__ = injectElementRef;
|
19106 | const SWITCH_ELEMENT_REF_FACTORY__PRE_R3__ = noop;
|
19107 | const SWITCH_ELEMENT_REF_FACTORY = SWITCH_ELEMENT_REF_FACTORY__PRE_R3__;
|
19108 |
|
19109 |
|
19110 |
|
19111 |
|
19112 |
|
19113 |
|
19114 |
|
19115 |
|
19116 | const Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
19117 |
|
19118 |
|
19119 |
|
19120 |
|
19121 |
|
19122 | class RendererFactory2 {
|
19123 | }
|
19124 |
|
19125 |
|
19126 |
|
19127 |
|
19128 | var RendererStyleFlags2;
|
19129 | (function (RendererStyleFlags2) {
|
19130 |
|
19131 |
|
19132 |
|
19133 | |
19134 |
|
19135 |
|
19136 | RendererStyleFlags2[RendererStyleFlags2["Important"] = 1] = "Important";
|
19137 | |
19138 |
|
19139 |
|
19140 | RendererStyleFlags2[RendererStyleFlags2["DashCase"] = 2] = "DashCase";
|
19141 | })(RendererStyleFlags2 || (RendererStyleFlags2 = {}));
|
19142 |
|
19143 |
|
19144 |
|
19145 |
|
19146 |
|
19147 |
|
19148 |
|
19149 |
|
19150 |
|
19151 |
|
19152 |
|
19153 |
|
19154 |
|
19155 |
|
19156 |
|
19157 | class Renderer2 {
|
19158 | }
|
19159 |
|
19160 |
|
19161 |
|
19162 |
|
19163 | Renderer2.__NG_ELEMENT_ID__ = () => SWITCH_RENDERER2_FACTORY();
|
19164 | const SWITCH_RENDERER2_FACTORY__POST_R3__ = injectRenderer2;
|
19165 | const SWITCH_RENDERER2_FACTORY__PRE_R3__ = noop;
|
19166 | const SWITCH_RENDERER2_FACTORY = SWITCH_RENDERER2_FACTORY__PRE_R3__;
|
19167 |
|
19168 |
|
19169 |
|
19170 |
|
19171 |
|
19172 |
|
19173 |
|
19174 |
|
19175 |
|
19176 |
|
19177 |
|
19178 |
|
19179 |
|
19180 | class Sanitizer {
|
19181 | }
|
19182 |
|
19183 | Sanitizer.ɵprov = ɵɵdefineInjectable({
|
19184 | token: Sanitizer,
|
19185 | providedIn: 'root',
|
19186 | factory: () => null,
|
19187 | });
|
19188 |
|
19189 |
|
19190 |
|
19191 |
|
19192 |
|
19193 |
|
19194 |
|
19195 |
|
19196 |
|
19197 |
|
19198 |
|
19199 |
|
19200 |
|
19201 | class Version {
|
19202 | constructor(full) {
|
19203 | this.full = full;
|
19204 | this.major = full.split('.')[0];
|
19205 | this.minor = full.split('.')[1];
|
19206 | this.patch = full.split('.').slice(2).join('.');
|
19207 | }
|
19208 | }
|
19209 |
|
19210 |
|
19211 |
|
19212 | const VERSION = new Version('10.0.10');
|
19213 |
|
19214 |
|
19215 |
|
19216 |
|
19217 |
|
19218 |
|
19219 |
|
19220 |
|
19221 | class DefaultIterableDifferFactory {
|
19222 | constructor() { }
|
19223 | supports(obj) {
|
19224 | return isListLikeIterable(obj);
|
19225 | }
|
19226 | create(trackByFn) {
|
19227 | return new DefaultIterableDiffer(trackByFn);
|
19228 | }
|
19229 | }
|
19230 | const trackByIdentity = (index, item) => item;
|
19231 | const ɵ0$c = trackByIdentity;
|
19232 |
|
19233 |
|
19234 |
|
19235 |
|
19236 | class DefaultIterableDiffer {
|
19237 | constructor(trackByFn) {
|
19238 | this.length = 0;
|
19239 |
|
19240 | this._linkedRecords = null;
|
19241 |
|
19242 | this._unlinkedRecords = null;
|
19243 | this._previousItHead = null;
|
19244 | this._itHead = null;
|
19245 | this._itTail = null;
|
19246 | this._additionsHead = null;
|
19247 | this._additionsTail = null;
|
19248 | this._movesHead = null;
|
19249 | this._movesTail = null;
|
19250 | this._removalsHead = null;
|
19251 | this._removalsTail = null;
|
19252 |
|
19253 | this._identityChangesHead = null;
|
19254 | this._identityChangesTail = null;
|
19255 | this._trackByFn = trackByFn || trackByIdentity;
|
19256 | }
|
19257 | forEachItem(fn) {
|
19258 | let record;
|
19259 | for (record = this._itHead; record !== null; record = record._next) {
|
19260 | fn(record);
|
19261 | }
|
19262 | }
|
19263 | forEachOperation(fn) {
|
19264 | let nextIt = this._itHead;
|
19265 | let nextRemove = this._removalsHead;
|
19266 | let addRemoveOffset = 0;
|
19267 | let moveOffsets = null;
|
19268 | while (nextIt || nextRemove) {
|
19269 |
|
19270 |
|
19271 | const record = !nextRemove ||
|
19272 | nextIt &&
|
19273 | nextIt.currentIndex <
|
19274 | getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ?
|
19275 | nextIt :
|
19276 | nextRemove;
|
19277 | const adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
|
19278 | const currentIndex = record.currentIndex;
|
19279 |
|
19280 | if (record === nextRemove) {
|
19281 | addRemoveOffset--;
|
19282 | nextRemove = nextRemove._nextRemoved;
|
19283 | }
|
19284 | else {
|
19285 | nextIt = nextIt._next;
|
19286 | if (record.previousIndex == null) {
|
19287 | addRemoveOffset++;
|
19288 | }
|
19289 | else {
|
19290 |
|
19291 | if (!moveOffsets)
|
19292 | moveOffsets = [];
|
19293 | const localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
|
19294 | const localCurrentIndex = currentIndex - addRemoveOffset;
|
19295 | if (localMovePreviousIndex != localCurrentIndex) {
|
19296 | for (let i = 0; i < localMovePreviousIndex; i++) {
|
19297 | const offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
|
19298 | const index = offset + i;
|
19299 | if (localCurrentIndex <= index && index < localMovePreviousIndex) {
|
19300 | moveOffsets[i] = offset + 1;
|
19301 | }
|
19302 | }
|
19303 | const previousIndex = record.previousIndex;
|
19304 | moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
|
19305 | }
|
19306 | }
|
19307 | }
|
19308 | if (adjPreviousIndex !== currentIndex) {
|
19309 | fn(record, adjPreviousIndex, currentIndex);
|
19310 | }
|
19311 | }
|
19312 | }
|
19313 | forEachPreviousItem(fn) {
|
19314 | let record;
|
19315 | for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
|
19316 | fn(record);
|
19317 | }
|
19318 | }
|
19319 | forEachAddedItem(fn) {
|
19320 | let record;
|
19321 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
19322 | fn(record);
|
19323 | }
|
19324 | }
|
19325 | forEachMovedItem(fn) {
|
19326 | let record;
|
19327 | for (record = this._movesHead; record !== null; record = record._nextMoved) {
|
19328 | fn(record);
|
19329 | }
|
19330 | }
|
19331 | forEachRemovedItem(fn) {
|
19332 | let record;
|
19333 | for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
19334 | fn(record);
|
19335 | }
|
19336 | }
|
19337 | forEachIdentityChange(fn) {
|
19338 | let record;
|
19339 | for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
|
19340 | fn(record);
|
19341 | }
|
19342 | }
|
19343 | diff(collection) {
|
19344 | if (collection == null)
|
19345 | collection = [];
|
19346 | if (!isListLikeIterable(collection)) {
|
19347 | throw new Error(`Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
|
19348 | }
|
19349 | if (this.check(collection)) {
|
19350 | return this;
|
19351 | }
|
19352 | else {
|
19353 | return null;
|
19354 | }
|
19355 | }
|
19356 | onDestroy() { }
|
19357 | check(collection) {
|
19358 | this._reset();
|
19359 | let record = this._itHead;
|
19360 | let mayBeDirty = false;
|
19361 | let index;
|
19362 | let item;
|
19363 | let itemTrackBy;
|
19364 | if (Array.isArray(collection)) {
|
19365 | this.length = collection.length;
|
19366 | for (let index = 0; index < this.length; index++) {
|
19367 | item = collection[index];
|
19368 | itemTrackBy = this._trackByFn(index, item);
|
19369 | if (record === null || !Object.is(record.trackById, itemTrackBy)) {
|
19370 | record = this._mismatch(record, item, itemTrackBy, index);
|
19371 | mayBeDirty = true;
|
19372 | }
|
19373 | else {
|
19374 | if (mayBeDirty) {
|
19375 |
|
19376 | record = this._verifyReinsertion(record, item, itemTrackBy, index);
|
19377 | }
|
19378 | if (!Object.is(record.item, item))
|
19379 | this._addIdentityChange(record, item);
|
19380 | }
|
19381 | record = record._next;
|
19382 | }
|
19383 | }
|
19384 | else {
|
19385 | index = 0;
|
19386 | iterateListLike(collection, (item) => {
|
19387 | itemTrackBy = this._trackByFn(index, item);
|
19388 | if (record === null || !Object.is(record.trackById, itemTrackBy)) {
|
19389 | record = this._mismatch(record, item, itemTrackBy, index);
|
19390 | mayBeDirty = true;
|
19391 | }
|
19392 | else {
|
19393 | if (mayBeDirty) {
|
19394 |
|
19395 | record = this._verifyReinsertion(record, item, itemTrackBy, index);
|
19396 | }
|
19397 | if (!Object.is(record.item, item))
|
19398 | this._addIdentityChange(record, item);
|
19399 | }
|
19400 | record = record._next;
|
19401 | index++;
|
19402 | });
|
19403 | this.length = index;
|
19404 | }
|
19405 | this._truncate(record);
|
19406 | this.collection = collection;
|
19407 | return this.isDirty;
|
19408 | }
|
19409 | |
19410 |
|
19411 |
|
19412 | get isDirty() {
|
19413 | return this._additionsHead !== null || this._movesHead !== null ||
|
19414 | this._removalsHead !== null || this._identityChangesHead !== null;
|
19415 | }
|
19416 | |
19417 |
|
19418 |
|
19419 |
|
19420 |
|
19421 |
|
19422 |
|
19423 |
|
19424 | _reset() {
|
19425 | if (this.isDirty) {
|
19426 | let record;
|
19427 | let nextRecord;
|
19428 | for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
|
19429 | record._nextPrevious = record._next;
|
19430 | }
|
19431 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
19432 | record.previousIndex = record.currentIndex;
|
19433 | }
|
19434 | this._additionsHead = this._additionsTail = null;
|
19435 | for (record = this._movesHead; record !== null; record = nextRecord) {
|
19436 | record.previousIndex = record.currentIndex;
|
19437 | nextRecord = record._nextMoved;
|
19438 | }
|
19439 | this._movesHead = this._movesTail = null;
|
19440 | this._removalsHead = this._removalsTail = null;
|
19441 | this._identityChangesHead = this._identityChangesTail = null;
|
19442 |
|
19443 |
|
19444 | }
|
19445 | }
|
19446 | |
19447 |
|
19448 |
|
19449 |
|
19450 |
|
19451 |
|
19452 |
|
19453 |
|
19454 |
|
19455 |
|
19456 | _mismatch(record, item, itemTrackBy, index) {
|
19457 |
|
19458 | let previousRecord;
|
19459 | if (record === null) {
|
19460 | previousRecord = this._itTail;
|
19461 | }
|
19462 | else {
|
19463 | previousRecord = record._prev;
|
19464 |
|
19465 | this._remove(record);
|
19466 | }
|
19467 |
|
19468 | record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
|
19469 | if (record !== null) {
|
19470 |
|
19471 |
|
19472 | if (!Object.is(record.item, item))
|
19473 | this._addIdentityChange(record, item);
|
19474 | this._moveAfter(record, previousRecord, index);
|
19475 | }
|
19476 | else {
|
19477 |
|
19478 | record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
19479 | if (record !== null) {
|
19480 |
|
19481 |
|
19482 | if (!Object.is(record.item, item))
|
19483 | this._addIdentityChange(record, item);
|
19484 | this._reinsertAfter(record, previousRecord, index);
|
19485 | }
|
19486 | else {
|
19487 |
|
19488 | record =
|
19489 | this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
|
19490 | }
|
19491 | }
|
19492 | return record;
|
19493 | }
|
19494 | |
19495 |
|
19496 |
|
19497 |
|
19498 |
|
19499 |
|
19500 |
|
19501 |
|
19502 |
|
19503 |
|
19504 |
|
19505 |
|
19506 |
|
19507 |
|
19508 |
|
19509 |
|
19510 |
|
19511 |
|
19512 |
|
19513 |
|
19514 |
|
19515 |
|
19516 |
|
19517 |
|
19518 |
|
19519 |
|
19520 |
|
19521 | _verifyReinsertion(record, item, itemTrackBy, index) {
|
19522 | let reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
19523 | if (reinsertRecord !== null) {
|
19524 | record = this._reinsertAfter(reinsertRecord, record._prev, index);
|
19525 | }
|
19526 | else if (record.currentIndex != index) {
|
19527 | record.currentIndex = index;
|
19528 | this._addToMoves(record, index);
|
19529 | }
|
19530 | return record;
|
19531 | }
|
19532 | |
19533 |
|
19534 |
|
19535 |
|
19536 |
|
19537 |
|
19538 |
|
19539 | _truncate(record) {
|
19540 |
|
19541 | while (record !== null) {
|
19542 | const nextRecord = record._next;
|
19543 | this._addToRemovals(this._unlink(record));
|
19544 | record = nextRecord;
|
19545 | }
|
19546 | if (this._unlinkedRecords !== null) {
|
19547 | this._unlinkedRecords.clear();
|
19548 | }
|
19549 | if (this._additionsTail !== null) {
|
19550 | this._additionsTail._nextAdded = null;
|
19551 | }
|
19552 | if (this._movesTail !== null) {
|
19553 | this._movesTail._nextMoved = null;
|
19554 | }
|
19555 | if (this._itTail !== null) {
|
19556 | this._itTail._next = null;
|
19557 | }
|
19558 | if (this._removalsTail !== null) {
|
19559 | this._removalsTail._nextRemoved = null;
|
19560 | }
|
19561 | if (this._identityChangesTail !== null) {
|
19562 | this._identityChangesTail._nextIdentityChange = null;
|
19563 | }
|
19564 | }
|
19565 |
|
19566 | _reinsertAfter(record, prevRecord, index) {
|
19567 | if (this._unlinkedRecords !== null) {
|
19568 | this._unlinkedRecords.remove(record);
|
19569 | }
|
19570 | const prev = record._prevRemoved;
|
19571 | const next = record._nextRemoved;
|
19572 | if (prev === null) {
|
19573 | this._removalsHead = next;
|
19574 | }
|
19575 | else {
|
19576 | prev._nextRemoved = next;
|
19577 | }
|
19578 | if (next === null) {
|
19579 | this._removalsTail = prev;
|
19580 | }
|
19581 | else {
|
19582 | next._prevRemoved = prev;
|
19583 | }
|
19584 | this._insertAfter(record, prevRecord, index);
|
19585 | this._addToMoves(record, index);
|
19586 | return record;
|
19587 | }
|
19588 |
|
19589 | _moveAfter(record, prevRecord, index) {
|
19590 | this._unlink(record);
|
19591 | this._insertAfter(record, prevRecord, index);
|
19592 | this._addToMoves(record, index);
|
19593 | return record;
|
19594 | }
|
19595 |
|
19596 | _addAfter(record, prevRecord, index) {
|
19597 | this._insertAfter(record, prevRecord, index);
|
19598 | if (this._additionsTail === null) {
|
19599 |
|
19600 |
|
19601 | this._additionsTail = this._additionsHead = record;
|
19602 | }
|
19603 | else {
|
19604 |
|
19605 |
|
19606 |
|
19607 | this._additionsTail = this._additionsTail._nextAdded = record;
|
19608 | }
|
19609 | return record;
|
19610 | }
|
19611 |
|
19612 | _insertAfter(record, prevRecord, index) {
|
19613 |
|
19614 |
|
19615 |
|
19616 |
|
19617 | const next = prevRecord === null ? this._itHead : prevRecord._next;
|
19618 |
|
19619 |
|
19620 |
|
19621 | record._next = next;
|
19622 | record._prev = prevRecord;
|
19623 | if (next === null) {
|
19624 | this._itTail = record;
|
19625 | }
|
19626 | else {
|
19627 | next._prev = record;
|
19628 | }
|
19629 | if (prevRecord === null) {
|
19630 | this._itHead = record;
|
19631 | }
|
19632 | else {
|
19633 | prevRecord._next = record;
|
19634 | }
|
19635 | if (this._linkedRecords === null) {
|
19636 | this._linkedRecords = new _DuplicateMap();
|
19637 | }
|
19638 | this._linkedRecords.put(record);
|
19639 | record.currentIndex = index;
|
19640 | return record;
|
19641 | }
|
19642 |
|
19643 | _remove(record) {
|
19644 | return this._addToRemovals(this._unlink(record));
|
19645 | }
|
19646 |
|
19647 | _unlink(record) {
|
19648 | if (this._linkedRecords !== null) {
|
19649 | this._linkedRecords.remove(record);
|
19650 | }
|
19651 | const prev = record._prev;
|
19652 | const next = record._next;
|
19653 |
|
19654 |
|
19655 |
|
19656 | if (prev === null) {
|
19657 | this._itHead = next;
|
19658 | }
|
19659 | else {
|
19660 | prev._next = next;
|
19661 | }
|
19662 | if (next === null) {
|
19663 | this._itTail = prev;
|
19664 | }
|
19665 | else {
|
19666 | next._prev = prev;
|
19667 | }
|
19668 | return record;
|
19669 | }
|
19670 |
|
19671 | _addToMoves(record, toIndex) {
|
19672 |
|
19673 |
|
19674 | if (record.previousIndex === toIndex) {
|
19675 | return record;
|
19676 | }
|
19677 | if (this._movesTail === null) {
|
19678 |
|
19679 |
|
19680 | this._movesTail = this._movesHead = record;
|
19681 | }
|
19682 | else {
|
19683 |
|
19684 |
|
19685 | this._movesTail = this._movesTail._nextMoved = record;
|
19686 | }
|
19687 | return record;
|
19688 | }
|
19689 | _addToRemovals(record) {
|
19690 | if (this._unlinkedRecords === null) {
|
19691 | this._unlinkedRecords = new _DuplicateMap();
|
19692 | }
|
19693 | this._unlinkedRecords.put(record);
|
19694 | record.currentIndex = null;
|
19695 | record._nextRemoved = null;
|
19696 | if (this._removalsTail === null) {
|
19697 |
|
19698 |
|
19699 | this._removalsTail = this._removalsHead = record;
|
19700 | record._prevRemoved = null;
|
19701 | }
|
19702 | else {
|
19703 |
|
19704 |
|
19705 |
|
19706 | record._prevRemoved = this._removalsTail;
|
19707 | this._removalsTail = this._removalsTail._nextRemoved = record;
|
19708 | }
|
19709 | return record;
|
19710 | }
|
19711 |
|
19712 | _addIdentityChange(record, item) {
|
19713 | record.item = item;
|
19714 | if (this._identityChangesTail === null) {
|
19715 | this._identityChangesTail = this._identityChangesHead = record;
|
19716 | }
|
19717 | else {
|
19718 | this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
|
19719 | }
|
19720 | return record;
|
19721 | }
|
19722 | }
|
19723 | class IterableChangeRecord_ {
|
19724 | constructor(item, trackById) {
|
19725 | this.item = item;
|
19726 | this.trackById = trackById;
|
19727 | this.currentIndex = null;
|
19728 | this.previousIndex = null;
|
19729 |
|
19730 | this._nextPrevious = null;
|
19731 |
|
19732 | this._prev = null;
|
19733 |
|
19734 | this._next = null;
|
19735 |
|
19736 | this._prevDup = null;
|
19737 |
|
19738 | this._nextDup = null;
|
19739 |
|
19740 | this._prevRemoved = null;
|
19741 |
|
19742 | this._nextRemoved = null;
|
19743 |
|
19744 | this._nextAdded = null;
|
19745 |
|
19746 | this._nextMoved = null;
|
19747 |
|
19748 | this._nextIdentityChange = null;
|
19749 | }
|
19750 | }
|
19751 |
|
19752 | class _DuplicateItemRecordList {
|
19753 | constructor() {
|
19754 |
|
19755 | this._head = null;
|
19756 |
|
19757 | this._tail = null;
|
19758 | }
|
19759 | |
19760 |
|
19761 |
|
19762 |
|
19763 |
|
19764 | add(record) {
|
19765 | if (this._head === null) {
|
19766 | this._head = this._tail = record;
|
19767 | record._nextDup = null;
|
19768 | record._prevDup = null;
|
19769 | }
|
19770 | else {
|
19771 |
|
19772 |
|
19773 |
|
19774 | this._tail._nextDup = record;
|
19775 | record._prevDup = this._tail;
|
19776 | record._nextDup = null;
|
19777 | this._tail = record;
|
19778 | }
|
19779 | }
|
19780 |
|
19781 |
|
19782 | get(trackById, atOrAfterIndex) {
|
19783 | let record;
|
19784 | for (record = this._head; record !== null; record = record._nextDup) {
|
19785 | if ((atOrAfterIndex === null || atOrAfterIndex <= record.currentIndex) &&
|
19786 | Object.is(record.trackById, trackById)) {
|
19787 | return record;
|
19788 | }
|
19789 | }
|
19790 | return null;
|
19791 | }
|
19792 | |
19793 |
|
19794 |
|
19795 |
|
19796 |
|
19797 | remove(record) {
|
19798 |
|
19799 |
|
19800 |
|
19801 |
|
19802 |
|
19803 |
|
19804 |
|
19805 |
|
19806 | const prev = record._prevDup;
|
19807 | const next = record._nextDup;
|
19808 | if (prev === null) {
|
19809 | this._head = next;
|
19810 | }
|
19811 | else {
|
19812 | prev._nextDup = next;
|
19813 | }
|
19814 | if (next === null) {
|
19815 | this._tail = prev;
|
19816 | }
|
19817 | else {
|
19818 | next._prevDup = prev;
|
19819 | }
|
19820 | return this._head === null;
|
19821 | }
|
19822 | }
|
19823 | class _DuplicateMap {
|
19824 | constructor() {
|
19825 | this.map = new Map();
|
19826 | }
|
19827 | put(record) {
|
19828 | const key = record.trackById;
|
19829 | let duplicates = this.map.get(key);
|
19830 | if (!duplicates) {
|
19831 | duplicates = new _DuplicateItemRecordList();
|
19832 | this.map.set(key, duplicates);
|
19833 | }
|
19834 | duplicates.add(record);
|
19835 | }
|
19836 | |
19837 |
|
19838 |
|
19839 |
|
19840 |
|
19841 |
|
19842 |
|
19843 | get(trackById, atOrAfterIndex) {
|
19844 | const key = trackById;
|
19845 | const recordList = this.map.get(key);
|
19846 | return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
|
19847 | }
|
19848 | |
19849 |
|
19850 |
|
19851 |
|
19852 |
|
19853 | remove(record) {
|
19854 | const key = record.trackById;
|
19855 | const recordList = this.map.get(key);
|
19856 |
|
19857 | if (recordList.remove(record)) {
|
19858 | this.map.delete(key);
|
19859 | }
|
19860 | return record;
|
19861 | }
|
19862 | get isEmpty() {
|
19863 | return this.map.size === 0;
|
19864 | }
|
19865 | clear() {
|
19866 | this.map.clear();
|
19867 | }
|
19868 | }
|
19869 | function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
|
19870 | const previousIndex = item.previousIndex;
|
19871 | if (previousIndex === null)
|
19872 | return previousIndex;
|
19873 | let moveOffset = 0;
|
19874 | if (moveOffsets && previousIndex < moveOffsets.length) {
|
19875 | moveOffset = moveOffsets[previousIndex];
|
19876 | }
|
19877 | return previousIndex + addRemoveOffset + moveOffset;
|
19878 | }
|
19879 |
|
19880 |
|
19881 |
|
19882 |
|
19883 |
|
19884 |
|
19885 |
|
19886 |
|
19887 | class DefaultKeyValueDifferFactory {
|
19888 | constructor() { }
|
19889 | supports(obj) {
|
19890 | return obj instanceof Map || isJsObject(obj);
|
19891 | }
|
19892 | create() {
|
19893 | return new DefaultKeyValueDiffer();
|
19894 | }
|
19895 | }
|
19896 | class DefaultKeyValueDiffer {
|
19897 | constructor() {
|
19898 | this._records = new Map();
|
19899 | this._mapHead = null;
|
19900 |
|
19901 | this._appendAfter = null;
|
19902 | this._previousMapHead = null;
|
19903 | this._changesHead = null;
|
19904 | this._changesTail = null;
|
19905 | this._additionsHead = null;
|
19906 | this._additionsTail = null;
|
19907 | this._removalsHead = null;
|
19908 | this._removalsTail = null;
|
19909 | }
|
19910 | get isDirty() {
|
19911 | return this._additionsHead !== null || this._changesHead !== null ||
|
19912 | this._removalsHead !== null;
|
19913 | }
|
19914 | forEachItem(fn) {
|
19915 | let record;
|
19916 | for (record = this._mapHead; record !== null; record = record._next) {
|
19917 | fn(record);
|
19918 | }
|
19919 | }
|
19920 | forEachPreviousItem(fn) {
|
19921 | let record;
|
19922 | for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
|
19923 | fn(record);
|
19924 | }
|
19925 | }
|
19926 | forEachChangedItem(fn) {
|
19927 | let record;
|
19928 | for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
19929 | fn(record);
|
19930 | }
|
19931 | }
|
19932 | forEachAddedItem(fn) {
|
19933 | let record;
|
19934 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
19935 | fn(record);
|
19936 | }
|
19937 | }
|
19938 | forEachRemovedItem(fn) {
|
19939 | let record;
|
19940 | for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
19941 | fn(record);
|
19942 | }
|
19943 | }
|
19944 | diff(map) {
|
19945 | if (!map) {
|
19946 | map = new Map();
|
19947 | }
|
19948 | else if (!(map instanceof Map || isJsObject(map))) {
|
19949 | throw new Error(`Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
|
19950 | }
|
19951 | return this.check(map) ? this : null;
|
19952 | }
|
19953 | onDestroy() { }
|
19954 | |
19955 |
|
19956 |
|
19957 |
|
19958 | check(map) {
|
19959 | this._reset();
|
19960 | let insertBefore = this._mapHead;
|
19961 | this._appendAfter = null;
|
19962 | this._forEach(map, (value, key) => {
|
19963 | if (insertBefore && insertBefore.key === key) {
|
19964 | this._maybeAddToChanges(insertBefore, value);
|
19965 | this._appendAfter = insertBefore;
|
19966 | insertBefore = insertBefore._next;
|
19967 | }
|
19968 | else {
|
19969 | const record = this._getOrCreateRecordForKey(key, value);
|
19970 | insertBefore = this._insertBeforeOrAppend(insertBefore, record);
|
19971 | }
|
19972 | });
|
19973 |
|
19974 | if (insertBefore) {
|
19975 | if (insertBefore._prev) {
|
19976 | insertBefore._prev._next = null;
|
19977 | }
|
19978 | this._removalsHead = insertBefore;
|
19979 | for (let record = insertBefore; record !== null; record = record._nextRemoved) {
|
19980 | if (record === this._mapHead) {
|
19981 | this._mapHead = null;
|
19982 | }
|
19983 | this._records.delete(record.key);
|
19984 | record._nextRemoved = record._next;
|
19985 | record.previousValue = record.currentValue;
|
19986 | record.currentValue = null;
|
19987 | record._prev = null;
|
19988 | record._next = null;
|
19989 | }
|
19990 | }
|
19991 |
|
19992 | if (this._changesTail)
|
19993 | this._changesTail._nextChanged = null;
|
19994 | if (this._additionsTail)
|
19995 | this._additionsTail._nextAdded = null;
|
19996 | return this.isDirty;
|
19997 | }
|
19998 | |
19999 |
|
20000 |
|
20001 |
|
20002 |
|
20003 |
|
20004 |
|
20005 |
|
20006 | _insertBeforeOrAppend(before, record) {
|
20007 | if (before) {
|
20008 | const prev = before._prev;
|
20009 | record._next = before;
|
20010 | record._prev = prev;
|
20011 | before._prev = record;
|
20012 | if (prev) {
|
20013 | prev._next = record;
|
20014 | }
|
20015 | if (before === this._mapHead) {
|
20016 | this._mapHead = record;
|
20017 | }
|
20018 | this._appendAfter = before;
|
20019 | return before;
|
20020 | }
|
20021 | if (this._appendAfter) {
|
20022 | this._appendAfter._next = record;
|
20023 | record._prev = this._appendAfter;
|
20024 | }
|
20025 | else {
|
20026 | this._mapHead = record;
|
20027 | }
|
20028 | this._appendAfter = record;
|
20029 | return null;
|
20030 | }
|
20031 | _getOrCreateRecordForKey(key, value) {
|
20032 | if (this._records.has(key)) {
|
20033 | const record = this._records.get(key);
|
20034 | this._maybeAddToChanges(record, value);
|
20035 | const prev = record._prev;
|
20036 | const next = record._next;
|
20037 | if (prev) {
|
20038 | prev._next = next;
|
20039 | }
|
20040 | if (next) {
|
20041 | next._prev = prev;
|
20042 | }
|
20043 | record._next = null;
|
20044 | record._prev = null;
|
20045 | return record;
|
20046 | }
|
20047 | const record = new KeyValueChangeRecord_(key);
|
20048 | this._records.set(key, record);
|
20049 | record.currentValue = value;
|
20050 | this._addToAdditions(record);
|
20051 | return record;
|
20052 | }
|
20053 |
|
20054 | _reset() {
|
20055 | if (this.isDirty) {
|
20056 | let record;
|
20057 |
|
20058 | this._previousMapHead = this._mapHead;
|
20059 | for (record = this._previousMapHead; record !== null; record = record._next) {
|
20060 | record._nextPrevious = record._next;
|
20061 | }
|
20062 |
|
20063 |
|
20064 | for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
20065 | record.previousValue = record.currentValue;
|
20066 | }
|
20067 | for (record = this._additionsHead; record != null; record = record._nextAdded) {
|
20068 | record.previousValue = record.currentValue;
|
20069 | }
|
20070 | this._changesHead = this._changesTail = null;
|
20071 | this._additionsHead = this._additionsTail = null;
|
20072 | this._removalsHead = null;
|
20073 | }
|
20074 | }
|
20075 |
|
20076 | _maybeAddToChanges(record, newValue) {
|
20077 | if (!Object.is(newValue, record.currentValue)) {
|
20078 | record.previousValue = record.currentValue;
|
20079 | record.currentValue = newValue;
|
20080 | this._addToChanges(record);
|
20081 | }
|
20082 | }
|
20083 | _addToAdditions(record) {
|
20084 | if (this._additionsHead === null) {
|
20085 | this._additionsHead = this._additionsTail = record;
|
20086 | }
|
20087 | else {
|
20088 | this._additionsTail._nextAdded = record;
|
20089 | this._additionsTail = record;
|
20090 | }
|
20091 | }
|
20092 | _addToChanges(record) {
|
20093 | if (this._changesHead === null) {
|
20094 | this._changesHead = this._changesTail = record;
|
20095 | }
|
20096 | else {
|
20097 | this._changesTail._nextChanged = record;
|
20098 | this._changesTail = record;
|
20099 | }
|
20100 | }
|
20101 |
|
20102 | _forEach(obj, fn) {
|
20103 | if (obj instanceof Map) {
|
20104 | obj.forEach(fn);
|
20105 | }
|
20106 | else {
|
20107 | Object.keys(obj).forEach(k => fn(obj[k], k));
|
20108 | }
|
20109 | }
|
20110 | }
|
20111 | class KeyValueChangeRecord_ {
|
20112 | constructor(key) {
|
20113 | this.key = key;
|
20114 | this.previousValue = null;
|
20115 | this.currentValue = null;
|
20116 |
|
20117 | this._nextPrevious = null;
|
20118 |
|
20119 | this._next = null;
|
20120 |
|
20121 | this._prev = null;
|
20122 |
|
20123 | this._nextAdded = null;
|
20124 |
|
20125 | this._nextRemoved = null;
|
20126 |
|
20127 | this._nextChanged = null;
|
20128 | }
|
20129 | }
|
20130 |
|
20131 |
|
20132 |
|
20133 |
|
20134 |
|
20135 |
|
20136 |
|
20137 |
|
20138 |
|
20139 |
|
20140 |
|
20141 |
|
20142 |
|
20143 | class IterableDiffers {
|
20144 | constructor(factories) {
|
20145 | this.factories = factories;
|
20146 | }
|
20147 | static create(factories, parent) {
|
20148 | if (parent != null) {
|
20149 | const copied = parent.factories.slice();
|
20150 | factories = factories.concat(copied);
|
20151 | }
|
20152 | return new IterableDiffers(factories);
|
20153 | }
|
20154 | |
20155 |
|
20156 |
|
20157 |
|
20158 |
|
20159 |
|
20160 |
|
20161 |
|
20162 |
|
20163 |
|
20164 |
|
20165 |
|
20166 |
|
20167 |
|
20168 |
|
20169 |
|
20170 |
|
20171 |
|
20172 |
|
20173 |
|
20174 | static extend(factories) {
|
20175 | return {
|
20176 | provide: IterableDiffers,
|
20177 | useFactory: (parent) => {
|
20178 | if (!parent) {
|
20179 |
|
20180 |
|
20181 |
|
20182 | throw new Error('Cannot extend IterableDiffers without a parent injector');
|
20183 | }
|
20184 | return IterableDiffers.create(factories, parent);
|
20185 | },
|
20186 |
|
20187 | deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
|
20188 | };
|
20189 | }
|
20190 | find(iterable) {
|
20191 | const factory = this.factories.find(f => f.supports(iterable));
|
20192 | if (factory != null) {
|
20193 | return factory;
|
20194 | }
|
20195 | else {
|
20196 | throw new Error(`Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
|
20197 | }
|
20198 | }
|
20199 | }
|
20200 |
|
20201 | IterableDiffers.ɵprov = ɵɵdefineInjectable({
|
20202 | token: IterableDiffers,
|
20203 | providedIn: 'root',
|
20204 | factory: () => new IterableDiffers([new DefaultIterableDifferFactory()])
|
20205 | });
|
20206 | function getTypeNameForDebugging(type) {
|
20207 | return type['name'] || typeof type;
|
20208 | }
|
20209 |
|
20210 |
|
20211 |
|
20212 |
|
20213 |
|
20214 |
|
20215 |
|
20216 |
|
20217 |
|
20218 |
|
20219 |
|
20220 |
|
20221 |
|
20222 | class KeyValueDiffers {
|
20223 | constructor(factories) {
|
20224 | this.factories = factories;
|
20225 | }
|
20226 | static create(factories, parent) {
|
20227 | if (parent) {
|
20228 | const copied = parent.factories.slice();
|
20229 | factories = factories.concat(copied);
|
20230 | }
|
20231 | return new KeyValueDiffers(factories);
|
20232 | }
|
20233 | |
20234 |
|
20235 |
|
20236 |
|
20237 |
|
20238 |
|
20239 |
|
20240 |
|
20241 |
|
20242 |
|
20243 |
|
20244 |
|
20245 |
|
20246 |
|
20247 |
|
20248 |
|
20249 |
|
20250 |
|
20251 |
|
20252 |
|
20253 | static extend(factories) {
|
20254 | return {
|
20255 | provide: KeyValueDiffers,
|
20256 | useFactory: (parent) => {
|
20257 | if (!parent) {
|
20258 |
|
20259 |
|
20260 | throw new Error('Cannot extend KeyValueDiffers without a parent injector');
|
20261 | }
|
20262 | return KeyValueDiffers.create(factories, parent);
|
20263 | },
|
20264 |
|
20265 | deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
|
20266 | };
|
20267 | }
|
20268 | find(kv) {
|
20269 | const factory = this.factories.find(f => f.supports(kv));
|
20270 | if (factory) {
|
20271 | return factory;
|
20272 | }
|
20273 | throw new Error(`Cannot find a differ supporting object '${kv}'`);
|
20274 | }
|
20275 | }
|
20276 |
|
20277 | KeyValueDiffers.ɵprov = ɵɵdefineInjectable({
|
20278 | token: KeyValueDiffers,
|
20279 | providedIn: 'root',
|
20280 | factory: () => new KeyValueDiffers([new DefaultKeyValueDifferFactory()])
|
20281 | });
|
20282 |
|
20283 |
|
20284 |
|
20285 |
|
20286 |
|
20287 |
|
20288 |
|
20289 |
|
20290 |
|
20291 |
|
20292 |
|
20293 | const keyValDiff = [new DefaultKeyValueDifferFactory()];
|
20294 |
|
20295 |
|
20296 |
|
20297 | const iterableDiff = [new DefaultIterableDifferFactory()];
|
20298 | const defaultIterableDiffers = new IterableDiffers(iterableDiff);
|
20299 | const defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
|
20300 |
|
20301 |
|
20302 |
|
20303 |
|
20304 |
|
20305 |
|
20306 |
|
20307 |
|
20308 |
|
20309 |
|
20310 |
|
20311 |
|
20312 |
|
20313 |
|
20314 |
|
20315 |
|
20316 |
|
20317 |
|
20318 |
|
20319 |
|
20320 |
|
20321 |
|
20322 |
|
20323 |
|
20324 |
|
20325 |
|
20326 | class TemplateRef {
|
20327 | }
|
20328 |
|
20329 |
|
20330 |
|
20331 |
|
20332 | TemplateRef.__NG_ELEMENT_ID__ = () => SWITCH_TEMPLATE_REF_FACTORY(TemplateRef, ElementRef);
|
20333 | const SWITCH_TEMPLATE_REF_FACTORY__POST_R3__ = injectTemplateRef;
|
20334 | const SWITCH_TEMPLATE_REF_FACTORY__PRE_R3__ = noop;
|
20335 | const SWITCH_TEMPLATE_REF_FACTORY = SWITCH_TEMPLATE_REF_FACTORY__PRE_R3__;
|
20336 |
|
20337 |
|
20338 |
|
20339 |
|
20340 |
|
20341 |
|
20342 |
|
20343 |
|
20344 |
|
20345 |
|
20346 |
|
20347 |
|
20348 |
|
20349 |
|
20350 |
|
20351 |
|
20352 |
|
20353 |
|
20354 |
|
20355 |
|
20356 |
|
20357 |
|
20358 |
|
20359 | class ViewContainerRef {
|
20360 | }
|
20361 |
|
20362 |
|
20363 |
|
20364 |
|
20365 | ViewContainerRef.__NG_ELEMENT_ID__ = () => SWITCH_VIEW_CONTAINER_REF_FACTORY(ViewContainerRef, ElementRef);
|
20366 | const SWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__ = injectViewContainerRef;
|
20367 | const SWITCH_VIEW_CONTAINER_REF_FACTORY__PRE_R3__ = noop;
|
20368 | const SWITCH_VIEW_CONTAINER_REF_FACTORY = SWITCH_VIEW_CONTAINER_REF_FACTORY__PRE_R3__;
|
20369 |
|
20370 |
|
20371 |
|
20372 |
|
20373 |
|
20374 |
|
20375 |
|
20376 |
|
20377 | function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
|
20378 | let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '${oldValue}'. Current value: '${currValue}'.`;
|
20379 | if (isFirstCheck) {
|
20380 | msg +=
|
20381 | ` It seems like the view has been created after its parent and its children have been dirty checked.` +
|
20382 | ` Has it been created in a change detection hook ?`;
|
20383 | }
|
20384 | return viewDebugError(msg, context);
|
20385 | }
|
20386 | function viewWrappedDebugError(err, context) {
|
20387 | if (!(err instanceof Error)) {
|
20388 |
|
20389 |
|
20390 | err = new Error(err.toString());
|
20391 | }
|
20392 | _addDebugContext(err, context);
|
20393 | return err;
|
20394 | }
|
20395 | function viewDebugError(msg, context) {
|
20396 | const err = new Error(msg);
|
20397 | _addDebugContext(err, context);
|
20398 | return err;
|
20399 | }
|
20400 | function _addDebugContext(err, context) {
|
20401 | err[ERROR_DEBUG_CONTEXT] = context;
|
20402 | err[ERROR_LOGGER] = context.logError.bind(context);
|
20403 | }
|
20404 | function isViewDebugError(err) {
|
20405 | return !!getDebugContext(err);
|
20406 | }
|
20407 | function viewDestroyedError(action) {
|
20408 | return new Error(`ViewDestroyedError: Attempt to use a destroyed view: ${action}`);
|
20409 | }
|
20410 |
|
20411 |
|
20412 |
|
20413 |
|
20414 |
|
20415 |
|
20416 |
|
20417 |
|
20418 |
|
20419 |
|
20420 |
|
20421 |
|
20422 | function shiftInitState(view, priorInitState, newInitState) {
|
20423 |
|
20424 |
|
20425 |
|
20426 |
|
20427 |
|
20428 |
|
20429 |
|
20430 |
|
20431 |
|
20432 | const state = view.state;
|
20433 | const initState = state & 1792 ;
|
20434 | if (initState === priorInitState) {
|
20435 | view.state = (state & ~1792 ) | newInitState;
|
20436 | view.initIndex = -1;
|
20437 | return true;
|
20438 | }
|
20439 | return initState === newInitState;
|
20440 | }
|
20441 |
|
20442 |
|
20443 | function shouldCallLifecycleInitHook(view, initState, index) {
|
20444 | if ((view.state & 1792 ) === initState && view.initIndex <= index) {
|
20445 | view.initIndex = index + 1;
|
20446 | return true;
|
20447 | }
|
20448 | return false;
|
20449 | }
|
20450 |
|
20451 |
|
20452 |
|
20453 |
|
20454 |
|
20455 |
|
20456 |
|
20457 |
|
20458 |
|
20459 |
|
20460 |
|
20461 | class NodeData {
|
20462 | }
|
20463 |
|
20464 |
|
20465 |
|
20466 | function asTextData(view, index) {
|
20467 | return view.nodes[index];
|
20468 | }
|
20469 |
|
20470 |
|
20471 |
|
20472 | function asElementData(view, index) {
|
20473 | return view.nodes[index];
|
20474 | }
|
20475 |
|
20476 |
|
20477 |
|
20478 | function asProviderData(view, index) {
|
20479 | return view.nodes[index];
|
20480 | }
|
20481 |
|
20482 |
|
20483 |
|
20484 | function asPureExpressionData(view, index) {
|
20485 | return view.nodes[index];
|
20486 | }
|
20487 |
|
20488 |
|
20489 |
|
20490 | function asQueryList(view, index) {
|
20491 | return view.nodes[index];
|
20492 | }
|
20493 | class DebugContext {
|
20494 | }
|
20495 |
|
20496 |
|
20497 |
|
20498 |
|
20499 | const Services = {
|
20500 | setCurrentNode: undefined,
|
20501 | createRootView: undefined,
|
20502 | createEmbeddedView: undefined,
|
20503 | createComponentView: undefined,
|
20504 | createNgModuleRef: undefined,
|
20505 | overrideProvider: undefined,
|
20506 | overrideComponentView: undefined,
|
20507 | clearOverrides: undefined,
|
20508 | checkAndUpdateView: undefined,
|
20509 | checkNoChangesView: undefined,
|
20510 | destroyView: undefined,
|
20511 | resolveDep: undefined,
|
20512 | createDebugContext: undefined,
|
20513 | handleEvent: undefined,
|
20514 | updateDirectives: undefined,
|
20515 | updateRenderer: undefined,
|
20516 | dirtyParentQueries: undefined,
|
20517 | };
|
20518 |
|
20519 |
|
20520 |
|
20521 |
|
20522 |
|
20523 |
|
20524 |
|
20525 |
|
20526 | const NOOP = () => { };
|
20527 | const _tokenKeyCache = new Map();
|
20528 | function tokenKey(token) {
|
20529 | let key = _tokenKeyCache.get(token);
|
20530 | if (!key) {
|
20531 | key = stringify(token) + '_' + _tokenKeyCache.size;
|
20532 | _tokenKeyCache.set(token, key);
|
20533 | }
|
20534 | return key;
|
20535 | }
|
20536 | function unwrapValue(view, nodeIdx, bindingIdx, value) {
|
20537 | if (WrappedValue.isWrapped(value)) {
|
20538 | value = WrappedValue.unwrap(value);
|
20539 | const globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx;
|
20540 | const oldValue = WrappedValue.unwrap(view.oldValues[globalBindingIdx]);
|
20541 | view.oldValues[globalBindingIdx] = new WrappedValue(oldValue);
|
20542 | }
|
20543 | return value;
|
20544 | }
|
20545 | const UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
|
20546 | const EMPTY_RENDERER_TYPE_ID = '$$empty';
|
20547 |
|
20548 |
|
20549 | function createRendererType2(values) {
|
20550 | return {
|
20551 | id: UNDEFINED_RENDERER_TYPE_ID,
|
20552 | styles: values.styles,
|
20553 | encapsulation: values.encapsulation,
|
20554 | data: values.data
|
20555 | };
|
20556 | }
|
20557 | let _renderCompCount$1 = 0;
|
20558 | function resolveRendererType2(type) {
|
20559 | if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
|
20560 |
|
20561 | const isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation$1.None) ||
|
20562 | type.styles.length || Object.keys(type.data).length);
|
20563 | if (isFilled) {
|
20564 | type.id = `c${_renderCompCount$1++}`;
|
20565 | }
|
20566 | else {
|
20567 | type.id = EMPTY_RENDERER_TYPE_ID;
|
20568 | }
|
20569 | }
|
20570 | if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
|
20571 | type = null;
|
20572 | }
|
20573 | return type || null;
|
20574 | }
|
20575 | function checkBinding(view, def, bindingIdx, value) {
|
20576 | const oldValues = view.oldValues;
|
20577 | if ((view.state & 2 ) ||
|
20578 | !Object.is(oldValues[def.bindingIndex + bindingIdx], value)) {
|
20579 | return true;
|
20580 | }
|
20581 | return false;
|
20582 | }
|
20583 | function checkAndUpdateBinding(view, def, bindingIdx, value) {
|
20584 | if (checkBinding(view, def, bindingIdx, value)) {
|
20585 | view.oldValues[def.bindingIndex + bindingIdx] = value;
|
20586 | return true;
|
20587 | }
|
20588 | return false;
|
20589 | }
|
20590 | function checkBindingNoChanges(view, def, bindingIdx, value) {
|
20591 | const oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
20592 | if ((view.state & 1 ) || !devModeEqual(oldValue, value)) {
|
20593 | const bindingName = def.bindings[bindingIdx].name;
|
20594 | throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.nodeIndex), `${bindingName}: ${oldValue}`, `${bindingName}: ${value}`, (view.state & 1 ) !== 0);
|
20595 | }
|
20596 | }
|
20597 | function markParentViewsForCheck(view) {
|
20598 | let currView = view;
|
20599 | while (currView) {
|
20600 | if (currView.def.flags & 2 ) {
|
20601 | currView.state |= 8 ;
|
20602 | }
|
20603 | currView = currView.viewContainerParent || currView.parent;
|
20604 | }
|
20605 | }
|
20606 | function markParentViewsForCheckProjectedViews(view, endView) {
|
20607 | let currView = view;
|
20608 | while (currView && currView !== endView) {
|
20609 | currView.state |= 64 ;
|
20610 | currView = currView.viewContainerParent || currView.parent;
|
20611 | }
|
20612 | }
|
20613 | function dispatchEvent(view, nodeIndex, eventName, event) {
|
20614 | try {
|
20615 | const nodeDef = view.def.nodes[nodeIndex];
|
20616 | const startView = nodeDef.flags & 33554432 ?
|
20617 | asElementData(view, nodeIndex).componentView :
|
20618 | view;
|
20619 | markParentViewsForCheck(startView);
|
20620 | return Services.handleEvent(view, nodeIndex, eventName, event);
|
20621 | }
|
20622 | catch (e) {
|
20623 |
|
20624 | view.root.errorHandler.handleError(e);
|
20625 | }
|
20626 | }
|
20627 | function declaredViewContainer(view) {
|
20628 | if (view.parent) {
|
20629 | const parentView = view.parent;
|
20630 | return asElementData(parentView, view.parentNodeDef.nodeIndex);
|
20631 | }
|
20632 | return null;
|
20633 | }
|
20634 |
|
20635 |
|
20636 |
|
20637 |
|
20638 |
|
20639 | function viewParentEl(view) {
|
20640 | const parentView = view.parent;
|
20641 | if (parentView) {
|
20642 | return view.parentNodeDef.parent;
|
20643 | }
|
20644 | else {
|
20645 | return null;
|
20646 | }
|
20647 | }
|
20648 | function renderNode(view, def) {
|
20649 | switch (def.flags & 201347067 ) {
|
20650 | case 1 :
|
20651 | return asElementData(view, def.nodeIndex).renderElement;
|
20652 | case 2 :
|
20653 | return asTextData(view, def.nodeIndex).renderText;
|
20654 | }
|
20655 | }
|
20656 | function elementEventFullName(target, name) {
|
20657 | return target ? `${target}:${name}` : name;
|
20658 | }
|
20659 | function isComponentView(view) {
|
20660 | return !!view.parent && !!(view.parentNodeDef.flags & 32768 );
|
20661 | }
|
20662 | function isEmbeddedView(view) {
|
20663 | return !!view.parent && !(view.parentNodeDef.flags & 32768 );
|
20664 | }
|
20665 | function filterQueryId(queryId) {
|
20666 | return 1 << (queryId % 32);
|
20667 | }
|
20668 | function splitMatchedQueriesDsl(matchedQueriesDsl) {
|
20669 | const matchedQueries = {};
|
20670 | let matchedQueryIds = 0;
|
20671 | const references = {};
|
20672 | if (matchedQueriesDsl) {
|
20673 | matchedQueriesDsl.forEach(([queryId, valueType]) => {
|
20674 | if (typeof queryId === 'number') {
|
20675 | matchedQueries[queryId] = valueType;
|
20676 | matchedQueryIds |= filterQueryId(queryId);
|
20677 | }
|
20678 | else {
|
20679 | references[queryId] = valueType;
|
20680 | }
|
20681 | });
|
20682 | }
|
20683 | return { matchedQueries, references, matchedQueryIds };
|
20684 | }
|
20685 | function splitDepsDsl(deps, sourceName) {
|
20686 | return deps.map(value => {
|
20687 | let token;
|
20688 | let flags;
|
20689 | if (Array.isArray(value)) {
|
20690 | [flags, token] = value;
|
20691 | }
|
20692 | else {
|
20693 | flags = 0 ;
|
20694 | token = value;
|
20695 | }
|
20696 | if (token && (typeof token === 'function' || typeof token === 'object') && sourceName) {
|
20697 | Object.defineProperty(token, SOURCE, { value: sourceName, configurable: true });
|
20698 | }
|
20699 | return { flags, token, tokenKey: tokenKey(token) };
|
20700 | });
|
20701 | }
|
20702 | function getParentRenderElement(view, renderHost, def) {
|
20703 | let renderParent = def.renderParent;
|
20704 | if (renderParent) {
|
20705 | if ((renderParent.flags & 1 ) === 0 ||
|
20706 | (renderParent.flags & 33554432 ) === 0 ||
|
20707 | (renderParent.element.componentRendererType &&
|
20708 | renderParent.element.componentRendererType.encapsulation === ViewEncapsulation$1.Native)) {
|
20709 |
|
20710 |
|
20711 | return asElementData(view, def.renderParent.nodeIndex).renderElement;
|
20712 | }
|
20713 | }
|
20714 | else {
|
20715 | return renderHost;
|
20716 | }
|
20717 | }
|
20718 | const DEFINITION_CACHE = new WeakMap();
|
20719 | function resolveDefinition(factory) {
|
20720 | let value = DEFINITION_CACHE.get(factory);
|
20721 | if (!value) {
|
20722 | value = factory(() => NOOP);
|
20723 | value.factory = factory;
|
20724 | DEFINITION_CACHE.set(factory, value);
|
20725 | }
|
20726 | return value;
|
20727 | }
|
20728 | function rootRenderNodes(view) {
|
20729 | const renderNodes = [];
|
20730 | visitRootRenderNodes(view, 0 , undefined, undefined, renderNodes);
|
20731 | return renderNodes;
|
20732 | }
|
20733 | function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
|
20734 |
|
20735 | if (action === 3 ) {
|
20736 | parentNode = view.renderer.parentNode(renderNode(view, view.def.lastRenderRootNode));
|
20737 | }
|
20738 | visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
|
20739 | }
|
20740 | function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
|
20741 | for (let i = startIndex; i <= endIndex; i++) {
|
20742 | const nodeDef = view.def.nodes[i];
|
20743 | if (nodeDef.flags & (1 | 2 | 8 )) {
|
20744 | visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
|
20745 | }
|
20746 |
|
20747 | i += nodeDef.childCount;
|
20748 | }
|
20749 | }
|
20750 | function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
|
20751 | let compView = view;
|
20752 | while (compView && !isComponentView(compView)) {
|
20753 | compView = compView.parent;
|
20754 | }
|
20755 | const hostView = compView.parent;
|
20756 | const hostElDef = viewParentEl(compView);
|
20757 | const startIndex = hostElDef.nodeIndex + 1;
|
20758 | const endIndex = hostElDef.nodeIndex + hostElDef.childCount;
|
20759 | for (let i = startIndex; i <= endIndex; i++) {
|
20760 | const nodeDef = hostView.def.nodes[i];
|
20761 | if (nodeDef.ngContentIndex === ngContentIndex) {
|
20762 | visitRenderNode(hostView, nodeDef, action, parentNode, nextSibling, target);
|
20763 | }
|
20764 |
|
20765 | i += nodeDef.childCount;
|
20766 | }
|
20767 | if (!hostView.parent) {
|
20768 |
|
20769 | const projectedNodes = view.root.projectableNodes[ngContentIndex];
|
20770 | if (projectedNodes) {
|
20771 | for (let i = 0; i < projectedNodes.length; i++) {
|
20772 | execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
|
20773 | }
|
20774 | }
|
20775 | }
|
20776 | }
|
20777 | function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
|
20778 | if (nodeDef.flags & 8 ) {
|
20779 | visitProjectedRenderNodes(view, nodeDef.ngContent.index, action, parentNode, nextSibling, target);
|
20780 | }
|
20781 | else {
|
20782 | const rn = renderNode(view, nodeDef);
|
20783 | if (action === 3 && (nodeDef.flags & 33554432 ) &&
|
20784 | (nodeDef.bindingFlags & 48 )) {
|
20785 |
|
20786 | if (nodeDef.bindingFlags & (16 )) {
|
20787 | execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
20788 | }
|
20789 | if (nodeDef.bindingFlags & (32 )) {
|
20790 | const compView = asElementData(view, nodeDef.nodeIndex).componentView;
|
20791 | execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
|
20792 | }
|
20793 | }
|
20794 | else {
|
20795 | execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
20796 | }
|
20797 | if (nodeDef.flags & 16777216 ) {
|
20798 | const embeddedViews = asElementData(view, nodeDef.nodeIndex).viewContainer._embeddedViews;
|
20799 | for (let k = 0; k < embeddedViews.length; k++) {
|
20800 | visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
|
20801 | }
|
20802 | }
|
20803 | if (nodeDef.flags & 1 && !nodeDef.element.name) {
|
20804 | visitSiblingRenderNodes(view, action, nodeDef.nodeIndex + 1, nodeDef.nodeIndex + nodeDef.childCount, parentNode, nextSibling, target);
|
20805 | }
|
20806 | }
|
20807 | }
|
20808 | function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
|
20809 | const renderer = view.renderer;
|
20810 | switch (action) {
|
20811 | case 1 :
|
20812 | renderer.appendChild(parentNode, renderNode);
|
20813 | break;
|
20814 | case 2 :
|
20815 | renderer.insertBefore(parentNode, renderNode, nextSibling);
|
20816 | break;
|
20817 | case 3 :
|
20818 | renderer.removeChild(parentNode, renderNode);
|
20819 | break;
|
20820 | case 0 :
|
20821 | target.push(renderNode);
|
20822 | break;
|
20823 | }
|
20824 | }
|
20825 | const NS_PREFIX_RE = /^:([^:]+):(.+)$/;
|
20826 | function splitNamespace(name) {
|
20827 | if (name[0] === ':') {
|
20828 | const match = name.match(NS_PREFIX_RE);
|
20829 | return [match[1], match[2]];
|
20830 | }
|
20831 | return ['', name];
|
20832 | }
|
20833 | function calcBindingFlags(bindings) {
|
20834 | let flags = 0;
|
20835 | for (let i = 0; i < bindings.length; i++) {
|
20836 | flags |= bindings[i].flags;
|
20837 | }
|
20838 | return flags;
|
20839 | }
|
20840 | function interpolate(valueCount, constAndInterp) {
|
20841 | let result = '';
|
20842 | for (let i = 0; i < valueCount * 2; i = i + 2) {
|
20843 | result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
|
20844 | }
|
20845 | return result + constAndInterp[valueCount * 2];
|
20846 | }
|
20847 | function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
|
20848 | switch (valueCount) {
|
20849 | case 1:
|
20850 | return c0 + _toStringWithNull(a1) + c1;
|
20851 | case 2:
|
20852 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
|
20853 | case 3:
|
20854 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
20855 | c3;
|
20856 | case 4:
|
20857 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
20858 | c3 + _toStringWithNull(a4) + c4;
|
20859 | case 5:
|
20860 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
20861 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
|
20862 | case 6:
|
20863 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
20864 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
|
20865 | case 7:
|
20866 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
20867 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
20868 | c6 + _toStringWithNull(a7) + c7;
|
20869 | case 8:
|
20870 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
20871 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
20872 | c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
|
20873 | case 9:
|
20874 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
20875 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
20876 | c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
|
20877 | default:
|
20878 | throw new Error(`Does not support more than 9 expressions`);
|
20879 | }
|
20880 | }
|
20881 | function _toStringWithNull(v) {
|
20882 | return v != null ? v.toString() : '';
|
20883 | }
|
20884 | const EMPTY_ARRAY$4 = [];
|
20885 | const EMPTY_MAP = {};
|
20886 |
|
20887 |
|
20888 |
|
20889 |
|
20890 |
|
20891 |
|
20892 |
|
20893 |
|
20894 | const UNDEFINED_VALUE = {};
|
20895 | const InjectorRefTokenKey = tokenKey(Injector);
|
20896 | const INJECTORRefTokenKey = tokenKey(INJECTOR);
|
20897 | const NgModuleRefTokenKey = tokenKey(NgModuleRef);
|
20898 | function moduleProvideDef(flags, token, value, deps) {
|
20899 |
|
20900 |
|
20901 |
|
20902 | value = resolveForwardRef(value);
|
20903 | const depDefs = splitDepsDsl(deps, stringify(token));
|
20904 | return {
|
20905 |
|
20906 | index: -1,
|
20907 | deps: depDefs,
|
20908 | flags,
|
20909 | token,
|
20910 | value
|
20911 | };
|
20912 | }
|
20913 | function moduleDef(providers) {
|
20914 | const providersByKey = {};
|
20915 | const modules = [];
|
20916 | let scope = null;
|
20917 | for (let i = 0; i < providers.length; i++) {
|
20918 | const provider = providers[i];
|
20919 | if (provider.token === INJECTOR_SCOPE) {
|
20920 | scope = provider.value;
|
20921 | }
|
20922 | if (provider.flags & 1073741824 ) {
|
20923 | modules.push(provider.token);
|
20924 | }
|
20925 | provider.index = i;
|
20926 | providersByKey[tokenKey(provider.token)] = provider;
|
20927 | }
|
20928 | return {
|
20929 |
|
20930 | factory: null,
|
20931 | providersByKey,
|
20932 | providers,
|
20933 | modules,
|
20934 | scope: scope,
|
20935 | };
|
20936 | }
|
20937 | function initNgModule(data) {
|
20938 | const def = data._def;
|
20939 | const providers = data._providers = newArray(def.providers.length);
|
20940 | for (let i = 0; i < def.providers.length; i++) {
|
20941 | const provDef = def.providers[i];
|
20942 | if (!(provDef.flags & 4096 )) {
|
20943 |
|
20944 | if (providers[i] === undefined) {
|
20945 | providers[i] = _createProviderInstance(data, provDef);
|
20946 | }
|
20947 | }
|
20948 | }
|
20949 | }
|
20950 | function resolveNgModuleDep(data, depDef, notFoundValue = Injector.THROW_IF_NOT_FOUND) {
|
20951 | const former = setCurrentInjector(data);
|
20952 | try {
|
20953 | if (depDef.flags & 8 ) {
|
20954 | return depDef.token;
|
20955 | }
|
20956 | if (depDef.flags & 2 ) {
|
20957 | notFoundValue = null;
|
20958 | }
|
20959 | if (depDef.flags & 1 ) {
|
20960 | return data._parent.get(depDef.token, notFoundValue);
|
20961 | }
|
20962 | const tokenKey = depDef.tokenKey;
|
20963 | switch (tokenKey) {
|
20964 | case InjectorRefTokenKey:
|
20965 | case INJECTORRefTokenKey:
|
20966 | case NgModuleRefTokenKey:
|
20967 | return data;
|
20968 | }
|
20969 | const providerDef = data._def.providersByKey[tokenKey];
|
20970 | let injectableDef;
|
20971 | if (providerDef) {
|
20972 | let providerInstance = data._providers[providerDef.index];
|
20973 | if (providerInstance === undefined) {
|
20974 | providerInstance = data._providers[providerDef.index] =
|
20975 | _createProviderInstance(data, providerDef);
|
20976 | }
|
20977 | return providerInstance === UNDEFINED_VALUE ? undefined : providerInstance;
|
20978 | }
|
20979 | else if ((injectableDef = getInjectableDef(depDef.token)) && targetsModule(data, injectableDef)) {
|
20980 | const index = data._providers.length;
|
20981 | data._def.providers[index] = data._def.providersByKey[depDef.tokenKey] = {
|
20982 | flags: 1024 | 4096 ,
|
20983 | value: injectableDef.factory,
|
20984 | deps: [],
|
20985 | index,
|
20986 | token: depDef.token,
|
20987 | };
|
20988 | data._providers[index] = UNDEFINED_VALUE;
|
20989 | return (data._providers[index] =
|
20990 | _createProviderInstance(data, data._def.providersByKey[depDef.tokenKey]));
|
20991 | }
|
20992 | else if (depDef.flags & 4 ) {
|
20993 | return notFoundValue;
|
20994 | }
|
20995 | return data._parent.get(depDef.token, notFoundValue);
|
20996 | }
|
20997 | finally {
|
20998 | setCurrentInjector(former);
|
20999 | }
|
21000 | }
|
21001 | function moduleTransitivelyPresent(ngModule, scope) {
|
21002 | return ngModule._def.modules.indexOf(scope) > -1;
|
21003 | }
|
21004 | function targetsModule(ngModule, def) {
|
21005 | const providedIn = def.providedIn;
|
21006 | return providedIn != null &&
|
21007 | (providedIn === 'any' || providedIn === ngModule._def.scope ||
|
21008 | moduleTransitivelyPresent(ngModule, providedIn));
|
21009 | }
|
21010 | function _createProviderInstance(ngModule, providerDef) {
|
21011 | let injectable;
|
21012 | switch (providerDef.flags & 201347067 ) {
|
21013 | case 512 :
|
21014 | injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
|
21015 | break;
|
21016 | case 1024 :
|
21017 | injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
|
21018 | break;
|
21019 | case 2048 :
|
21020 | injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
|
21021 | break;
|
21022 | case 256 :
|
21023 | injectable = providerDef.value;
|
21024 | break;
|
21025 | }
|
21026 |
|
21027 |
|
21028 |
|
21029 |
|
21030 | if (injectable !== UNDEFINED_VALUE && injectable !== null && typeof injectable === 'object' &&
|
21031 | !(providerDef.flags & 131072 ) && typeof injectable.ngOnDestroy === 'function') {
|
21032 | providerDef.flags |= 131072 ;
|
21033 | }
|
21034 | return injectable === undefined ? UNDEFINED_VALUE : injectable;
|
21035 | }
|
21036 | function _createClass(ngModule, ctor, deps) {
|
21037 | const len = deps.length;
|
21038 | switch (len) {
|
21039 | case 0:
|
21040 | return new ctor();
|
21041 | case 1:
|
21042 | return new ctor(resolveNgModuleDep(ngModule, deps[0]));
|
21043 | case 2:
|
21044 | return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
|
21045 | case 3:
|
21046 | return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
|
21047 | default:
|
21048 | const depValues = [];
|
21049 | for (let i = 0; i < len; i++) {
|
21050 | depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
|
21051 | }
|
21052 | return new ctor(...depValues);
|
21053 | }
|
21054 | }
|
21055 | function _callFactory(ngModule, factory, deps) {
|
21056 | const len = deps.length;
|
21057 | switch (len) {
|
21058 | case 0:
|
21059 | return factory();
|
21060 | case 1:
|
21061 | return factory(resolveNgModuleDep(ngModule, deps[0]));
|
21062 | case 2:
|
21063 | return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
|
21064 | case 3:
|
21065 | return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
|
21066 | default:
|
21067 | const depValues = [];
|
21068 | for (let i = 0; i < len; i++) {
|
21069 | depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
|
21070 | }
|
21071 | return factory(...depValues);
|
21072 | }
|
21073 | }
|
21074 | function callNgModuleLifecycle(ngModule, lifecycles) {
|
21075 | const def = ngModule._def;
|
21076 | const destroyed = new Set();
|
21077 | for (let i = 0; i < def.providers.length; i++) {
|
21078 | const provDef = def.providers[i];
|
21079 | if (provDef.flags & 131072 ) {
|
21080 | const instance = ngModule._providers[i];
|
21081 | if (instance && instance !== UNDEFINED_VALUE) {
|
21082 | const onDestroy = instance.ngOnDestroy;
|
21083 | if (typeof onDestroy === 'function' && !destroyed.has(instance)) {
|
21084 | onDestroy.apply(instance);
|
21085 | destroyed.add(instance);
|
21086 | }
|
21087 | }
|
21088 | }
|
21089 | }
|
21090 | }
|
21091 |
|
21092 |
|
21093 |
|
21094 |
|
21095 |
|
21096 |
|
21097 |
|
21098 |
|
21099 | function attachEmbeddedView(parentView, elementData, viewIndex, view) {
|
21100 | let embeddedViews = elementData.viewContainer._embeddedViews;
|
21101 | if (viewIndex === null || viewIndex === undefined) {
|
21102 | viewIndex = embeddedViews.length;
|
21103 | }
|
21104 | view.viewContainerParent = parentView;
|
21105 | addToArray(embeddedViews, viewIndex, view);
|
21106 | attachProjectedView(elementData, view);
|
21107 | Services.dirtyParentQueries(view);
|
21108 | const prevView = viewIndex > 0 ? embeddedViews[viewIndex - 1] : null;
|
21109 | renderAttachEmbeddedView(elementData, prevView, view);
|
21110 | }
|
21111 | function attachProjectedView(vcElementData, view) {
|
21112 | const dvcElementData = declaredViewContainer(view);
|
21113 | if (!dvcElementData || dvcElementData === vcElementData ||
|
21114 | view.state & 16 ) {
|
21115 | return;
|
21116 | }
|
21117 |
|
21118 |
|
21119 |
|
21120 |
|
21121 |
|
21122 |
|
21123 |
|
21124 | view.state |= 16 ;
|
21125 | let projectedViews = dvcElementData.template._projectedViews;
|
21126 | if (!projectedViews) {
|
21127 | projectedViews = dvcElementData.template._projectedViews = [];
|
21128 | }
|
21129 | projectedViews.push(view);
|
21130 |
|
21131 |
|
21132 | markNodeAsProjectedTemplate(view.parent.def, view.parentNodeDef);
|
21133 | }
|
21134 | function markNodeAsProjectedTemplate(viewDef, nodeDef) {
|
21135 | if (nodeDef.flags & 4 ) {
|
21136 | return;
|
21137 | }
|
21138 | viewDef.nodeFlags |= 4 ;
|
21139 | nodeDef.flags |= 4 ;
|
21140 | let parentNodeDef = nodeDef.parent;
|
21141 | while (parentNodeDef) {
|
21142 | parentNodeDef.childFlags |= 4 ;
|
21143 | parentNodeDef = parentNodeDef.parent;
|
21144 | }
|
21145 | }
|
21146 | function detachEmbeddedView(elementData, viewIndex) {
|
21147 | const embeddedViews = elementData.viewContainer._embeddedViews;
|
21148 | if (viewIndex == null || viewIndex >= embeddedViews.length) {
|
21149 | viewIndex = embeddedViews.length - 1;
|
21150 | }
|
21151 | if (viewIndex < 0) {
|
21152 | return null;
|
21153 | }
|
21154 | const view = embeddedViews[viewIndex];
|
21155 | view.viewContainerParent = null;
|
21156 | removeFromArray(embeddedViews, viewIndex);
|
21157 |
|
21158 | Services.dirtyParentQueries(view);
|
21159 | renderDetachView$1(view);
|
21160 | return view;
|
21161 | }
|
21162 | function detachProjectedView(view) {
|
21163 | if (!(view.state & 16 )) {
|
21164 | return;
|
21165 | }
|
21166 | const dvcElementData = declaredViewContainer(view);
|
21167 | if (dvcElementData) {
|
21168 | const projectedViews = dvcElementData.template._projectedViews;
|
21169 | if (projectedViews) {
|
21170 | removeFromArray(projectedViews, projectedViews.indexOf(view));
|
21171 | Services.dirtyParentQueries(view);
|
21172 | }
|
21173 | }
|
21174 | }
|
21175 | function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
|
21176 | const embeddedViews = elementData.viewContainer._embeddedViews;
|
21177 | const view = embeddedViews[oldViewIndex];
|
21178 | removeFromArray(embeddedViews, oldViewIndex);
|
21179 | if (newViewIndex == null) {
|
21180 | newViewIndex = embeddedViews.length;
|
21181 | }
|
21182 | addToArray(embeddedViews, newViewIndex, view);
|
21183 |
|
21184 |
|
21185 | Services.dirtyParentQueries(view);
|
21186 | renderDetachView$1(view);
|
21187 | const prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
|
21188 | renderAttachEmbeddedView(elementData, prevView, view);
|
21189 | return view;
|
21190 | }
|
21191 | function renderAttachEmbeddedView(elementData, prevView, view) {
|
21192 | const prevRenderNode = prevView ? renderNode(prevView, prevView.def.lastRenderRootNode) : elementData.renderElement;
|
21193 | const parentNode = view.renderer.parentNode(prevRenderNode);
|
21194 | const nextSibling = view.renderer.nextSibling(prevRenderNode);
|
21195 |
|
21196 |
|
21197 | visitRootRenderNodes(view, 2 , parentNode, nextSibling, undefined);
|
21198 | }
|
21199 | function renderDetachView$1(view) {
|
21200 | visitRootRenderNodes(view, 3 , null, null, undefined);
|
21201 | }
|
21202 |
|
21203 |
|
21204 |
|
21205 |
|
21206 |
|
21207 |
|
21208 |
|
21209 |
|
21210 | const EMPTY_CONTEXT = {};
|
21211 |
|
21212 |
|
21213 | function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
|
21214 | return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
|
21215 | }
|
21216 | function getComponentViewDefinitionFactory(componentFactory) {
|
21217 | return componentFactory.viewDefFactory;
|
21218 | }
|
21219 | class ComponentFactory_ extends ComponentFactory {
|
21220 | constructor(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
|
21221 |
|
21222 |
|
21223 | super();
|
21224 | this.selector = selector;
|
21225 | this.componentType = componentType;
|
21226 | this._inputs = _inputs;
|
21227 | this._outputs = _outputs;
|
21228 | this.ngContentSelectors = ngContentSelectors;
|
21229 | this.viewDefFactory = viewDefFactory;
|
21230 | }
|
21231 | get inputs() {
|
21232 | const inputsArr = [];
|
21233 | const inputs = this._inputs;
|
21234 | for (let propName in inputs) {
|
21235 | const templateName = inputs[propName];
|
21236 | inputsArr.push({ propName, templateName });
|
21237 | }
|
21238 | return inputsArr;
|
21239 | }
|
21240 | get outputs() {
|
21241 | const outputsArr = [];
|
21242 | for (let propName in this._outputs) {
|
21243 | const templateName = this._outputs[propName];
|
21244 | outputsArr.push({ propName, templateName });
|
21245 | }
|
21246 | return outputsArr;
|
21247 | }
|
21248 | |
21249 |
|
21250 |
|
21251 | create(injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
21252 | if (!ngModule) {
|
21253 | throw new Error('ngModule should be provided');
|
21254 | }
|
21255 | const viewDef = resolveDefinition(this.viewDefFactory);
|
21256 | const componentNodeIndex = viewDef.nodes[0].element.componentProvider.nodeIndex;
|
21257 | const view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
|
21258 | const component = asProviderData(view, componentNodeIndex).instance;
|
21259 | if (rootSelectorOrNode) {
|
21260 | view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
|
21261 | }
|
21262 | return new ComponentRef_(view, new ViewRef_(view), component);
|
21263 | }
|
21264 | }
|
21265 | class ComponentRef_ extends ComponentRef {
|
21266 | constructor(_view, _viewRef, _component) {
|
21267 | super();
|
21268 | this._view = _view;
|
21269 | this._viewRef = _viewRef;
|
21270 | this._component = _component;
|
21271 | this._elDef = this._view.def.nodes[0];
|
21272 | this.hostView = _viewRef;
|
21273 | this.changeDetectorRef = _viewRef;
|
21274 | this.instance = _component;
|
21275 | }
|
21276 | get location() {
|
21277 | return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement);
|
21278 | }
|
21279 | get injector() {
|
21280 | return new Injector_(this._view, this._elDef);
|
21281 | }
|
21282 | get componentType() {
|
21283 | return this._component.constructor;
|
21284 | }
|
21285 | destroy() {
|
21286 | this._viewRef.destroy();
|
21287 | }
|
21288 | onDestroy(callback) {
|
21289 | this._viewRef.onDestroy(callback);
|
21290 | }
|
21291 | }
|
21292 | function createViewContainerData(view, elDef, elData) {
|
21293 | return new ViewContainerRef_(view, elDef, elData);
|
21294 | }
|
21295 | class ViewContainerRef_ {
|
21296 | constructor(_view, _elDef, _data) {
|
21297 | this._view = _view;
|
21298 | this._elDef = _elDef;
|
21299 | this._data = _data;
|
21300 | |
21301 |
|
21302 |
|
21303 | this._embeddedViews = [];
|
21304 | }
|
21305 | get element() {
|
21306 | return new ElementRef(this._data.renderElement);
|
21307 | }
|
21308 | get injector() {
|
21309 | return new Injector_(this._view, this._elDef);
|
21310 | }
|
21311 |
|
21312 | get parentInjector() {
|
21313 | let view = this._view;
|
21314 | let elDef = this._elDef.parent;
|
21315 | while (!elDef && view) {
|
21316 | elDef = viewParentEl(view);
|
21317 | view = view.parent;
|
21318 | }
|
21319 | return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
|
21320 | }
|
21321 | clear() {
|
21322 | const len = this._embeddedViews.length;
|
21323 | for (let i = len - 1; i >= 0; i--) {
|
21324 | const view = detachEmbeddedView(this._data, i);
|
21325 | Services.destroyView(view);
|
21326 | }
|
21327 | }
|
21328 | get(index) {
|
21329 | const view = this._embeddedViews[index];
|
21330 | if (view) {
|
21331 | const ref = new ViewRef_(view);
|
21332 | ref.attachToViewContainerRef(this);
|
21333 | return ref;
|
21334 | }
|
21335 | return null;
|
21336 | }
|
21337 | get length() {
|
21338 | return this._embeddedViews.length;
|
21339 | }
|
21340 | createEmbeddedView(templateRef, context, index) {
|
21341 | const viewRef = templateRef.createEmbeddedView(context || {});
|
21342 | this.insert(viewRef, index);
|
21343 | return viewRef;
|
21344 | }
|
21345 | createComponent(componentFactory, index, injector, projectableNodes, ngModuleRef) {
|
21346 | const contextInjector = injector || this.parentInjector;
|
21347 | if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
|
21348 | ngModuleRef = contextInjector.get(NgModuleRef);
|
21349 | }
|
21350 | const componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
|
21351 | this.insert(componentRef.hostView, index);
|
21352 | return componentRef;
|
21353 | }
|
21354 | insert(viewRef, index) {
|
21355 | if (viewRef.destroyed) {
|
21356 | throw new Error('Cannot insert a destroyed View in a ViewContainer!');
|
21357 | }
|
21358 | const viewRef_ = viewRef;
|
21359 | const viewData = viewRef_._view;
|
21360 | attachEmbeddedView(this._view, this._data, index, viewData);
|
21361 | viewRef_.attachToViewContainerRef(this);
|
21362 | return viewRef;
|
21363 | }
|
21364 | move(viewRef, currentIndex) {
|
21365 | if (viewRef.destroyed) {
|
21366 | throw new Error('Cannot move a destroyed View in a ViewContainer!');
|
21367 | }
|
21368 | const previousIndex = this._embeddedViews.indexOf(viewRef._view);
|
21369 | moveEmbeddedView(this._data, previousIndex, currentIndex);
|
21370 | return viewRef;
|
21371 | }
|
21372 | indexOf(viewRef) {
|
21373 | return this._embeddedViews.indexOf(viewRef._view);
|
21374 | }
|
21375 | remove(index) {
|
21376 | const viewData = detachEmbeddedView(this._data, index);
|
21377 | if (viewData) {
|
21378 | Services.destroyView(viewData);
|
21379 | }
|
21380 | }
|
21381 | detach(index) {
|
21382 | const view = detachEmbeddedView(this._data, index);
|
21383 | return view ? new ViewRef_(view) : null;
|
21384 | }
|
21385 | }
|
21386 | function createChangeDetectorRef(view) {
|
21387 | return new ViewRef_(view);
|
21388 | }
|
21389 | class ViewRef_ {
|
21390 | constructor(_view) {
|
21391 | this._view = _view;
|
21392 | this._viewContainerRef = null;
|
21393 | this._appRef = null;
|
21394 | }
|
21395 | get rootNodes() {
|
21396 | return rootRenderNodes(this._view);
|
21397 | }
|
21398 | get context() {
|
21399 | return this._view.context;
|
21400 | }
|
21401 | get destroyed() {
|
21402 | return (this._view.state & 128 ) !== 0;
|
21403 | }
|
21404 | markForCheck() {
|
21405 | markParentViewsForCheck(this._view);
|
21406 | }
|
21407 | detach() {
|
21408 | this._view.state &= ~4 ;
|
21409 | }
|
21410 | detectChanges() {
|
21411 | const fs = this._view.root.rendererFactory;
|
21412 | if (fs.begin) {
|
21413 | fs.begin();
|
21414 | }
|
21415 | try {
|
21416 | Services.checkAndUpdateView(this._view);
|
21417 | }
|
21418 | finally {
|
21419 | if (fs.end) {
|
21420 | fs.end();
|
21421 | }
|
21422 | }
|
21423 | }
|
21424 | checkNoChanges() {
|
21425 | Services.checkNoChangesView(this._view);
|
21426 | }
|
21427 | reattach() {
|
21428 | this._view.state |= 4 ;
|
21429 | }
|
21430 | onDestroy(callback) {
|
21431 | if (!this._view.disposables) {
|
21432 | this._view.disposables = [];
|
21433 | }
|
21434 | this._view.disposables.push(callback);
|
21435 | }
|
21436 | destroy() {
|
21437 | if (this._appRef) {
|
21438 | this._appRef.detachView(this);
|
21439 | }
|
21440 | else if (this._viewContainerRef) {
|
21441 | this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
|
21442 | }
|
21443 | Services.destroyView(this._view);
|
21444 | }
|
21445 | detachFromAppRef() {
|
21446 | this._appRef = null;
|
21447 | renderDetachView$1(this._view);
|
21448 | Services.dirtyParentQueries(this._view);
|
21449 | }
|
21450 | attachToAppRef(appRef) {
|
21451 | if (this._viewContainerRef) {
|
21452 | throw new Error('This view is already attached to a ViewContainer!');
|
21453 | }
|
21454 | this._appRef = appRef;
|
21455 | }
|
21456 | attachToViewContainerRef(vcRef) {
|
21457 | if (this._appRef) {
|
21458 | throw new Error('This view is already attached directly to the ApplicationRef!');
|
21459 | }
|
21460 | this._viewContainerRef = vcRef;
|
21461 | }
|
21462 | }
|
21463 | function createTemplateData(view, def) {
|
21464 | return new TemplateRef_(view, def);
|
21465 | }
|
21466 | class TemplateRef_ extends TemplateRef {
|
21467 | constructor(_parentView, _def) {
|
21468 | super();
|
21469 | this._parentView = _parentView;
|
21470 | this._def = _def;
|
21471 | }
|
21472 | createEmbeddedView(context) {
|
21473 | return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, this._def.element.template, context));
|
21474 | }
|
21475 | get elementRef() {
|
21476 | return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement);
|
21477 | }
|
21478 | }
|
21479 | function createInjector$1(view, elDef) {
|
21480 | return new Injector_(view, elDef);
|
21481 | }
|
21482 | class Injector_ {
|
21483 | constructor(view, elDef) {
|
21484 | this.view = view;
|
21485 | this.elDef = elDef;
|
21486 | }
|
21487 | get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND) {
|
21488 | const allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 ) !== 0 : false;
|
21489 | return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 , token, tokenKey: tokenKey(token) }, notFoundValue);
|
21490 | }
|
21491 | }
|
21492 | function nodeValue(view, index) {
|
21493 | const def = view.def.nodes[index];
|
21494 | if (def.flags & 1 ) {
|
21495 | const elData = asElementData(view, def.nodeIndex);
|
21496 | return def.element.template ? elData.template : elData.renderElement;
|
21497 | }
|
21498 | else if (def.flags & 2 ) {
|
21499 | return asTextData(view, def.nodeIndex).renderText;
|
21500 | }
|
21501 | else if (def.flags & (20224 | 16 )) {
|
21502 | return asProviderData(view, def.nodeIndex).instance;
|
21503 | }
|
21504 | throw new Error(`Illegal state: read nodeValue for node index ${index}`);
|
21505 | }
|
21506 | function createNgModuleRef(moduleType, parent, bootstrapComponents, def) {
|
21507 | return new NgModuleRef_(moduleType, parent, bootstrapComponents, def);
|
21508 | }
|
21509 | class NgModuleRef_ {
|
21510 | constructor(_moduleType, _parent, _bootstrapComponents, _def) {
|
21511 | this._moduleType = _moduleType;
|
21512 | this._parent = _parent;
|
21513 | this._bootstrapComponents = _bootstrapComponents;
|
21514 | this._def = _def;
|
21515 | this._destroyListeners = [];
|
21516 | this._destroyed = false;
|
21517 | this.injector = this;
|
21518 | initNgModule(this);
|
21519 | }
|
21520 | get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
|
21521 | let flags = 0 ;
|
21522 | if (injectFlags & InjectFlags.SkipSelf) {
|
21523 | flags |= 1 ;
|
21524 | }
|
21525 | else if (injectFlags & InjectFlags.Self) {
|
21526 | flags |= 4 ;
|
21527 | }
|
21528 | return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: flags }, notFoundValue);
|
21529 | }
|
21530 | get instance() {
|
21531 | return this.get(this._moduleType);
|
21532 | }
|
21533 | get componentFactoryResolver() {
|
21534 | return this.get(ComponentFactoryResolver);
|
21535 | }
|
21536 | destroy() {
|
21537 | if (this._destroyed) {
|
21538 | throw new Error(`The ng module ${stringify(this.instance.constructor)} has already been destroyed.`);
|
21539 | }
|
21540 | this._destroyed = true;
|
21541 | callNgModuleLifecycle(this, 131072 );
|
21542 | this._destroyListeners.forEach((listener) => listener());
|
21543 | }
|
21544 | onDestroy(callback) {
|
21545 | this._destroyListeners.push(callback);
|
21546 | }
|
21547 | }
|
21548 |
|
21549 |
|
21550 |
|
21551 |
|
21552 |
|
21553 |
|
21554 |
|
21555 |
|
21556 | const Renderer2TokenKey = tokenKey(Renderer2);
|
21557 | const ElementRefTokenKey = tokenKey(ElementRef);
|
21558 | const ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
|
21559 | const TemplateRefTokenKey = tokenKey(TemplateRef);
|
21560 | const ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
|
21561 | const InjectorRefTokenKey$1 = tokenKey(Injector);
|
21562 | const INJECTORRefTokenKey$1 = tokenKey(INJECTOR);
|
21563 | function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps, props, outputs) {
|
21564 | const bindings = [];
|
21565 | if (props) {
|
21566 | for (let prop in props) {
|
21567 | const [bindingIndex, nonMinifiedName] = props[prop];
|
21568 | bindings[bindingIndex] = {
|
21569 | flags: 8 ,
|
21570 | name: prop,
|
21571 | nonMinifiedName,
|
21572 | ns: null,
|
21573 | securityContext: null,
|
21574 | suffix: null
|
21575 | };
|
21576 | }
|
21577 | }
|
21578 | const outputDefs = [];
|
21579 | if (outputs) {
|
21580 | for (let propName in outputs) {
|
21581 | outputDefs.push({ type: 1 , propName, target: null, eventName: outputs[propName] });
|
21582 | }
|
21583 | }
|
21584 | flags |= 16384 ;
|
21585 | return _def(checkIndex, flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
|
21586 | }
|
21587 | function pipeDef(flags, ctor, deps) {
|
21588 | flags |= 16 ;
|
21589 | return _def(-1, flags, null, 0, ctor, ctor, deps);
|
21590 | }
|
21591 | function providerDef(flags, matchedQueries, token, value, deps) {
|
21592 | return _def(-1, flags, matchedQueries, 0, token, value, deps);
|
21593 | }
|
21594 | function _def(checkIndex, flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
|
21595 | const { matchedQueries, references, matchedQueryIds } = splitMatchedQueriesDsl(matchedQueriesDsl);
|
21596 | if (!outputs) {
|
21597 | outputs = [];
|
21598 | }
|
21599 | if (!bindings) {
|
21600 | bindings = [];
|
21601 | }
|
21602 |
|
21603 |
|
21604 |
|
21605 | value = resolveForwardRef(value);
|
21606 | const depDefs = splitDepsDsl(deps, stringify(token));
|
21607 | return {
|
21608 |
|
21609 | nodeIndex: -1,
|
21610 | parent: null,
|
21611 | renderParent: null,
|
21612 | bindingIndex: -1,
|
21613 | outputIndex: -1,
|
21614 |
|
21615 | checkIndex,
|
21616 | flags,
|
21617 | childFlags: 0,
|
21618 | directChildFlags: 0,
|
21619 | childMatchedQueries: 0,
|
21620 | matchedQueries,
|
21621 | matchedQueryIds,
|
21622 | references,
|
21623 | ngContentIndex: -1,
|
21624 | childCount,
|
21625 | bindings,
|
21626 | bindingFlags: calcBindingFlags(bindings),
|
21627 | outputs,
|
21628 | element: null,
|
21629 | provider: { token, value, deps: depDefs },
|
21630 | text: null,
|
21631 | query: null,
|
21632 | ngContent: null
|
21633 | };
|
21634 | }
|
21635 | function createProviderInstance(view, def) {
|
21636 | return _createProviderInstance$1(view, def);
|
21637 | }
|
21638 | function createPipeInstance(view, def) {
|
21639 |
|
21640 | let compView = view;
|
21641 | while (compView.parent && !isComponentView(compView)) {
|
21642 | compView = compView.parent;
|
21643 | }
|
21644 |
|
21645 | const allowPrivateServices = true;
|
21646 |
|
21647 | return createClass(compView.parent, viewParentEl(compView), allowPrivateServices, def.provider.value, def.provider.deps);
|
21648 | }
|
21649 | function createDirectiveInstance(view, def) {
|
21650 |
|
21651 | const allowPrivateServices = (def.flags & 32768 ) > 0;
|
21652 |
|
21653 | const instance = createClass(view, def.parent, allowPrivateServices, def.provider.value, def.provider.deps);
|
21654 | if (def.outputs.length) {
|
21655 | for (let i = 0; i < def.outputs.length; i++) {
|
21656 | const output = def.outputs[i];
|
21657 | const outputObservable = instance[output.propName];
|
21658 | if (isObservable(outputObservable)) {
|
21659 | const subscription = outputObservable.subscribe(eventHandlerClosure(view, def.parent.nodeIndex, output.eventName));
|
21660 | view.disposables[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
|
21661 | }
|
21662 | else {
|
21663 | throw new Error(`@Output ${output.propName} not initialized in '${instance.constructor.name}'.`);
|
21664 | }
|
21665 | }
|
21666 | }
|
21667 | return instance;
|
21668 | }
|
21669 | function eventHandlerClosure(view, index, eventName) {
|
21670 | return (event) => dispatchEvent(view, index, eventName, event);
|
21671 | }
|
21672 | function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
21673 | const providerData = asProviderData(view, def.nodeIndex);
|
21674 | const directive = providerData.instance;
|
21675 | let changed = false;
|
21676 | let changes = undefined;
|
21677 | const bindLen = def.bindings.length;
|
21678 | if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
|
21679 | changed = true;
|
21680 | changes = updateProp(view, providerData, def, 0, v0, changes);
|
21681 | }
|
21682 | if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
|
21683 | changed = true;
|
21684 | changes = updateProp(view, providerData, def, 1, v1, changes);
|
21685 | }
|
21686 | if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
|
21687 | changed = true;
|
21688 | changes = updateProp(view, providerData, def, 2, v2, changes);
|
21689 | }
|
21690 | if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
|
21691 | changed = true;
|
21692 | changes = updateProp(view, providerData, def, 3, v3, changes);
|
21693 | }
|
21694 | if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
|
21695 | changed = true;
|
21696 | changes = updateProp(view, providerData, def, 4, v4, changes);
|
21697 | }
|
21698 | if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
|
21699 | changed = true;
|
21700 | changes = updateProp(view, providerData, def, 5, v5, changes);
|
21701 | }
|
21702 | if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
|
21703 | changed = true;
|
21704 | changes = updateProp(view, providerData, def, 6, v6, changes);
|
21705 | }
|
21706 | if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
|
21707 | changed = true;
|
21708 | changes = updateProp(view, providerData, def, 7, v7, changes);
|
21709 | }
|
21710 | if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
|
21711 | changed = true;
|
21712 | changes = updateProp(view, providerData, def, 8, v8, changes);
|
21713 | }
|
21714 | if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
|
21715 | changed = true;
|
21716 | changes = updateProp(view, providerData, def, 9, v9, changes);
|
21717 | }
|
21718 | if (changes) {
|
21719 | directive.ngOnChanges(changes);
|
21720 | }
|
21721 | if ((def.flags & 65536 ) &&
|
21722 | shouldCallLifecycleInitHook(view, 256 , def.nodeIndex)) {
|
21723 | directive.ngOnInit();
|
21724 | }
|
21725 | if (def.flags & 262144 ) {
|
21726 | directive.ngDoCheck();
|
21727 | }
|
21728 | return changed;
|
21729 | }
|
21730 | function checkAndUpdateDirectiveDynamic(view, def, values) {
|
21731 | const providerData = asProviderData(view, def.nodeIndex);
|
21732 | const directive = providerData.instance;
|
21733 | let changed = false;
|
21734 | let changes = undefined;
|
21735 | for (let i = 0; i < values.length; i++) {
|
21736 | if (checkBinding(view, def, i, values[i])) {
|
21737 | changed = true;
|
21738 | changes = updateProp(view, providerData, def, i, values[i], changes);
|
21739 | }
|
21740 | }
|
21741 | if (changes) {
|
21742 | directive.ngOnChanges(changes);
|
21743 | }
|
21744 | if ((def.flags & 65536 ) &&
|
21745 | shouldCallLifecycleInitHook(view, 256 , def.nodeIndex)) {
|
21746 | directive.ngOnInit();
|
21747 | }
|
21748 | if (def.flags & 262144 ) {
|
21749 | directive.ngDoCheck();
|
21750 | }
|
21751 | return changed;
|
21752 | }
|
21753 | function _createProviderInstance$1(view, def) {
|
21754 |
|
21755 | const allowPrivateServices = (def.flags & 8192 ) > 0;
|
21756 | const providerDef = def.provider;
|
21757 | switch (def.flags & 201347067 ) {
|
21758 | case 512 :
|
21759 | return createClass(view, def.parent, allowPrivateServices, providerDef.value, providerDef.deps);
|
21760 | case 1024 :
|
21761 | return callFactory(view, def.parent, allowPrivateServices, providerDef.value, providerDef.deps);
|
21762 | case 2048 :
|
21763 | return resolveDep(view, def.parent, allowPrivateServices, providerDef.deps[0]);
|
21764 | case 256 :
|
21765 | return providerDef.value;
|
21766 | }
|
21767 | }
|
21768 | function createClass(view, elDef, allowPrivateServices, ctor, deps) {
|
21769 | const len = deps.length;
|
21770 | switch (len) {
|
21771 | case 0:
|
21772 | return new ctor();
|
21773 | case 1:
|
21774 | return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
21775 | case 2:
|
21776 | return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
21777 | case 3:
|
21778 | return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
21779 | default:
|
21780 | const depValues = [];
|
21781 | for (let i = 0; i < len; i++) {
|
21782 | depValues.push(resolveDep(view, elDef, allowPrivateServices, deps[i]));
|
21783 | }
|
21784 | return new ctor(...depValues);
|
21785 | }
|
21786 | }
|
21787 | function callFactory(view, elDef, allowPrivateServices, factory, deps) {
|
21788 | const len = deps.length;
|
21789 | switch (len) {
|
21790 | case 0:
|
21791 | return factory();
|
21792 | case 1:
|
21793 | return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
21794 | case 2:
|
21795 | return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
21796 | case 3:
|
21797 | return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
21798 | default:
|
21799 | const depValues = [];
|
21800 | for (let i = 0; i < len; i++) {
|
21801 | depValues.push(resolveDep(view, elDef, allowPrivateServices, deps[i]));
|
21802 | }
|
21803 | return factory(...depValues);
|
21804 | }
|
21805 | }
|
21806 |
|
21807 |
|
21808 |
|
21809 |
|
21810 |
|
21811 |
|
21812 |
|
21813 |
|
21814 |
|
21815 |
|
21816 |
|
21817 |
|
21818 |
|
21819 |
|
21820 |
|
21821 |
|
21822 |
|
21823 | const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
|
21824 | function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue = Injector.THROW_IF_NOT_FOUND) {
|
21825 | if (depDef.flags & 8 ) {
|
21826 | return depDef.token;
|
21827 | }
|
21828 | const startView = view;
|
21829 | if (depDef.flags & 2 ) {
|
21830 | notFoundValue = null;
|
21831 | }
|
21832 | const tokenKey = depDef.tokenKey;
|
21833 | if (tokenKey === ChangeDetectorRefTokenKey) {
|
21834 |
|
21835 |
|
21836 | allowPrivateServices = !!(elDef && elDef.element.componentView);
|
21837 | }
|
21838 | if (elDef && (depDef.flags & 1 )) {
|
21839 | allowPrivateServices = false;
|
21840 | elDef = elDef.parent;
|
21841 | }
|
21842 | let searchView = view;
|
21843 | while (searchView) {
|
21844 | if (elDef) {
|
21845 | switch (tokenKey) {
|
21846 | case Renderer2TokenKey: {
|
21847 | const compView = findCompView(searchView, elDef, allowPrivateServices);
|
21848 | return compView.renderer;
|
21849 | }
|
21850 | case ElementRefTokenKey:
|
21851 | return new ElementRef(asElementData(searchView, elDef.nodeIndex).renderElement);
|
21852 | case ViewContainerRefTokenKey:
|
21853 | return asElementData(searchView, elDef.nodeIndex).viewContainer;
|
21854 | case TemplateRefTokenKey: {
|
21855 | if (elDef.element.template) {
|
21856 | return asElementData(searchView, elDef.nodeIndex).template;
|
21857 | }
|
21858 | break;
|
21859 | }
|
21860 | case ChangeDetectorRefTokenKey: {
|
21861 | let cdView = findCompView(searchView, elDef, allowPrivateServices);
|
21862 | return createChangeDetectorRef(cdView);
|
21863 | }
|
21864 | case InjectorRefTokenKey$1:
|
21865 | case INJECTORRefTokenKey$1:
|
21866 | return createInjector$1(searchView, elDef);
|
21867 | default:
|
21868 | const providerDef = (allowPrivateServices ? elDef.element.allProviders :
|
21869 | elDef.element.publicProviders)[tokenKey];
|
21870 | if (providerDef) {
|
21871 | let providerData = asProviderData(searchView, providerDef.nodeIndex);
|
21872 | if (!providerData) {
|
21873 | providerData = { instance: _createProviderInstance$1(searchView, providerDef) };
|
21874 | searchView.nodes[providerDef.nodeIndex] = providerData;
|
21875 | }
|
21876 | return providerData.instance;
|
21877 | }
|
21878 | }
|
21879 | }
|
21880 | allowPrivateServices = isComponentView(searchView);
|
21881 | elDef = viewParentEl(searchView);
|
21882 | searchView = searchView.parent;
|
21883 | if (depDef.flags & 4 ) {
|
21884 | searchView = null;
|
21885 | }
|
21886 | }
|
21887 | const value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
|
21888 | if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
21889 | notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
21890 |
|
21891 |
|
21892 |
|
21893 |
|
21894 |
|
21895 | return value;
|
21896 | }
|
21897 | return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
|
21898 | }
|
21899 | function findCompView(view, elDef, allowPrivateServices) {
|
21900 | let compView;
|
21901 | if (allowPrivateServices) {
|
21902 | compView = asElementData(view, elDef.nodeIndex).componentView;
|
21903 | }
|
21904 | else {
|
21905 | compView = view;
|
21906 | while (compView.parent && !isComponentView(compView)) {
|
21907 | compView = compView.parent;
|
21908 | }
|
21909 | }
|
21910 | return compView;
|
21911 | }
|
21912 | function updateProp(view, providerData, def, bindingIdx, value, changes) {
|
21913 | if (def.flags & 32768 ) {
|
21914 | const compView = asElementData(view, def.parent.nodeIndex).componentView;
|
21915 | if (compView.def.flags & 2 ) {
|
21916 | compView.state |= 8 ;
|
21917 | }
|
21918 | }
|
21919 | const binding = def.bindings[bindingIdx];
|
21920 | const propName = binding.name;
|
21921 |
|
21922 |
|
21923 |
|
21924 | providerData.instance[propName] = value;
|
21925 | if (def.flags & 524288 ) {
|
21926 | changes = changes || {};
|
21927 | const oldValue = WrappedValue.unwrap(view.oldValues[def.bindingIndex + bindingIdx]);
|
21928 | const binding = def.bindings[bindingIdx];
|
21929 | changes[binding.nonMinifiedName] =
|
21930 | new SimpleChange(oldValue, value, (view.state & 2 ) !== 0);
|
21931 | }
|
21932 | view.oldValues[def.bindingIndex + bindingIdx] = value;
|
21933 | return changes;
|
21934 | }
|
21935 |
|
21936 |
|
21937 |
|
21938 |
|
21939 |
|
21940 |
|
21941 |
|
21942 |
|
21943 |
|
21944 |
|
21945 |
|
21946 |
|
21947 |
|
21948 |
|
21949 |
|
21950 |
|
21951 |
|
21952 |
|
21953 |
|
21954 |
|
21955 |
|
21956 |
|
21957 |
|
21958 |
|
21959 |
|
21960 |
|
21961 |
|
21962 |
|
21963 |
|
21964 |
|
21965 |
|
21966 |
|
21967 |
|
21968 |
|
21969 |
|
21970 |
|
21971 |
|
21972 |
|
21973 |
|
21974 |
|
21975 |
|
21976 |
|
21977 |
|
21978 | function callLifecycleHooksChildrenFirst(view, lifecycles) {
|
21979 | if (!(view.def.nodeFlags & lifecycles)) {
|
21980 | return;
|
21981 | }
|
21982 | const nodes = view.def.nodes;
|
21983 | let initIndex = 0;
|
21984 | for (let i = 0; i < nodes.length; i++) {
|
21985 | const nodeDef = nodes[i];
|
21986 | let parent = nodeDef.parent;
|
21987 | if (!parent && nodeDef.flags & lifecycles) {
|
21988 |
|
21989 | callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
|
21990 | }
|
21991 | if ((nodeDef.childFlags & lifecycles) === 0) {
|
21992 |
|
21993 | i += nodeDef.childCount;
|
21994 | }
|
21995 | while (parent && (parent.flags & 1 ) &&
|
21996 | i === parent.nodeIndex + parent.childCount) {
|
21997 |
|
21998 | if (parent.directChildFlags & lifecycles) {
|
21999 | initIndex = callElementProvidersLifecycles(view, parent, lifecycles, initIndex);
|
22000 | }
|
22001 | parent = parent.parent;
|
22002 | }
|
22003 | }
|
22004 | }
|
22005 | function callElementProvidersLifecycles(view, elDef, lifecycles, initIndex) {
|
22006 | for (let i = elDef.nodeIndex + 1; i <= elDef.nodeIndex + elDef.childCount; i++) {
|
22007 | const nodeDef = view.def.nodes[i];
|
22008 | if (nodeDef.flags & lifecycles) {
|
22009 | callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
|
22010 | }
|
22011 |
|
22012 | i += nodeDef.childCount;
|
22013 | }
|
22014 | return initIndex;
|
22015 | }
|
22016 | function callProviderLifecycles(view, index, lifecycles, initIndex) {
|
22017 | const providerData = asProviderData(view, index);
|
22018 | if (!providerData) {
|
22019 | return;
|
22020 | }
|
22021 | const provider = providerData.instance;
|
22022 | if (!provider) {
|
22023 | return;
|
22024 | }
|
22025 | Services.setCurrentNode(view, index);
|
22026 | if (lifecycles & 1048576 &&
|
22027 | shouldCallLifecycleInitHook(view, 512 , initIndex)) {
|
22028 | provider.ngAfterContentInit();
|
22029 | }
|
22030 | if (lifecycles & 2097152 ) {
|
22031 | provider.ngAfterContentChecked();
|
22032 | }
|
22033 | if (lifecycles & 4194304 &&
|
22034 | shouldCallLifecycleInitHook(view, 768 , initIndex)) {
|
22035 | provider.ngAfterViewInit();
|
22036 | }
|
22037 | if (lifecycles & 8388608 ) {
|
22038 | provider.ngAfterViewChecked();
|
22039 | }
|
22040 | if (lifecycles & 131072 ) {
|
22041 | provider.ngOnDestroy();
|
22042 | }
|
22043 | }
|
22044 |
|
22045 |
|
22046 |
|
22047 |
|
22048 |
|
22049 |
|
22050 |
|
22051 |
|
22052 | class ComponentFactoryResolver$1 extends ComponentFactoryResolver {
|
22053 | |
22054 |
|
22055 |
|
22056 | constructor(ngModule) {
|
22057 | super();
|
22058 | this.ngModule = ngModule;
|
22059 | }
|
22060 | resolveComponentFactory(component) {
|
22061 | ngDevMode && assertComponentType(component);
|
22062 | const componentDef = getComponentDef(component);
|
22063 | return new ComponentFactory$1(componentDef, this.ngModule);
|
22064 | }
|
22065 | }
|
22066 | function toRefArray(map) {
|
22067 | const array = [];
|
22068 | for (let nonMinified in map) {
|
22069 | if (map.hasOwnProperty(nonMinified)) {
|
22070 | const minified = map[nonMinified];
|
22071 | array.push({ propName: minified, templateName: nonMinified });
|
22072 | }
|
22073 | }
|
22074 | return array;
|
22075 | }
|
22076 | function getNamespace$1(elementName) {
|
22077 | const name = elementName.toLowerCase();
|
22078 | return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
|
22079 | }
|
22080 |
|
22081 |
|
22082 |
|
22083 |
|
22084 | const SCHEDULER = new InjectionToken('SCHEDULER_TOKEN', {
|
22085 | providedIn: 'root',
|
22086 | factory: () => defaultScheduler,
|
22087 | });
|
22088 | function createChainedInjector(rootViewInjector, moduleInjector) {
|
22089 | return {
|
22090 | get: (token, notFoundValue, flags) => {
|
22091 | const value = rootViewInjector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
|
22092 | if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
22093 | notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
22094 |
|
22095 |
|
22096 |
|
22097 |
|
22098 |
|
22099 | return value;
|
22100 | }
|
22101 | return moduleInjector.get(token, notFoundValue, flags);
|
22102 | }
|
22103 | };
|
22104 | }
|
22105 |
|
22106 |
|
22107 |
|
22108 | class ComponentFactory$1 extends ComponentFactory {
|
22109 | |
22110 |
|
22111 |
|
22112 |
|
22113 | constructor(componentDef, ngModule) {
|
22114 | super();
|
22115 | this.componentDef = componentDef;
|
22116 | this.ngModule = ngModule;
|
22117 | this.componentType = componentDef.type;
|
22118 | this.selector = stringifyCSSSelectorList(componentDef.selectors);
|
22119 | this.ngContentSelectors =
|
22120 | componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
|
22121 | this.isBoundToModule = !!ngModule;
|
22122 | }
|
22123 | get inputs() {
|
22124 | return toRefArray(this.componentDef.inputs);
|
22125 | }
|
22126 | get outputs() {
|
22127 | return toRefArray(this.componentDef.outputs);
|
22128 | }
|
22129 | create(injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
22130 | ngModule = ngModule || this.ngModule;
|
22131 | const rootViewInjector = ngModule ? createChainedInjector(injector, ngModule.injector) : injector;
|
22132 | const rendererFactory = rootViewInjector.get(RendererFactory2, domRendererFactory3);
|
22133 | const sanitizer = rootViewInjector.get(Sanitizer, null);
|
22134 | const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
|
22135 |
|
22136 |
|
22137 | const elementName = this.componentDef.selectors[0][0] || 'div';
|
22138 | const hostRNode = rootSelectorOrNode ?
|
22139 | locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
|
22140 | elementCreate(elementName, rendererFactory.createRenderer(null, this.componentDef), getNamespace$1(elementName));
|
22141 | const rootFlags = this.componentDef.onPush ? 64 | 512 :
|
22142 | 16 | 512 ;
|
22143 | const rootContext = createRootContext();
|
22144 |
|
22145 | const rootTView = createTView(0 , -1, null, 1, 0, null, null, null, null, null);
|
22146 | const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector);
|
22147 |
|
22148 |
|
22149 |
|
22150 |
|
22151 |
|
22152 | enterView(rootLView, null);
|
22153 | let component;
|
22154 | let tElementNode;
|
22155 | try {
|
22156 | const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
|
22157 | if (hostRNode) {
|
22158 | if (rootSelectorOrNode) {
|
22159 | setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
|
22160 | }
|
22161 | else {
|
22162 |
|
22163 |
|
22164 |
|
22165 | const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
|
22166 | if (attrs) {
|
22167 | setUpAttributes(hostRenderer, hostRNode, attrs);
|
22168 | }
|
22169 | if (classes && classes.length > 0) {
|
22170 | writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
|
22171 | }
|
22172 | }
|
22173 | }
|
22174 | tElementNode = getTNode(rootTView, 0);
|
22175 | if (projectableNodes !== undefined) {
|
22176 | const projection = tElementNode.projection = [];
|
22177 | for (let i = 0; i < this.ngContentSelectors.length; i++) {
|
22178 | const nodesforSlot = projectableNodes[i];
|
22179 |
|
22180 |
|
22181 |
|
22182 |
|
22183 |
|
22184 | projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
|
22185 | }
|
22186 | }
|
22187 |
|
22188 |
|
22189 |
|
22190 | component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
|
22191 | renderView(rootTView, rootLView, null);
|
22192 | }
|
22193 | finally {
|
22194 | leaveView();
|
22195 | }
|
22196 | const componentRef = new ComponentRef$1(this.componentType, component, createElementRef(ElementRef, tElementNode, rootLView), rootLView, tElementNode);
|
22197 |
|
22198 | ngDevMode && assertNodeOfPossibleTypes(rootTView.node, [2 ]);
|
22199 | rootTView.node.child = tElementNode;
|
22200 | return componentRef;
|
22201 | }
|
22202 | }
|
22203 | const componentFactoryResolver = new ComponentFactoryResolver$1();
|
22204 |
|
22205 |
|
22206 |
|
22207 |
|
22208 |
|
22209 |
|
22210 |
|
22211 | function injectComponentFactoryResolver() {
|
22212 | return componentFactoryResolver;
|
22213 | }
|
22214 |
|
22215 |
|
22216 |
|
22217 |
|
22218 |
|
22219 |
|
22220 |
|
22221 |
|
22222 | class ComponentRef$1 extends ComponentRef {
|
22223 | constructor(componentType, instance, location, _rootLView, _tNode) {
|
22224 | super();
|
22225 | this.location = location;
|
22226 | this._rootLView = _rootLView;
|
22227 | this._tNode = _tNode;
|
22228 | this.destroyCbs = [];
|
22229 | this.instance = instance;
|
22230 | this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
|
22231 | assignTViewNodeToLView(_rootLView[TVIEW], null, -1, _rootLView);
|
22232 | this.componentType = componentType;
|
22233 | }
|
22234 | get injector() {
|
22235 | return new NodeInjector(this._tNode, this._rootLView);
|
22236 | }
|
22237 | destroy() {
|
22238 | if (this.destroyCbs) {
|
22239 | this.destroyCbs.forEach(fn => fn());
|
22240 | this.destroyCbs = null;
|
22241 | !this.hostView.destroyed && this.hostView.destroy();
|
22242 | }
|
22243 | }
|
22244 | onDestroy(callback) {
|
22245 | if (this.destroyCbs) {
|
22246 | this.destroyCbs.push(callback);
|
22247 | }
|
22248 | }
|
22249 | }
|
22250 |
|
22251 |
|
22252 |
|
22253 |
|
22254 |
|
22255 |
|
22256 |
|
22257 |
|
22258 |
|
22259 |
|
22260 | const u = undefined;
|
22261 | function plural(n) {
|
22262 | let i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length;
|
22263 | if (i === 1 && v === 0)
|
22264 | return 1;
|
22265 | return 5;
|
22266 | }
|
22267 | var localeEn = [
|
22268 | 'en',
|
22269 | [['a', 'p'], ['AM', 'PM'], u],
|
22270 | [['AM', 'PM'], u, u],
|
22271 | [
|
22272 | ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
22273 | ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
22274 | ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
|
22275 | ],
|
22276 | u,
|
22277 | [
|
22278 | ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
|
22279 | ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
22280 | [
|
22281 | 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
|
22282 | 'October', 'November', 'December'
|
22283 | ]
|
22284 | ],
|
22285 | u,
|
22286 | [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']],
|
22287 | 0,
|
22288 | [6, 0],
|
22289 | ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'],
|
22290 | ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'],
|
22291 | ['{1}, {0}', u, '{1} \'at\' {0}', u],
|
22292 | ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'],
|
22293 | ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'],
|
22294 | 'USD',
|
22295 | '$',
|
22296 | 'US Dollar',
|
22297 | {},
|
22298 | 'ltr',
|
22299 | plural
|
22300 | ];
|
22301 |
|
22302 |
|
22303 |
|
22304 |
|
22305 |
|
22306 |
|
22307 |
|
22308 |
|
22309 |
|
22310 |
|
22311 |
|
22312 | let LOCALE_DATA = {};
|
22313 |
|
22314 |
|
22315 |
|
22316 |
|
22317 |
|
22318 |
|
22319 | function registerLocaleData(data, localeId, extraData) {
|
22320 | if (typeof localeId !== 'string') {
|
22321 | extraData = localeId;
|
22322 | localeId = data[LocaleDataIndex.LocaleId];
|
22323 | }
|
22324 | localeId = localeId.toLowerCase().replace(/_/g, '-');
|
22325 | LOCALE_DATA[localeId] = data;
|
22326 | if (extraData) {
|
22327 | LOCALE_DATA[localeId][LocaleDataIndex.ExtraData] = extraData;
|
22328 | }
|
22329 | }
|
22330 |
|
22331 |
|
22332 |
|
22333 |
|
22334 |
|
22335 |
|
22336 |
|
22337 | function findLocaleData(locale) {
|
22338 | const normalizedLocale = normalizeLocale(locale);
|
22339 | let match = getLocaleData(normalizedLocale);
|
22340 | if (match) {
|
22341 | return match;
|
22342 | }
|
22343 |
|
22344 | const parentLocale = normalizedLocale.split('-')[0];
|
22345 | match = getLocaleData(parentLocale);
|
22346 | if (match) {
|
22347 | return match;
|
22348 | }
|
22349 | if (parentLocale === 'en') {
|
22350 | return localeEn;
|
22351 | }
|
22352 | throw new Error(`Missing locale data for the locale "${locale}".`);
|
22353 | }
|
22354 |
|
22355 |
|
22356 |
|
22357 |
|
22358 |
|
22359 |
|
22360 |
|
22361 |
|
22362 |
|
22363 | function getLocaleCurrencyCode(locale) {
|
22364 | const data = findLocaleData(locale);
|
22365 | return data[LocaleDataIndex.CurrencyCode] || null;
|
22366 | }
|
22367 |
|
22368 |
|
22369 |
|
22370 |
|
22371 |
|
22372 |
|
22373 |
|
22374 |
|
22375 | function getLocalePluralCase(locale) {
|
22376 | const data = findLocaleData(locale);
|
22377 | return data[LocaleDataIndex.PluralCase];
|
22378 | }
|
22379 |
|
22380 |
|
22381 |
|
22382 |
|
22383 | function getLocaleData(normalizedLocale) {
|
22384 | if (!(normalizedLocale in LOCALE_DATA)) {
|
22385 | LOCALE_DATA[normalizedLocale] = _global.ng && _global.ng.common && _global.ng.common.locales &&
|
22386 | _global.ng.common.locales[normalizedLocale];
|
22387 | }
|
22388 | return LOCALE_DATA[normalizedLocale];
|
22389 | }
|
22390 |
|
22391 |
|
22392 |
|
22393 | function unregisterAllLocaleData() {
|
22394 | LOCALE_DATA = {};
|
22395 | }
|
22396 |
|
22397 |
|
22398 |
|
22399 | var LocaleDataIndex;
|
22400 | (function (LocaleDataIndex) {
|
22401 | LocaleDataIndex[LocaleDataIndex["LocaleId"] = 0] = "LocaleId";
|
22402 | LocaleDataIndex[LocaleDataIndex["DayPeriodsFormat"] = 1] = "DayPeriodsFormat";
|
22403 | LocaleDataIndex[LocaleDataIndex["DayPeriodsStandalone"] = 2] = "DayPeriodsStandalone";
|
22404 | LocaleDataIndex[LocaleDataIndex["DaysFormat"] = 3] = "DaysFormat";
|
22405 | LocaleDataIndex[LocaleDataIndex["DaysStandalone"] = 4] = "DaysStandalone";
|
22406 | LocaleDataIndex[LocaleDataIndex["MonthsFormat"] = 5] = "MonthsFormat";
|
22407 | LocaleDataIndex[LocaleDataIndex["MonthsStandalone"] = 6] = "MonthsStandalone";
|
22408 | LocaleDataIndex[LocaleDataIndex["Eras"] = 7] = "Eras";
|
22409 | LocaleDataIndex[LocaleDataIndex["FirstDayOfWeek"] = 8] = "FirstDayOfWeek";
|
22410 | LocaleDataIndex[LocaleDataIndex["WeekendRange"] = 9] = "WeekendRange";
|
22411 | LocaleDataIndex[LocaleDataIndex["DateFormat"] = 10] = "DateFormat";
|
22412 | LocaleDataIndex[LocaleDataIndex["TimeFormat"] = 11] = "TimeFormat";
|
22413 | LocaleDataIndex[LocaleDataIndex["DateTimeFormat"] = 12] = "DateTimeFormat";
|
22414 | LocaleDataIndex[LocaleDataIndex["NumberSymbols"] = 13] = "NumberSymbols";
|
22415 | LocaleDataIndex[LocaleDataIndex["NumberFormats"] = 14] = "NumberFormats";
|
22416 | LocaleDataIndex[LocaleDataIndex["CurrencyCode"] = 15] = "CurrencyCode";
|
22417 | LocaleDataIndex[LocaleDataIndex["CurrencySymbol"] = 16] = "CurrencySymbol";
|
22418 | LocaleDataIndex[LocaleDataIndex["CurrencyName"] = 17] = "CurrencyName";
|
22419 | LocaleDataIndex[LocaleDataIndex["Currencies"] = 18] = "Currencies";
|
22420 | LocaleDataIndex[LocaleDataIndex["Directionality"] = 19] = "Directionality";
|
22421 | LocaleDataIndex[LocaleDataIndex["PluralCase"] = 20] = "PluralCase";
|
22422 | LocaleDataIndex[LocaleDataIndex["ExtraData"] = 21] = "ExtraData";
|
22423 | })(LocaleDataIndex || (LocaleDataIndex = {}));
|
22424 |
|
22425 |
|
22426 |
|
22427 | function normalizeLocale(locale) {
|
22428 | return locale.toLowerCase().replace(/_/g, '-');
|
22429 | }
|
22430 |
|
22431 |
|
22432 |
|
22433 |
|
22434 |
|
22435 |
|
22436 |
|
22437 |
|
22438 | const pluralMapping = ['zero', 'one', 'two', 'few', 'many'];
|
22439 |
|
22440 |
|
22441 |
|
22442 | function getPluralCase(value, locale) {
|
22443 | const plural = getLocalePluralCase(locale)(parseInt(value, 10));
|
22444 | const result = pluralMapping[plural];
|
22445 | return (result !== undefined) ? result : 'other';
|
22446 | }
|
22447 |
|
22448 |
|
22449 |
|
22450 | const DEFAULT_LOCALE_ID = 'en-US';
|
22451 |
|
22452 |
|
22453 |
|
22454 |
|
22455 | const USD_CURRENCY_CODE = 'USD';
|
22456 |
|
22457 |
|
22458 |
|
22459 |
|
22460 |
|
22461 |
|
22462 |
|
22463 |
|
22464 |
|
22465 |
|
22466 |
|
22467 |
|
22468 |
|
22469 | let LOCALE_ID = DEFAULT_LOCALE_ID;
|
22470 |
|
22471 |
|
22472 |
|
22473 |
|
22474 |
|
22475 |
|
22476 |
|
22477 | function setLocaleId(localeId) {
|
22478 | assertDefined(localeId, `Expected localeId to be defined`);
|
22479 | if (typeof localeId === 'string') {
|
22480 | LOCALE_ID = localeId.toLowerCase().replace(/_/g, '-');
|
22481 | }
|
22482 | }
|
22483 |
|
22484 |
|
22485 |
|
22486 |
|
22487 |
|
22488 | function getLocaleId() {
|
22489 | return LOCALE_ID;
|
22490 | }
|
22491 |
|
22492 |
|
22493 |
|
22494 |
|
22495 |
|
22496 |
|
22497 |
|
22498 |
|
22499 |
|
22500 |
|
22501 |
|
22502 | if (typeof ngI18nClosureMode === 'undefined') {
|
22503 |
|
22504 |
|
22505 |
|
22506 |
|
22507 | (function () {
|
22508 |
|
22509 | _global['ngI18nClosureMode'] =
|
22510 |
|
22511 |
|
22512 | typeof goog !== 'undefined' && typeof goog.getMsg === 'function';
|
22513 | })();
|
22514 | }
|
22515 |
|
22516 |
|
22517 |
|
22518 |
|
22519 |
|
22520 |
|
22521 |
|
22522 |
|
22523 | function getParentFromI18nMutateOpCode(mergedCode) {
|
22524 | return mergedCode >>> 17 ;
|
22525 | }
|
22526 | function getRefFromI18nMutateOpCode(mergedCode) {
|
22527 | return (mergedCode & 131064 ) >>> 3 ;
|
22528 | }
|
22529 | function getInstructionFromI18nMutateOpCode(mergedCode) {
|
22530 | return mergedCode & 7 ;
|
22531 | }
|
22532 |
|
22533 |
|
22534 |
|
22535 |
|
22536 |
|
22537 | const ELEMENT_MARKER = {
|
22538 | marker: 'element'
|
22539 | };
|
22540 |
|
22541 |
|
22542 |
|
22543 |
|
22544 |
|
22545 | const COMMENT_MARKER = {
|
22546 | marker: 'comment'
|
22547 | };
|
22548 |
|
22549 |
|
22550 | const unusedValueExportToPlacateAjd$6 = 1;
|
22551 |
|
22552 |
|
22553 |
|
22554 |
|
22555 |
|
22556 |
|
22557 |
|
22558 |
|
22559 | const i18nIndexStack = [];
|
22560 | let i18nIndexStackPointer = -1;
|
22561 | function popI18nIndex() {
|
22562 | return i18nIndexStack[i18nIndexStackPointer--];
|
22563 | }
|
22564 | function pushI18nIndex(index) {
|
22565 | i18nIndexStack[++i18nIndexStackPointer] = index;
|
22566 | }
|
22567 | let changeMask = 0b0;
|
22568 | let shiftsCounter = 0;
|
22569 | function setMaskBit(bit) {
|
22570 | if (bit) {
|
22571 | changeMask = changeMask | (1 << shiftsCounter);
|
22572 | }
|
22573 | shiftsCounter++;
|
22574 | }
|
22575 | function applyI18n(tView, lView, index) {
|
22576 | if (shiftsCounter > 0) {
|
22577 | ngDevMode && assertDefined(tView, `tView should be defined`);
|
22578 | const tI18n = tView.data[index + HEADER_OFFSET];
|
22579 | let updateOpCodes;
|
22580 | let tIcus = null;
|
22581 | if (Array.isArray(tI18n)) {
|
22582 | updateOpCodes = tI18n;
|
22583 | }
|
22584 | else {
|
22585 | updateOpCodes = tI18n.update;
|
22586 | tIcus = tI18n.icus;
|
22587 | }
|
22588 | const bindingsStartIndex = getBindingIndex() - shiftsCounter - 1;
|
22589 | applyUpdateOpCodes(tView, tIcus, lView, updateOpCodes, bindingsStartIndex, changeMask);
|
22590 |
|
22591 | changeMask = 0b0;
|
22592 | shiftsCounter = 0;
|
22593 | }
|
22594 | }
|
22595 |
|
22596 |
|
22597 |
|
22598 |
|
22599 |
|
22600 |
|
22601 |
|
22602 |
|
22603 | function applyCreateOpCodes(tView, rootindex, createOpCodes, lView) {
|
22604 | const renderer = lView[RENDERER];
|
22605 | let currentTNode = null;
|
22606 | let previousTNode = null;
|
22607 | const visitedNodes = [];
|
22608 | for (let i = 0; i < createOpCodes.length; i++) {
|
22609 | const opCode = createOpCodes[i];
|
22610 | if (typeof opCode == 'string') {
|
22611 | const textRNode = createTextNode(opCode, renderer);
|
22612 | const textNodeIndex = createOpCodes[++i];
|
22613 | ngDevMode && ngDevMode.rendererCreateTextNode++;
|
22614 | previousTNode = currentTNode;
|
22615 | currentTNode =
|
22616 | createDynamicNodeAtIndex(tView, lView, textNodeIndex, 3 , textRNode, null);
|
22617 | visitedNodes.push(textNodeIndex);
|
22618 | setIsNotParent();
|
22619 | }
|
22620 | else if (typeof opCode == 'number') {
|
22621 | switch (opCode & 7 ) {
|
22622 | case 1 :
|
22623 | const destinationNodeIndex = opCode >>> 17 ;
|
22624 | let destinationTNode;
|
22625 | if (destinationNodeIndex === rootindex) {
|
22626 |
|
22627 |
|
22628 | destinationTNode = lView[T_HOST];
|
22629 | }
|
22630 | else {
|
22631 | destinationTNode = getTNode(tView, destinationNodeIndex);
|
22632 | }
|
22633 | ngDevMode &&
|
22634 | assertDefined(currentTNode, `You need to create or select a node before you can insert it into the DOM`);
|
22635 | previousTNode =
|
22636 | appendI18nNode(tView, currentTNode, destinationTNode, previousTNode, lView);
|
22637 | break;
|
22638 | case 0 :
|
22639 |
|
22640 |
|
22641 | const isParent = opCode >= 0;
|
22642 |
|
22643 | const nodeIndex = (isParent ? opCode : ~opCode) >>> 3 ;
|
22644 | visitedNodes.push(nodeIndex);
|
22645 | previousTNode = currentTNode;
|
22646 | currentTNode = getTNode(tView, nodeIndex);
|
22647 | if (currentTNode) {
|
22648 | setPreviousOrParentTNode(currentTNode, isParent);
|
22649 | }
|
22650 | break;
|
22651 | case 5 :
|
22652 | const elementIndex = opCode >>> 3 ;
|
22653 | previousTNode = currentTNode = getTNode(tView, elementIndex);
|
22654 | setPreviousOrParentTNode(currentTNode, false);
|
22655 | break;
|
22656 | case 4 :
|
22657 | const elementNodeIndex = opCode >>> 3 ;
|
22658 | const attrName = createOpCodes[++i];
|
22659 | const attrValue = createOpCodes[++i];
|
22660 |
|
22661 |
|
22662 | elementAttributeInternal(getTNode(tView, elementNodeIndex), lView, attrName, attrValue, null, null);
|
22663 | break;
|
22664 | default:
|
22665 | throw new Error(`Unable to determine the type of mutate operation for "${opCode}"`);
|
22666 | }
|
22667 | }
|
22668 | else {
|
22669 | switch (opCode) {
|
22670 | case COMMENT_MARKER:
|
22671 | const commentValue = createOpCodes[++i];
|
22672 | const commentNodeIndex = createOpCodes[++i];
|
22673 | ngDevMode &&
|
22674 | assertEqual(typeof commentValue, 'string', `Expected "${commentValue}" to be a comment node value`);
|
22675 | const commentRNode = renderer.createComment(commentValue);
|
22676 | ngDevMode && ngDevMode.rendererCreateComment++;
|
22677 | previousTNode = currentTNode;
|
22678 | currentTNode = createDynamicNodeAtIndex(tView, lView, commentNodeIndex, 5 , commentRNode, null);
|
22679 | visitedNodes.push(commentNodeIndex);
|
22680 | attachPatchData(commentRNode, lView);
|
22681 |
|
22682 | setIsNotParent();
|
22683 | break;
|
22684 | case ELEMENT_MARKER:
|
22685 | const tagNameValue = createOpCodes[++i];
|
22686 | const elementNodeIndex = createOpCodes[++i];
|
22687 | ngDevMode &&
|
22688 | assertEqual(typeof tagNameValue, 'string', `Expected "${tagNameValue}" to be an element node tag name`);
|
22689 | const elementRNode = renderer.createElement(tagNameValue);
|
22690 | ngDevMode && ngDevMode.rendererCreateElement++;
|
22691 | previousTNode = currentTNode;
|
22692 | currentTNode = createDynamicNodeAtIndex(tView, lView, elementNodeIndex, 3 , elementRNode, tagNameValue);
|
22693 | visitedNodes.push(elementNodeIndex);
|
22694 | break;
|
22695 | default:
|
22696 | throw new Error(`Unable to determine the type of mutate operation for "${opCode}"`);
|
22697 | }
|
22698 | }
|
22699 | }
|
22700 | setIsNotParent();
|
22701 | return visitedNodes;
|
22702 | }
|
22703 |
|
22704 |
|
22705 |
|
22706 |
|
22707 |
|
22708 |
|
22709 |
|
22710 |
|
22711 |
|
22712 |
|
22713 |
|
22714 | function applyUpdateOpCodes(tView, tIcus, lView, updateOpCodes, bindingsStartIndex, changeMask) {
|
22715 | let caseCreated = false;
|
22716 | for (let i = 0; i < updateOpCodes.length; i++) {
|
22717 |
|
22718 | const checkBit = updateOpCodes[i];
|
22719 |
|
22720 | const skipCodes = updateOpCodes[++i];
|
22721 | if (checkBit & changeMask) {
|
22722 |
|
22723 | let value = '';
|
22724 | for (let j = i + 1; j <= (i + skipCodes); j++) {
|
22725 | const opCode = updateOpCodes[j];
|
22726 | if (typeof opCode == 'string') {
|
22727 | value += opCode;
|
22728 | }
|
22729 | else if (typeof opCode == 'number') {
|
22730 | if (opCode < 0) {
|
22731 |
|
22732 | value += renderStringify(lView[bindingsStartIndex - opCode]);
|
22733 | }
|
22734 | else {
|
22735 | const nodeIndex = opCode >>> 2 ;
|
22736 | switch (opCode & 3 ) {
|
22737 | case 1 :
|
22738 | const propName = updateOpCodes[++j];
|
22739 | const sanitizeFn = updateOpCodes[++j];
|
22740 | elementPropertyInternal(tView, getTNode(tView, nodeIndex), lView, propName, value, lView[RENDERER], sanitizeFn, false);
|
22741 | break;
|
22742 | case 0 :
|
22743 | textBindingInternal(lView, nodeIndex, value);
|
22744 | break;
|
22745 | case 2 :
|
22746 | caseCreated =
|
22747 | applyIcuSwitchCase(tView, tIcus, updateOpCodes[++j], lView, value);
|
22748 | break;
|
22749 | case 3 :
|
22750 | applyIcuUpdateCase(tView, tIcus, updateOpCodes[++j], bindingsStartIndex, lView, caseCreated);
|
22751 | break;
|
22752 | }
|
22753 | }
|
22754 | }
|
22755 | }
|
22756 | }
|
22757 | i += skipCodes;
|
22758 | }
|
22759 | }
|
22760 |
|
22761 |
|
22762 |
|
22763 |
|
22764 |
|
22765 |
|
22766 |
|
22767 |
|
22768 |
|
22769 |
|
22770 |
|
22771 | function applyIcuUpdateCase(tView, tIcus, tIcuIndex, bindingsStartIndex, lView, caseCreated) {
|
22772 | ngDevMode && assertIndexInRange(tIcus, tIcuIndex);
|
22773 | const tIcu = tIcus[tIcuIndex];
|
22774 | ngDevMode && assertIndexInRange(lView, tIcu.currentCaseLViewIndex);
|
22775 | const activeCaseIndex = lView[tIcu.currentCaseLViewIndex];
|
22776 | if (activeCaseIndex !== null) {
|
22777 | const mask = caseCreated ?
|
22778 | -1 :
|
22779 | changeMask;
|
22780 | applyUpdateOpCodes(tView, tIcus, lView, tIcu.update[activeCaseIndex], bindingsStartIndex, mask);
|
22781 | }
|
22782 | }
|
22783 |
|
22784 |
|
22785 |
|
22786 |
|
22787 |
|
22788 |
|
22789 |
|
22790 |
|
22791 |
|
22792 |
|
22793 |
|
22794 |
|
22795 |
|
22796 | function applyIcuSwitchCase(tView, tIcus, tICuIndex, lView, value) {
|
22797 | applyIcuSwitchCaseRemove(tView, tIcus, tICuIndex, lView);
|
22798 |
|
22799 | let caseCreated = false;
|
22800 | const tIcu = tIcus[tICuIndex];
|
22801 | const caseIndex = getCaseIndex(tIcu, value);
|
22802 | lView[tIcu.currentCaseLViewIndex] = caseIndex !== -1 ? caseIndex : null;
|
22803 | if (caseIndex > -1) {
|
22804 |
|
22805 | applyCreateOpCodes(tView, -1,
|
22806 | tIcu.create[caseIndex], lView);
|
22807 | caseCreated = true;
|
22808 | }
|
22809 | return caseCreated;
|
22810 | }
|
22811 |
|
22812 |
|
22813 |
|
22814 |
|
22815 |
|
22816 |
|
22817 |
|
22818 |
|
22819 |
|
22820 |
|
22821 |
|
22822 |
|
22823 | function applyIcuSwitchCaseRemove(tView, tIcus, tIcuIndex, lView) {
|
22824 | ngDevMode && assertIndexInRange(tIcus, tIcuIndex);
|
22825 | const tIcu = tIcus[tIcuIndex];
|
22826 | const activeCaseIndex = lView[tIcu.currentCaseLViewIndex];
|
22827 | if (activeCaseIndex !== null) {
|
22828 | const removeCodes = tIcu.remove[activeCaseIndex];
|
22829 | for (let k = 0; k < removeCodes.length; k++) {
|
22830 | const removeOpCode = removeCodes[k];
|
22831 | const nodeOrIcuIndex = removeOpCode >>> 3 ;
|
22832 | switch (removeOpCode & 7 ) {
|
22833 | case 3 :
|
22834 |
|
22835 |
|
22836 |
|
22837 |
|
22838 | removeNode(tView, lView, nodeOrIcuIndex, false);
|
22839 | break;
|
22840 | case 6 :
|
22841 | applyIcuSwitchCaseRemove(tView, tIcus, nodeOrIcuIndex, lView);
|
22842 | break;
|
22843 | }
|
22844 | }
|
22845 | }
|
22846 | }
|
22847 | function appendI18nNode(tView, tNode, parentTNode, previousTNode, lView) {
|
22848 | ngDevMode && ngDevMode.rendererMoveNode++;
|
22849 | const nextNode = tNode.next;
|
22850 | if (!previousTNode) {
|
22851 | previousTNode = parentTNode;
|
22852 | }
|
22853 |
|
22854 | if (previousTNode === parentTNode && tNode !== parentTNode.child) {
|
22855 | tNode.next = parentTNode.child;
|
22856 | parentTNode.child = tNode;
|
22857 | }
|
22858 | else if (previousTNode !== parentTNode && tNode !== previousTNode.next) {
|
22859 | tNode.next = previousTNode.next;
|
22860 | previousTNode.next = tNode;
|
22861 | }
|
22862 | else {
|
22863 | tNode.next = null;
|
22864 | }
|
22865 | if (parentTNode !== lView[T_HOST]) {
|
22866 | tNode.parent = parentTNode;
|
22867 | }
|
22868 |
|
22869 | let cursor = tNode.next;
|
22870 | while (cursor) {
|
22871 | if (cursor.next === tNode) {
|
22872 | cursor.next = nextNode;
|
22873 | }
|
22874 | cursor = cursor.next;
|
22875 | }
|
22876 |
|
22877 | if (tNode.type === 1 ) {
|
22878 | applyProjection(tView, lView, tNode);
|
22879 | return tNode;
|
22880 | }
|
22881 | appendChild(tView, lView, getNativeByTNode(tNode, lView), tNode);
|
22882 | const slotValue = lView[tNode.index];
|
22883 | if (tNode.type !== 0 && isLContainer(slotValue)) {
|
22884 |
|
22885 | appendChild(tView, lView, slotValue[NATIVE], tNode);
|
22886 | }
|
22887 | return tNode;
|
22888 | }
|
22889 |
|
22890 |
|
22891 |
|
22892 | function i18nEndFirstPass(tView, lView) {
|
22893 | ngDevMode &&
|
22894 | assertEqual(getBindingIndex(), tView.bindingStartIndex, 'i18nEnd should be called before any binding');
|
22895 | const rootIndex = popI18nIndex();
|
22896 | const tI18n = tView.data[rootIndex + HEADER_OFFSET];
|
22897 | ngDevMode && assertDefined(tI18n, `You should call i18nStart before i18nEnd`);
|
22898 |
|
22899 | const lastCreatedNode = getPreviousOrParentTNode();
|
22900 |
|
22901 | const visitedNodes = applyCreateOpCodes(tView, rootIndex, tI18n.create, lView);
|
22902 |
|
22903 | let index = rootIndex + 1;
|
22904 | while (index <= lastCreatedNode.index - HEADER_OFFSET) {
|
22905 | if (visitedNodes.indexOf(index) === -1) {
|
22906 | removeNode(tView, lView, index, true);
|
22907 | }
|
22908 |
|
22909 | const tNode = getTNode(tView, index);
|
22910 | if (tNode &&
|
22911 | (tNode.type === 0 || tNode.type === 3 ||
|
22912 | tNode.type === 4 ) &&
|
22913 | tNode.localNames !== null) {
|
22914 |
|
22915 |
|
22916 |
|
22917 | index += tNode.localNames.length >> 1;
|
22918 | }
|
22919 | index++;
|
22920 | }
|
22921 | }
|
22922 | function removeNode(tView, lView, index, markAsDetached) {
|
22923 | const removedPhTNode = getTNode(tView, index);
|
22924 | const removedPhRNode = getNativeByIndex(index, lView);
|
22925 | if (removedPhRNode) {
|
22926 | nativeRemoveNode(lView[RENDERER], removedPhRNode);
|
22927 | }
|
22928 | const slotValue = load(lView, index);
|
22929 | if (isLContainer(slotValue)) {
|
22930 | const lContainer = slotValue;
|
22931 | if (removedPhTNode.type !== 0 ) {
|
22932 | nativeRemoveNode(lView[RENDERER], lContainer[NATIVE]);
|
22933 | }
|
22934 | }
|
22935 | if (markAsDetached) {
|
22936 |
|
22937 | removedPhTNode.flags |= 64 ;
|
22938 | }
|
22939 | ngDevMode && ngDevMode.rendererRemoveNode++;
|
22940 | }
|
22941 |
|
22942 |
|
22943 |
|
22944 | function createDynamicNodeAtIndex(tView, lView, index, type, native, name) {
|
22945 | const previousOrParentTNode = getPreviousOrParentTNode();
|
22946 | ngDevMode && assertIndexInRange(lView, index + HEADER_OFFSET);
|
22947 | lView[index + HEADER_OFFSET] = native;
|
22948 |
|
22949 | const tNode = getOrCreateTNode(tView, lView[T_HOST], index, type, name, null);
|
22950 |
|
22951 |
|
22952 | if (previousOrParentTNode && previousOrParentTNode.next === tNode) {
|
22953 | previousOrParentTNode.next = null;
|
22954 | }
|
22955 | return tNode;
|
22956 | }
|
22957 |
|
22958 |
|
22959 |
|
22960 |
|
22961 |
|
22962 |
|
22963 | function getCaseIndex(icuExpression, bindingValue) {
|
22964 | let index = icuExpression.cases.indexOf(bindingValue);
|
22965 | if (index === -1) {
|
22966 | switch (icuExpression.type) {
|
22967 | case 1 : {
|
22968 | const resolvedCase = getPluralCase(bindingValue, getLocaleId());
|
22969 | index = icuExpression.cases.indexOf(resolvedCase);
|
22970 | if (index === -1 && resolvedCase !== 'other') {
|
22971 | index = icuExpression.cases.indexOf('other');
|
22972 | }
|
22973 | break;
|
22974 | }
|
22975 | case 0 : {
|
22976 | index = icuExpression.cases.indexOf('other');
|
22977 | break;
|
22978 | }
|
22979 | }
|
22980 | }
|
22981 | return index;
|
22982 | }
|
22983 |
|
22984 |
|
22985 |
|
22986 |
|
22987 |
|
22988 |
|
22989 |
|
22990 |
|
22991 |
|
22992 |
|
22993 |
|
22994 |
|
22995 |
|
22996 |
|
22997 |
|
22998 |
|
22999 |
|
23000 |
|
23001 | function i18nUpdateOpCodesToString(opcodes) {
|
23002 | const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
|
23003 | let lines = [];
|
23004 | function consumeOpCode(value) {
|
23005 | const ref = value >>> 2 ;
|
23006 | const opCode = value & 3 ;
|
23007 | switch (opCode) {
|
23008 | case 0 :
|
23009 | return `(lView[${ref}] as Text).textContent = $$$`;
|
23010 | case 1 :
|
23011 | const attrName = parser.consumeString();
|
23012 | const sanitizationFn = parser.consumeFunction();
|
23013 | const value = sanitizationFn ? `(${sanitizationFn})($$$)` : '$$$';
|
23014 | return `(lView[${ref}] as Element).setAttribute('${attrName}', ${value})`;
|
23015 | case 2 :
|
23016 | return `icuSwitchCase(lView[${ref}] as Comment, ${parser.consumeNumber()}, $$$)`;
|
23017 | case 3 :
|
23018 | return `icuUpdateCase(lView[${ref}] as Comment, ${parser.consumeNumber()})`;
|
23019 | }
|
23020 | throw new Error('unexpected OpCode');
|
23021 | }
|
23022 | while (parser.hasMore()) {
|
23023 | let mask = parser.consumeNumber();
|
23024 | let size = parser.consumeNumber();
|
23025 | const end = parser.i + size;
|
23026 | const statements = [];
|
23027 | let statement = '';
|
23028 | while (parser.i < end) {
|
23029 | let value = parser.consumeNumberOrString();
|
23030 | if (typeof value === 'string') {
|
23031 | statement += value;
|
23032 | }
|
23033 | else if (value < 0) {
|
23034 |
|
23035 | statement += '${lView[' + (0 - value) + ']}';
|
23036 | }
|
23037 | else {
|
23038 |
|
23039 | const opCodeText = consumeOpCode(value);
|
23040 | statements.push(opCodeText.replace('$$$', '`' + statement + '`') + ';');
|
23041 | statement = '';
|
23042 | }
|
23043 | }
|
23044 | lines.push(`if (mask & 0b${mask.toString(2)}) { ${statements.join(' ')} }`);
|
23045 | }
|
23046 | return lines;
|
23047 | }
|
23048 |
|
23049 |
|
23050 |
|
23051 |
|
23052 |
|
23053 |
|
23054 |
|
23055 |
|
23056 |
|
23057 |
|
23058 | function i18nMutateOpCodesToString(opcodes) {
|
23059 | const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
|
23060 | let lines = [];
|
23061 | function consumeOpCode(opCode) {
|
23062 | const parent = getParentFromI18nMutateOpCode(opCode);
|
23063 | const ref = getRefFromI18nMutateOpCode(opCode);
|
23064 | switch (getInstructionFromI18nMutateOpCode(opCode)) {
|
23065 | case 0 :
|
23066 | lastRef = ref;
|
23067 | return '';
|
23068 | case 1 :
|
23069 | return `(lView[${parent}] as Element).appendChild(lView[${lastRef}])`;
|
23070 | case 3 :
|
23071 | return `(lView[${parent}] as Element).remove(lView[${ref}])`;
|
23072 | case 4 :
|
23073 | return `(lView[${ref}] as Element).setAttribute("${parser.consumeString()}", "${parser.consumeString()}")`;
|
23074 | case 5 :
|
23075 | return `setPreviousOrParentTNode(tView.data[${ref}] as TNode)`;
|
23076 | case 6 :
|
23077 | return `removeNestedICU(${ref})`;
|
23078 | }
|
23079 | throw new Error('Unexpected OpCode');
|
23080 | }
|
23081 | let lastRef = -1;
|
23082 | while (parser.hasMore()) {
|
23083 | let value = parser.consumeNumberStringOrMarker();
|
23084 | if (value === COMMENT_MARKER) {
|
23085 | const text = parser.consumeString();
|
23086 | lastRef = parser.consumeNumber();
|
23087 | lines.push(`lView[${lastRef}] = document.createComment("${text}")`);
|
23088 | }
|
23089 | else if (value === ELEMENT_MARKER) {
|
23090 | const text = parser.consumeString();
|
23091 | lastRef = parser.consumeNumber();
|
23092 | lines.push(`lView[${lastRef}] = document.createElement("${text}")`);
|
23093 | }
|
23094 | else if (typeof value === 'string') {
|
23095 | lastRef = parser.consumeNumber();
|
23096 | lines.push(`lView[${lastRef}] = document.createTextNode("${value}")`);
|
23097 | }
|
23098 | else if (typeof value === 'number') {
|
23099 | const line = consumeOpCode(value);
|
23100 | line && lines.push(line);
|
23101 | }
|
23102 | else {
|
23103 | throw new Error('Unexpected value');
|
23104 | }
|
23105 | }
|
23106 | return lines;
|
23107 | }
|
23108 | class OpCodeParser {
|
23109 | constructor(codes) {
|
23110 | this.i = 0;
|
23111 | this.codes = codes;
|
23112 | }
|
23113 | hasMore() {
|
23114 | return this.i < this.codes.length;
|
23115 | }
|
23116 | consumeNumber() {
|
23117 | let value = this.codes[this.i++];
|
23118 | assertNumber(value, 'expecting number in OpCode');
|
23119 | return value;
|
23120 | }
|
23121 | consumeString() {
|
23122 | let value = this.codes[this.i++];
|
23123 | assertString(value, 'expecting string in OpCode');
|
23124 | return value;
|
23125 | }
|
23126 | consumeFunction() {
|
23127 | let value = this.codes[this.i++];
|
23128 | if (value === null || typeof value === 'function') {
|
23129 | return value;
|
23130 | }
|
23131 | throw new Error('expecting function in OpCode');
|
23132 | }
|
23133 | consumeNumberOrString() {
|
23134 | let value = this.codes[this.i++];
|
23135 | if (typeof value === 'string') {
|
23136 | return value;
|
23137 | }
|
23138 | assertNumber(value, 'expecting number or string in OpCode');
|
23139 | return value;
|
23140 | }
|
23141 | consumeNumberStringOrMarker() {
|
23142 | let value = this.codes[this.i++];
|
23143 | if (typeof value === 'string' || typeof value === 'number' || value == COMMENT_MARKER ||
|
23144 | value == ELEMENT_MARKER) {
|
23145 | return value;
|
23146 | }
|
23147 | assertNumber(value, 'expecting number, string, COMMENT_MARKER or ELEMENT_MARKER in OpCode');
|
23148 | return value;
|
23149 | }
|
23150 | }
|
23151 |
|
23152 |
|
23153 |
|
23154 |
|
23155 |
|
23156 |
|
23157 |
|
23158 |
|
23159 | const BINDING_REGEXP = /�(\d+):?\d*�/gi;
|
23160 | const ICU_REGEXP = /({\s*�\d+:?\d*�\s*,\s*\S{6}\s*,[\s\S]*})/gi;
|
23161 | const NESTED_ICU = /�(\d+)�/;
|
23162 | const ICU_BLOCK_REGEXP = /^\s*(�\d+:?\d*�)\s*,\s*(select|plural)\s*,/;
|
23163 |
|
23164 |
|
23165 |
|
23166 | let i18nVarsCount;
|
23167 | const parentIndexStack = [];
|
23168 | const MARKER = `�`;
|
23169 | const SUBTEMPLATE_REGEXP = /�\/?\*(\d+:\d+)�/gi;
|
23170 | const PH_REGEXP = /�(\/?[#*!]\d+):?\d*�/gi;
|
23171 |
|
23172 |
|
23173 |
|
23174 |
|
23175 |
|
23176 |
|
23177 |
|
23178 | const NGSP_UNICODE_REGEXP = /\uE500/g;
|
23179 | function replaceNgsp(value) {
|
23180 | return value.replace(NGSP_UNICODE_REGEXP, ' ');
|
23181 | }
|
23182 |
|
23183 |
|
23184 |
|
23185 | function i18nStartFirstPass(lView, tView, index, message, subTemplateIndex) {
|
23186 | const startIndex = tView.blueprint.length - HEADER_OFFSET;
|
23187 | i18nVarsCount = 0;
|
23188 | const previousOrParentTNode = getPreviousOrParentTNode();
|
23189 | const parentTNode = getIsParent() ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent;
|
23190 | let parentIndex = parentTNode && parentTNode !== lView[T_HOST] ? parentTNode.index - HEADER_OFFSET : index;
|
23191 | let parentIndexPointer = 0;
|
23192 | parentIndexStack[parentIndexPointer] = parentIndex;
|
23193 | const createOpCodes = [];
|
23194 | if (ngDevMode) {
|
23195 | attachDebugGetter(createOpCodes, i18nMutateOpCodesToString);
|
23196 | }
|
23197 |
|
23198 |
|
23199 |
|
23200 |
|
23201 |
|
23202 | if (index > 0 && previousOrParentTNode !== parentTNode) {
|
23203 | let previousTNodeIndex = previousOrParentTNode.index - HEADER_OFFSET;
|
23204 |
|
23205 |
|
23206 | if (!getIsParent()) {
|
23207 | previousTNodeIndex = ~previousTNodeIndex;
|
23208 | }
|
23209 |
|
23210 | createOpCodes.push(previousTNodeIndex << 3 | 0 );
|
23211 | }
|
23212 | const updateOpCodes = [];
|
23213 | if (ngDevMode) {
|
23214 | attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
|
23215 | }
|
23216 | const icuExpressions = [];
|
23217 | if (message === '' && isRootTemplateMessage(subTemplateIndex)) {
|
23218 |
|
23219 |
|
23220 | createOpCodes.push(message, allocNodeIndex(startIndex), parentIndex << 17 | 1 );
|
23221 | }
|
23222 | else {
|
23223 | const templateTranslation = getTranslationForTemplate(message, subTemplateIndex);
|
23224 | const msgParts = replaceNgsp(templateTranslation).split(PH_REGEXP);
|
23225 | for (let i = 0; i < msgParts.length; i++) {
|
23226 | let value = msgParts[i];
|
23227 | if (i & 1) {
|
23228 |
|
23229 | if (value.charAt(0) === '/') {
|
23230 |
|
23231 | if (value.charAt(1) === "#" ) {
|
23232 | const phIndex = parseInt(value.substr(2), 10);
|
23233 | parentIndex = parentIndexStack[--parentIndexPointer];
|
23234 | createOpCodes.push(phIndex << 3 | 5 );
|
23235 | }
|
23236 | }
|
23237 | else {
|
23238 | const phIndex = parseInt(value.substr(1), 10);
|
23239 | const isElement = value.charAt(0) === "#" ;
|
23240 |
|
23241 |
|
23242 |
|
23243 | createOpCodes.push((isElement ? phIndex : ~phIndex) << 3 |
|
23244 | 0 , parentIndex << 17 | 1 );
|
23245 | if (isElement) {
|
23246 | parentIndexStack[++parentIndexPointer] = parentIndex = phIndex;
|
23247 | }
|
23248 | }
|
23249 | }
|
23250 | else {
|
23251 |
|
23252 | const parts = extractParts(value);
|
23253 | for (let j = 0; j < parts.length; j++) {
|
23254 | if (j & 1) {
|
23255 |
|
23256 | const icuExpression = parts[j];
|
23257 |
|
23258 |
|
23259 |
|
23260 | if (typeof icuExpression !== 'object') {
|
23261 | throw new Error(`Unable to parse ICU expression in "${templateTranslation}" message.`);
|
23262 | }
|
23263 |
|
23264 | const icuNodeIndex = allocNodeIndex(startIndex);
|
23265 | createOpCodes.push(COMMENT_MARKER, ngDevMode ? `ICU ${icuNodeIndex}` : '', icuNodeIndex, parentIndex << 17 | 1 );
|
23266 |
|
23267 | const mask = getBindingMask(icuExpression);
|
23268 | icuStart(icuExpressions, icuExpression, icuNodeIndex, icuNodeIndex);
|
23269 |
|
23270 | const tIcuIndex = icuExpressions.length - 1;
|
23271 | updateOpCodes.push(toMaskBit(icuExpression.mainBinding),
|
23272 | 3,
|
23273 | -1 - icuExpression.mainBinding, icuNodeIndex << 2 | 2 , tIcuIndex, mask,
|
23274 | 2,
|
23275 | icuNodeIndex << 2 | 3 , tIcuIndex);
|
23276 | }
|
23277 | else if (parts[j] !== '') {
|
23278 | const text = parts[j];
|
23279 |
|
23280 | const hasBinding = text.match(BINDING_REGEXP);
|
23281 |
|
23282 | const textNodeIndex = allocNodeIndex(startIndex);
|
23283 | createOpCodes.push(
|
23284 |
|
23285 | hasBinding ? '' : text, textNodeIndex, parentIndex << 17 | 1 );
|
23286 | if (hasBinding) {
|
23287 | addAllToArray(generateBindingUpdateOpCodes(text, textNodeIndex), updateOpCodes);
|
23288 | }
|
23289 | }
|
23290 | }
|
23291 | }
|
23292 | }
|
23293 | }
|
23294 | if (i18nVarsCount > 0) {
|
23295 | allocExpando(tView, lView, i18nVarsCount);
|
23296 | }
|
23297 |
|
23298 | const tI18n = {
|
23299 | vars: i18nVarsCount,
|
23300 | create: createOpCodes,
|
23301 | update: updateOpCodes,
|
23302 | icus: icuExpressions.length ? icuExpressions : null,
|
23303 | };
|
23304 | tView.data[index + HEADER_OFFSET] = tI18n;
|
23305 | }
|
23306 |
|
23307 |
|
23308 |
|
23309 | function i18nAttributesFirstPass(lView, tView, index, values) {
|
23310 | const previousElement = getPreviousOrParentTNode();
|
23311 | const previousElementIndex = previousElement.index - HEADER_OFFSET;
|
23312 | const updateOpCodes = [];
|
23313 | if (ngDevMode) {
|
23314 | attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
|
23315 | }
|
23316 | for (let i = 0; i < values.length; i += 2) {
|
23317 | const attrName = values[i];
|
23318 | const message = values[i + 1];
|
23319 | const parts = message.split(ICU_REGEXP);
|
23320 | for (let j = 0; j < parts.length; j++) {
|
23321 | const value = parts[j];
|
23322 | if (j & 1) {
|
23323 |
|
23324 |
|
23325 | throw new Error('ICU expressions are not yet supported in attributes');
|
23326 | }
|
23327 | else if (value !== '') {
|
23328 |
|
23329 | const hasBinding = !!value.match(BINDING_REGEXP);
|
23330 | if (hasBinding) {
|
23331 | if (tView.firstCreatePass && tView.data[index + HEADER_OFFSET] === null) {
|
23332 | addAllToArray(generateBindingUpdateOpCodes(value, previousElementIndex, attrName), updateOpCodes);
|
23333 | }
|
23334 | }
|
23335 | else {
|
23336 | const tNode = getTNode(tView, previousElementIndex);
|
23337 |
|
23338 |
|
23339 | if (tNode.type === 3 ) {
|
23340 | elementAttributeInternal(tNode, lView, attrName, value, null, null);
|
23341 | }
|
23342 |
|
23343 | const dataValue = tNode.inputs !== null && tNode.inputs[attrName];
|
23344 | if (dataValue) {
|
23345 | setInputsForProperty(tView, lView, dataValue, attrName, value);
|
23346 | if (ngDevMode) {
|
23347 | const element = getNativeByIndex(previousElementIndex, lView);
|
23348 | setNgReflectProperties(lView, element, tNode.type, dataValue, value);
|
23349 | }
|
23350 | }
|
23351 | }
|
23352 | }
|
23353 | }
|
23354 | }
|
23355 | if (tView.firstCreatePass && tView.data[index + HEADER_OFFSET] === null) {
|
23356 | tView.data[index + HEADER_OFFSET] = updateOpCodes;
|
23357 | }
|
23358 | }
|
23359 |
|
23360 |
|
23361 |
|
23362 |
|
23363 |
|
23364 |
|
23365 |
|
23366 |
|
23367 | function generateBindingUpdateOpCodes(str, destinationNode, attrName, sanitizeFn = null) {
|
23368 | const updateOpCodes = [null, null];
|
23369 | if (ngDevMode) {
|
23370 | attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
|
23371 | }
|
23372 | const textParts = str.split(BINDING_REGEXP);
|
23373 | let mask = 0;
|
23374 | for (let j = 0; j < textParts.length; j++) {
|
23375 | const textValue = textParts[j];
|
23376 | if (j & 1) {
|
23377 |
|
23378 | const bindingIndex = parseInt(textValue, 10);
|
23379 | updateOpCodes.push(-1 - bindingIndex);
|
23380 | mask = mask | toMaskBit(bindingIndex);
|
23381 | }
|
23382 | else if (textValue !== '') {
|
23383 |
|
23384 | updateOpCodes.push(textValue);
|
23385 | }
|
23386 | }
|
23387 | updateOpCodes.push(destinationNode << 2 |
|
23388 | (attrName ? 1 : 0 ));
|
23389 | if (attrName) {
|
23390 | updateOpCodes.push(attrName, sanitizeFn);
|
23391 | }
|
23392 | updateOpCodes[0] = mask;
|
23393 | updateOpCodes[1] = updateOpCodes.length - 2;
|
23394 | return updateOpCodes;
|
23395 | }
|
23396 | function getBindingMask(icuExpression, mask = 0) {
|
23397 | mask = mask | toMaskBit(icuExpression.mainBinding);
|
23398 | let match;
|
23399 | for (let i = 0; i < icuExpression.values.length; i++) {
|
23400 | const valueArr = icuExpression.values[i];
|
23401 | for (let j = 0; j < valueArr.length; j++) {
|
23402 | const value = valueArr[j];
|
23403 | if (typeof value === 'string') {
|
23404 | while (match = BINDING_REGEXP.exec(value)) {
|
23405 | mask = mask | toMaskBit(parseInt(match[1], 10));
|
23406 | }
|
23407 | }
|
23408 | else {
|
23409 | mask = getBindingMask(value, mask);
|
23410 | }
|
23411 | }
|
23412 | }
|
23413 | return mask;
|
23414 | }
|
23415 | function allocNodeIndex(startIndex) {
|
23416 | return startIndex + i18nVarsCount++;
|
23417 | }
|
23418 |
|
23419 |
|
23420 |
|
23421 |
|
23422 |
|
23423 |
|
23424 |
|
23425 |
|
23426 | function toMaskBit(bindingIndex) {
|
23427 | return 1 << Math.min(bindingIndex, 31);
|
23428 | }
|
23429 | function isRootTemplateMessage(subTemplateIndex) {
|
23430 | return subTemplateIndex === undefined;
|
23431 | }
|
23432 |
|
23433 |
|
23434 |
|
23435 | function removeInnerTemplateTranslation(message) {
|
23436 | let match;
|
23437 | let res = '';
|
23438 | let index = 0;
|
23439 | let inTemplate = false;
|
23440 | let tagMatched;
|
23441 | while ((match = SUBTEMPLATE_REGEXP.exec(message)) !== null) {
|
23442 | if (!inTemplate) {
|
23443 | res += message.substring(index, match.index + match[0].length);
|
23444 | tagMatched = match[1];
|
23445 | inTemplate = true;
|
23446 | }
|
23447 | else {
|
23448 | if (match[0] === `${MARKER}/*${tagMatched}${MARKER}`) {
|
23449 | index = match.index;
|
23450 | inTemplate = false;
|
23451 | }
|
23452 | }
|
23453 | }
|
23454 | ngDevMode &&
|
23455 | assertEqual(inTemplate, false, `Tag mismatch: unable to find the end of the sub-template in the translation "${message}"`);
|
23456 | res += message.substr(index);
|
23457 | return res;
|
23458 | }
|
23459 |
|
23460 |
|
23461 |
|
23462 |
|
23463 |
|
23464 |
|
23465 |
|
23466 |
|
23467 |
|
23468 |
|
23469 |
|
23470 |
|
23471 |
|
23472 |
|
23473 |
|
23474 | function getTranslationForTemplate(message, subTemplateIndex) {
|
23475 | if (isRootTemplateMessage(subTemplateIndex)) {
|
23476 |
|
23477 | return removeInnerTemplateTranslation(message);
|
23478 | }
|
23479 | else {
|
23480 |
|
23481 | const start = message.indexOf(`:${subTemplateIndex}${MARKER}`) + 2 + subTemplateIndex.toString().length;
|
23482 | const end = message.search(new RegExp(`${MARKER}\\/\\*\\d+:${subTemplateIndex}${MARKER}`));
|
23483 | return removeInnerTemplateTranslation(message.substring(start, end));
|
23484 | }
|
23485 | }
|
23486 |
|
23487 |
|
23488 |
|
23489 |
|
23490 |
|
23491 |
|
23492 |
|
23493 |
|
23494 | function icuStart(tIcus, icuExpression, startIndex, expandoStartIndex) {
|
23495 | const createCodes = [];
|
23496 | const removeCodes = [];
|
23497 | const updateCodes = [];
|
23498 | const vars = [];
|
23499 | const childIcus = [];
|
23500 | const values = icuExpression.values;
|
23501 | for (let i = 0; i < values.length; i++) {
|
23502 |
|
23503 | const valueArr = values[i];
|
23504 | const nestedIcus = [];
|
23505 | for (let j = 0; j < valueArr.length; j++) {
|
23506 | const value = valueArr[j];
|
23507 | if (typeof value !== 'string') {
|
23508 |
|
23509 | const icuIndex = nestedIcus.push(value) - 1;
|
23510 |
|
23511 | valueArr[j] = `<!--�${icuIndex}�-->`;
|
23512 | }
|
23513 | }
|
23514 | const icuCase = parseIcuCase(valueArr.join(''), startIndex, nestedIcus, tIcus, expandoStartIndex);
|
23515 | createCodes.push(icuCase.create);
|
23516 | removeCodes.push(icuCase.remove);
|
23517 | updateCodes.push(icuCase.update);
|
23518 | vars.push(icuCase.vars);
|
23519 | childIcus.push(icuCase.childIcus);
|
23520 | }
|
23521 | const tIcu = {
|
23522 | type: icuExpression.type,
|
23523 | vars,
|
23524 | currentCaseLViewIndex: HEADER_OFFSET +
|
23525 | expandoStartIndex
|
23526 | + 1,
|
23527 | childIcus,
|
23528 | cases: icuExpression.cases,
|
23529 | create: createCodes,
|
23530 | remove: removeCodes,
|
23531 | update: updateCodes
|
23532 | };
|
23533 | tIcus.push(tIcu);
|
23534 |
|
23535 | i18nVarsCount += Math.max(...vars);
|
23536 | }
|
23537 |
|
23538 |
|
23539 |
|
23540 |
|
23541 |
|
23542 |
|
23543 |
|
23544 | function parseICUBlock(pattern) {
|
23545 | const cases = [];
|
23546 | const values = [];
|
23547 | let icuType = 1 ;
|
23548 | let mainBinding = 0;
|
23549 | pattern = pattern.replace(ICU_BLOCK_REGEXP, function (str, binding, type) {
|
23550 | if (type === 'select') {
|
23551 | icuType = 0 ;
|
23552 | }
|
23553 | else {
|
23554 | icuType = 1 ;
|
23555 | }
|
23556 | mainBinding = parseInt(binding.substr(1), 10);
|
23557 | return '';
|
23558 | });
|
23559 | const parts = extractParts(pattern);
|
23560 |
|
23561 | for (let pos = 0; pos < parts.length;) {
|
23562 | let key = parts[pos++].trim();
|
23563 | if (icuType === 1 ) {
|
23564 |
|
23565 | key = key.replace(/\s*(?:=)?(\w+)\s*/, '$1');
|
23566 | }
|
23567 | if (key.length) {
|
23568 | cases.push(key);
|
23569 | }
|
23570 | const blocks = extractParts(parts[pos++]);
|
23571 | if (cases.length > values.length) {
|
23572 | values.push(blocks);
|
23573 | }
|
23574 | }
|
23575 |
|
23576 | return { type: icuType, mainBinding: mainBinding, cases, values };
|
23577 | }
|
23578 |
|
23579 |
|
23580 |
|
23581 |
|
23582 |
|
23583 |
|
23584 |
|
23585 |
|
23586 |
|
23587 |
|
23588 | function parseIcuCase(unsafeHtml, parentIndex, nestedIcus, tIcus, expandoStartIndex) {
|
23589 | const inertBodyHelper = getInertBodyHelper(getDocument());
|
23590 | const inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
|
23591 | if (!inertBodyElement) {
|
23592 | throw new Error('Unable to generate inert body element');
|
23593 | }
|
23594 | const wrapper = getTemplateContent(inertBodyElement) || inertBodyElement;
|
23595 | const opCodes = {
|
23596 | vars: 1,
|
23597 | childIcus: [],
|
23598 | create: [],
|
23599 | remove: [],
|
23600 | update: []
|
23601 | };
|
23602 | if (ngDevMode) {
|
23603 | attachDebugGetter(opCodes.create, i18nMutateOpCodesToString);
|
23604 | attachDebugGetter(opCodes.remove, i18nMutateOpCodesToString);
|
23605 | attachDebugGetter(opCodes.update, i18nUpdateOpCodesToString);
|
23606 | }
|
23607 | parseNodes(wrapper.firstChild, opCodes, parentIndex, nestedIcus, tIcus, expandoStartIndex);
|
23608 | return opCodes;
|
23609 | }
|
23610 |
|
23611 |
|
23612 |
|
23613 |
|
23614 |
|
23615 |
|
23616 |
|
23617 |
|
23618 |
|
23619 | function extractParts(pattern) {
|
23620 | if (!pattern) {
|
23621 | return [];
|
23622 | }
|
23623 | let prevPos = 0;
|
23624 | const braceStack = [];
|
23625 | const results = [];
|
23626 | const braces = /[{}]/g;
|
23627 |
|
23628 | braces.lastIndex = 0;
|
23629 | let match;
|
23630 | while (match = braces.exec(pattern)) {
|
23631 | const pos = match.index;
|
23632 | if (match[0] == '}') {
|
23633 | braceStack.pop();
|
23634 | if (braceStack.length == 0) {
|
23635 |
|
23636 | const block = pattern.substring(prevPos, pos);
|
23637 | if (ICU_BLOCK_REGEXP.test(block)) {
|
23638 | results.push(parseICUBlock(block));
|
23639 | }
|
23640 | else {
|
23641 | results.push(block);
|
23642 | }
|
23643 | prevPos = pos + 1;
|
23644 | }
|
23645 | }
|
23646 | else {
|
23647 | if (braceStack.length == 0) {
|
23648 | const substring = pattern.substring(prevPos, pos);
|
23649 | results.push(substring);
|
23650 | prevPos = pos + 1;
|
23651 | }
|
23652 | braceStack.push('{');
|
23653 | }
|
23654 | }
|
23655 | const substring = pattern.substring(prevPos);
|
23656 | results.push(substring);
|
23657 | return results;
|
23658 | }
|
23659 |
|
23660 |
|
23661 |
|
23662 |
|
23663 |
|
23664 |
|
23665 |
|
23666 |
|
23667 |
|
23668 |
|
23669 | function parseNodes(currentNode, icuCase, parentIndex, nestedIcus, tIcus, expandoStartIndex) {
|
23670 | if (currentNode) {
|
23671 | const nestedIcusToCreate = [];
|
23672 | while (currentNode) {
|
23673 | const nextNode = currentNode.nextSibling;
|
23674 | const newIndex = expandoStartIndex + ++icuCase.vars;
|
23675 | switch (currentNode.nodeType) {
|
23676 | case Node.ELEMENT_NODE:
|
23677 | const element = currentNode;
|
23678 | const tagName = element.tagName.toLowerCase();
|
23679 | if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
|
23680 |
|
23681 | icuCase.vars--;
|
23682 | }
|
23683 | else {
|
23684 | icuCase.create.push(ELEMENT_MARKER, tagName, newIndex, parentIndex << 17 | 1 );
|
23685 | const elAttrs = element.attributes;
|
23686 | for (let i = 0; i < elAttrs.length; i++) {
|
23687 | const attr = elAttrs.item(i);
|
23688 | const lowerAttrName = attr.name.toLowerCase();
|
23689 | const hasBinding = !!attr.value.match(BINDING_REGEXP);
|
23690 |
|
23691 | if (hasBinding) {
|
23692 | if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
|
23693 | if (URI_ATTRS[lowerAttrName]) {
|
23694 | addAllToArray(generateBindingUpdateOpCodes(attr.value, newIndex, attr.name, _sanitizeUrl), icuCase.update);
|
23695 | }
|
23696 | else if (SRCSET_ATTRS[lowerAttrName]) {
|
23697 | addAllToArray(generateBindingUpdateOpCodes(attr.value, newIndex, attr.name, sanitizeSrcset), icuCase.update);
|
23698 | }
|
23699 | else {
|
23700 | addAllToArray(generateBindingUpdateOpCodes(attr.value, newIndex, attr.name), icuCase.update);
|
23701 | }
|
23702 | }
|
23703 | else {
|
23704 | ngDevMode &&
|
23705 | console.warn(`WARNING: ignoring unsafe attribute value ${lowerAttrName} on element ${tagName} (see http://g.co/ng/security#xss)`);
|
23706 | }
|
23707 | }
|
23708 | else {
|
23709 | icuCase.create.push(newIndex << 3 | 4 , attr.name, attr.value);
|
23710 | }
|
23711 | }
|
23712 |
|
23713 | parseNodes(currentNode.firstChild, icuCase, newIndex, nestedIcus, tIcus, expandoStartIndex);
|
23714 |
|
23715 | icuCase.remove.push(newIndex << 3 | 3 );
|
23716 | }
|
23717 | break;
|
23718 | case Node.TEXT_NODE:
|
23719 | const value = currentNode.textContent || '';
|
23720 | const hasBinding = value.match(BINDING_REGEXP);
|
23721 | icuCase.create.push(hasBinding ? '' : value, newIndex, parentIndex << 17 | 1 );
|
23722 | icuCase.remove.push(newIndex << 3 | 3 );
|
23723 | if (hasBinding) {
|
23724 | addAllToArray(generateBindingUpdateOpCodes(value, newIndex), icuCase.update);
|
23725 | }
|
23726 | break;
|
23727 | case Node.COMMENT_NODE:
|
23728 |
|
23729 | const match = NESTED_ICU.exec(currentNode.textContent || '');
|
23730 | if (match) {
|
23731 | const nestedIcuIndex = parseInt(match[1], 10);
|
23732 | const newLocal = ngDevMode ? `nested ICU ${nestedIcuIndex}` : '';
|
23733 |
|
23734 | icuCase.create.push(COMMENT_MARKER, newLocal, newIndex, parentIndex << 17 | 1 );
|
23735 | const nestedIcu = nestedIcus[nestedIcuIndex];
|
23736 | nestedIcusToCreate.push([nestedIcu, newIndex]);
|
23737 | }
|
23738 | else {
|
23739 |
|
23740 | icuCase.vars--;
|
23741 | }
|
23742 | break;
|
23743 | default:
|
23744 |
|
23745 | icuCase.vars--;
|
23746 | }
|
23747 | currentNode = nextNode;
|
23748 | }
|
23749 | for (let i = 0; i < nestedIcusToCreate.length; i++) {
|
23750 | const nestedIcu = nestedIcusToCreate[i][0];
|
23751 | const nestedIcuNodeIndex = nestedIcusToCreate[i][1];
|
23752 | icuStart(tIcus, nestedIcu, nestedIcuNodeIndex, expandoStartIndex + icuCase.vars);
|
23753 |
|
23754 | const nestTIcuIndex = tIcus.length - 1;
|
23755 | icuCase.vars += Math.max(...tIcus[nestTIcuIndex].vars);
|
23756 | icuCase.childIcus.push(nestTIcuIndex);
|
23757 | const mask = getBindingMask(nestedIcu);
|
23758 | icuCase.update.push(toMaskBit(nestedIcu.mainBinding),
|
23759 | 3,
|
23760 | -1 - nestedIcu.mainBinding, nestedIcuNodeIndex << 2 | 2 ,
|
23761 |
|
23762 | nestTIcuIndex, mask,
|
23763 | 2,
|
23764 | nestedIcuNodeIndex << 2 | 3 , nestTIcuIndex);
|
23765 | icuCase.remove.push(nestTIcuIndex << 3 | 6 ,
|
23766 |
|
23767 | nestedIcuNodeIndex << 3 | 3 );
|
23768 | }
|
23769 | }
|
23770 | }
|
23771 |
|
23772 |
|
23773 |
|
23774 |
|
23775 |
|
23776 |
|
23777 |
|
23778 |
|
23779 |
|
23780 | const ROOT_TEMPLATE_ID = 0;
|
23781 | const PP_MULTI_VALUE_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]/;
|
23782 | const PP_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]|(�\/?\*\d+:\d+�)/g;
|
23783 | const PP_ICU_VARS_REGEXP = /({\s*)(VAR_(PLURAL|SELECT)(_\d+)?)(\s*,)/g;
|
23784 | const PP_ICU_PLACEHOLDERS_REGEXP = /{([A-Z0-9_]+)}/g;
|
23785 | const PP_ICUS_REGEXP = /�I18N_EXP_(ICU(_\d+)?)�/g;
|
23786 | const PP_CLOSE_TEMPLATE_REGEXP = /\/\*/;
|
23787 | const PP_TEMPLATE_ID_REGEXP = /\d+\:(\d+)/;
|
23788 |
|
23789 |
|
23790 |
|
23791 |
|
23792 |
|
23793 |
|
23794 |
|
23795 |
|
23796 |
|
23797 |
|
23798 |
|
23799 |
|
23800 |
|
23801 |
|
23802 |
|
23803 |
|
23804 |
|
23805 |
|
23806 |
|
23807 |
|
23808 | function i18nPostprocess(message, replacements = {}) {
|
23809 | |
23810 |
|
23811 |
|
23812 |
|
23813 |
|
23814 |
|
23815 |
|
23816 |
|
23817 |
|
23818 |
|
23819 | let result = message;
|
23820 | if (PP_MULTI_VALUE_PLACEHOLDERS_REGEXP.test(message)) {
|
23821 | const matches = {};
|
23822 | const templateIdsStack = [ROOT_TEMPLATE_ID];
|
23823 | result = result.replace(PP_PLACEHOLDERS_REGEXP, (m, phs, tmpl) => {
|
23824 | const content = phs || tmpl;
|
23825 | const placeholders = matches[content] || [];
|
23826 | if (!placeholders.length) {
|
23827 | content.split('|').forEach((placeholder) => {
|
23828 | const match = placeholder.match(PP_TEMPLATE_ID_REGEXP);
|
23829 | const templateId = match ? parseInt(match[1], 10) : ROOT_TEMPLATE_ID;
|
23830 | const isCloseTemplateTag = PP_CLOSE_TEMPLATE_REGEXP.test(placeholder);
|
23831 | placeholders.push([templateId, isCloseTemplateTag, placeholder]);
|
23832 | });
|
23833 | matches[content] = placeholders;
|
23834 | }
|
23835 | if (!placeholders.length) {
|
23836 | throw new Error(`i18n postprocess: unmatched placeholder - ${content}`);
|
23837 | }
|
23838 | const currentTemplateId = templateIdsStack[templateIdsStack.length - 1];
|
23839 | let idx = 0;
|
23840 |
|
23841 | for (let i = 0; i < placeholders.length; i++) {
|
23842 | if (placeholders[i][0] === currentTemplateId) {
|
23843 | idx = i;
|
23844 | break;
|
23845 | }
|
23846 | }
|
23847 |
|
23848 | const [templateId, isCloseTemplateTag, placeholder] = placeholders[idx];
|
23849 | if (isCloseTemplateTag) {
|
23850 | templateIdsStack.pop();
|
23851 | }
|
23852 | else if (currentTemplateId !== templateId) {
|
23853 | templateIdsStack.push(templateId);
|
23854 | }
|
23855 |
|
23856 | placeholders.splice(idx, 1);
|
23857 | return placeholder;
|
23858 | });
|
23859 | }
|
23860 |
|
23861 | if (!Object.keys(replacements).length) {
|
23862 | return result;
|
23863 | }
|
23864 | |
23865 |
|
23866 |
|
23867 | result = result.replace(PP_ICU_VARS_REGEXP, (match, start, key, _type, _idx, end) => {
|
23868 | return replacements.hasOwnProperty(key) ? `${start}${replacements[key]}${end}` : match;
|
23869 | });
|
23870 | |
23871 |
|
23872 |
|
23873 | result = result.replace(PP_ICU_PLACEHOLDERS_REGEXP, (match, key) => {
|
23874 | return replacements.hasOwnProperty(key) ? replacements[key] : match;
|
23875 | });
|
23876 | |
23877 |
|
23878 |
|
23879 |
|
23880 | result = result.replace(PP_ICUS_REGEXP, (match, key) => {
|
23881 | if (replacements.hasOwnProperty(key)) {
|
23882 | const list = replacements[key];
|
23883 | if (!list.length) {
|
23884 | throw new Error(`i18n postprocess: unmatched ICU - ${match} with key: ${key}`);
|
23885 | }
|
23886 | return list.shift();
|
23887 | }
|
23888 | return match;
|
23889 | });
|
23890 | return result;
|
23891 | }
|
23892 |
|
23893 |
|
23894 |
|
23895 |
|
23896 |
|
23897 |
|
23898 |
|
23899 |
|
23900 |
|
23901 |
|
23902 |
|
23903 |
|
23904 |
|
23905 |
|
23906 |
|
23907 |
|
23908 |
|
23909 |
|
23910 |
|
23911 |
|
23912 |
|
23913 |
|
23914 |
|
23915 |
|
23916 |
|
23917 |
|
23918 |
|
23919 |
|
23920 |
|
23921 |
|
23922 |
|
23923 |
|
23924 |
|
23925 |
|
23926 |
|
23927 |
|
23928 |
|
23929 | function ɵɵi18nStart(index, message, subTemplateIndex) {
|
23930 | const tView = getTView();
|
23931 | ngDevMode && assertDefined(tView, `tView should be defined`);
|
23932 | pushI18nIndex(index);
|
23933 |
|
23934 | setDelayProjection(true);
|
23935 | if (tView.firstCreatePass && tView.data[index + HEADER_OFFSET] === null) {
|
23936 | i18nStartFirstPass(getLView(), tView, index, message, subTemplateIndex);
|
23937 | }
|
23938 | }
|
23939 |
|
23940 |
|
23941 |
|
23942 |
|
23943 |
|
23944 |
|
23945 | function ɵɵi18nEnd() {
|
23946 | const lView = getLView();
|
23947 | const tView = getTView();
|
23948 | ngDevMode && assertDefined(tView, `tView should be defined`);
|
23949 | i18nEndFirstPass(tView, lView);
|
23950 |
|
23951 | setDelayProjection(false);
|
23952 | }
|
23953 |
|
23954 |
|
23955 |
|
23956 |
|
23957 |
|
23958 |
|
23959 |
|
23960 |
|
23961 |
|
23962 |
|
23963 |
|
23964 |
|
23965 |
|
23966 |
|
23967 |
|
23968 |
|
23969 |
|
23970 |
|
23971 |
|
23972 |
|
23973 |
|
23974 |
|
23975 |
|
23976 |
|
23977 |
|
23978 |
|
23979 | function ɵɵi18n(index, message, subTemplateIndex) {
|
23980 | ɵɵi18nStart(index, message, subTemplateIndex);
|
23981 | ɵɵi18nEnd();
|
23982 | }
|
23983 |
|
23984 |
|
23985 |
|
23986 |
|
23987 |
|
23988 |
|
23989 |
|
23990 |
|
23991 | function ɵɵi18nAttributes(index, values) {
|
23992 | const lView = getLView();
|
23993 | const tView = getTView();
|
23994 | ngDevMode && assertDefined(tView, `tView should be defined`);
|
23995 | i18nAttributesFirstPass(lView, tView, index, values);
|
23996 | }
|
23997 |
|
23998 |
|
23999 |
|
24000 |
|
24001 |
|
24002 |
|
24003 |
|
24004 |
|
24005 |
|
24006 |
|
24007 | function ɵɵi18nExp(value) {
|
24008 | const lView = getLView();
|
24009 | setMaskBit(bindingUpdated(lView, nextBindingIndex(), value));
|
24010 | return ɵɵi18nExp;
|
24011 | }
|
24012 |
|
24013 |
|
24014 |
|
24015 |
|
24016 |
|
24017 |
|
24018 |
|
24019 |
|
24020 | function ɵɵi18nApply(index) {
|
24021 | applyI18n(getTView(), getLView(), index);
|
24022 | }
|
24023 |
|
24024 |
|
24025 |
|
24026 |
|
24027 |
|
24028 |
|
24029 |
|
24030 |
|
24031 |
|
24032 |
|
24033 |
|
24034 |
|
24035 |
|
24036 |
|
24037 |
|
24038 |
|
24039 |
|
24040 |
|
24041 |
|
24042 |
|
24043 | function ɵɵi18nPostprocess(message, replacements = {}) {
|
24044 | return i18nPostprocess(message, replacements);
|
24045 | }
|
24046 |
|
24047 |
|
24048 |
|
24049 |
|
24050 |
|
24051 |
|
24052 |
|
24053 |
|
24054 |
|
24055 |
|
24056 |
|
24057 |
|
24058 |
|
24059 |
|
24060 |
|
24061 |
|
24062 |
|
24063 | function setClassMetadata(type, decorators, ctorParameters, propDecorators) {
|
24064 | return noSideEffects(() => {
|
24065 | const clazz = type;
|
24066 |
|
24067 |
|
24068 |
|
24069 |
|
24070 |
|
24071 | const parentPrototype = clazz.prototype ? Object.getPrototypeOf(clazz.prototype) : null;
|
24072 | const parentConstructor = parentPrototype && parentPrototype.constructor;
|
24073 | if (decorators !== null) {
|
24074 | if (clazz.decorators !== undefined &&
|
24075 | (!parentConstructor || parentConstructor.decorators !== clazz.decorators)) {
|
24076 | clazz.decorators.push(...decorators);
|
24077 | }
|
24078 | else {
|
24079 | clazz.decorators = decorators;
|
24080 | }
|
24081 | }
|
24082 | if (ctorParameters !== null) {
|
24083 |
|
24084 |
|
24085 |
|
24086 | clazz.ctorParameters = ctorParameters;
|
24087 | }
|
24088 | if (propDecorators !== null) {
|
24089 |
|
24090 |
|
24091 |
|
24092 |
|
24093 | if (clazz.propDecorators !== undefined &&
|
24094 | (!parentConstructor ||
|
24095 | parentConstructor.propDecorators !== clazz.propDecorators)) {
|
24096 | clazz.propDecorators = Object.assign(Object.assign({}, clazz.propDecorators), propDecorators);
|
24097 | }
|
24098 | else {
|
24099 | clazz.propDecorators = propDecorators;
|
24100 | }
|
24101 | }
|
24102 | });
|
24103 | }
|
24104 |
|
24105 |
|
24106 |
|
24107 |
|
24108 |
|
24109 |
|
24110 |
|
24111 |
|
24112 |
|
24113 |
|
24114 |
|
24115 |
|
24116 |
|
24117 | const modules = new Map();
|
24118 |
|
24119 |
|
24120 |
|
24121 |
|
24122 | function registerModuleFactory(id, factory) {
|
24123 | const existing = modules.get(id);
|
24124 | assertSameOrNotExisting(id, existing && existing.moduleType, factory.moduleType);
|
24125 | modules.set(id, factory);
|
24126 | }
|
24127 | function assertSameOrNotExisting(id, type, incoming) {
|
24128 | if (type && type !== incoming) {
|
24129 | throw new Error(`Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}`);
|
24130 | }
|
24131 | }
|
24132 | function registerNgModuleType(ngModuleType) {
|
24133 | if (ngModuleType.ɵmod.id !== null) {
|
24134 | const id = ngModuleType.ɵmod.id;
|
24135 | const existing = modules.get(id);
|
24136 | assertSameOrNotExisting(id, existing, ngModuleType);
|
24137 | modules.set(id, ngModuleType);
|
24138 | }
|
24139 | let imports = ngModuleType.ɵmod.imports;
|
24140 | if (imports instanceof Function) {
|
24141 | imports = imports();
|
24142 | }
|
24143 | if (imports) {
|
24144 | imports.forEach(i => registerNgModuleType(i));
|
24145 | }
|
24146 | }
|
24147 | function clearModulesForTest() {
|
24148 | modules.clear();
|
24149 | }
|
24150 | function getRegisteredNgModuleType(id) {
|
24151 | return modules.get(id) || autoRegisterModuleById[id];
|
24152 | }
|
24153 |
|
24154 |
|
24155 |
|
24156 |
|
24157 |
|
24158 |
|
24159 |
|
24160 |
|
24161 | class NgModuleRef$1 extends NgModuleRef {
|
24162 | constructor(ngModuleType, _parent) {
|
24163 | super();
|
24164 | this._parent = _parent;
|
24165 |
|
24166 | this._bootstrapComponents = [];
|
24167 | this.injector = this;
|
24168 | this.destroyCbs = [];
|
24169 |
|
24170 |
|
24171 |
|
24172 |
|
24173 |
|
24174 |
|
24175 | this.componentFactoryResolver = new ComponentFactoryResolver$1(this);
|
24176 | const ngModuleDef = getNgModuleDef(ngModuleType);
|
24177 | ngDevMode &&
|
24178 | assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
|
24179 | const ngLocaleIdDef = getNgLocaleIdDef(ngModuleType);
|
24180 | ngLocaleIdDef && setLocaleId(ngLocaleIdDef);
|
24181 | this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
|
24182 | this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
|
24183 | { provide: NgModuleRef, useValue: this }, {
|
24184 | provide: ComponentFactoryResolver,
|
24185 | useValue: this.componentFactoryResolver
|
24186 | }
|
24187 | ], stringify(ngModuleType));
|
24188 |
|
24189 |
|
24190 |
|
24191 | this._r3Injector._resolveInjectorDefTypes();
|
24192 | this.instance = this.get(ngModuleType);
|
24193 | }
|
24194 | get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
|
24195 | if (token === Injector || token === NgModuleRef || token === INJECTOR) {
|
24196 | return this;
|
24197 | }
|
24198 | return this._r3Injector.get(token, notFoundValue, injectFlags);
|
24199 | }
|
24200 | destroy() {
|
24201 | ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
|
24202 | const injector = this._r3Injector;
|
24203 | !injector.destroyed && injector.destroy();
|
24204 | this.destroyCbs.forEach(fn => fn());
|
24205 | this.destroyCbs = null;
|
24206 | }
|
24207 | onDestroy(callback) {
|
24208 | ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
|
24209 | this.destroyCbs.push(callback);
|
24210 | }
|
24211 | }
|
24212 | class NgModuleFactory$1 extends NgModuleFactory {
|
24213 | constructor(moduleType) {
|
24214 | super();
|
24215 | this.moduleType = moduleType;
|
24216 | const ngModuleDef = getNgModuleDef(moduleType);
|
24217 | if (ngModuleDef !== null) {
|
24218 |
|
24219 |
|
24220 |
|
24221 |
|
24222 |
|
24223 |
|
24224 |
|
24225 |
|
24226 |
|
24227 |
|
24228 |
|
24229 |
|
24230 |
|
24231 |
|
24232 |
|
24233 |
|
24234 |
|
24235 |
|
24236 |
|
24237 |
|
24238 |
|
24239 |
|
24240 |
|
24241 | registerNgModuleType(moduleType);
|
24242 | }
|
24243 | }
|
24244 | create(parentInjector) {
|
24245 | return new NgModuleRef$1(this.moduleType, parentInjector);
|
24246 | }
|
24247 | }
|
24248 |
|
24249 |
|
24250 |
|
24251 |
|
24252 |
|
24253 |
|
24254 |
|
24255 |
|
24256 |
|
24257 |
|
24258 |
|
24259 |
|
24260 |
|
24261 |
|
24262 |
|
24263 |
|
24264 |
|
24265 |
|
24266 |
|
24267 |
|
24268 |
|
24269 |
|
24270 |
|
24271 |
|
24272 |
|
24273 |
|
24274 |
|
24275 |
|
24276 |
|
24277 |
|
24278 |
|
24279 |
|
24280 |
|
24281 |
|
24282 |
|
24283 |
|
24284 | function ɵɵpureFunction0(slotOffset, pureFn, thisArg) {
|
24285 | const bindingIndex = getBindingRoot() + slotOffset;
|
24286 | const lView = getLView();
|
24287 | return lView[bindingIndex] === NO_CHANGE ?
|
24288 | updateBinding(lView, bindingIndex, thisArg ? pureFn.call(thisArg) : pureFn()) :
|
24289 | getBinding(lView, bindingIndex);
|
24290 | }
|
24291 |
|
24292 |
|
24293 |
|
24294 |
|
24295 |
|
24296 |
|
24297 |
|
24298 |
|
24299 |
|
24300 |
|
24301 |
|
24302 |
|
24303 | function ɵɵpureFunction1(slotOffset, pureFn, exp, thisArg) {
|
24304 | return pureFunction1Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp, thisArg);
|
24305 | }
|
24306 |
|
24307 |
|
24308 |
|
24309 |
|
24310 |
|
24311 |
|
24312 |
|
24313 |
|
24314 |
|
24315 |
|
24316 |
|
24317 |
|
24318 |
|
24319 | function ɵɵpureFunction2(slotOffset, pureFn, exp1, exp2, thisArg) {
|
24320 | return pureFunction2Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, thisArg);
|
24321 | }
|
24322 |
|
24323 |
|
24324 |
|
24325 |
|
24326 |
|
24327 |
|
24328 |
|
24329 |
|
24330 |
|
24331 |
|
24332 |
|
24333 |
|
24334 |
|
24335 |
|
24336 | function ɵɵpureFunction3(slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
|
24337 | return pureFunction3Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, thisArg);
|
24338 | }
|
24339 |
|
24340 |
|
24341 |
|
24342 |
|
24343 |
|
24344 |
|
24345 |
|
24346 |
|
24347 |
|
24348 |
|
24349 |
|
24350 |
|
24351 |
|
24352 |
|
24353 |
|
24354 | function ɵɵpureFunction4(slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
|
24355 | return pureFunction4Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg);
|
24356 | }
|
24357 |
|
24358 |
|
24359 |
|
24360 |
|
24361 |
|
24362 |
|
24363 |
|
24364 |
|
24365 |
|
24366 |
|
24367 |
|
24368 |
|
24369 |
|
24370 |
|
24371 |
|
24372 |
|
24373 | function ɵɵpureFunction5(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, thisArg) {
|
24374 | const bindingIndex = getBindingRoot() + slotOffset;
|
24375 | const lView = getLView();
|
24376 | const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
|
24377 | return bindingUpdated(lView, bindingIndex + 4, exp5) || different ?
|
24378 | updateBinding(lView, bindingIndex + 5, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5) :
|
24379 | pureFn(exp1, exp2, exp3, exp4, exp5)) :
|
24380 | getBinding(lView, bindingIndex + 5);
|
24381 | }
|
24382 |
|
24383 |
|
24384 |
|
24385 |
|
24386 |
|
24387 |
|
24388 |
|
24389 |
|
24390 |
|
24391 |
|
24392 |
|
24393 |
|
24394 |
|
24395 |
|
24396 |
|
24397 |
|
24398 |
|
24399 | function ɵɵpureFunction6(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, thisArg) {
|
24400 | const bindingIndex = getBindingRoot() + slotOffset;
|
24401 | const lView = getLView();
|
24402 | const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
|
24403 | return bindingUpdated2(lView, bindingIndex + 4, exp5, exp6) || different ?
|
24404 | updateBinding(lView, bindingIndex + 6, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6) :
|
24405 | pureFn(exp1, exp2, exp3, exp4, exp5, exp6)) :
|
24406 | getBinding(lView, bindingIndex + 6);
|
24407 | }
|
24408 |
|
24409 |
|
24410 |
|
24411 |
|
24412 |
|
24413 |
|
24414 |
|
24415 |
|
24416 |
|
24417 |
|
24418 |
|
24419 |
|
24420 |
|
24421 |
|
24422 |
|
24423 |
|
24424 |
|
24425 |
|
24426 | function ɵɵpureFunction7(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, thisArg) {
|
24427 | const bindingIndex = getBindingRoot() + slotOffset;
|
24428 | const lView = getLView();
|
24429 | let different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
|
24430 | return bindingUpdated3(lView, bindingIndex + 4, exp5, exp6, exp7) || different ?
|
24431 | updateBinding(lView, bindingIndex + 7, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7) :
|
24432 | pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7)) :
|
24433 | getBinding(lView, bindingIndex + 7);
|
24434 | }
|
24435 |
|
24436 |
|
24437 |
|
24438 |
|
24439 |
|
24440 |
|
24441 |
|
24442 |
|
24443 |
|
24444 |
|
24445 |
|
24446 |
|
24447 |
|
24448 |
|
24449 |
|
24450 |
|
24451 |
|
24452 |
|
24453 |
|
24454 | function ɵɵpureFunction8(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, thisArg) {
|
24455 | const bindingIndex = getBindingRoot() + slotOffset;
|
24456 | const lView = getLView();
|
24457 | const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
|
24458 | return bindingUpdated4(lView, bindingIndex + 4, exp5, exp6, exp7, exp8) || different ?
|
24459 | updateBinding(lView, bindingIndex + 8, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8) :
|
24460 | pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8)) :
|
24461 | getBinding(lView, bindingIndex + 8);
|
24462 | }
|
24463 |
|
24464 |
|
24465 |
|
24466 |
|
24467 |
|
24468 |
|
24469 |
|
24470 |
|
24471 |
|
24472 |
|
24473 |
|
24474 |
|
24475 |
|
24476 |
|
24477 |
|
24478 | function ɵɵpureFunctionV(slotOffset, pureFn, exps, thisArg) {
|
24479 | return pureFunctionVInternal(getLView(), getBindingRoot(), slotOffset, pureFn, exps, thisArg);
|
24480 | }
|
24481 |
|
24482 |
|
24483 |
|
24484 |
|
24485 |
|
24486 |
|
24487 |
|
24488 | function getPureFunctionReturnValue(lView, returnValueIndex) {
|
24489 | ngDevMode && assertIndexInRange(lView, returnValueIndex);
|
24490 | const lastReturnValue = lView[returnValueIndex];
|
24491 | return lastReturnValue === NO_CHANGE ? undefined : lastReturnValue;
|
24492 | }
|
24493 |
|
24494 |
|
24495 |
|
24496 |
|
24497 |
|
24498 |
|
24499 |
|
24500 |
|
24501 |
|
24502 |
|
24503 |
|
24504 |
|
24505 | function pureFunction1Internal(lView, bindingRoot, slotOffset, pureFn, exp, thisArg) {
|
24506 | const bindingIndex = bindingRoot + slotOffset;
|
24507 | return bindingUpdated(lView, bindingIndex, exp) ?
|
24508 | updateBinding(lView, bindingIndex + 1, thisArg ? pureFn.call(thisArg, exp) : pureFn(exp)) :
|
24509 | getPureFunctionReturnValue(lView, bindingIndex + 1);
|
24510 | }
|
24511 |
|
24512 |
|
24513 |
|
24514 |
|
24515 |
|
24516 |
|
24517 |
|
24518 |
|
24519 |
|
24520 |
|
24521 |
|
24522 |
|
24523 |
|
24524 | function pureFunction2Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, thisArg) {
|
24525 | const bindingIndex = bindingRoot + slotOffset;
|
24526 | return bindingUpdated2(lView, bindingIndex, exp1, exp2) ?
|
24527 | updateBinding(lView, bindingIndex + 2, thisArg ? pureFn.call(thisArg, exp1, exp2) : pureFn(exp1, exp2)) :
|
24528 | getPureFunctionReturnValue(lView, bindingIndex + 2);
|
24529 | }
|
24530 |
|
24531 |
|
24532 |
|
24533 |
|
24534 |
|
24535 |
|
24536 |
|
24537 |
|
24538 |
|
24539 |
|
24540 |
|
24541 |
|
24542 |
|
24543 |
|
24544 | function pureFunction3Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
|
24545 | const bindingIndex = bindingRoot + slotOffset;
|
24546 | return bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) ?
|
24547 | updateBinding(lView, bindingIndex + 3, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3) : pureFn(exp1, exp2, exp3)) :
|
24548 | getPureFunctionReturnValue(lView, bindingIndex + 3);
|
24549 | }
|
24550 |
|
24551 |
|
24552 |
|
24553 |
|
24554 |
|
24555 |
|
24556 |
|
24557 |
|
24558 |
|
24559 |
|
24560 |
|
24561 |
|
24562 |
|
24563 |
|
24564 |
|
24565 |
|
24566 | function pureFunction4Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
|
24567 | const bindingIndex = bindingRoot + slotOffset;
|
24568 | return bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) ?
|
24569 | updateBinding(lView, bindingIndex + 4, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4) : pureFn(exp1, exp2, exp3, exp4)) :
|
24570 | getPureFunctionReturnValue(lView, bindingIndex + 4);
|
24571 | }
|
24572 |
|
24573 |
|
24574 |
|
24575 |
|
24576 |
|
24577 |
|
24578 |
|
24579 |
|
24580 |
|
24581 |
|
24582 |
|
24583 |
|
24584 |
|
24585 |
|
24586 |
|
24587 | function pureFunctionVInternal(lView, bindingRoot, slotOffset, pureFn, exps, thisArg) {
|
24588 | let bindingIndex = bindingRoot + slotOffset;
|
24589 | let different = false;
|
24590 | for (let i = 0; i < exps.length; i++) {
|
24591 | bindingUpdated(lView, bindingIndex++, exps[i]) && (different = true);
|
24592 | }
|
24593 | return different ? updateBinding(lView, bindingIndex, pureFn.apply(thisArg, exps)) :
|
24594 | getPureFunctionReturnValue(lView, bindingIndex);
|
24595 | }
|
24596 |
|
24597 |
|
24598 |
|
24599 |
|
24600 |
|
24601 |
|
24602 |
|
24603 |
|
24604 |
|
24605 |
|
24606 |
|
24607 |
|
24608 |
|
24609 |
|
24610 |
|
24611 |
|
24612 |
|
24613 | function ɵɵpipe(index, pipeName) {
|
24614 | const tView = getTView();
|
24615 | let pipeDef;
|
24616 | const adjustedIndex = index + HEADER_OFFSET;
|
24617 | if (tView.firstCreatePass) {
|
24618 | pipeDef = getPipeDef$1(pipeName, tView.pipeRegistry);
|
24619 | tView.data[adjustedIndex] = pipeDef;
|
24620 | if (pipeDef.onDestroy) {
|
24621 | (tView.destroyHooks || (tView.destroyHooks = [])).push(adjustedIndex, pipeDef.onDestroy);
|
24622 | }
|
24623 | }
|
24624 | else {
|
24625 | pipeDef = tView.data[adjustedIndex];
|
24626 | }
|
24627 | const pipeFactory = pipeDef.factory || (pipeDef.factory = getFactoryDef(pipeDef.type, true));
|
24628 | const previousInjectImplementation = setInjectImplementation(ɵɵdirectiveInject);
|
24629 |
|
24630 |
|
24631 | const previousIncludeViewProviders = setIncludeViewProviders(false);
|
24632 | const pipeInstance = pipeFactory();
|
24633 | setIncludeViewProviders(previousIncludeViewProviders);
|
24634 | setInjectImplementation(previousInjectImplementation);
|
24635 | store(tView, getLView(), index, pipeInstance);
|
24636 | return pipeInstance;
|
24637 | }
|
24638 |
|
24639 |
|
24640 |
|
24641 |
|
24642 |
|
24643 |
|
24644 |
|
24645 |
|
24646 | function getPipeDef$1(name, registry) {
|
24647 | if (registry) {
|
24648 | for (let i = registry.length - 1; i >= 0; i--) {
|
24649 | const pipeDef = registry[i];
|
24650 | if (name === pipeDef.name) {
|
24651 | return pipeDef;
|
24652 | }
|
24653 | }
|
24654 | }
|
24655 | throw new Error(`The pipe '${name}' could not be found!`);
|
24656 | }
|
24657 |
|
24658 |
|
24659 |
|
24660 |
|
24661 |
|
24662 |
|
24663 |
|
24664 |
|
24665 |
|
24666 |
|
24667 |
|
24668 |
|
24669 | function ɵɵpipeBind1(index, slotOffset, v1) {
|
24670 | const lView = getLView();
|
24671 | const pipeInstance = load(lView, index);
|
24672 | return unwrapValue$1(lView, isPure(lView, index) ?
|
24673 | pureFunction1Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, pipeInstance) :
|
24674 | pipeInstance.transform(v1));
|
24675 | }
|
24676 |
|
24677 |
|
24678 |
|
24679 |
|
24680 |
|
24681 |
|
24682 |
|
24683 |
|
24684 |
|
24685 |
|
24686 |
|
24687 |
|
24688 |
|
24689 | function ɵɵpipeBind2(index, slotOffset, v1, v2) {
|
24690 | const lView = getLView();
|
24691 | const pipeInstance = load(lView, index);
|
24692 | return unwrapValue$1(lView, isPure(lView, index) ?
|
24693 | pureFunction2Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, pipeInstance) :
|
24694 | pipeInstance.transform(v1, v2));
|
24695 | }
|
24696 |
|
24697 |
|
24698 |
|
24699 |
|
24700 |
|
24701 |
|
24702 |
|
24703 |
|
24704 |
|
24705 |
|
24706 |
|
24707 |
|
24708 |
|
24709 |
|
24710 | function ɵɵpipeBind3(index, slotOffset, v1, v2, v3) {
|
24711 | const lView = getLView();
|
24712 | const pipeInstance = load(lView, index);
|
24713 | return unwrapValue$1(lView, isPure(lView, index) ? pureFunction3Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) :
|
24714 | pipeInstance.transform(v1, v2, v3));
|
24715 | }
|
24716 |
|
24717 |
|
24718 |
|
24719 |
|
24720 |
|
24721 |
|
24722 |
|
24723 |
|
24724 |
|
24725 |
|
24726 |
|
24727 |
|
24728 |
|
24729 |
|
24730 |
|
24731 | function ɵɵpipeBind4(index, slotOffset, v1, v2, v3, v4) {
|
24732 | const lView = getLView();
|
24733 | const pipeInstance = load(lView, index);
|
24734 | return unwrapValue$1(lView, isPure(lView, index) ? pureFunction4Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) :
|
24735 | pipeInstance.transform(v1, v2, v3, v4));
|
24736 | }
|
24737 |
|
24738 |
|
24739 |
|
24740 |
|
24741 |
|
24742 |
|
24743 |
|
24744 |
|
24745 |
|
24746 |
|
24747 |
|
24748 |
|
24749 | function ɵɵpipeBindV(index, slotOffset, values) {
|
24750 | const lView = getLView();
|
24751 | const pipeInstance = load(lView, index);
|
24752 | return unwrapValue$1(lView, isPure(lView, index) ?
|
24753 | pureFunctionVInternal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, values, pipeInstance) :
|
24754 | pipeInstance.transform.apply(pipeInstance, values));
|
24755 | }
|
24756 | function isPure(lView, index) {
|
24757 | return lView[TVIEW].data[index + HEADER_OFFSET].pure;
|
24758 | }
|
24759 |
|
24760 |
|
24761 |
|
24762 |
|
24763 |
|
24764 |
|
24765 |
|
24766 | function unwrapValue$1(lView, newValue) {
|
24767 | if (WrappedValue.isWrapped(newValue)) {
|
24768 | newValue = WrappedValue.unwrap(newValue);
|
24769 |
|
24770 |
|
24771 | const bindingToInvalidateIdx = getBindingIndex();
|
24772 | lView[bindingToInvalidateIdx] = NO_CHANGE;
|
24773 | }
|
24774 | return newValue;
|
24775 | }
|
24776 |
|
24777 |
|
24778 |
|
24779 |
|
24780 |
|
24781 |
|
24782 |
|
24783 |
|
24784 | class EventEmitter_ extends Subject {
|
24785 | constructor(isAsync = false) {
|
24786 | super();
|
24787 | this.__isAsync = isAsync;
|
24788 | }
|
24789 | emit(value) {
|
24790 | super.next(value);
|
24791 | }
|
24792 | subscribe(generatorOrNext, error, complete) {
|
24793 | let schedulerFn;
|
24794 | let errorFn = (err) => null;
|
24795 | let completeFn = () => null;
|
24796 | if (generatorOrNext && typeof generatorOrNext === 'object') {
|
24797 | schedulerFn = this.__isAsync ? (value) => {
|
24798 | setTimeout(() => generatorOrNext.next(value));
|
24799 | } : (value) => {
|
24800 | generatorOrNext.next(value);
|
24801 | };
|
24802 | if (generatorOrNext.error) {
|
24803 | errorFn = this.__isAsync ? (err) => {
|
24804 | setTimeout(() => generatorOrNext.error(err));
|
24805 | } : (err) => {
|
24806 | generatorOrNext.error(err);
|
24807 | };
|
24808 | }
|
24809 | if (generatorOrNext.complete) {
|
24810 | completeFn = this.__isAsync ? () => {
|
24811 | setTimeout(() => generatorOrNext.complete());
|
24812 | } : () => {
|
24813 | generatorOrNext.complete();
|
24814 | };
|
24815 | }
|
24816 | }
|
24817 | else {
|
24818 | schedulerFn = this.__isAsync ? (value) => {
|
24819 | setTimeout(() => generatorOrNext(value));
|
24820 | } : (value) => {
|
24821 | generatorOrNext(value);
|
24822 | };
|
24823 | if (error) {
|
24824 | errorFn = this.__isAsync ? (err) => {
|
24825 | setTimeout(() => error(err));
|
24826 | } : (err) => {
|
24827 | error(err);
|
24828 | };
|
24829 | }
|
24830 | if (complete) {
|
24831 | completeFn = this.__isAsync ? () => {
|
24832 | setTimeout(() => complete());
|
24833 | } : () => {
|
24834 | complete();
|
24835 | };
|
24836 | }
|
24837 | }
|
24838 | const sink = super.subscribe(schedulerFn, errorFn, completeFn);
|
24839 | if (generatorOrNext instanceof Subscription) {
|
24840 | generatorOrNext.add(sink);
|
24841 | }
|
24842 | return sink;
|
24843 | }
|
24844 | }
|
24845 |
|
24846 |
|
24847 |
|
24848 | const EventEmitter = EventEmitter_;
|
24849 |
|
24850 |
|
24851 |
|
24852 |
|
24853 |
|
24854 |
|
24855 |
|
24856 |
|
24857 | function symbolIterator() {
|
24858 | return this._results[getSymbolIterator()]();
|
24859 | }
|
24860 |
|
24861 |
|
24862 |
|
24863 |
|
24864 |
|
24865 |
|
24866 |
|
24867 |
|
24868 |
|
24869 |
|
24870 |
|
24871 |
|
24872 |
|
24873 |
|
24874 |
|
24875 |
|
24876 |
|
24877 |
|
24878 |
|
24879 |
|
24880 |
|
24881 |
|
24882 |
|
24883 |
|
24884 |
|
24885 |
|
24886 | class QueryList {
|
24887 | constructor() {
|
24888 | this.dirty = true;
|
24889 | this._results = [];
|
24890 | this.changes = new EventEmitter();
|
24891 | this.length = 0;
|
24892 |
|
24893 |
|
24894 |
|
24895 |
|
24896 | const symbol = getSymbolIterator();
|
24897 | const proto = QueryList.prototype;
|
24898 | if (!proto[symbol])
|
24899 | proto[symbol] = symbolIterator;
|
24900 | }
|
24901 | |
24902 |
|
24903 |
|
24904 |
|
24905 | map(fn) {
|
24906 | return this._results.map(fn);
|
24907 | }
|
24908 | |
24909 |
|
24910 |
|
24911 |
|
24912 | filter(fn) {
|
24913 | return this._results.filter(fn);
|
24914 | }
|
24915 | |
24916 |
|
24917 |
|
24918 |
|
24919 | find(fn) {
|
24920 | return this._results.find(fn);
|
24921 | }
|
24922 | |
24923 |
|
24924 |
|
24925 |
|
24926 | reduce(fn, init) {
|
24927 | return this._results.reduce(fn, init);
|
24928 | }
|
24929 | |
24930 |
|
24931 |
|
24932 |
|
24933 | forEach(fn) {
|
24934 | this._results.forEach(fn);
|
24935 | }
|
24936 | |
24937 |
|
24938 |
|
24939 |
|
24940 | some(fn) {
|
24941 | return this._results.some(fn);
|
24942 | }
|
24943 | |
24944 |
|
24945 |
|
24946 | toArray() {
|
24947 | return this._results.slice();
|
24948 | }
|
24949 | toString() {
|
24950 | return this._results.toString();
|
24951 | }
|
24952 | |
24953 |
|
24954 |
|
24955 |
|
24956 |
|
24957 |
|
24958 |
|
24959 | reset(resultsTree) {
|
24960 | this._results = flatten(resultsTree);
|
24961 | this.dirty = false;
|
24962 | this.length = this._results.length;
|
24963 | this.last = this._results[this.length - 1];
|
24964 | this.first = this._results[0];
|
24965 | }
|
24966 | |
24967 |
|
24968 |
|
24969 | notifyOnChanges() {
|
24970 | this.changes.emit(this);
|
24971 | }
|
24972 |
|
24973 | setDirty() {
|
24974 | this.dirty = true;
|
24975 | }
|
24976 |
|
24977 | destroy() {
|
24978 | this.changes.complete();
|
24979 | this.changes.unsubscribe();
|
24980 | }
|
24981 | }
|
24982 |
|
24983 |
|
24984 |
|
24985 |
|
24986 |
|
24987 |
|
24988 |
|
24989 |
|
24990 |
|
24991 |
|
24992 | const unusedValueExportToPlacateAjd$7 = 1;
|
24993 |
|
24994 |
|
24995 |
|
24996 |
|
24997 |
|
24998 |
|
24999 |
|
25000 |
|
25001 |
|
25002 |
|
25003 | const unusedValueExportToPlacateAjd$8 = 1;
|
25004 |
|
25005 |
|
25006 |
|
25007 |
|
25008 |
|
25009 |
|
25010 |
|
25011 |
|
25012 | const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$7 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$8;
|
25013 | class LQuery_ {
|
25014 | constructor(queryList) {
|
25015 | this.queryList = queryList;
|
25016 | this.matches = null;
|
25017 | }
|
25018 | clone() {
|
25019 | return new LQuery_(this.queryList);
|
25020 | }
|
25021 | setDirty() {
|
25022 | this.queryList.setDirty();
|
25023 | }
|
25024 | }
|
25025 | class LQueries_ {
|
25026 | constructor(queries = []) {
|
25027 | this.queries = queries;
|
25028 | }
|
25029 | createEmbeddedView(tView) {
|
25030 | const tQueries = tView.queries;
|
25031 | if (tQueries !== null) {
|
25032 | const noOfInheritedQueries = tView.contentQueries !== null ? tView.contentQueries[0] : tQueries.length;
|
25033 | const viewLQueries = [];
|
25034 |
|
25035 |
|
25036 |
|
25037 |
|
25038 | for (let i = 0; i < noOfInheritedQueries; i++) {
|
25039 | const tQuery = tQueries.getByIndex(i);
|
25040 | const parentLQuery = this.queries[tQuery.indexInDeclarationView];
|
25041 | viewLQueries.push(parentLQuery.clone());
|
25042 | }
|
25043 | return new LQueries_(viewLQueries);
|
25044 | }
|
25045 | return null;
|
25046 | }
|
25047 | insertView(tView) {
|
25048 | this.dirtyQueriesWithMatches(tView);
|
25049 | }
|
25050 | detachView(tView) {
|
25051 | this.dirtyQueriesWithMatches(tView);
|
25052 | }
|
25053 | dirtyQueriesWithMatches(tView) {
|
25054 | for (let i = 0; i < this.queries.length; i++) {
|
25055 | if (getTQuery(tView, i).matches !== null) {
|
25056 | this.queries[i].setDirty();
|
25057 | }
|
25058 | }
|
25059 | }
|
25060 | }
|
25061 | class TQueryMetadata_ {
|
25062 | constructor(predicate, descendants, isStatic, read = null) {
|
25063 | this.predicate = predicate;
|
25064 | this.descendants = descendants;
|
25065 | this.isStatic = isStatic;
|
25066 | this.read = read;
|
25067 | }
|
25068 | }
|
25069 | class TQueries_ {
|
25070 | constructor(queries = []) {
|
25071 | this.queries = queries;
|
25072 | }
|
25073 | elementStart(tView, tNode) {
|
25074 | ngDevMode &&
|
25075 | assertFirstCreatePass(tView, 'Queries should collect results on the first template pass only');
|
25076 | for (let i = 0; i < this.queries.length; i++) {
|
25077 | this.queries[i].elementStart(tView, tNode);
|
25078 | }
|
25079 | }
|
25080 | elementEnd(tNode) {
|
25081 | for (let i = 0; i < this.queries.length; i++) {
|
25082 | this.queries[i].elementEnd(tNode);
|
25083 | }
|
25084 | }
|
25085 | embeddedTView(tNode) {
|
25086 | let queriesForTemplateRef = null;
|
25087 | for (let i = 0; i < this.length; i++) {
|
25088 | const childQueryIndex = queriesForTemplateRef !== null ? queriesForTemplateRef.length : 0;
|
25089 | const tqueryClone = this.getByIndex(i).embeddedTView(tNode, childQueryIndex);
|
25090 | if (tqueryClone) {
|
25091 | tqueryClone.indexInDeclarationView = i;
|
25092 | if (queriesForTemplateRef !== null) {
|
25093 | queriesForTemplateRef.push(tqueryClone);
|
25094 | }
|
25095 | else {
|
25096 | queriesForTemplateRef = [tqueryClone];
|
25097 | }
|
25098 | }
|
25099 | }
|
25100 | return queriesForTemplateRef !== null ? new TQueries_(queriesForTemplateRef) : null;
|
25101 | }
|
25102 | template(tView, tNode) {
|
25103 | ngDevMode &&
|
25104 | assertFirstCreatePass(tView, 'Queries should collect results on the first template pass only');
|
25105 | for (let i = 0; i < this.queries.length; i++) {
|
25106 | this.queries[i].template(tView, tNode);
|
25107 | }
|
25108 | }
|
25109 | getByIndex(index) {
|
25110 | ngDevMode && assertIndexInRange(this.queries, index);
|
25111 | return this.queries[index];
|
25112 | }
|
25113 | get length() {
|
25114 | return this.queries.length;
|
25115 | }
|
25116 | track(tquery) {
|
25117 | this.queries.push(tquery);
|
25118 | }
|
25119 | }
|
25120 | class TQuery_ {
|
25121 | constructor(metadata, nodeIndex = -1) {
|
25122 | this.metadata = metadata;
|
25123 | this.matches = null;
|
25124 | this.indexInDeclarationView = -1;
|
25125 | this.crossesNgTemplate = false;
|
25126 | |
25127 |
|
25128 |
|
25129 |
|
25130 |
|
25131 | this._appliesToNextNode = true;
|
25132 | this._declarationNodeIndex = nodeIndex;
|
25133 | }
|
25134 | elementStart(tView, tNode) {
|
25135 | if (this.isApplyingToNode(tNode)) {
|
25136 | this.matchTNode(tView, tNode);
|
25137 | }
|
25138 | }
|
25139 | elementEnd(tNode) {
|
25140 | if (this._declarationNodeIndex === tNode.index) {
|
25141 | this._appliesToNextNode = false;
|
25142 | }
|
25143 | }
|
25144 | template(tView, tNode) {
|
25145 | this.elementStart(tView, tNode);
|
25146 | }
|
25147 | embeddedTView(tNode, childQueryIndex) {
|
25148 | if (this.isApplyingToNode(tNode)) {
|
25149 | this.crossesNgTemplate = true;
|
25150 |
|
25151 |
|
25152 | this.addMatch(-tNode.index, childQueryIndex);
|
25153 | return new TQuery_(this.metadata);
|
25154 | }
|
25155 | return null;
|
25156 | }
|
25157 | isApplyingToNode(tNode) {
|
25158 | if (this._appliesToNextNode && this.metadata.descendants === false) {
|
25159 | const declarationNodeIdx = this._declarationNodeIndex;
|
25160 | let parent = tNode.parent;
|
25161 |
|
25162 |
|
25163 |
|
25164 |
|
25165 |
|
25166 |
|
25167 |
|
25168 |
|
25169 |
|
25170 |
|
25171 | while (parent !== null && parent.type === 4 &&
|
25172 | parent.index !== declarationNodeIdx) {
|
25173 | parent = parent.parent;
|
25174 | }
|
25175 | return declarationNodeIdx === (parent !== null ? parent.index : -1);
|
25176 | }
|
25177 | return this._appliesToNextNode;
|
25178 | }
|
25179 | matchTNode(tView, tNode) {
|
25180 | const predicate = this.metadata.predicate;
|
25181 | if (Array.isArray(predicate)) {
|
25182 | for (let i = 0; i < predicate.length; i++) {
|
25183 | const name = predicate[i];
|
25184 | this.matchTNodeWithReadOption(tView, tNode, getIdxOfMatchingSelector(tNode, name));
|
25185 |
|
25186 | this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, name, false, false));
|
25187 | }
|
25188 | }
|
25189 | else {
|
25190 | if (predicate === TemplateRef) {
|
25191 | if (tNode.type === 0 ) {
|
25192 | this.matchTNodeWithReadOption(tView, tNode, -1);
|
25193 | }
|
25194 | }
|
25195 | else {
|
25196 | this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, predicate, false, false));
|
25197 | }
|
25198 | }
|
25199 | }
|
25200 | matchTNodeWithReadOption(tView, tNode, nodeMatchIdx) {
|
25201 | if (nodeMatchIdx !== null) {
|
25202 | const read = this.metadata.read;
|
25203 | if (read !== null) {
|
25204 | if (read === ElementRef || read === ViewContainerRef ||
|
25205 | read === TemplateRef && tNode.type === 0 ) {
|
25206 | this.addMatch(tNode.index, -2);
|
25207 | }
|
25208 | else {
|
25209 | const directiveOrProviderIdx = locateDirectiveOrProvider(tNode, tView, read, false, false);
|
25210 | if (directiveOrProviderIdx !== null) {
|
25211 | this.addMatch(tNode.index, directiveOrProviderIdx);
|
25212 | }
|
25213 | }
|
25214 | }
|
25215 | else {
|
25216 | this.addMatch(tNode.index, nodeMatchIdx);
|
25217 | }
|
25218 | }
|
25219 | }
|
25220 | addMatch(tNodeIdx, matchIdx) {
|
25221 | if (this.matches === null) {
|
25222 | this.matches = [tNodeIdx, matchIdx];
|
25223 | }
|
25224 | else {
|
25225 | this.matches.push(tNodeIdx, matchIdx);
|
25226 | }
|
25227 | }
|
25228 | }
|
25229 |
|
25230 |
|
25231 |
|
25232 |
|
25233 |
|
25234 |
|
25235 |
|
25236 |
|
25237 | function getIdxOfMatchingSelector(tNode, selector) {
|
25238 | const localNames = tNode.localNames;
|
25239 | if (localNames !== null) {
|
25240 | for (let i = 0; i < localNames.length; i += 2) {
|
25241 | if (localNames[i] === selector) {
|
25242 | return localNames[i + 1];
|
25243 | }
|
25244 | }
|
25245 | }
|
25246 | return null;
|
25247 | }
|
25248 | function createResultByTNodeType(tNode, currentView) {
|
25249 | if (tNode.type === 3 || tNode.type === 4 ) {
|
25250 | return createElementRef(ElementRef, tNode, currentView);
|
25251 | }
|
25252 | else if (tNode.type === 0 ) {
|
25253 | return createTemplateRef(TemplateRef, ElementRef, tNode, currentView);
|
25254 | }
|
25255 | return null;
|
25256 | }
|
25257 | function createResultForNode(lView, tNode, matchingIdx, read) {
|
25258 | if (matchingIdx === -1) {
|
25259 |
|
25260 | return createResultByTNodeType(tNode, lView);
|
25261 | }
|
25262 | else if (matchingIdx === -2) {
|
25263 |
|
25264 | return createSpecialToken(lView, tNode, read);
|
25265 | }
|
25266 | else {
|
25267 |
|
25268 | return getNodeInjectable(lView, lView[TVIEW], matchingIdx, tNode);
|
25269 | }
|
25270 | }
|
25271 | function createSpecialToken(lView, tNode, read) {
|
25272 | if (read === ElementRef) {
|
25273 | return createElementRef(ElementRef, tNode, lView);
|
25274 | }
|
25275 | else if (read === TemplateRef) {
|
25276 | return createTemplateRef(TemplateRef, ElementRef, tNode, lView);
|
25277 | }
|
25278 | else if (read === ViewContainerRef) {
|
25279 | ngDevMode &&
|
25280 | assertNodeOfPossibleTypes(tNode, [3 , 0 , 4 ]);
|
25281 | return createContainerRef(ViewContainerRef, ElementRef, tNode, lView);
|
25282 | }
|
25283 | else {
|
25284 | ngDevMode &&
|
25285 | throwError(`Special token to read should be one of ElementRef, TemplateRef or ViewContainerRef but got ${stringify(read)}.`);
|
25286 | }
|
25287 | }
|
25288 |
|
25289 |
|
25290 |
|
25291 |
|
25292 |
|
25293 | function materializeViewResults(tView, lView, tQuery, queryIndex) {
|
25294 | const lQuery = lView[QUERIES].queries[queryIndex];
|
25295 | if (lQuery.matches === null) {
|
25296 | const tViewData = tView.data;
|
25297 | const tQueryMatches = tQuery.matches;
|
25298 | const result = [];
|
25299 | for (let i = 0; i < tQueryMatches.length; i += 2) {
|
25300 | const matchedNodeIdx = tQueryMatches[i];
|
25301 | if (matchedNodeIdx < 0) {
|
25302 |
|
25303 |
|
25304 |
|
25305 | result.push(null);
|
25306 | }
|
25307 | else {
|
25308 | ngDevMode && assertIndexInRange(tViewData, matchedNodeIdx);
|
25309 | const tNode = tViewData[matchedNodeIdx];
|
25310 | result.push(createResultForNode(lView, tNode, tQueryMatches[i + 1], tQuery.metadata.read));
|
25311 | }
|
25312 | }
|
25313 | lQuery.matches = result;
|
25314 | }
|
25315 | return lQuery.matches;
|
25316 | }
|
25317 |
|
25318 |
|
25319 |
|
25320 |
|
25321 | function collectQueryResults(tView, lView, queryIndex, result) {
|
25322 | const tQuery = tView.queries.getByIndex(queryIndex);
|
25323 | const tQueryMatches = tQuery.matches;
|
25324 | if (tQueryMatches !== null) {
|
25325 | const lViewResults = materializeViewResults(tView, lView, tQuery, queryIndex);
|
25326 | for (let i = 0; i < tQueryMatches.length; i += 2) {
|
25327 | const tNodeIdx = tQueryMatches[i];
|
25328 | if (tNodeIdx > 0) {
|
25329 | result.push(lViewResults[i / 2]);
|
25330 | }
|
25331 | else {
|
25332 | const childQueryIndex = tQueryMatches[i + 1];
|
25333 | const declarationLContainer = lView[-tNodeIdx];
|
25334 | ngDevMode && assertLContainer(declarationLContainer);
|
25335 |
|
25336 | for (let i = CONTAINER_HEADER_OFFSET; i < declarationLContainer.length; i++) {
|
25337 | const embeddedLView = declarationLContainer[i];
|
25338 | if (embeddedLView[DECLARATION_LCONTAINER] === embeddedLView[PARENT]) {
|
25339 | collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result);
|
25340 | }
|
25341 | }
|
25342 |
|
25343 |
|
25344 | if (declarationLContainer[MOVED_VIEWS] !== null) {
|
25345 | const embeddedLViews = declarationLContainer[MOVED_VIEWS];
|
25346 | for (let i = 0; i < embeddedLViews.length; i++) {
|
25347 | const embeddedLView = embeddedLViews[i];
|
25348 | collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result);
|
25349 | }
|
25350 | }
|
25351 | }
|
25352 | }
|
25353 | }
|
25354 | return result;
|
25355 | }
|
25356 |
|
25357 |
|
25358 |
|
25359 |
|
25360 |
|
25361 |
|
25362 |
|
25363 |
|
25364 |
|
25365 | function ɵɵqueryRefresh(queryList) {
|
25366 | const lView = getLView();
|
25367 | const tView = getTView();
|
25368 | const queryIndex = getCurrentQueryIndex();
|
25369 | setCurrentQueryIndex(queryIndex + 1);
|
25370 | const tQuery = getTQuery(tView, queryIndex);
|
25371 | if (queryList.dirty && (isCreationMode(lView) === tQuery.metadata.isStatic)) {
|
25372 | if (tQuery.matches === null) {
|
25373 | queryList.reset([]);
|
25374 | }
|
25375 | else {
|
25376 | const result = tQuery.crossesNgTemplate ?
|
25377 | collectQueryResults(tView, lView, queryIndex, []) :
|
25378 | materializeViewResults(tView, lView, tQuery, queryIndex);
|
25379 | queryList.reset(result);
|
25380 | queryList.notifyOnChanges();
|
25381 | }
|
25382 | return true;
|
25383 | }
|
25384 | return false;
|
25385 | }
|
25386 |
|
25387 |
|
25388 |
|
25389 |
|
25390 |
|
25391 |
|
25392 |
|
25393 |
|
25394 |
|
25395 | function ɵɵstaticViewQuery(predicate, descend, read) {
|
25396 | viewQueryInternal(getTView(), getLView(), predicate, descend, read, true);
|
25397 | }
|
25398 |
|
25399 |
|
25400 |
|
25401 |
|
25402 |
|
25403 |
|
25404 |
|
25405 |
|
25406 |
|
25407 | function ɵɵviewQuery(predicate, descend, read) {
|
25408 | viewQueryInternal(getTView(), getLView(), predicate, descend, read, false);
|
25409 | }
|
25410 | function viewQueryInternal(tView, lView, predicate, descend, read, isStatic) {
|
25411 | if (tView.firstCreatePass) {
|
25412 | createTQuery(tView, new TQueryMetadata_(predicate, descend, isStatic, read), -1);
|
25413 | if (isStatic) {
|
25414 | tView.staticViewQueries = true;
|
25415 | }
|
25416 | }
|
25417 | createLQuery(tView, lView);
|
25418 | }
|
25419 |
|
25420 |
|
25421 |
|
25422 |
|
25423 |
|
25424 |
|
25425 |
|
25426 |
|
25427 |
|
25428 |
|
25429 |
|
25430 |
|
25431 | function ɵɵcontentQuery(directiveIndex, predicate, descend, read) {
|
25432 | contentQueryInternal(getTView(), getLView(), predicate, descend, read, false, getPreviousOrParentTNode(), directiveIndex);
|
25433 | }
|
25434 |
|
25435 |
|
25436 |
|
25437 |
|
25438 |
|
25439 |
|
25440 |
|
25441 |
|
25442 |
|
25443 |
|
25444 |
|
25445 |
|
25446 | function ɵɵstaticContentQuery(directiveIndex, predicate, descend, read) {
|
25447 | contentQueryInternal(getTView(), getLView(), predicate, descend, read, true, getPreviousOrParentTNode(), directiveIndex);
|
25448 | }
|
25449 | function contentQueryInternal(tView, lView, predicate, descend, read, isStatic, tNode, directiveIndex) {
|
25450 | if (tView.firstCreatePass) {
|
25451 | createTQuery(tView, new TQueryMetadata_(predicate, descend, isStatic, read), tNode.index);
|
25452 | saveContentQueryAndDirectiveIndex(tView, directiveIndex);
|
25453 | if (isStatic) {
|
25454 | tView.staticContentQueries = true;
|
25455 | }
|
25456 | }
|
25457 | createLQuery(tView, lView);
|
25458 | }
|
25459 |
|
25460 |
|
25461 |
|
25462 |
|
25463 |
|
25464 | function ɵɵloadQuery() {
|
25465 | return loadQueryInternal(getLView(), getCurrentQueryIndex());
|
25466 | }
|
25467 | function loadQueryInternal(lView, queryIndex) {
|
25468 | ngDevMode &&
|
25469 | assertDefined(lView[QUERIES], 'LQueries should be defined when trying to load a query');
|
25470 | ngDevMode && assertIndexInRange(lView[QUERIES].queries, queryIndex);
|
25471 | return lView[QUERIES].queries[queryIndex].queryList;
|
25472 | }
|
25473 | function createLQuery(tView, lView) {
|
25474 | const queryList = new QueryList();
|
25475 | storeCleanupWithContext(tView, lView, queryList, queryList.destroy);
|
25476 | if (lView[QUERIES] === null)
|
25477 | lView[QUERIES] = new LQueries_();
|
25478 | lView[QUERIES].queries.push(new LQuery_(queryList));
|
25479 | }
|
25480 | function createTQuery(tView, metadata, nodeIndex) {
|
25481 | if (tView.queries === null)
|
25482 | tView.queries = new TQueries_();
|
25483 | tView.queries.track(new TQuery_(metadata, nodeIndex));
|
25484 | }
|
25485 | function saveContentQueryAndDirectiveIndex(tView, directiveIndex) {
|
25486 | const tViewContentQueries = tView.contentQueries || (tView.contentQueries = []);
|
25487 | const lastSavedDirectiveIndex = tView.contentQueries.length ? tViewContentQueries[tViewContentQueries.length - 1] : -1;
|
25488 | if (directiveIndex !== lastSavedDirectiveIndex) {
|
25489 | tViewContentQueries.push(tView.queries.length - 1, directiveIndex);
|
25490 | }
|
25491 | }
|
25492 | function getTQuery(tView, index) {
|
25493 | ngDevMode && assertDefined(tView.queries, 'TQueries must be defined to retrieve a TQuery');
|
25494 | return tView.queries.getByIndex(index);
|
25495 | }
|
25496 |
|
25497 |
|
25498 |
|
25499 |
|
25500 |
|
25501 |
|
25502 |
|
25503 |
|
25504 |
|
25505 |
|
25506 |
|
25507 |
|
25508 |
|
25509 |
|
25510 | function ɵɵtemplateRefExtractor(tNode, currentView) {
|
25511 | return createTemplateRef(TemplateRef, ElementRef, tNode, currentView);
|
25512 | }
|
25513 |
|
25514 |
|
25515 |
|
25516 |
|
25517 |
|
25518 | function ɵɵinjectPipeChangeDetectorRef(flags = InjectFlags.Default) {
|
25519 | const value = injectChangeDetectorRef(true);
|
25520 | if (value == null && !(flags & InjectFlags.Optional)) {
|
25521 | throw new Error(`No provider for ChangeDetectorRef!`);
|
25522 | }
|
25523 | else {
|
25524 | return value;
|
25525 | }
|
25526 | }
|
25527 |
|
25528 |
|
25529 |
|
25530 |
|
25531 |
|
25532 |
|
25533 |
|
25534 |
|
25535 |
|
25536 |
|
25537 |
|
25538 |
|
25539 |
|
25540 |
|
25541 |
|
25542 |
|
25543 | const ɵ0$d = () => ({
|
25544 | 'ɵɵattribute': ɵɵattribute,
|
25545 | 'ɵɵattributeInterpolate1': ɵɵattributeInterpolate1,
|
25546 | 'ɵɵattributeInterpolate2': ɵɵattributeInterpolate2,
|
25547 | 'ɵɵattributeInterpolate3': ɵɵattributeInterpolate3,
|
25548 | 'ɵɵattributeInterpolate4': ɵɵattributeInterpolate4,
|
25549 | 'ɵɵattributeInterpolate5': ɵɵattributeInterpolate5,
|
25550 | 'ɵɵattributeInterpolate6': ɵɵattributeInterpolate6,
|
25551 | 'ɵɵattributeInterpolate7': ɵɵattributeInterpolate7,
|
25552 | 'ɵɵattributeInterpolate8': ɵɵattributeInterpolate8,
|
25553 | 'ɵɵattributeInterpolateV': ɵɵattributeInterpolateV,
|
25554 | 'ɵɵdefineComponent': ɵɵdefineComponent,
|
25555 | 'ɵɵdefineDirective': ɵɵdefineDirective,
|
25556 | 'ɵɵdefineInjectable': ɵɵdefineInjectable,
|
25557 | 'ɵɵdefineInjector': ɵɵdefineInjector,
|
25558 | 'ɵɵdefineNgModule': ɵɵdefineNgModule,
|
25559 | 'ɵɵdefinePipe': ɵɵdefinePipe,
|
25560 | 'ɵɵdirectiveInject': ɵɵdirectiveInject,
|
25561 | 'ɵɵgetFactoryOf': ɵɵgetFactoryOf,
|
25562 | 'ɵɵgetInheritedFactory': ɵɵgetInheritedFactory,
|
25563 | 'ɵɵinject': ɵɵinject,
|
25564 | 'ɵɵinjectAttribute': ɵɵinjectAttribute,
|
25565 | 'ɵɵinvalidFactory': ɵɵinvalidFactory,
|
25566 | 'ɵɵinvalidFactoryDep': ɵɵinvalidFactoryDep,
|
25567 | 'ɵɵinjectPipeChangeDetectorRef': ɵɵinjectPipeChangeDetectorRef,
|
25568 | 'ɵɵtemplateRefExtractor': ɵɵtemplateRefExtractor,
|
25569 | 'ɵɵNgOnChangesFeature': ɵɵNgOnChangesFeature,
|
25570 | 'ɵɵProvidersFeature': ɵɵProvidersFeature,
|
25571 | 'ɵɵCopyDefinitionFeature': ɵɵCopyDefinitionFeature,
|
25572 | 'ɵɵInheritDefinitionFeature': ɵɵInheritDefinitionFeature,
|
25573 | 'ɵɵnextContext': ɵɵnextContext,
|
25574 | 'ɵɵnamespaceHTML': ɵɵnamespaceHTML,
|
25575 | 'ɵɵnamespaceMathML': ɵɵnamespaceMathML,
|
25576 | 'ɵɵnamespaceSVG': ɵɵnamespaceSVG,
|
25577 | 'ɵɵenableBindings': ɵɵenableBindings,
|
25578 | 'ɵɵdisableBindings': ɵɵdisableBindings,
|
25579 | 'ɵɵelementStart': ɵɵelementStart,
|
25580 | 'ɵɵelementEnd': ɵɵelementEnd,
|
25581 | 'ɵɵelement': ɵɵelement,
|
25582 | 'ɵɵelementContainerStart': ɵɵelementContainerStart,
|
25583 | 'ɵɵelementContainerEnd': ɵɵelementContainerEnd,
|
25584 | 'ɵɵelementContainer': ɵɵelementContainer,
|
25585 | 'ɵɵpureFunction0': ɵɵpureFunction0,
|
25586 | 'ɵɵpureFunction1': ɵɵpureFunction1,
|
25587 | 'ɵɵpureFunction2': ɵɵpureFunction2,
|
25588 | 'ɵɵpureFunction3': ɵɵpureFunction3,
|
25589 | 'ɵɵpureFunction4': ɵɵpureFunction4,
|
25590 | 'ɵɵpureFunction5': ɵɵpureFunction5,
|
25591 | 'ɵɵpureFunction6': ɵɵpureFunction6,
|
25592 | 'ɵɵpureFunction7': ɵɵpureFunction7,
|
25593 | 'ɵɵpureFunction8': ɵɵpureFunction8,
|
25594 | 'ɵɵpureFunctionV': ɵɵpureFunctionV,
|
25595 | 'ɵɵgetCurrentView': ɵɵgetCurrentView,
|
25596 | 'ɵɵrestoreView': ɵɵrestoreView,
|
25597 | 'ɵɵlistener': ɵɵlistener,
|
25598 | 'ɵɵprojection': ɵɵprojection,
|
25599 | 'ɵɵsyntheticHostProperty': ɵɵsyntheticHostProperty,
|
25600 | 'ɵɵsyntheticHostListener': ɵɵsyntheticHostListener,
|
25601 | 'ɵɵpipeBind1': ɵɵpipeBind1,
|
25602 | 'ɵɵpipeBind2': ɵɵpipeBind2,
|
25603 | 'ɵɵpipeBind3': ɵɵpipeBind3,
|
25604 | 'ɵɵpipeBind4': ɵɵpipeBind4,
|
25605 | 'ɵɵpipeBindV': ɵɵpipeBindV,
|
25606 | 'ɵɵprojectionDef': ɵɵprojectionDef,
|
25607 | 'ɵɵhostProperty': ɵɵhostProperty,
|
25608 | 'ɵɵproperty': ɵɵproperty,
|
25609 | 'ɵɵpropertyInterpolate': ɵɵpropertyInterpolate,
|
25610 | 'ɵɵpropertyInterpolate1': ɵɵpropertyInterpolate1,
|
25611 | 'ɵɵpropertyInterpolate2': ɵɵpropertyInterpolate2,
|
25612 | 'ɵɵpropertyInterpolate3': ɵɵpropertyInterpolate3,
|
25613 | 'ɵɵpropertyInterpolate4': ɵɵpropertyInterpolate4,
|
25614 | 'ɵɵpropertyInterpolate5': ɵɵpropertyInterpolate5,
|
25615 | 'ɵɵpropertyInterpolate6': ɵɵpropertyInterpolate6,
|
25616 | 'ɵɵpropertyInterpolate7': ɵɵpropertyInterpolate7,
|
25617 | 'ɵɵpropertyInterpolate8': ɵɵpropertyInterpolate8,
|
25618 | 'ɵɵpropertyInterpolateV': ɵɵpropertyInterpolateV,
|
25619 | 'ɵɵpipe': ɵɵpipe,
|
25620 | 'ɵɵqueryRefresh': ɵɵqueryRefresh,
|
25621 | 'ɵɵviewQuery': ɵɵviewQuery,
|
25622 | 'ɵɵstaticViewQuery': ɵɵstaticViewQuery,
|
25623 | 'ɵɵstaticContentQuery': ɵɵstaticContentQuery,
|
25624 | 'ɵɵloadQuery': ɵɵloadQuery,
|
25625 | 'ɵɵcontentQuery': ɵɵcontentQuery,
|
25626 | 'ɵɵreference': ɵɵreference,
|
25627 | 'ɵɵclassMap': ɵɵclassMap,
|
25628 | 'ɵɵclassMapInterpolate1': ɵɵclassMapInterpolate1,
|
25629 | 'ɵɵclassMapInterpolate2': ɵɵclassMapInterpolate2,
|
25630 | 'ɵɵclassMapInterpolate3': ɵɵclassMapInterpolate3,
|
25631 | 'ɵɵclassMapInterpolate4': ɵɵclassMapInterpolate4,
|
25632 | 'ɵɵclassMapInterpolate5': ɵɵclassMapInterpolate5,
|
25633 | 'ɵɵclassMapInterpolate6': ɵɵclassMapInterpolate6,
|
25634 | 'ɵɵclassMapInterpolate7': ɵɵclassMapInterpolate7,
|
25635 | 'ɵɵclassMapInterpolate8': ɵɵclassMapInterpolate8,
|
25636 | 'ɵɵclassMapInterpolateV': ɵɵclassMapInterpolateV,
|
25637 | 'ɵɵstyleMap': ɵɵstyleMap,
|
25638 | 'ɵɵstyleMapInterpolate1': ɵɵstyleMapInterpolate1,
|
25639 | 'ɵɵstyleMapInterpolate2': ɵɵstyleMapInterpolate2,
|
25640 | 'ɵɵstyleMapInterpolate3': ɵɵstyleMapInterpolate3,
|
25641 | 'ɵɵstyleMapInterpolate4': ɵɵstyleMapInterpolate4,
|
25642 | 'ɵɵstyleMapInterpolate5': ɵɵstyleMapInterpolate5,
|
25643 | 'ɵɵstyleMapInterpolate6': ɵɵstyleMapInterpolate6,
|
25644 | 'ɵɵstyleMapInterpolate7': ɵɵstyleMapInterpolate7,
|
25645 | 'ɵɵstyleMapInterpolate8': ɵɵstyleMapInterpolate8,
|
25646 | 'ɵɵstyleMapInterpolateV': ɵɵstyleMapInterpolateV,
|
25647 | 'ɵɵstyleProp': ɵɵstyleProp,
|
25648 | 'ɵɵstylePropInterpolate1': ɵɵstylePropInterpolate1,
|
25649 | 'ɵɵstylePropInterpolate2': ɵɵstylePropInterpolate2,
|
25650 | 'ɵɵstylePropInterpolate3': ɵɵstylePropInterpolate3,
|
25651 | 'ɵɵstylePropInterpolate4': ɵɵstylePropInterpolate4,
|
25652 | 'ɵɵstylePropInterpolate5': ɵɵstylePropInterpolate5,
|
25653 | 'ɵɵstylePropInterpolate6': ɵɵstylePropInterpolate6,
|
25654 | 'ɵɵstylePropInterpolate7': ɵɵstylePropInterpolate7,
|
25655 | 'ɵɵstylePropInterpolate8': ɵɵstylePropInterpolate8,
|
25656 | 'ɵɵstylePropInterpolateV': ɵɵstylePropInterpolateV,
|
25657 | 'ɵɵclassProp': ɵɵclassProp,
|
25658 | 'ɵɵselect': ɵɵselect,
|
25659 | 'ɵɵadvance': ɵɵadvance,
|
25660 | 'ɵɵtemplate': ɵɵtemplate,
|
25661 | 'ɵɵtext': ɵɵtext,
|
25662 | 'ɵɵtextInterpolate': ɵɵtextInterpolate,
|
25663 | 'ɵɵtextInterpolate1': ɵɵtextInterpolate1,
|
25664 | 'ɵɵtextInterpolate2': ɵɵtextInterpolate2,
|
25665 | 'ɵɵtextInterpolate3': ɵɵtextInterpolate3,
|
25666 | 'ɵɵtextInterpolate4': ɵɵtextInterpolate4,
|
25667 | 'ɵɵtextInterpolate5': ɵɵtextInterpolate5,
|
25668 | 'ɵɵtextInterpolate6': ɵɵtextInterpolate6,
|
25669 | 'ɵɵtextInterpolate7': ɵɵtextInterpolate7,
|
25670 | 'ɵɵtextInterpolate8': ɵɵtextInterpolate8,
|
25671 | 'ɵɵtextInterpolateV': ɵɵtextInterpolateV,
|
25672 | 'ɵɵi18n': ɵɵi18n,
|
25673 | 'ɵɵi18nAttributes': ɵɵi18nAttributes,
|
25674 | 'ɵɵi18nExp': ɵɵi18nExp,
|
25675 | 'ɵɵi18nStart': ɵɵi18nStart,
|
25676 | 'ɵɵi18nEnd': ɵɵi18nEnd,
|
25677 | 'ɵɵi18nApply': ɵɵi18nApply,
|
25678 | 'ɵɵi18nPostprocess': ɵɵi18nPostprocess,
|
25679 | 'ɵɵresolveWindow': ɵɵresolveWindow,
|
25680 | 'ɵɵresolveDocument': ɵɵresolveDocument,
|
25681 | 'ɵɵresolveBody': ɵɵresolveBody,
|
25682 | 'ɵɵsetComponentScope': ɵɵsetComponentScope,
|
25683 | 'ɵɵsetNgModuleScope': ɵɵsetNgModuleScope,
|
25684 | 'ɵɵsanitizeHtml': ɵɵsanitizeHtml,
|
25685 | 'ɵɵsanitizeStyle': ɵɵsanitizeStyle,
|
25686 | 'ɵɵsanitizeResourceUrl': ɵɵsanitizeResourceUrl,
|
25687 | 'ɵɵsanitizeScript': ɵɵsanitizeScript,
|
25688 | 'ɵɵsanitizeUrl': ɵɵsanitizeUrl,
|
25689 | 'ɵɵsanitizeUrlOrResourceUrl': ɵɵsanitizeUrlOrResourceUrl,
|
25690 | });
|
25691 |
|
25692 |
|
25693 |
|
25694 |
|
25695 |
|
25696 | const angularCoreEnv = (ɵ0$d)();
|
25697 |
|
25698 | let jitOptions = null;
|
25699 | function setJitOptions(options) {
|
25700 | if (jitOptions !== null) {
|
25701 | if (options.defaultEncapsulation !== jitOptions.defaultEncapsulation) {
|
25702 | ngDevMode &&
|
25703 | console.error('Provided value for `defaultEncapsulation` can not be changed once it has been set.');
|
25704 | return;
|
25705 | }
|
25706 | if (options.preserveWhitespaces !== jitOptions.preserveWhitespaces) {
|
25707 | ngDevMode &&
|
25708 | console.error('Provided value for `preserveWhitespaces` can not be changed once it has been set.');
|
25709 | return;
|
25710 | }
|
25711 | }
|
25712 | jitOptions = options;
|
25713 | }
|
25714 | function getJitOptions() {
|
25715 | return jitOptions;
|
25716 | }
|
25717 | function resetJitOptions() {
|
25718 | jitOptions = null;
|
25719 | }
|
25720 |
|
25721 |
|
25722 |
|
25723 |
|
25724 |
|
25725 |
|
25726 |
|
25727 |
|
25728 | const EMPTY_ARRAY$5 = [];
|
25729 | const moduleQueue = [];
|
25730 |
|
25731 |
|
25732 |
|
25733 |
|
25734 | function enqueueModuleForDelayedScoping(moduleType, ngModule) {
|
25735 | moduleQueue.push({ moduleType, ngModule });
|
25736 | }
|
25737 | let flushingModuleQueue = false;
|
25738 |
|
25739 |
|
25740 |
|
25741 |
|
25742 |
|
25743 | function flushModuleScopingQueueAsMuchAsPossible() {
|
25744 | if (!flushingModuleQueue) {
|
25745 | flushingModuleQueue = true;
|
25746 | try {
|
25747 | for (let i = moduleQueue.length - 1; i >= 0; i--) {
|
25748 | const { moduleType, ngModule } = moduleQueue[i];
|
25749 | if (ngModule.declarations && ngModule.declarations.every(isResolvedDeclaration)) {
|
25750 |
|
25751 | moduleQueue.splice(i, 1);
|
25752 | setScopeOnDeclaredComponents(moduleType, ngModule);
|
25753 | }
|
25754 | }
|
25755 | }
|
25756 | finally {
|
25757 | flushingModuleQueue = false;
|
25758 | }
|
25759 | }
|
25760 | }
|
25761 |
|
25762 |
|
25763 |
|
25764 |
|
25765 |
|
25766 | function isResolvedDeclaration(declaration) {
|
25767 | if (Array.isArray(declaration)) {
|
25768 | return declaration.every(isResolvedDeclaration);
|
25769 | }
|
25770 | return !!resolveForwardRef(declaration);
|
25771 | }
|
25772 |
|
25773 |
|
25774 |
|
25775 |
|
25776 |
|
25777 | function compileNgModule(moduleType, ngModule = {}) {
|
25778 | compileNgModuleDefs(moduleType, ngModule);
|
25779 |
|
25780 |
|
25781 |
|
25782 |
|
25783 | enqueueModuleForDelayedScoping(moduleType, ngModule);
|
25784 | }
|
25785 |
|
25786 |
|
25787 |
|
25788 |
|
25789 |
|
25790 |
|
25791 | function compileNgModuleDefs(moduleType, ngModule, allowDuplicateDeclarationsInRoot = false) {
|
25792 | ngDevMode && assertDefined(moduleType, 'Required value moduleType');
|
25793 | ngDevMode && assertDefined(ngModule, 'Required value ngModule');
|
25794 | const declarations = flatten(ngModule.declarations || EMPTY_ARRAY$5);
|
25795 | let ngModuleDef = null;
|
25796 | Object.defineProperty(moduleType, NG_MOD_DEF, {
|
25797 | configurable: true,
|
25798 | get: () => {
|
25799 | if (ngModuleDef === null) {
|
25800 | if (ngDevMode && ngModule.imports && ngModule.imports.indexOf(moduleType) > -1) {
|
25801 |
|
25802 |
|
25803 | throw new Error(`'${stringifyForError(moduleType)}' module can't import itself`);
|
25804 | }
|
25805 | ngModuleDef = getCompilerFacade().compileNgModule(angularCoreEnv, `ng:///${moduleType.name}/ɵmod.js`, {
|
25806 | type: moduleType,
|
25807 | bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY$5).map(resolveForwardRef),
|
25808 | declarations: declarations.map(resolveForwardRef),
|
25809 | imports: flatten(ngModule.imports || EMPTY_ARRAY$5)
|
25810 | .map(resolveForwardRef)
|
25811 | .map(expandModuleWithProviders),
|
25812 | exports: flatten(ngModule.exports || EMPTY_ARRAY$5)
|
25813 | .map(resolveForwardRef)
|
25814 | .map(expandModuleWithProviders),
|
25815 | schemas: ngModule.schemas ? flatten(ngModule.schemas) : null,
|
25816 | id: ngModule.id || null,
|
25817 | });
|
25818 |
|
25819 |
|
25820 |
|
25821 |
|
25822 | if (!ngModuleDef.schemas) {
|
25823 | ngModuleDef.schemas = [];
|
25824 | }
|
25825 | }
|
25826 | return ngModuleDef;
|
25827 | }
|
25828 | });
|
25829 | let ngInjectorDef = null;
|
25830 | Object.defineProperty(moduleType, NG_INJ_DEF, {
|
25831 | get: () => {
|
25832 | if (ngInjectorDef === null) {
|
25833 | ngDevMode &&
|
25834 | verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot);
|
25835 | const meta = {
|
25836 | name: moduleType.name,
|
25837 | type: moduleType,
|
25838 | deps: reflectDependencies(moduleType),
|
25839 | providers: ngModule.providers || EMPTY_ARRAY$5,
|
25840 | imports: [
|
25841 | (ngModule.imports || EMPTY_ARRAY$5).map(resolveForwardRef),
|
25842 | (ngModule.exports || EMPTY_ARRAY$5).map(resolveForwardRef),
|
25843 | ],
|
25844 | };
|
25845 | ngInjectorDef = getCompilerFacade().compileInjector(angularCoreEnv, `ng:///${moduleType.name}/ɵinj.js`, meta);
|
25846 | }
|
25847 | return ngInjectorDef;
|
25848 | },
|
25849 |
|
25850 | configurable: !!ngDevMode,
|
25851 | });
|
25852 | }
|
25853 | function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot, importingModule) {
|
25854 | if (verifiedNgModule.get(moduleType))
|
25855 | return;
|
25856 | verifiedNgModule.set(moduleType, true);
|
25857 | moduleType = resolveForwardRef(moduleType);
|
25858 | let ngModuleDef;
|
25859 | if (importingModule) {
|
25860 | ngModuleDef = getNgModuleDef(moduleType);
|
25861 | if (!ngModuleDef) {
|
25862 | throw new Error(`Unexpected value '${moduleType.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
|
25863 | }
|
25864 | }
|
25865 | else {
|
25866 | ngModuleDef = getNgModuleDef(moduleType, true);
|
25867 | }
|
25868 | const errors = [];
|
25869 | const declarations = maybeUnwrapFn(ngModuleDef.declarations);
|
25870 | const imports = maybeUnwrapFn(ngModuleDef.imports);
|
25871 | flatten(imports).map(unwrapModuleWithProvidersImports).forEach(mod => {
|
25872 | verifySemanticsOfNgModuleImport(mod, moduleType);
|
25873 | verifySemanticsOfNgModuleDef(mod, false, moduleType);
|
25874 | });
|
25875 | const exports = maybeUnwrapFn(ngModuleDef.exports);
|
25876 | declarations.forEach(verifyDeclarationsHaveDefinitions);
|
25877 | declarations.forEach(verifyDirectivesHaveSelector);
|
25878 | const combinedDeclarations = [
|
25879 | ...declarations.map(resolveForwardRef),
|
25880 | ...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef),
|
25881 | ];
|
25882 | exports.forEach(verifyExportsAreDeclaredOrReExported);
|
25883 | declarations.forEach(decl => verifyDeclarationIsUnique(decl, allowDuplicateDeclarationsInRoot));
|
25884 | declarations.forEach(verifyComponentEntryComponentsIsPartOfNgModule);
|
25885 | const ngModule = getAnnotation(moduleType, 'NgModule');
|
25886 | if (ngModule) {
|
25887 | ngModule.imports &&
|
25888 | flatten(ngModule.imports).map(unwrapModuleWithProvidersImports).forEach(mod => {
|
25889 | verifySemanticsOfNgModuleImport(mod, moduleType);
|
25890 | verifySemanticsOfNgModuleDef(mod, false, moduleType);
|
25891 | });
|
25892 | ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyCorrectBootstrapType);
|
25893 | ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyComponentIsPartOfNgModule);
|
25894 | ngModule.entryComponents &&
|
25895 | deepForEach(ngModule.entryComponents, verifyComponentIsPartOfNgModule);
|
25896 | }
|
25897 |
|
25898 | if (errors.length) {
|
25899 | throw new Error(errors.join('\n'));
|
25900 | }
|
25901 |
|
25902 | function verifyDeclarationsHaveDefinitions(type) {
|
25903 | type = resolveForwardRef(type);
|
25904 | const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type);
|
25905 | if (!def) {
|
25906 | errors.push(`Unexpected value '${stringifyForError(type)}' declared by the module '${stringifyForError(moduleType)}'. Please add a @Pipe/@Directive/@Component annotation.`);
|
25907 | }
|
25908 | }
|
25909 | function verifyDirectivesHaveSelector(type) {
|
25910 | type = resolveForwardRef(type);
|
25911 | const def = getDirectiveDef(type);
|
25912 | if (!getComponentDef(type) && def && def.selectors.length == 0) {
|
25913 | errors.push(`Directive ${stringifyForError(type)} has no selector, please add it!`);
|
25914 | }
|
25915 | }
|
25916 | function verifyExportsAreDeclaredOrReExported(type) {
|
25917 | type = resolveForwardRef(type);
|
25918 | const kind = getComponentDef(type) && 'component' || getDirectiveDef(type) && 'directive' ||
|
25919 | getPipeDef(type) && 'pipe';
|
25920 | if (kind) {
|
25921 |
|
25922 |
|
25923 | if (combinedDeclarations.lastIndexOf(type) === -1) {
|
25924 |
|
25925 | errors.push(`Can't export ${kind} ${stringifyForError(type)} from ${stringifyForError(moduleType)} as it was neither declared nor imported!`);
|
25926 | }
|
25927 | }
|
25928 | }
|
25929 | function verifyDeclarationIsUnique(type, suppressErrors) {
|
25930 | type = resolveForwardRef(type);
|
25931 | const existingModule = ownerNgModule.get(type);
|
25932 | if (existingModule && existingModule !== moduleType) {
|
25933 | if (!suppressErrors) {
|
25934 | const modules = [existingModule, moduleType].map(stringifyForError).sort();
|
25935 | errors.push(`Type ${stringifyForError(type)} is part of the declarations of 2 modules: ${modules[0]} and ${modules[1]}! ` +
|
25936 | `Please consider moving ${stringifyForError(type)} to a higher module that imports ${modules[0]} and ${modules[1]}. ` +
|
25937 | `You can also create a new NgModule that exports and includes ${stringifyForError(type)} then import that NgModule in ${modules[0]} and ${modules[1]}.`);
|
25938 | }
|
25939 | }
|
25940 | else {
|
25941 |
|
25942 | ownerNgModule.set(type, moduleType);
|
25943 | }
|
25944 | }
|
25945 | function verifyComponentIsPartOfNgModule(type) {
|
25946 | type = resolveForwardRef(type);
|
25947 | const existingModule = ownerNgModule.get(type);
|
25948 | if (!existingModule) {
|
25949 | errors.push(`Component ${stringifyForError(type)} is not part of any NgModule or the module has not been imported into your module.`);
|
25950 | }
|
25951 | }
|
25952 | function verifyCorrectBootstrapType(type) {
|
25953 | type = resolveForwardRef(type);
|
25954 | if (!getComponentDef(type)) {
|
25955 | errors.push(`${stringifyForError(type)} cannot be used as an entry component.`);
|
25956 | }
|
25957 | }
|
25958 | function verifyComponentEntryComponentsIsPartOfNgModule(type) {
|
25959 | type = resolveForwardRef(type);
|
25960 | if (getComponentDef(type)) {
|
25961 |
|
25962 | const component = getAnnotation(type, 'Component');
|
25963 | if (component && component.entryComponents) {
|
25964 | deepForEach(component.entryComponents, verifyComponentIsPartOfNgModule);
|
25965 | }
|
25966 | }
|
25967 | }
|
25968 | function verifySemanticsOfNgModuleImport(type, importingModule) {
|
25969 | type = resolveForwardRef(type);
|
25970 | if (getComponentDef(type) || getDirectiveDef(type)) {
|
25971 | throw new Error(`Unexpected directive '${type.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
|
25972 | }
|
25973 | if (getPipeDef(type)) {
|
25974 | throw new Error(`Unexpected pipe '${type.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
|
25975 | }
|
25976 | }
|
25977 | }
|
25978 | function unwrapModuleWithProvidersImports(typeOrWithProviders) {
|
25979 | typeOrWithProviders = resolveForwardRef(typeOrWithProviders);
|
25980 | return typeOrWithProviders.ngModule || typeOrWithProviders;
|
25981 | }
|
25982 | function getAnnotation(type, name) {
|
25983 | let annotation = null;
|
25984 | collect(type.__annotations__);
|
25985 | collect(type.decorators);
|
25986 | return annotation;
|
25987 | function collect(annotations) {
|
25988 | if (annotations) {
|
25989 | annotations.forEach(readAnnotation);
|
25990 | }
|
25991 | }
|
25992 | function readAnnotation(decorator) {
|
25993 | if (!annotation) {
|
25994 | const proto = Object.getPrototypeOf(decorator);
|
25995 | if (proto.ngMetadataName == name) {
|
25996 | annotation = decorator;
|
25997 | }
|
25998 | else if (decorator.type) {
|
25999 | const proto = Object.getPrototypeOf(decorator.type);
|
26000 | if (proto.ngMetadataName == name) {
|
26001 | annotation = decorator.args[0];
|
26002 | }
|
26003 | }
|
26004 | }
|
26005 | }
|
26006 | }
|
26007 |
|
26008 |
|
26009 |
|
26010 |
|
26011 |
|
26012 |
|
26013 | let ownerNgModule = new Map();
|
26014 | let verifiedNgModule = new Map();
|
26015 | function resetCompiledComponents() {
|
26016 | ownerNgModule = new Map();
|
26017 | verifiedNgModule = new Map();
|
26018 | moduleQueue.length = 0;
|
26019 | }
|
26020 |
|
26021 |
|
26022 |
|
26023 |
|
26024 |
|
26025 | function computeCombinedExports(type) {
|
26026 | type = resolveForwardRef(type);
|
26027 | const ngModuleDef = getNgModuleDef(type, true);
|
26028 | return [...flatten(maybeUnwrapFn(ngModuleDef.exports).map((type) => {
|
26029 | const ngModuleDef = getNgModuleDef(type);
|
26030 | if (ngModuleDef) {
|
26031 | verifySemanticsOfNgModuleDef(type, false);
|
26032 | return computeCombinedExports(type);
|
26033 | }
|
26034 | else {
|
26035 | return type;
|
26036 | }
|
26037 | }))];
|
26038 | }
|
26039 |
|
26040 |
|
26041 |
|
26042 |
|
26043 |
|
26044 | function setScopeOnDeclaredComponents(moduleType, ngModule) {
|
26045 | const declarations = flatten(ngModule.declarations || EMPTY_ARRAY$5);
|
26046 | const transitiveScopes = transitiveScopesFor(moduleType);
|
26047 | declarations.forEach(declaration => {
|
26048 | if (declaration.hasOwnProperty(NG_COMP_DEF)) {
|
26049 |
|
26050 | const component = declaration;
|
26051 | const componentDef = getComponentDef(component);
|
26052 | patchComponentDefWithScope(componentDef, transitiveScopes);
|
26053 | }
|
26054 | else if (!declaration.hasOwnProperty(NG_DIR_DEF) && !declaration.hasOwnProperty(NG_PIPE_DEF)) {
|
26055 |
|
26056 | declaration.ngSelectorScope = moduleType;
|
26057 | }
|
26058 | });
|
26059 | }
|
26060 |
|
26061 |
|
26062 |
|
26063 |
|
26064 | function patchComponentDefWithScope(componentDef, transitiveScopes) {
|
26065 | componentDef.directiveDefs = () => Array.from(transitiveScopes.compilation.directives)
|
26066 | .map(dir => dir.hasOwnProperty(NG_COMP_DEF) ? getComponentDef(dir) : getDirectiveDef(dir))
|
26067 | .filter(def => !!def);
|
26068 | componentDef.pipeDefs = () => Array.from(transitiveScopes.compilation.pipes).map(pipe => getPipeDef(pipe));
|
26069 | componentDef.schemas = transitiveScopes.schemas;
|
26070 |
|
26071 |
|
26072 |
|
26073 |
|
26074 | componentDef.tView = null;
|
26075 | }
|
26076 |
|
26077 |
|
26078 |
|
26079 |
|
26080 |
|
26081 |
|
26082 |
|
26083 |
|
26084 |
|
26085 | function transitiveScopesFor(moduleType) {
|
26086 | if (!isNgModule(moduleType)) {
|
26087 | throw new Error(`${moduleType.name} does not have a module def (ɵmod property)`);
|
26088 | }
|
26089 | const def = getNgModuleDef(moduleType);
|
26090 | if (def.transitiveCompileScopes !== null) {
|
26091 | return def.transitiveCompileScopes;
|
26092 | }
|
26093 | const scopes = {
|
26094 | schemas: def.schemas || null,
|
26095 | compilation: {
|
26096 | directives: new Set(),
|
26097 | pipes: new Set(),
|
26098 | },
|
26099 | exported: {
|
26100 | directives: new Set(),
|
26101 | pipes: new Set(),
|
26102 | },
|
26103 | };
|
26104 | maybeUnwrapFn(def.imports).forEach((imported) => {
|
26105 | const importedType = imported;
|
26106 | if (!isNgModule(importedType)) {
|
26107 | throw new Error(`Importing ${importedType.name} which does not have a ɵmod property`);
|
26108 | }
|
26109 |
|
26110 |
|
26111 | const importedScope = transitiveScopesFor(importedType);
|
26112 | importedScope.exported.directives.forEach(entry => scopes.compilation.directives.add(entry));
|
26113 | importedScope.exported.pipes.forEach(entry => scopes.compilation.pipes.add(entry));
|
26114 | });
|
26115 | maybeUnwrapFn(def.declarations).forEach(declared => {
|
26116 | const declaredWithDefs = declared;
|
26117 | if (getPipeDef(declaredWithDefs)) {
|
26118 | scopes.compilation.pipes.add(declared);
|
26119 | }
|
26120 | else {
|
26121 |
|
26122 |
|
26123 |
|
26124 | scopes.compilation.directives.add(declared);
|
26125 | }
|
26126 | });
|
26127 | maybeUnwrapFn(def.exports).forEach((exported) => {
|
26128 | const exportedType = exported;
|
26129 |
|
26130 |
|
26131 | if (isNgModule(exportedType)) {
|
26132 |
|
26133 |
|
26134 | const exportedScope = transitiveScopesFor(exportedType);
|
26135 | exportedScope.exported.directives.forEach(entry => {
|
26136 | scopes.compilation.directives.add(entry);
|
26137 | scopes.exported.directives.add(entry);
|
26138 | });
|
26139 | exportedScope.exported.pipes.forEach(entry => {
|
26140 | scopes.compilation.pipes.add(entry);
|
26141 | scopes.exported.pipes.add(entry);
|
26142 | });
|
26143 | }
|
26144 | else if (getPipeDef(exportedType)) {
|
26145 | scopes.exported.pipes.add(exportedType);
|
26146 | }
|
26147 | else {
|
26148 | scopes.exported.directives.add(exportedType);
|
26149 | }
|
26150 | });
|
26151 | def.transitiveCompileScopes = scopes;
|
26152 | return scopes;
|
26153 | }
|
26154 | function expandModuleWithProviders(value) {
|
26155 | if (isModuleWithProviders(value)) {
|
26156 | return value.ngModule;
|
26157 | }
|
26158 | return value;
|
26159 | }
|
26160 | function isModuleWithProviders(value) {
|
26161 | return value.ngModule !== undefined;
|
26162 | }
|
26163 | function isNgModule(value) {
|
26164 | return !!getNgModuleDef(value);
|
26165 | }
|
26166 |
|
26167 |
|
26168 |
|
26169 |
|
26170 |
|
26171 |
|
26172 |
|
26173 |
|
26174 |
|
26175 |
|
26176 |
|
26177 |
|
26178 |
|
26179 |
|
26180 |
|
26181 |
|
26182 |
|
26183 |
|
26184 |
|
26185 |
|
26186 |
|
26187 | let compilationDepth = 0;
|
26188 |
|
26189 |
|
26190 |
|
26191 |
|
26192 |
|
26193 |
|
26194 |
|
26195 |
|
26196 |
|
26197 | function compileComponent(type, metadata) {
|
26198 |
|
26199 |
|
26200 | (typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();
|
26201 | let ngComponentDef = null;
|
26202 |
|
26203 | maybeQueueResolutionOfComponentResources(type, metadata);
|
26204 |
|
26205 |
|
26206 |
|
26207 | addDirectiveFactoryDef(type, metadata);
|
26208 | Object.defineProperty(type, NG_COMP_DEF, {
|
26209 | get: () => {
|
26210 | if (ngComponentDef === null) {
|
26211 | const compiler = getCompilerFacade();
|
26212 | if (componentNeedsResolution(metadata)) {
|
26213 | const error = [`Component '${type.name}' is not resolved:`];
|
26214 | if (metadata.templateUrl) {
|
26215 | error.push(` - templateUrl: ${metadata.templateUrl}`);
|
26216 | }
|
26217 | if (metadata.styleUrls && metadata.styleUrls.length) {
|
26218 | error.push(` - styleUrls: ${JSON.stringify(metadata.styleUrls)}`);
|
26219 | }
|
26220 | error.push(`Did you run and wait for 'resolveComponentResources()'?`);
|
26221 | throw new Error(error.join('\n'));
|
26222 | }
|
26223 |
|
26224 |
|
26225 |
|
26226 |
|
26227 | const options = getJitOptions();
|
26228 | let preserveWhitespaces = metadata.preserveWhitespaces;
|
26229 | if (preserveWhitespaces === undefined) {
|
26230 | if (options !== null && options.preserveWhitespaces !== undefined) {
|
26231 | preserveWhitespaces = options.preserveWhitespaces;
|
26232 | }
|
26233 | else {
|
26234 | preserveWhitespaces = false;
|
26235 | }
|
26236 | }
|
26237 | let encapsulation = metadata.encapsulation;
|
26238 | if (encapsulation === undefined) {
|
26239 | if (options !== null && options.defaultEncapsulation !== undefined) {
|
26240 | encapsulation = options.defaultEncapsulation;
|
26241 | }
|
26242 | else {
|
26243 | encapsulation = ViewEncapsulation$1.Emulated;
|
26244 | }
|
26245 | }
|
26246 | const templateUrl = metadata.templateUrl || `ng:///${type.name}/template.html`;
|
26247 | const meta = Object.assign(Object.assign({}, directiveMetadata(type, metadata)), { typeSourceSpan: compiler.createParseSourceSpan('Component', type.name, templateUrl), template: metadata.template || '', preserveWhitespaces, styles: metadata.styles || EMPTY_ARRAY, animations: metadata.animations, directives: [], changeDetection: metadata.changeDetection, pipes: new Map(), encapsulation, interpolation: metadata.interpolation, viewProviders: metadata.viewProviders || null });
|
26248 | compilationDepth++;
|
26249 | try {
|
26250 | if (meta.usesInheritance) {
|
26251 | addDirectiveDefToUndecoratedParents(type);
|
26252 | }
|
26253 | ngComponentDef = compiler.compileComponent(angularCoreEnv, templateUrl, meta);
|
26254 | }
|
26255 | finally {
|
26256 |
|
26257 | compilationDepth--;
|
26258 | }
|
26259 | if (compilationDepth === 0) {
|
26260 |
|
26261 |
|
26262 |
|
26263 |
|
26264 |
|
26265 | flushModuleScopingQueueAsMuchAsPossible();
|
26266 | }
|
26267 |
|
26268 |
|
26269 |
|
26270 |
|
26271 | if (hasSelectorScope(type)) {
|
26272 | const scopes = transitiveScopesFor(type.ngSelectorScope);
|
26273 | patchComponentDefWithScope(ngComponentDef, scopes);
|
26274 | }
|
26275 | }
|
26276 | return ngComponentDef;
|
26277 | },
|
26278 |
|
26279 | configurable: !!ngDevMode,
|
26280 | });
|
26281 | }
|
26282 | function hasSelectorScope(component) {
|
26283 | return component.ngSelectorScope !== undefined;
|
26284 | }
|
26285 |
|
26286 |
|
26287 |
|
26288 |
|
26289 |
|
26290 |
|
26291 |
|
26292 | function compileDirective(type, directive) {
|
26293 | let ngDirectiveDef = null;
|
26294 | addDirectiveFactoryDef(type, directive || {});
|
26295 | Object.defineProperty(type, NG_DIR_DEF, {
|
26296 | get: () => {
|
26297 | if (ngDirectiveDef === null) {
|
26298 |
|
26299 |
|
26300 |
|
26301 | const meta = getDirectiveMetadata(type, directive || {});
|
26302 | ngDirectiveDef =
|
26303 | getCompilerFacade().compileDirective(angularCoreEnv, meta.sourceMapUrl, meta.metadata);
|
26304 | }
|
26305 | return ngDirectiveDef;
|
26306 | },
|
26307 |
|
26308 | configurable: !!ngDevMode,
|
26309 | });
|
26310 | }
|
26311 | function getDirectiveMetadata(type, metadata) {
|
26312 | const name = type && type.name;
|
26313 | const sourceMapUrl = `ng:///${name}/ɵdir.js`;
|
26314 | const compiler = getCompilerFacade();
|
26315 | const facade = directiveMetadata(type, metadata);
|
26316 | facade.typeSourceSpan = compiler.createParseSourceSpan('Directive', name, sourceMapUrl);
|
26317 | if (facade.usesInheritance) {
|
26318 | addDirectiveDefToUndecoratedParents(type);
|
26319 | }
|
26320 | return { metadata: facade, sourceMapUrl };
|
26321 | }
|
26322 | function addDirectiveFactoryDef(type, metadata) {
|
26323 | let ngFactoryDef = null;
|
26324 | Object.defineProperty(type, NG_FACTORY_DEF, {
|
26325 | get: () => {
|
26326 | if (ngFactoryDef === null) {
|
26327 | const meta = getDirectiveMetadata(type, metadata);
|
26328 | const compiler = getCompilerFacade();
|
26329 | ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${type.name}/ɵfac.js`, Object.assign(Object.assign({}, meta.metadata), { injectFn: 'directiveInject', target: compiler.R3FactoryTarget.Directive }));
|
26330 | }
|
26331 | return ngFactoryDef;
|
26332 | },
|
26333 |
|
26334 | configurable: !!ngDevMode,
|
26335 | });
|
26336 | }
|
26337 | function extendsDirectlyFromObject(type) {
|
26338 | return Object.getPrototypeOf(type.prototype) === Object.prototype;
|
26339 | }
|
26340 |
|
26341 |
|
26342 |
|
26343 |
|
26344 | function directiveMetadata(type, metadata) {
|
26345 |
|
26346 | const reflect = getReflect();
|
26347 | const propMetadata = reflect.ownPropMetadata(type);
|
26348 | return {
|
26349 | name: type.name,
|
26350 | type: type,
|
26351 | typeArgumentCount: 0,
|
26352 | selector: metadata.selector !== undefined ? metadata.selector : null,
|
26353 | deps: reflectDependencies(type),
|
26354 | host: metadata.host || EMPTY_OBJ,
|
26355 | propMetadata: propMetadata,
|
26356 | inputs: metadata.inputs || EMPTY_ARRAY,
|
26357 | outputs: metadata.outputs || EMPTY_ARRAY,
|
26358 | queries: extractQueriesMetadata(type, propMetadata, isContentQuery),
|
26359 | lifecycle: { usesOnChanges: reflect.hasLifecycleHook(type, 'ngOnChanges') },
|
26360 | typeSourceSpan: null,
|
26361 | usesInheritance: !extendsDirectlyFromObject(type),
|
26362 | exportAs: extractExportAs(metadata.exportAs),
|
26363 | providers: metadata.providers || null,
|
26364 | viewQueries: extractQueriesMetadata(type, propMetadata, isViewQuery)
|
26365 | };
|
26366 | }
|
26367 |
|
26368 |
|
26369 |
|
26370 | function addDirectiveDefToUndecoratedParents(type) {
|
26371 | const objPrototype = Object.prototype;
|
26372 | let parent = Object.getPrototypeOf(type.prototype).constructor;
|
26373 |
|
26374 | while (parent && parent !== objPrototype) {
|
26375 |
|
26376 |
|
26377 | if (!getDirectiveDef(parent) && !getComponentDef(parent) &&
|
26378 | shouldAddAbstractDirective(parent)) {
|
26379 | compileDirective(parent, null);
|
26380 | }
|
26381 | parent = Object.getPrototypeOf(parent);
|
26382 | }
|
26383 | }
|
26384 | function convertToR3QueryPredicate(selector) {
|
26385 | return typeof selector === 'string' ? splitByComma(selector) : resolveForwardRef(selector);
|
26386 | }
|
26387 | function convertToR3QueryMetadata(propertyName, ann) {
|
26388 | return {
|
26389 | propertyName: propertyName,
|
26390 | predicate: convertToR3QueryPredicate(ann.selector),
|
26391 | descendants: ann.descendants,
|
26392 | first: ann.first,
|
26393 | read: ann.read ? ann.read : null,
|
26394 | static: !!ann.static
|
26395 | };
|
26396 | }
|
26397 | function extractQueriesMetadata(type, propMetadata, isQueryAnn) {
|
26398 | const queriesMeta = [];
|
26399 | for (const field in propMetadata) {
|
26400 | if (propMetadata.hasOwnProperty(field)) {
|
26401 | const annotations = propMetadata[field];
|
26402 | annotations.forEach(ann => {
|
26403 | if (isQueryAnn(ann)) {
|
26404 | if (!ann.selector) {
|
26405 | throw new Error(`Can't construct a query for the property "${field}" of ` +
|
26406 | `"${stringifyForError(type)}" since the query selector wasn't defined.`);
|
26407 | }
|
26408 | if (annotations.some(isInputAnnotation)) {
|
26409 | throw new Error(`Cannot combine @Input decorators with query decorators`);
|
26410 | }
|
26411 | queriesMeta.push(convertToR3QueryMetadata(field, ann));
|
26412 | }
|
26413 | });
|
26414 | }
|
26415 | }
|
26416 | return queriesMeta;
|
26417 | }
|
26418 | function extractExportAs(exportAs) {
|
26419 | return exportAs === undefined ? null : splitByComma(exportAs);
|
26420 | }
|
26421 | function isContentQuery(value) {
|
26422 | const name = value.ngMetadataName;
|
26423 | return name === 'ContentChild' || name === 'ContentChildren';
|
26424 | }
|
26425 | function isViewQuery(value) {
|
26426 | const name = value.ngMetadataName;
|
26427 | return name === 'ViewChild' || name === 'ViewChildren';
|
26428 | }
|
26429 | function isInputAnnotation(value) {
|
26430 | return value.ngMetadataName === 'Input';
|
26431 | }
|
26432 | function splitByComma(value) {
|
26433 | return value.split(',').map(piece => piece.trim());
|
26434 | }
|
26435 | const LIFECYCLE_HOOKS = [
|
26436 | 'ngOnChanges', 'ngOnInit', 'ngOnDestroy', 'ngDoCheck', 'ngAfterViewInit', 'ngAfterViewChecked',
|
26437 | 'ngAfterContentInit', 'ngAfterContentChecked'
|
26438 | ];
|
26439 | function shouldAddAbstractDirective(type) {
|
26440 | const reflect = getReflect();
|
26441 | if (LIFECYCLE_HOOKS.some(hookName => reflect.hasLifecycleHook(type, hookName))) {
|
26442 | return true;
|
26443 | }
|
26444 | const propMetadata = reflect.propMetadata(type);
|
26445 | for (const field in propMetadata) {
|
26446 | const annotations = propMetadata[field];
|
26447 | for (let i = 0; i < annotations.length; i++) {
|
26448 | const current = annotations[i];
|
26449 | const metadataName = current.ngMetadataName;
|
26450 | if (isInputAnnotation(current) || isContentQuery(current) || isViewQuery(current) ||
|
26451 | metadataName === 'Output' || metadataName === 'HostBinding' ||
|
26452 | metadataName === 'HostListener') {
|
26453 | return true;
|
26454 | }
|
26455 | }
|
26456 | }
|
26457 | return false;
|
26458 | }
|
26459 |
|
26460 |
|
26461 |
|
26462 |
|
26463 |
|
26464 |
|
26465 |
|
26466 |
|
26467 | function compilePipe(type, meta) {
|
26468 | let ngPipeDef = null;
|
26469 | let ngFactoryDef = null;
|
26470 | Object.defineProperty(type, NG_FACTORY_DEF, {
|
26471 | get: () => {
|
26472 | if (ngFactoryDef === null) {
|
26473 | const metadata = getPipeMetadata(type, meta);
|
26474 | const compiler = getCompilerFacade();
|
26475 | ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${metadata.name}/ɵfac.js`, Object.assign(Object.assign({}, metadata), { injectFn: 'directiveInject', target: compiler.R3FactoryTarget.Pipe }));
|
26476 | }
|
26477 | return ngFactoryDef;
|
26478 | },
|
26479 |
|
26480 | configurable: !!ngDevMode,
|
26481 | });
|
26482 | Object.defineProperty(type, NG_PIPE_DEF, {
|
26483 | get: () => {
|
26484 | if (ngPipeDef === null) {
|
26485 | const metadata = getPipeMetadata(type, meta);
|
26486 | ngPipeDef = getCompilerFacade().compilePipe(angularCoreEnv, `ng:///${metadata.name}/ɵpipe.js`, metadata);
|
26487 | }
|
26488 | return ngPipeDef;
|
26489 | },
|
26490 |
|
26491 | configurable: !!ngDevMode,
|
26492 | });
|
26493 | }
|
26494 | function getPipeMetadata(type, meta) {
|
26495 | return {
|
26496 | type: type,
|
26497 | typeArgumentCount: 0,
|
26498 | name: type.name,
|
26499 | deps: reflectDependencies(type),
|
26500 | pipeName: meta.name,
|
26501 | pure: meta.pure !== undefined ? meta.pure : true
|
26502 | };
|
26503 | }
|
26504 |
|
26505 |
|
26506 |
|
26507 |
|
26508 |
|
26509 |
|
26510 |
|
26511 |
|
26512 | const ɵ0$e = (dir = {}) => dir, ɵ1$3 = (type, meta) => SWITCH_COMPILE_DIRECTIVE(type, meta);
|
26513 |
|
26514 |
|
26515 |
|
26516 |
|
26517 |
|
26518 | const Directive = makeDecorator('Directive', ɵ0$e, undefined, undefined, ɵ1$3);
|
26519 | const ɵ2$1 = (c = {}) => (Object.assign({ changeDetection: ChangeDetectionStrategy.Default }, c)), ɵ3$1 = (type, meta) => SWITCH_COMPILE_COMPONENT(type, meta);
|
26520 |
|
26521 |
|
26522 |
|
26523 |
|
26524 |
|
26525 |
|
26526 | const Component = makeDecorator('Component', ɵ2$1, Directive, undefined, ɵ3$1);
|
26527 | const ɵ4 = (p) => (Object.assign({ pure: true }, p)), ɵ5 = (type, meta) => SWITCH_COMPILE_PIPE(type, meta);
|
26528 |
|
26529 |
|
26530 |
|
26531 |
|
26532 | const Pipe = makeDecorator('Pipe', ɵ4, undefined, undefined, ɵ5);
|
26533 | const ɵ6 = (bindingPropertyName) => ({ bindingPropertyName });
|
26534 |
|
26535 |
|
26536 |
|
26537 |
|
26538 | const Input = makePropDecorator('Input', ɵ6);
|
26539 | const ɵ7 = (bindingPropertyName) => ({ bindingPropertyName });
|
26540 |
|
26541 |
|
26542 |
|
26543 |
|
26544 | const Output = makePropDecorator('Output', ɵ7);
|
26545 | const ɵ8 = (hostPropertyName) => ({ hostPropertyName });
|
26546 |
|
26547 |
|
26548 |
|
26549 |
|
26550 | const HostBinding = makePropDecorator('HostBinding', ɵ8);
|
26551 | const ɵ9 = (eventName, args) => ({ eventName, args });
|
26552 |
|
26553 |
|
26554 |
|
26555 |
|
26556 |
|
26557 |
|
26558 |
|
26559 |
|
26560 |
|
26561 |
|
26562 |
|
26563 |
|
26564 |
|
26565 |
|
26566 |
|
26567 |
|
26568 |
|
26569 |
|
26570 |
|
26571 |
|
26572 |
|
26573 |
|
26574 |
|
26575 |
|
26576 |
|
26577 |
|
26578 |
|
26579 |
|
26580 |
|
26581 |
|
26582 |
|
26583 |
|
26584 |
|
26585 |
|
26586 |
|
26587 |
|
26588 |
|
26589 |
|
26590 |
|
26591 |
|
26592 |
|
26593 |
|
26594 |
|
26595 |
|
26596 |
|
26597 |
|
26598 |
|
26599 |
|
26600 |
|
26601 |
|
26602 |
|
26603 |
|
26604 |
|
26605 |
|
26606 |
|
26607 |
|
26608 | const HostListener = makePropDecorator('HostListener', ɵ9);
|
26609 | const SWITCH_COMPILE_COMPONENT__POST_R3__ = compileComponent;
|
26610 | const SWITCH_COMPILE_DIRECTIVE__POST_R3__ = compileDirective;
|
26611 | const SWITCH_COMPILE_PIPE__POST_R3__ = compilePipe;
|
26612 | const SWITCH_COMPILE_COMPONENT__PRE_R3__ = noop;
|
26613 | const SWITCH_COMPILE_DIRECTIVE__PRE_R3__ = noop;
|
26614 | const SWITCH_COMPILE_PIPE__PRE_R3__ = noop;
|
26615 | const SWITCH_COMPILE_COMPONENT = SWITCH_COMPILE_COMPONENT__PRE_R3__;
|
26616 | const SWITCH_COMPILE_DIRECTIVE = SWITCH_COMPILE_DIRECTIVE__PRE_R3__;
|
26617 | const SWITCH_COMPILE_PIPE = SWITCH_COMPILE_PIPE__PRE_R3__;
|
26618 |
|
26619 |
|
26620 |
|
26621 |
|
26622 |
|
26623 |
|
26624 |
|
26625 |
|
26626 | const ɵ0$f = (ngModule) => ngModule, ɵ1$4 =
|
26627 |
|
26628 |
|
26629 |
|
26630 |
|
26631 |
|
26632 |
|
26633 |
|
26634 |
|
26635 |
|
26636 |
|
26637 |
|
26638 | (type, meta) => SWITCH_COMPILE_NGMODULE(type, meta);
|
26639 |
|
26640 |
|
26641 |
|
26642 |
|
26643 | const NgModule = makeDecorator('NgModule', ɵ0$f, undefined, undefined, ɵ1$4);
|
26644 | function preR3NgModuleCompile(moduleType, metadata) {
|
26645 | let imports = (metadata && metadata.imports) || [];
|
26646 | if (metadata && metadata.exports) {
|
26647 | imports = [...imports, metadata.exports];
|
26648 | }
|
26649 | moduleType.ɵinj = ɵɵdefineInjector({
|
26650 | factory: convertInjectableProviderToFactory(moduleType, { useClass: moduleType }),
|
26651 | providers: metadata && metadata.providers,
|
26652 | imports: imports,
|
26653 | });
|
26654 | }
|
26655 | const SWITCH_COMPILE_NGMODULE__POST_R3__ = compileNgModule;
|
26656 | const SWITCH_COMPILE_NGMODULE__PRE_R3__ = preR3NgModuleCompile;
|
26657 | const SWITCH_COMPILE_NGMODULE = SWITCH_COMPILE_NGMODULE__PRE_R3__;
|
26658 |
|
26659 |
|
26660 |
|
26661 |
|
26662 |
|
26663 |
|
26664 |
|
26665 |
|
26666 |
|
26667 |
|
26668 |
|
26669 |
|
26670 |
|
26671 |
|
26672 |
|
26673 |
|
26674 |
|
26675 |
|
26676 |
|
26677 |
|
26678 |
|
26679 |
|
26680 |
|
26681 |
|
26682 |
|
26683 |
|
26684 |
|
26685 |
|
26686 |
|
26687 |
|
26688 |
|
26689 |
|
26690 |
|
26691 |
|
26692 |
|
26693 |
|
26694 |
|
26695 |
|
26696 |
|
26697 |
|
26698 |
|
26699 | const APP_INITIALIZER = new InjectionToken('Application Initializer');
|
26700 |
|
26701 |
|
26702 |
|
26703 |
|
26704 |
|
26705 | class ApplicationInitStatus {
|
26706 | constructor(appInits) {
|
26707 | this.appInits = appInits;
|
26708 | this.initialized = false;
|
26709 | this.done = false;
|
26710 | this.donePromise = new Promise((res, rej) => {
|
26711 | this.resolve = res;
|
26712 | this.reject = rej;
|
26713 | });
|
26714 | }
|
26715 |
|
26716 | runInitializers() {
|
26717 | if (this.initialized) {
|
26718 | return;
|
26719 | }
|
26720 | const asyncInitPromises = [];
|
26721 | const complete = () => {
|
26722 | this.done = true;
|
26723 | this.resolve();
|
26724 | };
|
26725 | if (this.appInits) {
|
26726 | for (let i = 0; i < this.appInits.length; i++) {
|
26727 | const initResult = this.appInits[i]();
|
26728 | if (isPromise(initResult)) {
|
26729 | asyncInitPromises.push(initResult);
|
26730 | }
|
26731 | }
|
26732 | }
|
26733 | Promise.all(asyncInitPromises)
|
26734 | .then(() => {
|
26735 | complete();
|
26736 | })
|
26737 | .catch(e => {
|
26738 | this.reject(e);
|
26739 | });
|
26740 | if (asyncInitPromises.length === 0) {
|
26741 | complete();
|
26742 | }
|
26743 | this.initialized = true;
|
26744 | }
|
26745 | }
|
26746 | ApplicationInitStatus.decorators = [
|
26747 | { type: Injectable }
|
26748 | ];
|
26749 | ApplicationInitStatus.ctorParameters = () => [
|
26750 | { type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional }] }
|
26751 | ];
|
26752 |
|
26753 |
|
26754 |
|
26755 |
|
26756 |
|
26757 |
|
26758 |
|
26759 |
|
26760 |
|
26761 |
|
26762 |
|
26763 |
|
26764 |
|
26765 |
|
26766 |
|
26767 |
|
26768 |
|
26769 |
|
26770 |
|
26771 | const APP_ID = new InjectionToken('AppId');
|
26772 | function _appIdRandomProviderFactory() {
|
26773 | return `${_randomChar()}${_randomChar()}${_randomChar()}`;
|
26774 | }
|
26775 |
|
26776 |
|
26777 |
|
26778 |
|
26779 | const APP_ID_RANDOM_PROVIDER = {
|
26780 | provide: APP_ID,
|
26781 | useFactory: _appIdRandomProviderFactory,
|
26782 | deps: [],
|
26783 | };
|
26784 | function _randomChar() {
|
26785 | return String.fromCharCode(97 + Math.floor(Math.random() * 25));
|
26786 | }
|
26787 |
|
26788 |
|
26789 |
|
26790 |
|
26791 | const PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
|
26792 |
|
26793 |
|
26794 |
|
26795 |
|
26796 | const PLATFORM_ID = new InjectionToken('Platform ID');
|
26797 |
|
26798 |
|
26799 |
|
26800 |
|
26801 |
|
26802 |
|
26803 |
|
26804 |
|
26805 |
|
26806 |
|
26807 | const APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
|
26808 |
|
26809 |
|
26810 |
|
26811 |
|
26812 |
|
26813 | const PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
|
26814 |
|
26815 |
|
26816 |
|
26817 |
|
26818 |
|
26819 |
|
26820 |
|
26821 |
|
26822 | class Console {
|
26823 | log(message) {
|
26824 |
|
26825 | console.log(message);
|
26826 | }
|
26827 |
|
26828 | warn(message) {
|
26829 |
|
26830 | console.warn(message);
|
26831 | }
|
26832 | }
|
26833 | Console.decorators = [
|
26834 | { type: Injectable }
|
26835 | ];
|
26836 |
|
26837 |
|
26838 |
|
26839 |
|
26840 |
|
26841 |
|
26842 |
|
26843 |
|
26844 |
|
26845 |
|
26846 |
|
26847 |
|
26848 |
|
26849 |
|
26850 |
|
26851 |
|
26852 |
|
26853 |
|
26854 |
|
26855 |
|
26856 |
|
26857 |
|
26858 |
|
26859 |
|
26860 |
|
26861 |
|
26862 |
|
26863 |
|
26864 |
|
26865 |
|
26866 | const LOCALE_ID$1 = new InjectionToken('LocaleId');
|
26867 |
|
26868 |
|
26869 |
|
26870 |
|
26871 |
|
26872 |
|
26873 |
|
26874 |
|
26875 |
|
26876 |
|
26877 |
|
26878 |
|
26879 |
|
26880 |
|
26881 |
|
26882 |
|
26883 |
|
26884 |
|
26885 |
|
26886 |
|
26887 |
|
26888 |
|
26889 |
|
26890 |
|
26891 |
|
26892 |
|
26893 |
|
26894 |
|
26895 |
|
26896 |
|
26897 |
|
26898 |
|
26899 |
|
26900 |
|
26901 |
|
26902 |
|
26903 |
|
26904 |
|
26905 | const DEFAULT_CURRENCY_CODE = new InjectionToken('DefaultCurrencyCode');
|
26906 |
|
26907 |
|
26908 |
|
26909 |
|
26910 |
|
26911 |
|
26912 |
|
26913 |
|
26914 |
|
26915 |
|
26916 |
|
26917 |
|
26918 |
|
26919 |
|
26920 |
|
26921 |
|
26922 |
|
26923 |
|
26924 |
|
26925 |
|
26926 |
|
26927 |
|
26928 |
|
26929 |
|
26930 | const TRANSLATIONS = new InjectionToken('Translations');
|
26931 |
|
26932 |
|
26933 |
|
26934 |
|
26935 |
|
26936 |
|
26937 |
|
26938 |
|
26939 |
|
26940 |
|
26941 |
|
26942 |
|
26943 |
|
26944 |
|
26945 |
|
26946 |
|
26947 |
|
26948 |
|
26949 |
|
26950 |
|
26951 |
|
26952 | const TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
|
26953 |
|
26954 |
|
26955 |
|
26956 |
|
26957 |
|
26958 |
|
26959 |
|
26960 |
|
26961 |
|
26962 |
|
26963 |
|
26964 |
|
26965 |
|
26966 |
|
26967 |
|
26968 |
|
26969 |
|
26970 |
|
26971 |
|
26972 |
|
26973 |
|
26974 |
|
26975 |
|
26976 | var MissingTranslationStrategy;
|
26977 | (function (MissingTranslationStrategy) {
|
26978 | MissingTranslationStrategy[MissingTranslationStrategy["Error"] = 0] = "Error";
|
26979 | MissingTranslationStrategy[MissingTranslationStrategy["Warning"] = 1] = "Warning";
|
26980 | MissingTranslationStrategy[MissingTranslationStrategy["Ignore"] = 2] = "Ignore";
|
26981 | })(MissingTranslationStrategy || (MissingTranslationStrategy = {}));
|
26982 |
|
26983 |
|
26984 |
|
26985 |
|
26986 |
|
26987 |
|
26988 |
|
26989 |
|
26990 | const SWITCH_IVY_ENABLED__POST_R3__ = true;
|
26991 | const SWITCH_IVY_ENABLED__PRE_R3__ = false;
|
26992 | const ivyEnabled = SWITCH_IVY_ENABLED__PRE_R3__;
|
26993 |
|
26994 |
|
26995 |
|
26996 |
|
26997 |
|
26998 |
|
26999 |
|
27000 |
|
27001 |
|
27002 |
|
27003 |
|
27004 |
|
27005 |
|
27006 | class ModuleWithComponentFactories {
|
27007 | constructor(ngModuleFactory, componentFactories) {
|
27008 | this.ngModuleFactory = ngModuleFactory;
|
27009 | this.componentFactories = componentFactories;
|
27010 | }
|
27011 | }
|
27012 | function _throwError() {
|
27013 | throw new Error(`Runtime compiler is not loaded`);
|
27014 | }
|
27015 | const Compiler_compileModuleSync__PRE_R3__ = _throwError;
|
27016 | const Compiler_compileModuleSync__POST_R3__ = function (moduleType) {
|
27017 | return new NgModuleFactory$1(moduleType);
|
27018 | };
|
27019 | const Compiler_compileModuleSync = Compiler_compileModuleSync__PRE_R3__;
|
27020 | const Compiler_compileModuleAsync__PRE_R3__ = _throwError;
|
27021 | const Compiler_compileModuleAsync__POST_R3__ = function (moduleType) {
|
27022 | return Promise.resolve(Compiler_compileModuleSync__POST_R3__(moduleType));
|
27023 | };
|
27024 | const Compiler_compileModuleAsync = Compiler_compileModuleAsync__PRE_R3__;
|
27025 | const Compiler_compileModuleAndAllComponentsSync__PRE_R3__ = _throwError;
|
27026 | const Compiler_compileModuleAndAllComponentsSync__POST_R3__ = function (moduleType) {
|
27027 | const ngModuleFactory = Compiler_compileModuleSync__POST_R3__(moduleType);
|
27028 | const moduleDef = getNgModuleDef(moduleType);
|
27029 | const componentFactories = maybeUnwrapFn(moduleDef.declarations)
|
27030 | .reduce((factories, declaration) => {
|
27031 | const componentDef = getComponentDef(declaration);
|
27032 | componentDef && factories.push(new ComponentFactory$1(componentDef));
|
27033 | return factories;
|
27034 | }, []);
|
27035 | return new ModuleWithComponentFactories(ngModuleFactory, componentFactories);
|
27036 | };
|
27037 | const Compiler_compileModuleAndAllComponentsSync = Compiler_compileModuleAndAllComponentsSync__PRE_R3__;
|
27038 | const Compiler_compileModuleAndAllComponentsAsync__PRE_R3__ = _throwError;
|
27039 | const Compiler_compileModuleAndAllComponentsAsync__POST_R3__ = function (moduleType) {
|
27040 | return Promise.resolve(Compiler_compileModuleAndAllComponentsSync__POST_R3__(moduleType));
|
27041 | };
|
27042 | const Compiler_compileModuleAndAllComponentsAsync = Compiler_compileModuleAndAllComponentsAsync__PRE_R3__;
|
27043 |
|
27044 |
|
27045 |
|
27046 |
|
27047 |
|
27048 |
|
27049 |
|
27050 |
|
27051 |
|
27052 |
|
27053 |
|
27054 | class Compiler {
|
27055 | constructor() {
|
27056 | |
27057 |
|
27058 |
|
27059 |
|
27060 | this.compileModuleSync = Compiler_compileModuleSync;
|
27061 | |
27062 |
|
27063 |
|
27064 | this.compileModuleAsync = Compiler_compileModuleAsync;
|
27065 | |
27066 |
|
27067 |
|
27068 | this.compileModuleAndAllComponentsSync = Compiler_compileModuleAndAllComponentsSync;
|
27069 | |
27070 |
|
27071 |
|
27072 | this.compileModuleAndAllComponentsAsync = Compiler_compileModuleAndAllComponentsAsync;
|
27073 | }
|
27074 | |
27075 |
|
27076 |
|
27077 | clearCache() { }
|
27078 | |
27079 |
|
27080 |
|
27081 | clearCacheFor(type) { }
|
27082 | |
27083 |
|
27084 |
|
27085 | getModuleId(moduleType) {
|
27086 | return undefined;
|
27087 | }
|
27088 | }
|
27089 | Compiler.decorators = [
|
27090 | { type: Injectable }
|
27091 | ];
|
27092 |
|
27093 |
|
27094 |
|
27095 |
|
27096 |
|
27097 | const COMPILER_OPTIONS = new InjectionToken('compilerOptions');
|
27098 |
|
27099 |
|
27100 |
|
27101 |
|
27102 |
|
27103 | class CompilerFactory {
|
27104 | }
|
27105 |
|
27106 |
|
27107 |
|
27108 |
|
27109 |
|
27110 |
|
27111 |
|
27112 |
|
27113 | const promise = (() => Promise.resolve(0))();
|
27114 | function scheduleMicroTask(fn) {
|
27115 | if (typeof Zone === 'undefined') {
|
27116 |
|
27117 | promise.then(() => {
|
27118 | fn && fn.apply(null, null);
|
27119 | });
|
27120 | }
|
27121 | else {
|
27122 | Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
|
27123 | }
|
27124 | }
|
27125 |
|
27126 |
|
27127 |
|
27128 |
|
27129 |
|
27130 |
|
27131 |
|
27132 |
|
27133 | function getNativeRequestAnimationFrame() {
|
27134 | let nativeRequestAnimationFrame = _global['requestAnimationFrame'];
|
27135 | let nativeCancelAnimationFrame = _global['cancelAnimationFrame'];
|
27136 | if (typeof Zone !== 'undefined' && nativeRequestAnimationFrame && nativeCancelAnimationFrame) {
|
27137 |
|
27138 |
|
27139 | const unpatchedRequestAnimationFrame = nativeRequestAnimationFrame[Zone.__symbol__('OriginalDelegate')];
|
27140 | if (unpatchedRequestAnimationFrame) {
|
27141 | nativeRequestAnimationFrame = unpatchedRequestAnimationFrame;
|
27142 | }
|
27143 | const unpatchedCancelAnimationFrame = nativeCancelAnimationFrame[Zone.__symbol__('OriginalDelegate')];
|
27144 | if (unpatchedCancelAnimationFrame) {
|
27145 | nativeCancelAnimationFrame = unpatchedCancelAnimationFrame;
|
27146 | }
|
27147 | }
|
27148 | return { nativeRequestAnimationFrame, nativeCancelAnimationFrame };
|
27149 | }
|
27150 |
|
27151 |
|
27152 |
|
27153 |
|
27154 |
|
27155 |
|
27156 |
|
27157 |
|
27158 |
|
27159 |
|
27160 |
|
27161 |
|
27162 |
|
27163 |
|
27164 |
|
27165 |
|
27166 |
|
27167 |
|
27168 |
|
27169 |
|
27170 |
|
27171 |
|
27172 |
|
27173 |
|
27174 |
|
27175 |
|
27176 |
|
27177 |
|
27178 |
|
27179 |
|
27180 |
|
27181 |
|
27182 |
|
27183 |
|
27184 |
|
27185 |
|
27186 |
|
27187 |
|
27188 |
|
27189 |
|
27190 |
|
27191 |
|
27192 |
|
27193 |
|
27194 |
|
27195 |
|
27196 |
|
27197 |
|
27198 |
|
27199 |
|
27200 |
|
27201 |
|
27202 |
|
27203 |
|
27204 |
|
27205 |
|
27206 |
|
27207 |
|
27208 |
|
27209 |
|
27210 |
|
27211 |
|
27212 |
|
27213 |
|
27214 |
|
27215 |
|
27216 |
|
27217 |
|
27218 |
|
27219 |
|
27220 |
|
27221 |
|
27222 |
|
27223 |
|
27224 |
|
27225 |
|
27226 |
|
27227 |
|
27228 |
|
27229 |
|
27230 |
|
27231 |
|
27232 | class NgZone {
|
27233 | constructor({ enableLongStackTrace = false, shouldCoalesceEventChangeDetection = false }) {
|
27234 | this.hasPendingMacrotasks = false;
|
27235 | this.hasPendingMicrotasks = false;
|
27236 | |
27237 |
|
27238 |
|
27239 | this.isStable = true;
|
27240 | |
27241 |
|
27242 |
|
27243 | this.onUnstable = new EventEmitter(false);
|
27244 | |
27245 |
|
27246 |
|
27247 |
|
27248 |
|
27249 | this.onMicrotaskEmpty = new EventEmitter(false);
|
27250 | |
27251 |
|
27252 |
|
27253 |
|
27254 |
|
27255 | this.onStable = new EventEmitter(false);
|
27256 | |
27257 |
|
27258 |
|
27259 | this.onError = new EventEmitter(false);
|
27260 | if (typeof Zone == 'undefined') {
|
27261 | throw new Error(`In this configuration Angular requires Zone.js`);
|
27262 | }
|
27263 | Zone.assertZonePatched();
|
27264 | const self = this;
|
27265 | self._nesting = 0;
|
27266 | self._outer = self._inner = Zone.current;
|
27267 | if (Zone['wtfZoneSpec']) {
|
27268 | self._inner = self._inner.fork(Zone['wtfZoneSpec']);
|
27269 | }
|
27270 | if (Zone['TaskTrackingZoneSpec']) {
|
27271 | self._inner = self._inner.fork(new Zone['TaskTrackingZoneSpec']);
|
27272 | }
|
27273 | if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {
|
27274 | self._inner = self._inner.fork(Zone['longStackTraceZoneSpec']);
|
27275 | }
|
27276 | self.shouldCoalesceEventChangeDetection = shouldCoalesceEventChangeDetection;
|
27277 | self.lastRequestAnimationFrameId = -1;
|
27278 | self.nativeRequestAnimationFrame = getNativeRequestAnimationFrame().nativeRequestAnimationFrame;
|
27279 | forkInnerZoneWithAngularBehavior(self);
|
27280 | }
|
27281 | static isInAngularZone() {
|
27282 | return Zone.current.get('isAngularZone') === true;
|
27283 | }
|
27284 | static assertInAngularZone() {
|
27285 | if (!NgZone.isInAngularZone()) {
|
27286 | throw new Error('Expected to be in Angular Zone, but it is not!');
|
27287 | }
|
27288 | }
|
27289 | static assertNotInAngularZone() {
|
27290 | if (NgZone.isInAngularZone()) {
|
27291 | throw new Error('Expected to not be in Angular Zone, but it is!');
|
27292 | }
|
27293 | }
|
27294 | |
27295 |
|
27296 |
|
27297 |
|
27298 |
|
27299 |
|
27300 |
|
27301 |
|
27302 |
|
27303 |
|
27304 |
|
27305 |
|
27306 | run(fn, applyThis, applyArgs) {
|
27307 | return this._inner.run(fn, applyThis, applyArgs);
|
27308 | }
|
27309 | |
27310 |
|
27311 |
|
27312 |
|
27313 |
|
27314 |
|
27315 |
|
27316 |
|
27317 |
|
27318 |
|
27319 |
|
27320 |
|
27321 | runTask(fn, applyThis, applyArgs, name) {
|
27322 | const zone = this._inner;
|
27323 | const task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop$1, noop$1);
|
27324 | try {
|
27325 | return zone.runTask(task, applyThis, applyArgs);
|
27326 | }
|
27327 | finally {
|
27328 | zone.cancelTask(task);
|
27329 | }
|
27330 | }
|
27331 | |
27332 |
|
27333 |
|
27334 |
|
27335 | runGuarded(fn, applyThis, applyArgs) {
|
27336 | return this._inner.runGuarded(fn, applyThis, applyArgs);
|
27337 | }
|
27338 | |
27339 |
|
27340 |
|
27341 |
|
27342 |
|
27343 |
|
27344 |
|
27345 |
|
27346 |
|
27347 |
|
27348 |
|
27349 |
|
27350 |
|
27351 | runOutsideAngular(fn) {
|
27352 | return this._outer.run(fn);
|
27353 | }
|
27354 | }
|
27355 | function noop$1() { }
|
27356 | const EMPTY_PAYLOAD = {};
|
27357 | function checkStable(zone) {
|
27358 | if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
|
27359 | try {
|
27360 | zone._nesting++;
|
27361 | zone.onMicrotaskEmpty.emit(null);
|
27362 | }
|
27363 | finally {
|
27364 | zone._nesting--;
|
27365 | if (!zone.hasPendingMicrotasks) {
|
27366 | try {
|
27367 | zone.runOutsideAngular(() => zone.onStable.emit(null));
|
27368 | }
|
27369 | finally {
|
27370 | zone.isStable = true;
|
27371 | }
|
27372 | }
|
27373 | }
|
27374 | }
|
27375 | }
|
27376 | function delayChangeDetectionForEvents(zone) {
|
27377 | if (zone.lastRequestAnimationFrameId !== -1) {
|
27378 | return;
|
27379 | }
|
27380 | zone.lastRequestAnimationFrameId = zone.nativeRequestAnimationFrame.call(_global, () => {
|
27381 |
|
27382 |
|
27383 |
|
27384 |
|
27385 |
|
27386 |
|
27387 |
|
27388 |
|
27389 |
|
27390 | if (!zone.fakeTopEventTask) {
|
27391 | zone.fakeTopEventTask = Zone.root.scheduleEventTask('fakeTopEventTask', () => {
|
27392 | zone.lastRequestAnimationFrameId = -1;
|
27393 | updateMicroTaskStatus(zone);
|
27394 | checkStable(zone);
|
27395 | }, undefined, () => { }, () => { });
|
27396 | }
|
27397 | zone.fakeTopEventTask.invoke();
|
27398 | });
|
27399 | updateMicroTaskStatus(zone);
|
27400 | }
|
27401 | function forkInnerZoneWithAngularBehavior(zone) {
|
27402 | const delayChangeDetectionForEventsDelegate = () => {
|
27403 | delayChangeDetectionForEvents(zone);
|
27404 | };
|
27405 | const maybeDelayChangeDetection = !!zone.shouldCoalesceEventChangeDetection &&
|
27406 | zone.nativeRequestAnimationFrame && delayChangeDetectionForEventsDelegate;
|
27407 | zone._inner = zone._inner.fork({
|
27408 | name: 'angular',
|
27409 | properties: { 'isAngularZone': true, 'maybeDelayChangeDetection': maybeDelayChangeDetection },
|
27410 | onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => {
|
27411 | try {
|
27412 | onEnter(zone);
|
27413 | return delegate.invokeTask(target, task, applyThis, applyArgs);
|
27414 | }
|
27415 | finally {
|
27416 | if (maybeDelayChangeDetection && task.type === 'eventTask') {
|
27417 | maybeDelayChangeDetection();
|
27418 | }
|
27419 | onLeave(zone);
|
27420 | }
|
27421 | },
|
27422 | onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => {
|
27423 | try {
|
27424 | onEnter(zone);
|
27425 | return delegate.invoke(target, callback, applyThis, applyArgs, source);
|
27426 | }
|
27427 | finally {
|
27428 | onLeave(zone);
|
27429 | }
|
27430 | },
|
27431 | onHasTask: (delegate, current, target, hasTaskState) => {
|
27432 | delegate.hasTask(target, hasTaskState);
|
27433 | if (current === target) {
|
27434 |
|
27435 |
|
27436 | if (hasTaskState.change == 'microTask') {
|
27437 | zone._hasPendingMicrotasks = hasTaskState.microTask;
|
27438 | updateMicroTaskStatus(zone);
|
27439 | checkStable(zone);
|
27440 | }
|
27441 | else if (hasTaskState.change == 'macroTask') {
|
27442 | zone.hasPendingMacrotasks = hasTaskState.macroTask;
|
27443 | }
|
27444 | }
|
27445 | },
|
27446 | onHandleError: (delegate, current, target, error) => {
|
27447 | delegate.handleError(target, error);
|
27448 | zone.runOutsideAngular(() => zone.onError.emit(error));
|
27449 | return false;
|
27450 | }
|
27451 | });
|
27452 | }
|
27453 | function updateMicroTaskStatus(zone) {
|
27454 | if (zone._hasPendingMicrotasks ||
|
27455 | (zone.shouldCoalesceEventChangeDetection && zone.lastRequestAnimationFrameId !== -1)) {
|
27456 | zone.hasPendingMicrotasks = true;
|
27457 | }
|
27458 | else {
|
27459 | zone.hasPendingMicrotasks = false;
|
27460 | }
|
27461 | }
|
27462 | function onEnter(zone) {
|
27463 | zone._nesting++;
|
27464 | if (zone.isStable) {
|
27465 | zone.isStable = false;
|
27466 | zone.onUnstable.emit(null);
|
27467 | }
|
27468 | }
|
27469 | function onLeave(zone) {
|
27470 | zone._nesting--;
|
27471 | checkStable(zone);
|
27472 | }
|
27473 |
|
27474 |
|
27475 |
|
27476 |
|
27477 | class NoopNgZone {
|
27478 | constructor() {
|
27479 | this.hasPendingMicrotasks = false;
|
27480 | this.hasPendingMacrotasks = false;
|
27481 | this.isStable = true;
|
27482 | this.onUnstable = new EventEmitter();
|
27483 | this.onMicrotaskEmpty = new EventEmitter();
|
27484 | this.onStable = new EventEmitter();
|
27485 | this.onError = new EventEmitter();
|
27486 | }
|
27487 | run(fn, applyThis, applyArgs) {
|
27488 | return fn.apply(applyThis, applyArgs);
|
27489 | }
|
27490 | runGuarded(fn, applyThis, applyArgs) {
|
27491 | return fn.apply(applyThis, applyArgs);
|
27492 | }
|
27493 | runOutsideAngular(fn) {
|
27494 | return fn();
|
27495 | }
|
27496 | runTask(fn, applyThis, applyArgs, name) {
|
27497 | return fn.apply(applyThis, applyArgs);
|
27498 | }
|
27499 | }
|
27500 |
|
27501 |
|
27502 |
|
27503 |
|
27504 |
|
27505 |
|
27506 |
|
27507 |
|
27508 |
|
27509 |
|
27510 |
|
27511 |
|
27512 |
|
27513 |
|
27514 | class Testability {
|
27515 | constructor(_ngZone) {
|
27516 | this._ngZone = _ngZone;
|
27517 | this._pendingCount = 0;
|
27518 | this._isZoneStable = true;
|
27519 | |
27520 |
|
27521 |
|
27522 |
|
27523 |
|
27524 |
|
27525 | this._didWork = false;
|
27526 | this._callbacks = [];
|
27527 | this.taskTrackingZone = null;
|
27528 | this._watchAngularEvents();
|
27529 | _ngZone.run(() => {
|
27530 | this.taskTrackingZone =
|
27531 | typeof Zone == 'undefined' ? null : Zone.current.get('TaskTrackingZone');
|
27532 | });
|
27533 | }
|
27534 | _watchAngularEvents() {
|
27535 | this._ngZone.onUnstable.subscribe({
|
27536 | next: () => {
|
27537 | this._didWork = true;
|
27538 | this._isZoneStable = false;
|
27539 | }
|
27540 | });
|
27541 | this._ngZone.runOutsideAngular(() => {
|
27542 | this._ngZone.onStable.subscribe({
|
27543 | next: () => {
|
27544 | NgZone.assertNotInAngularZone();
|
27545 | scheduleMicroTask(() => {
|
27546 | this._isZoneStable = true;
|
27547 | this._runCallbacksIfReady();
|
27548 | });
|
27549 | }
|
27550 | });
|
27551 | });
|
27552 | }
|
27553 | |
27554 |
|
27555 |
|
27556 |
|
27557 | increasePendingRequestCount() {
|
27558 | this._pendingCount += 1;
|
27559 | this._didWork = true;
|
27560 | return this._pendingCount;
|
27561 | }
|
27562 | |
27563 |
|
27564 |
|
27565 |
|
27566 | decreasePendingRequestCount() {
|
27567 | this._pendingCount -= 1;
|
27568 | if (this._pendingCount < 0) {
|
27569 | throw new Error('pending async requests below zero');
|
27570 | }
|
27571 | this._runCallbacksIfReady();
|
27572 | return this._pendingCount;
|
27573 | }
|
27574 | |
27575 |
|
27576 |
|
27577 | isStable() {
|
27578 | return this._isZoneStable && this._pendingCount === 0 && !this._ngZone.hasPendingMacrotasks;
|
27579 | }
|
27580 | _runCallbacksIfReady() {
|
27581 | if (this.isStable()) {
|
27582 |
|
27583 | scheduleMicroTask(() => {
|
27584 | while (this._callbacks.length !== 0) {
|
27585 | let cb = this._callbacks.pop();
|
27586 | clearTimeout(cb.timeoutId);
|
27587 | cb.doneCb(this._didWork);
|
27588 | }
|
27589 | this._didWork = false;
|
27590 | });
|
27591 | }
|
27592 | else {
|
27593 |
|
27594 | let pending = this.getPendingTasks();
|
27595 | this._callbacks = this._callbacks.filter((cb) => {
|
27596 | if (cb.updateCb && cb.updateCb(pending)) {
|
27597 | clearTimeout(cb.timeoutId);
|
27598 | return false;
|
27599 | }
|
27600 | return true;
|
27601 | });
|
27602 | this._didWork = true;
|
27603 | }
|
27604 | }
|
27605 | getPendingTasks() {
|
27606 | if (!this.taskTrackingZone) {
|
27607 | return [];
|
27608 | }
|
27609 |
|
27610 | return this.taskTrackingZone.macroTasks.map((t) => {
|
27611 | return {
|
27612 | source: t.source,
|
27613 |
|
27614 |
|
27615 | creationLocation: t.creationLocation,
|
27616 | data: t.data
|
27617 | };
|
27618 | });
|
27619 | }
|
27620 | addCallback(cb, timeout, updateCb) {
|
27621 | let timeoutId = -1;
|
27622 | if (timeout && timeout > 0) {
|
27623 | timeoutId = setTimeout(() => {
|
27624 | this._callbacks = this._callbacks.filter((cb) => cb.timeoutId !== timeoutId);
|
27625 | cb(this._didWork, this.getPendingTasks());
|
27626 | }, timeout);
|
27627 | }
|
27628 | this._callbacks.push({ doneCb: cb, timeoutId: timeoutId, updateCb: updateCb });
|
27629 | }
|
27630 | |
27631 |
|
27632 |
|
27633 |
|
27634 |
|
27635 |
|
27636 |
|
27637 |
|
27638 |
|
27639 |
|
27640 |
|
27641 |
|
27642 | whenStable(doneCb, timeout, updateCb) {
|
27643 | if (updateCb && !this.taskTrackingZone) {
|
27644 | throw new Error('Task tracking zone is required when passing an update callback to ' +
|
27645 | 'whenStable(). Is "zone.js/dist/task-tracking.js" loaded?');
|
27646 | }
|
27647 |
|
27648 | this.addCallback(doneCb, timeout, updateCb);
|
27649 | this._runCallbacksIfReady();
|
27650 | }
|
27651 | |
27652 |
|
27653 |
|
27654 |
|
27655 | getPendingRequestCount() {
|
27656 | return this._pendingCount;
|
27657 | }
|
27658 | |
27659 |
|
27660 |
|
27661 |
|
27662 |
|
27663 |
|
27664 | findProviders(using, provider, exactMatch) {
|
27665 |
|
27666 | return [];
|
27667 | }
|
27668 | }
|
27669 | Testability.decorators = [
|
27670 | { type: Injectable }
|
27671 | ];
|
27672 | Testability.ctorParameters = () => [
|
27673 | { type: NgZone }
|
27674 | ];
|
27675 |
|
27676 |
|
27677 |
|
27678 |
|
27679 | class TestabilityRegistry {
|
27680 | constructor() {
|
27681 |
|
27682 | this._applications = new Map();
|
27683 | _testabilityGetter.addToWindow(this);
|
27684 | }
|
27685 | |
27686 |
|
27687 |
|
27688 |
|
27689 |
|
27690 | registerApplication(token, testability) {
|
27691 | this._applications.set(token, testability);
|
27692 | }
|
27693 | |
27694 |
|
27695 |
|
27696 |
|
27697 | unregisterApplication(token) {
|
27698 | this._applications.delete(token);
|
27699 | }
|
27700 | |
27701 |
|
27702 |
|
27703 | unregisterAllApplications() {
|
27704 | this._applications.clear();
|
27705 | }
|
27706 | |
27707 |
|
27708 |
|
27709 |
|
27710 | getTestability(elem) {
|
27711 | return this._applications.get(elem) || null;
|
27712 | }
|
27713 | |
27714 |
|
27715 |
|
27716 | getAllTestabilities() {
|
27717 | return Array.from(this._applications.values());
|
27718 | }
|
27719 | |
27720 |
|
27721 |
|
27722 | getAllRootElements() {
|
27723 | return Array.from(this._applications.keys());
|
27724 | }
|
27725 | |
27726 |
|
27727 |
|
27728 |
|
27729 |
|
27730 |
|
27731 | findTestabilityInTree(elem, findInAncestors = true) {
|
27732 | return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
|
27733 | }
|
27734 | }
|
27735 | TestabilityRegistry.decorators = [
|
27736 | { type: Injectable }
|
27737 | ];
|
27738 | TestabilityRegistry.ctorParameters = () => [];
|
27739 | class _NoopGetTestability {
|
27740 | addToWindow(registry) { }
|
27741 | findTestabilityInTree(registry, elem, findInAncestors) {
|
27742 | return null;
|
27743 | }
|
27744 | }
|
27745 |
|
27746 |
|
27747 |
|
27748 |
|
27749 | function setTestabilityGetter(getter) {
|
27750 | _testabilityGetter = getter;
|
27751 | }
|
27752 | let _testabilityGetter = new _NoopGetTestability();
|
27753 |
|
27754 |
|
27755 |
|
27756 |
|
27757 |
|
27758 |
|
27759 |
|
27760 |
|
27761 | let _platform;
|
27762 | let compileNgModuleFactory = compileNgModuleFactory__PRE_R3__;
|
27763 | function compileNgModuleFactory__PRE_R3__(injector, options, moduleType) {
|
27764 | const compilerFactory = injector.get(CompilerFactory);
|
27765 | const compiler = compilerFactory.createCompiler([options]);
|
27766 | return compiler.compileModuleAsync(moduleType);
|
27767 | }
|
27768 | function compileNgModuleFactory__POST_R3__(injector, options, moduleType) {
|
27769 | ngDevMode && assertNgModuleType(moduleType);
|
27770 | const moduleFactory = new NgModuleFactory$1(moduleType);
|
27771 |
|
27772 | if (typeof ngJitMode !== 'undefined' && !ngJitMode) {
|
27773 | return Promise.resolve(moduleFactory);
|
27774 | }
|
27775 | const compilerOptions = injector.get(COMPILER_OPTIONS, []).concat(options);
|
27776 |
|
27777 |
|
27778 |
|
27779 | setJitOptions({
|
27780 | defaultEncapsulation: _lastDefined(compilerOptions.map(opts => opts.defaultEncapsulation)),
|
27781 | preserveWhitespaces: _lastDefined(compilerOptions.map(opts => opts.preserveWhitespaces)),
|
27782 | });
|
27783 | if (isComponentResourceResolutionQueueEmpty()) {
|
27784 | return Promise.resolve(moduleFactory);
|
27785 | }
|
27786 | const compilerProviders = _mergeArrays(compilerOptions.map(o => o.providers));
|
27787 |
|
27788 |
|
27789 |
|
27790 |
|
27791 | if (compilerProviders.length === 0) {
|
27792 | return Promise.resolve(moduleFactory);
|
27793 | }
|
27794 | const compiler = getCompilerFacade();
|
27795 | const compilerInjector = Injector.create({ providers: compilerProviders });
|
27796 | const resourceLoader = compilerInjector.get(compiler.ResourceLoader);
|
27797 |
|
27798 |
|
27799 | return resolveComponentResources(url => Promise.resolve(resourceLoader.get(url)))
|
27800 | .then(() => moduleFactory);
|
27801 | }
|
27802 |
|
27803 |
|
27804 |
|
27805 | function publishDefaultGlobalUtils__PRE_R3__() { }
|
27806 | function publishDefaultGlobalUtils__POST_R3__() {
|
27807 | ngDevMode && publishDefaultGlobalUtils();
|
27808 | }
|
27809 | let publishDefaultGlobalUtils$1 = publishDefaultGlobalUtils__PRE_R3__;
|
27810 | let isBoundToModule = isBoundToModule__PRE_R3__;
|
27811 | function isBoundToModule__PRE_R3__(cf) {
|
27812 | return cf instanceof ComponentFactoryBoundToModule;
|
27813 | }
|
27814 | function isBoundToModule__POST_R3__(cf) {
|
27815 | return cf.isBoundToModule;
|
27816 | }
|
27817 | const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
|
27818 |
|
27819 |
|
27820 |
|
27821 |
|
27822 |
|
27823 | class NgProbeToken {
|
27824 | constructor(name, token) {
|
27825 | this.name = name;
|
27826 | this.token = token;
|
27827 | }
|
27828 | }
|
27829 |
|
27830 |
|
27831 |
|
27832 |
|
27833 |
|
27834 |
|
27835 | function createPlatform(injector) {
|
27836 | if (_platform && !_platform.destroyed &&
|
27837 | !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
27838 | throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
|
27839 | }
|
27840 | publishDefaultGlobalUtils$1();
|
27841 | _platform = injector.get(PlatformRef);
|
27842 | const inits = injector.get(PLATFORM_INITIALIZER, null);
|
27843 | if (inits)
|
27844 | inits.forEach((init) => init());
|
27845 | return _platform;
|
27846 | }
|
27847 |
|
27848 |
|
27849 |
|
27850 |
|
27851 |
|
27852 |
|
27853 |
|
27854 |
|
27855 |
|
27856 |
|
27857 |
|
27858 | function createPlatformFactory(parentPlatformFactory, name, providers = []) {
|
27859 | const desc = `Platform: ${name}`;
|
27860 | const marker = new InjectionToken(desc);
|
27861 | return (extraProviders = []) => {
|
27862 | let platform = getPlatform();
|
27863 | if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
27864 | if (parentPlatformFactory) {
|
27865 | parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
|
27866 | }
|
27867 | else {
|
27868 | const injectedProviders = providers.concat(extraProviders).concat({ provide: marker, useValue: true }, {
|
27869 | provide: INJECTOR_SCOPE,
|
27870 | useValue: 'platform'
|
27871 | });
|
27872 | createPlatform(Injector.create({ providers: injectedProviders, name: desc }));
|
27873 | }
|
27874 | }
|
27875 | return assertPlatform(marker);
|
27876 | };
|
27877 | }
|
27878 |
|
27879 |
|
27880 |
|
27881 |
|
27882 |
|
27883 | function assertPlatform(requiredToken) {
|
27884 | const platform = getPlatform();
|
27885 | if (!platform) {
|
27886 | throw new Error('No platform exists!');
|
27887 | }
|
27888 | if (!platform.injector.get(requiredToken, null)) {
|
27889 | throw new Error('A platform with a different configuration has been created. Please destroy it first.');
|
27890 | }
|
27891 | return platform;
|
27892 | }
|
27893 |
|
27894 |
|
27895 |
|
27896 |
|
27897 |
|
27898 |
|
27899 | function destroyPlatform() {
|
27900 | if (_platform && !_platform.destroyed) {
|
27901 | _platform.destroy();
|
27902 | }
|
27903 | }
|
27904 |
|
27905 |
|
27906 |
|
27907 |
|
27908 |
|
27909 | function getPlatform() {
|
27910 | return _platform && !_platform.destroyed ? _platform : null;
|
27911 | }
|
27912 |
|
27913 |
|
27914 |
|
27915 |
|
27916 |
|
27917 |
|
27918 |
|
27919 |
|
27920 |
|
27921 | class PlatformRef {
|
27922 |
|
27923 | constructor(_injector) {
|
27924 | this._injector = _injector;
|
27925 | this._modules = [];
|
27926 | this._destroyListeners = [];
|
27927 | this._destroyed = false;
|
27928 | }
|
27929 | |
27930 |
|
27931 |
|
27932 |
|
27933 |
|
27934 |
|
27935 |
|
27936 |
|
27937 |
|
27938 |
|
27939 |
|
27940 |
|
27941 |
|
27942 |
|
27943 |
|
27944 |
|
27945 |
|
27946 |
|
27947 |
|
27948 |
|
27949 |
|
27950 |
|
27951 | bootstrapModuleFactory(moduleFactory, options) {
|
27952 |
|
27953 |
|
27954 |
|
27955 |
|
27956 | const ngZoneOption = options ? options.ngZone : undefined;
|
27957 | const ngZoneEventCoalescing = (options && options.ngZoneEventCoalescing) || false;
|
27958 | const ngZone = getNgZone(ngZoneOption, ngZoneEventCoalescing);
|
27959 | const providers = [{ provide: NgZone, useValue: ngZone }];
|
27960 |
|
27961 |
|
27962 | return ngZone.run(() => {
|
27963 | const ngZoneInjector = Injector.create({ providers: providers, parent: this.injector, name: moduleFactory.moduleType.name });
|
27964 | const moduleRef = moduleFactory.create(ngZoneInjector);
|
27965 | const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
|
27966 | if (!exceptionHandler) {
|
27967 | throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
|
27968 | }
|
27969 | moduleRef.onDestroy(() => remove(this._modules, moduleRef));
|
27970 | ngZone.runOutsideAngular(() => ngZone.onError.subscribe({
|
27971 | next: (error) => {
|
27972 | exceptionHandler.handleError(error);
|
27973 | }
|
27974 | }));
|
27975 | return _callAndReportToErrorHandler(exceptionHandler, ngZone, () => {
|
27976 | const initStatus = moduleRef.injector.get(ApplicationInitStatus);
|
27977 | initStatus.runInitializers();
|
27978 | return initStatus.donePromise.then(() => {
|
27979 | if (ivyEnabled) {
|
27980 |
|
27981 | const localeId = moduleRef.injector.get(LOCALE_ID$1, DEFAULT_LOCALE_ID);
|
27982 | setLocaleId(localeId || DEFAULT_LOCALE_ID);
|
27983 | }
|
27984 | this._moduleDoBootstrap(moduleRef);
|
27985 | return moduleRef;
|
27986 | });
|
27987 | });
|
27988 | });
|
27989 | }
|
27990 | |
27991 |
|
27992 |
|
27993 |
|
27994 |
|
27995 |
|
27996 |
|
27997 |
|
27998 |
|
27999 |
|
28000 |
|
28001 |
|
28002 |
|
28003 |
|
28004 |
|
28005 |
|
28006 | bootstrapModule(moduleType, compilerOptions = []) {
|
28007 | const options = optionsReducer({}, compilerOptions);
|
28008 | return compileNgModuleFactory(this.injector, options, moduleType)
|
28009 | .then(moduleFactory => this.bootstrapModuleFactory(moduleFactory, options));
|
28010 | }
|
28011 | _moduleDoBootstrap(moduleRef) {
|
28012 | const appRef = moduleRef.injector.get(ApplicationRef);
|
28013 | if (moduleRef._bootstrapComponents.length > 0) {
|
28014 | moduleRef._bootstrapComponents.forEach(f => appRef.bootstrap(f));
|
28015 | }
|
28016 | else if (moduleRef.instance.ngDoBootstrap) {
|
28017 | moduleRef.instance.ngDoBootstrap(appRef);
|
28018 | }
|
28019 | else {
|
28020 | throw new Error(`The module ${stringify(moduleRef.instance
|
28021 | .constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
|
28022 | `Please define one of these.`);
|
28023 | }
|
28024 | this._modules.push(moduleRef);
|
28025 | }
|
28026 | |
28027 |
|
28028 |
|
28029 | onDestroy(callback) {
|
28030 | this._destroyListeners.push(callback);
|
28031 | }
|
28032 | |
28033 |
|
28034 |
|
28035 |
|
28036 | get injector() {
|
28037 | return this._injector;
|
28038 | }
|
28039 | |
28040 |
|
28041 |
|
28042 |
|
28043 | destroy() {
|
28044 | if (this._destroyed) {
|
28045 | throw new Error('The platform has already been destroyed!');
|
28046 | }
|
28047 | this._modules.slice().forEach(module => module.destroy());
|
28048 | this._destroyListeners.forEach(listener => listener());
|
28049 | this._destroyed = true;
|
28050 | }
|
28051 | get destroyed() {
|
28052 | return this._destroyed;
|
28053 | }
|
28054 | }
|
28055 | PlatformRef.decorators = [
|
28056 | { type: Injectable }
|
28057 | ];
|
28058 | PlatformRef.ctorParameters = () => [
|
28059 | { type: Injector }
|
28060 | ];
|
28061 | function getNgZone(ngZoneOption, ngZoneEventCoalescing) {
|
28062 | let ngZone;
|
28063 | if (ngZoneOption === 'noop') {
|
28064 | ngZone = new NoopNgZone();
|
28065 | }
|
28066 | else {
|
28067 | ngZone = (ngZoneOption === 'zone.js' ? undefined : ngZoneOption) || new NgZone({
|
28068 | enableLongStackTrace: isDevMode(),
|
28069 | shouldCoalesceEventChangeDetection: ngZoneEventCoalescing
|
28070 | });
|
28071 | }
|
28072 | return ngZone;
|
28073 | }
|
28074 | function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
|
28075 | try {
|
28076 | const result = callback();
|
28077 | if (isPromise(result)) {
|
28078 | return result.catch((e) => {
|
28079 | ngZone.runOutsideAngular(() => errorHandler.handleError(e));
|
28080 |
|
28081 | throw e;
|
28082 | });
|
28083 | }
|
28084 | return result;
|
28085 | }
|
28086 | catch (e) {
|
28087 | ngZone.runOutsideAngular(() => errorHandler.handleError(e));
|
28088 |
|
28089 | throw e;
|
28090 | }
|
28091 | }
|
28092 | function optionsReducer(dst, objs) {
|
28093 | if (Array.isArray(objs)) {
|
28094 | dst = objs.reduce(optionsReducer, dst);
|
28095 | }
|
28096 | else {
|
28097 | dst = Object.assign(Object.assign({}, dst), objs);
|
28098 | }
|
28099 | return dst;
|
28100 | }
|
28101 |
|
28102 |
|
28103 |
|
28104 |
|
28105 |
|
28106 |
|
28107 |
|
28108 |
|
28109 |
|
28110 |
|
28111 |
|
28112 |
|
28113 |
|
28114 |
|
28115 |
|
28116 |
|
28117 |
|
28118 |
|
28119 |
|
28120 |
|
28121 |
|
28122 |
|
28123 |
|
28124 |
|
28125 |
|
28126 |
|
28127 |
|
28128 |
|
28129 |
|
28130 |
|
28131 |
|
28132 |
|
28133 |
|
28134 |
|
28135 |
|
28136 |
|
28137 |
|
28138 |
|
28139 |
|
28140 |
|
28141 |
|
28142 |
|
28143 |
|
28144 |
|
28145 |
|
28146 |
|
28147 |
|
28148 |
|
28149 |
|
28150 |
|
28151 |
|
28152 |
|
28153 |
|
28154 |
|
28155 |
|
28156 |
|
28157 |
|
28158 |
|
28159 |
|
28160 |
|
28161 |
|
28162 |
|
28163 |
|
28164 |
|
28165 |
|
28166 |
|
28167 |
|
28168 |
|
28169 |
|
28170 |
|
28171 |
|
28172 |
|
28173 |
|
28174 |
|
28175 |
|
28176 |
|
28177 |
|
28178 |
|
28179 |
|
28180 |
|
28181 |
|
28182 |
|
28183 |
|
28184 |
|
28185 |
|
28186 |
|
28187 |
|
28188 |
|
28189 |
|
28190 |
|
28191 |
|
28192 |
|
28193 |
|
28194 | class ApplicationRef {
|
28195 |
|
28196 | constructor(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
|
28197 | this._zone = _zone;
|
28198 | this._console = _console;
|
28199 | this._injector = _injector;
|
28200 | this._exceptionHandler = _exceptionHandler;
|
28201 | this._componentFactoryResolver = _componentFactoryResolver;
|
28202 | this._initStatus = _initStatus;
|
28203 |
|
28204 | this._bootstrapListeners = [];
|
28205 | this._views = [];
|
28206 | this._runningTick = false;
|
28207 | this._enforceNoNewChanges = false;
|
28208 | this._stable = true;
|
28209 | |
28210 |
|
28211 |
|
28212 |
|
28213 | this.componentTypes = [];
|
28214 | |
28215 |
|
28216 |
|
28217 | this.components = [];
|
28218 | this._enforceNoNewChanges = isDevMode();
|
28219 | this._zone.onMicrotaskEmpty.subscribe({
|
28220 | next: () => {
|
28221 | this._zone.run(() => {
|
28222 | this.tick();
|
28223 | });
|
28224 | }
|
28225 | });
|
28226 | const isCurrentlyStable = new Observable((observer) => {
|
28227 | this._stable = this._zone.isStable && !this._zone.hasPendingMacrotasks &&
|
28228 | !this._zone.hasPendingMicrotasks;
|
28229 | this._zone.runOutsideAngular(() => {
|
28230 | observer.next(this._stable);
|
28231 | observer.complete();
|
28232 | });
|
28233 | });
|
28234 | const isStable = new Observable((observer) => {
|
28235 |
|
28236 |
|
28237 | let stableSub;
|
28238 | this._zone.runOutsideAngular(() => {
|
28239 | stableSub = this._zone.onStable.subscribe(() => {
|
28240 | NgZone.assertNotInAngularZone();
|
28241 |
|
28242 |
|
28243 | scheduleMicroTask(() => {
|
28244 | if (!this._stable && !this._zone.hasPendingMacrotasks &&
|
28245 | !this._zone.hasPendingMicrotasks) {
|
28246 | this._stable = true;
|
28247 | observer.next(true);
|
28248 | }
|
28249 | });
|
28250 | });
|
28251 | });
|
28252 | const unstableSub = this._zone.onUnstable.subscribe(() => {
|
28253 | NgZone.assertInAngularZone();
|
28254 | if (this._stable) {
|
28255 | this._stable = false;
|
28256 | this._zone.runOutsideAngular(() => {
|
28257 | observer.next(false);
|
28258 | });
|
28259 | }
|
28260 | });
|
28261 | return () => {
|
28262 | stableSub.unsubscribe();
|
28263 | unstableSub.unsubscribe();
|
28264 | };
|
28265 | });
|
28266 | this.isStable =
|
28267 | merge$1(isCurrentlyStable, isStable.pipe(share()));
|
28268 | }
|
28269 | |
28270 |
|
28271 |
|
28272 |
|
28273 |
|
28274 |
|
28275 |
|
28276 |
|
28277 |
|
28278 |
|
28279 |
|
28280 |
|
28281 |
|
28282 |
|
28283 |
|
28284 |
|
28285 | bootstrap(componentOrFactory, rootSelectorOrNode) {
|
28286 | if (!this._initStatus.done) {
|
28287 | throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
28288 | }
|
28289 | let componentFactory;
|
28290 | if (componentOrFactory instanceof ComponentFactory) {
|
28291 | componentFactory = componentOrFactory;
|
28292 | }
|
28293 | else {
|
28294 | componentFactory =
|
28295 | this._componentFactoryResolver.resolveComponentFactory(componentOrFactory);
|
28296 | }
|
28297 | this.componentTypes.push(componentFactory.componentType);
|
28298 |
|
28299 | const ngModule = isBoundToModule(componentFactory) ? undefined : this._injector.get(NgModuleRef);
|
28300 | const selectorOrNode = rootSelectorOrNode || componentFactory.selector;
|
28301 | const compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
|
28302 | compRef.onDestroy(() => {
|
28303 | this._unloadComponent(compRef);
|
28304 | });
|
28305 | const testability = compRef.injector.get(Testability, null);
|
28306 | if (testability) {
|
28307 | compRef.injector.get(TestabilityRegistry)
|
28308 | .registerApplication(compRef.location.nativeElement, testability);
|
28309 | }
|
28310 | this._loadComponent(compRef);
|
28311 | if (isDevMode()) {
|
28312 | this._console.log(`Angular is running in development mode. Call enableProdMode() to enable production mode.`);
|
28313 | }
|
28314 | return compRef;
|
28315 | }
|
28316 | |
28317 |
|
28318 |
|
28319 |
|
28320 |
|
28321 |
|
28322 |
|
28323 |
|
28324 |
|
28325 |
|
28326 | tick() {
|
28327 | if (this._runningTick) {
|
28328 | throw new Error('ApplicationRef.tick is called recursively');
|
28329 | }
|
28330 | try {
|
28331 | this._runningTick = true;
|
28332 | for (let view of this._views) {
|
28333 | view.detectChanges();
|
28334 | }
|
28335 | if (this._enforceNoNewChanges) {
|
28336 | for (let view of this._views) {
|
28337 | view.checkNoChanges();
|
28338 | }
|
28339 | }
|
28340 | }
|
28341 | catch (e) {
|
28342 |
|
28343 | this._zone.runOutsideAngular(() => this._exceptionHandler.handleError(e));
|
28344 | }
|
28345 | finally {
|
28346 | this._runningTick = false;
|
28347 | }
|
28348 | }
|
28349 | |
28350 |
|
28351 |
|
28352 |
|
28353 |
|
28354 | attachView(viewRef) {
|
28355 | const view = viewRef;
|
28356 | this._views.push(view);
|
28357 | view.attachToAppRef(this);
|
28358 | }
|
28359 | |
28360 |
|
28361 |
|
28362 | detachView(viewRef) {
|
28363 | const view = viewRef;
|
28364 | remove(this._views, view);
|
28365 | view.detachFromAppRef();
|
28366 | }
|
28367 | _loadComponent(componentRef) {
|
28368 | this.attachView(componentRef.hostView);
|
28369 | this.tick();
|
28370 | this.components.push(componentRef);
|
28371 |
|
28372 | const listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
|
28373 | listeners.forEach((listener) => listener(componentRef));
|
28374 | }
|
28375 | _unloadComponent(componentRef) {
|
28376 | this.detachView(componentRef.hostView);
|
28377 | remove(this.components, componentRef);
|
28378 | }
|
28379 |
|
28380 | ngOnDestroy() {
|
28381 |
|
28382 | this._views.slice().forEach((view) => view.destroy());
|
28383 | }
|
28384 | |
28385 |
|
28386 |
|
28387 | get viewCount() {
|
28388 | return this._views.length;
|
28389 | }
|
28390 | }
|
28391 | ApplicationRef.decorators = [
|
28392 | { type: Injectable }
|
28393 | ];
|
28394 | ApplicationRef.ctorParameters = () => [
|
28395 | { type: NgZone },
|
28396 | { type: Console },
|
28397 | { type: Injector },
|
28398 | { type: ErrorHandler },
|
28399 | { type: ComponentFactoryResolver },
|
28400 | { type: ApplicationInitStatus }
|
28401 | ];
|
28402 | function remove(list, el) {
|
28403 | const index = list.indexOf(el);
|
28404 | if (index > -1) {
|
28405 | list.splice(index, 1);
|
28406 | }
|
28407 | }
|
28408 | function _lastDefined(args) {
|
28409 | for (let i = args.length - 1; i >= 0; i--) {
|
28410 | if (args[i] !== undefined) {
|
28411 | return args[i];
|
28412 | }
|
28413 | }
|
28414 | return undefined;
|
28415 | }
|
28416 | function _mergeArrays(parts) {
|
28417 | const result = [];
|
28418 | parts.forEach((part) => part && result.push(...part));
|
28419 | return result;
|
28420 | }
|
28421 |
|
28422 |
|
28423 |
|
28424 |
|
28425 |
|
28426 |
|
28427 |
|
28428 |
|
28429 |
|
28430 |
|
28431 |
|
28432 |
|
28433 |
|
28434 |
|
28435 |
|
28436 |
|
28437 |
|
28438 |
|
28439 |
|
28440 |
|
28441 |
|
28442 |
|
28443 |
|
28444 |
|
28445 |
|
28446 |
|
28447 |
|
28448 |
|
28449 |
|
28450 |
|
28451 |
|
28452 | class NgModuleFactoryLoader {
|
28453 | }
|
28454 | function getModuleFactory__PRE_R3__(id) {
|
28455 | const factory = getRegisteredNgModuleType(id);
|
28456 | if (!factory)
|
28457 | throw noModuleError(id);
|
28458 | return factory;
|
28459 | }
|
28460 | function getModuleFactory__POST_R3__(id) {
|
28461 | const type = getRegisteredNgModuleType(id);
|
28462 | if (!type)
|
28463 | throw noModuleError(id);
|
28464 | return new NgModuleFactory$1(type);
|
28465 | }
|
28466 |
|
28467 |
|
28468 |
|
28469 |
|
28470 |
|
28471 |
|
28472 | const getModuleFactory = getModuleFactory__PRE_R3__;
|
28473 | function noModuleError(id) {
|
28474 | return new Error(`No module with ID ${id} loaded`);
|
28475 | }
|
28476 |
|
28477 |
|
28478 |
|
28479 |
|
28480 |
|
28481 |
|
28482 |
|
28483 |
|
28484 | const _SEPARATOR = '#';
|
28485 | const FACTORY_CLASS_SUFFIX = 'NgFactory';
|
28486 |
|
28487 |
|
28488 |
|
28489 |
|
28490 |
|
28491 |
|
28492 |
|
28493 |
|
28494 | class SystemJsNgModuleLoaderConfig {
|
28495 | }
|
28496 | const DEFAULT_CONFIG = {
|
28497 | factoryPathPrefix: '',
|
28498 | factoryPathSuffix: '.ngfactory',
|
28499 | };
|
28500 |
|
28501 |
|
28502 |
|
28503 |
|
28504 |
|
28505 |
|
28506 | class SystemJsNgModuleLoader {
|
28507 | constructor(_compiler, config) {
|
28508 | this._compiler = _compiler;
|
28509 | this._config = config || DEFAULT_CONFIG;
|
28510 | }
|
28511 | load(path) {
|
28512 | const legacyOfflineMode = !ivyEnabled && this._compiler instanceof Compiler;
|
28513 | return legacyOfflineMode ? this.loadFactory(path) : this.loadAndCompile(path);
|
28514 | }
|
28515 | loadAndCompile(path) {
|
28516 | let [module, exportName] = path.split(_SEPARATOR);
|
28517 | if (exportName === undefined) {
|
28518 | exportName = 'default';
|
28519 | }
|
28520 | return System.import(module)
|
28521 | .then((module) => module[exportName])
|
28522 | .then((type) => checkNotEmpty(type, module, exportName))
|
28523 | .then((type) => this._compiler.compileModuleAsync(type));
|
28524 | }
|
28525 | loadFactory(path) {
|
28526 | let [module, exportName] = path.split(_SEPARATOR);
|
28527 | let factoryClassSuffix = FACTORY_CLASS_SUFFIX;
|
28528 | if (exportName === undefined) {
|
28529 | exportName = 'default';
|
28530 | factoryClassSuffix = '';
|
28531 | }
|
28532 | return System.import(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
|
28533 | .then((module) => module[exportName + factoryClassSuffix])
|
28534 | .then((factory) => checkNotEmpty(factory, module, exportName));
|
28535 | }
|
28536 | }
|
28537 | SystemJsNgModuleLoader.decorators = [
|
28538 | { type: Injectable }
|
28539 | ];
|
28540 | SystemJsNgModuleLoader.ctorParameters = () => [
|
28541 | { type: Compiler },
|
28542 | { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional }] }
|
28543 | ];
|
28544 | function checkNotEmpty(value, modulePath, exportName) {
|
28545 | if (!value) {
|
28546 | throw new Error(`Cannot find '${exportName}' in '${modulePath}'`);
|
28547 | }
|
28548 | return value;
|
28549 | }
|
28550 |
|
28551 |
|
28552 |
|
28553 |
|
28554 |
|
28555 |
|
28556 |
|
28557 |
|
28558 |
|
28559 |
|
28560 |
|
28561 |
|
28562 |
|
28563 |
|
28564 |
|
28565 | class ViewRef$1 extends ChangeDetectorRef {
|
28566 | }
|
28567 |
|
28568 |
|
28569 |
|
28570 |
|
28571 |
|
28572 |
|
28573 |
|
28574 |
|
28575 |
|
28576 |
|
28577 |
|
28578 |
|
28579 |
|
28580 |
|
28581 |
|
28582 |
|
28583 |
|
28584 |
|
28585 |
|
28586 |
|
28587 |
|
28588 |
|
28589 |
|
28590 |
|
28591 |
|
28592 |
|
28593 |
|
28594 |
|
28595 |
|
28596 |
|
28597 |
|
28598 |
|
28599 |
|
28600 |
|
28601 |
|
28602 |
|
28603 |
|
28604 |
|
28605 |
|
28606 |
|
28607 |
|
28608 |
|
28609 |
|
28610 |
|
28611 |
|
28612 |
|
28613 |
|
28614 |
|
28615 |
|
28616 |
|
28617 |
|
28618 |
|
28619 |
|
28620 | class EmbeddedViewRef extends ViewRef$1 {
|
28621 | }
|
28622 |
|
28623 |
|
28624 |
|
28625 |
|
28626 |
|
28627 |
|
28628 |
|
28629 |
|
28630 |
|
28631 |
|
28632 |
|
28633 |
|
28634 |
|
28635 |
|
28636 |
|
28637 |
|
28638 |
|
28639 |
|
28640 |
|
28641 | class DebugEventListener {
|
28642 | constructor(name, callback) {
|
28643 | this.name = name;
|
28644 | this.callback = callback;
|
28645 | }
|
28646 | }
|
28647 | class DebugNode__PRE_R3__ {
|
28648 | constructor(nativeNode, parent, _debugContext) {
|
28649 | this.listeners = [];
|
28650 | this.parent = null;
|
28651 | this._debugContext = _debugContext;
|
28652 | this.nativeNode = nativeNode;
|
28653 | if (parent && parent instanceof DebugElement__PRE_R3__) {
|
28654 | parent.addChild(this);
|
28655 | }
|
28656 | }
|
28657 | get injector() {
|
28658 | return this._debugContext.injector;
|
28659 | }
|
28660 | get componentInstance() {
|
28661 | return this._debugContext.component;
|
28662 | }
|
28663 | get context() {
|
28664 | return this._debugContext.context;
|
28665 | }
|
28666 | get references() {
|
28667 | return this._debugContext.references;
|
28668 | }
|
28669 | get providerTokens() {
|
28670 | return this._debugContext.providerTokens;
|
28671 | }
|
28672 | }
|
28673 | class DebugElement__PRE_R3__ extends DebugNode__PRE_R3__ {
|
28674 | constructor(nativeNode, parent, _debugContext) {
|
28675 | super(nativeNode, parent, _debugContext);
|
28676 | this.properties = {};
|
28677 | this.attributes = {};
|
28678 | this.classes = {};
|
28679 | this.styles = {};
|
28680 | this.childNodes = [];
|
28681 | this.nativeElement = nativeNode;
|
28682 | }
|
28683 | addChild(child) {
|
28684 | if (child) {
|
28685 | this.childNodes.push(child);
|
28686 | child.parent = this;
|
28687 | }
|
28688 | }
|
28689 | removeChild(child) {
|
28690 | const childIndex = this.childNodes.indexOf(child);
|
28691 | if (childIndex !== -1) {
|
28692 | child.parent = null;
|
28693 | this.childNodes.splice(childIndex, 1);
|
28694 | }
|
28695 | }
|
28696 | insertChildrenAfter(child, newChildren) {
|
28697 | const siblingIndex = this.childNodes.indexOf(child);
|
28698 | if (siblingIndex !== -1) {
|
28699 | this.childNodes.splice(siblingIndex + 1, 0, ...newChildren);
|
28700 | newChildren.forEach(c => {
|
28701 | if (c.parent) {
|
28702 | c.parent.removeChild(c);
|
28703 | }
|
28704 | child.parent = this;
|
28705 | });
|
28706 | }
|
28707 | }
|
28708 | insertBefore(refChild, newChild) {
|
28709 | const refIndex = this.childNodes.indexOf(refChild);
|
28710 | if (refIndex === -1) {
|
28711 | this.addChild(newChild);
|
28712 | }
|
28713 | else {
|
28714 | if (newChild.parent) {
|
28715 | newChild.parent.removeChild(newChild);
|
28716 | }
|
28717 | newChild.parent = this;
|
28718 | this.childNodes.splice(refIndex, 0, newChild);
|
28719 | }
|
28720 | }
|
28721 | query(predicate) {
|
28722 | const results = this.queryAll(predicate);
|
28723 | return results[0] || null;
|
28724 | }
|
28725 | queryAll(predicate) {
|
28726 | const matches = [];
|
28727 | _queryElementChildren(this, predicate, matches);
|
28728 | return matches;
|
28729 | }
|
28730 | queryAllNodes(predicate) {
|
28731 | const matches = [];
|
28732 | _queryNodeChildren(this, predicate, matches);
|
28733 | return matches;
|
28734 | }
|
28735 | get children() {
|
28736 | return this.childNodes
|
28737 | .filter((node) => node instanceof DebugElement__PRE_R3__);
|
28738 | }
|
28739 | triggerEventHandler(eventName, eventObj) {
|
28740 | this.listeners.forEach((listener) => {
|
28741 | if (listener.name == eventName) {
|
28742 | listener.callback(eventObj);
|
28743 | }
|
28744 | });
|
28745 | }
|
28746 | }
|
28747 |
|
28748 |
|
28749 |
|
28750 | function asNativeElements(debugEls) {
|
28751 | return debugEls.map((el) => el.nativeElement);
|
28752 | }
|
28753 | function _queryElementChildren(element, predicate, matches) {
|
28754 | element.childNodes.forEach(node => {
|
28755 | if (node instanceof DebugElement__PRE_R3__) {
|
28756 | if (predicate(node)) {
|
28757 | matches.push(node);
|
28758 | }
|
28759 | _queryElementChildren(node, predicate, matches);
|
28760 | }
|
28761 | });
|
28762 | }
|
28763 | function _queryNodeChildren(parentNode, predicate, matches) {
|
28764 | if (parentNode instanceof DebugElement__PRE_R3__) {
|
28765 | parentNode.childNodes.forEach(node => {
|
28766 | if (predicate(node)) {
|
28767 | matches.push(node);
|
28768 | }
|
28769 | if (node instanceof DebugElement__PRE_R3__) {
|
28770 | _queryNodeChildren(node, predicate, matches);
|
28771 | }
|
28772 | });
|
28773 | }
|
28774 | }
|
28775 | class DebugNode__POST_R3__ {
|
28776 | constructor(nativeNode) {
|
28777 | this.nativeNode = nativeNode;
|
28778 | }
|
28779 | get parent() {
|
28780 | const parent = this.nativeNode.parentNode;
|
28781 | return parent ? new DebugElement__POST_R3__(parent) : null;
|
28782 | }
|
28783 | get injector() {
|
28784 | return getInjector(this.nativeNode);
|
28785 | }
|
28786 | get componentInstance() {
|
28787 | const nativeElement = this.nativeNode;
|
28788 | return nativeElement &&
|
28789 | (getComponent(nativeElement) || getOwningComponent(nativeElement));
|
28790 | }
|
28791 | get context() {
|
28792 | return getComponent(this.nativeNode) || getContext(this.nativeNode);
|
28793 | }
|
28794 | get listeners() {
|
28795 | return getListeners(this.nativeNode).filter(listener => listener.type === 'dom');
|
28796 | }
|
28797 | get references() {
|
28798 | return getLocalRefs(this.nativeNode);
|
28799 | }
|
28800 | get providerTokens() {
|
28801 | return getInjectionTokens(this.nativeNode);
|
28802 | }
|
28803 | }
|
28804 | class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
28805 | constructor(nativeNode) {
|
28806 | ngDevMode && assertDomNode(nativeNode);
|
28807 | super(nativeNode);
|
28808 | }
|
28809 | get nativeElement() {
|
28810 | return this.nativeNode.nodeType == Node.ELEMENT_NODE ? this.nativeNode : null;
|
28811 | }
|
28812 | get name() {
|
28813 | try {
|
28814 | const context = loadLContext(this.nativeNode);
|
28815 | const lView = context.lView;
|
28816 | const tData = lView[TVIEW].data;
|
28817 | const tNode = tData[context.nodeIndex];
|
28818 | return tNode.tagName;
|
28819 | }
|
28820 | catch (e) {
|
28821 | return this.nativeNode.nodeName;
|
28822 | }
|
28823 | }
|
28824 | |
28825 |
|
28826 |
|
28827 |
|
28828 |
|
28829 |
|
28830 |
|
28831 |
|
28832 |
|
28833 |
|
28834 |
|
28835 |
|
28836 | get properties() {
|
28837 | const context = loadLContext(this.nativeNode, false);
|
28838 | if (context == null) {
|
28839 | return {};
|
28840 | }
|
28841 | const lView = context.lView;
|
28842 | const tData = lView[TVIEW].data;
|
28843 | const tNode = tData[context.nodeIndex];
|
28844 | const properties = {};
|
28845 |
|
28846 | copyDomProperties(this.nativeElement, properties);
|
28847 |
|
28848 |
|
28849 | collectPropertyBindings(properties, tNode, lView, tData);
|
28850 | return properties;
|
28851 | }
|
28852 | get attributes() {
|
28853 | const attributes = {};
|
28854 | const element = this.nativeElement;
|
28855 | if (!element) {
|
28856 | return attributes;
|
28857 | }
|
28858 | const context = loadLContext(element, false);
|
28859 | if (context == null) {
|
28860 | return {};
|
28861 | }
|
28862 | const lView = context.lView;
|
28863 | const tNodeAttrs = lView[TVIEW].data[context.nodeIndex].attrs;
|
28864 | const lowercaseTNodeAttrs = [];
|
28865 |
|
28866 |
|
28867 |
|
28868 |
|
28869 |
|
28870 |
|
28871 |
|
28872 | if (tNodeAttrs) {
|
28873 | let i = 0;
|
28874 | while (i < tNodeAttrs.length) {
|
28875 | const attrName = tNodeAttrs[i];
|
28876 |
|
28877 |
|
28878 | if (typeof attrName !== 'string')
|
28879 | break;
|
28880 | const attrValue = tNodeAttrs[i + 1];
|
28881 | attributes[attrName] = attrValue;
|
28882 | lowercaseTNodeAttrs.push(attrName.toLowerCase());
|
28883 | i += 2;
|
28884 | }
|
28885 | }
|
28886 | const eAttrs = element.attributes;
|
28887 | for (let i = 0; i < eAttrs.length; i++) {
|
28888 | const attr = eAttrs[i];
|
28889 | const lowercaseName = attr.name.toLowerCase();
|
28890 |
|
28891 |
|
28892 | if (lowercaseTNodeAttrs.indexOf(lowercaseName) === -1) {
|
28893 |
|
28894 |
|
28895 | attributes[lowercaseName] = attr.value;
|
28896 | }
|
28897 | }
|
28898 | return attributes;
|
28899 | }
|
28900 | get styles() {
|
28901 | if (this.nativeElement && this.nativeElement.style) {
|
28902 | return this.nativeElement.style;
|
28903 | }
|
28904 | return {};
|
28905 | }
|
28906 | get classes() {
|
28907 | const result = {};
|
28908 | const element = this.nativeElement;
|
28909 |
|
28910 | const className = element.className;
|
28911 | const classes = className && typeof className !== 'string' ? className.baseVal.split(' ') :
|
28912 | className.split(' ');
|
28913 | classes.forEach((value) => result[value] = true);
|
28914 | return result;
|
28915 | }
|
28916 | get childNodes() {
|
28917 | const childNodes = this.nativeNode.childNodes;
|
28918 | const children = [];
|
28919 | for (let i = 0; i < childNodes.length; i++) {
|
28920 | const element = childNodes[i];
|
28921 | children.push(getDebugNode__POST_R3__(element));
|
28922 | }
|
28923 | return children;
|
28924 | }
|
28925 | get children() {
|
28926 | const nativeElement = this.nativeElement;
|
28927 | if (!nativeElement)
|
28928 | return [];
|
28929 | const childNodes = nativeElement.children;
|
28930 | const children = [];
|
28931 | for (let i = 0; i < childNodes.length; i++) {
|
28932 | const element = childNodes[i];
|
28933 | children.push(getDebugNode__POST_R3__(element));
|
28934 | }
|
28935 | return children;
|
28936 | }
|
28937 | query(predicate) {
|
28938 | const results = this.queryAll(predicate);
|
28939 | return results[0] || null;
|
28940 | }
|
28941 | queryAll(predicate) {
|
28942 | const matches = [];
|
28943 | _queryAllR3(this, predicate, matches, true);
|
28944 | return matches;
|
28945 | }
|
28946 | queryAllNodes(predicate) {
|
28947 | const matches = [];
|
28948 | _queryAllR3(this, predicate, matches, false);
|
28949 | return matches;
|
28950 | }
|
28951 | triggerEventHandler(eventName, eventObj) {
|
28952 | const node = this.nativeNode;
|
28953 | const invokedListeners = [];
|
28954 | this.listeners.forEach(listener => {
|
28955 | if (listener.name === eventName) {
|
28956 | const callback = listener.callback;
|
28957 | callback.call(node, eventObj);
|
28958 | invokedListeners.push(callback);
|
28959 | }
|
28960 | });
|
28961 |
|
28962 |
|
28963 | if (typeof node.eventListeners === 'function') {
|
28964 |
|
28965 |
|
28966 |
|
28967 | node.eventListeners(eventName).forEach((listener) => {
|
28968 |
|
28969 |
|
28970 |
|
28971 |
|
28972 |
|
28973 |
|
28974 | if (listener.toString().indexOf('__ngUnwrap__') !== -1) {
|
28975 | const unwrappedListener = listener('__ngUnwrap__');
|
28976 | return invokedListeners.indexOf(unwrappedListener) === -1 &&
|
28977 | unwrappedListener.call(node, eventObj);
|
28978 | }
|
28979 | });
|
28980 | }
|
28981 | }
|
28982 | }
|
28983 | function copyDomProperties(element, properties) {
|
28984 | if (element) {
|
28985 |
|
28986 | let obj = Object.getPrototypeOf(element);
|
28987 | const NodePrototype = Node.prototype;
|
28988 | while (obj !== null && obj !== NodePrototype) {
|
28989 | const descriptors = Object.getOwnPropertyDescriptors(obj);
|
28990 | for (let key in descriptors) {
|
28991 | if (!key.startsWith('__') && !key.startsWith('on')) {
|
28992 |
|
28993 |
|
28994 |
|
28995 | const value = element[key];
|
28996 | if (isPrimitiveValue(value)) {
|
28997 | properties[key] = value;
|
28998 | }
|
28999 | }
|
29000 | }
|
29001 | obj = Object.getPrototypeOf(obj);
|
29002 | }
|
29003 | }
|
29004 | }
|
29005 | function isPrimitiveValue(value) {
|
29006 | return typeof value === 'string' || typeof value === 'boolean' || typeof value === 'number' ||
|
29007 | value === null;
|
29008 | }
|
29009 | function _queryAllR3(parentElement, predicate, matches, elementsOnly) {
|
29010 | const context = loadLContext(parentElement.nativeNode, false);
|
29011 | if (context !== null) {
|
29012 | const parentTNode = context.lView[TVIEW].data[context.nodeIndex];
|
29013 | _queryNodeChildrenR3(parentTNode, context.lView, predicate, matches, elementsOnly, parentElement.nativeNode);
|
29014 | }
|
29015 | else {
|
29016 |
|
29017 |
|
29018 | _queryNativeNodeDescendants(parentElement.nativeNode, predicate, matches, elementsOnly);
|
29019 | }
|
29020 | }
|
29021 |
|
29022 |
|
29023 |
|
29024 |
|
29025 |
|
29026 |
|
29027 |
|
29028 |
|
29029 |
|
29030 |
|
29031 | function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, rootNativeNode) {
|
29032 | const nativeNode = getNativeByTNodeOrNull(tNode, lView);
|
29033 |
|
29034 | if (tNode.type === 3 || tNode.type === 4 ) {
|
29035 |
|
29036 |
|
29037 | _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
|
29038 | if (isComponentHost(tNode)) {
|
29039 |
|
29040 |
|
29041 | const componentView = getComponentLViewByIndex(tNode.index, lView);
|
29042 | if (componentView && componentView[TVIEW].firstChild) {
|
29043 | _queryNodeChildrenR3(componentView[TVIEW].firstChild, componentView, predicate, matches, elementsOnly, rootNativeNode);
|
29044 | }
|
29045 | }
|
29046 | else {
|
29047 | if (tNode.child) {
|
29048 |
|
29049 | _queryNodeChildrenR3(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
|
29050 | }
|
29051 |
|
29052 |
|
29053 |
|
29054 |
|
29055 |
|
29056 |
|
29057 |
|
29058 |
|
29059 | nativeNode && _queryNativeNodeDescendants(nativeNode, predicate, matches, elementsOnly);
|
29060 | }
|
29061 |
|
29062 |
|
29063 | const nodeOrContainer = lView[tNode.index];
|
29064 | if (isLContainer(nodeOrContainer)) {
|
29065 | _queryNodeChildrenInContainerR3(nodeOrContainer, predicate, matches, elementsOnly, rootNativeNode);
|
29066 | }
|
29067 | }
|
29068 | else if (tNode.type === 0 ) {
|
29069 |
|
29070 |
|
29071 | const lContainer = lView[tNode.index];
|
29072 | _addQueryMatchR3(lContainer[NATIVE], predicate, matches, elementsOnly, rootNativeNode);
|
29073 |
|
29074 | _queryNodeChildrenInContainerR3(lContainer, predicate, matches, elementsOnly, rootNativeNode);
|
29075 | }
|
29076 | else if (tNode.type === 1 ) {
|
29077 |
|
29078 |
|
29079 | const componentView = lView[DECLARATION_COMPONENT_VIEW];
|
29080 | const componentHost = componentView[T_HOST];
|
29081 | const head = componentHost.projection[tNode.projection];
|
29082 | if (Array.isArray(head)) {
|
29083 | for (let nativeNode of head) {
|
29084 | _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
|
29085 | }
|
29086 | }
|
29087 | else if (head) {
|
29088 | const nextLView = componentView[PARENT];
|
29089 | const nextTNode = nextLView[TVIEW].data[head.index];
|
29090 | _queryNodeChildrenR3(nextTNode, nextLView, predicate, matches, elementsOnly, rootNativeNode);
|
29091 | }
|
29092 | }
|
29093 | else if (tNode.child) {
|
29094 |
|
29095 | _queryNodeChildrenR3(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
|
29096 | }
|
29097 |
|
29098 | if (rootNativeNode !== nativeNode) {
|
29099 |
|
29100 |
|
29101 | const nextTNode = (tNode.flags & 4 ) ? tNode.projectionNext : tNode.next;
|
29102 | if (nextTNode) {
|
29103 | _queryNodeChildrenR3(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
|
29104 | }
|
29105 | }
|
29106 | }
|
29107 |
|
29108 |
|
29109 |
|
29110 |
|
29111 |
|
29112 |
|
29113 |
|
29114 |
|
29115 |
|
29116 | function _queryNodeChildrenInContainerR3(lContainer, predicate, matches, elementsOnly, rootNativeNode) {
|
29117 | for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
29118 | const childView = lContainer[i];
|
29119 | _queryNodeChildrenR3(childView[TVIEW].node, childView, predicate, matches, elementsOnly, rootNativeNode);
|
29120 | }
|
29121 | }
|
29122 |
|
29123 |
|
29124 |
|
29125 |
|
29126 |
|
29127 |
|
29128 |
|
29129 |
|
29130 |
|
29131 | function _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode) {
|
29132 | if (rootNativeNode !== nativeNode) {
|
29133 | const debugNode = getDebugNode$1(nativeNode);
|
29134 | if (!debugNode) {
|
29135 | return;
|
29136 | }
|
29137 |
|
29138 |
|
29139 |
|
29140 | if (elementsOnly && debugNode instanceof DebugElement__POST_R3__ && predicate(debugNode) &&
|
29141 | matches.indexOf(debugNode) === -1) {
|
29142 | matches.push(debugNode);
|
29143 | }
|
29144 | else if (!elementsOnly && predicate(debugNode) &&
|
29145 | matches.indexOf(debugNode) === -1) {
|
29146 | matches.push(debugNode);
|
29147 | }
|
29148 | }
|
29149 | }
|
29150 |
|
29151 |
|
29152 |
|
29153 |
|
29154 |
|
29155 |
|
29156 |
|
29157 |
|
29158 | function _queryNativeNodeDescendants(parentNode, predicate, matches, elementsOnly) {
|
29159 | const nodes = parentNode.childNodes;
|
29160 | const length = nodes.length;
|
29161 | for (let i = 0; i < length; i++) {
|
29162 | const node = nodes[i];
|
29163 | const debugNode = getDebugNode$1(node);
|
29164 | if (debugNode) {
|
29165 | if (elementsOnly && debugNode instanceof DebugElement__POST_R3__ && predicate(debugNode) &&
|
29166 | matches.indexOf(debugNode) === -1) {
|
29167 | matches.push(debugNode);
|
29168 | }
|
29169 | else if (!elementsOnly && predicate(debugNode) &&
|
29170 | matches.indexOf(debugNode) === -1) {
|
29171 | matches.push(debugNode);
|
29172 | }
|
29173 | _queryNativeNodeDescendants(node, predicate, matches, elementsOnly);
|
29174 | }
|
29175 | }
|
29176 | }
|
29177 |
|
29178 |
|
29179 |
|
29180 |
|
29181 |
|
29182 | function collectPropertyBindings(properties, tNode, lView, tData) {
|
29183 | let bindingIndexes = tNode.propertyBindings;
|
29184 | if (bindingIndexes !== null) {
|
29185 | for (let i = 0; i < bindingIndexes.length; i++) {
|
29186 | const bindingIndex = bindingIndexes[i];
|
29187 | const propMetadata = tData[bindingIndex];
|
29188 | const metadataParts = propMetadata.split(INTERPOLATION_DELIMITER);
|
29189 | const propertyName = metadataParts[0];
|
29190 | if (metadataParts.length > 1) {
|
29191 | let value = metadataParts[1];
|
29192 | for (let j = 1; j < metadataParts.length - 1; j++) {
|
29193 | value += renderStringify(lView[bindingIndex + j - 1]) + metadataParts[j + 1];
|
29194 | }
|
29195 | properties[propertyName] = value;
|
29196 | }
|
29197 | else {
|
29198 | properties[propertyName] = lView[bindingIndex];
|
29199 | }
|
29200 | }
|
29201 | }
|
29202 | }
|
29203 |
|
29204 | const _nativeNodeToDebugNode = new Map();
|
29205 | function getDebugNode__PRE_R3__(nativeNode) {
|
29206 | return _nativeNodeToDebugNode.get(nativeNode) || null;
|
29207 | }
|
29208 | const NG_DEBUG_PROPERTY = '__ng_debug__';
|
29209 | function getDebugNode__POST_R3__(nativeNode) {
|
29210 | if (nativeNode instanceof Node) {
|
29211 | if (!(nativeNode.hasOwnProperty(NG_DEBUG_PROPERTY))) {
|
29212 | nativeNode[NG_DEBUG_PROPERTY] = nativeNode.nodeType == Node.ELEMENT_NODE ?
|
29213 | new DebugElement__POST_R3__(nativeNode) :
|
29214 | new DebugNode__POST_R3__(nativeNode);
|
29215 | }
|
29216 | return nativeNode[NG_DEBUG_PROPERTY];
|
29217 | }
|
29218 | return null;
|
29219 | }
|
29220 |
|
29221 |
|
29222 |
|
29223 | const getDebugNode$1 = getDebugNode__PRE_R3__;
|
29224 | function getDebugNodeR2__PRE_R3__(nativeNode) {
|
29225 | return getDebugNode__PRE_R3__(nativeNode);
|
29226 | }
|
29227 | function getDebugNodeR2__POST_R3__(_nativeNode) {
|
29228 | return null;
|
29229 | }
|
29230 | const getDebugNodeR2 = getDebugNodeR2__PRE_R3__;
|
29231 | function getAllDebugNodes() {
|
29232 | return Array.from(_nativeNodeToDebugNode.values());
|
29233 | }
|
29234 | function indexDebugNode(node) {
|
29235 | _nativeNodeToDebugNode.set(node.nativeNode, node);
|
29236 | }
|
29237 | function removeDebugNodeFromIndex(node) {
|
29238 | _nativeNodeToDebugNode.delete(node.nativeNode);
|
29239 | }
|
29240 |
|
29241 |
|
29242 |
|
29243 | const DebugNode = DebugNode__PRE_R3__;
|
29244 |
|
29245 |
|
29246 |
|
29247 | const DebugElement = DebugElement__PRE_R3__;
|
29248 |
|
29249 |
|
29250 |
|
29251 |
|
29252 |
|
29253 |
|
29254 |
|
29255 |
|
29256 |
|
29257 |
|
29258 |
|
29259 |
|
29260 |
|
29261 |
|
29262 |
|
29263 |
|
29264 | const _CORE_PLATFORM_PROVIDERS = [
|
29265 |
|
29266 | { provide: PLATFORM_ID, useValue: 'unknown' },
|
29267 | { provide: PlatformRef, deps: [Injector] },
|
29268 | { provide: TestabilityRegistry, deps: [] },
|
29269 | { provide: Console, deps: [] },
|
29270 | ];
|
29271 |
|
29272 |
|
29273 |
|
29274 |
|
29275 |
|
29276 | const platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
|
29277 |
|
29278 |
|
29279 |
|
29280 |
|
29281 |
|
29282 |
|
29283 |
|
29284 |
|
29285 | function _iterableDiffersFactory() {
|
29286 | return defaultIterableDiffers;
|
29287 | }
|
29288 | function _keyValueDiffersFactory() {
|
29289 | return defaultKeyValueDiffers;
|
29290 | }
|
29291 | function _localeFactory(locale) {
|
29292 | locale = locale || getGlobalLocale();
|
29293 | if (ivyEnabled) {
|
29294 | setLocaleId(locale);
|
29295 | }
|
29296 | return locale;
|
29297 | }
|
29298 |
|
29299 |
|
29300 |
|
29301 |
|
29302 |
|
29303 |
|
29304 | function getGlobalLocale() {
|
29305 | if (typeof ngI18nClosureMode !== 'undefined' && ngI18nClosureMode &&
|
29306 | typeof goog !== 'undefined' && goog.LOCALE !== 'en') {
|
29307 |
|
29308 |
|
29309 |
|
29310 | return goog.LOCALE;
|
29311 | }
|
29312 | else {
|
29313 |
|
29314 |
|
29315 |
|
29316 |
|
29317 |
|
29318 |
|
29319 |
|
29320 |
|
29321 |
|
29322 | return (ivyEnabled && typeof $localize !== 'undefined' && $localize.locale) ||
|
29323 | DEFAULT_LOCALE_ID;
|
29324 | }
|
29325 | }
|
29326 | const ɵ0$g = USD_CURRENCY_CODE;
|
29327 |
|
29328 |
|
29329 |
|
29330 |
|
29331 | const APPLICATION_MODULE_PROVIDERS = [
|
29332 | {
|
29333 | provide: ApplicationRef,
|
29334 | useClass: ApplicationRef,
|
29335 | deps: [NgZone, Console, Injector, ErrorHandler, ComponentFactoryResolver, ApplicationInitStatus]
|
29336 | },
|
29337 | { provide: SCHEDULER, deps: [NgZone], useFactory: zoneSchedulerFactory },
|
29338 | {
|
29339 | provide: ApplicationInitStatus,
|
29340 | useClass: ApplicationInitStatus,
|
29341 | deps: [[new Optional(), APP_INITIALIZER]]
|
29342 | },
|
29343 | { provide: Compiler, useClass: Compiler, deps: [] },
|
29344 | APP_ID_RANDOM_PROVIDER,
|
29345 | { provide: IterableDiffers, useFactory: _iterableDiffersFactory, deps: [] },
|
29346 | { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory, deps: [] },
|
29347 | {
|
29348 | provide: LOCALE_ID$1,
|
29349 | useFactory: _localeFactory,
|
29350 | deps: [[new Inject(LOCALE_ID$1), new Optional(), new SkipSelf()]]
|
29351 | },
|
29352 | { provide: DEFAULT_CURRENCY_CODE, useValue: ɵ0$g },
|
29353 | ];
|
29354 |
|
29355 |
|
29356 |
|
29357 |
|
29358 |
|
29359 |
|
29360 |
|
29361 |
|
29362 |
|
29363 | function zoneSchedulerFactory(ngZone) {
|
29364 | let queue = [];
|
29365 | ngZone.onStable.subscribe(() => {
|
29366 | while (queue.length) {
|
29367 | queue.pop()();
|
29368 | }
|
29369 | });
|
29370 | return function (fn) {
|
29371 | queue.push(fn);
|
29372 | };
|
29373 | }
|
29374 |
|
29375 |
|
29376 |
|
29377 |
|
29378 |
|
29379 |
|
29380 |
|
29381 |
|
29382 |
|
29383 |
|
29384 | class ApplicationModule {
|
29385 |
|
29386 | constructor(appRef) { }
|
29387 | }
|
29388 | ApplicationModule.decorators = [
|
29389 | { type: NgModule, args: [{ providers: APPLICATION_MODULE_PROVIDERS },] }
|
29390 | ];
|
29391 | ApplicationModule.ctorParameters = () => [
|
29392 | { type: ApplicationRef }
|
29393 | ];
|
29394 |
|
29395 |
|
29396 |
|
29397 |
|
29398 |
|
29399 |
|
29400 |
|
29401 |
|
29402 | function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
|
29403 | flags |= 1 ;
|
29404 | const { matchedQueries, references, matchedQueryIds } = splitMatchedQueriesDsl(matchedQueriesDsl);
|
29405 | const template = templateFactory ? resolveDefinition(templateFactory) : null;
|
29406 | return {
|
29407 |
|
29408 | nodeIndex: -1,
|
29409 | parent: null,
|
29410 | renderParent: null,
|
29411 | bindingIndex: -1,
|
29412 | outputIndex: -1,
|
29413 |
|
29414 | flags,
|
29415 | checkIndex: -1,
|
29416 | childFlags: 0,
|
29417 | directChildFlags: 0,
|
29418 | childMatchedQueries: 0,
|
29419 | matchedQueries,
|
29420 | matchedQueryIds,
|
29421 | references,
|
29422 | ngContentIndex,
|
29423 | childCount,
|
29424 | bindings: [],
|
29425 | bindingFlags: 0,
|
29426 | outputs: [],
|
29427 | element: {
|
29428 | ns: null,
|
29429 | name: null,
|
29430 | attrs: null,
|
29431 | template,
|
29432 | componentProvider: null,
|
29433 | componentView: null,
|
29434 | componentRendererType: null,
|
29435 | publicProviders: null,
|
29436 | allProviders: null,
|
29437 | handleEvent: handleEvent || NOOP
|
29438 | },
|
29439 | provider: null,
|
29440 | text: null,
|
29441 | query: null,
|
29442 | ngContent: null
|
29443 | };
|
29444 | }
|
29445 | function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs = [], bindings, outputs, handleEvent, componentView, componentRendererType) {
|
29446 | if (!handleEvent) {
|
29447 | handleEvent = NOOP;
|
29448 | }
|
29449 | const { matchedQueries, references, matchedQueryIds } = splitMatchedQueriesDsl(matchedQueriesDsl);
|
29450 | let ns = null;
|
29451 | let name = null;
|
29452 | if (namespaceAndName) {
|
29453 | [ns, name] = splitNamespace(namespaceAndName);
|
29454 | }
|
29455 | bindings = bindings || [];
|
29456 | const bindingDefs = [];
|
29457 | for (let i = 0; i < bindings.length; i++) {
|
29458 | const [bindingFlags, namespaceAndName, suffixOrSecurityContext] = bindings[i];
|
29459 | const [ns, name] = splitNamespace(namespaceAndName);
|
29460 | let securityContext = undefined;
|
29461 | let suffix = undefined;
|
29462 | switch (bindingFlags & 15 ) {
|
29463 | case 4 :
|
29464 | suffix = suffixOrSecurityContext;
|
29465 | break;
|
29466 | case 1 :
|
29467 | case 8 :
|
29468 | securityContext = suffixOrSecurityContext;
|
29469 | break;
|
29470 | }
|
29471 | bindingDefs[i] =
|
29472 | { flags: bindingFlags, ns, name, nonMinifiedName: name, securityContext, suffix };
|
29473 | }
|
29474 | outputs = outputs || [];
|
29475 | const outputDefs = [];
|
29476 | for (let i = 0; i < outputs.length; i++) {
|
29477 | const [target, eventName] = outputs[i];
|
29478 | outputDefs[i] =
|
29479 | { type: 0 , target: target, eventName, propName: null };
|
29480 | }
|
29481 | fixedAttrs = fixedAttrs || [];
|
29482 | const attrs = fixedAttrs.map(([namespaceAndName, value]) => {
|
29483 | const [ns, name] = splitNamespace(namespaceAndName);
|
29484 | return [ns, name, value];
|
29485 | });
|
29486 | componentRendererType = resolveRendererType2(componentRendererType);
|
29487 | if (componentView) {
|
29488 | flags |= 33554432 ;
|
29489 | }
|
29490 | flags |= 1 ;
|
29491 | return {
|
29492 |
|
29493 | nodeIndex: -1,
|
29494 | parent: null,
|
29495 | renderParent: null,
|
29496 | bindingIndex: -1,
|
29497 | outputIndex: -1,
|
29498 |
|
29499 | checkIndex,
|
29500 | flags,
|
29501 | childFlags: 0,
|
29502 | directChildFlags: 0,
|
29503 | childMatchedQueries: 0,
|
29504 | matchedQueries,
|
29505 | matchedQueryIds,
|
29506 | references,
|
29507 | ngContentIndex,
|
29508 | childCount,
|
29509 | bindings: bindingDefs,
|
29510 | bindingFlags: calcBindingFlags(bindingDefs),
|
29511 | outputs: outputDefs,
|
29512 | element: {
|
29513 | ns,
|
29514 | name,
|
29515 | attrs,
|
29516 | template: null,
|
29517 |
|
29518 | componentProvider: null,
|
29519 | componentView: componentView || null,
|
29520 | componentRendererType: componentRendererType,
|
29521 | publicProviders: null,
|
29522 | allProviders: null,
|
29523 | handleEvent: handleEvent || NOOP,
|
29524 | },
|
29525 | provider: null,
|
29526 | text: null,
|
29527 | query: null,
|
29528 | ngContent: null
|
29529 | };
|
29530 | }
|
29531 | function createElement(view, renderHost, def) {
|
29532 | const elDef = def.element;
|
29533 | const rootSelectorOrNode = view.root.selectorOrNode;
|
29534 | const renderer = view.renderer;
|
29535 | let el;
|
29536 | if (view.parent || !rootSelectorOrNode) {
|
29537 | if (elDef.name) {
|
29538 | el = renderer.createElement(elDef.name, elDef.ns);
|
29539 | }
|
29540 | else {
|
29541 | el = renderer.createComment('');
|
29542 | }
|
29543 | const parentEl = getParentRenderElement(view, renderHost, def);
|
29544 | if (parentEl) {
|
29545 | renderer.appendChild(parentEl, el);
|
29546 | }
|
29547 | }
|
29548 | else {
|
29549 |
|
29550 | const preserveContent = (!!elDef.componentRendererType &&
|
29551 | elDef.componentRendererType.encapsulation === ViewEncapsulation$1.ShadowDom);
|
29552 | el = renderer.selectRootElement(rootSelectorOrNode, preserveContent);
|
29553 | }
|
29554 | if (elDef.attrs) {
|
29555 | for (let i = 0; i < elDef.attrs.length; i++) {
|
29556 | const [ns, name, value] = elDef.attrs[i];
|
29557 | renderer.setAttribute(el, name, value, ns);
|
29558 | }
|
29559 | }
|
29560 | return el;
|
29561 | }
|
29562 | function listenToElementOutputs(view, compView, def, el) {
|
29563 | for (let i = 0; i < def.outputs.length; i++) {
|
29564 | const output = def.outputs[i];
|
29565 | const handleEventClosure = renderEventHandlerClosure(view, def.nodeIndex, elementEventFullName(output.target, output.eventName));
|
29566 | let listenTarget = output.target;
|
29567 | let listenerView = view;
|
29568 | if (output.target === 'component') {
|
29569 | listenTarget = null;
|
29570 | listenerView = compView;
|
29571 | }
|
29572 | const disposable = listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure);
|
29573 | view.disposables[def.outputIndex + i] = disposable;
|
29574 | }
|
29575 | }
|
29576 | function renderEventHandlerClosure(view, index, eventName) {
|
29577 | return (event) => dispatchEvent(view, index, eventName, event);
|
29578 | }
|
29579 | function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
29580 | const bindLen = def.bindings.length;
|
29581 | let changed = false;
|
29582 | if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
|
29583 | changed = true;
|
29584 | if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
|
29585 | changed = true;
|
29586 | if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
|
29587 | changed = true;
|
29588 | if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
|
29589 | changed = true;
|
29590 | if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
|
29591 | changed = true;
|
29592 | if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
|
29593 | changed = true;
|
29594 | if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
|
29595 | changed = true;
|
29596 | if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
|
29597 | changed = true;
|
29598 | if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
|
29599 | changed = true;
|
29600 | if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
|
29601 | changed = true;
|
29602 | return changed;
|
29603 | }
|
29604 | function checkAndUpdateElementDynamic(view, def, values) {
|
29605 | let changed = false;
|
29606 | for (let i = 0; i < values.length; i++) {
|
29607 | if (checkAndUpdateElementValue(view, def, i, values[i]))
|
29608 | changed = true;
|
29609 | }
|
29610 | return changed;
|
29611 | }
|
29612 | function checkAndUpdateElementValue(view, def, bindingIdx, value) {
|
29613 | if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
|
29614 | return false;
|
29615 | }
|
29616 | const binding = def.bindings[bindingIdx];
|
29617 | const elData = asElementData(view, def.nodeIndex);
|
29618 | const renderNode = elData.renderElement;
|
29619 | const name = binding.name;
|
29620 | switch (binding.flags & 15 ) {
|
29621 | case 1 :
|
29622 | setElementAttribute(view, binding, renderNode, binding.ns, name, value);
|
29623 | break;
|
29624 | case 2 :
|
29625 | setElementClass(view, renderNode, name, value);
|
29626 | break;
|
29627 | case 4 :
|
29628 | setElementStyle(view, binding, renderNode, name, value);
|
29629 | break;
|
29630 | case 8 :
|
29631 | const bindView = (def.flags & 33554432 &&
|
29632 | binding.flags & 32 ) ?
|
29633 | elData.componentView :
|
29634 | view;
|
29635 | setElementProperty(bindView, binding, renderNode, name, value);
|
29636 | break;
|
29637 | }
|
29638 | return true;
|
29639 | }
|
29640 | function setElementAttribute(view, binding, renderNode, ns, name, value) {
|
29641 | const securityContext = binding.securityContext;
|
29642 | let renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
29643 | renderValue = renderValue != null ? renderValue.toString() : null;
|
29644 | const renderer = view.renderer;
|
29645 | if (value != null) {
|
29646 | renderer.setAttribute(renderNode, name, renderValue, ns);
|
29647 | }
|
29648 | else {
|
29649 | renderer.removeAttribute(renderNode, name, ns);
|
29650 | }
|
29651 | }
|
29652 | function setElementClass(view, renderNode, name, value) {
|
29653 | const renderer = view.renderer;
|
29654 | if (value) {
|
29655 | renderer.addClass(renderNode, name);
|
29656 | }
|
29657 | else {
|
29658 | renderer.removeClass(renderNode, name);
|
29659 | }
|
29660 | }
|
29661 | function setElementStyle(view, binding, renderNode, name, value) {
|
29662 | let renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, value);
|
29663 | if (renderValue != null) {
|
29664 | renderValue = renderValue.toString();
|
29665 | const unit = binding.suffix;
|
29666 | if (unit != null) {
|
29667 | renderValue = renderValue + unit;
|
29668 | }
|
29669 | }
|
29670 | else {
|
29671 | renderValue = null;
|
29672 | }
|
29673 | const renderer = view.renderer;
|
29674 | if (renderValue != null) {
|
29675 | renderer.setStyle(renderNode, name, renderValue);
|
29676 | }
|
29677 | else {
|
29678 | renderer.removeStyle(renderNode, name);
|
29679 | }
|
29680 | }
|
29681 | function setElementProperty(view, binding, renderNode, name, value) {
|
29682 | const securityContext = binding.securityContext;
|
29683 | let renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
29684 | view.renderer.setProperty(renderNode, name, renderValue);
|
29685 | }
|
29686 |
|
29687 |
|
29688 |
|
29689 |
|
29690 |
|
29691 |
|
29692 |
|
29693 |
|
29694 | function queryDef(flags, id, bindings) {
|
29695 | let bindingDefs = [];
|
29696 | for (let propName in bindings) {
|
29697 | const bindingType = bindings[propName];
|
29698 | bindingDefs.push({ propName, bindingType });
|
29699 | }
|
29700 | return {
|
29701 |
|
29702 | nodeIndex: -1,
|
29703 | parent: null,
|
29704 | renderParent: null,
|
29705 | bindingIndex: -1,
|
29706 | outputIndex: -1,
|
29707 |
|
29708 |
|
29709 | checkIndex: -1,
|
29710 | flags,
|
29711 | childFlags: 0,
|
29712 | directChildFlags: 0,
|
29713 | childMatchedQueries: 0,
|
29714 | ngContentIndex: -1,
|
29715 | matchedQueries: {},
|
29716 | matchedQueryIds: 0,
|
29717 | references: {},
|
29718 | childCount: 0,
|
29719 | bindings: [],
|
29720 | bindingFlags: 0,
|
29721 | outputs: [],
|
29722 | element: null,
|
29723 | provider: null,
|
29724 | text: null,
|
29725 | query: { id, filterId: filterQueryId(id), bindings: bindingDefs },
|
29726 | ngContent: null
|
29727 | };
|
29728 | }
|
29729 | function createQuery() {
|
29730 | return new QueryList();
|
29731 | }
|
29732 | function dirtyParentQueries(view) {
|
29733 | const queryIds = view.def.nodeMatchedQueries;
|
29734 | while (view.parent && isEmbeddedView(view)) {
|
29735 | let tplDef = view.parentNodeDef;
|
29736 | view = view.parent;
|
29737 |
|
29738 | const end = tplDef.nodeIndex + tplDef.childCount;
|
29739 | for (let i = 0; i <= end; i++) {
|
29740 | const nodeDef = view.def.nodes[i];
|
29741 | if ((nodeDef.flags & 67108864 ) &&
|
29742 | (nodeDef.flags & 536870912 ) &&
|
29743 | (nodeDef.query.filterId & queryIds) === nodeDef.query.filterId) {
|
29744 | asQueryList(view, i).setDirty();
|
29745 | }
|
29746 | if ((nodeDef.flags & 1 && i + nodeDef.childCount < tplDef.nodeIndex) ||
|
29747 | !(nodeDef.childFlags & 67108864 ) ||
|
29748 | !(nodeDef.childFlags & 536870912 )) {
|
29749 |
|
29750 | i += nodeDef.childCount;
|
29751 | }
|
29752 | }
|
29753 | }
|
29754 |
|
29755 | if (view.def.nodeFlags & 134217728 ) {
|
29756 | for (let i = 0; i < view.def.nodes.length; i++) {
|
29757 | const nodeDef = view.def.nodes[i];
|
29758 | if ((nodeDef.flags & 134217728 ) && (nodeDef.flags & 536870912 )) {
|
29759 | asQueryList(view, i).setDirty();
|
29760 | }
|
29761 |
|
29762 | i += nodeDef.childCount;
|
29763 | }
|
29764 | }
|
29765 | }
|
29766 | function checkAndUpdateQuery(view, nodeDef) {
|
29767 | const queryList = asQueryList(view, nodeDef.nodeIndex);
|
29768 | if (!queryList.dirty) {
|
29769 | return;
|
29770 | }
|
29771 | let directiveInstance;
|
29772 | let newValues = undefined;
|
29773 | if (nodeDef.flags & 67108864 ) {
|
29774 | const elementDef = nodeDef.parent.parent;
|
29775 | newValues = calcQueryValues(view, elementDef.nodeIndex, elementDef.nodeIndex + elementDef.childCount, nodeDef.query, []);
|
29776 | directiveInstance = asProviderData(view, nodeDef.parent.nodeIndex).instance;
|
29777 | }
|
29778 | else if (nodeDef.flags & 134217728 ) {
|
29779 | newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, nodeDef.query, []);
|
29780 | directiveInstance = view.component;
|
29781 | }
|
29782 | queryList.reset(newValues);
|
29783 | const bindings = nodeDef.query.bindings;
|
29784 | let notify = false;
|
29785 | for (let i = 0; i < bindings.length; i++) {
|
29786 | const binding = bindings[i];
|
29787 | let boundValue;
|
29788 | switch (binding.bindingType) {
|
29789 | case 0 :
|
29790 | boundValue = queryList.first;
|
29791 | break;
|
29792 | case 1 :
|
29793 | boundValue = queryList;
|
29794 | notify = true;
|
29795 | break;
|
29796 | }
|
29797 | directiveInstance[binding.propName] = boundValue;
|
29798 | }
|
29799 | if (notify) {
|
29800 | queryList.notifyOnChanges();
|
29801 | }
|
29802 | }
|
29803 | function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
|
29804 | for (let i = startIndex; i <= endIndex; i++) {
|
29805 | const nodeDef = view.def.nodes[i];
|
29806 | const valueType = nodeDef.matchedQueries[queryDef.id];
|
29807 | if (valueType != null) {
|
29808 | values.push(getQueryValue(view, nodeDef, valueType));
|
29809 | }
|
29810 | if (nodeDef.flags & 1 && nodeDef.element.template &&
|
29811 | (nodeDef.element.template.nodeMatchedQueries & queryDef.filterId) ===
|
29812 | queryDef.filterId) {
|
29813 | const elementData = asElementData(view, i);
|
29814 |
|
29815 |
|
29816 | if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) {
|
29817 | calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values);
|
29818 | i += nodeDef.childCount;
|
29819 | }
|
29820 | if (nodeDef.flags & 16777216 ) {
|
29821 | const embeddedViews = elementData.viewContainer._embeddedViews;
|
29822 | for (let k = 0; k < embeddedViews.length; k++) {
|
29823 | const embeddedView = embeddedViews[k];
|
29824 | const dvc = declaredViewContainer(embeddedView);
|
29825 | if (dvc && dvc === elementData) {
|
29826 | calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
|
29827 | }
|
29828 | }
|
29829 | }
|
29830 | const projectedViews = elementData.template._projectedViews;
|
29831 | if (projectedViews) {
|
29832 | for (let k = 0; k < projectedViews.length; k++) {
|
29833 | const projectedView = projectedViews[k];
|
29834 | calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
|
29835 | }
|
29836 | }
|
29837 | }
|
29838 | if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
|
29839 |
|
29840 | i += nodeDef.childCount;
|
29841 | }
|
29842 | }
|
29843 | return values;
|
29844 | }
|
29845 | function getQueryValue(view, nodeDef, queryValueType) {
|
29846 | if (queryValueType != null) {
|
29847 |
|
29848 | switch (queryValueType) {
|
29849 | case 1 :
|
29850 | return asElementData(view, nodeDef.nodeIndex).renderElement;
|
29851 | case 0 :
|
29852 | return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement);
|
29853 | case 2 :
|
29854 | return asElementData(view, nodeDef.nodeIndex).template;
|
29855 | case 3 :
|
29856 | return asElementData(view, nodeDef.nodeIndex).viewContainer;
|
29857 | case 4 :
|
29858 | return asProviderData(view, nodeDef.nodeIndex).instance;
|
29859 | }
|
29860 | }
|
29861 | }
|
29862 |
|
29863 |
|
29864 |
|
29865 |
|
29866 |
|
29867 |
|
29868 |
|
29869 |
|
29870 | function ngContentDef(ngContentIndex, index) {
|
29871 | return {
|
29872 |
|
29873 | nodeIndex: -1,
|
29874 | parent: null,
|
29875 | renderParent: null,
|
29876 | bindingIndex: -1,
|
29877 | outputIndex: -1,
|
29878 |
|
29879 | checkIndex: -1,
|
29880 | flags: 8 ,
|
29881 | childFlags: 0,
|
29882 | directChildFlags: 0,
|
29883 | childMatchedQueries: 0,
|
29884 | matchedQueries: {},
|
29885 | matchedQueryIds: 0,
|
29886 | references: {},
|
29887 | ngContentIndex,
|
29888 | childCount: 0,
|
29889 | bindings: [],
|
29890 | bindingFlags: 0,
|
29891 | outputs: [],
|
29892 | element: null,
|
29893 | provider: null,
|
29894 | text: null,
|
29895 | query: null,
|
29896 | ngContent: { index }
|
29897 | };
|
29898 | }
|
29899 | function appendNgContent(view, renderHost, def) {
|
29900 | const parentEl = getParentRenderElement(view, renderHost, def);
|
29901 | if (!parentEl) {
|
29902 |
|
29903 | return;
|
29904 | }
|
29905 | const ngContentIndex = def.ngContent.index;
|
29906 | visitProjectedRenderNodes(view, ngContentIndex, 1 , parentEl, null, undefined);
|
29907 | }
|
29908 |
|
29909 |
|
29910 |
|
29911 |
|
29912 |
|
29913 |
|
29914 |
|
29915 |
|
29916 | function purePipeDef(checkIndex, argCount) {
|
29917 |
|
29918 | return _pureExpressionDef(128 , checkIndex, newArray(argCount + 1));
|
29919 | }
|
29920 | function pureArrayDef(checkIndex, argCount) {
|
29921 | return _pureExpressionDef(32 , checkIndex, newArray(argCount));
|
29922 | }
|
29923 | function pureObjectDef(checkIndex, propToIndex) {
|
29924 | const keys = Object.keys(propToIndex);
|
29925 | const nbKeys = keys.length;
|
29926 | const propertyNames = [];
|
29927 | for (let i = 0; i < nbKeys; i++) {
|
29928 | const key = keys[i];
|
29929 | const index = propToIndex[key];
|
29930 | propertyNames.push(key);
|
29931 | }
|
29932 | return _pureExpressionDef(64 , checkIndex, propertyNames);
|
29933 | }
|
29934 | function _pureExpressionDef(flags, checkIndex, propertyNames) {
|
29935 | const bindings = [];
|
29936 | for (let i = 0; i < propertyNames.length; i++) {
|
29937 | const prop = propertyNames[i];
|
29938 | bindings.push({
|
29939 | flags: 8 ,
|
29940 | name: prop,
|
29941 | ns: null,
|
29942 | nonMinifiedName: prop,
|
29943 | securityContext: null,
|
29944 | suffix: null
|
29945 | });
|
29946 | }
|
29947 | return {
|
29948 |
|
29949 | nodeIndex: -1,
|
29950 | parent: null,
|
29951 | renderParent: null,
|
29952 | bindingIndex: -1,
|
29953 | outputIndex: -1,
|
29954 |
|
29955 | checkIndex,
|
29956 | flags,
|
29957 | childFlags: 0,
|
29958 | directChildFlags: 0,
|
29959 | childMatchedQueries: 0,
|
29960 | matchedQueries: {},
|
29961 | matchedQueryIds: 0,
|
29962 | references: {},
|
29963 | ngContentIndex: -1,
|
29964 | childCount: 0,
|
29965 | bindings,
|
29966 | bindingFlags: calcBindingFlags(bindings),
|
29967 | outputs: [],
|
29968 | element: null,
|
29969 | provider: null,
|
29970 | text: null,
|
29971 | query: null,
|
29972 | ngContent: null
|
29973 | };
|
29974 | }
|
29975 | function createPureExpression(view, def) {
|
29976 | return { value: undefined };
|
29977 | }
|
29978 | function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
29979 | const bindings = def.bindings;
|
29980 | let changed = false;
|
29981 | const bindLen = bindings.length;
|
29982 | if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
29983 | changed = true;
|
29984 | if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
29985 | changed = true;
|
29986 | if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
29987 | changed = true;
|
29988 | if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
29989 | changed = true;
|
29990 | if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
29991 | changed = true;
|
29992 | if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
29993 | changed = true;
|
29994 | if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
29995 | changed = true;
|
29996 | if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
29997 | changed = true;
|
29998 | if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
29999 | changed = true;
|
30000 | if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
30001 | changed = true;
|
30002 | if (changed) {
|
30003 | const data = asPureExpressionData(view, def.nodeIndex);
|
30004 | let value;
|
30005 | switch (def.flags & 201347067 ) {
|
30006 | case 32 :
|
30007 | value = [];
|
30008 | if (bindLen > 0)
|
30009 | value.push(v0);
|
30010 | if (bindLen > 1)
|
30011 | value.push(v1);
|
30012 | if (bindLen > 2)
|
30013 | value.push(v2);
|
30014 | if (bindLen > 3)
|
30015 | value.push(v3);
|
30016 | if (bindLen > 4)
|
30017 | value.push(v4);
|
30018 | if (bindLen > 5)
|
30019 | value.push(v5);
|
30020 | if (bindLen > 6)
|
30021 | value.push(v6);
|
30022 | if (bindLen > 7)
|
30023 | value.push(v7);
|
30024 | if (bindLen > 8)
|
30025 | value.push(v8);
|
30026 | if (bindLen > 9)
|
30027 | value.push(v9);
|
30028 | break;
|
30029 | case 64 :
|
30030 | value = {};
|
30031 | if (bindLen > 0)
|
30032 | value[bindings[0].name] = v0;
|
30033 | if (bindLen > 1)
|
30034 | value[bindings[1].name] = v1;
|
30035 | if (bindLen > 2)
|
30036 | value[bindings[2].name] = v2;
|
30037 | if (bindLen > 3)
|
30038 | value[bindings[3].name] = v3;
|
30039 | if (bindLen > 4)
|
30040 | value[bindings[4].name] = v4;
|
30041 | if (bindLen > 5)
|
30042 | value[bindings[5].name] = v5;
|
30043 | if (bindLen > 6)
|
30044 | value[bindings[6].name] = v6;
|
30045 | if (bindLen > 7)
|
30046 | value[bindings[7].name] = v7;
|
30047 | if (bindLen > 8)
|
30048 | value[bindings[8].name] = v8;
|
30049 | if (bindLen > 9)
|
30050 | value[bindings[9].name] = v9;
|
30051 | break;
|
30052 | case 128 :
|
30053 | const pipe = v0;
|
30054 | switch (bindLen) {
|
30055 | case 1:
|
30056 | value = pipe.transform(v0);
|
30057 | break;
|
30058 | case 2:
|
30059 | value = pipe.transform(v1);
|
30060 | break;
|
30061 | case 3:
|
30062 | value = pipe.transform(v1, v2);
|
30063 | break;
|
30064 | case 4:
|
30065 | value = pipe.transform(v1, v2, v3);
|
30066 | break;
|
30067 | case 5:
|
30068 | value = pipe.transform(v1, v2, v3, v4);
|
30069 | break;
|
30070 | case 6:
|
30071 | value = pipe.transform(v1, v2, v3, v4, v5);
|
30072 | break;
|
30073 | case 7:
|
30074 | value = pipe.transform(v1, v2, v3, v4, v5, v6);
|
30075 | break;
|
30076 | case 8:
|
30077 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
|
30078 | break;
|
30079 | case 9:
|
30080 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
|
30081 | break;
|
30082 | case 10:
|
30083 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
30084 | break;
|
30085 | }
|
30086 | break;
|
30087 | }
|
30088 | data.value = value;
|
30089 | }
|
30090 | return changed;
|
30091 | }
|
30092 | function checkAndUpdatePureExpressionDynamic(view, def, values) {
|
30093 | const bindings = def.bindings;
|
30094 | let changed = false;
|
30095 | for (let i = 0; i < values.length; i++) {
|
30096 |
|
30097 |
|
30098 | if (checkAndUpdateBinding(view, def, i, values[i])) {
|
30099 | changed = true;
|
30100 | }
|
30101 | }
|
30102 | if (changed) {
|
30103 | const data = asPureExpressionData(view, def.nodeIndex);
|
30104 | let value;
|
30105 | switch (def.flags & 201347067 ) {
|
30106 | case 32 :
|
30107 | value = values;
|
30108 | break;
|
30109 | case 64 :
|
30110 | value = {};
|
30111 | for (let i = 0; i < values.length; i++) {
|
30112 | value[bindings[i].name] = values[i];
|
30113 | }
|
30114 | break;
|
30115 | case 128 :
|
30116 | const pipe = values[0];
|
30117 | const params = values.slice(1);
|
30118 | value = pipe.transform(...params);
|
30119 | break;
|
30120 | }
|
30121 | data.value = value;
|
30122 | }
|
30123 | return changed;
|
30124 | }
|
30125 |
|
30126 |
|
30127 |
|
30128 |
|
30129 |
|
30130 |
|
30131 |
|
30132 |
|
30133 | function textDef(checkIndex, ngContentIndex, staticText) {
|
30134 | const bindings = [];
|
30135 | for (let i = 1; i < staticText.length; i++) {
|
30136 | bindings[i - 1] = {
|
30137 | flags: 8 ,
|
30138 | name: null,
|
30139 | ns: null,
|
30140 | nonMinifiedName: null,
|
30141 | securityContext: null,
|
30142 | suffix: staticText[i],
|
30143 | };
|
30144 | }
|
30145 | return {
|
30146 |
|
30147 | nodeIndex: -1,
|
30148 | parent: null,
|
30149 | renderParent: null,
|
30150 | bindingIndex: -1,
|
30151 | outputIndex: -1,
|
30152 |
|
30153 | checkIndex,
|
30154 | flags: 2 ,
|
30155 | childFlags: 0,
|
30156 | directChildFlags: 0,
|
30157 | childMatchedQueries: 0,
|
30158 | matchedQueries: {},
|
30159 | matchedQueryIds: 0,
|
30160 | references: {},
|
30161 | ngContentIndex,
|
30162 | childCount: 0,
|
30163 | bindings,
|
30164 | bindingFlags: 8 ,
|
30165 | outputs: [],
|
30166 | element: null,
|
30167 | provider: null,
|
30168 | text: { prefix: staticText[0] },
|
30169 | query: null,
|
30170 | ngContent: null,
|
30171 | };
|
30172 | }
|
30173 | function createText(view, renderHost, def) {
|
30174 | let renderNode;
|
30175 | const renderer = view.renderer;
|
30176 | renderNode = renderer.createText(def.text.prefix);
|
30177 | const parentEl = getParentRenderElement(view, renderHost, def);
|
30178 | if (parentEl) {
|
30179 | renderer.appendChild(parentEl, renderNode);
|
30180 | }
|
30181 | return { renderText: renderNode };
|
30182 | }
|
30183 | function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
30184 | let changed = false;
|
30185 | const bindings = def.bindings;
|
30186 | const bindLen = bindings.length;
|
30187 | if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
30188 | changed = true;
|
30189 | if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
30190 | changed = true;
|
30191 | if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
30192 | changed = true;
|
30193 | if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
30194 | changed = true;
|
30195 | if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
30196 | changed = true;
|
30197 | if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
30198 | changed = true;
|
30199 | if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
30200 | changed = true;
|
30201 | if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
30202 | changed = true;
|
30203 | if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
30204 | changed = true;
|
30205 | if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
30206 | changed = true;
|
30207 | if (changed) {
|
30208 | let value = def.text.prefix;
|
30209 | if (bindLen > 0)
|
30210 | value += _addInterpolationPart(v0, bindings[0]);
|
30211 | if (bindLen > 1)
|
30212 | value += _addInterpolationPart(v1, bindings[1]);
|
30213 | if (bindLen > 2)
|
30214 | value += _addInterpolationPart(v2, bindings[2]);
|
30215 | if (bindLen > 3)
|
30216 | value += _addInterpolationPart(v3, bindings[3]);
|
30217 | if (bindLen > 4)
|
30218 | value += _addInterpolationPart(v4, bindings[4]);
|
30219 | if (bindLen > 5)
|
30220 | value += _addInterpolationPart(v5, bindings[5]);
|
30221 | if (bindLen > 6)
|
30222 | value += _addInterpolationPart(v6, bindings[6]);
|
30223 | if (bindLen > 7)
|
30224 | value += _addInterpolationPart(v7, bindings[7]);
|
30225 | if (bindLen > 8)
|
30226 | value += _addInterpolationPart(v8, bindings[8]);
|
30227 | if (bindLen > 9)
|
30228 | value += _addInterpolationPart(v9, bindings[9]);
|
30229 | const renderNode = asTextData(view, def.nodeIndex).renderText;
|
30230 | view.renderer.setValue(renderNode, value);
|
30231 | }
|
30232 | return changed;
|
30233 | }
|
30234 | function checkAndUpdateTextDynamic(view, def, values) {
|
30235 | const bindings = def.bindings;
|
30236 | let changed = false;
|
30237 | for (let i = 0; i < values.length; i++) {
|
30238 |
|
30239 |
|
30240 | if (checkAndUpdateBinding(view, def, i, values[i])) {
|
30241 | changed = true;
|
30242 | }
|
30243 | }
|
30244 | if (changed) {
|
30245 | let value = '';
|
30246 | for (let i = 0; i < values.length; i++) {
|
30247 | value = value + _addInterpolationPart(values[i], bindings[i]);
|
30248 | }
|
30249 | value = def.text.prefix + value;
|
30250 | const renderNode = asTextData(view, def.nodeIndex).renderText;
|
30251 | view.renderer.setValue(renderNode, value);
|
30252 | }
|
30253 | return changed;
|
30254 | }
|
30255 | function _addInterpolationPart(value, binding) {
|
30256 | const valueStr = value != null ? value.toString() : '';
|
30257 | return valueStr + binding.suffix;
|
30258 | }
|
30259 |
|
30260 |
|
30261 |
|
30262 |
|
30263 |
|
30264 |
|
30265 |
|
30266 |
|
30267 | function viewDef(flags, nodes, updateDirectives, updateRenderer) {
|
30268 |
|
30269 | let viewBindingCount = 0;
|
30270 | let viewDisposableCount = 0;
|
30271 | let viewNodeFlags = 0;
|
30272 | let viewRootNodeFlags = 0;
|
30273 | let viewMatchedQueries = 0;
|
30274 | let currentParent = null;
|
30275 | let currentRenderParent = null;
|
30276 | let currentElementHasPublicProviders = false;
|
30277 | let currentElementHasPrivateProviders = false;
|
30278 | let lastRenderRootNode = null;
|
30279 | for (let i = 0; i < nodes.length; i++) {
|
30280 | const node = nodes[i];
|
30281 | node.nodeIndex = i;
|
30282 | node.parent = currentParent;
|
30283 | node.bindingIndex = viewBindingCount;
|
30284 | node.outputIndex = viewDisposableCount;
|
30285 | node.renderParent = currentRenderParent;
|
30286 | viewNodeFlags |= node.flags;
|
30287 | viewMatchedQueries |= node.matchedQueryIds;
|
30288 | if (node.element) {
|
30289 | const elDef = node.element;
|
30290 | elDef.publicProviders =
|
30291 | currentParent ? currentParent.element.publicProviders : Object.create(null);
|
30292 | elDef.allProviders = elDef.publicProviders;
|
30293 |
|
30294 | currentElementHasPublicProviders = false;
|
30295 | currentElementHasPrivateProviders = false;
|
30296 | if (node.element.template) {
|
30297 | viewMatchedQueries |= node.element.template.nodeMatchedQueries;
|
30298 | }
|
30299 | }
|
30300 | validateNode(currentParent, node, nodes.length);
|
30301 | viewBindingCount += node.bindings.length;
|
30302 | viewDisposableCount += node.outputs.length;
|
30303 | if (!currentRenderParent && (node.flags & 3 )) {
|
30304 | lastRenderRootNode = node;
|
30305 | }
|
30306 | if (node.flags & 20224 ) {
|
30307 | if (!currentElementHasPublicProviders) {
|
30308 | currentElementHasPublicProviders = true;
|
30309 |
|
30310 | currentParent.element.publicProviders =
|
30311 | Object.create(currentParent.element.publicProviders);
|
30312 | currentParent.element.allProviders = currentParent.element.publicProviders;
|
30313 | }
|
30314 | const isPrivateService = (node.flags & 8192 ) !== 0;
|
30315 | const isComponent = (node.flags & 32768 ) !== 0;
|
30316 | if (!isPrivateService || isComponent) {
|
30317 | currentParent.element.publicProviders[tokenKey(node.provider.token)] = node;
|
30318 | }
|
30319 | else {
|
30320 | if (!currentElementHasPrivateProviders) {
|
30321 | currentElementHasPrivateProviders = true;
|
30322 |
|
30323 | currentParent.element.allProviders =
|
30324 | Object.create(currentParent.element.publicProviders);
|
30325 | }
|
30326 | currentParent.element.allProviders[tokenKey(node.provider.token)] = node;
|
30327 | }
|
30328 | if (isComponent) {
|
30329 | currentParent.element.componentProvider = node;
|
30330 | }
|
30331 | }
|
30332 | if (currentParent) {
|
30333 | currentParent.childFlags |= node.flags;
|
30334 | currentParent.directChildFlags |= node.flags;
|
30335 | currentParent.childMatchedQueries |= node.matchedQueryIds;
|
30336 | if (node.element && node.element.template) {
|
30337 | currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
|
30338 | }
|
30339 | }
|
30340 | else {
|
30341 | viewRootNodeFlags |= node.flags;
|
30342 | }
|
30343 | if (node.childCount > 0) {
|
30344 | currentParent = node;
|
30345 | if (!isNgContainer(node)) {
|
30346 | currentRenderParent = node;
|
30347 | }
|
30348 | }
|
30349 | else {
|
30350 |
|
30351 |
|
30352 |
|
30353 |
|
30354 |
|
30355 | while (currentParent && i === currentParent.nodeIndex + currentParent.childCount) {
|
30356 | const newParent = currentParent.parent;
|
30357 | if (newParent) {
|
30358 | newParent.childFlags |= currentParent.childFlags;
|
30359 | newParent.childMatchedQueries |= currentParent.childMatchedQueries;
|
30360 | }
|
30361 | currentParent = newParent;
|
30362 |
|
30363 | if (currentParent && isNgContainer(currentParent)) {
|
30364 | currentRenderParent = currentParent.renderParent;
|
30365 | }
|
30366 | else {
|
30367 | currentRenderParent = currentParent;
|
30368 | }
|
30369 | }
|
30370 | }
|
30371 | }
|
30372 | const handleEvent = (view, nodeIndex, eventName, event) => nodes[nodeIndex].element.handleEvent(view, eventName, event);
|
30373 | return {
|
30374 |
|
30375 | factory: null,
|
30376 | nodeFlags: viewNodeFlags,
|
30377 | rootNodeFlags: viewRootNodeFlags,
|
30378 | nodeMatchedQueries: viewMatchedQueries,
|
30379 | flags,
|
30380 | nodes: nodes,
|
30381 | updateDirectives: updateDirectives || NOOP,
|
30382 | updateRenderer: updateRenderer || NOOP,
|
30383 | handleEvent,
|
30384 | bindingCount: viewBindingCount,
|
30385 | outputCount: viewDisposableCount,
|
30386 | lastRenderRootNode
|
30387 | };
|
30388 | }
|
30389 | function isNgContainer(node) {
|
30390 | return (node.flags & 1 ) !== 0 && node.element.name === null;
|
30391 | }
|
30392 | function validateNode(parent, node, nodeCount) {
|
30393 | const template = node.element && node.element.template;
|
30394 | if (template) {
|
30395 | if (!template.lastRenderRootNode) {
|
30396 | throw new Error(`Illegal State: Embedded templates without nodes are not allowed!`);
|
30397 | }
|
30398 | if (template.lastRenderRootNode &&
|
30399 | template.lastRenderRootNode.flags & 16777216 ) {
|
30400 | throw new Error(`Illegal State: Last root node of a template can't have embedded views, at index ${node.nodeIndex}!`);
|
30401 | }
|
30402 | }
|
30403 | if (node.flags & 20224 ) {
|
30404 | const parentFlags = parent ? parent.flags : 0;
|
30405 | if ((parentFlags & 1 ) === 0) {
|
30406 | throw new Error(`Illegal State: StaticProvider/Directive nodes need to be children of elements or anchors, at index ${node.nodeIndex}!`);
|
30407 | }
|
30408 | }
|
30409 | if (node.query) {
|
30410 | if (node.flags & 67108864 &&
|
30411 | (!parent || (parent.flags & 16384 ) === 0)) {
|
30412 | throw new Error(`Illegal State: Content Query nodes need to be children of directives, at index ${node.nodeIndex}!`);
|
30413 | }
|
30414 | if (node.flags & 134217728 && parent) {
|
30415 | throw new Error(`Illegal State: View Query nodes have to be top level nodes, at index ${node.nodeIndex}!`);
|
30416 | }
|
30417 | }
|
30418 | if (node.childCount) {
|
30419 | const parentEnd = parent ? parent.nodeIndex + parent.childCount : nodeCount - 1;
|
30420 | if (node.nodeIndex <= parentEnd && node.nodeIndex + node.childCount > parentEnd) {
|
30421 | throw new Error(`Illegal State: childCount of node leads outside of parent, at index ${node.nodeIndex}!`);
|
30422 | }
|
30423 | }
|
30424 | }
|
30425 | function createEmbeddedView(parent, anchorDef, viewDef, context) {
|
30426 |
|
30427 |
|
30428 | const view = createView(parent.root, parent.renderer, parent, anchorDef, viewDef);
|
30429 | initView(view, parent.component, context);
|
30430 | createViewNodes(view);
|
30431 | return view;
|
30432 | }
|
30433 | function createRootView(root, def, context) {
|
30434 | const view = createView(root, root.renderer, null, null, def);
|
30435 | initView(view, context, context);
|
30436 | createViewNodes(view);
|
30437 | return view;
|
30438 | }
|
30439 | function createComponentView(parentView, nodeDef, viewDef, hostElement) {
|
30440 | const rendererType = nodeDef.element.componentRendererType;
|
30441 | let compRenderer;
|
30442 | if (!rendererType) {
|
30443 | compRenderer = parentView.root.renderer;
|
30444 | }
|
30445 | else {
|
30446 | compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType);
|
30447 | }
|
30448 | return createView(parentView.root, compRenderer, parentView, nodeDef.element.componentProvider, viewDef);
|
30449 | }
|
30450 | function createView(root, renderer, parent, parentNodeDef, def) {
|
30451 | const nodes = new Array(def.nodes.length);
|
30452 | const disposables = def.outputCount ? new Array(def.outputCount) : null;
|
30453 | const view = {
|
30454 | def,
|
30455 | parent,
|
30456 | viewContainerParent: null,
|
30457 | parentNodeDef,
|
30458 | context: null,
|
30459 | component: null,
|
30460 | nodes,
|
30461 | state: 13 ,
|
30462 | root,
|
30463 | renderer,
|
30464 | oldValues: new Array(def.bindingCount),
|
30465 | disposables,
|
30466 | initIndex: -1
|
30467 | };
|
30468 | return view;
|
30469 | }
|
30470 | function initView(view, component, context) {
|
30471 | view.component = component;
|
30472 | view.context = context;
|
30473 | }
|
30474 | function createViewNodes(view) {
|
30475 | let renderHost;
|
30476 | if (isComponentView(view)) {
|
30477 | const hostDef = view.parentNodeDef;
|
30478 | renderHost = asElementData(view.parent, hostDef.parent.nodeIndex).renderElement;
|
30479 | }
|
30480 | const def = view.def;
|
30481 | const nodes = view.nodes;
|
30482 | for (let i = 0; i < def.nodes.length; i++) {
|
30483 | const nodeDef = def.nodes[i];
|
30484 | Services.setCurrentNode(view, i);
|
30485 | let nodeData;
|
30486 | switch (nodeDef.flags & 201347067 ) {
|
30487 | case 1 :
|
30488 | const el = createElement(view, renderHost, nodeDef);
|
30489 | let componentView = undefined;
|
30490 | if (nodeDef.flags & 33554432 ) {
|
30491 | const compViewDef = resolveDefinition(nodeDef.element.componentView);
|
30492 | componentView = Services.createComponentView(view, nodeDef, compViewDef, el);
|
30493 | }
|
30494 | listenToElementOutputs(view, componentView, nodeDef, el);
|
30495 | nodeData = {
|
30496 | renderElement: el,
|
30497 | componentView,
|
30498 | viewContainer: null,
|
30499 | template: nodeDef.element.template ? createTemplateData(view, nodeDef) : undefined
|
30500 | };
|
30501 | if (nodeDef.flags & 16777216 ) {
|
30502 | nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
|
30503 | }
|
30504 | break;
|
30505 | case 2 :
|
30506 | nodeData = createText(view, renderHost, nodeDef);
|
30507 | break;
|
30508 | case 512 :
|
30509 | case 1024 :
|
30510 | case 2048 :
|
30511 | case 256 : {
|
30512 | nodeData = nodes[i];
|
30513 | if (!nodeData && !(nodeDef.flags & 4096 )) {
|
30514 | const instance = createProviderInstance(view, nodeDef);
|
30515 | nodeData = { instance };
|
30516 | }
|
30517 | break;
|
30518 | }
|
30519 | case 16 : {
|
30520 | const instance = createPipeInstance(view, nodeDef);
|
30521 | nodeData = { instance };
|
30522 | break;
|
30523 | }
|
30524 | case 16384 : {
|
30525 | nodeData = nodes[i];
|
30526 | if (!nodeData) {
|
30527 | const instance = createDirectiveInstance(view, nodeDef);
|
30528 | nodeData = { instance };
|
30529 | }
|
30530 | if (nodeDef.flags & 32768 ) {
|
30531 | const compView = asElementData(view, nodeDef.parent.nodeIndex).componentView;
|
30532 | initView(compView, nodeData.instance, nodeData.instance);
|
30533 | }
|
30534 | break;
|
30535 | }
|
30536 | case 32 :
|
30537 | case 64 :
|
30538 | case 128 :
|
30539 | nodeData = createPureExpression(view, nodeDef);
|
30540 | break;
|
30541 | case 67108864 :
|
30542 | case 134217728 :
|
30543 | nodeData = createQuery();
|
30544 | break;
|
30545 | case 8 :
|
30546 | appendNgContent(view, renderHost, nodeDef);
|
30547 |
|
30548 | nodeData = undefined;
|
30549 | break;
|
30550 | }
|
30551 | nodes[i] = nodeData;
|
30552 | }
|
30553 |
|
30554 |
|
30555 | execComponentViewsAction(view, ViewAction.CreateViewNodes);
|
30556 |
|
30557 | execQueriesAction(view, 67108864 | 134217728 , 268435456 , 0 );
|
30558 | }
|
30559 | function checkNoChangesView(view) {
|
30560 | markProjectedViewsForCheck(view);
|
30561 | Services.updateDirectives(view, 1 );
|
30562 | execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
|
30563 | Services.updateRenderer(view, 1 );
|
30564 | execComponentViewsAction(view, ViewAction.CheckNoChanges);
|
30565 |
|
30566 |
|
30567 | view.state &= ~(64 | 32 );
|
30568 | }
|
30569 | function checkAndUpdateView(view) {
|
30570 | if (view.state & 1 ) {
|
30571 | view.state &= ~1 ;
|
30572 | view.state |= 2 ;
|
30573 | }
|
30574 | else {
|
30575 | view.state &= ~2 ;
|
30576 | }
|
30577 | shiftInitState(view, 0 , 256 );
|
30578 | markProjectedViewsForCheck(view);
|
30579 | Services.updateDirectives(view, 0 );
|
30580 | execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
|
30581 | execQueriesAction(view, 67108864 , 536870912 , 0 );
|
30582 | let callInit = shiftInitState(view, 256 , 512 );
|
30583 | callLifecycleHooksChildrenFirst(view, 2097152 | (callInit ? 1048576 : 0));
|
30584 | Services.updateRenderer(view, 0 );
|
30585 | execComponentViewsAction(view, ViewAction.CheckAndUpdate);
|
30586 | execQueriesAction(view, 134217728 , 536870912 , 0 );
|
30587 | callInit = shiftInitState(view, 512 , 768 );
|
30588 | callLifecycleHooksChildrenFirst(view, 8388608 | (callInit ? 4194304 : 0));
|
30589 | if (view.def.flags & 2 ) {
|
30590 | view.state &= ~8 ;
|
30591 | }
|
30592 | view.state &= ~(64 | 32 );
|
30593 | shiftInitState(view, 768 , 1024 );
|
30594 | }
|
30595 | function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
30596 | if (argStyle === 0 ) {
|
30597 | return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
30598 | }
|
30599 | else {
|
30600 | return checkAndUpdateNodeDynamic(view, nodeDef, v0);
|
30601 | }
|
30602 | }
|
30603 | function markProjectedViewsForCheck(view) {
|
30604 | const def = view.def;
|
30605 | if (!(def.nodeFlags & 4 )) {
|
30606 | return;
|
30607 | }
|
30608 | for (let i = 0; i < def.nodes.length; i++) {
|
30609 | const nodeDef = def.nodes[i];
|
30610 | if (nodeDef.flags & 4 ) {
|
30611 | const projectedViews = asElementData(view, i).template._projectedViews;
|
30612 | if (projectedViews) {
|
30613 | for (let i = 0; i < projectedViews.length; i++) {
|
30614 | const projectedView = projectedViews[i];
|
30615 | projectedView.state |= 32 ;
|
30616 | markParentViewsForCheckProjectedViews(projectedView, view);
|
30617 | }
|
30618 | }
|
30619 | }
|
30620 | else if ((nodeDef.childFlags & 4 ) === 0) {
|
30621 |
|
30622 |
|
30623 |
|
30624 | i += nodeDef.childCount;
|
30625 | }
|
30626 | }
|
30627 | }
|
30628 | function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
30629 | switch (nodeDef.flags & 201347067 ) {
|
30630 | case 1 :
|
30631 | return checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
30632 | case 2 :
|
30633 | return checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
30634 | case 16384 :
|
30635 | return checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
30636 | case 32 :
|
30637 | case 64 :
|
30638 | case 128 :
|
30639 | return checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
30640 | default:
|
30641 | throw 'unreachable';
|
30642 | }
|
30643 | }
|
30644 | function checkAndUpdateNodeDynamic(view, nodeDef, values) {
|
30645 | switch (nodeDef.flags & 201347067 ) {
|
30646 | case 1 :
|
30647 | return checkAndUpdateElementDynamic(view, nodeDef, values);
|
30648 | case 2 :
|
30649 | return checkAndUpdateTextDynamic(view, nodeDef, values);
|
30650 | case 16384 :
|
30651 | return checkAndUpdateDirectiveDynamic(view, nodeDef, values);
|
30652 | case 32 :
|
30653 | case 64 :
|
30654 | case 128 :
|
30655 | return checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
|
30656 | default:
|
30657 | throw 'unreachable';
|
30658 | }
|
30659 | }
|
30660 | function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
30661 | if (argStyle === 0 ) {
|
30662 | checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
30663 | }
|
30664 | else {
|
30665 | checkNoChangesNodeDynamic(view, nodeDef, v0);
|
30666 | }
|
30667 |
|
30668 | return false;
|
30669 | }
|
30670 | function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
30671 | const bindLen = nodeDef.bindings.length;
|
30672 | if (bindLen > 0)
|
30673 | checkBindingNoChanges(view, nodeDef, 0, v0);
|
30674 | if (bindLen > 1)
|
30675 | checkBindingNoChanges(view, nodeDef, 1, v1);
|
30676 | if (bindLen > 2)
|
30677 | checkBindingNoChanges(view, nodeDef, 2, v2);
|
30678 | if (bindLen > 3)
|
30679 | checkBindingNoChanges(view, nodeDef, 3, v3);
|
30680 | if (bindLen > 4)
|
30681 | checkBindingNoChanges(view, nodeDef, 4, v4);
|
30682 | if (bindLen > 5)
|
30683 | checkBindingNoChanges(view, nodeDef, 5, v5);
|
30684 | if (bindLen > 6)
|
30685 | checkBindingNoChanges(view, nodeDef, 6, v6);
|
30686 | if (bindLen > 7)
|
30687 | checkBindingNoChanges(view, nodeDef, 7, v7);
|
30688 | if (bindLen > 8)
|
30689 | checkBindingNoChanges(view, nodeDef, 8, v8);
|
30690 | if (bindLen > 9)
|
30691 | checkBindingNoChanges(view, nodeDef, 9, v9);
|
30692 | }
|
30693 | function checkNoChangesNodeDynamic(view, nodeDef, values) {
|
30694 | for (let i = 0; i < values.length; i++) {
|
30695 | checkBindingNoChanges(view, nodeDef, i, values[i]);
|
30696 | }
|
30697 | }
|
30698 |
|
30699 |
|
30700 |
|
30701 |
|
30702 | function checkNoChangesQuery(view, nodeDef) {
|
30703 | const queryList = asQueryList(view, nodeDef.nodeIndex);
|
30704 | if (queryList.dirty) {
|
30705 | throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.nodeIndex), `Query ${nodeDef.query.id} not dirty`, `Query ${nodeDef.query.id} dirty`, (view.state & 1 ) !== 0);
|
30706 | }
|
30707 | }
|
30708 | function destroyView(view) {
|
30709 | if (view.state & 128 ) {
|
30710 | return;
|
30711 | }
|
30712 | execEmbeddedViewsAction(view, ViewAction.Destroy);
|
30713 | execComponentViewsAction(view, ViewAction.Destroy);
|
30714 | callLifecycleHooksChildrenFirst(view, 131072 );
|
30715 | if (view.disposables) {
|
30716 | for (let i = 0; i < view.disposables.length; i++) {
|
30717 | view.disposables[i]();
|
30718 | }
|
30719 | }
|
30720 | detachProjectedView(view);
|
30721 | if (view.renderer.destroyNode) {
|
30722 | destroyViewNodes(view);
|
30723 | }
|
30724 | if (isComponentView(view)) {
|
30725 | view.renderer.destroy();
|
30726 | }
|
30727 | view.state |= 128 ;
|
30728 | }
|
30729 | function destroyViewNodes(view) {
|
30730 | const len = view.def.nodes.length;
|
30731 | for (let i = 0; i < len; i++) {
|
30732 | const def = view.def.nodes[i];
|
30733 | if (def.flags & 1 ) {
|
30734 | view.renderer.destroyNode(asElementData(view, i).renderElement);
|
30735 | }
|
30736 | else if (def.flags & 2 ) {
|
30737 | view.renderer.destroyNode(asTextData(view, i).renderText);
|
30738 | }
|
30739 | else if (def.flags & 67108864 || def.flags & 134217728 ) {
|
30740 | asQueryList(view, i).destroy();
|
30741 | }
|
30742 | }
|
30743 | }
|
30744 | var ViewAction;
|
30745 | (function (ViewAction) {
|
30746 | ViewAction[ViewAction["CreateViewNodes"] = 0] = "CreateViewNodes";
|
30747 | ViewAction[ViewAction["CheckNoChanges"] = 1] = "CheckNoChanges";
|
30748 | ViewAction[ViewAction["CheckNoChangesProjectedViews"] = 2] = "CheckNoChangesProjectedViews";
|
30749 | ViewAction[ViewAction["CheckAndUpdate"] = 3] = "CheckAndUpdate";
|
30750 | ViewAction[ViewAction["CheckAndUpdateProjectedViews"] = 4] = "CheckAndUpdateProjectedViews";
|
30751 | ViewAction[ViewAction["Destroy"] = 5] = "Destroy";
|
30752 | })(ViewAction || (ViewAction = {}));
|
30753 | function execComponentViewsAction(view, action) {
|
30754 | const def = view.def;
|
30755 | if (!(def.nodeFlags & 33554432 )) {
|
30756 | return;
|
30757 | }
|
30758 | for (let i = 0; i < def.nodes.length; i++) {
|
30759 | const nodeDef = def.nodes[i];
|
30760 | if (nodeDef.flags & 33554432 ) {
|
30761 |
|
30762 | callViewAction(asElementData(view, i).componentView, action);
|
30763 | }
|
30764 | else if ((nodeDef.childFlags & 33554432 ) === 0) {
|
30765 |
|
30766 |
|
30767 |
|
30768 | i += nodeDef.childCount;
|
30769 | }
|
30770 | }
|
30771 | }
|
30772 | function execEmbeddedViewsAction(view, action) {
|
30773 | const def = view.def;
|
30774 | if (!(def.nodeFlags & 16777216 )) {
|
30775 | return;
|
30776 | }
|
30777 | for (let i = 0; i < def.nodes.length; i++) {
|
30778 | const nodeDef = def.nodes[i];
|
30779 | if (nodeDef.flags & 16777216 ) {
|
30780 |
|
30781 | const embeddedViews = asElementData(view, i).viewContainer._embeddedViews;
|
30782 | for (let k = 0; k < embeddedViews.length; k++) {
|
30783 | callViewAction(embeddedViews[k], action);
|
30784 | }
|
30785 | }
|
30786 | else if ((nodeDef.childFlags & 16777216 ) === 0) {
|
30787 |
|
30788 |
|
30789 |
|
30790 | i += nodeDef.childCount;
|
30791 | }
|
30792 | }
|
30793 | }
|
30794 | function callViewAction(view, action) {
|
30795 | const viewState = view.state;
|
30796 | switch (action) {
|
30797 | case ViewAction.CheckNoChanges:
|
30798 | if ((viewState & 128 ) === 0) {
|
30799 | if ((viewState & 12 ) === 12 ) {
|
30800 | checkNoChangesView(view);
|
30801 | }
|
30802 | else if (viewState & 64 ) {
|
30803 | execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews);
|
30804 | }
|
30805 | }
|
30806 | break;
|
30807 | case ViewAction.CheckNoChangesProjectedViews:
|
30808 | if ((viewState & 128 ) === 0) {
|
30809 | if (viewState & 32 ) {
|
30810 | checkNoChangesView(view);
|
30811 | }
|
30812 | else if (viewState & 64 ) {
|
30813 | execProjectedViewsAction(view, action);
|
30814 | }
|
30815 | }
|
30816 | break;
|
30817 | case ViewAction.CheckAndUpdate:
|
30818 | if ((viewState & 128 ) === 0) {
|
30819 | if ((viewState & 12 ) === 12 ) {
|
30820 | checkAndUpdateView(view);
|
30821 | }
|
30822 | else if (viewState & 64 ) {
|
30823 | execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews);
|
30824 | }
|
30825 | }
|
30826 | break;
|
30827 | case ViewAction.CheckAndUpdateProjectedViews:
|
30828 | if ((viewState & 128 ) === 0) {
|
30829 | if (viewState & 32 ) {
|
30830 | checkAndUpdateView(view);
|
30831 | }
|
30832 | else if (viewState & 64 ) {
|
30833 | execProjectedViewsAction(view, action);
|
30834 | }
|
30835 | }
|
30836 | break;
|
30837 | case ViewAction.Destroy:
|
30838 |
|
30839 |
|
30840 | destroyView(view);
|
30841 | break;
|
30842 | case ViewAction.CreateViewNodes:
|
30843 | createViewNodes(view);
|
30844 | break;
|
30845 | }
|
30846 | }
|
30847 | function execProjectedViewsAction(view, action) {
|
30848 | execEmbeddedViewsAction(view, action);
|
30849 | execComponentViewsAction(view, action);
|
30850 | }
|
30851 | function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
|
30852 | if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
|
30853 | return;
|
30854 | }
|
30855 | const nodeCount = view.def.nodes.length;
|
30856 | for (let i = 0; i < nodeCount; i++) {
|
30857 | const nodeDef = view.def.nodes[i];
|
30858 | if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
|
30859 | Services.setCurrentNode(view, nodeDef.nodeIndex);
|
30860 | switch (checkType) {
|
30861 | case 0 :
|
30862 | checkAndUpdateQuery(view, nodeDef);
|
30863 | break;
|
30864 | case 1 :
|
30865 | checkNoChangesQuery(view, nodeDef);
|
30866 | break;
|
30867 | }
|
30868 | }
|
30869 | if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
|
30870 |
|
30871 |
|
30872 | i += nodeDef.childCount;
|
30873 | }
|
30874 | }
|
30875 | }
|
30876 |
|
30877 |
|
30878 |
|
30879 |
|
30880 |
|
30881 |
|
30882 |
|
30883 |
|
30884 | let initialized = false;
|
30885 | function initServicesIfNeeded() {
|
30886 | if (initialized) {
|
30887 | return;
|
30888 | }
|
30889 | initialized = true;
|
30890 | const services = isDevMode() ? createDebugServices() : createProdServices();
|
30891 | Services.setCurrentNode = services.setCurrentNode;
|
30892 | Services.createRootView = services.createRootView;
|
30893 | Services.createEmbeddedView = services.createEmbeddedView;
|
30894 | Services.createComponentView = services.createComponentView;
|
30895 | Services.createNgModuleRef = services.createNgModuleRef;
|
30896 | Services.overrideProvider = services.overrideProvider;
|
30897 | Services.overrideComponentView = services.overrideComponentView;
|
30898 | Services.clearOverrides = services.clearOverrides;
|
30899 | Services.checkAndUpdateView = services.checkAndUpdateView;
|
30900 | Services.checkNoChangesView = services.checkNoChangesView;
|
30901 | Services.destroyView = services.destroyView;
|
30902 | Services.resolveDep = resolveDep;
|
30903 | Services.createDebugContext = services.createDebugContext;
|
30904 | Services.handleEvent = services.handleEvent;
|
30905 | Services.updateDirectives = services.updateDirectives;
|
30906 | Services.updateRenderer = services.updateRenderer;
|
30907 | Services.dirtyParentQueries = dirtyParentQueries;
|
30908 | }
|
30909 | function createProdServices() {
|
30910 | return {
|
30911 | setCurrentNode: () => { },
|
30912 | createRootView: createProdRootView,
|
30913 | createEmbeddedView: createEmbeddedView,
|
30914 | createComponentView: createComponentView,
|
30915 | createNgModuleRef: createNgModuleRef,
|
30916 | overrideProvider: NOOP,
|
30917 | overrideComponentView: NOOP,
|
30918 | clearOverrides: NOOP,
|
30919 | checkAndUpdateView: checkAndUpdateView,
|
30920 | checkNoChangesView: checkNoChangesView,
|
30921 | destroyView: destroyView,
|
30922 | createDebugContext: (view, nodeIndex) => new DebugContext_(view, nodeIndex),
|
30923 | handleEvent: (view, nodeIndex, eventName, event) => view.def.handleEvent(view, nodeIndex, eventName, event),
|
30924 | updateDirectives: (view, checkType) => view.def.updateDirectives(checkType === 0 ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view),
|
30925 | updateRenderer: (view, checkType) => view.def.updateRenderer(checkType === 0 ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view),
|
30926 | };
|
30927 | }
|
30928 | function createDebugServices() {
|
30929 | return {
|
30930 | setCurrentNode: debugSetCurrentNode,
|
30931 | createRootView: debugCreateRootView,
|
30932 | createEmbeddedView: debugCreateEmbeddedView,
|
30933 | createComponentView: debugCreateComponentView,
|
30934 | createNgModuleRef: debugCreateNgModuleRef,
|
30935 | overrideProvider: debugOverrideProvider,
|
30936 | overrideComponentView: debugOverrideComponentView,
|
30937 | clearOverrides: debugClearOverrides,
|
30938 | checkAndUpdateView: debugCheckAndUpdateView,
|
30939 | checkNoChangesView: debugCheckNoChangesView,
|
30940 | destroyView: debugDestroyView,
|
30941 | createDebugContext: (view, nodeIndex) => new DebugContext_(view, nodeIndex),
|
30942 | handleEvent: debugHandleEvent,
|
30943 | updateDirectives: debugUpdateDirectives,
|
30944 | updateRenderer: debugUpdateRenderer,
|
30945 | };
|
30946 | }
|
30947 | function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
30948 | const rendererFactory = ngModule.injector.get(RendererFactory2);
|
30949 | return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
|
30950 | }
|
30951 | function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
30952 | const rendererFactory = ngModule.injector.get(RendererFactory2);
|
30953 | const root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
|
30954 | const defWithOverride = applyProviderOverridesToView(def);
|
30955 | return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]);
|
30956 | }
|
30957 | function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
|
30958 | const sanitizer = ngModule.injector.get(Sanitizer);
|
30959 | const errorHandler = ngModule.injector.get(ErrorHandler);
|
30960 | const renderer = rendererFactory.createRenderer(null, null);
|
30961 | return {
|
30962 | ngModule,
|
30963 | injector: elInjector,
|
30964 | projectableNodes,
|
30965 | selectorOrNode: rootSelectorOrNode,
|
30966 | sanitizer,
|
30967 | rendererFactory,
|
30968 | renderer,
|
30969 | errorHandler
|
30970 | };
|
30971 | }
|
30972 | function debugCreateEmbeddedView(parentView, anchorDef, viewDef, context) {
|
30973 | const defWithOverride = applyProviderOverridesToView(viewDef);
|
30974 | return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]);
|
30975 | }
|
30976 | function debugCreateComponentView(parentView, nodeDef, viewDef, hostElement) {
|
30977 | const overrideComponentView = viewDefOverrides.get(nodeDef.element.componentProvider.provider.token);
|
30978 | if (overrideComponentView) {
|
30979 | viewDef = overrideComponentView;
|
30980 | }
|
30981 | else {
|
30982 | viewDef = applyProviderOverridesToView(viewDef);
|
30983 | }
|
30984 | return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, viewDef, hostElement]);
|
30985 | }
|
30986 | function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) {
|
30987 | const defWithOverride = applyProviderOverridesToNgModule(def);
|
30988 | return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
|
30989 | }
|
30990 | const providerOverrides = new Map();
|
30991 | const providerOverridesWithScope = new Map();
|
30992 | const viewDefOverrides = new Map();
|
30993 | function debugOverrideProvider(override) {
|
30994 | providerOverrides.set(override.token, override);
|
30995 | let injectableDef;
|
30996 | if (typeof override.token === 'function' && (injectableDef = getInjectableDef(override.token)) &&
|
30997 | typeof injectableDef.providedIn === 'function') {
|
30998 | providerOverridesWithScope.set(override.token, override);
|
30999 | }
|
31000 | }
|
31001 | function debugOverrideComponentView(comp, compFactory) {
|
31002 | const hostViewDef = resolveDefinition(getComponentViewDefinitionFactory(compFactory));
|
31003 | const compViewDef = resolveDefinition(hostViewDef.nodes[0].element.componentView);
|
31004 | viewDefOverrides.set(comp, compViewDef);
|
31005 | }
|
31006 | function debugClearOverrides() {
|
31007 | providerOverrides.clear();
|
31008 | providerOverridesWithScope.clear();
|
31009 | viewDefOverrides.clear();
|
31010 | }
|
31011 |
|
31012 |
|
31013 |
|
31014 |
|
31015 |
|
31016 |
|
31017 | function applyProviderOverridesToView(def) {
|
31018 | if (providerOverrides.size === 0) {
|
31019 | return def;
|
31020 | }
|
31021 | const elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
|
31022 | if (elementIndicesWithOverwrittenProviders.length === 0) {
|
31023 | return def;
|
31024 | }
|
31025 |
|
31026 |
|
31027 | def = def.factory(() => NOOP);
|
31028 | for (let i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
|
31029 | applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
|
31030 | }
|
31031 | return def;
|
31032 | function findElementIndicesWithOverwrittenProviders(def) {
|
31033 | const elIndicesWithOverwrittenProviders = [];
|
31034 | let lastElementDef = null;
|
31035 | for (let i = 0; i < def.nodes.length; i++) {
|
31036 | const nodeDef = def.nodes[i];
|
31037 | if (nodeDef.flags & 1 ) {
|
31038 | lastElementDef = nodeDef;
|
31039 | }
|
31040 | if (lastElementDef && nodeDef.flags & 3840 &&
|
31041 | providerOverrides.has(nodeDef.provider.token)) {
|
31042 | elIndicesWithOverwrittenProviders.push(lastElementDef.nodeIndex);
|
31043 | lastElementDef = null;
|
31044 | }
|
31045 | }
|
31046 | return elIndicesWithOverwrittenProviders;
|
31047 | }
|
31048 | function applyProviderOverridesToElement(viewDef, elIndex) {
|
31049 | for (let i = elIndex + 1; i < viewDef.nodes.length; i++) {
|
31050 | const nodeDef = viewDef.nodes[i];
|
31051 | if (nodeDef.flags & 1 ) {
|
31052 |
|
31053 | return;
|
31054 | }
|
31055 | if (nodeDef.flags & 3840 ) {
|
31056 | const provider = nodeDef.provider;
|
31057 | const override = providerOverrides.get(provider.token);
|
31058 | if (override) {
|
31059 | nodeDef.flags = (nodeDef.flags & ~3840 ) | override.flags;
|
31060 | provider.deps = splitDepsDsl(override.deps);
|
31061 | provider.value = override.value;
|
31062 | }
|
31063 | }
|
31064 | }
|
31065 | }
|
31066 | }
|
31067 |
|
31068 |
|
31069 |
|
31070 | function applyProviderOverridesToNgModule(def) {
|
31071 | const { hasOverrides, hasDeprecatedOverrides } = calcHasOverrides(def);
|
31072 | if (!hasOverrides) {
|
31073 | return def;
|
31074 | }
|
31075 |
|
31076 |
|
31077 | def = def.factory(() => NOOP);
|
31078 | applyProviderOverrides(def);
|
31079 | return def;
|
31080 | function calcHasOverrides(def) {
|
31081 | let hasOverrides = false;
|
31082 | let hasDeprecatedOverrides = false;
|
31083 | if (providerOverrides.size === 0) {
|
31084 | return { hasOverrides, hasDeprecatedOverrides };
|
31085 | }
|
31086 | def.providers.forEach(node => {
|
31087 | const override = providerOverrides.get(node.token);
|
31088 | if ((node.flags & 3840 ) && override) {
|
31089 | hasOverrides = true;
|
31090 | hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
|
31091 | }
|
31092 | });
|
31093 | def.modules.forEach(module => {
|
31094 | providerOverridesWithScope.forEach((override, token) => {
|
31095 | if (getInjectableDef(token).providedIn === module) {
|
31096 | hasOverrides = true;
|
31097 | hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
|
31098 | }
|
31099 | });
|
31100 | });
|
31101 | return { hasOverrides, hasDeprecatedOverrides };
|
31102 | }
|
31103 | function applyProviderOverrides(def) {
|
31104 | for (let i = 0; i < def.providers.length; i++) {
|
31105 | const provider = def.providers[i];
|
31106 | if (hasDeprecatedOverrides) {
|
31107 |
|
31108 |
|
31109 |
|
31110 | provider.flags |= 4096 ;
|
31111 | }
|
31112 | const override = providerOverrides.get(provider.token);
|
31113 | if (override) {
|
31114 | provider.flags = (provider.flags & ~3840 ) | override.flags;
|
31115 | provider.deps = splitDepsDsl(override.deps);
|
31116 | provider.value = override.value;
|
31117 | }
|
31118 | }
|
31119 | if (providerOverridesWithScope.size > 0) {
|
31120 | let moduleSet = new Set(def.modules);
|
31121 | providerOverridesWithScope.forEach((override, token) => {
|
31122 | if (moduleSet.has(getInjectableDef(token).providedIn)) {
|
31123 | let provider = {
|
31124 | token: token,
|
31125 | flags: override.flags | (hasDeprecatedOverrides ? 4096 : 0 ),
|
31126 | deps: splitDepsDsl(override.deps),
|
31127 | value: override.value,
|
31128 | index: def.providers.length,
|
31129 | };
|
31130 | def.providers.push(provider);
|
31131 | def.providersByKey[tokenKey(token)] = provider;
|
31132 | }
|
31133 | });
|
31134 | }
|
31135 | }
|
31136 | }
|
31137 | function prodCheckAndUpdateNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
31138 | const nodeDef = view.def.nodes[checkIndex];
|
31139 | checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
31140 | return (nodeDef.flags & 224 ) ?
|
31141 | asPureExpressionData(view, checkIndex).value :
|
31142 | undefined;
|
31143 | }
|
31144 | function prodCheckNoChangesNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
31145 | const nodeDef = view.def.nodes[checkIndex];
|
31146 | checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
31147 | return (nodeDef.flags & 224 ) ?
|
31148 | asPureExpressionData(view, checkIndex).value :
|
31149 | undefined;
|
31150 | }
|
31151 | function debugCheckAndUpdateView(view) {
|
31152 | return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
|
31153 | }
|
31154 | function debugCheckNoChangesView(view) {
|
31155 | return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
|
31156 | }
|
31157 | function debugDestroyView(view) {
|
31158 | return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
|
31159 | }
|
31160 | var DebugAction;
|
31161 | (function (DebugAction) {
|
31162 | DebugAction[DebugAction["create"] = 0] = "create";
|
31163 | DebugAction[DebugAction["detectChanges"] = 1] = "detectChanges";
|
31164 | DebugAction[DebugAction["checkNoChanges"] = 2] = "checkNoChanges";
|
31165 | DebugAction[DebugAction["destroy"] = 3] = "destroy";
|
31166 | DebugAction[DebugAction["handleEvent"] = 4] = "handleEvent";
|
31167 | })(DebugAction || (DebugAction = {}));
|
31168 | let _currentAction;
|
31169 | let _currentView;
|
31170 | let _currentNodeIndex;
|
31171 | function debugSetCurrentNode(view, nodeIndex) {
|
31172 | _currentView = view;
|
31173 | _currentNodeIndex = nodeIndex;
|
31174 | }
|
31175 | function debugHandleEvent(view, nodeIndex, eventName, event) {
|
31176 | debugSetCurrentNode(view, nodeIndex);
|
31177 | return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
|
31178 | }
|
31179 | function debugUpdateDirectives(view, checkType) {
|
31180 | if (view.state & 128 ) {
|
31181 | throw viewDestroyedError(DebugAction[_currentAction]);
|
31182 | }
|
31183 | debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
|
31184 | return view.def.updateDirectives(debugCheckDirectivesFn, view);
|
31185 | function debugCheckDirectivesFn(view, nodeIndex, argStyle, ...values) {
|
31186 | const nodeDef = view.def.nodes[nodeIndex];
|
31187 | if (checkType === 0 ) {
|
31188 | debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
31189 | }
|
31190 | else {
|
31191 | debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
31192 | }
|
31193 | if (nodeDef.flags & 16384 ) {
|
31194 | debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
|
31195 | }
|
31196 | return (nodeDef.flags & 224 ) ?
|
31197 | asPureExpressionData(view, nodeDef.nodeIndex).value :
|
31198 | undefined;
|
31199 | }
|
31200 | }
|
31201 | function debugUpdateRenderer(view, checkType) {
|
31202 | if (view.state & 128 ) {
|
31203 | throw viewDestroyedError(DebugAction[_currentAction]);
|
31204 | }
|
31205 | debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
|
31206 | return view.def.updateRenderer(debugCheckRenderNodeFn, view);
|
31207 | function debugCheckRenderNodeFn(view, nodeIndex, argStyle, ...values) {
|
31208 | const nodeDef = view.def.nodes[nodeIndex];
|
31209 | if (checkType === 0 ) {
|
31210 | debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
31211 | }
|
31212 | else {
|
31213 | debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
31214 | }
|
31215 | if (nodeDef.flags & 3 ) {
|
31216 | debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
|
31217 | }
|
31218 | return (nodeDef.flags & 224 ) ?
|
31219 | asPureExpressionData(view, nodeDef.nodeIndex).value :
|
31220 | undefined;
|
31221 | }
|
31222 | }
|
31223 | function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
|
31224 | const changed = checkAndUpdateNode(view, nodeDef, argStyle, ...givenValues);
|
31225 | if (changed) {
|
31226 | const values = argStyle === 1 ? givenValues[0] : givenValues;
|
31227 | if (nodeDef.flags & 16384 ) {
|
31228 | const bindingValues = {};
|
31229 | for (let i = 0; i < nodeDef.bindings.length; i++) {
|
31230 | const binding = nodeDef.bindings[i];
|
31231 | const value = values[i];
|
31232 | if (binding.flags & 8 ) {
|
31233 | bindingValues[normalizeDebugBindingName(binding.nonMinifiedName)] =
|
31234 | normalizeDebugBindingValue(value);
|
31235 | }
|
31236 | }
|
31237 | const elDef = nodeDef.parent;
|
31238 | const el = asElementData(view, elDef.nodeIndex).renderElement;
|
31239 | if (!elDef.element.name) {
|
31240 |
|
31241 | view.renderer.setValue(el, `bindings=${JSON.stringify(bindingValues, null, 2)}`);
|
31242 | }
|
31243 | else {
|
31244 |
|
31245 | for (let attr in bindingValues) {
|
31246 | const value = bindingValues[attr];
|
31247 | if (value != null) {
|
31248 | view.renderer.setAttribute(el, attr, value);
|
31249 | }
|
31250 | else {
|
31251 | view.renderer.removeAttribute(el, attr);
|
31252 | }
|
31253 | }
|
31254 | }
|
31255 | }
|
31256 | }
|
31257 | }
|
31258 | function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
|
31259 | checkNoChangesNode(view, nodeDef, argStyle, ...values);
|
31260 | }
|
31261 | function nextDirectiveWithBinding(view, nodeIndex) {
|
31262 | for (let i = nodeIndex; i < view.def.nodes.length; i++) {
|
31263 | const nodeDef = view.def.nodes[i];
|
31264 | if (nodeDef.flags & 16384 && nodeDef.bindings && nodeDef.bindings.length) {
|
31265 | return i;
|
31266 | }
|
31267 | }
|
31268 | return null;
|
31269 | }
|
31270 | function nextRenderNodeWithBinding(view, nodeIndex) {
|
31271 | for (let i = nodeIndex; i < view.def.nodes.length; i++) {
|
31272 | const nodeDef = view.def.nodes[i];
|
31273 | if ((nodeDef.flags & 3 ) && nodeDef.bindings && nodeDef.bindings.length) {
|
31274 | return i;
|
31275 | }
|
31276 | }
|
31277 | return null;
|
31278 | }
|
31279 | class DebugContext_ {
|
31280 | constructor(view, nodeIndex) {
|
31281 | this.view = view;
|
31282 | this.nodeIndex = nodeIndex;
|
31283 | if (nodeIndex == null) {
|
31284 | this.nodeIndex = nodeIndex = 0;
|
31285 | }
|
31286 | this.nodeDef = view.def.nodes[nodeIndex];
|
31287 | let elDef = this.nodeDef;
|
31288 | let elView = view;
|
31289 | while (elDef && (elDef.flags & 1 ) === 0) {
|
31290 | elDef = elDef.parent;
|
31291 | }
|
31292 | if (!elDef) {
|
31293 | while (!elDef && elView) {
|
31294 | elDef = viewParentEl(elView);
|
31295 | elView = elView.parent;
|
31296 | }
|
31297 | }
|
31298 | this.elDef = elDef;
|
31299 | this.elView = elView;
|
31300 | }
|
31301 | get elOrCompView() {
|
31302 |
|
31303 | return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view;
|
31304 | }
|
31305 | get injector() {
|
31306 | return createInjector$1(this.elView, this.elDef);
|
31307 | }
|
31308 | get component() {
|
31309 | return this.elOrCompView.component;
|
31310 | }
|
31311 | get context() {
|
31312 | return this.elOrCompView.context;
|
31313 | }
|
31314 | get providerTokens() {
|
31315 | const tokens = [];
|
31316 | if (this.elDef) {
|
31317 | for (let i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
|
31318 | const childDef = this.elView.def.nodes[i];
|
31319 | if (childDef.flags & 20224 ) {
|
31320 | tokens.push(childDef.provider.token);
|
31321 | }
|
31322 | i += childDef.childCount;
|
31323 | }
|
31324 | }
|
31325 | return tokens;
|
31326 | }
|
31327 | get references() {
|
31328 | const references = {};
|
31329 | if (this.elDef) {
|
31330 | collectReferences(this.elView, this.elDef, references);
|
31331 | for (let i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
|
31332 | const childDef = this.elView.def.nodes[i];
|
31333 | if (childDef.flags & 20224 ) {
|
31334 | collectReferences(this.elView, childDef, references);
|
31335 | }
|
31336 | i += childDef.childCount;
|
31337 | }
|
31338 | }
|
31339 | return references;
|
31340 | }
|
31341 | get componentRenderElement() {
|
31342 | const elData = findHostElement(this.elOrCompView);
|
31343 | return elData ? elData.renderElement : undefined;
|
31344 | }
|
31345 | get renderNode() {
|
31346 | return this.nodeDef.flags & 2 ? renderNode(this.view, this.nodeDef) :
|
31347 | renderNode(this.elView, this.elDef);
|
31348 | }
|
31349 | logError(console, ...values) {
|
31350 | let logViewDef;
|
31351 | let logNodeIndex;
|
31352 | if (this.nodeDef.flags & 2 ) {
|
31353 | logViewDef = this.view.def;
|
31354 | logNodeIndex = this.nodeDef.nodeIndex;
|
31355 | }
|
31356 | else {
|
31357 | logViewDef = this.elView.def;
|
31358 | logNodeIndex = this.elDef.nodeIndex;
|
31359 | }
|
31360 |
|
31361 |
|
31362 | const renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
|
31363 | let currRenderNodeIndex = -1;
|
31364 | let nodeLogger = () => {
|
31365 | currRenderNodeIndex++;
|
31366 | if (currRenderNodeIndex === renderNodeIndex) {
|
31367 | return console.error.bind(console, ...values);
|
31368 | }
|
31369 | else {
|
31370 | return NOOP;
|
31371 | }
|
31372 | };
|
31373 | logViewDef.factory(nodeLogger);
|
31374 | if (currRenderNodeIndex < renderNodeIndex) {
|
31375 | console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
|
31376 | console.error(...values);
|
31377 | }
|
31378 | }
|
31379 | }
|
31380 | function getRenderNodeIndex(viewDef, nodeIndex) {
|
31381 | let renderNodeIndex = -1;
|
31382 | for (let i = 0; i <= nodeIndex; i++) {
|
31383 | const nodeDef = viewDef.nodes[i];
|
31384 | if (nodeDef.flags & 3 ) {
|
31385 | renderNodeIndex++;
|
31386 | }
|
31387 | }
|
31388 | return renderNodeIndex;
|
31389 | }
|
31390 | function findHostElement(view) {
|
31391 | while (view && !isComponentView(view)) {
|
31392 | view = view.parent;
|
31393 | }
|
31394 | if (view.parent) {
|
31395 | return asElementData(view.parent, viewParentEl(view).nodeIndex);
|
31396 | }
|
31397 | return null;
|
31398 | }
|
31399 | function collectReferences(view, nodeDef, references) {
|
31400 | for (let refName in nodeDef.references) {
|
31401 | references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
|
31402 | }
|
31403 | }
|
31404 | function callWithDebugContext(action, fn, self, args) {
|
31405 | const oldAction = _currentAction;
|
31406 | const oldView = _currentView;
|
31407 | const oldNodeIndex = _currentNodeIndex;
|
31408 | try {
|
31409 | _currentAction = action;
|
31410 | const result = fn.apply(self, args);
|
31411 | _currentView = oldView;
|
31412 | _currentNodeIndex = oldNodeIndex;
|
31413 | _currentAction = oldAction;
|
31414 | return result;
|
31415 | }
|
31416 | catch (e) {
|
31417 | if (isViewDebugError(e) || !_currentView) {
|
31418 | throw e;
|
31419 | }
|
31420 | throw viewWrappedDebugError(e, getCurrentDebugContext());
|
31421 | }
|
31422 | }
|
31423 | function getCurrentDebugContext() {
|
31424 | return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
|
31425 | }
|
31426 | class DebugRendererFactory2 {
|
31427 | constructor(delegate) {
|
31428 | this.delegate = delegate;
|
31429 | }
|
31430 | createRenderer(element, renderData) {
|
31431 | return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
|
31432 | }
|
31433 | begin() {
|
31434 | if (this.delegate.begin) {
|
31435 | this.delegate.begin();
|
31436 | }
|
31437 | }
|
31438 | end() {
|
31439 | if (this.delegate.end) {
|
31440 | this.delegate.end();
|
31441 | }
|
31442 | }
|
31443 | whenRenderingDone() {
|
31444 | if (this.delegate.whenRenderingDone) {
|
31445 | return this.delegate.whenRenderingDone();
|
31446 | }
|
31447 | return Promise.resolve(null);
|
31448 | }
|
31449 | }
|
31450 | class DebugRenderer2 {
|
31451 | constructor(delegate) {
|
31452 | this.delegate = delegate;
|
31453 | |
31454 |
|
31455 |
|
31456 |
|
31457 |
|
31458 |
|
31459 |
|
31460 |
|
31461 | this.debugContextFactory = getCurrentDebugContext;
|
31462 | this.data = this.delegate.data;
|
31463 | }
|
31464 | createDebugContext(nativeElement) {
|
31465 | return this.debugContextFactory(nativeElement);
|
31466 | }
|
31467 | destroyNode(node) {
|
31468 | const debugNode = getDebugNode$1(node);
|
31469 | removeDebugNodeFromIndex(debugNode);
|
31470 | if (debugNode instanceof DebugNode__PRE_R3__) {
|
31471 | debugNode.listeners.length = 0;
|
31472 | }
|
31473 | if (this.delegate.destroyNode) {
|
31474 | this.delegate.destroyNode(node);
|
31475 | }
|
31476 | }
|
31477 | destroy() {
|
31478 | this.delegate.destroy();
|
31479 | }
|
31480 | createElement(name, namespace) {
|
31481 | const el = this.delegate.createElement(name, namespace);
|
31482 | const debugCtx = this.createDebugContext(el);
|
31483 | if (debugCtx) {
|
31484 | const debugEl = new DebugElement__PRE_R3__(el, null, debugCtx);
|
31485 | debugEl.name = name;
|
31486 | indexDebugNode(debugEl);
|
31487 | }
|
31488 | return el;
|
31489 | }
|
31490 | createComment(value) {
|
31491 | const comment = this.delegate.createComment(value);
|
31492 | const debugCtx = this.createDebugContext(comment);
|
31493 | if (debugCtx) {
|
31494 | indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx));
|
31495 | }
|
31496 | return comment;
|
31497 | }
|
31498 | createText(value) {
|
31499 | const text = this.delegate.createText(value);
|
31500 | const debugCtx = this.createDebugContext(text);
|
31501 | if (debugCtx) {
|
31502 | indexDebugNode(new DebugNode__PRE_R3__(text, null, debugCtx));
|
31503 | }
|
31504 | return text;
|
31505 | }
|
31506 | appendChild(parent, newChild) {
|
31507 | const debugEl = getDebugNode$1(parent);
|
31508 | const debugChildEl = getDebugNode$1(newChild);
|
31509 | if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31510 | debugEl.addChild(debugChildEl);
|
31511 | }
|
31512 | this.delegate.appendChild(parent, newChild);
|
31513 | }
|
31514 | insertBefore(parent, newChild, refChild) {
|
31515 | const debugEl = getDebugNode$1(parent);
|
31516 | const debugChildEl = getDebugNode$1(newChild);
|
31517 | const debugRefEl = getDebugNode$1(refChild);
|
31518 | if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31519 | debugEl.insertBefore(debugRefEl, debugChildEl);
|
31520 | }
|
31521 | this.delegate.insertBefore(parent, newChild, refChild);
|
31522 | }
|
31523 | removeChild(parent, oldChild) {
|
31524 | const debugEl = getDebugNode$1(parent);
|
31525 | const debugChildEl = getDebugNode$1(oldChild);
|
31526 | if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31527 | debugEl.removeChild(debugChildEl);
|
31528 | }
|
31529 | this.delegate.removeChild(parent, oldChild);
|
31530 | }
|
31531 | selectRootElement(selectorOrNode, preserveContent) {
|
31532 | const el = this.delegate.selectRootElement(selectorOrNode, preserveContent);
|
31533 | const debugCtx = getCurrentDebugContext();
|
31534 | if (debugCtx) {
|
31535 | indexDebugNode(new DebugElement__PRE_R3__(el, null, debugCtx));
|
31536 | }
|
31537 | return el;
|
31538 | }
|
31539 | setAttribute(el, name, value, namespace) {
|
31540 | const debugEl = getDebugNode$1(el);
|
31541 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31542 | const fullName = namespace ? namespace + ':' + name : name;
|
31543 | debugEl.attributes[fullName] = value;
|
31544 | }
|
31545 | this.delegate.setAttribute(el, name, value, namespace);
|
31546 | }
|
31547 | removeAttribute(el, name, namespace) {
|
31548 | const debugEl = getDebugNode$1(el);
|
31549 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31550 | const fullName = namespace ? namespace + ':' + name : name;
|
31551 | debugEl.attributes[fullName] = null;
|
31552 | }
|
31553 | this.delegate.removeAttribute(el, name, namespace);
|
31554 | }
|
31555 | addClass(el, name) {
|
31556 | const debugEl = getDebugNode$1(el);
|
31557 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31558 | debugEl.classes[name] = true;
|
31559 | }
|
31560 | this.delegate.addClass(el, name);
|
31561 | }
|
31562 | removeClass(el, name) {
|
31563 | const debugEl = getDebugNode$1(el);
|
31564 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31565 | debugEl.classes[name] = false;
|
31566 | }
|
31567 | this.delegate.removeClass(el, name);
|
31568 | }
|
31569 | setStyle(el, style, value, flags) {
|
31570 | const debugEl = getDebugNode$1(el);
|
31571 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31572 | debugEl.styles[style] = value;
|
31573 | }
|
31574 | this.delegate.setStyle(el, style, value, flags);
|
31575 | }
|
31576 | removeStyle(el, style, flags) {
|
31577 | const debugEl = getDebugNode$1(el);
|
31578 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31579 | debugEl.styles[style] = null;
|
31580 | }
|
31581 | this.delegate.removeStyle(el, style, flags);
|
31582 | }
|
31583 | setProperty(el, name, value) {
|
31584 | const debugEl = getDebugNode$1(el);
|
31585 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
31586 | debugEl.properties[name] = value;
|
31587 | }
|
31588 | this.delegate.setProperty(el, name, value);
|
31589 | }
|
31590 | listen(target, eventName, callback) {
|
31591 | if (typeof target !== 'string') {
|
31592 | const debugEl = getDebugNode$1(target);
|
31593 | if (debugEl) {
|
31594 | debugEl.listeners.push(new DebugEventListener(eventName, callback));
|
31595 | }
|
31596 | }
|
31597 | return this.delegate.listen(target, eventName, callback);
|
31598 | }
|
31599 | parentNode(node) {
|
31600 | return this.delegate.parentNode(node);
|
31601 | }
|
31602 | nextSibling(node) {
|
31603 | return this.delegate.nextSibling(node);
|
31604 | }
|
31605 | setValue(node, value) {
|
31606 | return this.delegate.setValue(node, value);
|
31607 | }
|
31608 | }
|
31609 |
|
31610 |
|
31611 |
|
31612 |
|
31613 |
|
31614 |
|
31615 |
|
31616 |
|
31617 | function overrideProvider(override) {
|
31618 | initServicesIfNeeded();
|
31619 | return Services.overrideProvider(override);
|
31620 | }
|
31621 | function overrideComponentView(comp, componentFactory) {
|
31622 | initServicesIfNeeded();
|
31623 | return Services.overrideComponentView(comp, componentFactory);
|
31624 | }
|
31625 | function clearOverrides() {
|
31626 | initServicesIfNeeded();
|
31627 | return Services.clearOverrides();
|
31628 | }
|
31629 |
|
31630 |
|
31631 | function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
|
31632 | return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
|
31633 | }
|
31634 | function cloneNgModuleDefinition(def) {
|
31635 | const providers = Array.from(def.providers);
|
31636 | const modules = Array.from(def.modules);
|
31637 | const providersByKey = {};
|
31638 | for (const key in def.providersByKey) {
|
31639 | providersByKey[key] = def.providersByKey[key];
|
31640 | }
|
31641 | return {
|
31642 | factory: def.factory,
|
31643 | scope: def.scope,
|
31644 | providers,
|
31645 | modules,
|
31646 | providersByKey,
|
31647 | };
|
31648 | }
|
31649 | class NgModuleFactory_ extends NgModuleFactory {
|
31650 | constructor(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
|
31651 |
|
31652 |
|
31653 | super();
|
31654 | this.moduleType = moduleType;
|
31655 | this._bootstrapComponents = _bootstrapComponents;
|
31656 | this._ngModuleDefFactory = _ngModuleDefFactory;
|
31657 | }
|
31658 | create(parentInjector) {
|
31659 | initServicesIfNeeded();
|
31660 |
|
31661 |
|
31662 |
|
31663 | const def = cloneNgModuleDefinition(resolveDefinition(this._ngModuleDefFactory));
|
31664 | return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def);
|
31665 | }
|
31666 | }
|
31667 |
|
31668 |
|
31669 |
|
31670 |
|
31671 |
|
31672 |
|
31673 |
|
31674 |
|
31675 |
|
31676 |
|
31677 |
|
31678 |
|
31679 |
|
31680 |
|
31681 |
|
31682 |
|
31683 |
|
31684 |
|
31685 |
|
31686 |
|
31687 |
|
31688 |
|
31689 |
|
31690 |
|
31691 |
|
31692 |
|
31693 |
|
31694 |
|
31695 |
|
31696 |
|
31697 |
|
31698 |
|
31699 |
|
31700 |
|
31701 |
|
31702 |
|
31703 |
|
31704 |
|
31705 |
|
31706 |
|
31707 |
|
31708 | if (ngDevMode) {
|
31709 |
|
31710 |
|
31711 |
|
31712 | _global.$localize = _global.$localize || function () {
|
31713 | throw new Error('It looks like your application or one of its dependencies is using i18n.\n' +
|
31714 | 'Angular 9 introduced a global `$localize()` function that needs to be loaded.\n' +
|
31715 | 'Please run `ng add @angular/localize` from the Angular CLI.\n' +
|
31716 | '(For non-CLI projects, add `import \'@angular/localize/init\';` to your `polyfills.ts` file.\n' +
|
31717 | 'For server-side rendering applications add the import to your `main.server.ts` file.)');
|
31718 | };
|
31719 | }
|
31720 |
|
31721 |
|
31722 |
|
31723 |
|
31724 |
|
31725 |
|
31726 |
|
31727 |
|
31728 |
|
31729 |
|
31730 |
|
31731 |
|
31732 |
|
31733 |
|
31734 |
|
31735 |
|
31736 |
|
31737 |
|
31738 |
|
31739 |
|
31740 |
|
31741 |
|
31742 | export { ANALYZE_FOR_ENTRY_COMPONENTS, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory, ComponentFactoryResolver, ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, Directive, ElementRef, EmbeddedViewRef, ErrorHandler, EventEmitter, Host, HostBinding, HostListener, INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID$1 as LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory, NgModuleFactoryLoader, NgModuleRef, NgProbeToken, NgZone, Optional, Output, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, Pipe, PlatformRef, Query, QueryList, ReflectiveInjector, ReflectiveKey, Renderer2, RendererFactory2, RendererStyleFlags2, ResolvedReflectiveFactory, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, SystemJsNgModuleLoader, SystemJsNgModuleLoaderConfig, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef$1 as ViewRef, WrappedValue, asNativeElements, assertPlatform, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, enableProdMode, forwardRef, getDebugNode$1 as getDebugNode, getModuleFactory, getPlatform, inject, isDevMode, platformCore, resolveForwardRef, setTestabilityGetter, ɵ0, ɵ1, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, APP_ID_RANDOM_PROVIDER as ɵAPP_ID_RANDOM_PROVIDER, ChangeDetectorStatus as ɵChangeDetectorStatus, CodegenComponentFactoryResolver as ɵCodegenComponentFactoryResolver, Compiler_compileModuleAndAllComponentsAsync__POST_R3__ as ɵCompiler_compileModuleAndAllComponentsAsync__POST_R3__, Compiler_compileModuleAndAllComponentsSync__POST_R3__ as ɵCompiler_compileModuleAndAllComponentsSync__POST_R3__, Compiler_compileModuleAsync__POST_R3__ as ɵCompiler_compileModuleAsync__POST_R3__, Compiler_compileModuleSync__POST_R3__ as ɵCompiler_compileModuleSync__POST_R3__, ComponentFactory as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, EMPTY_ARRAY$4 as ɵEMPTY_ARRAY, EMPTY_MAP as ɵEMPTY_MAP, INJECTOR_IMPL__POST_R3__ as ɵINJECTOR_IMPL__POST_R3__, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory$1 as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory$1 as ɵRender3ComponentFactory, ComponentRef$1 as ɵRender3ComponentRef, NgModuleRef$1 as ɵRender3NgModuleRef, SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__ as ɵSWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__, SWITCH_COMPILE_COMPONENT__POST_R3__ as ɵSWITCH_COMPILE_COMPONENT__POST_R3__, SWITCH_COMPILE_DIRECTIVE__POST_R3__ as ɵSWITCH_COMPILE_DIRECTIVE__POST_R3__, SWITCH_COMPILE_INJECTABLE__POST_R3__ as ɵSWITCH_COMPILE_INJECTABLE__POST_R3__, SWITCH_COMPILE_NGMODULE__POST_R3__ as ɵSWITCH_COMPILE_NGMODULE__POST_R3__, SWITCH_COMPILE_PIPE__POST_R3__ as ɵSWITCH_COMPILE_PIPE__POST_R3__, SWITCH_ELEMENT_REF_FACTORY__POST_R3__ as ɵSWITCH_ELEMENT_REF_FACTORY__POST_R3__, SWITCH_IVY_ENABLED__POST_R3__ as ɵSWITCH_IVY_ENABLED__POST_R3__, SWITCH_RENDERER2_FACTORY__POST_R3__ as ɵSWITCH_RENDERER2_FACTORY__POST_R3__, SWITCH_TEMPLATE_REF_FACTORY__POST_R3__ as ɵSWITCH_TEMPLATE_REF_FACTORY__POST_R3__, SWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__ as ɵSWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, anchorDef as ɵand, isForwardRef as ɵangular_packages_core_core_a, injectInjectorOnly as ɵangular_packages_core_core_b, instructionState as ɵangular_packages_core_core_ba, getLView as ɵangular_packages_core_core_bb, getPreviousOrParentTNode as ɵangular_packages_core_core_bc, getBindingRoot as ɵangular_packages_core_core_bd, nextContextImpl as ɵangular_packages_core_core_be, pureFunction1Internal as ɵangular_packages_core_core_bg, pureFunction2Internal as ɵangular_packages_core_core_bh, pureFunction3Internal as ɵangular_packages_core_core_bi, pureFunction4Internal as ɵangular_packages_core_core_bj, pureFunctionVInternal as ɵangular_packages_core_core_bk, getUrlSanitizer as ɵangular_packages_core_core_bl, makeParamDecorator as ɵangular_packages_core_core_bm, makePropDecorator as ɵangular_packages_core_core_bn, getClosureSafeProperty as ɵangular_packages_core_core_bo, getRootContext as ɵangular_packages_core_core_bq, i18nPostprocess as ɵangular_packages_core_core_br, NullInjector as ɵangular_packages_core_core_c, ReflectiveInjector_ as ɵangular_packages_core_core_d, ReflectiveDependency as ɵangular_packages_core_core_e, resolveReflectiveProviders as ɵangular_packages_core_core_f, _appIdRandomProviderFactory as ɵangular_packages_core_core_g, createElementRef as ɵangular_packages_core_core_h, createTemplateRef as ɵangular_packages_core_core_i, getModuleFactory__PRE_R3__ as ɵangular_packages_core_core_j, DebugNode__PRE_R3__ as ɵangular_packages_core_core_k, DebugElement__PRE_R3__ as ɵangular_packages_core_core_l, getDebugNodeR2__PRE_R3__ as ɵangular_packages_core_core_m, DefaultIterableDifferFactory as ɵangular_packages_core_core_n, DefaultKeyValueDifferFactory as ɵangular_packages_core_core_o, _iterableDiffersFactory as ɵangular_packages_core_core_p, _keyValueDiffersFactory as ɵangular_packages_core_core_q, _localeFactory as ɵangular_packages_core_core_r, APPLICATION_MODULE_PROVIDERS as ɵangular_packages_core_core_s, zoneSchedulerFactory as ɵangular_packages_core_core_t, USD_CURRENCY_CODE as ɵangular_packages_core_core_u, _def as ɵangular_packages_core_core_v, DebugContext as ɵangular_packages_core_core_w, NgOnChangesFeatureImpl as ɵangular_packages_core_core_x, SCHEDULER as ɵangular_packages_core_core_y, injectAttributeImpl as ɵangular_packages_core_core_z, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, createComponentFactory as ɵccf, clearOverrides as ɵclearOverrides, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, createNgModuleFactory as ɵcmf, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory__POST_R3__ as ɵcompileNgModuleFactory__POST_R3__, compilePipe as ɵcompilePipe, createInjector as ɵcreateInjector, createRendererType2 as ɵcrt, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, detectChanges as ɵdetectChanges, devModeEqual as ɵdevModeEqual, directiveDef as ɵdid, elementDef as ɵeld, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, getComponentViewDefinitionFactory as ɵgetComponentViewDefinitionFactory, getDebugNodeR2 as ɵgetDebugNodeR2, getDebugNode__POST_R3__ as ɵgetDebugNode__POST_R3__, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getModuleFactory__POST_R3__ as ɵgetModuleFactory__POST_R3__, getSanitizationBypassType as ɵgetSanitizationBypassType, _global as ɵglobal, initServicesIfNeeded as ɵinitServicesIfNeeded, inlineInterpolate as ɵinlineInterpolate, interpolate as ɵinterpolate, isBoundToModule__POST_R3__ as ɵisBoundToModule__POST_R3__, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy, isListLikeIterable as ɵisListLikeIterable, isObservable as ɵisObservable, isPromise as ɵisPromise, ivyEnabled as ɵivyEnabled, makeDecorator as ɵmakeDecorator, markDirty as ɵmarkDirty, moduleDef as ɵmod, moduleProvideDef as ɵmpd, ngContentDef as ɵncd, noSideEffects as ɵnoSideEffects, nodeValue as ɵnov, overrideComponentView as ɵoverrideComponentView, overrideProvider as ɵoverrideProvider, pureArrayDef as ɵpad, patchComponentDefWithScope as ɵpatchComponentDefWithScope, pipeDef as ɵpid, pureObjectDef as ɵpod, purePipeDef as ɵppd, providerDef as ɵprd, publishDefaultGlobalUtils as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, queryDef as ɵqud, registerLocaleData as ɵregisterLocaleData, registerModuleFactory as ɵregisterModuleFactory, registerNgModuleType as ɵregisterNgModuleType, renderComponent$1 as ɵrenderComponent, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, setClassMetadata as ɵsetClassMetadata, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setLocaleId as ɵsetLocaleId, store as ɵstore, stringify as ɵstringify, textDef as ɵted, transitiveScopesFor as ɵtransitiveScopesFor, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapValue as ɵunv, unwrapSafeValue as ɵunwrapSafeValue, viewDef as ɵvid, whenRendered as ɵwhenRendered, ɵɵCopyDefinitionFeature, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵadvance, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcontentQuery, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetCurrentView, ɵɵgetFactoryOf, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinjectPipeChangeDetectorRef, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryRefresh, ɵɵreference, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵselect, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstaticContentQuery, ɵɵstaticViewQuery, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵviewQuery };
|
31743 |
|