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 | function getClosureSafeProperty(objWithPropertyToExtract) {
|
18 | for (let key in objWithPropertyToExtract) {
|
19 | if (objWithPropertyToExtract[key] === getClosureSafeProperty) {
|
20 | return key;
|
21 | }
|
22 | }
|
23 | throw Error('Could not find renamed property on target object.');
|
24 | }
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | function fillProperties(target, source) {
|
32 | for (const key in source) {
|
33 | if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {
|
34 | target[key] = source[key];
|
35 | }
|
36 | }
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | function stringify(token) {
|
47 | if (typeof token === 'string') {
|
48 | return token;
|
49 | }
|
50 | if (Array.isArray(token)) {
|
51 | return '[' + token.map(stringify).join(', ') + ']';
|
52 | }
|
53 | if (token == null) {
|
54 | return '' + token;
|
55 | }
|
56 | if (token.overriddenName) {
|
57 | return `${token.overriddenName}`;
|
58 | }
|
59 | if (token.name) {
|
60 | return `${token.name}`;
|
61 | }
|
62 | const res = token.toString();
|
63 | if (res == null) {
|
64 | return '' + res;
|
65 | }
|
66 | const newLineIndex = res.indexOf('\n');
|
67 | return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
|
68 | }
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 | function concatStringsWithSpace(before, after) {
|
78 | return (before == null || before === '') ?
|
79 | (after === null ? '' : after) :
|
80 | ((after == null || after === '') ? before : before + ' ' + after);
|
81 | }
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | const __forward_ref__ = getClosureSafeProperty({ __forward_ref__: getClosureSafeProperty });
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 | function forwardRef(forwardRefFn) {
|
104 | forwardRefFn.__forward_ref__ = forwardRef;
|
105 | forwardRefFn.toString = function () {
|
106 | return stringify(this());
|
107 | };
|
108 | return forwardRefFn;
|
109 | }
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 | function resolveForwardRef(type) {
|
124 | return isForwardRef(type) ? type() : type;
|
125 | }
|
126 |
|
127 | function isForwardRef(fn) {
|
128 | return typeof fn === 'function' && fn.hasOwnProperty(__forward_ref__) &&
|
129 | fn.__forward_ref__ === forwardRef;
|
130 | }
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 | const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 | class RuntimeError extends Error {
|
156 | constructor(code, message) {
|
157 | super(formatRuntimeError(code, message));
|
158 | this.code = code;
|
159 | }
|
160 | }
|
161 |
|
162 |
|
163 |
|
164 | const RUNTIME_ERRORS_WITH_GUIDES = new Set([
|
165 | "100" ,
|
166 | "200" ,
|
167 | "201" ,
|
168 | "300" ,
|
169 | "301" ,
|
170 | "302" ,
|
171 | ]);
|
172 |
|
173 |
|
174 | function formatRuntimeError(code, message) {
|
175 | const fullCode = code ? `NG0${code}: ` : '';
|
176 | let errorMessage = `${fullCode}${message}`;
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 | if (ngDevMode && RUNTIME_ERRORS_WITH_GUIDES.has(code)) {
|
184 | errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0${code}`;
|
185 | }
|
186 | return errorMessage;
|
187 | }
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 | function renderStringify(value) {
|
203 | if (typeof value === 'string')
|
204 | return value;
|
205 | if (value == null)
|
206 | return '';
|
207 |
|
208 |
|
209 | return String(value);
|
210 | }
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 | function stringifyForError(value) {
|
217 | if (typeof value === 'function')
|
218 | return value.name || value.toString();
|
219 | if (typeof value === 'object' && value != null && typeof value.type === 'function') {
|
220 | return value.type.name || value.type.toString();
|
221 | }
|
222 | return renderStringify(value);
|
223 | }
|
224 |
|
225 |
|
226 | function throwCyclicDependencyError(token, path) {
|
227 | const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';
|
228 | throw new RuntimeError("200" , `Circular dependency in DI detected for ${token}${depPath}`);
|
229 | }
|
230 | function throwMixedMultiProviderError() {
|
231 | throw new Error(`Cannot mix multi providers and regular providers`);
|
232 | }
|
233 | function throwInvalidProviderError(ngModuleType, providers, provider) {
|
234 | let ngModuleDetail = '';
|
235 | if (ngModuleType && providers) {
|
236 | const providerDetail = providers.map(v => v == provider ? '?' + provider + '?' : '...');
|
237 | ngModuleDetail =
|
238 | ` - only instances of Provider and Type are allowed, got: [${providerDetail.join(', ')}]`;
|
239 | }
|
240 | throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}'` + ngModuleDetail);
|
241 | }
|
242 |
|
243 | function throwProviderNotFoundError(token, injectorName) {
|
244 | const injectorDetails = injectorName ? ` in ${injectorName}` : '';
|
245 | throw new RuntimeError("201" , `No provider for ${stringifyForError(token)} found${injectorDetails}`);
|
246 | }
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 | function assertNumber(actual, msg) {
|
256 | if (!(typeof actual === 'number')) {
|
257 | throwError(msg, typeof actual, 'number', '===');
|
258 | }
|
259 | }
|
260 | function assertNumberInRange(actual, minInclusive, maxInclusive) {
|
261 | assertNumber(actual, 'Expected a number');
|
262 | assertLessThanOrEqual(actual, maxInclusive, 'Expected number to be less than or equal to');
|
263 | assertGreaterThanOrEqual(actual, minInclusive, 'Expected number to be greater than or equal to');
|
264 | }
|
265 | function assertString(actual, msg) {
|
266 | if (!(typeof actual === 'string')) {
|
267 | throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
|
268 | }
|
269 | }
|
270 | function assertFunction(actual, msg) {
|
271 | if (!(typeof actual === 'function')) {
|
272 | throwError(msg, actual === null ? 'null' : typeof actual, 'function', '===');
|
273 | }
|
274 | }
|
275 | function assertEqual(actual, expected, msg) {
|
276 | if (!(actual == expected)) {
|
277 | throwError(msg, actual, expected, '==');
|
278 | }
|
279 | }
|
280 | function assertNotEqual(actual, expected, msg) {
|
281 | if (!(actual != expected)) {
|
282 | throwError(msg, actual, expected, '!=');
|
283 | }
|
284 | }
|
285 | function assertSame(actual, expected, msg) {
|
286 | if (!(actual === expected)) {
|
287 | throwError(msg, actual, expected, '===');
|
288 | }
|
289 | }
|
290 | function assertNotSame(actual, expected, msg) {
|
291 | if (!(actual !== expected)) {
|
292 | throwError(msg, actual, expected, '!==');
|
293 | }
|
294 | }
|
295 | function assertLessThan(actual, expected, msg) {
|
296 | if (!(actual < expected)) {
|
297 | throwError(msg, actual, expected, '<');
|
298 | }
|
299 | }
|
300 | function assertLessThanOrEqual(actual, expected, msg) {
|
301 | if (!(actual <= expected)) {
|
302 | throwError(msg, actual, expected, '<=');
|
303 | }
|
304 | }
|
305 | function assertGreaterThan(actual, expected, msg) {
|
306 | if (!(actual > expected)) {
|
307 | throwError(msg, actual, expected, '>');
|
308 | }
|
309 | }
|
310 | function assertGreaterThanOrEqual(actual, expected, msg) {
|
311 | if (!(actual >= expected)) {
|
312 | throwError(msg, actual, expected, '>=');
|
313 | }
|
314 | }
|
315 | function assertNotDefined(actual, msg) {
|
316 | if (actual != null) {
|
317 | throwError(msg, actual, null, '==');
|
318 | }
|
319 | }
|
320 | function assertDefined(actual, msg) {
|
321 | if (actual == null) {
|
322 | throwError(msg, actual, null, '!=');
|
323 | }
|
324 | }
|
325 | function throwError(msg, actual, expected, comparison) {
|
326 | throw new Error(`ASSERTION ERROR: ${msg}` +
|
327 | (comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));
|
328 | }
|
329 | function assertDomNode(node) {
|
330 |
|
331 | if (!(typeof Node !== 'undefined' && node instanceof Node) &&
|
332 | !(typeof node === 'object' && node != null &&
|
333 | node.constructor.name === 'WebWorkerRenderNode')) {
|
334 | throwError(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`);
|
335 | }
|
336 | }
|
337 | function assertIndexInRange(arr, index) {
|
338 | assertDefined(arr, 'Array must be defined.');
|
339 | const maxLen = arr.length;
|
340 | if (index < 0 || index >= maxLen) {
|
341 | throwError(`Index expected to be less than ${maxLen} but got ${index}`);
|
342 | }
|
343 | }
|
344 | function assertOneOf(value, ...validValues) {
|
345 | if (validValues.indexOf(value) !== -1)
|
346 | return true;
|
347 | throwError(`Expected value to be one of ${JSON.stringify(validValues)} but was ${JSON.stringify(value)}.`);
|
348 | }
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 | function ɵɵdefineInjectable(opts) {
|
375 | return {
|
376 | token: opts.token,
|
377 | providedIn: opts.providedIn || null,
|
378 | factory: opts.factory,
|
379 | value: undefined,
|
380 | };
|
381 | }
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 | const defineInjectable = ɵɵdefineInjectable;
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 | function ɵɵdefineInjector(options) {
|
406 | return { providers: options.providers || [], imports: options.imports || [] };
|
407 | }
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 | function getInjectableDef(type) {
|
415 | return getOwnDefinition(type, NG_PROV_DEF) || getOwnDefinition(type, NG_INJECTABLE_DEF);
|
416 | }
|
417 |
|
418 |
|
419 |
|
420 |
|
421 | function getOwnDefinition(type, field) {
|
422 | return type.hasOwnProperty(field) ? type[field] : null;
|
423 | }
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 | function getInheritedInjectableDef(type) {
|
433 | const def = type && (type[NG_PROV_DEF] || type[NG_INJECTABLE_DEF]);
|
434 | if (def) {
|
435 | const typeName = getTypeName(type);
|
436 |
|
437 |
|
438 | console.warn(`DEPRECATED: DI is instantiating a token "${typeName}" that inherits its @Injectable decorator but does not provide one itself.\n` +
|
439 | `This will become an error in a future version of Angular. Please add @Injectable() to the "${typeName}" class.`);
|
440 | return def;
|
441 | }
|
442 | else {
|
443 | return null;
|
444 | }
|
445 | }
|
446 |
|
447 | function getTypeName(type) {
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 | if (type.hasOwnProperty('name')) {
|
455 | return type.name;
|
456 | }
|
457 | const match = ('' + type).match(/^function\s*([^\s(]+)/);
|
458 | return match === null ? '' : match[1];
|
459 | }
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 | function getInjectorDef(type) {
|
466 | return type && (type.hasOwnProperty(NG_INJ_DEF) || type.hasOwnProperty(NG_INJECTOR_DEF)) ?
|
467 | type[NG_INJ_DEF] :
|
468 | null;
|
469 | }
|
470 | const NG_PROV_DEF = getClosureSafeProperty({ ɵprov: getClosureSafeProperty });
|
471 | const NG_INJ_DEF = getClosureSafeProperty({ ɵinj: getClosureSafeProperty });
|
472 |
|
473 | const NG_INJECTABLE_DEF = getClosureSafeProperty({ ngInjectableDef: getClosureSafeProperty });
|
474 | const NG_INJECTOR_DEF = getClosureSafeProperty({ ngInjectorDef: getClosureSafeProperty });
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 | var InjectFlags;
|
489 | (function (InjectFlags) {
|
490 |
|
491 |
|
492 |
|
493 | InjectFlags[InjectFlags["Default"] = 0] = "Default";
|
494 | |
495 |
|
496 |
|
497 |
|
498 | InjectFlags[InjectFlags["Host"] = 1] = "Host";
|
499 |
|
500 | InjectFlags[InjectFlags["Self"] = 2] = "Self";
|
501 |
|
502 | InjectFlags[InjectFlags["SkipSelf"] = 4] = "SkipSelf";
|
503 |
|
504 | InjectFlags[InjectFlags["Optional"] = 8] = "Optional";
|
505 | })(InjectFlags || (InjectFlags = {}));
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 | let _injectImplementation;
|
524 | function getInjectImplementation() {
|
525 | return _injectImplementation;
|
526 | }
|
527 |
|
528 |
|
529 |
|
530 | function setInjectImplementation(impl) {
|
531 | const previous = _injectImplementation;
|
532 | _injectImplementation = impl;
|
533 | return previous;
|
534 | }
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 | function injectRootLimpMode(token, notFoundValue, flags) {
|
543 | const injectableDef = getInjectableDef(token);
|
544 | if (injectableDef && injectableDef.providedIn == 'root') {
|
545 | return injectableDef.value === undefined ? injectableDef.value = injectableDef.factory() :
|
546 | injectableDef.value;
|
547 | }
|
548 | if (flags & InjectFlags.Optional)
|
549 | return null;
|
550 | if (notFoundValue !== undefined)
|
551 | return notFoundValue;
|
552 | throwProviderNotFoundError(stringify(token), 'Injector');
|
553 | }
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 | function assertInjectImplementationNotEqual(fn) {
|
562 | ngDevMode &&
|
563 | assertNotEqual(_injectImplementation, fn, 'Calling ɵɵinject would cause infinite recursion');
|
564 | }
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 | function noSideEffects(fn) {
|
583 | return { toString: fn }.toString();
|
584 | }
|
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 | var ChangeDetectionStrategy;
|
602 | (function (ChangeDetectionStrategy) {
|
603 | |
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 | ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
|
610 | |
611 |
|
612 |
|
613 |
|
614 | ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
|
615 | })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
|
616 |
|
617 |
|
618 |
|
619 |
|
620 | var ChangeDetectorStatus;
|
621 | (function (ChangeDetectorStatus) {
|
622 | |
623 |
|
624 |
|
625 |
|
626 | ChangeDetectorStatus[ChangeDetectorStatus["CheckOnce"] = 0] = "CheckOnce";
|
627 | |
628 |
|
629 |
|
630 |
|
631 | ChangeDetectorStatus[ChangeDetectorStatus["Checked"] = 1] = "Checked";
|
632 | |
633 |
|
634 |
|
635 |
|
636 | ChangeDetectorStatus[ChangeDetectorStatus["CheckAlways"] = 2] = "CheckAlways";
|
637 | |
638 |
|
639 |
|
640 |
|
641 | ChangeDetectorStatus[ChangeDetectorStatus["Detached"] = 3] = "Detached";
|
642 | |
643 |
|
644 |
|
645 |
|
646 |
|
647 | ChangeDetectorStatus[ChangeDetectorStatus["Errored"] = 4] = "Errored";
|
648 | |
649 |
|
650 |
|
651 | ChangeDetectorStatus[ChangeDetectorStatus["Destroyed"] = 5] = "Destroyed";
|
652 | })(ChangeDetectorStatus || (ChangeDetectorStatus = {}));
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 | function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
|
661 | return changeDetectionStrategy == null ||
|
662 | changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
663 | }
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 | var ViewEncapsulation$1;
|
685 | (function (ViewEncapsulation) {
|
686 |
|
687 |
|
688 | |
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 | ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
|
697 |
|
698 | |
699 |
|
700 |
|
701 | ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
|
702 | |
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 | ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
|
710 | })(ViewEncapsulation$1 || (ViewEncapsulation$1 = {}));
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 | const __globalThis = typeof globalThis !== 'undefined' && globalThis;
|
720 | const __window = typeof window !== 'undefined' && window;
|
721 | const __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
722 | self instanceof WorkerGlobalScope && self;
|
723 | const __global = typeof global !== 'undefined' && global;
|
724 |
|
725 |
|
726 |
|
727 | const _global = __globalThis || __global || __window || __self;
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 | function ngDevModeResetPerfCounters() {
|
737 | const locationString = typeof location !== 'undefined' ? location.toString() : '';
|
738 | const newCounters = {
|
739 | namedConstructors: locationString.indexOf('ngDevMode=namedConstructors') != -1,
|
740 | firstCreatePass: 0,
|
741 | tNode: 0,
|
742 | tView: 0,
|
743 | rendererCreateTextNode: 0,
|
744 | rendererSetText: 0,
|
745 | rendererCreateElement: 0,
|
746 | rendererAddEventListener: 0,
|
747 | rendererSetAttribute: 0,
|
748 | rendererRemoveAttribute: 0,
|
749 | rendererSetProperty: 0,
|
750 | rendererSetClassName: 0,
|
751 | rendererAddClass: 0,
|
752 | rendererRemoveClass: 0,
|
753 | rendererSetStyle: 0,
|
754 | rendererRemoveStyle: 0,
|
755 | rendererDestroy: 0,
|
756 | rendererDestroyNode: 0,
|
757 | rendererMoveNode: 0,
|
758 | rendererRemoveNode: 0,
|
759 | rendererAppendChild: 0,
|
760 | rendererInsertBefore: 0,
|
761 | rendererCreateComment: 0,
|
762 | };
|
763 |
|
764 | const allowNgDevModeTrue = locationString.indexOf('ngDevMode=false') === -1;
|
765 | _global['ngDevMode'] = allowNgDevModeTrue && newCounters;
|
766 | return newCounters;
|
767 | }
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 | function initNgDevMode() {
|
790 |
|
791 |
|
792 |
|
793 |
|
794 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
795 | if (typeof ngDevMode !== 'object') {
|
796 | ngDevModeResetPerfCounters();
|
797 | }
|
798 | return typeof ngDevMode !== 'undefined' && !!ngDevMode;
|
799 | }
|
800 | return false;
|
801 | }
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 | const EMPTY_OBJ = {};
|
817 | const EMPTY_ARRAY = [];
|
818 |
|
819 | if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
|
820 |
|
821 |
|
822 |
|
823 | Object.freeze(EMPTY_OBJ);
|
824 |
|
825 | Object.freeze(EMPTY_ARRAY);
|
826 | }
|
827 |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 | const NG_COMP_DEF = getClosureSafeProperty({ ɵcmp: getClosureSafeProperty });
|
836 | const NG_DIR_DEF = getClosureSafeProperty({ ɵdir: getClosureSafeProperty });
|
837 | const NG_PIPE_DEF = getClosureSafeProperty({ ɵpipe: getClosureSafeProperty });
|
838 | const NG_MOD_DEF = getClosureSafeProperty({ ɵmod: getClosureSafeProperty });
|
839 | const NG_FACTORY_DEF = getClosureSafeProperty({ ɵfac: getClosureSafeProperty });
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty });
|
847 |
|
848 |
|
849 |
|
850 |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 | let _renderCompCount$1 = 0;
|
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 | function ɵɵdefineComponent(componentDefinition) {
|
873 | return noSideEffects(() => {
|
874 |
|
875 |
|
876 | (typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();
|
877 | const type = componentDefinition.type;
|
878 | const declaredInputs = {};
|
879 | const def = {
|
880 | type: type,
|
881 | providersResolver: null,
|
882 | decls: componentDefinition.decls,
|
883 | vars: componentDefinition.vars,
|
884 | factory: null,
|
885 | template: componentDefinition.template || null,
|
886 | consts: componentDefinition.consts || null,
|
887 | ngContentSelectors: componentDefinition.ngContentSelectors,
|
888 | hostBindings: componentDefinition.hostBindings || null,
|
889 | hostVars: componentDefinition.hostVars || 0,
|
890 | hostAttrs: componentDefinition.hostAttrs || null,
|
891 | contentQueries: componentDefinition.contentQueries || null,
|
892 | declaredInputs: declaredInputs,
|
893 | inputs: null,
|
894 | outputs: null,
|
895 | exportAs: componentDefinition.exportAs || null,
|
896 | onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
|
897 | directiveDefs: null,
|
898 | pipeDefs: null,
|
899 | selectors: componentDefinition.selectors || EMPTY_ARRAY,
|
900 | viewQuery: componentDefinition.viewQuery || null,
|
901 | features: componentDefinition.features || null,
|
902 | data: componentDefinition.data || {},
|
903 | encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,
|
904 | id: 'c',
|
905 | styles: componentDefinition.styles || EMPTY_ARRAY,
|
906 | _: null,
|
907 | setInput: null,
|
908 | schemas: componentDefinition.schemas || null,
|
909 | tView: null,
|
910 | };
|
911 | const directiveTypes = componentDefinition.directives;
|
912 | const feature = componentDefinition.features;
|
913 | const pipeTypes = componentDefinition.pipes;
|
914 | def.id += _renderCompCount$1++;
|
915 | def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
|
916 | def.outputs = invertObject(componentDefinition.outputs),
|
917 | feature && feature.forEach((fn) => fn(def));
|
918 | def.directiveDefs = directiveTypes ?
|
919 | () => (typeof directiveTypes === 'function' ? directiveTypes() : directiveTypes)
|
920 | .map(extractDirectiveDef) :
|
921 | null;
|
922 | def.pipeDefs = pipeTypes ?
|
923 | () => (typeof pipeTypes === 'function' ? pipeTypes() : pipeTypes).map(extractPipeDef) :
|
924 | null;
|
925 | return def;
|
926 | });
|
927 | }
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 | function ɵɵsetComponentScope(type, directives, pipes) {
|
938 | const def = type.ɵcmp;
|
939 | def.directiveDefs = () => directives.map(extractDirectiveDef);
|
940 | def.pipeDefs = () => pipes.map(extractPipeDef);
|
941 | }
|
942 | function extractDirectiveDef(type) {
|
943 | const def = getComponentDef(type) || getDirectiveDef(type);
|
944 | if (ngDevMode && !def) {
|
945 | throw new Error(`'${type.name}' is neither 'ComponentType' or 'DirectiveType'.`);
|
946 | }
|
947 | return def;
|
948 | }
|
949 | function extractPipeDef(type) {
|
950 | const def = getPipeDef$1(type);
|
951 | if (ngDevMode && !def) {
|
952 | throw new Error(`'${type.name}' is not a 'PipeType'.`);
|
953 | }
|
954 | return def;
|
955 | }
|
956 | const autoRegisterModuleById = {};
|
957 |
|
958 |
|
959 |
|
960 | function ɵɵdefineNgModule(def) {
|
961 | return noSideEffects(() => {
|
962 | const res = {
|
963 | type: def.type,
|
964 | bootstrap: def.bootstrap || EMPTY_ARRAY,
|
965 | declarations: def.declarations || EMPTY_ARRAY,
|
966 | imports: def.imports || EMPTY_ARRAY,
|
967 | exports: def.exports || EMPTY_ARRAY,
|
968 | transitiveCompileScopes: null,
|
969 | schemas: def.schemas || null,
|
970 | id: def.id || null,
|
971 | };
|
972 | if (def.id != null) {
|
973 | autoRegisterModuleById[def.id] = def.type;
|
974 | }
|
975 | return res;
|
976 | });
|
977 | }
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 | function ɵɵsetNgModuleScope(type, scope) {
|
989 | return noSideEffects(() => {
|
990 | const ngModuleDef = getNgModuleDef(type, true);
|
991 | ngModuleDef.declarations = scope.declarations || EMPTY_ARRAY;
|
992 | ngModuleDef.imports = scope.imports || EMPTY_ARRAY;
|
993 | ngModuleDef.exports = scope.exports || EMPTY_ARRAY;
|
994 | });
|
995 | }
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 | function invertObject(obj, secondary) {
|
1052 | if (obj == null)
|
1053 | return EMPTY_OBJ;
|
1054 | const newLookup = {};
|
1055 | for (const minifiedKey in obj) {
|
1056 | if (obj.hasOwnProperty(minifiedKey)) {
|
1057 | let publicName = obj[minifiedKey];
|
1058 | let declaredName = publicName;
|
1059 | if (Array.isArray(publicName)) {
|
1060 | declaredName = publicName[1];
|
1061 | publicName = publicName[0];
|
1062 | }
|
1063 | newLookup[publicName] = minifiedKey;
|
1064 | if (secondary) {
|
1065 | (secondary[publicName] = declaredName);
|
1066 | }
|
1067 | }
|
1068 | }
|
1069 | return newLookup;
|
1070 | }
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 | const ɵɵdefineDirective = ɵɵdefineComponent;
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 | function ɵɵdefinePipe(pipeDef) {
|
1105 | return {
|
1106 | type: pipeDef.type,
|
1107 | name: pipeDef.name,
|
1108 | factory: null,
|
1109 | pure: pipeDef.pure !== false,
|
1110 | onDestroy: pipeDef.type.prototype.ngOnDestroy || null
|
1111 | };
|
1112 | }
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 | function getComponentDef(type) {
|
1119 | return type[NG_COMP_DEF] || null;
|
1120 | }
|
1121 | function getDirectiveDef(type) {
|
1122 | return type[NG_DIR_DEF] || null;
|
1123 | }
|
1124 | function getPipeDef$1(type) {
|
1125 | return type[NG_PIPE_DEF] || null;
|
1126 | }
|
1127 | function getNgModuleDef(type, throwNotFound) {
|
1128 | const ngModuleDef = type[NG_MOD_DEF] || null;
|
1129 | if (!ngModuleDef && throwNotFound === true) {
|
1130 | throw new Error(`Type ${stringify(type)} does not have 'ɵmod' property.`);
|
1131 | }
|
1132 | return ngModuleDef;
|
1133 | }
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 | const HOST = 0;
|
1146 | const TVIEW = 1;
|
1147 | const FLAGS = 2;
|
1148 | const PARENT = 3;
|
1149 | const NEXT = 4;
|
1150 | const TRANSPLANTED_VIEWS_TO_REFRESH = 5;
|
1151 | const T_HOST = 6;
|
1152 | const CLEANUP = 7;
|
1153 | const CONTEXT = 8;
|
1154 | const INJECTOR$1 = 9;
|
1155 | const RENDERER_FACTORY = 10;
|
1156 | const RENDERER = 11;
|
1157 | const SANITIZER = 12;
|
1158 | const CHILD_HEAD = 13;
|
1159 | const CHILD_TAIL = 14;
|
1160 |
|
1161 | const DECLARATION_VIEW = 15;
|
1162 | const DECLARATION_COMPONENT_VIEW = 16;
|
1163 | const DECLARATION_LCONTAINER = 17;
|
1164 | const PREORDER_HOOK_FLAGS = 18;
|
1165 | const QUERIES = 19;
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 | const HEADER_OFFSET = 20;
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 | const TViewTypeAsString = [
|
1179 | 'Root',
|
1180 | 'Component',
|
1181 | 'Embedded',
|
1182 | ];
|
1183 |
|
1184 |
|
1185 | const unusedValueExportToPlacateAjd$8 = 1;
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 | const TYPE = 1;
|
1200 |
|
1201 |
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 | const HAS_TRANSPLANTED_VIEWS = 2;
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 | const NATIVE = 7;
|
1219 | const VIEW_REFS = 8;
|
1220 | const MOVED_VIEWS = 9;
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 | const CONTAINER_HEADER_OFFSET = 10;
|
1228 |
|
1229 |
|
1230 | const unusedValueExportToPlacateAjd$7 = 1;
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 | function isLView(value) {
|
1244 | return Array.isArray(value) && typeof value[TYPE] === 'object';
|
1245 | }
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 | function isLContainer(value) {
|
1251 | return Array.isArray(value) && value[TYPE] === true;
|
1252 | }
|
1253 | function isContentQueryHost(tNode) {
|
1254 | return (tNode.flags & 8 ) !== 0;
|
1255 | }
|
1256 | function isComponentHost(tNode) {
|
1257 | return (tNode.flags & 2 ) === 2 ;
|
1258 | }
|
1259 | function isDirectiveHost(tNode) {
|
1260 | return (tNode.flags & 1 ) === 1 ;
|
1261 | }
|
1262 | function isComponentDef(def) {
|
1263 | return def.template !== null;
|
1264 | }
|
1265 | function isRootView(target) {
|
1266 | return (target[FLAGS] & 512 ) !== 0;
|
1267 | }
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 | function assertTNodeForLView(tNode, lView) {
|
1279 | assertTNodeForTView(tNode, lView[TVIEW]);
|
1280 | }
|
1281 | function assertTNodeForTView(tNode, tView) {
|
1282 | assertTNode(tNode);
|
1283 | tNode.hasOwnProperty('tView_') &&
|
1284 | assertEqual(tNode.tView_, tView, 'This TNode does not belong to this TView.');
|
1285 | }
|
1286 | function assertTNode(tNode) {
|
1287 | assertDefined(tNode, 'TNode must be defined');
|
1288 | if (!(tNode && typeof tNode === 'object' && tNode.hasOwnProperty('directiveStylingLast'))) {
|
1289 | throwError('Not of type TNode, got: ' + tNode);
|
1290 | }
|
1291 | }
|
1292 | function assertTIcu(tIcu) {
|
1293 | assertDefined(tIcu, 'Expected TIcu to be defined');
|
1294 | if (!(typeof tIcu.currentCaseLViewIndex === 'number')) {
|
1295 | throwError('Object is not of TIcu type.');
|
1296 | }
|
1297 | }
|
1298 | function assertComponentType(actual, msg = 'Type passed in is not ComponentType, it does not have \'ɵcmp\' property.') {
|
1299 | if (!getComponentDef(actual)) {
|
1300 | throwError(msg);
|
1301 | }
|
1302 | }
|
1303 | function assertNgModuleType(actual, msg = 'Type passed in is not NgModuleType, it does not have \'ɵmod\' property.') {
|
1304 | if (!getNgModuleDef(actual)) {
|
1305 | throwError(msg);
|
1306 | }
|
1307 | }
|
1308 | function assertCurrentTNodeIsParent(isParent) {
|
1309 | assertEqual(isParent, true, 'currentTNode should be a parent');
|
1310 | }
|
1311 | function assertHasParent(tNode) {
|
1312 | assertDefined(tNode, 'currentTNode should exist!');
|
1313 | assertDefined(tNode.parent, 'currentTNode should have a parent');
|
1314 | }
|
1315 | function assertDataNext(lView, index, arr) {
|
1316 | if (arr == null)
|
1317 | arr = lView;
|
1318 | assertEqual(arr.length, index, `index ${index} expected to be at the end of arr (length ${arr.length})`);
|
1319 | }
|
1320 | function assertLContainer(value) {
|
1321 | assertDefined(value, 'LContainer must be defined');
|
1322 | assertEqual(isLContainer(value), true, 'Expecting LContainer');
|
1323 | }
|
1324 | function assertLViewOrUndefined(value) {
|
1325 | value && assertEqual(isLView(value), true, 'Expecting LView or undefined or null');
|
1326 | }
|
1327 | function assertLView(value) {
|
1328 | assertDefined(value, 'LView must be defined');
|
1329 | assertEqual(isLView(value), true, 'Expecting LView');
|
1330 | }
|
1331 | function assertFirstCreatePass(tView, errMessage) {
|
1332 | assertEqual(tView.firstCreatePass, true, errMessage || 'Should only be called in first create pass.');
|
1333 | }
|
1334 | function assertFirstUpdatePass(tView, errMessage) {
|
1335 | assertEqual(tView.firstUpdatePass, true, errMessage || 'Should only be called in first update pass.');
|
1336 | }
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 | function assertDirectiveDef(obj) {
|
1342 | if (obj.type === undefined || obj.selectors == undefined || obj.inputs === undefined) {
|
1343 | throwError(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);
|
1344 | }
|
1345 | }
|
1346 | function assertIndexInDeclRange(lView, index) {
|
1347 | const tView = lView[1];
|
1348 | assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);
|
1349 | }
|
1350 | function assertIndexInVarsRange(lView, index) {
|
1351 | const tView = lView[1];
|
1352 | assertBetween(tView.bindingStartIndex, tView.expandoStartIndex, index);
|
1353 | }
|
1354 | function assertIndexInExpandoRange(lView, index) {
|
1355 | const tView = lView[1];
|
1356 | assertBetween(tView.expandoStartIndex, lView.length, index);
|
1357 | }
|
1358 | function assertBetween(lower, upper, index) {
|
1359 | if (!(lower <= index && index < upper)) {
|
1360 | throwError(`Index out of range (expecting ${lower} <= ${index} < ${upper})`);
|
1361 | }
|
1362 | }
|
1363 | function assertProjectionSlots(lView, errMessage) {
|
1364 | assertDefined(lView[DECLARATION_COMPONENT_VIEW], 'Component views should exist.');
|
1365 | assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, errMessage ||
|
1366 | 'Components with projection nodes (<ng-content>) must have projection slots defined.');
|
1367 | }
|
1368 | function assertParentView(lView, errMessage) {
|
1369 | assertDefined(lView, errMessage || 'Component views should always have a parent view (component\'s host view)');
|
1370 | }
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 | function assertNodeInjector(lView, injectorIndex) {
|
1379 | assertIndexInExpandoRange(lView, injectorIndex);
|
1380 | assertIndexInExpandoRange(lView, injectorIndex + 8 );
|
1381 | assertNumber(lView[injectorIndex + 0], 'injectorIndex should point to a bloom filter');
|
1382 | assertNumber(lView[injectorIndex + 1], 'injectorIndex should point to a bloom filter');
|
1383 | assertNumber(lView[injectorIndex + 2], 'injectorIndex should point to a bloom filter');
|
1384 | assertNumber(lView[injectorIndex + 3], 'injectorIndex should point to a bloom filter');
|
1385 | assertNumber(lView[injectorIndex + 4], 'injectorIndex should point to a bloom filter');
|
1386 | assertNumber(lView[injectorIndex + 5], 'injectorIndex should point to a bloom filter');
|
1387 | assertNumber(lView[injectorIndex + 6], 'injectorIndex should point to a bloom filter');
|
1388 | assertNumber(lView[injectorIndex + 7], 'injectorIndex should point to a bloom filter');
|
1389 | assertNumber(lView[injectorIndex + 8 ], 'injectorIndex should point to parent injector');
|
1390 | }
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 | function getFactoryDef(type, throwNotFound) {
|
1400 | const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF);
|
1401 | if (!hasFactoryDef && throwNotFound === true && ngDevMode) {
|
1402 | throw new Error(`Type ${stringify(type)} does not have 'ɵfac' property.`);
|
1403 | }
|
1404 | return hasFactoryDef ? type[NG_FACTORY_DEF] : null;
|
1405 | }
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 | class SimpleChange {
|
1424 | constructor(previousValue, currentValue, firstChange) {
|
1425 | this.previousValue = previousValue;
|
1426 | this.currentValue = currentValue;
|
1427 | this.firstChange = firstChange;
|
1428 | }
|
1429 | |
1430 |
|
1431 |
|
1432 | isFirstChange() {
|
1433 | return this.firstChange;
|
1434 | }
|
1435 | }
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 | function ɵɵNgOnChangesFeature() {
|
1467 | return NgOnChangesFeatureImpl;
|
1468 | }
|
1469 | function NgOnChangesFeatureImpl(definition) {
|
1470 | if (definition.type.prototype.ngOnChanges) {
|
1471 | definition.setInput = ngOnChangesSetInput;
|
1472 | }
|
1473 | return rememberChangeHistoryAndInvokeOnChangesHook;
|
1474 | }
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 | ɵɵNgOnChangesFeature.ngInherit = true;
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 | function rememberChangeHistoryAndInvokeOnChangesHook() {
|
1491 | const simpleChangesStore = getSimpleChangesStore(this);
|
1492 | const current = simpleChangesStore?.current;
|
1493 | if (current) {
|
1494 | const previous = simpleChangesStore.previous;
|
1495 | if (previous === EMPTY_OBJ) {
|
1496 | simpleChangesStore.previous = current;
|
1497 | }
|
1498 | else {
|
1499 |
|
1500 |
|
1501 | for (let key in current) {
|
1502 | previous[key] = current[key];
|
1503 | }
|
1504 | }
|
1505 | simpleChangesStore.current = null;
|
1506 | this.ngOnChanges(current);
|
1507 | }
|
1508 | }
|
1509 | function ngOnChangesSetInput(instance, value, publicName, privateName) {
|
1510 | const simpleChangesStore = getSimpleChangesStore(instance) ||
|
1511 | setSimpleChangesStore(instance, { previous: EMPTY_OBJ, current: null });
|
1512 | const current = simpleChangesStore.current || (simpleChangesStore.current = {});
|
1513 | const previous = simpleChangesStore.previous;
|
1514 | const declaredName = this.declaredInputs[publicName];
|
1515 | const previousChange = previous[declaredName];
|
1516 | current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ);
|
1517 | instance[privateName] = value;
|
1518 | }
|
1519 | const SIMPLE_CHANGES_STORE = '__ngSimpleChanges__';
|
1520 | function getSimpleChangesStore(instance) {
|
1521 | return instance[SIMPLE_CHANGES_STORE] || null;
|
1522 | }
|
1523 | function setSimpleChangesStore(instance, store) {
|
1524 | return instance[SIMPLE_CHANGES_STORE] = store;
|
1525 | }
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 | let profilerCallback = null;
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 | const setProfiler = (profiler) => {
|
1546 | profilerCallback = profiler;
|
1547 | };
|
1548 |
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 | const profiler = function (event, instance, hookOrListener) {
|
1558 | if (profilerCallback != null ) {
|
1559 | profilerCallback(event, instance, hookOrListener);
|
1560 | }
|
1561 | };
|
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 | const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
1571 | const MATH_ML_NAMESPACE = 'http://www.w3.org/1998/MathML/';
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 | let DOCUMENT = undefined;
|
1597 |
|
1598 |
|
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 | function setDocument(document) {
|
1605 | DOCUMENT = document;
|
1606 | }
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 | function getDocument() {
|
1614 | if (DOCUMENT !== undefined) {
|
1615 | return DOCUMENT;
|
1616 | }
|
1617 | else if (typeof document !== 'undefined') {
|
1618 | return document;
|
1619 | }
|
1620 |
|
1621 |
|
1622 |
|
1623 |
|
1624 |
|
1625 | return undefined;
|
1626 | }
|
1627 |
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 | var RendererStyleFlags3;
|
1637 | (function (RendererStyleFlags3) {
|
1638 | RendererStyleFlags3[RendererStyleFlags3["Important"] = 1] = "Important";
|
1639 | RendererStyleFlags3[RendererStyleFlags3["DashCase"] = 2] = "DashCase";
|
1640 | })(RendererStyleFlags3 || (RendererStyleFlags3 = {}));
|
1641 |
|
1642 | function isProceduralRenderer(renderer) {
|
1643 | return !!(renderer.listen);
|
1644 | }
|
1645 | const domRendererFactory3 = {
|
1646 | createRenderer: (hostElement, rendererType) => {
|
1647 | return getDocument();
|
1648 | }
|
1649 | };
|
1650 |
|
1651 |
|
1652 | const unusedValueExportToPlacateAjd$6 = 1;
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 |
|
1664 |
|
1665 |
|
1666 |
|
1667 |
|
1668 |
|
1669 |
|
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 | function unwrapRNode(value) {
|
1682 | while (Array.isArray(value)) {
|
1683 | value = value[HOST];
|
1684 | }
|
1685 | return value;
|
1686 | }
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 | function unwrapLView(value) {
|
1692 | while (Array.isArray(value)) {
|
1693 |
|
1694 |
|
1695 | if (typeof value[TYPE] === 'object')
|
1696 | return value;
|
1697 | value = value[HOST];
|
1698 | }
|
1699 | return null;
|
1700 | }
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 | function unwrapLContainer(value) {
|
1706 | while (Array.isArray(value)) {
|
1707 |
|
1708 |
|
1709 | if (value[TYPE] === true)
|
1710 | return value;
|
1711 | value = value[HOST];
|
1712 | }
|
1713 | return null;
|
1714 | }
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 | function getNativeByIndex(index, lView) {
|
1720 | ngDevMode && assertIndexInRange(lView, index);
|
1721 | ngDevMode && assertGreaterThanOrEqual(index, HEADER_OFFSET, 'Expected to be past HEADER_OFFSET');
|
1722 | return unwrapRNode(lView[index]);
|
1723 | }
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 | function getNativeByTNode(tNode, lView) {
|
1733 | ngDevMode && assertTNodeForLView(tNode, lView);
|
1734 | ngDevMode && assertIndexInRange(lView, tNode.index);
|
1735 | const node = unwrapRNode(lView[tNode.index]);
|
1736 | ngDevMode && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
|
1737 | return node;
|
1738 | }
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 | function getNativeByTNodeOrNull(tNode, lView) {
|
1748 | const index = tNode === null ? -1 : tNode.index;
|
1749 | if (index !== -1) {
|
1750 | ngDevMode && assertTNodeForLView(tNode, lView);
|
1751 | const node = unwrapRNode(lView[index]);
|
1752 | ngDevMode && node !== null && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
|
1753 | return node;
|
1754 | }
|
1755 | return null;
|
1756 | }
|
1757 |
|
1758 | function getTNode(tView, index) {
|
1759 | ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');
|
1760 | ngDevMode && assertLessThan(index, tView.data.length, 'wrong index for TNode');
|
1761 | const tNode = tView.data[index];
|
1762 | ngDevMode && tNode !== null && assertTNode(tNode);
|
1763 | return tNode;
|
1764 | }
|
1765 |
|
1766 | function load(view, index) {
|
1767 | ngDevMode && assertIndexInRange(view, index);
|
1768 | return view[index];
|
1769 | }
|
1770 | function getComponentLViewByIndex(nodeIndex, hostView) {
|
1771 |
|
1772 | ngDevMode && assertIndexInRange(hostView, nodeIndex);
|
1773 | const slotValue = hostView[nodeIndex];
|
1774 | const lView = isLView(slotValue) ? slotValue : slotValue[HOST];
|
1775 | return lView;
|
1776 | }
|
1777 |
|
1778 | function isCreationMode(view) {
|
1779 | return (view[FLAGS] & 4 ) === 4 ;
|
1780 | }
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 | function viewAttachedToChangeDetector(view) {
|
1788 | return (view[FLAGS] & 128 ) === 128 ;
|
1789 | }
|
1790 |
|
1791 | function viewAttachedToContainer(view) {
|
1792 | return isLContainer(view[PARENT]);
|
1793 | }
|
1794 | function getConstant(consts, index) {
|
1795 | if (index === null || index === undefined)
|
1796 | return null;
|
1797 | ngDevMode && assertIndexInRange(consts, index);
|
1798 | return consts[index];
|
1799 | }
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 | function resetPreOrderHookFlags(lView) {
|
1805 | lView[PREORDER_HOOK_FLAGS] = 0;
|
1806 | }
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 | function updateTransplantedViewCount(lContainer, amount) {
|
1815 | lContainer[TRANSPLANTED_VIEWS_TO_REFRESH] += amount;
|
1816 | let viewOrContainer = lContainer;
|
1817 | let parent = lContainer[PARENT];
|
1818 | while (parent !== null &&
|
1819 | ((amount === 1 && viewOrContainer[TRANSPLANTED_VIEWS_TO_REFRESH] === 1) ||
|
1820 | (amount === -1 && viewOrContainer[TRANSPLANTED_VIEWS_TO_REFRESH] === 0))) {
|
1821 | parent[TRANSPLANTED_VIEWS_TO_REFRESH] += amount;
|
1822 | viewOrContainer = parent;
|
1823 | parent = parent[PARENT];
|
1824 | }
|
1825 | }
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 |
|
1833 |
|
1834 | const instructionState = {
|
1835 | lFrame: createLFrame(null),
|
1836 | bindingsEnabled: true,
|
1837 | isInCheckNoChangesMode: false,
|
1838 | };
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 | function specOnlyIsInstructionStateEmpty() {
|
1845 | return instructionState.lFrame.parent === null;
|
1846 | }
|
1847 | function getElementDepthCount() {
|
1848 | return instructionState.lFrame.elementDepthCount;
|
1849 | }
|
1850 | function increaseElementDepthCount() {
|
1851 | instructionState.lFrame.elementDepthCount++;
|
1852 | }
|
1853 | function decreaseElementDepthCount() {
|
1854 | instructionState.lFrame.elementDepthCount--;
|
1855 | }
|
1856 | function getBindingsEnabled() {
|
1857 | return instructionState.bindingsEnabled;
|
1858 | }
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 | function ɵɵenableBindings() {
|
1879 | instructionState.bindingsEnabled = true;
|
1880 | }
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 | function ɵɵdisableBindings() {
|
1901 | instructionState.bindingsEnabled = false;
|
1902 | }
|
1903 |
|
1904 |
|
1905 |
|
1906 | function getLView() {
|
1907 | return instructionState.lFrame.lView;
|
1908 | }
|
1909 |
|
1910 |
|
1911 |
|
1912 | function getTView() {
|
1913 | return instructionState.lFrame.tView;
|
1914 | }
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 | function ɵɵrestoreView(viewToRestore) {
|
1928 | instructionState.lFrame.contextLView = viewToRestore;
|
1929 | return viewToRestore[CONTEXT];
|
1930 | }
|
1931 | function getCurrentTNode() {
|
1932 | let currentTNode = getCurrentTNodePlaceholderOk();
|
1933 | while (currentTNode !== null && currentTNode.type === 64 ) {
|
1934 | currentTNode = currentTNode.parent;
|
1935 | }
|
1936 | return currentTNode;
|
1937 | }
|
1938 | function getCurrentTNodePlaceholderOk() {
|
1939 | return instructionState.lFrame.currentTNode;
|
1940 | }
|
1941 | function getCurrentParentTNode() {
|
1942 | const lFrame = instructionState.lFrame;
|
1943 | const currentTNode = lFrame.currentTNode;
|
1944 | return lFrame.isParent ? currentTNode : currentTNode.parent;
|
1945 | }
|
1946 | function setCurrentTNode(tNode, isParent) {
|
1947 | ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView);
|
1948 | const lFrame = instructionState.lFrame;
|
1949 | lFrame.currentTNode = tNode;
|
1950 | lFrame.isParent = isParent;
|
1951 | }
|
1952 | function isCurrentTNodeParent() {
|
1953 | return instructionState.lFrame.isParent;
|
1954 | }
|
1955 | function setCurrentTNodeAsNotParent() {
|
1956 | instructionState.lFrame.isParent = false;
|
1957 | }
|
1958 | function setCurrentTNodeAsParent() {
|
1959 | instructionState.lFrame.isParent = true;
|
1960 | }
|
1961 | function getContextLView() {
|
1962 | return instructionState.lFrame.contextLView;
|
1963 | }
|
1964 | function isInCheckNoChangesMode() {
|
1965 |
|
1966 | return instructionState.isInCheckNoChangesMode;
|
1967 | }
|
1968 | function setIsInCheckNoChangesMode(mode) {
|
1969 | instructionState.isInCheckNoChangesMode = mode;
|
1970 | }
|
1971 |
|
1972 | function getBindingRoot() {
|
1973 | const lFrame = instructionState.lFrame;
|
1974 | let index = lFrame.bindingRootIndex;
|
1975 | if (index === -1) {
|
1976 | index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex;
|
1977 | }
|
1978 | return index;
|
1979 | }
|
1980 | function getBindingIndex() {
|
1981 | return instructionState.lFrame.bindingIndex;
|
1982 | }
|
1983 | function setBindingIndex(value) {
|
1984 | return instructionState.lFrame.bindingIndex = value;
|
1985 | }
|
1986 | function nextBindingIndex() {
|
1987 | return instructionState.lFrame.bindingIndex++;
|
1988 | }
|
1989 | function incrementBindingIndex(count) {
|
1990 | const lFrame = instructionState.lFrame;
|
1991 | const index = lFrame.bindingIndex;
|
1992 | lFrame.bindingIndex = lFrame.bindingIndex + count;
|
1993 | return index;
|
1994 | }
|
1995 | function isInI18nBlock() {
|
1996 | return instructionState.lFrame.inI18n;
|
1997 | }
|
1998 | function setInI18nBlock(isInI18nBlock) {
|
1999 | instructionState.lFrame.inI18n = isInI18nBlock;
|
2000 | }
|
2001 |
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 | function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
|
2013 | const lFrame = instructionState.lFrame;
|
2014 | lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
|
2015 | setCurrentDirectiveIndex(currentDirectiveIndex);
|
2016 | }
|
2017 |
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 | function getCurrentDirectiveIndex() {
|
2023 | return instructionState.lFrame.currentDirectiveIndex;
|
2024 | }
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 | function setCurrentDirectiveIndex(currentDirectiveIndex) {
|
2031 | instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;
|
2032 | }
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 | function getCurrentDirectiveDef(tData) {
|
2040 | const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;
|
2041 | return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
|
2042 | }
|
2043 | function getCurrentQueryIndex() {
|
2044 | return instructionState.lFrame.currentQueryIndex;
|
2045 | }
|
2046 | function setCurrentQueryIndex(value) {
|
2047 | instructionState.lFrame.currentQueryIndex = value;
|
2048 | }
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 | function getDeclarationTNode(lView) {
|
2055 | const tView = lView[TVIEW];
|
2056 |
|
2057 | if (tView.type === 2 ) {
|
2058 | ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');
|
2059 | return tView.declTNode;
|
2060 | }
|
2061 |
|
2062 |
|
2063 |
|
2064 | if (tView.type === 1 ) {
|
2065 | return lView[T_HOST];
|
2066 | }
|
2067 |
|
2068 | return null;
|
2069 | }
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 | function enterDI(lView, tNode, flags) {
|
2084 | ngDevMode && assertLViewOrUndefined(lView);
|
2085 | if (flags & InjectFlags.SkipSelf) {
|
2086 | ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]);
|
2087 | let parentTNode = tNode;
|
2088 | let parentLView = lView;
|
2089 | while (true) {
|
2090 | ngDevMode && assertDefined(parentTNode, 'Parent TNode should be defined');
|
2091 | parentTNode = parentTNode.parent;
|
2092 | if (parentTNode === null && !(flags & InjectFlags.Host)) {
|
2093 | parentTNode = getDeclarationTNode(parentLView);
|
2094 | if (parentTNode === null)
|
2095 | break;
|
2096 |
|
2097 |
|
2098 | ngDevMode && assertDefined(parentLView, 'Parent LView should be defined');
|
2099 | parentLView = parentLView[DECLARATION_VIEW];
|
2100 |
|
2101 |
|
2102 |
|
2103 | if (parentTNode.type & (2 | 8 )) {
|
2104 | break;
|
2105 | }
|
2106 | }
|
2107 | else {
|
2108 | break;
|
2109 | }
|
2110 | }
|
2111 | if (parentTNode === null) {
|
2112 |
|
2113 | return false;
|
2114 | }
|
2115 | else {
|
2116 | tNode = parentTNode;
|
2117 | lView = parentLView;
|
2118 | }
|
2119 | }
|
2120 | ngDevMode && assertTNodeForLView(tNode, lView);
|
2121 | const lFrame = instructionState.lFrame = allocLFrame();
|
2122 | lFrame.currentTNode = tNode;
|
2123 | lFrame.lView = lView;
|
2124 | return true;
|
2125 | }
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 |
|
2133 |
|
2134 |
|
2135 |
|
2136 |
|
2137 | function enterView(newView) {
|
2138 | ngDevMode && assertNotEqual(newView[0], newView[1], '????');
|
2139 | ngDevMode && assertLViewOrUndefined(newView);
|
2140 | const newLFrame = allocLFrame();
|
2141 | if (ngDevMode) {
|
2142 | assertEqual(newLFrame.isParent, true, 'Expected clean LFrame');
|
2143 | assertEqual(newLFrame.lView, null, 'Expected clean LFrame');
|
2144 | assertEqual(newLFrame.tView, null, 'Expected clean LFrame');
|
2145 | assertEqual(newLFrame.selectedIndex, -1, 'Expected clean LFrame');
|
2146 | assertEqual(newLFrame.elementDepthCount, 0, 'Expected clean LFrame');
|
2147 | assertEqual(newLFrame.currentDirectiveIndex, -1, 'Expected clean LFrame');
|
2148 | assertEqual(newLFrame.currentNamespace, null, 'Expected clean LFrame');
|
2149 | assertEqual(newLFrame.bindingRootIndex, -1, 'Expected clean LFrame');
|
2150 | assertEqual(newLFrame.currentQueryIndex, 0, 'Expected clean LFrame');
|
2151 | }
|
2152 | const tView = newView[TVIEW];
|
2153 | instructionState.lFrame = newLFrame;
|
2154 | ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);
|
2155 | newLFrame.currentTNode = tView.firstChild;
|
2156 | newLFrame.lView = newView;
|
2157 | newLFrame.tView = tView;
|
2158 | newLFrame.contextLView = newView;
|
2159 | newLFrame.bindingIndex = tView.bindingStartIndex;
|
2160 | newLFrame.inI18n = false;
|
2161 | }
|
2162 |
|
2163 |
|
2164 |
|
2165 | function allocLFrame() {
|
2166 | const currentLFrame = instructionState.lFrame;
|
2167 | const childLFrame = currentLFrame === null ? null : currentLFrame.child;
|
2168 | const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame;
|
2169 | return newLFrame;
|
2170 | }
|
2171 | function createLFrame(parent) {
|
2172 | const lFrame = {
|
2173 | currentTNode: null,
|
2174 | isParent: true,
|
2175 | lView: null,
|
2176 | tView: null,
|
2177 | selectedIndex: -1,
|
2178 | contextLView: null,
|
2179 | elementDepthCount: 0,
|
2180 | currentNamespace: null,
|
2181 | currentDirectiveIndex: -1,
|
2182 | bindingRootIndex: -1,
|
2183 | bindingIndex: -1,
|
2184 | currentQueryIndex: 0,
|
2185 | parent: parent,
|
2186 | child: null,
|
2187 | inI18n: false,
|
2188 | };
|
2189 | parent !== null && (parent.child = lFrame);
|
2190 | return lFrame;
|
2191 | }
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 | function leaveViewLight() {
|
2202 | const oldLFrame = instructionState.lFrame;
|
2203 | instructionState.lFrame = oldLFrame.parent;
|
2204 | oldLFrame.currentTNode = null;
|
2205 | oldLFrame.lView = null;
|
2206 | return oldLFrame;
|
2207 | }
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 | const leaveDI = leaveViewLight;
|
2215 |
|
2216 |
|
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 | function leaveView() {
|
2224 | const oldLFrame = leaveViewLight();
|
2225 | oldLFrame.isParent = true;
|
2226 | oldLFrame.tView = null;
|
2227 | oldLFrame.selectedIndex = -1;
|
2228 | oldLFrame.contextLView = null;
|
2229 | oldLFrame.elementDepthCount = 0;
|
2230 | oldLFrame.currentDirectiveIndex = -1;
|
2231 | oldLFrame.currentNamespace = null;
|
2232 | oldLFrame.bindingRootIndex = -1;
|
2233 | oldLFrame.bindingIndex = -1;
|
2234 | oldLFrame.currentQueryIndex = 0;
|
2235 | }
|
2236 | function nextContextImpl(level) {
|
2237 | const contextLView = instructionState.lFrame.contextLView =
|
2238 | walkUpViews(level, instructionState.lFrame.contextLView);
|
2239 | return contextLView[CONTEXT];
|
2240 | }
|
2241 | function walkUpViews(nestingLevel, currentView) {
|
2242 | while (nestingLevel > 0) {
|
2243 | ngDevMode &&
|
2244 | assertDefined(currentView[DECLARATION_VIEW], 'Declaration view should be defined if nesting level is greater than 0.');
|
2245 | currentView = currentView[DECLARATION_VIEW];
|
2246 | nestingLevel--;
|
2247 | }
|
2248 | return currentView;
|
2249 | }
|
2250 |
|
2251 |
|
2252 |
|
2253 |
|
2254 |
|
2255 |
|
2256 | function getSelectedIndex() {
|
2257 | return instructionState.lFrame.selectedIndex;
|
2258 | }
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 | function setSelectedIndex(index) {
|
2269 | ngDevMode && index !== -1 &&
|
2270 | assertGreaterThanOrEqual(index, HEADER_OFFSET, 'Index must be past HEADER_OFFSET (or -1).');
|
2271 | ngDevMode &&
|
2272 | assertLessThan(index, instructionState.lFrame.lView.length, 'Can\'t set index passed end of LView');
|
2273 | instructionState.lFrame.selectedIndex = index;
|
2274 | }
|
2275 |
|
2276 |
|
2277 |
|
2278 | function getSelectedTNode() {
|
2279 | const lFrame = instructionState.lFrame;
|
2280 | return getTNode(lFrame.tView, lFrame.selectedIndex);
|
2281 | }
|
2282 |
|
2283 |
|
2284 |
|
2285 |
|
2286 |
|
2287 | function ɵɵnamespaceSVG() {
|
2288 | instructionState.lFrame.currentNamespace = SVG_NAMESPACE;
|
2289 | }
|
2290 |
|
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 | function ɵɵnamespaceMathML() {
|
2296 | instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE;
|
2297 | }
|
2298 |
|
2299 |
|
2300 |
|
2301 |
|
2302 |
|
2303 |
|
2304 | function ɵɵnamespaceHTML() {
|
2305 | namespaceHTMLInternal();
|
2306 | }
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 | function namespaceHTMLInternal() {
|
2312 | instructionState.lFrame.currentNamespace = null;
|
2313 | }
|
2314 | function getNamespace$1() {
|
2315 | return instructionState.lFrame.currentNamespace;
|
2316 | }
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 | function registerPreOrderHooks(directiveIndex, directiveDef, tView) {
|
2338 | ngDevMode && assertFirstCreatePass(tView);
|
2339 | const { ngOnChanges, ngOnInit, ngDoCheck } = directiveDef.type.prototype;
|
2340 | if (ngOnChanges) {
|
2341 | const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef);
|
2342 | (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, wrappedOnChanges);
|
2343 | (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = []))
|
2344 | .push(directiveIndex, wrappedOnChanges);
|
2345 | }
|
2346 | if (ngOnInit) {
|
2347 | (tView.preOrderHooks || (tView.preOrderHooks = [])).push(0 - directiveIndex, ngOnInit);
|
2348 | }
|
2349 | if (ngDoCheck) {
|
2350 | (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, ngDoCheck);
|
2351 | (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(directiveIndex, ngDoCheck);
|
2352 | }
|
2353 | }
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 | function registerPostOrderHooks(tView, tNode) {
|
2373 | ngDevMode && assertFirstCreatePass(tView);
|
2374 |
|
2375 |
|
2376 |
|
2377 | for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) {
|
2378 | const directiveDef = tView.data[i];
|
2379 | ngDevMode && assertDefined(directiveDef, 'Expecting DirectiveDef');
|
2380 | const lifecycleHooks = directiveDef.type.prototype;
|
2381 | const { ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy } = lifecycleHooks;
|
2382 | if (ngAfterContentInit) {
|
2383 | (tView.contentHooks || (tView.contentHooks = [])).push(-i, ngAfterContentInit);
|
2384 | }
|
2385 | if (ngAfterContentChecked) {
|
2386 | (tView.contentHooks || (tView.contentHooks = [])).push(i, ngAfterContentChecked);
|
2387 | (tView.contentCheckHooks || (tView.contentCheckHooks = [])).push(i, ngAfterContentChecked);
|
2388 | }
|
2389 | if (ngAfterViewInit) {
|
2390 | (tView.viewHooks || (tView.viewHooks = [])).push(-i, ngAfterViewInit);
|
2391 | }
|
2392 | if (ngAfterViewChecked) {
|
2393 | (tView.viewHooks || (tView.viewHooks = [])).push(i, ngAfterViewChecked);
|
2394 | (tView.viewCheckHooks || (tView.viewCheckHooks = [])).push(i, ngAfterViewChecked);
|
2395 | }
|
2396 | if (ngOnDestroy != null) {
|
2397 | (tView.destroyHooks || (tView.destroyHooks = [])).push(i, ngOnDestroy);
|
2398 | }
|
2399 | }
|
2400 | }
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 |
|
2425 |
|
2426 |
|
2427 |
|
2428 |
|
2429 |
|
2430 |
|
2431 |
|
2432 |
|
2433 | function executeCheckHooks(lView, hooks, nodeIndex) {
|
2434 | callHooks(lView, hooks, 3 , nodeIndex);
|
2435 | }
|
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 |
|
2449 | function executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) {
|
2450 | ngDevMode &&
|
2451 | assertNotEqual(initPhase, 3 , 'Init pre-order hooks should not be called more than once');
|
2452 | if ((lView[FLAGS] & 3 ) === initPhase) {
|
2453 | callHooks(lView, hooks, initPhase, nodeIndex);
|
2454 | }
|
2455 | }
|
2456 | function incrementInitPhaseFlags(lView, initPhase) {
|
2457 | ngDevMode &&
|
2458 | assertNotEqual(initPhase, 3 , 'Init hooks phase should not be incremented after all init hooks have been run.');
|
2459 | let flags = lView[FLAGS];
|
2460 | if ((flags & 3 ) === initPhase) {
|
2461 | flags &= 2047 ;
|
2462 | flags += 1 ;
|
2463 | lView[FLAGS] = flags;
|
2464 | }
|
2465 | }
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 | function callHooks(currentView, arr, initPhase, currentNodeIndex) {
|
2481 | ngDevMode &&
|
2482 | assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');
|
2483 | const startIndex = currentNodeIndex !== undefined ?
|
2484 | (currentView[PREORDER_HOOK_FLAGS] & 65535 ) :
|
2485 | 0;
|
2486 | const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;
|
2487 | const max = arr.length - 1;
|
2488 | let lastNodeIndexFound = 0;
|
2489 | for (let i = startIndex; i < max; i++) {
|
2490 | const hook = arr[i + 1];
|
2491 | if (typeof hook === 'number') {
|
2492 | lastNodeIndexFound = arr[i];
|
2493 | if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {
|
2494 | break;
|
2495 | }
|
2496 | }
|
2497 | else {
|
2498 | const isInitHook = arr[i] < 0;
|
2499 | if (isInitHook)
|
2500 | currentView[PREORDER_HOOK_FLAGS] += 65536 ;
|
2501 | if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {
|
2502 | callHook(currentView, initPhase, arr, i);
|
2503 | currentView[PREORDER_HOOK_FLAGS] =
|
2504 | (currentView[PREORDER_HOOK_FLAGS] & 4294901760 ) + i +
|
2505 | 2;
|
2506 | }
|
2507 | i++;
|
2508 | }
|
2509 | }
|
2510 | }
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 | function callHook(currentView, initPhase, arr, i) {
|
2520 | const isInitHook = arr[i] < 0;
|
2521 | const hook = arr[i + 1];
|
2522 | const directiveIndex = isInitHook ? -arr[i] : arr[i];
|
2523 | const directive = currentView[directiveIndex];
|
2524 | if (isInitHook) {
|
2525 | const indexWithintInitPhase = currentView[FLAGS] >> 11 ;
|
2526 |
|
2527 | if (indexWithintInitPhase <
|
2528 | (currentView[PREORDER_HOOK_FLAGS] >> 16 ) &&
|
2529 | (currentView[FLAGS] & 3 ) === initPhase) {
|
2530 | currentView[FLAGS] += 2048 ;
|
2531 | profiler(4 , directive, hook);
|
2532 | try {
|
2533 | hook.call(directive);
|
2534 | }
|
2535 | finally {
|
2536 | profiler(5 , directive, hook);
|
2537 | }
|
2538 | }
|
2539 | }
|
2540 | else {
|
2541 | profiler(4 , directive, hook);
|
2542 | try {
|
2543 | hook.call(directive);
|
2544 | }
|
2545 | finally {
|
2546 | profiler(5 , directive, hook);
|
2547 | }
|
2548 | }
|
2549 | }
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 | const NO_PARENT_INJECTOR = -1;
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 |
|
2580 |
|
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 |
|
2595 |
|
2596 |
|
2597 |
|
2598 |
|
2599 |
|
2600 |
|
2601 |
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 |
|
2610 |
|
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 | class NodeInjectorFactory {
|
2654 | constructor(
|
2655 | /**
|
2656 | * Factory to invoke in order to create a new instance.
|
2657 | */
|
2658 | factory,
|
2659 | /**
|
2660 | * Set to `true` if the token is declared in `viewProviders` (or if it is component).
|
2661 | */
|
2662 | isViewProvider, injectImplementation) {
|
2663 | this.factory = factory;
|
2664 | |
2665 |
|
2666 |
|
2667 |
|
2668 | this.resolving = false;
|
2669 | ngDevMode && assertDefined(factory, 'Factory not specified');
|
2670 | ngDevMode && assertEqual(typeof factory, 'function', 'Expected factory function.');
|
2671 | this.canSeeViewProviders = isViewProvider;
|
2672 | this.injectImpl = injectImplementation;
|
2673 | }
|
2674 | }
|
2675 | function isFactory(obj) {
|
2676 | return obj instanceof NodeInjectorFactory;
|
2677 | }
|
2678 |
|
2679 |
|
2680 | const unusedValueExportToPlacateAjd$5 = 1;
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 | function toTNodeTypeAsString(tNodeType) {
|
2687 | let text = '';
|
2688 | (tNodeType & 1 ) && (text += '|Text');
|
2689 | (tNodeType & 2 ) && (text += '|Element');
|
2690 | (tNodeType & 4 ) && (text += '|Container');
|
2691 | (tNodeType & 8 ) && (text += '|ElementContainer');
|
2692 | (tNodeType & 16 ) && (text += '|Projection');
|
2693 | (tNodeType & 32 ) && (text += '|IcuContainer');
|
2694 | (tNodeType & 64 ) && (text += '|Placeholder');
|
2695 | return text.length > 0 ? text.substring(1) : text;
|
2696 | }
|
2697 |
|
2698 |
|
2699 | const unusedValueExportToPlacateAjd$4 = 1;
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 |
|
2719 |
|
2720 |
|
2721 | function hasClassInput(tNode) {
|
2722 | return (tNode.flags & 16 ) !== 0;
|
2723 | }
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 |
|
2731 |
|
2732 |
|
2733 |
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
2745 | function hasStyleInput(tNode) {
|
2746 | return (tNode.flags & 32 ) !== 0;
|
2747 | }
|
2748 |
|
2749 |
|
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 |
|
2755 |
|
2756 | function assertTNodeType(tNode, expectedTypes, message) {
|
2757 | assertDefined(tNode, 'should be called with a TNode');
|
2758 | if ((tNode.type & expectedTypes) === 0) {
|
2759 | throwError(message ||
|
2760 | `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString(tNode.type)}.`);
|
2761 | }
|
2762 | }
|
2763 | function assertPureTNodeType(type) {
|
2764 | if (!(type === 2 ||
|
2765 | type === 1 ||
|
2766 | type === 4 ||
|
2767 | type === 8 ||
|
2768 | type === 32 ||
|
2769 | type === 16 ||
|
2770 | type === 64 )) {
|
2771 | throwError(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`);
|
2772 | }
|
2773 | }
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 |
|
2781 |
|
2782 |
|
2783 |
|
2784 |
|
2785 |
|
2786 |
|
2787 |
|
2788 |
|
2789 |
|
2790 |
|
2791 |
|
2792 |
|
2793 |
|
2794 |
|
2795 |
|
2796 |
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 | function setUpAttributes(renderer, native, attrs) {
|
2803 | const isProc = isProceduralRenderer(renderer);
|
2804 | let i = 0;
|
2805 | while (i < attrs.length) {
|
2806 | const value = attrs[i];
|
2807 | if (typeof value === 'number') {
|
2808 |
|
2809 |
|
2810 | if (value !== 0 ) {
|
2811 | break;
|
2812 | }
|
2813 |
|
2814 |
|
2815 | i++;
|
2816 | const namespaceURI = attrs[i++];
|
2817 | const attrName = attrs[i++];
|
2818 | const attrVal = attrs[i++];
|
2819 | ngDevMode && ngDevMode.rendererSetAttribute++;
|
2820 | isProc ?
|
2821 | renderer.setAttribute(native, attrName, attrVal, namespaceURI) :
|
2822 | native.setAttributeNS(namespaceURI, attrName, attrVal);
|
2823 | }
|
2824 | else {
|
2825 |
|
2826 | const attrName = value;
|
2827 | const attrVal = attrs[++i];
|
2828 |
|
2829 | ngDevMode && ngDevMode.rendererSetAttribute++;
|
2830 | if (isAnimationProp(attrName)) {
|
2831 | if (isProc) {
|
2832 | renderer.setProperty(native, attrName, attrVal);
|
2833 | }
|
2834 | }
|
2835 | else {
|
2836 | isProc ?
|
2837 | renderer.setAttribute(native, attrName, attrVal) :
|
2838 | native.setAttribute(attrName, attrVal);
|
2839 | }
|
2840 | i++;
|
2841 | }
|
2842 | }
|
2843 |
|
2844 |
|
2845 |
|
2846 |
|
2847 | return i;
|
2848 | }
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 | function isNameOnlyAttributeMarker(marker) {
|
2857 | return marker === 3 || marker === 4 ||
|
2858 | marker === 6 ;
|
2859 | }
|
2860 | function isAnimationProp(name) {
|
2861 |
|
2862 |
|
2863 |
|
2864 | return name.charCodeAt(0) === 64 ;
|
2865 | }
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 | function mergeHostAttrs(dst, src) {
|
2875 | if (src === null || src.length === 0) {
|
2876 |
|
2877 | }
|
2878 | else if (dst === null || dst.length === 0) {
|
2879 |
|
2880 | dst = src.slice();
|
2881 | }
|
2882 | else {
|
2883 | let srcMarker = -1 ;
|
2884 | for (let i = 0; i < src.length; i++) {
|
2885 | const item = src[i];
|
2886 | if (typeof item === 'number') {
|
2887 | srcMarker = item;
|
2888 | }
|
2889 | else {
|
2890 | if (srcMarker === 0 ) {
|
2891 |
|
2892 | }
|
2893 | else if (srcMarker === -1 ||
|
2894 | srcMarker === 2 ) {
|
2895 |
|
2896 | mergeHostAttribute(dst, srcMarker, item, null, src[++i]);
|
2897 | }
|
2898 | else {
|
2899 |
|
2900 | mergeHostAttribute(dst, srcMarker, item, null, null);
|
2901 | }
|
2902 | }
|
2903 | }
|
2904 | }
|
2905 | return dst;
|
2906 | }
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 | function mergeHostAttribute(dst, marker, key1, key2, value) {
|
2917 | let i = 0;
|
2918 |
|
2919 | let markerInsertPosition = dst.length;
|
2920 |
|
2921 | if (marker === -1 ) {
|
2922 | markerInsertPosition = -1;
|
2923 | }
|
2924 | else {
|
2925 | while (i < dst.length) {
|
2926 | const dstValue = dst[i++];
|
2927 | if (typeof dstValue === 'number') {
|
2928 | if (dstValue === marker) {
|
2929 | markerInsertPosition = -1;
|
2930 | break;
|
2931 | }
|
2932 | else if (dstValue > marker) {
|
2933 |
|
2934 | markerInsertPosition = i - 1;
|
2935 | break;
|
2936 | }
|
2937 | }
|
2938 | }
|
2939 | }
|
2940 |
|
2941 | while (i < dst.length) {
|
2942 | const item = dst[i];
|
2943 | if (typeof item === 'number') {
|
2944 |
|
2945 |
|
2946 | break;
|
2947 | }
|
2948 | else if (item === key1) {
|
2949 |
|
2950 | if (key2 === null) {
|
2951 | if (value !== null) {
|
2952 | dst[i + 1] = value;
|
2953 | }
|
2954 | return;
|
2955 | }
|
2956 | else if (key2 === dst[i + 1]) {
|
2957 | dst[i + 2] = value;
|
2958 | return;
|
2959 | }
|
2960 | }
|
2961 |
|
2962 | i++;
|
2963 | if (key2 !== null)
|
2964 | i++;
|
2965 | if (value !== null)
|
2966 | i++;
|
2967 | }
|
2968 |
|
2969 | if (markerInsertPosition !== -1) {
|
2970 | dst.splice(markerInsertPosition, 0, marker);
|
2971 | i = markerInsertPosition + 1;
|
2972 | }
|
2973 | dst.splice(i++, 0, key1);
|
2974 | if (key2 !== null) {
|
2975 | dst.splice(i++, 0, key2);
|
2976 | }
|
2977 | if (value !== null) {
|
2978 | dst.splice(i++, 0, value);
|
2979 | }
|
2980 | }
|
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 |
|
2988 |
|
2989 |
|
2990 | function hasParentInjector(parentLocation) {
|
2991 | return parentLocation !== NO_PARENT_INJECTOR;
|
2992 | }
|
2993 | function getParentInjectorIndex(parentLocation) {
|
2994 | ngDevMode && assertNumber(parentLocation, 'Number expected');
|
2995 | ngDevMode && assertNotEqual(parentLocation, -1, 'Not a valid state.');
|
2996 | const parentInjectorIndex = parentLocation & 32767 ;
|
2997 | ngDevMode &&
|
2998 | assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, 'Parent injector must be pointing past HEADER_OFFSET.');
|
2999 | return parentLocation & 32767 ;
|
3000 | }
|
3001 | function getParentInjectorViewOffset(parentLocation) {
|
3002 | return parentLocation >> 16 ;
|
3003 | }
|
3004 |
|
3005 |
|
3006 |
|
3007 |
|
3008 |
|
3009 |
|
3010 |
|
3011 |
|
3012 |
|
3013 | function getParentInjectorView(location, startView) {
|
3014 | let viewOffset = getParentInjectorViewOffset(location);
|
3015 | let parentView = startView;
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 | while (viewOffset > 0) {
|
3021 | parentView = parentView[DECLARATION_VIEW];
|
3022 | viewOffset--;
|
3023 | }
|
3024 | return parentView;
|
3025 | }
|
3026 |
|
3027 |
|
3028 |
|
3029 |
|
3030 |
|
3031 |
|
3032 |
|
3033 |
|
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 |
|
3039 |
|
3040 |
|
3041 |
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 |
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 |
|
3064 |
|
3065 |
|
3066 |
|
3067 |
|
3068 |
|
3069 |
|
3070 | let includeViewProviders = true;
|
3071 | function setIncludeViewProviders(v) {
|
3072 | const oldValue = includeViewProviders;
|
3073 | includeViewProviders = v;
|
3074 | return oldValue;
|
3075 | }
|
3076 |
|
3077 |
|
3078 |
|
3079 |
|
3080 |
|
3081 | const BLOOM_SIZE = 256;
|
3082 | const BLOOM_MASK = BLOOM_SIZE - 1;
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 | const BLOOM_BUCKET_BITS = 5;
|
3089 |
|
3090 | let nextNgElementId = 0;
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 | function bloomAdd(injectorIndex, tView, type) {
|
3100 | ngDevMode && assertEqual(tView.firstCreatePass, true, 'expected firstCreatePass to be true');
|
3101 | let id;
|
3102 | if (typeof type === 'string') {
|
3103 | id = type.charCodeAt(0) || 0;
|
3104 | }
|
3105 | else if (type.hasOwnProperty(NG_ELEMENT_ID)) {
|
3106 | id = type[NG_ELEMENT_ID];
|
3107 | }
|
3108 |
|
3109 |
|
3110 | if (id == null) {
|
3111 | id = type[NG_ELEMENT_ID] = nextNgElementId++;
|
3112 | }
|
3113 |
|
3114 |
|
3115 | const bloomHash = id & BLOOM_MASK;
|
3116 |
|
3117 |
|
3118 |
|
3119 | const mask = 1 << bloomHash;
|
3120 |
|
3121 |
|
3122 |
|
3123 | tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask;
|
3124 | }
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 | function getOrCreateNodeInjectorForNode(tNode, lView) {
|
3133 | const existingInjectorIndex = getInjectorIndex(tNode, lView);
|
3134 | if (existingInjectorIndex !== -1) {
|
3135 | return existingInjectorIndex;
|
3136 | }
|
3137 | const tView = lView[TVIEW];
|
3138 | if (tView.firstCreatePass) {
|
3139 | tNode.injectorIndex = lView.length;
|
3140 | insertBloom(tView.data, tNode);
|
3141 | insertBloom(lView, null);
|
3142 | insertBloom(tView.blueprint, null);
|
3143 | }
|
3144 | const parentLoc = getParentInjectorLocation(tNode, lView);
|
3145 | const injectorIndex = tNode.injectorIndex;
|
3146 |
|
3147 |
|
3148 | if (hasParentInjector(parentLoc)) {
|
3149 | const parentIndex = getParentInjectorIndex(parentLoc);
|
3150 | const parentLView = getParentInjectorView(parentLoc, lView);
|
3151 | const parentData = parentLView[TVIEW].data;
|
3152 |
|
3153 |
|
3154 | for (let i = 0; i < 8 ; i++) {
|
3155 | lView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i];
|
3156 | }
|
3157 | }
|
3158 | lView[injectorIndex + 8 ] = parentLoc;
|
3159 | return injectorIndex;
|
3160 | }
|
3161 | function insertBloom(arr, footer) {
|
3162 | arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer);
|
3163 | }
|
3164 | function getInjectorIndex(tNode, lView) {
|
3165 | if (tNode.injectorIndex === -1 ||
|
3166 |
|
3167 |
|
3168 | (tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex) ||
|
3169 |
|
3170 |
|
3171 | lView[tNode.injectorIndex + 8 ] === null) {
|
3172 | return -1;
|
3173 | }
|
3174 | else {
|
3175 | ngDevMode && assertIndexInRange(lView, tNode.injectorIndex);
|
3176 | return tNode.injectorIndex;
|
3177 | }
|
3178 | }
|
3179 |
|
3180 |
|
3181 |
|
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 | function getParentInjectorLocation(tNode, lView) {
|
3187 | if (tNode.parent && tNode.parent.injectorIndex !== -1) {
|
3188 |
|
3189 |
|
3190 | return tNode.parent.injectorIndex;
|
3191 | }
|
3192 |
|
3193 |
|
3194 |
|
3195 | let declarationViewOffset = 0;
|
3196 | let parentTNode = null;
|
3197 | let lViewCursor = lView;
|
3198 |
|
3199 |
|
3200 |
|
3201 | while (lViewCursor !== null) {
|
3202 |
|
3203 | const tView = lViewCursor[TVIEW];
|
3204 | const tViewType = tView.type;
|
3205 | if (tViewType === 2 ) {
|
3206 | ngDevMode &&
|
3207 | assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');
|
3208 | parentTNode = tView.declTNode;
|
3209 | }
|
3210 | else if (tViewType === 1 ) {
|
3211 |
|
3212 |
|
3213 | parentTNode = lViewCursor[T_HOST];
|
3214 | }
|
3215 | else {
|
3216 | ngDevMode && assertEqual(tView.type, 0 , 'Root type expected');
|
3217 | parentTNode = null;
|
3218 | }
|
3219 | if (parentTNode === null) {
|
3220 |
|
3221 | return NO_PARENT_INJECTOR;
|
3222 | }
|
3223 | ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]);
|
3224 |
|
3225 | declarationViewOffset++;
|
3226 | lViewCursor = lViewCursor[DECLARATION_VIEW];
|
3227 | if (parentTNode.injectorIndex !== -1) {
|
3228 |
|
3229 | return (parentTNode.injectorIndex |
|
3230 | (declarationViewOffset << 16 ));
|
3231 | }
|
3232 | }
|
3233 | return NO_PARENT_INJECTOR;
|
3234 | }
|
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 | function diPublicInInjector(injectorIndex, tView, token) {
|
3243 | bloomAdd(injectorIndex, tView, token);
|
3244 | }
|
3245 |
|
3246 |
|
3247 |
|
3248 |
|
3249 |
|
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 |
|
3255 |
|
3256 |
|
3257 |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 |
|
3263 |
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 |
|
3276 | function injectAttributeImpl(tNode, attrNameToInject) {
|
3277 | ngDevMode && assertTNodeType(tNode, 12 | 3 );
|
3278 | ngDevMode && assertDefined(tNode, 'expecting tNode');
|
3279 | if (attrNameToInject === 'class') {
|
3280 | return tNode.classes;
|
3281 | }
|
3282 | if (attrNameToInject === 'style') {
|
3283 | return tNode.styles;
|
3284 | }
|
3285 | const attrs = tNode.attrs;
|
3286 | if (attrs) {
|
3287 | const attrsLength = attrs.length;
|
3288 | let i = 0;
|
3289 | while (i < attrsLength) {
|
3290 | const value = attrs[i];
|
3291 |
|
3292 | if (isNameOnlyAttributeMarker(value))
|
3293 | break;
|
3294 |
|
3295 | if (value === 0 ) {
|
3296 |
|
3297 |
|
3298 |
|
3299 |
|
3300 | i = i + 2;
|
3301 | }
|
3302 | else if (typeof value === 'number') {
|
3303 |
|
3304 | i++;
|
3305 | while (i < attrsLength && typeof attrs[i] === 'string') {
|
3306 | i++;
|
3307 | }
|
3308 | }
|
3309 | else if (value === attrNameToInject) {
|
3310 | return attrs[i + 1];
|
3311 | }
|
3312 | else {
|
3313 | i = i + 2;
|
3314 | }
|
3315 | }
|
3316 | }
|
3317 | return null;
|
3318 | }
|
3319 | function notFoundValueOrThrow(notFoundValue, token, flags) {
|
3320 | if (flags & InjectFlags.Optional) {
|
3321 | return notFoundValue;
|
3322 | }
|
3323 | else {
|
3324 | throwProviderNotFoundError(token, 'NodeInjector');
|
3325 | }
|
3326 | }
|
3327 |
|
3328 |
|
3329 |
|
3330 |
|
3331 |
|
3332 |
|
3333 |
|
3334 |
|
3335 |
|
3336 | function lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) {
|
3337 | if (flags & InjectFlags.Optional && notFoundValue === undefined) {
|
3338 |
|
3339 | notFoundValue = null;
|
3340 | }
|
3341 | if ((flags & (InjectFlags.Self | InjectFlags.Host)) === 0) {
|
3342 | const moduleInjector = lView[INJECTOR$1];
|
3343 |
|
3344 |
|
3345 |
|
3346 | const previousInjectImplementation = setInjectImplementation(undefined);
|
3347 | try {
|
3348 | if (moduleInjector) {
|
3349 | return moduleInjector.get(token, notFoundValue, flags & InjectFlags.Optional);
|
3350 | }
|
3351 | else {
|
3352 | return injectRootLimpMode(token, notFoundValue, flags & InjectFlags.Optional);
|
3353 | }
|
3354 | }
|
3355 | finally {
|
3356 | setInjectImplementation(previousInjectImplementation);
|
3357 | }
|
3358 | }
|
3359 | return notFoundValueOrThrow(notFoundValue, token, flags);
|
3360 | }
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 | function getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default, notFoundValue) {
|
3378 | if (tNode !== null) {
|
3379 | const bloomHash = bloomHashBitOrFactory(token);
|
3380 |
|
3381 |
|
3382 | if (typeof bloomHash === 'function') {
|
3383 | if (!enterDI(lView, tNode, flags)) {
|
3384 |
|
3385 |
|
3386 | return (flags & InjectFlags.Host) ?
|
3387 | notFoundValueOrThrow(notFoundValue, token, flags) :
|
3388 | lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);
|
3389 | }
|
3390 | try {
|
3391 | const value = bloomHash(flags);
|
3392 | if (value == null && !(flags & InjectFlags.Optional)) {
|
3393 | throwProviderNotFoundError(token);
|
3394 | }
|
3395 | else {
|
3396 | return value;
|
3397 | }
|
3398 | }
|
3399 | finally {
|
3400 | leaveDI();
|
3401 | }
|
3402 | }
|
3403 | else if (typeof bloomHash === 'number') {
|
3404 |
|
3405 |
|
3406 |
|
3407 | let previousTView = null;
|
3408 | let injectorIndex = getInjectorIndex(tNode, lView);
|
3409 | let parentLocation = NO_PARENT_INJECTOR;
|
3410 | let hostTElementNode = flags & InjectFlags.Host ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null;
|
3411 |
|
3412 |
|
3413 | if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {
|
3414 | parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) :
|
3415 | lView[injectorIndex + 8 ];
|
3416 | if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) {
|
3417 | injectorIndex = -1;
|
3418 | }
|
3419 | else {
|
3420 | previousTView = lView[TVIEW];
|
3421 | injectorIndex = getParentInjectorIndex(parentLocation);
|
3422 | lView = getParentInjectorView(parentLocation, lView);
|
3423 | }
|
3424 | }
|
3425 |
|
3426 |
|
3427 | while (injectorIndex !== -1) {
|
3428 | ngDevMode && assertNodeInjector(lView, injectorIndex);
|
3429 |
|
3430 | const tView = lView[TVIEW];
|
3431 | ngDevMode &&
|
3432 | assertTNodeForLView(tView.data[injectorIndex + 8 ], lView);
|
3433 | if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {
|
3434 |
|
3435 |
|
3436 |
|
3437 | const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode);
|
3438 | if (instance !== NOT_FOUND) {
|
3439 | return instance;
|
3440 | }
|
3441 | }
|
3442 | parentLocation = lView[injectorIndex + 8 ];
|
3443 | if (parentLocation !== NO_PARENT_INJECTOR &&
|
3444 | shouldSearchParent(flags, lView[TVIEW].data[injectorIndex + 8 ] === hostTElementNode) &&
|
3445 | bloomHasToken(bloomHash, injectorIndex, lView)) {
|
3446 |
|
3447 |
|
3448 | previousTView = tView;
|
3449 | injectorIndex = getParentInjectorIndex(parentLocation);
|
3450 | lView = getParentInjectorView(parentLocation, lView);
|
3451 | }
|
3452 | else {
|
3453 |
|
3454 |
|
3455 |
|
3456 | injectorIndex = -1;
|
3457 | }
|
3458 | }
|
3459 | }
|
3460 | }
|
3461 | return lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);
|
3462 | }
|
3463 | const NOT_FOUND = {};
|
3464 | function createNodeInjector() {
|
3465 | return new NodeInjector(getCurrentTNode(), getLView());
|
3466 | }
|
3467 | function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) {
|
3468 | const currentTView = lView[TVIEW];
|
3469 | const tNode = currentTView.data[injectorIndex + 8 ];
|
3470 |
|
3471 |
|
3472 | const canAccessViewProviders = previousTView == null ?
|
3473 |
|
3474 |
|
3475 |
|
3476 |
|
3477 |
|
3478 |
|
3479 |
|
3480 | (isComponentHost(tNode) && includeViewProviders) :
|
3481 |
|
3482 |
|
3483 |
|
3484 |
|
3485 |
|
3486 |
|
3487 | (previousTView != currentTView && ((tNode.type & 3 ) !== 0));
|
3488 |
|
3489 |
|
3490 | const isHostSpecialCase = (flags & InjectFlags.Host) && hostTElementNode === tNode;
|
3491 | const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase);
|
3492 | if (injectableIdx !== null) {
|
3493 | return getNodeInjectable(lView, currentTView, injectableIdx, tNode);
|
3494 | }
|
3495 | else {
|
3496 | return NOT_FOUND;
|
3497 | }
|
3498 | }
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 |
|
3508 |
|
3509 | function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) {
|
3510 | const nodeProviderIndexes = tNode.providerIndexes;
|
3511 | const tInjectables = tView.data;
|
3512 | const injectablesStart = nodeProviderIndexes & 1048575 ;
|
3513 | const directivesStart = tNode.directiveStart;
|
3514 | const directiveEnd = tNode.directiveEnd;
|
3515 | const cptViewProvidersCount = nodeProviderIndexes >> 20 ;
|
3516 | const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount;
|
3517 |
|
3518 | const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd;
|
3519 | for (let i = startingIndex; i < endIndex; i++) {
|
3520 | const providerTokenOrDef = tInjectables[i];
|
3521 | if (i < directivesStart && token === providerTokenOrDef ||
|
3522 | i >= directivesStart && providerTokenOrDef.type === token) {
|
3523 | return i;
|
3524 | }
|
3525 | }
|
3526 | if (isHostSpecialCase) {
|
3527 | const dirDef = tInjectables[directivesStart];
|
3528 | if (dirDef && isComponentDef(dirDef) && dirDef.type === token) {
|
3529 | return directivesStart;
|
3530 | }
|
3531 | }
|
3532 | return null;
|
3533 | }
|
3534 |
|
3535 |
|
3536 |
|
3537 |
|
3538 |
|
3539 |
|
3540 |
|
3541 | function getNodeInjectable(lView, tView, index, tNode) {
|
3542 | let value = lView[index];
|
3543 | const tData = tView.data;
|
3544 | if (isFactory(value)) {
|
3545 | const factory = value;
|
3546 | if (factory.resolving) {
|
3547 | throwCyclicDependencyError(stringifyForError(tData[index]));
|
3548 | }
|
3549 | const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);
|
3550 | factory.resolving = true;
|
3551 | const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null;
|
3552 | const success = enterDI(lView, tNode, InjectFlags.Default);
|
3553 | ngDevMode &&
|
3554 | assertEqual(success, true, 'Because flags do not contain \`SkipSelf\' we expect this to always succeed.');
|
3555 | try {
|
3556 | value = lView[index] = factory.factory(undefined, tData, lView, tNode);
|
3557 |
|
3558 |
|
3559 |
|
3560 |
|
3561 |
|
3562 |
|
3563 | if (tView.firstCreatePass && index >= tNode.directiveStart) {
|
3564 | ngDevMode && assertDirectiveDef(tData[index]);
|
3565 | registerPreOrderHooks(index, tData[index], tView);
|
3566 | }
|
3567 | }
|
3568 | finally {
|
3569 | previousInjectImplementation !== null &&
|
3570 | setInjectImplementation(previousInjectImplementation);
|
3571 | setIncludeViewProviders(previousIncludeViewProviders);
|
3572 | factory.resolving = false;
|
3573 | leaveDI();
|
3574 | }
|
3575 | }
|
3576 | return value;
|
3577 | }
|
3578 |
|
3579 |
|
3580 |
|
3581 |
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 |
|
3590 | function bloomHashBitOrFactory(token) {
|
3591 | ngDevMode && assertDefined(token, 'token must be defined');
|
3592 | if (typeof token === 'string') {
|
3593 | return token.charCodeAt(0) || 0;
|
3594 | }
|
3595 | const tokenId =
|
3596 |
|
3597 | token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : undefined;
|
3598 |
|
3599 | if (typeof tokenId === 'number') {
|
3600 | if (tokenId >= 0) {
|
3601 | return tokenId & BLOOM_MASK;
|
3602 | }
|
3603 | else {
|
3604 | ngDevMode &&
|
3605 | assertEqual(tokenId, -1 , 'Expecting to get Special Injector Id');
|
3606 | return createNodeInjector;
|
3607 | }
|
3608 | }
|
3609 | else {
|
3610 | return tokenId;
|
3611 | }
|
3612 | }
|
3613 | function bloomHasToken(bloomHash, injectorIndex, injectorView) {
|
3614 |
|
3615 |
|
3616 |
|
3617 | const mask = 1 << bloomHash;
|
3618 |
|
3619 |
|
3620 |
|
3621 | const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)];
|
3622 |
|
3623 |
|
3624 | return !!(value & mask);
|
3625 | }
|
3626 |
|
3627 | function shouldSearchParent(flags, isFirstHostTNode) {
|
3628 | return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode);
|
3629 | }
|
3630 | class NodeInjector {
|
3631 | constructor(_tNode, _lView) {
|
3632 | this._tNode = _tNode;
|
3633 | this._lView = _lView;
|
3634 | }
|
3635 | get(token, notFoundValue, flags) {
|
3636 | return getOrCreateInjectable(this._tNode, this._lView, token, flags, notFoundValue);
|
3637 | }
|
3638 | }
|
3639 |
|
3640 |
|
3641 |
|
3642 | function ɵɵgetInheritedFactory(type) {
|
3643 | return noSideEffects(() => {
|
3644 | const ownConstructor = type.prototype.constructor;
|
3645 | const ownFactory = ownConstructor[NG_FACTORY_DEF] || getFactoryOf(ownConstructor);
|
3646 | const objectPrototype = Object.prototype;
|
3647 | let parent = Object.getPrototypeOf(type.prototype).constructor;
|
3648 |
|
3649 | while (parent && parent !== objectPrototype) {
|
3650 | const factory = parent[NG_FACTORY_DEF] || getFactoryOf(parent);
|
3651 |
|
3652 |
|
3653 |
|
3654 |
|
3655 |
|
3656 | if (factory && factory !== ownFactory) {
|
3657 | return factory;
|
3658 | }
|
3659 | parent = Object.getPrototypeOf(parent);
|
3660 | }
|
3661 |
|
3662 |
|
3663 |
|
3664 |
|
3665 | return t => new t();
|
3666 | });
|
3667 | }
|
3668 | function getFactoryOf(type) {
|
3669 | if (isForwardRef(type)) {
|
3670 | return () => {
|
3671 | const factory = getFactoryOf(resolveForwardRef(type));
|
3672 | return factory && factory();
|
3673 | };
|
3674 | }
|
3675 | return getFactoryDef(type);
|
3676 | }
|
3677 |
|
3678 |
|
3679 |
|
3680 |
|
3681 |
|
3682 |
|
3683 |
|
3684 |
|
3685 |
|
3686 |
|
3687 |
|
3688 |
|
3689 |
|
3690 | function ɵɵinjectAttribute(attrNameToInject) {
|
3691 | return injectAttributeImpl(getCurrentTNode(), attrNameToInject);
|
3692 | }
|
3693 |
|
3694 |
|
3695 |
|
3696 |
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 | const ANNOTATIONS = '__annotations__';
|
3702 | const PARAMETERS = '__parameters__';
|
3703 | const PROP_METADATA = '__prop__metadata__';
|
3704 |
|
3705 |
|
3706 |
|
3707 | function makeDecorator(name, props, parentClass, additionalProcessing, typeFn) {
|
3708 | return noSideEffects(() => {
|
3709 | const metaCtor = makeMetadataCtor(props);
|
3710 | function DecoratorFactory(...args) {
|
3711 | if (this instanceof DecoratorFactory) {
|
3712 | metaCtor.call(this, ...args);
|
3713 | return this;
|
3714 | }
|
3715 | const annotationInstance = new DecoratorFactory(...args);
|
3716 | return function TypeDecorator(cls) {
|
3717 | if (typeFn)
|
3718 | typeFn(cls, ...args);
|
3719 |
|
3720 |
|
3721 | const annotations = cls.hasOwnProperty(ANNOTATIONS) ?
|
3722 | cls[ANNOTATIONS] :
|
3723 | Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
|
3724 | annotations.push(annotationInstance);
|
3725 | if (additionalProcessing)
|
3726 | additionalProcessing(cls);
|
3727 | return cls;
|
3728 | };
|
3729 | }
|
3730 | if (parentClass) {
|
3731 | DecoratorFactory.prototype = Object.create(parentClass.prototype);
|
3732 | }
|
3733 | DecoratorFactory.prototype.ngMetadataName = name;
|
3734 | DecoratorFactory.annotationCls = DecoratorFactory;
|
3735 | return DecoratorFactory;
|
3736 | });
|
3737 | }
|
3738 | function makeMetadataCtor(props) {
|
3739 | return function ctor(...args) {
|
3740 | if (props) {
|
3741 | const values = props(...args);
|
3742 | for (const propName in values) {
|
3743 | this[propName] = values[propName];
|
3744 | }
|
3745 | }
|
3746 | };
|
3747 | }
|
3748 | function makeParamDecorator(name, props, parentClass) {
|
3749 | return noSideEffects(() => {
|
3750 | const metaCtor = makeMetadataCtor(props);
|
3751 | function ParamDecoratorFactory(...args) {
|
3752 | if (this instanceof ParamDecoratorFactory) {
|
3753 | metaCtor.apply(this, args);
|
3754 | return this;
|
3755 | }
|
3756 | const annotationInstance = new ParamDecoratorFactory(...args);
|
3757 | ParamDecorator.annotation = annotationInstance;
|
3758 | return ParamDecorator;
|
3759 | function ParamDecorator(cls, unusedKey, index) {
|
3760 |
|
3761 |
|
3762 | const parameters = cls.hasOwnProperty(PARAMETERS) ?
|
3763 | cls[PARAMETERS] :
|
3764 | Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
|
3765 |
|
3766 |
|
3767 | while (parameters.length <= index) {
|
3768 | parameters.push(null);
|
3769 | }
|
3770 | (parameters[index] = parameters[index] || []).push(annotationInstance);
|
3771 | return cls;
|
3772 | }
|
3773 | }
|
3774 | if (parentClass) {
|
3775 | ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
3776 | }
|
3777 | ParamDecoratorFactory.prototype.ngMetadataName = name;
|
3778 | ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;
|
3779 | return ParamDecoratorFactory;
|
3780 | });
|
3781 | }
|
3782 | function makePropDecorator(name, props, parentClass, additionalProcessing) {
|
3783 | return noSideEffects(() => {
|
3784 | const metaCtor = makeMetadataCtor(props);
|
3785 | function PropDecoratorFactory(...args) {
|
3786 | if (this instanceof PropDecoratorFactory) {
|
3787 | metaCtor.apply(this, args);
|
3788 | return this;
|
3789 | }
|
3790 | const decoratorInstance = new PropDecoratorFactory(...args);
|
3791 | function PropDecorator(target, name) {
|
3792 | const constructor = target.constructor;
|
3793 | // Use of Object.defineProperty is important because it creates a non-enumerable property
|
3794 | // which prevents the property from being copied during subclassing.
|
3795 | const meta = constructor.hasOwnProperty(PROP_METADATA) ?
|
3796 | constructor[PROP_METADATA] :
|
3797 | Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA];
|
3798 | meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
|
3799 | meta[name].unshift(decoratorInstance);
|
3800 | if (additionalProcessing)
|
3801 | additionalProcessing(target, name, ...args);
|
3802 | }
|
3803 | return PropDecorator;
|
3804 | }
|
3805 | if (parentClass) {
|
3806 | PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
3807 | }
|
3808 | PropDecoratorFactory.prototype.ngMetadataName = name;
|
3809 | PropDecoratorFactory.annotationCls = PropDecoratorFactory;
|
3810 | return PropDecoratorFactory;
|
3811 | });
|
3812 | }
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 |
|
3819 |
|
3820 |
|
3821 | function CREATE_ATTRIBUTE_DECORATOR__PRE_R3__() {
|
3822 | return makeParamDecorator('Attribute', (attributeName) => ({ attributeName }));
|
3823 | }
|
3824 | function CREATE_ATTRIBUTE_DECORATOR__POST_R3__() {
|
3825 | return makeParamDecorator('Attribute', (attributeName) => ({ attributeName, __NG_ELEMENT_ID__: () => ɵɵinjectAttribute(attributeName) }));
|
3826 | }
|
3827 | const CREATE_ATTRIBUTE_DECORATOR_IMPL = CREATE_ATTRIBUTE_DECORATOR__POST_R3__;
|
3828 |
|
3829 |
|
3830 |
|
3831 |
|
3832 |
|
3833 |
|
3834 | const Attribute = CREATE_ATTRIBUTE_DECORATOR_IMPL();
|
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 |
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 |
|
3860 |
|
3861 |
|
3862 |
|
3863 |
|
3864 |
|
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 | class InjectionToken {
|
3885 | |
3886 |
|
3887 |
|
3888 |
|
3889 |
|
3890 |
|
3891 | constructor(_desc, options) {
|
3892 | this._desc = _desc;
|
3893 |
|
3894 | this.ngMetadataName = 'InjectionToken';
|
3895 | this.ɵprov = undefined;
|
3896 | if (typeof options == 'number') {
|
3897 | (typeof ngDevMode === 'undefined' || ngDevMode) &&
|
3898 | assertLessThan(options, 0, 'Only negative numbers are supported here');
|
3899 |
|
3900 |
|
3901 | this.__NG_ELEMENT_ID__ = options;
|
3902 | }
|
3903 | else if (options !== undefined) {
|
3904 | this.ɵprov = ɵɵdefineInjectable({
|
3905 | token: this,
|
3906 | providedIn: options.providedIn || 'root',
|
3907 | factory: options.factory,
|
3908 | });
|
3909 | }
|
3910 | }
|
3911 | toString() {
|
3912 | return `InjectionToken ${this._desc}`;
|
3913 | }
|
3914 | }
|
3915 |
|
3916 |
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 |
|
3929 |
|
3930 |
|
3931 |
|
3932 |
|
3933 |
|
3934 |
|
3935 |
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 |
|
3942 |
|
3943 |
|
3944 |
|
3945 |
|
3946 |
|
3947 |
|
3948 |
|
3949 |
|
3950 |
|
3951 |
|
3952 |
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 | const ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
|
3961 |
|
3962 |
|
3963 | const emitDistinctChangesOnlyDefaultValue = true;
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 |
|
3974 | class Query {
|
3975 | }
|
3976 |
|
3977 |
|
3978 |
|
3979 |
|
3980 |
|
3981 |
|
3982 |
|
3983 | const ContentChildren = makePropDecorator('ContentChildren', (selector, data = {}) => ({
|
3984 | selector,
|
3985 | first: false,
|
3986 | isViewQuery: false,
|
3987 | descendants: false,
|
3988 | emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue,
|
3989 | ...data
|
3990 | }), Query);
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 | const ContentChild = makePropDecorator('ContentChild', (selector, data = {}) => ({ selector, first: true, isViewQuery: false, descendants: true, ...data }), Query);
|
4000 |
|
4001 |
|
4002 |
|
4003 |
|
4004 |
|
4005 |
|
4006 | const ViewChildren = makePropDecorator('ViewChildren', (selector, data = {}) => ({
|
4007 | selector,
|
4008 | first: false,
|
4009 | isViewQuery: true,
|
4010 | descendants: true,
|
4011 | emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue,
|
4012 | ...data
|
4013 | }), Query);
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 | const ViewChild = makePropDecorator('ViewChild', (selector, data) => ({ selector, first: true, isViewQuery: true, descendants: true, ...data }), Query);
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 | var FactoryTarget;
|
4030 | (function (FactoryTarget) {
|
4031 | FactoryTarget[FactoryTarget["Directive"] = 0] = "Directive";
|
4032 | FactoryTarget[FactoryTarget["Component"] = 1] = "Component";
|
4033 | FactoryTarget[FactoryTarget["Injectable"] = 2] = "Injectable";
|
4034 | FactoryTarget[FactoryTarget["Pipe"] = 3] = "Pipe";
|
4035 | FactoryTarget[FactoryTarget["NgModule"] = 4] = "NgModule";
|
4036 | })(FactoryTarget || (FactoryTarget = {}));
|
4037 | var ViewEncapsulation;
|
4038 | (function (ViewEncapsulation) {
|
4039 | ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
|
4040 |
|
4041 | ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
|
4042 | ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
|
4043 | })(ViewEncapsulation || (ViewEncapsulation = {}));
|
4044 |
|
4045 |
|
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 |
|
4052 | function getCompilerFacade(request) {
|
4053 | const globalNg = _global['ng'];
|
4054 | if (globalNg && globalNg.ɵcompilerFacade) {
|
4055 | return globalNg.ɵcompilerFacade;
|
4056 | }
|
4057 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
4058 |
|
4059 |
|
4060 | console.error(`JIT compilation failed for ${request.kind}`, request.type);
|
4061 | let message = `The ${request.kind} '${request
|
4062 | .type.name}' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.\n\n`;
|
4063 | if (request.usage === 1 ) {
|
4064 | message += `The ${request.kind} is part of a library that has been partially compiled.\n`;
|
4065 | message +=
|
4066 | `However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.\n`;
|
4067 | message += '\n';
|
4068 | message +=
|
4069 | `Ideally, the library is processed using the Angular Linker to become fully AOT compiled.\n`;
|
4070 | }
|
4071 | else {
|
4072 | message +=
|
4073 | `JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.\n`;
|
4074 | }
|
4075 | message +=
|
4076 | `Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',\n`;
|
4077 | message +=
|
4078 | `or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.`;
|
4079 | throw new Error(message);
|
4080 | }
|
4081 | else {
|
4082 | throw new Error('JIT compiler unavailable');
|
4083 | }
|
4084 | }
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 |
|
4092 |
|
4093 |
|
4094 |
|
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 |
|
4100 |
|
4101 |
|
4102 |
|
4103 | const Type = Function;
|
4104 | function isType(v) {
|
4105 | return typeof v === 'function';
|
4106 | }
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 |
|
4120 |
|
4121 | function addAllToArray(items, arr) {
|
4122 | for (let i = 0; i < items.length; i++) {
|
4123 | arr.push(items[i]);
|
4124 | }
|
4125 | }
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 |
|
4132 |
|
4133 |
|
4134 | function arrayEquals(a, b, identityAccessor) {
|
4135 | if (a.length !== b.length)
|
4136 | return false;
|
4137 | for (let i = 0; i < a.length; i++) {
|
4138 | let valueA = a[i];
|
4139 | let valueB = b[i];
|
4140 | if (identityAccessor) {
|
4141 | valueA = identityAccessor(valueA);
|
4142 | valueB = identityAccessor(valueB);
|
4143 | }
|
4144 | if (valueB !== valueA) {
|
4145 | return false;
|
4146 | }
|
4147 | }
|
4148 | return true;
|
4149 | }
|
4150 |
|
4151 |
|
4152 |
|
4153 | function flatten(list, dst) {
|
4154 | if (dst === undefined)
|
4155 | dst = list;
|
4156 | for (let i = 0; i < list.length; i++) {
|
4157 | let item = list[i];
|
4158 | if (Array.isArray(item)) {
|
4159 |
|
4160 | if (dst === list) {
|
4161 |
|
4162 |
|
4163 | dst = list.slice(0, i);
|
4164 | }
|
4165 | flatten(item, dst);
|
4166 | }
|
4167 | else if (dst !== list) {
|
4168 | dst.push(item);
|
4169 | }
|
4170 | }
|
4171 | return dst;
|
4172 | }
|
4173 | function deepForEach(input, fn) {
|
4174 | input.forEach(value => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
|
4175 | }
|
4176 | function addToArray(arr, index, value) {
|
4177 |
|
4178 | if (index >= arr.length) {
|
4179 | arr.push(value);
|
4180 | }
|
4181 | else {
|
4182 | arr.splice(index, 0, value);
|
4183 | }
|
4184 | }
|
4185 | function removeFromArray(arr, index) {
|
4186 |
|
4187 | if (index >= arr.length - 1) {
|
4188 | return arr.pop();
|
4189 | }
|
4190 | else {
|
4191 | return arr.splice(index, 1)[0];
|
4192 | }
|
4193 | }
|
4194 | function newArray(size, value) {
|
4195 | const list = [];
|
4196 | for (let i = 0; i < size; i++) {
|
4197 | list.push(value);
|
4198 | }
|
4199 | return list;
|
4200 | }
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 | function arraySplice(array, index, count) {
|
4215 | const length = array.length - count;
|
4216 | while (index < length) {
|
4217 | array[index] = array[index + count];
|
4218 | index++;
|
4219 | }
|
4220 | while (count--) {
|
4221 | array.pop();
|
4222 | }
|
4223 | }
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 | function arrayInsert(array, index, value) {
|
4236 | ngDevMode && assertLessThanOrEqual(index, array.length, 'Can\'t insert past array end.');
|
4237 | let end = array.length;
|
4238 | while (end > index) {
|
4239 | const previousEnd = end - 1;
|
4240 | array[end] = array[previousEnd];
|
4241 | end = previousEnd;
|
4242 | }
|
4243 | array[index] = value;
|
4244 | }
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 | function arrayInsert2(array, index, value1, value2) {
|
4258 | ngDevMode && assertLessThanOrEqual(index, array.length, 'Can\'t insert past array end.');
|
4259 | let end = array.length;
|
4260 | if (end == index) {
|
4261 |
|
4262 | array.push(value1, value2);
|
4263 | }
|
4264 | else if (end === 1) {
|
4265 |
|
4266 | array.push(value2, array[0]);
|
4267 | array[0] = value1;
|
4268 | }
|
4269 | else {
|
4270 | end--;
|
4271 | array.push(array[end - 1], array[end]);
|
4272 | while (end > index) {
|
4273 | const previousEnd = end - 2;
|
4274 | array[end] = array[previousEnd];
|
4275 | end--;
|
4276 | }
|
4277 | array[index] = value1;
|
4278 | array[index + 1] = value2;
|
4279 | }
|
4280 | }
|
4281 |
|
4282 |
|
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 |
|
4291 |
|
4292 | function arrayInsertSorted(array, value) {
|
4293 | let index = arrayIndexOfSorted(array, value);
|
4294 | if (index < 0) {
|
4295 |
|
4296 | index = ~index;
|
4297 | arrayInsert(array, index, value);
|
4298 | }
|
4299 | return index;
|
4300 | }
|
4301 |
|
4302 |
|
4303 |
|
4304 |
|
4305 |
|
4306 |
|
4307 |
|
4308 |
|
4309 |
|
4310 |
|
4311 |
|
4312 |
|
4313 |
|
4314 | function arrayRemoveSorted(array, value) {
|
4315 | const index = arrayIndexOfSorted(array, value);
|
4316 | if (index >= 0) {
|
4317 | arraySplice(array, index, 1);
|
4318 | }
|
4319 | return index;
|
4320 | }
|
4321 |
|
4322 |
|
4323 |
|
4324 |
|
4325 |
|
4326 |
|
4327 |
|
4328 |
|
4329 |
|
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 | function arrayIndexOfSorted(array, value) {
|
4335 | return _arrayIndexOfSorted(array, value, 0);
|
4336 | }
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 |
|
4345 | function keyValueArraySet(keyValueArray, key, value) {
|
4346 | let index = keyValueArrayIndexOf(keyValueArray, key);
|
4347 | if (index >= 0) {
|
4348 |
|
4349 | keyValueArray[index | 1] = value;
|
4350 | }
|
4351 | else {
|
4352 | index = ~index;
|
4353 | arrayInsert2(keyValueArray, index, key, value);
|
4354 | }
|
4355 | return index;
|
4356 | }
|
4357 |
|
4358 |
|
4359 |
|
4360 |
|
4361 |
|
4362 |
|
4363 |
|
4364 | function keyValueArrayGet(keyValueArray, key) {
|
4365 | const index = keyValueArrayIndexOf(keyValueArray, key);
|
4366 | if (index >= 0) {
|
4367 |
|
4368 | return keyValueArray[index | 1];
|
4369 | }
|
4370 | return undefined;
|
4371 | }
|
4372 |
|
4373 |
|
4374 |
|
4375 |
|
4376 |
|
4377 |
|
4378 |
|
4379 |
|
4380 |
|
4381 |
|
4382 | function keyValueArrayIndexOf(keyValueArray, key) {
|
4383 | return _arrayIndexOfSorted(keyValueArray, key, 1);
|
4384 | }
|
4385 |
|
4386 |
|
4387 |
|
4388 |
|
4389 |
|
4390 |
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 | function keyValueArrayDelete(keyValueArray, key) {
|
4396 | const index = keyValueArrayIndexOf(keyValueArray, key);
|
4397 | if (index >= 0) {
|
4398 |
|
4399 | arraySplice(keyValueArray, index, 2);
|
4400 | }
|
4401 | return index;
|
4402 | }
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 |
|
4410 |
|
4411 |
|
4412 |
|
4413 |
|
4414 |
|
4415 |
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 | function _arrayIndexOfSorted(array, value, shift) {
|
4421 | ngDevMode && assertEqual(Array.isArray(array), true, 'Expecting an array');
|
4422 | let start = 0;
|
4423 | let end = array.length >> shift;
|
4424 | while (end !== start) {
|
4425 | const middle = start + ((end - start) >> 1);
|
4426 | const current = array[middle << shift];
|
4427 | if (value === current) {
|
4428 | return (middle << shift);
|
4429 | }
|
4430 | else if (current > value) {
|
4431 | end = middle;
|
4432 | }
|
4433 | else {
|
4434 | start = middle + 1;
|
4435 | }
|
4436 | }
|
4437 | return ~(end << shift);
|
4438 | }
|
4439 |
|
4440 |
|
4441 |
|
4442 |
|
4443 |
|
4444 |
|
4445 |
|
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 |
|
4452 |
|
4453 |
|
4454 |
|
4455 |
|
4456 |
|
4457 |
|
4458 |
|
4459 |
|
4460 |
|
4461 |
|
4462 |
|
4463 |
|
4464 |
|
4465 |
|
4466 |
|
4467 |
|
4468 |
|
4469 |
|
4470 |
|
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 |
|
4476 |
|
4477 | const ES5_DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*(arguments|(?:[^()]+\(\[\],)?[^()]+\(arguments\).*)\)/;
|
4478 |
|
4479 | const ES2015_INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/;
|
4480 |
|
4481 |
|
4482 |
|
4483 |
|
4484 | const ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(/;
|
4485 |
|
4486 |
|
4487 |
|
4488 |
|
4489 | const ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{\s*super\(\.\.\.arguments\)/;
|
4490 |
|
4491 |
|
4492 |
|
4493 |
|
4494 |
|
4495 |
|
4496 |
|
4497 |
|
4498 | function isDelegateCtor(typeStr) {
|
4499 | return ES5_DELEGATE_CTOR.test(typeStr) ||
|
4500 | ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) ||
|
4501 | (ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr));
|
4502 | }
|
4503 | class ReflectionCapabilities {
|
4504 | constructor(reflect) {
|
4505 | this._reflect = reflect || _global['Reflect'];
|
4506 | }
|
4507 | isReflectionEnabled() {
|
4508 | return true;
|
4509 | }
|
4510 | factory(t) {
|
4511 | return (...args) => new t(...args);
|
4512 | }
|
4513 |
|
4514 | _zipTypesAndAnnotations(paramTypes, paramAnnotations) {
|
4515 | let result;
|
4516 | if (typeof paramTypes === 'undefined') {
|
4517 | result = newArray(paramAnnotations.length);
|
4518 | }
|
4519 | else {
|
4520 | result = newArray(paramTypes.length);
|
4521 | }
|
4522 | for (let i = 0; i < result.length; i++) {
|
4523 |
|
4524 |
|
4525 |
|
4526 | if (typeof paramTypes === 'undefined') {
|
4527 | result[i] = [];
|
4528 | }
|
4529 | else if (paramTypes[i] && paramTypes[i] != Object) {
|
4530 | result[i] = [paramTypes[i]];
|
4531 | }
|
4532 | else {
|
4533 | result[i] = [];
|
4534 | }
|
4535 | if (paramAnnotations && paramAnnotations[i] != null) {
|
4536 | result[i] = result[i].concat(paramAnnotations[i]);
|
4537 | }
|
4538 | }
|
4539 | return result;
|
4540 | }
|
4541 | _ownParameters(type, parentCtor) {
|
4542 | const typeStr = type.toString();
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 | if (isDelegateCtor(typeStr)) {
|
4551 | return null;
|
4552 | }
|
4553 |
|
4554 | if (type.parameters && type.parameters !== parentCtor.parameters) {
|
4555 | return type.parameters;
|
4556 | }
|
4557 |
|
4558 | const tsickleCtorParams = type.ctorParameters;
|
4559 | if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
|
4560 |
|
4561 |
|
4562 | const ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
|
4563 | const paramTypes = ctorParameters.map((ctorParam) => ctorParam && ctorParam.type);
|
4564 | const paramAnnotations = ctorParameters.map((ctorParam) => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators));
|
4565 | return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
4566 | }
|
4567 |
|
4568 | const paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS];
|
4569 | const paramTypes = this._reflect && this._reflect.getOwnMetadata &&
|
4570 | this._reflect.getOwnMetadata('design:paramtypes', type);
|
4571 | if (paramTypes || paramAnnotations) {
|
4572 | return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
4573 | }
|
4574 |
|
4575 |
|
4576 |
|
4577 |
|
4578 | return newArray(type.length);
|
4579 | }
|
4580 | parameters(type) {
|
4581 |
|
4582 |
|
4583 | if (!isType(type)) {
|
4584 | return [];
|
4585 | }
|
4586 | const parentCtor = getParentCtor(type);
|
4587 | let parameters = this._ownParameters(type, parentCtor);
|
4588 | if (!parameters && parentCtor !== Object) {
|
4589 | parameters = this.parameters(parentCtor);
|
4590 | }
|
4591 | return parameters || [];
|
4592 | }
|
4593 | _ownAnnotations(typeOrFunc, parentCtor) {
|
4594 |
|
4595 | if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) {
|
4596 | let annotations = typeOrFunc.annotations;
|
4597 | if (typeof annotations === 'function' && annotations.annotations) {
|
4598 | annotations = annotations.annotations;
|
4599 | }
|
4600 | return annotations;
|
4601 | }
|
4602 |
|
4603 | if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) {
|
4604 | return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators);
|
4605 | }
|
4606 |
|
4607 | if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {
|
4608 | return typeOrFunc[ANNOTATIONS];
|
4609 | }
|
4610 | return null;
|
4611 | }
|
4612 | annotations(typeOrFunc) {
|
4613 | if (!isType(typeOrFunc)) {
|
4614 | return [];
|
4615 | }
|
4616 | const parentCtor = getParentCtor(typeOrFunc);
|
4617 | const ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
|
4618 | const parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
|
4619 | return parentAnnotations.concat(ownAnnotations);
|
4620 | }
|
4621 | _ownPropMetadata(typeOrFunc, parentCtor) {
|
4622 |
|
4623 | if (typeOrFunc.propMetadata &&
|
4624 | typeOrFunc.propMetadata !== parentCtor.propMetadata) {
|
4625 | let propMetadata = typeOrFunc.propMetadata;
|
4626 | if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
|
4627 | propMetadata = propMetadata.propMetadata;
|
4628 | }
|
4629 | return propMetadata;
|
4630 | }
|
4631 |
|
4632 | if (typeOrFunc.propDecorators &&
|
4633 | typeOrFunc.propDecorators !== parentCtor.propDecorators) {
|
4634 | const propDecorators = typeOrFunc.propDecorators;
|
4635 | const propMetadata = {};
|
4636 | Object.keys(propDecorators).forEach(prop => {
|
4637 | propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
|
4638 | });
|
4639 | return propMetadata;
|
4640 | }
|
4641 |
|
4642 | if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
|
4643 | return typeOrFunc[PROP_METADATA];
|
4644 | }
|
4645 | return null;
|
4646 | }
|
4647 | propMetadata(typeOrFunc) {
|
4648 | if (!isType(typeOrFunc)) {
|
4649 | return {};
|
4650 | }
|
4651 | const parentCtor = getParentCtor(typeOrFunc);
|
4652 | const propMetadata = {};
|
4653 | if (parentCtor !== Object) {
|
4654 | const parentPropMetadata = this.propMetadata(parentCtor);
|
4655 | Object.keys(parentPropMetadata).forEach((propName) => {
|
4656 | propMetadata[propName] = parentPropMetadata[propName];
|
4657 | });
|
4658 | }
|
4659 | const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
|
4660 | if (ownPropMetadata) {
|
4661 | Object.keys(ownPropMetadata).forEach((propName) => {
|
4662 | const decorators = [];
|
4663 | if (propMetadata.hasOwnProperty(propName)) {
|
4664 | decorators.push(...propMetadata[propName]);
|
4665 | }
|
4666 | decorators.push(...ownPropMetadata[propName]);
|
4667 | propMetadata[propName] = decorators;
|
4668 | });
|
4669 | }
|
4670 | return propMetadata;
|
4671 | }
|
4672 | ownPropMetadata(typeOrFunc) {
|
4673 | if (!isType(typeOrFunc)) {
|
4674 | return {};
|
4675 | }
|
4676 | return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};
|
4677 | }
|
4678 | hasLifecycleHook(type, lcProperty) {
|
4679 | return type instanceof Type && lcProperty in type.prototype;
|
4680 | }
|
4681 | guards(type) {
|
4682 | return {};
|
4683 | }
|
4684 | getter(name) {
|
4685 | return new Function('o', 'return o.' + name + ';');
|
4686 | }
|
4687 | setter(name) {
|
4688 | return new Function('o', 'v', 'return o.' + name + ' = v;');
|
4689 | }
|
4690 | method(name) {
|
4691 | const functionBody = `if (!o.${name}) throw new Error('"${name}" is undefined');
|
4692 | return o.${name}.apply(o, args);`;
|
4693 | return new Function('o', 'args', functionBody);
|
4694 | }
|
4695 |
|
4696 | importUri(type) {
|
4697 |
|
4698 | if (typeof type === 'object' && type['filePath']) {
|
4699 | return type['filePath'];
|
4700 | }
|
4701 |
|
4702 | return `./${stringify(type)}`;
|
4703 | }
|
4704 | resourceUri(type) {
|
4705 | return `./${stringify(type)}`;
|
4706 | }
|
4707 | resolveIdentifier(name, moduleUrl, members, runtime) {
|
4708 | return runtime;
|
4709 | }
|
4710 | resolveEnum(enumIdentifier, name) {
|
4711 | return enumIdentifier[name];
|
4712 | }
|
4713 | }
|
4714 | function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
|
4715 | if (!decoratorInvocations) {
|
4716 | return [];
|
4717 | }
|
4718 | return decoratorInvocations.map(decoratorInvocation => {
|
4719 | const decoratorType = decoratorInvocation.type;
|
4720 | const annotationCls = decoratorType.annotationCls;
|
4721 | const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
|
4722 | return new annotationCls(...annotationArgs);
|
4723 | });
|
4724 | }
|
4725 | function getParentCtor(ctor) {
|
4726 | const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
|
4727 | const parentCtor = parentProto ? parentProto.constructor : null;
|
4728 |
|
4729 |
|
4730 | return parentCtor || Object;
|
4731 | }
|
4732 |
|
4733 |
|
4734 |
|
4735 |
|
4736 |
|
4737 |
|
4738 |
|
4739 |
|
4740 | const _THROW_IF_NOT_FOUND = {};
|
4741 | const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
4742 |
|
4743 |
|
4744 |
|
4745 |
|
4746 |
|
4747 | const DI_DECORATOR_FLAG = '__NG_DI_FLAG__';
|
4748 | const NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';
|
4749 | const NG_TOKEN_PATH = 'ngTokenPath';
|
4750 | const NEW_LINE = /\n/gm;
|
4751 | const NO_NEW_LINE$1 = 'ɵ';
|
4752 | const SOURCE = '__source';
|
4753 | const USE_VALUE$2 = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty });
|
4754 |
|
4755 |
|
4756 |
|
4757 |
|
4758 |
|
4759 |
|
4760 | let _currentInjector = undefined;
|
4761 | function setCurrentInjector(injector) {
|
4762 | const former = _currentInjector;
|
4763 | _currentInjector = injector;
|
4764 | return former;
|
4765 | }
|
4766 | function injectInjectorOnly(token, flags = InjectFlags.Default) {
|
4767 | if (_currentInjector === undefined) {
|
4768 | throw new Error(`inject() must be called from an injection context`);
|
4769 | }
|
4770 | else if (_currentInjector === null) {
|
4771 | return injectRootLimpMode(token, undefined, flags);
|
4772 | }
|
4773 | else {
|
4774 | return _currentInjector.get(token, flags & InjectFlags.Optional ? null : undefined, flags);
|
4775 | }
|
4776 | }
|
4777 | function ɵɵinject(token, flags = InjectFlags.Default) {
|
4778 | return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);
|
4779 | }
|
4780 |
|
4781 |
|
4782 |
|
4783 |
|
4784 |
|
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 |
|
4790 |
|
4791 |
|
4792 | function ɵɵinvalidFactoryDep(index) {
|
4793 | const msg = ngDevMode ?
|
4794 | `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
|
4795 | 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.
|
4796 |
|
4797 | 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.` :
|
4798 | 'invalid';
|
4799 | throw new Error(msg);
|
4800 | }
|
4801 |
|
4802 |
|
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 |
|
4812 |
|
4813 |
|
4814 |
|
4815 |
|
4816 |
|
4817 |
|
4818 |
|
4819 |
|
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 | const inject = ɵɵinject;
|
4826 | function injectArgs(types) {
|
4827 | const args = [];
|
4828 | for (let i = 0; i < types.length; i++) {
|
4829 | const arg = resolveForwardRef(types[i]);
|
4830 | if (Array.isArray(arg)) {
|
4831 | if (arg.length === 0) {
|
4832 | throw new Error('Arguments array must have arguments.');
|
4833 | }
|
4834 | let type = undefined;
|
4835 | let flags = InjectFlags.Default;
|
4836 | for (let j = 0; j < arg.length; j++) {
|
4837 | const meta = arg[j];
|
4838 | const flag = getInjectFlag(meta);
|
4839 | if (typeof flag === 'number') {
|
4840 |
|
4841 | if (flag === -1 ) {
|
4842 | type = meta.token;
|
4843 | }
|
4844 | else {
|
4845 | flags |= flag;
|
4846 | }
|
4847 | }
|
4848 | else {
|
4849 | type = meta;
|
4850 | }
|
4851 | }
|
4852 | args.push(ɵɵinject(type, flags));
|
4853 | }
|
4854 | else {
|
4855 | args.push(ɵɵinject(arg));
|
4856 | }
|
4857 | }
|
4858 | return args;
|
4859 | }
|
4860 |
|
4861 |
|
4862 |
|
4863 |
|
4864 |
|
4865 |
|
4866 |
|
4867 |
|
4868 |
|
4869 |
|
4870 | function attachInjectFlag(decorator, flag) {
|
4871 | decorator[DI_DECORATOR_FLAG] = flag;
|
4872 | decorator.prototype[DI_DECORATOR_FLAG] = flag;
|
4873 | return decorator;
|
4874 | }
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 | function getInjectFlag(token) {
|
4881 | return token[DI_DECORATOR_FLAG];
|
4882 | }
|
4883 | function catchInjectorError(e, token, injectorErrorName, source) {
|
4884 | const tokenPath = e[NG_TEMP_TOKEN_PATH];
|
4885 | if (token[SOURCE]) {
|
4886 | tokenPath.unshift(token[SOURCE]);
|
4887 | }
|
4888 | e.message = formatError('\n' + e.message, tokenPath, injectorErrorName, source);
|
4889 | e[NG_TOKEN_PATH] = tokenPath;
|
4890 | e[NG_TEMP_TOKEN_PATH] = null;
|
4891 | throw e;
|
4892 | }
|
4893 | function formatError(text, obj, injectorErrorName, source = null) {
|
4894 | text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE$1 ? text.substr(2) : text;
|
4895 | let context = stringify(obj);
|
4896 | if (Array.isArray(obj)) {
|
4897 | context = obj.map(stringify).join(' -> ');
|
4898 | }
|
4899 | else if (typeof obj === 'object') {
|
4900 | let parts = [];
|
4901 | for (let key in obj) {
|
4902 | if (obj.hasOwnProperty(key)) {
|
4903 | let value = obj[key];
|
4904 | parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));
|
4905 | }
|
4906 | }
|
4907 | context = `{${parts.join(', ')}}`;
|
4908 | }
|
4909 | return `${injectorErrorName}${source ? '(' + source + ')' : ''}[${context}]: ${text.replace(NEW_LINE, '\n ')}`;
|
4910 | }
|
4911 |
|
4912 |
|
4913 |
|
4914 |
|
4915 |
|
4916 |
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 | const Inject = attachInjectFlag(
|
4926 |
|
4927 |
|
4928 | makeParamDecorator('Inject', (token) => ({ token })), -1 );
|
4929 |
|
4930 |
|
4931 |
|
4932 |
|
4933 |
|
4934 |
|
4935 | const Optional =
|
4936 |
|
4937 |
|
4938 | attachInjectFlag(makeParamDecorator('Optional'), 8 );
|
4939 |
|
4940 |
|
4941 |
|
4942 |
|
4943 |
|
4944 |
|
4945 | const Self =
|
4946 |
|
4947 |
|
4948 | attachInjectFlag(makeParamDecorator('Self'), 2 );
|
4949 |
|
4950 |
|
4951 |
|
4952 |
|
4953 |
|
4954 |
|
4955 | const SkipSelf =
|
4956 |
|
4957 |
|
4958 | attachInjectFlag(makeParamDecorator('SkipSelf'), 4 );
|
4959 |
|
4960 |
|
4961 |
|
4962 |
|
4963 |
|
4964 |
|
4965 | const Host =
|
4966 |
|
4967 |
|
4968 | attachInjectFlag(makeParamDecorator('Host'), 1 );
|
4969 |
|
4970 |
|
4971 |
|
4972 |
|
4973 |
|
4974 |
|
4975 |
|
4976 |
|
4977 | let _reflect = null;
|
4978 | function getReflect() {
|
4979 | return (_reflect = _reflect || new ReflectionCapabilities());
|
4980 | }
|
4981 | function reflectDependencies(type) {
|
4982 | return convertDependencies(getReflect().parameters(type));
|
4983 | }
|
4984 | function convertDependencies(deps) {
|
4985 | return deps.map(dep => reflectDependency(dep));
|
4986 | }
|
4987 | function reflectDependency(dep) {
|
4988 | const meta = {
|
4989 | token: null,
|
4990 | attribute: null,
|
4991 | host: false,
|
4992 | optional: false,
|
4993 | self: false,
|
4994 | skipSelf: false,
|
4995 | };
|
4996 | if (Array.isArray(dep) && dep.length > 0) {
|
4997 | for (let j = 0; j < dep.length; j++) {
|
4998 | const param = dep[j];
|
4999 | if (param === undefined) {
|
5000 |
|
5001 | continue;
|
5002 | }
|
5003 | const proto = Object.getPrototypeOf(param);
|
5004 | if (param instanceof Optional || proto.ngMetadataName === 'Optional') {
|
5005 | meta.optional = true;
|
5006 | }
|
5007 | else if (param instanceof SkipSelf || proto.ngMetadataName === 'SkipSelf') {
|
5008 | meta.skipSelf = true;
|
5009 | }
|
5010 | else if (param instanceof Self || proto.ngMetadataName === 'Self') {
|
5011 | meta.self = true;
|
5012 | }
|
5013 | else if (param instanceof Host || proto.ngMetadataName === 'Host') {
|
5014 | meta.host = true;
|
5015 | }
|
5016 | else if (param instanceof Inject) {
|
5017 | meta.token = param.token;
|
5018 | }
|
5019 | else if (param instanceof Attribute) {
|
5020 | if (param.attributeName === undefined) {
|
5021 | throw new Error(`Attribute name must be defined.`);
|
5022 | }
|
5023 | meta.attribute = param.attributeName;
|
5024 | }
|
5025 | else {
|
5026 | meta.token = param;
|
5027 | }
|
5028 | }
|
5029 | }
|
5030 | else if (dep === undefined || (Array.isArray(dep) && dep.length === 0)) {
|
5031 | meta.token = null;
|
5032 | }
|
5033 | else {
|
5034 | meta.token = dep;
|
5035 | }
|
5036 | return meta;
|
5037 | }
|
5038 |
|
5039 |
|
5040 |
|
5041 |
|
5042 |
|
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 |
|
5055 |
|
5056 |
|
5057 |
|
5058 |
|
5059 |
|
5060 |
|
5061 |
|
5062 |
|
5063 |
|
5064 |
|
5065 |
|
5066 |
|
5067 |
|
5068 |
|
5069 |
|
5070 |
|
5071 |
|
5072 |
|
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 | function resolveComponentResources(resourceResolver) {
|
5079 |
|
5080 | const componentResolved = [];
|
5081 |
|
5082 | const urlMap = new Map();
|
5083 | function cachedResourceResolve(url) {
|
5084 | let promise = urlMap.get(url);
|
5085 | if (!promise) {
|
5086 | const resp = resourceResolver(url);
|
5087 | urlMap.set(url, promise = resp.then(unwrapResponse));
|
5088 | }
|
5089 | return promise;
|
5090 | }
|
5091 | componentResourceResolutionQueue.forEach((component, type) => {
|
5092 | const promises = [];
|
5093 | if (component.templateUrl) {
|
5094 | promises.push(cachedResourceResolve(component.templateUrl).then((template) => {
|
5095 | component.template = template;
|
5096 | }));
|
5097 | }
|
5098 | const styleUrls = component.styleUrls;
|
5099 | const styles = component.styles || (component.styles = []);
|
5100 | const styleOffset = component.styles.length;
|
5101 | styleUrls && styleUrls.forEach((styleUrl, index) => {
|
5102 | styles.push('');
|
5103 | promises.push(cachedResourceResolve(styleUrl).then((style) => {
|
5104 | styles[styleOffset + index] = style;
|
5105 | styleUrls.splice(styleUrls.indexOf(styleUrl), 1);
|
5106 | if (styleUrls.length == 0) {
|
5107 | component.styleUrls = undefined;
|
5108 | }
|
5109 | }));
|
5110 | });
|
5111 | const fullyResolved = Promise.all(promises).then(() => componentDefResolved(type));
|
5112 | componentResolved.push(fullyResolved);
|
5113 | });
|
5114 | clearResolutionOfComponentResourcesQueue();
|
5115 | return Promise.all(componentResolved).then(() => undefined);
|
5116 | }
|
5117 | let componentResourceResolutionQueue = new Map();
|
5118 |
|
5119 | const componentDefPendingResolution = new Set();
|
5120 | function maybeQueueResolutionOfComponentResources(type, metadata) {
|
5121 | if (componentNeedsResolution(metadata)) {
|
5122 | componentResourceResolutionQueue.set(type, metadata);
|
5123 | componentDefPendingResolution.add(type);
|
5124 | }
|
5125 | }
|
5126 | function isComponentDefPendingResolution(type) {
|
5127 | return componentDefPendingResolution.has(type);
|
5128 | }
|
5129 | function componentNeedsResolution(component) {
|
5130 | return !!((component.templateUrl && !component.hasOwnProperty('template')) ||
|
5131 | component.styleUrls && component.styleUrls.length);
|
5132 | }
|
5133 | function clearResolutionOfComponentResourcesQueue() {
|
5134 | const old = componentResourceResolutionQueue;
|
5135 | componentResourceResolutionQueue = new Map();
|
5136 | return old;
|
5137 | }
|
5138 | function restoreComponentResolutionQueue(queue) {
|
5139 | componentDefPendingResolution.clear();
|
5140 | queue.forEach((_, type) => componentDefPendingResolution.add(type));
|
5141 | componentResourceResolutionQueue = queue;
|
5142 | }
|
5143 | function isComponentResourceResolutionQueueEmpty() {
|
5144 | return componentResourceResolutionQueue.size === 0;
|
5145 | }
|
5146 | function unwrapResponse(response) {
|
5147 | return typeof response == 'string' ? response : response.text();
|
5148 | }
|
5149 | function componentDefResolved(type) {
|
5150 | componentDefPendingResolution.delete(type);
|
5151 | }
|
5152 |
|
5153 |
|
5154 |
|
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 |
|
5164 | let policy$1;
|
5165 |
|
5166 |
|
5167 |
|
5168 |
|
5169 | function getPolicy$1() {
|
5170 | if (policy$1 === undefined) {
|
5171 | policy$1 = null;
|
5172 | if (_global.trustedTypes) {
|
5173 | try {
|
5174 | policy$1 = _global.trustedTypes.createPolicy('angular', {
|
5175 | createHTML: (s) => s,
|
5176 | createScript: (s) => s,
|
5177 | createScriptURL: (s) => s,
|
5178 | });
|
5179 | }
|
5180 | catch {
|
5181 |
|
5182 |
|
5183 |
|
5184 |
|
5185 | }
|
5186 | }
|
5187 | }
|
5188 | return policy$1;
|
5189 | }
|
5190 |
|
5191 |
|
5192 |
|
5193 |
|
5194 |
|
5195 |
|
5196 |
|
5197 |
|
5198 |
|
5199 | function trustedHTMLFromString(html) {
|
5200 | return getPolicy$1()?.createHTML(html) || html;
|
5201 | }
|
5202 |
|
5203 |
|
5204 |
|
5205 |
|
5206 |
|
5207 |
|
5208 |
|
5209 | function trustedScriptFromString(script) {
|
5210 | return getPolicy$1()?.createScript(script) || script;
|
5211 | }
|
5212 |
|
5213 |
|
5214 |
|
5215 |
|
5216 |
|
5217 |
|
5218 |
|
5219 |
|
5220 |
|
5221 | function trustedScriptURLFromString(url) {
|
5222 | return getPolicy$1()?.createScriptURL(url) || url;
|
5223 | }
|
5224 |
|
5225 |
|
5226 |
|
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 |
|
5232 |
|
5233 | function newTrustedFunctionForDev(...args) {
|
5234 | if (typeof ngDevMode === 'undefined') {
|
5235 | throw new Error('newTrustedFunctionForDev should never be called in production');
|
5236 | }
|
5237 | if (!_global.trustedTypes) {
|
5238 |
|
5239 |
|
5240 | return new Function(...args);
|
5241 | }
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 | const fnArgs = args.slice(0, -1).join(',');
|
5247 | const fnBody = args[args.length - 1];
|
5248 | const body = `(function anonymous(${fnArgs}
|
5249 | ) { ${fnBody}
|
5250 | })`;
|
5251 |
|
5252 |
|
5253 |
|
5254 | const fn = _global['eval'](trustedScriptFromString(body));
|
5255 | if (fn.bind === undefined) {
|
5256 |
|
5257 |
|
5258 |
|
5259 |
|
5260 | return new Function(...args);
|
5261 | }
|
5262 |
|
5263 |
|
5264 |
|
5265 | fn.toString = () => body;
|
5266 |
|
5267 | return fn.bind(_global);
|
5268 |
|
5269 |
|
5270 |
|
5271 | }
|
5272 |
|
5273 |
|
5274 |
|
5275 |
|
5276 |
|
5277 |
|
5278 |
|
5279 |
|
5280 |
|
5281 |
|
5282 |
|
5283 |
|
5284 | let policy;
|
5285 |
|
5286 |
|
5287 |
|
5288 |
|
5289 | function getPolicy() {
|
5290 | if (policy === undefined) {
|
5291 | policy = null;
|
5292 | if (_global.trustedTypes) {
|
5293 | try {
|
5294 | policy = _global.trustedTypes
|
5295 | .createPolicy('angular#unsafe-bypass', {
|
5296 | createHTML: (s) => s,
|
5297 | createScript: (s) => s,
|
5298 | createScriptURL: (s) => s,
|
5299 | });
|
5300 | }
|
5301 | catch {
|
5302 |
|
5303 |
|
5304 |
|
5305 |
|
5306 | }
|
5307 | }
|
5308 | }
|
5309 | return policy;
|
5310 | }
|
5311 |
|
5312 |
|
5313 |
|
5314 |
|
5315 |
|
5316 |
|
5317 |
|
5318 |
|
5319 | function trustedHTMLFromStringBypass(html) {
|
5320 | return getPolicy()?.createHTML(html) || html;
|
5321 | }
|
5322 |
|
5323 |
|
5324 |
|
5325 |
|
5326 |
|
5327 |
|
5328 |
|
5329 |
|
5330 | function trustedScriptFromStringBypass(script) {
|
5331 | return getPolicy()?.createScript(script) || script;
|
5332 | }
|
5333 |
|
5334 |
|
5335 |
|
5336 |
|
5337 |
|
5338 |
|
5339 |
|
5340 |
|
5341 | function trustedScriptURLFromStringBypass(url) {
|
5342 | return getPolicy()?.createScriptURL(url) || url;
|
5343 | }
|
5344 |
|
5345 |
|
5346 |
|
5347 |
|
5348 |
|
5349 |
|
5350 |
|
5351 |
|
5352 | class SafeValueImpl {
|
5353 | constructor(changingThisBreaksApplicationSecurity) {
|
5354 | this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
|
5355 | }
|
5356 | toString() {
|
5357 | return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity}` +
|
5358 | ` (see https://g.co/ng/security#xss)`;
|
5359 | }
|
5360 | }
|
5361 | class SafeHtmlImpl extends SafeValueImpl {
|
5362 | getTypeName() {
|
5363 | return "HTML" ;
|
5364 | }
|
5365 | }
|
5366 | class SafeStyleImpl extends SafeValueImpl {
|
5367 | getTypeName() {
|
5368 | return "Style" ;
|
5369 | }
|
5370 | }
|
5371 | class SafeScriptImpl extends SafeValueImpl {
|
5372 | getTypeName() {
|
5373 | return "Script" ;
|
5374 | }
|
5375 | }
|
5376 | class SafeUrlImpl extends SafeValueImpl {
|
5377 | getTypeName() {
|
5378 | return "URL" ;
|
5379 | }
|
5380 | }
|
5381 | class SafeResourceUrlImpl extends SafeValueImpl {
|
5382 | getTypeName() {
|
5383 | return "ResourceURL" ;
|
5384 | }
|
5385 | }
|
5386 | function unwrapSafeValue(value) {
|
5387 | return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity :
|
5388 | value;
|
5389 | }
|
5390 | function allowSanitizationBypassAndThrow(value, type) {
|
5391 | const actualType = getSanitizationBypassType(value);
|
5392 | if (actualType != null && actualType !== type) {
|
5393 |
|
5394 | if (actualType === "ResourceURL" && type === "URL" )
|
5395 | return true;
|
5396 | throw new Error(`Required a safe ${type}, got a ${actualType} (see https://g.co/ng/security#xss)`);
|
5397 | }
|
5398 | return actualType === type;
|
5399 | }
|
5400 | function getSanitizationBypassType(value) {
|
5401 | return value instanceof SafeValueImpl && value.getTypeName() || null;
|
5402 | }
|
5403 |
|
5404 |
|
5405 |
|
5406 |
|
5407 |
|
5408 |
|
5409 |
|
5410 |
|
5411 |
|
5412 | function bypassSanitizationTrustHtml(trustedHtml) {
|
5413 | return new SafeHtmlImpl(trustedHtml);
|
5414 | }
|
5415 |
|
5416 |
|
5417 |
|
5418 |
|
5419 |
|
5420 |
|
5421 |
|
5422 |
|
5423 |
|
5424 | function bypassSanitizationTrustStyle(trustedStyle) {
|
5425 | return new SafeStyleImpl(trustedStyle);
|
5426 | }
|
5427 |
|
5428 |
|
5429 |
|
5430 |
|
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 |
|
5436 | function bypassSanitizationTrustScript(trustedScript) {
|
5437 | return new SafeScriptImpl(trustedScript);
|
5438 | }
|
5439 |
|
5440 |
|
5441 |
|
5442 |
|
5443 |
|
5444 |
|
5445 |
|
5446 |
|
5447 |
|
5448 | function bypassSanitizationTrustUrl(trustedUrl) {
|
5449 | return new SafeUrlImpl(trustedUrl);
|
5450 | }
|
5451 |
|
5452 |
|
5453 |
|
5454 |
|
5455 |
|
5456 |
|
5457 |
|
5458 |
|
5459 |
|
5460 | function bypassSanitizationTrustResourceUrl(trustedResourceUrl) {
|
5461 | return new SafeResourceUrlImpl(trustedResourceUrl);
|
5462 | }
|
5463 |
|
5464 |
|
5465 |
|
5466 |
|
5467 |
|
5468 |
|
5469 |
|
5470 |
|
5471 |
|
5472 |
|
5473 |
|
5474 |
|
5475 |
|
5476 |
|
5477 |
|
5478 | function getInertBodyHelper(defaultDoc) {
|
5479 | const inertDocumentHelper = new InertDocumentHelper(defaultDoc);
|
5480 | return isDOMParserAvailable() ? new DOMParserHelper(inertDocumentHelper) : inertDocumentHelper;
|
5481 | }
|
5482 |
|
5483 |
|
5484 |
|
5485 |
|
5486 | class DOMParserHelper {
|
5487 | constructor(inertDocumentHelper) {
|
5488 | this.inertDocumentHelper = inertDocumentHelper;
|
5489 | }
|
5490 | getInertBodyElement(html) {
|
5491 |
|
5492 |
|
5493 |
|
5494 |
|
5495 | html = '<body><remove></remove>' + html;
|
5496 | try {
|
5497 | const body = new window.DOMParser()
|
5498 | .parseFromString(trustedHTMLFromString(html), 'text/html')
|
5499 | .body;
|
5500 | if (body === null) {
|
5501 |
|
5502 |
|
5503 |
|
5504 | return this.inertDocumentHelper.getInertBodyElement(html);
|
5505 | }
|
5506 | body.removeChild(body.firstChild);
|
5507 | return body;
|
5508 | }
|
5509 | catch {
|
5510 | return null;
|
5511 | }
|
5512 | }
|
5513 | }
|
5514 |
|
5515 |
|
5516 |
|
5517 |
|
5518 |
|
5519 | class InertDocumentHelper {
|
5520 | constructor(defaultDoc) {
|
5521 | this.defaultDoc = defaultDoc;
|
5522 | this.inertDocument = this.defaultDoc.implementation.createHTMLDocument('sanitization-inert');
|
5523 | if (this.inertDocument.body == null) {
|
5524 |
|
5525 |
|
5526 | const inertHtml = this.inertDocument.createElement('html');
|
5527 | this.inertDocument.appendChild(inertHtml);
|
5528 | const inertBodyElement = this.inertDocument.createElement('body');
|
5529 | inertHtml.appendChild(inertBodyElement);
|
5530 | }
|
5531 | }
|
5532 | getInertBodyElement(html) {
|
5533 |
|
5534 | const templateEl = this.inertDocument.createElement('template');
|
5535 | if ('content' in templateEl) {
|
5536 | templateEl.innerHTML = trustedHTMLFromString(html);
|
5537 | return templateEl;
|
5538 | }
|
5539 |
|
5540 |
|
5541 |
|
5542 |
|
5543 |
|
5544 |
|
5545 |
|
5546 | const inertBody = this.inertDocument.createElement('body');
|
5547 | inertBody.innerHTML = trustedHTMLFromString(html);
|
5548 |
|
5549 |
|
5550 | if (this.defaultDoc.documentMode) {
|
5551 | this.stripCustomNsAttrs(inertBody);
|
5552 | }
|
5553 | return inertBody;
|
5554 | }
|
5555 | |
5556 |
|
5557 |
|
5558 |
|
5559 |
|
5560 |
|
5561 |
|
5562 |
|
5563 | stripCustomNsAttrs(el) {
|
5564 | const elAttrs = el.attributes;
|
5565 |
|
5566 | for (let i = elAttrs.length - 1; 0 < i; i--) {
|
5567 | const attrib = elAttrs.item(i);
|
5568 | const attrName = attrib.name;
|
5569 | if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
|
5570 | el.removeAttribute(attrName);
|
5571 | }
|
5572 | }
|
5573 | let childNode = el.firstChild;
|
5574 | while (childNode) {
|
5575 | if (childNode.nodeType === Node.ELEMENT_NODE)
|
5576 | this.stripCustomNsAttrs(childNode);
|
5577 | childNode = childNode.nextSibling;
|
5578 | }
|
5579 | }
|
5580 | }
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 |
|
5588 | function isDOMParserAvailable() {
|
5589 | try {
|
5590 | return !!new window.DOMParser().parseFromString(trustedHTMLFromString(''), 'text/html');
|
5591 | }
|
5592 | catch {
|
5593 | return false;
|
5594 | }
|
5595 | }
|
5596 |
|
5597 |
|
5598 |
|
5599 |
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 |
|
5608 |
|
5609 |
|
5610 |
|
5611 |
|
5612 |
|
5613 |
|
5614 |
|
5615 |
|
5616 |
|
5617 |
|
5618 |
|
5619 |
|
5620 |
|
5621 |
|
5622 |
|
5623 |
|
5624 |
|
5625 |
|
5626 |
|
5627 |
|
5628 |
|
5629 |
|
5630 | const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;
|
5631 |
|
5632 | const SAFE_SRCSET_PATTERN = /^(?:(?:https?|file):|[^&:/?#]*(?:[/?#]|$))/gi;
|
5633 |
|
5634 | 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;
|
5635 | function _sanitizeUrl(url) {
|
5636 | url = String(url);
|
5637 | if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN))
|
5638 | return url;
|
5639 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
5640 | console.warn(`WARNING: sanitizing unsafe URL value ${url} (see https://g.co/ng/security#xss)`);
|
5641 | }
|
5642 | return 'unsafe:' + url;
|
5643 | }
|
5644 | function sanitizeSrcset(srcset) {
|
5645 | srcset = String(srcset);
|
5646 | return srcset.split(',').map((srcset) => _sanitizeUrl(srcset.trim())).join(', ');
|
5647 | }
|
5648 |
|
5649 |
|
5650 |
|
5651 |
|
5652 |
|
5653 |
|
5654 |
|
5655 |
|
5656 | function tagSet(tags) {
|
5657 | const res = {};
|
5658 | for (const t of tags.split(','))
|
5659 | res[t] = true;
|
5660 | return res;
|
5661 | }
|
5662 | function merge(...sets) {
|
5663 | const res = {};
|
5664 | for (const s of sets) {
|
5665 | for (const v in s) {
|
5666 | if (s.hasOwnProperty(v))
|
5667 | res[v] = true;
|
5668 | }
|
5669 | }
|
5670 | return res;
|
5671 | }
|
5672 |
|
5673 |
|
5674 |
|
5675 |
|
5676 |
|
5677 | const VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr');
|
5678 |
|
5679 |
|
5680 | const OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr');
|
5681 | const OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt');
|
5682 | const OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
|
5683 |
|
5684 | const BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' +
|
5685 | 'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
|
5686 | 'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul'));
|
5687 |
|
5688 | const INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' +
|
5689 | 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' +
|
5690 | 'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video'));
|
5691 | const VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
|
5692 |
|
5693 | const URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href');
|
5694 |
|
5695 | const SRCSET_ATTRS = tagSet('srcset');
|
5696 | const HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +
|
5697 | 'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +
|
5698 | 'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +
|
5699 | 'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +
|
5700 | 'valign,value,vspace,width');
|
5701 |
|
5702 | const ARIA_ATTRS = tagSet('aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,' +
|
5703 | 'aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,' +
|
5704 | 'aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,' +
|
5705 | 'aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,' +
|
5706 | 'aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,' +
|
5707 | 'aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,' +
|
5708 | 'aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext');
|
5709 |
|
5710 |
|
5711 |
|
5712 |
|
5713 |
|
5714 |
|
5715 | const VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS, ARIA_ATTRS);
|
5716 |
|
5717 |
|
5718 |
|
5719 |
|
5720 |
|
5721 | const SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS = tagSet('script,style,template');
|
5722 |
|
5723 |
|
5724 |
|
5725 |
|
5726 | class SanitizingHtmlSerializer {
|
5727 | constructor() {
|
5728 |
|
5729 |
|
5730 | this.sanitizedSomething = false;
|
5731 | this.buf = [];
|
5732 | }
|
5733 | sanitizeChildren(el) {
|
5734 |
|
5735 |
|
5736 |
|
5737 | let current = el.firstChild;
|
5738 | let traverseContent = true;
|
5739 | while (current) {
|
5740 | if (current.nodeType === Node.ELEMENT_NODE) {
|
5741 | traverseContent = this.startElement(current);
|
5742 | }
|
5743 | else if (current.nodeType === Node.TEXT_NODE) {
|
5744 | this.chars(current.nodeValue);
|
5745 | }
|
5746 | else {
|
5747 |
|
5748 | this.sanitizedSomething = true;
|
5749 | }
|
5750 | if (traverseContent && current.firstChild) {
|
5751 | current = current.firstChild;
|
5752 | continue;
|
5753 | }
|
5754 | while (current) {
|
5755 |
|
5756 | if (current.nodeType === Node.ELEMENT_NODE) {
|
5757 | this.endElement(current);
|
5758 | }
|
5759 | let next = this.checkClobberedElement(current, current.nextSibling);
|
5760 | if (next) {
|
5761 | current = next;
|
5762 | break;
|
5763 | }
|
5764 | current = this.checkClobberedElement(current, current.parentNode);
|
5765 | }
|
5766 | }
|
5767 | return this.buf.join('');
|
5768 | }
|
5769 | |
5770 |
|
5771 |
|
5772 |
|
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 | startElement(element) {
|
5778 | const tagName = element.nodeName.toLowerCase();
|
5779 | if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
|
5780 | this.sanitizedSomething = true;
|
5781 | return !SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS.hasOwnProperty(tagName);
|
5782 | }
|
5783 | this.buf.push('<');
|
5784 | this.buf.push(tagName);
|
5785 | const elAttrs = element.attributes;
|
5786 | for (let i = 0; i < elAttrs.length; i++) {
|
5787 | const elAttr = elAttrs.item(i);
|
5788 | const attrName = elAttr.name;
|
5789 | const lower = attrName.toLowerCase();
|
5790 | if (!VALID_ATTRS.hasOwnProperty(lower)) {
|
5791 | this.sanitizedSomething = true;
|
5792 | continue;
|
5793 | }
|
5794 | let value = elAttr.value;
|
5795 |
|
5796 | if (URI_ATTRS[lower])
|
5797 | value = _sanitizeUrl(value);
|
5798 | if (SRCSET_ATTRS[lower])
|
5799 | value = sanitizeSrcset(value);
|
5800 | this.buf.push(' ', attrName, '="', encodeEntities(value), '"');
|
5801 | }
|
5802 | this.buf.push('>');
|
5803 | return true;
|
5804 | }
|
5805 | endElement(current) {
|
5806 | const tagName = current.nodeName.toLowerCase();
|
5807 | if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
|
5808 | this.buf.push('</');
|
5809 | this.buf.push(tagName);
|
5810 | this.buf.push('>');
|
5811 | }
|
5812 | }
|
5813 | chars(chars) {
|
5814 | this.buf.push(encodeEntities(chars));
|
5815 | }
|
5816 | checkClobberedElement(node, nextNode) {
|
5817 | if (nextNode &&
|
5818 | (node.compareDocumentPosition(nextNode) &
|
5819 | Node.DOCUMENT_POSITION_CONTAINED_BY) === Node.DOCUMENT_POSITION_CONTAINED_BY) {
|
5820 | throw new Error(`Failed to sanitize html because the element is clobbered: ${node.outerHTML}`);
|
5821 | }
|
5822 | return nextNode;
|
5823 | }
|
5824 | }
|
5825 |
|
5826 | const SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
5827 |
|
5828 | const NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
|
5829 |
|
5830 |
|
5831 |
|
5832 |
|
5833 |
|
5834 |
|
5835 | function encodeEntities(value) {
|
5836 | return value.replace(/&/g, '&')
|
5837 | .replace(SURROGATE_PAIR_REGEXP, function (match) {
|
5838 | const hi = match.charCodeAt(0);
|
5839 | const low = match.charCodeAt(1);
|
5840 | return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
5841 | })
|
5842 | .replace(NON_ALPHANUMERIC_REGEXP, function (match) {
|
5843 | return '&#' + match.charCodeAt(0) + ';';
|
5844 | })
|
5845 | .replace(/</g, '<')
|
5846 | .replace(/>/g, '>');
|
5847 | }
|
5848 | let inertBodyHelper;
|
5849 |
|
5850 |
|
5851 |
|
5852 |
|
5853 | function _sanitizeHtml(defaultDoc, unsafeHtmlInput) {
|
5854 | let inertBodyElement = null;
|
5855 | try {
|
5856 | inertBodyHelper = inertBodyHelper || getInertBodyHelper(defaultDoc);
|
5857 |
|
5858 | let unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : '';
|
5859 | inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
|
5860 |
|
5861 |
|
5862 | let mXSSAttempts = 5;
|
5863 | let parsedHtml = unsafeHtml;
|
5864 | do {
|
5865 | if (mXSSAttempts === 0) {
|
5866 | throw new Error('Failed to sanitize html because the input is unstable');
|
5867 | }
|
5868 | mXSSAttempts--;
|
5869 | unsafeHtml = parsedHtml;
|
5870 | parsedHtml = inertBodyElement.innerHTML;
|
5871 | inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
|
5872 | } while (unsafeHtml !== parsedHtml);
|
5873 | const sanitizer = new SanitizingHtmlSerializer();
|
5874 | const safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement);
|
5875 | if ((typeof ngDevMode === 'undefined' || ngDevMode) && sanitizer.sanitizedSomething) {
|
5876 | console.warn('WARNING: sanitizing HTML stripped some content, see https://g.co/ng/security#xss');
|
5877 | }
|
5878 | return trustedHTMLFromString(safeHtml);
|
5879 | }
|
5880 | finally {
|
5881 |
|
5882 | if (inertBodyElement) {
|
5883 | const parent = getTemplateContent(inertBodyElement) || inertBodyElement;
|
5884 | while (parent.firstChild) {
|
5885 | parent.removeChild(parent.firstChild);
|
5886 | }
|
5887 | }
|
5888 | }
|
5889 | }
|
5890 | function getTemplateContent(el) {
|
5891 | return 'content' in el && isTemplateElement(el) ?
|
5892 | el.content :
|
5893 | null;
|
5894 | }
|
5895 | function isTemplateElement(el) {
|
5896 | return el.nodeType === Node.ELEMENT_NODE && el.nodeName === 'TEMPLATE';
|
5897 | }
|
5898 |
|
5899 |
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 |
|
5905 |
|
5906 |
|
5907 |
|
5908 |
|
5909 |
|
5910 |
|
5911 |
|
5912 |
|
5913 |
|
5914 |
|
5915 | var SecurityContext;
|
5916 | (function (SecurityContext) {
|
5917 | SecurityContext[SecurityContext["NONE"] = 0] = "NONE";
|
5918 | SecurityContext[SecurityContext["HTML"] = 1] = "HTML";
|
5919 | SecurityContext[SecurityContext["STYLE"] = 2] = "STYLE";
|
5920 | SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
|
5921 | SecurityContext[SecurityContext["URL"] = 4] = "URL";
|
5922 | SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
|
5923 | })(SecurityContext || (SecurityContext = {}));
|
5924 |
|
5925 |
|
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 |
|
5931 |
|
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 |
|
5938 |
|
5939 |
|
5940 |
|
5941 |
|
5942 |
|
5943 |
|
5944 |
|
5945 |
|
5946 |
|
5947 | function ɵɵsanitizeHtml(unsafeHtml) {
|
5948 | const sanitizer = getSanitizer();
|
5949 | if (sanitizer) {
|
5950 | return trustedHTMLFromStringBypass(sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || '');
|
5951 | }
|
5952 | if (allowSanitizationBypassAndThrow(unsafeHtml, "HTML" )) {
|
5953 | return trustedHTMLFromStringBypass(unwrapSafeValue(unsafeHtml));
|
5954 | }
|
5955 | return _sanitizeHtml(getDocument(), renderStringify(unsafeHtml));
|
5956 | }
|
5957 |
|
5958 |
|
5959 |
|
5960 |
|
5961 |
|
5962 |
|
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 |
|
5968 | function ɵɵsanitizeStyle(unsafeStyle) {
|
5969 | const sanitizer = getSanitizer();
|
5970 | if (sanitizer) {
|
5971 | return sanitizer.sanitize(SecurityContext.STYLE, unsafeStyle) || '';
|
5972 | }
|
5973 | if (allowSanitizationBypassAndThrow(unsafeStyle, "Style" )) {
|
5974 | return unwrapSafeValue(unsafeStyle);
|
5975 | }
|
5976 | return renderStringify(unsafeStyle);
|
5977 | }
|
5978 |
|
5979 |
|
5980 |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 |
|
5986 |
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 | function ɵɵsanitizeUrl(unsafeUrl) {
|
5995 | const sanitizer = getSanitizer();
|
5996 | if (sanitizer) {
|
5997 | return sanitizer.sanitize(SecurityContext.URL, unsafeUrl) || '';
|
5998 | }
|
5999 | if (allowSanitizationBypassAndThrow(unsafeUrl, "URL" )) {
|
6000 | return unwrapSafeValue(unsafeUrl);
|
6001 | }
|
6002 | return _sanitizeUrl(renderStringify(unsafeUrl));
|
6003 | }
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 |
|
6015 | function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
|
6016 | const sanitizer = getSanitizer();
|
6017 | if (sanitizer) {
|
6018 | return trustedScriptURLFromStringBypass(sanitizer.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || '');
|
6019 | }
|
6020 | if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" )) {
|
6021 | return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
|
6022 | }
|
6023 | throw new Error('unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
|
6024 | }
|
6025 |
|
6026 |
|
6027 |
|
6028 |
|
6029 |
|
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 | function ɵɵsanitizeScript(unsafeScript) {
|
6038 | const sanitizer = getSanitizer();
|
6039 | if (sanitizer) {
|
6040 | return trustedScriptFromStringBypass(sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || '');
|
6041 | }
|
6042 | if (allowSanitizationBypassAndThrow(unsafeScript, "Script" )) {
|
6043 | return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
|
6044 | }
|
6045 | throw new Error('unsafe value used in a script context');
|
6046 | }
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 |
|
6052 |
|
6053 |
|
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 |
|
6059 |
|
6060 | function ɵɵtrustConstantHtml(html) {
|
6061 |
|
6062 |
|
6063 |
|
6064 |
|
6065 |
|
6066 |
|
6067 | if (ngDevMode && (!Array.isArray(html) || !Array.isArray(html.raw) || html.length !== 1)) {
|
6068 | throw new Error(`Unexpected interpolation in trusted HTML constant: ${html.join('?')}`);
|
6069 | }
|
6070 | return trustedHTMLFromString(html[0]);
|
6071 | }
|
6072 |
|
6073 |
|
6074 |
|
6075 |
|
6076 |
|
6077 |
|
6078 |
|
6079 |
|
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 |
|
6085 | function ɵɵtrustConstantResourceUrl(url) {
|
6086 |
|
6087 |
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 | if (ngDevMode && (!Array.isArray(url) || !Array.isArray(url.raw) || url.length !== 1)) {
|
6093 | throw new Error(`Unexpected interpolation in trusted URL constant: ${url.join('?')}`);
|
6094 | }
|
6095 | return trustedScriptURLFromString(url[0]);
|
6096 | }
|
6097 |
|
6098 |
|
6099 |
|
6100 |
|
6101 |
|
6102 |
|
6103 |
|
6104 | function getUrlSanitizer(tag, prop) {
|
6105 | if ((prop === 'src' &&
|
6106 | (tag === 'embed' || tag === 'frame' || tag === 'iframe' || tag === 'media' ||
|
6107 | tag === 'script')) ||
|
6108 | (prop === 'href' && (tag === 'base' || tag === 'link'))) {
|
6109 | return ɵɵsanitizeResourceUrl;
|
6110 | }
|
6111 | return ɵɵsanitizeUrl;
|
6112 | }
|
6113 |
|
6114 |
|
6115 |
|
6116 |
|
6117 |
|
6118 |
|
6119 |
|
6120 |
|
6121 |
|
6122 |
|
6123 |
|
6124 |
|
6125 |
|
6126 |
|
6127 |
|
6128 | function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) {
|
6129 | return getUrlSanitizer(tag, prop)(unsafeUrl);
|
6130 | }
|
6131 | function validateAgainstEventProperties(name) {
|
6132 | if (name.toLowerCase().startsWith('on')) {
|
6133 | const msg = `Binding to event property '${name}' is disallowed for security reasons, ` +
|
6134 | `please use (${name.slice(2)})=...` +
|
6135 | `\nIf '${name}' is a directive input, make sure the directive is imported by the` +
|
6136 | ` current module.`;
|
6137 | throw new Error(msg);
|
6138 | }
|
6139 | }
|
6140 | function validateAgainstEventAttributes(name) {
|
6141 | if (name.toLowerCase().startsWith('on')) {
|
6142 | const msg = `Binding to event attribute '${name}' is disallowed for security reasons, ` +
|
6143 | `please use (${name.slice(2)})=...`;
|
6144 | throw new Error(msg);
|
6145 | }
|
6146 | }
|
6147 | function getSanitizer() {
|
6148 | const lView = getLView();
|
6149 | return lView && lView[SANITIZER];
|
6150 | }
|
6151 |
|
6152 |
|
6153 |
|
6154 |
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 |
|
6163 |
|
6164 |
|
6165 |
|
6166 |
|
6167 |
|
6168 |
|
6169 |
|
6170 |
|
6171 |
|
6172 |
|
6173 |
|
6174 |
|
6175 |
|
6176 |
|
6177 |
|
6178 |
|
6179 | function getLContext(target) {
|
6180 | let mpValue = readPatchedData(target);
|
6181 | if (mpValue) {
|
6182 |
|
6183 |
|
6184 | if (Array.isArray(mpValue)) {
|
6185 | const lView = mpValue;
|
6186 | let nodeIndex;
|
6187 | let component = undefined;
|
6188 | let directives = undefined;
|
6189 | if (isComponentInstance(target)) {
|
6190 | nodeIndex = findViaComponent(lView, target);
|
6191 | if (nodeIndex == -1) {
|
6192 | throw new Error('The provided component was not found in the application');
|
6193 | }
|
6194 | component = target;
|
6195 | }
|
6196 | else if (isDirectiveInstance(target)) {
|
6197 | nodeIndex = findViaDirective(lView, target);
|
6198 | if (nodeIndex == -1) {
|
6199 | throw new Error('The provided directive was not found in the application');
|
6200 | }
|
6201 | directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
|
6202 | }
|
6203 | else {
|
6204 | nodeIndex = findViaNativeElement(lView, target);
|
6205 | if (nodeIndex == -1) {
|
6206 | return null;
|
6207 | }
|
6208 | }
|
6209 |
|
6210 |
|
6211 |
|
6212 |
|
6213 | const native = unwrapRNode(lView[nodeIndex]);
|
6214 | const existingCtx = readPatchedData(native);
|
6215 | const context = (existingCtx && !Array.isArray(existingCtx)) ?
|
6216 | existingCtx :
|
6217 | createLContext(lView, nodeIndex, native);
|
6218 |
|
6219 | if (component && context.component === undefined) {
|
6220 | context.component = component;
|
6221 | attachPatchData(context.component, context);
|
6222 | }
|
6223 |
|
6224 | if (directives && context.directives === undefined) {
|
6225 | context.directives = directives;
|
6226 | for (let i = 0; i < directives.length; i++) {
|
6227 | attachPatchData(directives[i], context);
|
6228 | }
|
6229 | }
|
6230 | attachPatchData(context.native, context);
|
6231 | mpValue = context;
|
6232 | }
|
6233 | }
|
6234 | else {
|
6235 | const rElement = target;
|
6236 | ngDevMode && assertDomNode(rElement);
|
6237 |
|
6238 |
|
6239 | let parent = rElement;
|
6240 | while (parent = parent.parentNode) {
|
6241 | const parentContext = readPatchedData(parent);
|
6242 | if (parentContext) {
|
6243 | let lView;
|
6244 | if (Array.isArray(parentContext)) {
|
6245 | lView = parentContext;
|
6246 | }
|
6247 | else {
|
6248 | lView = parentContext.lView;
|
6249 | }
|
6250 |
|
6251 |
|
6252 | if (!lView) {
|
6253 | return null;
|
6254 | }
|
6255 | const index = findViaNativeElement(lView, rElement);
|
6256 | if (index >= 0) {
|
6257 | const native = unwrapRNode(lView[index]);
|
6258 | const context = createLContext(lView, index, native);
|
6259 | attachPatchData(native, context);
|
6260 | mpValue = context;
|
6261 | break;
|
6262 | }
|
6263 | }
|
6264 | }
|
6265 | }
|
6266 | return mpValue || null;
|
6267 | }
|
6268 |
|
6269 |
|
6270 |
|
6271 | function createLContext(lView, nodeIndex, native) {
|
6272 | return {
|
6273 | lView,
|
6274 | nodeIndex,
|
6275 | native,
|
6276 | component: undefined,
|
6277 | directives: undefined,
|
6278 | localRefs: undefined,
|
6279 | };
|
6280 | }
|
6281 |
|
6282 |
|
6283 |
|
6284 |
|
6285 |
|
6286 |
|
6287 | function getComponentViewByInstance(componentInstance) {
|
6288 | let lView = readPatchedData(componentInstance);
|
6289 | let view;
|
6290 | if (Array.isArray(lView)) {
|
6291 | const nodeIndex = findViaComponent(lView, componentInstance);
|
6292 | view = getComponentLViewByIndex(nodeIndex, lView);
|
6293 | const context = createLContext(lView, nodeIndex, view[HOST]);
|
6294 | context.component = componentInstance;
|
6295 | attachPatchData(componentInstance, context);
|
6296 | attachPatchData(context.native, context);
|
6297 | }
|
6298 | else {
|
6299 | const context = lView;
|
6300 | view = getComponentLViewByIndex(context.nodeIndex, context.lView);
|
6301 | }
|
6302 | return view;
|
6303 | }
|
6304 |
|
6305 |
|
6306 |
|
6307 | const MONKEY_PATCH_KEY_NAME = '__ngContext__';
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 | function attachPatchData(target, data) {
|
6313 | ngDevMode && assertDefined(target, 'Target expected');
|
6314 | target[MONKEY_PATCH_KEY_NAME] = data;
|
6315 | }
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 | function readPatchedData(target) {
|
6321 | ngDevMode && assertDefined(target, 'Target expected');
|
6322 | return target[MONKEY_PATCH_KEY_NAME] || null;
|
6323 | }
|
6324 | function readPatchedLView(target) {
|
6325 | const value = readPatchedData(target);
|
6326 | if (value) {
|
6327 | return Array.isArray(value) ? value : value.lView;
|
6328 | }
|
6329 | return null;
|
6330 | }
|
6331 | function isComponentInstance(instance) {
|
6332 | return instance && instance.constructor && instance.constructor.ɵcmp;
|
6333 | }
|
6334 | function isDirectiveInstance(instance) {
|
6335 | return instance && instance.constructor && instance.constructor.ɵdir;
|
6336 | }
|
6337 |
|
6338 |
|
6339 |
|
6340 | function findViaNativeElement(lView, target) {
|
6341 | const tView = lView[TVIEW];
|
6342 | for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
|
6343 | if (unwrapRNode(lView[i]) === target) {
|
6344 | return i;
|
6345 | }
|
6346 | }
|
6347 | return -1;
|
6348 | }
|
6349 |
|
6350 |
|
6351 |
|
6352 | function traverseNextElement(tNode) {
|
6353 | if (tNode.child) {
|
6354 | return tNode.child;
|
6355 | }
|
6356 | else if (tNode.next) {
|
6357 | return tNode.next;
|
6358 | }
|
6359 | else {
|
6360 |
|
6361 |
|
6362 |
|
6363 | while (tNode.parent && !tNode.parent.next) {
|
6364 | tNode = tNode.parent;
|
6365 | }
|
6366 | return tNode.parent && tNode.parent.next;
|
6367 | }
|
6368 | }
|
6369 |
|
6370 |
|
6371 |
|
6372 | function findViaComponent(lView, componentInstance) {
|
6373 | const componentIndices = lView[TVIEW].components;
|
6374 | if (componentIndices) {
|
6375 | for (let i = 0; i < componentIndices.length; i++) {
|
6376 | const elementComponentIndex = componentIndices[i];
|
6377 | const componentView = getComponentLViewByIndex(elementComponentIndex, lView);
|
6378 | if (componentView[CONTEXT] === componentInstance) {
|
6379 | return elementComponentIndex;
|
6380 | }
|
6381 | }
|
6382 | }
|
6383 | else {
|
6384 | const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);
|
6385 | const rootComponent = rootComponentView[CONTEXT];
|
6386 | if (rootComponent === componentInstance) {
|
6387 |
|
6388 |
|
6389 | return HEADER_OFFSET;
|
6390 | }
|
6391 | }
|
6392 | return -1;
|
6393 | }
|
6394 |
|
6395 |
|
6396 |
|
6397 | function findViaDirective(lView, directiveInstance) {
|
6398 |
|
6399 |
|
6400 |
|
6401 |
|
6402 |
|
6403 | let tNode = lView[TVIEW].firstChild;
|
6404 | while (tNode) {
|
6405 | const directiveIndexStart = tNode.directiveStart;
|
6406 | const directiveIndexEnd = tNode.directiveEnd;
|
6407 | for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {
|
6408 | if (lView[i] === directiveInstance) {
|
6409 | return tNode.index;
|
6410 | }
|
6411 | }
|
6412 | tNode = traverseNextElement(tNode);
|
6413 | }
|
6414 | return -1;
|
6415 | }
|
6416 |
|
6417 |
|
6418 |
|
6419 |
|
6420 |
|
6421 |
|
6422 |
|
6423 |
|
6424 | function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
|
6425 | const tNode = lView[TVIEW].data[nodeIndex];
|
6426 | let directiveStartIndex = tNode.directiveStart;
|
6427 | if (directiveStartIndex == 0)
|
6428 | return EMPTY_ARRAY;
|
6429 | const directiveEndIndex = tNode.directiveEnd;
|
6430 | if (!includeComponents && tNode.flags & 2 )
|
6431 | directiveStartIndex++;
|
6432 | return lView.slice(directiveStartIndex, directiveEndIndex);
|
6433 | }
|
6434 | function getComponentAtNodeIndex(nodeIndex, lView) {
|
6435 | const tNode = lView[TVIEW].data[nodeIndex];
|
6436 | let directiveStartIndex = tNode.directiveStart;
|
6437 | return tNode.flags & 2 ? lView[directiveStartIndex] : null;
|
6438 | }
|
6439 |
|
6440 |
|
6441 |
|
6442 |
|
6443 | function discoverLocalRefs(lView, nodeIndex) {
|
6444 | const tNode = lView[TVIEW].data[nodeIndex];
|
6445 | if (tNode && tNode.localNames) {
|
6446 | const result = {};
|
6447 | let localIndex = tNode.index + 1;
|
6448 | for (let i = 0; i < tNode.localNames.length; i += 2) {
|
6449 | result[tNode.localNames[i]] = lView[localIndex];
|
6450 | localIndex++;
|
6451 | }
|
6452 | return result;
|
6453 | }
|
6454 | return null;
|
6455 | }
|
6456 |
|
6457 |
|
6458 |
|
6459 |
|
6460 |
|
6461 |
|
6462 |
|
6463 |
|
6464 | const ERROR_TYPE = 'ngType';
|
6465 | const ERROR_DEBUG_CONTEXT = 'ngDebugContext';
|
6466 | const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
6467 | const ERROR_LOGGER = 'ngErrorLogger';
|
6468 | function wrappedError(message, originalError) {
|
6469 | const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
|
6470 | const error = Error(msg);
|
6471 | error[ERROR_ORIGINAL_ERROR] = originalError;
|
6472 | return error;
|
6473 | }
|
6474 |
|
6475 |
|
6476 |
|
6477 |
|
6478 |
|
6479 |
|
6480 |
|
6481 |
|
6482 | function getType(error) {
|
6483 | return error[ERROR_TYPE];
|
6484 | }
|
6485 | function getDebugContext(error) {
|
6486 | return error[ERROR_DEBUG_CONTEXT];
|
6487 | }
|
6488 | function getOriginalError(error) {
|
6489 | return error[ERROR_ORIGINAL_ERROR];
|
6490 | }
|
6491 | function getErrorLogger(error) {
|
6492 | return error && error[ERROR_LOGGER] || defaultErrorLogger;
|
6493 | }
|
6494 | function defaultErrorLogger(console, ...values) {
|
6495 | console.error(...values);
|
6496 | }
|
6497 |
|
6498 |
|
6499 |
|
6500 |
|
6501 |
|
6502 |
|
6503 |
|
6504 |
|
6505 |
|
6506 |
|
6507 |
|
6508 |
|
6509 |
|
6510 |
|
6511 |
|
6512 |
|
6513 |
|
6514 |
|
6515 |
|
6516 |
|
6517 |
|
6518 |
|
6519 |
|
6520 |
|
6521 |
|
6522 |
|
6523 |
|
6524 |
|
6525 |
|
6526 |
|
6527 |
|
6528 |
|
6529 |
|
6530 | class ErrorHandler {
|
6531 | constructor() {
|
6532 | |
6533 |
|
6534 |
|
6535 | this._console = console;
|
6536 | }
|
6537 | handleError(error) {
|
6538 | const originalError = this._findOriginalError(error);
|
6539 | const context = this._findContext(error);
|
6540 |
|
6541 |
|
6542 | const errorLogger = getErrorLogger(error);
|
6543 | errorLogger(this._console, `ERROR`, error);
|
6544 | if (originalError) {
|
6545 | errorLogger(this._console, `ORIGINAL ERROR`, originalError);
|
6546 | }
|
6547 | if (context) {
|
6548 | errorLogger(this._console, 'ERROR CONTEXT', context);
|
6549 | }
|
6550 | }
|
6551 |
|
6552 | _findContext(error) {
|
6553 | return error ? (getDebugContext(error) || this._findContext(getOriginalError(error))) : null;
|
6554 | }
|
6555 |
|
6556 | _findOriginalError(error) {
|
6557 | let e = error && getOriginalError(error);
|
6558 | while (e && getOriginalError(e)) {
|
6559 | e = getOriginalError(e);
|
6560 | }
|
6561 | return e || null;
|
6562 | }
|
6563 | }
|
6564 |
|
6565 |
|
6566 |
|
6567 |
|
6568 |
|
6569 |
|
6570 |
|
6571 |
|
6572 |
|
6573 |
|
6574 |
|
6575 |
|
6576 |
|
6577 |
|
6578 |
|
6579 |
|
6580 | const CUSTOM_ELEMENTS_SCHEMA = {
|
6581 | name: 'custom-elements'
|
6582 | };
|
6583 |
|
6584 |
|
6585 |
|
6586 |
|
6587 |
|
6588 |
|
6589 |
|
6590 |
|
6591 |
|
6592 | const NO_ERRORS_SCHEMA = {
|
6593 | name: 'no-errors-schema'
|
6594 | };
|
6595 |
|
6596 |
|
6597 |
|
6598 |
|
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 |
|
6604 |
|
6605 |
|
6606 |
|
6607 |
|
6608 | const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
|
6609 |
|
6610 |
|
6611 |
|
6612 | const COMMENT_DELIMITER = /(<|>)/;
|
6613 | const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
|
6614 |
|
6615 |
|
6616 |
|
6617 |
|
6618 |
|
6619 |
|
6620 |
|
6621 |
|
6622 |
|
6623 |
|
6624 |
|
6625 |
|
6626 |
|
6627 |
|
6628 |
|
6629 |
|
6630 |
|
6631 |
|
6632 |
|
6633 |
|
6634 |
|
6635 |
|
6636 |
|
6637 |
|
6638 |
|
6639 |
|
6640 |
|
6641 | function escapeCommentText(value) {
|
6642 | return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
|
6643 | }
|
6644 |
|
6645 |
|
6646 |
|
6647 |
|
6648 |
|
6649 |
|
6650 |
|
6651 |
|
6652 | function normalizeDebugBindingName(name) {
|
6653 |
|
6654 | name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
6655 | return `ng-reflect-${name}`;
|
6656 | }
|
6657 | const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
6658 | function camelCaseToDashCase(input) {
|
6659 | return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
6660 | }
|
6661 | function normalizeDebugBindingValue(value) {
|
6662 | try {
|
6663 |
|
6664 | return value != null ? value.toString().slice(0, 30) : value;
|
6665 | }
|
6666 | catch (e) {
|
6667 | return '[ERROR] Exception while trying to serialize the value';
|
6668 | }
|
6669 | }
|
6670 |
|
6671 |
|
6672 |
|
6673 |
|
6674 |
|
6675 |
|
6676 |
|
6677 |
|
6678 | const defaultScheduler = (() => (typeof requestAnimationFrame !== 'undefined' &&
|
6679 | requestAnimationFrame ||
|
6680 | setTimeout
|
6681 | )
|
6682 | .bind(_global))();
|
6683 |
|
6684 |
|
6685 |
|
6686 |
|
6687 | function ɵɵresolveWindow(element) {
|
6688 | return element.ownerDocument.defaultView;
|
6689 | }
|
6690 |
|
6691 |
|
6692 |
|
6693 |
|
6694 | function ɵɵresolveDocument(element) {
|
6695 | return element.ownerDocument;
|
6696 | }
|
6697 |
|
6698 |
|
6699 |
|
6700 |
|
6701 | function ɵɵresolveBody(element) {
|
6702 | return element.ownerDocument.body;
|
6703 | }
|
6704 |
|
6705 |
|
6706 |
|
6707 |
|
6708 |
|
6709 |
|
6710 |
|
6711 |
|
6712 |
|
6713 |
|
6714 |
|
6715 |
|
6716 |
|
6717 |
|
6718 | const INTERPOLATION_DELIMITER = `�`;
|
6719 |
|
6720 |
|
6721 |
|
6722 | function maybeUnwrapFn(value) {
|
6723 | if (value instanceof Function) {
|
6724 | return value();
|
6725 | }
|
6726 | else {
|
6727 | return value;
|
6728 | }
|
6729 | }
|
6730 |
|
6731 |
|
6732 |
|
6733 |
|
6734 |
|
6735 |
|
6736 |
|
6737 |
|
6738 |
|
6739 | function throwMultipleComponentError(tNode) {
|
6740 | throw new RuntimeError("300" , `Multiple components match node with tagname ${tNode.value}`);
|
6741 | }
|
6742 |
|
6743 | function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName) {
|
6744 | const field = propName ? ` for '${propName}'` : '';
|
6745 | let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value${field}: '${oldValue}'. Current value: '${currValue}'.`;
|
6746 | if (creationMode) {
|
6747 | msg +=
|
6748 | ` It seems like the view has been created after its parent and its children have been dirty checked.` +
|
6749 | ` Has it been created in a change detection hook?`;
|
6750 | }
|
6751 |
|
6752 |
|
6753 | throw new RuntimeError("100" , msg);
|
6754 | }
|
6755 | function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) {
|
6756 | const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER);
|
6757 | let oldValue = prefix, newValue = prefix;
|
6758 | for (let i = 0; i < chunks.length; i++) {
|
6759 | const slotIdx = rootIndex + i;
|
6760 | oldValue += `${lView[slotIdx]}${chunks[i]}`;
|
6761 | newValue += `${slotIdx === expressionIndex ? changedValue : lView[slotIdx]}${chunks[i]}`;
|
6762 | }
|
6763 | return { propName, oldValue, newValue };
|
6764 | }
|
6765 |
|
6766 |
|
6767 |
|
6768 |
|
6769 |
|
6770 |
|
6771 |
|
6772 |
|
6773 | function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValue) {
|
6774 | const tData = lView[TVIEW].data;
|
6775 | const metadata = tData[bindingIndex];
|
6776 | if (typeof metadata === 'string') {
|
6777 |
|
6778 | if (metadata.indexOf(INTERPOLATION_DELIMITER) > -1) {
|
6779 | return constructDetailsForInterpolation(lView, bindingIndex, bindingIndex, metadata, newValue);
|
6780 | }
|
6781 |
|
6782 | return { propName: metadata, oldValue, newValue };
|
6783 | }
|
6784 |
|
6785 |
|
6786 |
|
6787 |
|
6788 | if (metadata === null) {
|
6789 | let idx = bindingIndex - 1;
|
6790 | while (typeof tData[idx] !== 'string' && tData[idx + 1] === null) {
|
6791 | idx--;
|
6792 | }
|
6793 | const meta = tData[idx];
|
6794 | if (typeof meta === 'string') {
|
6795 | const matches = meta.match(new RegExp(INTERPOLATION_DELIMITER, 'g'));
|
6796 |
|
6797 |
|
6798 | if (matches && (matches.length - 1) > bindingIndex - idx) {
|
6799 | return constructDetailsForInterpolation(lView, idx, bindingIndex, meta, newValue);
|
6800 | }
|
6801 | }
|
6802 | }
|
6803 | return { propName: undefined, oldValue, newValue };
|
6804 | }
|
6805 |
|
6806 |
|
6807 |
|
6808 |
|
6809 |
|
6810 |
|
6811 |
|
6812 |
|
6813 |
|
6814 |
|
6815 |
|
6816 |
|
6817 | var RendererStyleFlags2;
|
6818 | (function (RendererStyleFlags2) {
|
6819 |
|
6820 |
|
6821 |
|
6822 | |
6823 |
|
6824 |
|
6825 | RendererStyleFlags2[RendererStyleFlags2["Important"] = 1] = "Important";
|
6826 | |
6827 |
|
6828 |
|
6829 | RendererStyleFlags2[RendererStyleFlags2["DashCase"] = 2] = "DashCase";
|
6830 | })(RendererStyleFlags2 || (RendererStyleFlags2 = {}));
|
6831 |
|
6832 |
|
6833 |
|
6834 |
|
6835 |
|
6836 |
|
6837 |
|
6838 |
|
6839 | let _icuContainerIterate;
|
6840 |
|
6841 |
|
6842 |
|
6843 | function icuContainerIterate(tIcuContainerNode, lView) {
|
6844 | return _icuContainerIterate(tIcuContainerNode, lView);
|
6845 | }
|
6846 |
|
6847 |
|
6848 |
|
6849 |
|
6850 |
|
6851 |
|
6852 | function ensureIcuContainerVisitorLoaded(loader) {
|
6853 | if (_icuContainerIterate === undefined) {
|
6854 |
|
6855 |
|
6856 | _icuContainerIterate = loader();
|
6857 | }
|
6858 | }
|
6859 |
|
6860 |
|
6861 |
|
6862 |
|
6863 |
|
6864 |
|
6865 |
|
6866 |
|
6867 |
|
6868 |
|
6869 | const unusedValueExportToPlacateAjd$3 = 1;
|
6870 |
|
6871 |
|
6872 |
|
6873 |
|
6874 |
|
6875 |
|
6876 |
|
6877 |
|
6878 |
|
6879 |
|
6880 |
|
6881 |
|
6882 |
|
6883 | function getLViewParent(lView) {
|
6884 | ngDevMode && assertLView(lView);
|
6885 | const parent = lView[PARENT];
|
6886 | return isLContainer(parent) ? parent[PARENT] : parent;
|
6887 | }
|
6888 |
|
6889 |
|
6890 |
|
6891 |
|
6892 |
|
6893 |
|
6894 | function getRootView(componentOrLView) {
|
6895 | ngDevMode && assertDefined(componentOrLView, 'component');
|
6896 | let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);
|
6897 | while (lView && !(lView[FLAGS] & 512 )) {
|
6898 | lView = getLViewParent(lView);
|
6899 | }
|
6900 | ngDevMode && assertLView(lView);
|
6901 | return lView;
|
6902 | }
|
6903 |
|
6904 |
|
6905 |
|
6906 |
|
6907 |
|
6908 |
|
6909 |
|
6910 | function getRootContext(viewOrComponent) {
|
6911 | const rootView = getRootView(viewOrComponent);
|
6912 | ngDevMode &&
|
6913 | assertDefined(rootView[CONTEXT], 'RootView has no context. Perhaps it is disconnected?');
|
6914 | return rootView[CONTEXT];
|
6915 | }
|
6916 |
|
6917 |
|
6918 |
|
6919 | function getFirstLContainer(lView) {
|
6920 | return getNearestLContainer(lView[CHILD_HEAD]);
|
6921 | }
|
6922 |
|
6923 |
|
6924 |
|
6925 | function getNextLContainer(container) {
|
6926 | return getNearestLContainer(container[NEXT]);
|
6927 | }
|
6928 | function getNearestLContainer(viewOrContainer) {
|
6929 | while (viewOrContainer !== null && !isLContainer(viewOrContainer)) {
|
6930 | viewOrContainer = viewOrContainer[NEXT];
|
6931 | }
|
6932 | return viewOrContainer;
|
6933 | }
|
6934 |
|
6935 |
|
6936 |
|
6937 |
|
6938 |
|
6939 |
|
6940 |
|
6941 |
|
6942 | const unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$7 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd$6 + unusedValueExportToPlacateAjd$8;
|
6943 |
|
6944 |
|
6945 |
|
6946 |
|
6947 | function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, beforeNode) {
|
6948 |
|
6949 |
|
6950 |
|
6951 |
|
6952 | if (lNodeToHandle != null) {
|
6953 | let lContainer;
|
6954 | let isComponent = false;
|
6955 |
|
6956 |
|
6957 |
|
6958 | if (isLContainer(lNodeToHandle)) {
|
6959 | lContainer = lNodeToHandle;
|
6960 | }
|
6961 | else if (isLView(lNodeToHandle)) {
|
6962 | isComponent = true;
|
6963 | ngDevMode && assertDefined(lNodeToHandle[HOST], 'HOST must be defined for a component LView');
|
6964 | lNodeToHandle = lNodeToHandle[HOST];
|
6965 | }
|
6966 | const rNode = unwrapRNode(lNodeToHandle);
|
6967 | ngDevMode && !isProceduralRenderer(renderer) && assertDomNode(rNode);
|
6968 | if (action === 0 && parent !== null) {
|
6969 | if (beforeNode == null) {
|
6970 | nativeAppendChild(renderer, parent, rNode);
|
6971 | }
|
6972 | else {
|
6973 | nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true);
|
6974 | }
|
6975 | }
|
6976 | else if (action === 1 && parent !== null) {
|
6977 | nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true);
|
6978 | }
|
6979 | else if (action === 2 ) {
|
6980 | nativeRemoveNode(renderer, rNode, isComponent);
|
6981 | }
|
6982 | else if (action === 3 ) {
|
6983 | ngDevMode && ngDevMode.rendererDestroyNode++;
|
6984 | renderer.destroyNode(rNode);
|
6985 | }
|
6986 | if (lContainer != null) {
|
6987 | applyContainer(renderer, action, lContainer, parent, beforeNode);
|
6988 | }
|
6989 | }
|
6990 | }
|
6991 | function createTextNode(renderer, value) {
|
6992 | ngDevMode && ngDevMode.rendererCreateTextNode++;
|
6993 | ngDevMode && ngDevMode.rendererSetText++;
|
6994 | return isProceduralRenderer(renderer) ? renderer.createText(value) :
|
6995 | renderer.createTextNode(value);
|
6996 | }
|
6997 | function updateTextNode(renderer, rNode, value) {
|
6998 | ngDevMode && ngDevMode.rendererSetText++;
|
6999 | isProceduralRenderer(renderer) ? renderer.setValue(rNode, value) : rNode.textContent = value;
|
7000 | }
|
7001 | function createCommentNode(renderer, value) {
|
7002 | ngDevMode && ngDevMode.rendererCreateComment++;
|
7003 |
|
7004 |
|
7005 | return renderer.createComment(escapeCommentText(value));
|
7006 | }
|
7007 |
|
7008 |
|
7009 |
|
7010 |
|
7011 |
|
7012 |
|
7013 |
|
7014 | function createElementNode(renderer, name, namespace) {
|
7015 | ngDevMode && ngDevMode.rendererCreateElement++;
|
7016 | if (isProceduralRenderer(renderer)) {
|
7017 | return renderer.createElement(name, namespace);
|
7018 | }
|
7019 | else {
|
7020 | return namespace === null ? renderer.createElement(name) :
|
7021 | renderer.createElementNS(namespace, name);
|
7022 | }
|
7023 | }
|
7024 |
|
7025 |
|
7026 |
|
7027 |
|
7028 |
|
7029 |
|
7030 |
|
7031 |
|
7032 |
|
7033 |
|
7034 | function removeViewFromContainer(tView, lView) {
|
7035 | const renderer = lView[RENDERER];
|
7036 | applyView(tView, lView, renderer, 2 , null, null);
|
7037 | lView[HOST] = null;
|
7038 | lView[T_HOST] = null;
|
7039 | }
|
7040 |
|
7041 |
|
7042 |
|
7043 |
|
7044 |
|
7045 |
|
7046 |
|
7047 |
|
7048 |
|
7049 |
|
7050 |
|
7051 |
|
7052 |
|
7053 |
|
7054 | function addViewToContainer(tView, parentTNode, renderer, lView, parentNativeNode, beforeNode) {
|
7055 | lView[HOST] = parentNativeNode;
|
7056 | lView[T_HOST] = parentTNode;
|
7057 | applyView(tView, lView, renderer, 1 , parentNativeNode, beforeNode);
|
7058 | }
|
7059 |
|
7060 |
|
7061 |
|
7062 |
|
7063 |
|
7064 |
|
7065 | function renderDetachView$1(tView, lView) {
|
7066 | applyView(tView, lView, lView[RENDERER], 2 , null, null);
|
7067 | }
|
7068 |
|
7069 |
|
7070 |
|
7071 |
|
7072 |
|
7073 |
|
7074 |
|
7075 |
|
7076 |
|
7077 |
|
7078 |
|
7079 |
|
7080 |
|
7081 | function destroyViewTree(rootView) {
|
7082 |
|
7083 | let lViewOrLContainer = rootView[CHILD_HEAD];
|
7084 | if (!lViewOrLContainer) {
|
7085 | return cleanUpView(rootView[TVIEW], rootView);
|
7086 | }
|
7087 | while (lViewOrLContainer) {
|
7088 | let next = null;
|
7089 | if (isLView(lViewOrLContainer)) {
|
7090 |
|
7091 | next = lViewOrLContainer[CHILD_HEAD];
|
7092 | }
|
7093 | else {
|
7094 | ngDevMode && assertLContainer(lViewOrLContainer);
|
7095 |
|
7096 | const firstView = lViewOrLContainer[CONTAINER_HEADER_OFFSET];
|
7097 | if (firstView)
|
7098 | next = firstView;
|
7099 | }
|
7100 | if (!next) {
|
7101 |
|
7102 |
|
7103 | while (lViewOrLContainer && !lViewOrLContainer[NEXT] && lViewOrLContainer !== rootView) {
|
7104 | if (isLView(lViewOrLContainer)) {
|
7105 | cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
|
7106 | }
|
7107 | lViewOrLContainer = lViewOrLContainer[PARENT];
|
7108 | }
|
7109 | if (lViewOrLContainer === null)
|
7110 | lViewOrLContainer = rootView;
|
7111 | if (isLView(lViewOrLContainer)) {
|
7112 | cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
|
7113 | }
|
7114 | next = lViewOrLContainer && lViewOrLContainer[NEXT];
|
7115 | }
|
7116 | lViewOrLContainer = next;
|
7117 | }
|
7118 | }
|
7119 |
|
7120 |
|
7121 |
|
7122 |
|
7123 |
|
7124 |
|
7125 |
|
7126 |
|
7127 |
|
7128 |
|
7129 |
|
7130 |
|
7131 |
|
7132 | function insertView(tView, lView, lContainer, index) {
|
7133 | ngDevMode && assertLView(lView);
|
7134 | ngDevMode && assertLContainer(lContainer);
|
7135 | const indexInContainer = CONTAINER_HEADER_OFFSET + index;
|
7136 | const containerLength = lContainer.length;
|
7137 | if (index > 0) {
|
7138 |
|
7139 | lContainer[indexInContainer - 1][NEXT] = lView;
|
7140 | }
|
7141 | if (index < containerLength - CONTAINER_HEADER_OFFSET) {
|
7142 | lView[NEXT] = lContainer[indexInContainer];
|
7143 | addToArray(lContainer, CONTAINER_HEADER_OFFSET + index, lView);
|
7144 | }
|
7145 | else {
|
7146 | lContainer.push(lView);
|
7147 | lView[NEXT] = null;
|
7148 | }
|
7149 | lView[PARENT] = lContainer;
|
7150 |
|
7151 | const declarationLContainer = lView[DECLARATION_LCONTAINER];
|
7152 | if (declarationLContainer !== null && lContainer !== declarationLContainer) {
|
7153 | trackMovedView(declarationLContainer, lView);
|
7154 | }
|
7155 |
|
7156 | const lQueries = lView[QUERIES];
|
7157 | if (lQueries !== null) {
|
7158 | lQueries.insertView(tView);
|
7159 | }
|
7160 |
|
7161 | lView[FLAGS] |= 128 ;
|
7162 | }
|
7163 |
|
7164 |
|
7165 |
|
7166 |
|
7167 | function trackMovedView(declarationContainer, lView) {
|
7168 | ngDevMode && assertDefined(lView, 'LView required');
|
7169 | ngDevMode && assertLContainer(declarationContainer);
|
7170 | const movedViews = declarationContainer[MOVED_VIEWS];
|
7171 | const insertedLContainer = lView[PARENT];
|
7172 | ngDevMode && assertLContainer(insertedLContainer);
|
7173 | const insertedComponentLView = insertedLContainer[PARENT][DECLARATION_COMPONENT_VIEW];
|
7174 | ngDevMode && assertDefined(insertedComponentLView, 'Missing insertedComponentLView');
|
7175 | const declaredComponentLView = lView[DECLARATION_COMPONENT_VIEW];
|
7176 | ngDevMode && assertDefined(declaredComponentLView, 'Missing declaredComponentLView');
|
7177 | if (declaredComponentLView !== insertedComponentLView) {
|
7178 |
|
7179 |
|
7180 |
|
7181 | declarationContainer[HAS_TRANSPLANTED_VIEWS] = true;
|
7182 | }
|
7183 | if (movedViews === null) {
|
7184 | declarationContainer[MOVED_VIEWS] = [lView];
|
7185 | }
|
7186 | else {
|
7187 | movedViews.push(lView);
|
7188 | }
|
7189 | }
|
7190 | function detachMovedView(declarationContainer, lView) {
|
7191 | ngDevMode && assertLContainer(declarationContainer);
|
7192 | ngDevMode &&
|
7193 | assertDefined(declarationContainer[MOVED_VIEWS], 'A projected view should belong to a non-empty projected views collection');
|
7194 | const movedViews = declarationContainer[MOVED_VIEWS];
|
7195 | const declarationViewIndex = movedViews.indexOf(lView);
|
7196 | const insertionLContainer = lView[PARENT];
|
7197 | ngDevMode && assertLContainer(insertionLContainer);
|
7198 |
|
7199 |
|
7200 |
|
7201 | if (lView[FLAGS] & 1024 ) {
|
7202 | lView[FLAGS] &= ~1024 ;
|
7203 | updateTransplantedViewCount(insertionLContainer, -1);
|
7204 | }
|
7205 | movedViews.splice(declarationViewIndex, 1);
|
7206 | }
|
7207 |
|
7208 |
|
7209 |
|
7210 |
|
7211 |
|
7212 |
|
7213 |
|
7214 |
|
7215 |
|
7216 |
|
7217 | function detachView(lContainer, removeIndex) {
|
7218 | if (lContainer.length <= CONTAINER_HEADER_OFFSET)
|
7219 | return;
|
7220 | const indexInContainer = CONTAINER_HEADER_OFFSET + removeIndex;
|
7221 | const viewToDetach = lContainer[indexInContainer];
|
7222 | if (viewToDetach) {
|
7223 | const declarationLContainer = viewToDetach[DECLARATION_LCONTAINER];
|
7224 | if (declarationLContainer !== null && declarationLContainer !== lContainer) {
|
7225 | detachMovedView(declarationLContainer, viewToDetach);
|
7226 | }
|
7227 | if (removeIndex > 0) {
|
7228 | lContainer[indexInContainer - 1][NEXT] = viewToDetach[NEXT];
|
7229 | }
|
7230 | const removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex);
|
7231 | removeViewFromContainer(viewToDetach[TVIEW], viewToDetach);
|
7232 |
|
7233 | const lQueries = removedLView[QUERIES];
|
7234 | if (lQueries !== null) {
|
7235 | lQueries.detachView(removedLView[TVIEW]);
|
7236 | }
|
7237 | viewToDetach[PARENT] = null;
|
7238 | viewToDetach[NEXT] = null;
|
7239 |
|
7240 | viewToDetach[FLAGS] &= ~128 ;
|
7241 | }
|
7242 | return viewToDetach;
|
7243 | }
|
7244 |
|
7245 |
|
7246 |
|
7247 |
|
7248 |
|
7249 |
|
7250 |
|
7251 | function destroyLView(tView, lView) {
|
7252 | if (!(lView[FLAGS] & 256 )) {
|
7253 | const renderer = lView[RENDERER];
|
7254 | if (isProceduralRenderer(renderer) && renderer.destroyNode) {
|
7255 | applyView(tView, lView, renderer, 3 , null, null);
|
7256 | }
|
7257 | destroyViewTree(lView);
|
7258 | }
|
7259 | }
|
7260 |
|
7261 |
|
7262 |
|
7263 |
|
7264 |
|
7265 |
|
7266 |
|
7267 |
|
7268 | function cleanUpView(tView, lView) {
|
7269 | if (!(lView[FLAGS] & 256 )) {
|
7270 |
|
7271 |
|
7272 | lView[FLAGS] &= ~128 ;
|
7273 |
|
7274 |
|
7275 |
|
7276 |
|
7277 |
|
7278 | lView[FLAGS] |= 256 ;
|
7279 | executeOnDestroys(tView, lView);
|
7280 | processCleanups(tView, lView);
|
7281 |
|
7282 | if (lView[TVIEW].type === 1 && isProceduralRenderer(lView[RENDERER])) {
|
7283 | ngDevMode && ngDevMode.rendererDestroy++;
|
7284 | lView[RENDERER].destroy();
|
7285 | }
|
7286 | const declarationContainer = lView[DECLARATION_LCONTAINER];
|
7287 |
|
7288 | if (declarationContainer !== null && isLContainer(lView[PARENT])) {
|
7289 |
|
7290 | if (declarationContainer !== lView[PARENT]) {
|
7291 | detachMovedView(declarationContainer, lView);
|
7292 | }
|
7293 |
|
7294 | const lQueries = lView[QUERIES];
|
7295 | if (lQueries !== null) {
|
7296 | lQueries.detachView(tView);
|
7297 | }
|
7298 | }
|
7299 | }
|
7300 | }
|
7301 |
|
7302 | function processCleanups(tView, lView) {
|
7303 | const tCleanup = tView.cleanup;
|
7304 | const lCleanup = lView[CLEANUP];
|
7305 |
|
7306 |
|
7307 |
|
7308 | let lastLCleanupIndex = -1;
|
7309 | if (tCleanup !== null) {
|
7310 | for (let i = 0; i < tCleanup.length - 1; i += 2) {
|
7311 | if (typeof tCleanup[i] === 'string') {
|
7312 |
|
7313 | const idxOrTargetGetter = tCleanup[i + 1];
|
7314 | const target = typeof idxOrTargetGetter === 'function' ?
|
7315 | idxOrTargetGetter(lView) :
|
7316 | unwrapRNode(lView[idxOrTargetGetter]);
|
7317 | const listener = lCleanup[lastLCleanupIndex = tCleanup[i + 2]];
|
7318 | const useCaptureOrSubIdx = tCleanup[i + 3];
|
7319 | if (typeof useCaptureOrSubIdx === 'boolean') {
|
7320 |
|
7321 | target.removeEventListener(tCleanup[i], listener, useCaptureOrSubIdx);
|
7322 | }
|
7323 | else {
|
7324 | if (useCaptureOrSubIdx >= 0) {
|
7325 |
|
7326 | lCleanup[lastLCleanupIndex = useCaptureOrSubIdx]();
|
7327 | }
|
7328 | else {
|
7329 |
|
7330 | lCleanup[lastLCleanupIndex = -useCaptureOrSubIdx].unsubscribe();
|
7331 | }
|
7332 | }
|
7333 | i += 2;
|
7334 | }
|
7335 | else {
|
7336 |
|
7337 | const context = lCleanup[lastLCleanupIndex = tCleanup[i + 1]];
|
7338 | tCleanup[i].call(context);
|
7339 | }
|
7340 | }
|
7341 | }
|
7342 | if (lCleanup !== null) {
|
7343 | for (let i = lastLCleanupIndex + 1; i < lCleanup.length; i++) {
|
7344 | const instanceCleanupFn = lCleanup[i];
|
7345 | ngDevMode && assertFunction(instanceCleanupFn, 'Expecting instance cleanup function.');
|
7346 | instanceCleanupFn();
|
7347 | }
|
7348 | lView[CLEANUP] = null;
|
7349 | }
|
7350 | }
|
7351 |
|
7352 | function executeOnDestroys(tView, lView) {
|
7353 | let destroyHooks;
|
7354 | if (tView != null && (destroyHooks = tView.destroyHooks) != null) {
|
7355 | for (let i = 0; i < destroyHooks.length; i += 2) {
|
7356 | const context = lView[destroyHooks[i]];
|
7357 |
|
7358 | if (!(context instanceof NodeInjectorFactory)) {
|
7359 | const toCall = destroyHooks[i + 1];
|
7360 | if (Array.isArray(toCall)) {
|
7361 | for (let j = 0; j < toCall.length; j += 2) {
|
7362 | const callContext = context[toCall[j]];
|
7363 | const hook = toCall[j + 1];
|
7364 | profiler(4 , callContext, hook);
|
7365 | try {
|
7366 | hook.call(callContext);
|
7367 | }
|
7368 | finally {
|
7369 | profiler(5 , callContext, hook);
|
7370 | }
|
7371 | }
|
7372 | }
|
7373 | else {
|
7374 | profiler(4 , context, toCall);
|
7375 | try {
|
7376 | toCall.call(context);
|
7377 | }
|
7378 | finally {
|
7379 | profiler(5 , context, toCall);
|
7380 | }
|
7381 | }
|
7382 | }
|
7383 | }
|
7384 | }
|
7385 | }
|
7386 |
|
7387 |
|
7388 |
|
7389 |
|
7390 |
|
7391 |
|
7392 |
|
7393 |
|
7394 |
|
7395 |
|
7396 |
|
7397 |
|
7398 |
|
7399 |
|
7400 |
|
7401 |
|
7402 | function getParentRElement(tView, tNode, lView) {
|
7403 | return getClosestRElement(tView, tNode.parent, lView);
|
7404 | }
|
7405 |
|
7406 |
|
7407 |
|
7408 |
|
7409 |
|
7410 |
|
7411 |
|
7412 |
|
7413 |
|
7414 |
|
7415 |
|
7416 |
|
7417 |
|
7418 |
|
7419 |
|
7420 | function getClosestRElement(tView, tNode, lView) {
|
7421 | let parentTNode = tNode;
|
7422 |
|
7423 |
|
7424 | while (parentTNode !== null &&
|
7425 | (parentTNode.type & (8 | 32 ))) {
|
7426 | tNode = parentTNode;
|
7427 | parentTNode = tNode.parent;
|
7428 | }
|
7429 |
|
7430 |
|
7431 | if (parentTNode === null) {
|
7432 |
|
7433 |
|
7434 | return lView[HOST];
|
7435 | }
|
7436 | else {
|
7437 | ngDevMode && assertTNodeType(parentTNode, 3 | 4 );
|
7438 | if (parentTNode.flags & 2 ) {
|
7439 | ngDevMode && assertTNodeForLView(parentTNode, lView);
|
7440 | const encapsulation = tView.data[parentTNode.directiveStart].encapsulation;
|
7441 |
|
7442 |
|
7443 |
|
7444 |
|
7445 |
|
7446 |
|
7447 | if (encapsulation === ViewEncapsulation$1.None ||
|
7448 | encapsulation === ViewEncapsulation$1.Emulated) {
|
7449 | return null;
|
7450 | }
|
7451 | }
|
7452 | return getNativeByTNode(parentTNode, lView);
|
7453 | }
|
7454 | }
|
7455 |
|
7456 |
|
7457 |
|
7458 |
|
7459 |
|
7460 | function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) {
|
7461 | ngDevMode && ngDevMode.rendererInsertBefore++;
|
7462 | if (isProceduralRenderer(renderer)) {
|
7463 | renderer.insertBefore(parent, child, beforeNode, isMove);
|
7464 | }
|
7465 | else {
|
7466 | parent.insertBefore(child, beforeNode, isMove);
|
7467 | }
|
7468 | }
|
7469 | function nativeAppendChild(renderer, parent, child) {
|
7470 | ngDevMode && ngDevMode.rendererAppendChild++;
|
7471 | ngDevMode && assertDefined(parent, 'parent node must be defined');
|
7472 | if (isProceduralRenderer(renderer)) {
|
7473 | renderer.appendChild(parent, child);
|
7474 | }
|
7475 | else {
|
7476 | parent.appendChild(child);
|
7477 | }
|
7478 | }
|
7479 | function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove) {
|
7480 | if (beforeNode !== null) {
|
7481 | nativeInsertBefore(renderer, parent, child, beforeNode, isMove);
|
7482 | }
|
7483 | else {
|
7484 | nativeAppendChild(renderer, parent, child);
|
7485 | }
|
7486 | }
|
7487 |
|
7488 | function nativeRemoveChild(renderer, parent, child, isHostElement) {
|
7489 | if (isProceduralRenderer(renderer)) {
|
7490 | renderer.removeChild(parent, child, isHostElement);
|
7491 | }
|
7492 | else {
|
7493 | parent.removeChild(child);
|
7494 | }
|
7495 | }
|
7496 |
|
7497 |
|
7498 |
|
7499 | function nativeParentNode(renderer, node) {
|
7500 | return (isProceduralRenderer(renderer) ? renderer.parentNode(node) : node.parentNode);
|
7501 | }
|
7502 |
|
7503 |
|
7504 |
|
7505 | function nativeNextSibling(renderer, node) {
|
7506 | return isProceduralRenderer(renderer) ? renderer.nextSibling(node) : node.nextSibling;
|
7507 | }
|
7508 |
|
7509 |
|
7510 |
|
7511 |
|
7512 |
|
7513 |
|
7514 |
|
7515 |
|
7516 |
|
7517 |
|
7518 | function getInsertInFrontOfRNode(parentTNode, currentTNode, lView) {
|
7519 | return _getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView);
|
7520 | }
|
7521 |
|
7522 |
|
7523 |
|
7524 |
|
7525 |
|
7526 |
|
7527 |
|
7528 |
|
7529 |
|
7530 |
|
7531 |
|
7532 | function getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView) {
|
7533 | if (parentTNode.type & (8 | 32 )) {
|
7534 | return getNativeByTNode(parentTNode, lView);
|
7535 | }
|
7536 | return null;
|
7537 | }
|
7538 |
|
7539 |
|
7540 |
|
7541 |
|
7542 |
|
7543 | let _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithNoI18n;
|
7544 |
|
7545 |
|
7546 |
|
7547 |
|
7548 |
|
7549 | let _processI18nInsertBefore;
|
7550 | function setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore) {
|
7551 | _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithI18n;
|
7552 | _processI18nInsertBefore = processI18nInsertBefore;
|
7553 | }
|
7554 |
|
7555 |
|
7556 |
|
7557 |
|
7558 |
|
7559 |
|
7560 |
|
7561 |
|
7562 | function appendChild(tView, lView, childRNode, childTNode) {
|
7563 | const parentRNode = getParentRElement(tView, childTNode, lView);
|
7564 | const renderer = lView[RENDERER];
|
7565 | const parentTNode = childTNode.parent || lView[T_HOST];
|
7566 | const anchorNode = getInsertInFrontOfRNode(parentTNode, childTNode, lView);
|
7567 | if (parentRNode != null) {
|
7568 | if (Array.isArray(childRNode)) {
|
7569 | for (let i = 0; i < childRNode.length; i++) {
|
7570 | nativeAppendOrInsertBefore(renderer, parentRNode, childRNode[i], anchorNode, false);
|
7571 | }
|
7572 | }
|
7573 | else {
|
7574 | nativeAppendOrInsertBefore(renderer, parentRNode, childRNode, anchorNode, false);
|
7575 | }
|
7576 | }
|
7577 | _processI18nInsertBefore !== undefined &&
|
7578 | _processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRNode);
|
7579 | }
|
7580 |
|
7581 |
|
7582 |
|
7583 |
|
7584 |
|
7585 | function getFirstNativeNode(lView, tNode) {
|
7586 | if (tNode !== null) {
|
7587 | ngDevMode &&
|
7588 | assertTNodeType(tNode, 3 | 12 | 32 | 16 );
|
7589 | const tNodeType = tNode.type;
|
7590 | if (tNodeType & 3 ) {
|
7591 | return getNativeByTNode(tNode, lView);
|
7592 | }
|
7593 | else if (tNodeType & 4 ) {
|
7594 | return getBeforeNodeForView(-1, lView[tNode.index]);
|
7595 | }
|
7596 | else if (tNodeType & 8 ) {
|
7597 | const elIcuContainerChild = tNode.child;
|
7598 | if (elIcuContainerChild !== null) {
|
7599 | return getFirstNativeNode(lView, elIcuContainerChild);
|
7600 | }
|
7601 | else {
|
7602 | const rNodeOrLContainer = lView[tNode.index];
|
7603 | if (isLContainer(rNodeOrLContainer)) {
|
7604 | return getBeforeNodeForView(-1, rNodeOrLContainer);
|
7605 | }
|
7606 | else {
|
7607 | return unwrapRNode(rNodeOrLContainer);
|
7608 | }
|
7609 | }
|
7610 | }
|
7611 | else if (tNodeType & 32 ) {
|
7612 | let nextRNode = icuContainerIterate(tNode, lView);
|
7613 | let rNode = nextRNode();
|
7614 |
|
7615 | return rNode || unwrapRNode(lView[tNode.index]);
|
7616 | }
|
7617 | else {
|
7618 | const projectionNodes = getProjectionNodes(lView, tNode);
|
7619 | if (projectionNodes !== null) {
|
7620 | if (Array.isArray(projectionNodes)) {
|
7621 | return projectionNodes[0];
|
7622 | }
|
7623 | const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]);
|
7624 | ngDevMode && assertParentView(parentView);
|
7625 | return getFirstNativeNode(parentView, projectionNodes);
|
7626 | }
|
7627 | else {
|
7628 | return getFirstNativeNode(lView, tNode.next);
|
7629 | }
|
7630 | }
|
7631 | }
|
7632 | return null;
|
7633 | }
|
7634 | function getProjectionNodes(lView, tNode) {
|
7635 | if (tNode !== null) {
|
7636 | const componentView = lView[DECLARATION_COMPONENT_VIEW];
|
7637 | const componentHost = componentView[T_HOST];
|
7638 | const slotIdx = tNode.projection;
|
7639 | ngDevMode && assertProjectionSlots(lView);
|
7640 | return componentHost.projection[slotIdx];
|
7641 | }
|
7642 | return null;
|
7643 | }
|
7644 | function getBeforeNodeForView(viewIndexInContainer, lContainer) {
|
7645 | const nextViewIndex = CONTAINER_HEADER_OFFSET + viewIndexInContainer + 1;
|
7646 | if (nextViewIndex < lContainer.length) {
|
7647 | const lView = lContainer[nextViewIndex];
|
7648 | const firstTNodeOfView = lView[TVIEW].firstChild;
|
7649 | if (firstTNodeOfView !== null) {
|
7650 | return getFirstNativeNode(lView, firstTNodeOfView);
|
7651 | }
|
7652 | }
|
7653 | return lContainer[NATIVE];
|
7654 | }
|
7655 |
|
7656 |
|
7657 |
|
7658 |
|
7659 |
|
7660 |
|
7661 |
|
7662 |
|
7663 |
|
7664 | function nativeRemoveNode(renderer, rNode, isHostElement) {
|
7665 | ngDevMode && ngDevMode.rendererRemoveNode++;
|
7666 | const nativeParent = nativeParentNode(renderer, rNode);
|
7667 | if (nativeParent) {
|
7668 | nativeRemoveChild(renderer, nativeParent, rNode, isHostElement);
|
7669 | }
|
7670 | }
|
7671 |
|
7672 |
|
7673 |
|
7674 |
|
7675 | function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode, isProjection) {
|
7676 | while (tNode != null) {
|
7677 | ngDevMode && assertTNodeForLView(tNode, lView);
|
7678 | ngDevMode &&
|
7679 | assertTNodeType(tNode, 3 | 12 | 16 | 32 );
|
7680 | const rawSlotValue = lView[tNode.index];
|
7681 | const tNodeType = tNode.type;
|
7682 | if (isProjection) {
|
7683 | if (action === 0 ) {
|
7684 | rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
|
7685 | tNode.flags |= 4 ;
|
7686 | }
|
7687 | }
|
7688 | if ((tNode.flags & 64 ) !== 64 ) {
|
7689 | if (tNodeType & 8 ) {
|
7690 | applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
|
7691 | applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
|
7692 | }
|
7693 | else if (tNodeType & 32 ) {
|
7694 | const nextRNode = icuContainerIterate(tNode, lView);
|
7695 | let rNode;
|
7696 | while (rNode = nextRNode()) {
|
7697 | applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode);
|
7698 | }
|
7699 | applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
|
7700 | }
|
7701 | else if (tNodeType & 16 ) {
|
7702 | applyProjectionRecursive(renderer, action, lView, tNode, parentRElement, beforeNode);
|
7703 | }
|
7704 | else {
|
7705 | ngDevMode && assertTNodeType(tNode, 3 | 4 );
|
7706 | applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
|
7707 | }
|
7708 | }
|
7709 | tNode = isProjection ? tNode.projectionNext : tNode.next;
|
7710 | }
|
7711 | }
|
7712 | function applyView(tView, lView, renderer, action, parentRElement, beforeNode) {
|
7713 | applyNodes(renderer, action, tView.firstChild, lView, parentRElement, beforeNode, false);
|
7714 | }
|
7715 |
|
7716 |
|
7717 |
|
7718 |
|
7719 |
|
7720 |
|
7721 |
|
7722 |
|
7723 |
|
7724 |
|
7725 | function applyProjection(tView, lView, tProjectionNode) {
|
7726 | const renderer = lView[RENDERER];
|
7727 | const parentRNode = getParentRElement(tView, tProjectionNode, lView);
|
7728 | const parentTNode = tProjectionNode.parent || lView[T_HOST];
|
7729 | let beforeNode = getInsertInFrontOfRNode(parentTNode, tProjectionNode, lView);
|
7730 | applyProjectionRecursive(renderer, 0 , lView, tProjectionNode, parentRNode, beforeNode);
|
7731 | }
|
7732 |
|
7733 |
|
7734 |
|
7735 |
|
7736 |
|
7737 |
|
7738 |
|
7739 |
|
7740 |
|
7741 |
|
7742 |
|
7743 |
|
7744 |
|
7745 |
|
7746 | function applyProjectionRecursive(renderer, action, lView, tProjectionNode, parentRElement, beforeNode) {
|
7747 | const componentLView = lView[DECLARATION_COMPONENT_VIEW];
|
7748 | const componentNode = componentLView[T_HOST];
|
7749 | ngDevMode &&
|
7750 | assertEqual(typeof tProjectionNode.projection, 'number', 'expecting projection index');
|
7751 | const nodeToProjectOrRNodes = componentNode.projection[tProjectionNode.projection];
|
7752 | if (Array.isArray(nodeToProjectOrRNodes)) {
|
7753 |
|
7754 |
|
7755 |
|
7756 |
|
7757 |
|
7758 | for (let i = 0; i < nodeToProjectOrRNodes.length; i++) {
|
7759 | const rNode = nodeToProjectOrRNodes[i];
|
7760 | applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode);
|
7761 | }
|
7762 | }
|
7763 | else {
|
7764 | let nodeToProject = nodeToProjectOrRNodes;
|
7765 | const projectedComponentLView = componentLView[PARENT];
|
7766 | applyNodes(renderer, action, nodeToProject, projectedComponentLView, parentRElement, beforeNode, true);
|
7767 | }
|
7768 | }
|
7769 |
|
7770 |
|
7771 |
|
7772 |
|
7773 |
|
7774 |
|
7775 |
|
7776 |
|
7777 |
|
7778 |
|
7779 |
|
7780 |
|
7781 |
|
7782 | function applyContainer(renderer, action, lContainer, parentRElement, beforeNode) {
|
7783 | ngDevMode && assertLContainer(lContainer);
|
7784 | const anchor = lContainer[NATIVE];
|
7785 | const native = unwrapRNode(lContainer);
|
7786 |
|
7787 |
|
7788 |
|
7789 |
|
7790 |
|
7791 |
|
7792 | if (anchor !== native) {
|
7793 |
|
7794 |
|
7795 |
|
7796 |
|
7797 | applyToElementOrContainer(action, renderer, parentRElement, anchor, beforeNode);
|
7798 | }
|
7799 | for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
7800 | const lView = lContainer[i];
|
7801 | applyView(lView[TVIEW], lView, renderer, action, parentRElement, anchor);
|
7802 | }
|
7803 | }
|
7804 |
|
7805 |
|
7806 |
|
7807 |
|
7808 |
|
7809 |
|
7810 |
|
7811 |
|
7812 |
|
7813 |
|
7814 | function applyStyling(renderer, isClassBased, rNode, prop, value) {
|
7815 | const isProcedural = isProceduralRenderer(renderer);
|
7816 | if (isClassBased) {
|
7817 |
|
7818 | if (!value) {
|
7819 | ngDevMode && ngDevMode.rendererRemoveClass++;
|
7820 | if (isProcedural) {
|
7821 | renderer.removeClass(rNode, prop);
|
7822 | }
|
7823 | else {
|
7824 | rNode.classList.remove(prop);
|
7825 | }
|
7826 | }
|
7827 | else {
|
7828 | ngDevMode && ngDevMode.rendererAddClass++;
|
7829 | if (isProcedural) {
|
7830 | renderer.addClass(rNode, prop);
|
7831 | }
|
7832 | else {
|
7833 | ngDevMode && assertDefined(rNode.classList, 'HTMLElement expected');
|
7834 | rNode.classList.add(prop);
|
7835 | }
|
7836 | }
|
7837 | }
|
7838 | else {
|
7839 | let flags = prop.indexOf('-') === -1 ? undefined : RendererStyleFlags2.DashCase;
|
7840 | if (value == null ) {
|
7841 | ngDevMode && ngDevMode.rendererRemoveStyle++;
|
7842 | if (isProcedural) {
|
7843 | renderer.removeStyle(rNode, prop, flags);
|
7844 | }
|
7845 | else {
|
7846 | rNode.style.removeProperty(prop);
|
7847 | }
|
7848 | }
|
7849 | else {
|
7850 |
|
7851 |
|
7852 | const isImportant = typeof value === 'string' ? value.endsWith('!important') : false;
|
7853 | if (isImportant) {
|
7854 |
|
7855 | value = value.slice(0, -10);
|
7856 | flags |= RendererStyleFlags2.Important;
|
7857 | }
|
7858 | ngDevMode && ngDevMode.rendererSetStyle++;
|
7859 | if (isProcedural) {
|
7860 | renderer.setStyle(rNode, prop, value, flags);
|
7861 | }
|
7862 | else {
|
7863 | ngDevMode && assertDefined(rNode.style, 'HTMLElement expected');
|
7864 | rNode.style.setProperty(prop, value, isImportant ? 'important' : '');
|
7865 | }
|
7866 | }
|
7867 | }
|
7868 | }
|
7869 |
|
7870 |
|
7871 |
|
7872 |
|
7873 |
|
7874 |
|
7875 |
|
7876 |
|
7877 |
|
7878 |
|
7879 | function writeDirectStyle(renderer, element, newValue) {
|
7880 | ngDevMode && assertString(newValue, '\'newValue\' should be a string');
|
7881 | if (isProceduralRenderer(renderer)) {
|
7882 | renderer.setAttribute(element, 'style', newValue);
|
7883 | }
|
7884 | else {
|
7885 | element.style.cssText = newValue;
|
7886 | }
|
7887 | ngDevMode && ngDevMode.rendererSetStyle++;
|
7888 | }
|
7889 |
|
7890 |
|
7891 |
|
7892 |
|
7893 |
|
7894 |
|
7895 |
|
7896 |
|
7897 |
|
7898 |
|
7899 | function writeDirectClass(renderer, element, newValue) {
|
7900 | ngDevMode && assertString(newValue, '\'newValue\' should be a string');
|
7901 | if (isProceduralRenderer(renderer)) {
|
7902 | if (newValue === '') {
|
7903 |
|
7904 | renderer.removeAttribute(element, 'class');
|
7905 | }
|
7906 | else {
|
7907 | renderer.setAttribute(element, 'class', newValue);
|
7908 | }
|
7909 | }
|
7910 | else {
|
7911 | element.className = newValue;
|
7912 | }
|
7913 | ngDevMode && ngDevMode.rendererSetClassName++;
|
7914 | }
|
7915 |
|
7916 |
|
7917 |
|
7918 |
|
7919 |
|
7920 |
|
7921 |
|
7922 |
|
7923 |
|
7924 |
|
7925 |
|
7926 |
|
7927 |
|
7928 |
|
7929 |
|
7930 |
|
7931 |
|
7932 |
|
7933 | function classIndexOf(className, classToSearch, startingIndex) {
|
7934 | ngDevMode && assertNotEqual(classToSearch, '', 'can not look for "" string.');
|
7935 | let end = className.length;
|
7936 | while (true) {
|
7937 | const foundIndex = className.indexOf(classToSearch, startingIndex);
|
7938 | if (foundIndex === -1)
|
7939 | return foundIndex;
|
7940 | if (foundIndex === 0 || className.charCodeAt(foundIndex - 1) <= 32 ) {
|
7941 |
|
7942 | const length = classToSearch.length;
|
7943 | if (foundIndex + length === end ||
|
7944 | className.charCodeAt(foundIndex + length) <= 32 ) {
|
7945 |
|
7946 | return foundIndex;
|
7947 | }
|
7948 | }
|
7949 |
|
7950 | startingIndex = foundIndex + 1;
|
7951 | }
|
7952 | }
|
7953 |
|
7954 |
|
7955 |
|
7956 |
|
7957 |
|
7958 |
|
7959 |
|
7960 |
|
7961 | const unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$3;
|
7962 | const NG_TEMPLATE_SELECTOR = 'ng-template';
|
7963 |
|
7964 |
|
7965 |
|
7966 |
|
7967 |
|
7968 |
|
7969 |
|
7970 |
|
7971 | function isCssClassMatching(attrs, cssClassToMatch, isProjectionMode) {
|
7972 |
|
7973 |
|
7974 |
|
7975 |
|
7976 | ngDevMode &&
|
7977 | assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), 'Class name expected to be lowercase.');
|
7978 | let i = 0;
|
7979 | while (i < attrs.length) {
|
7980 | let item = attrs[i++];
|
7981 | if (isProjectionMode && item === 'class') {
|
7982 | item = attrs[i];
|
7983 | if (classIndexOf(item.toLowerCase(), cssClassToMatch, 0) !== -1) {
|
7984 | return true;
|
7985 | }
|
7986 | }
|
7987 | else if (item === 1 ) {
|
7988 |
|
7989 | while (i < attrs.length && typeof (item = attrs[i++]) == 'string') {
|
7990 |
|
7991 | if (item.toLowerCase() === cssClassToMatch)
|
7992 | return true;
|
7993 | }
|
7994 | return false;
|
7995 | }
|
7996 | }
|
7997 | return false;
|
7998 | }
|
7999 |
|
8000 |
|
8001 |
|
8002 |
|
8003 |
|
8004 | function isInlineTemplate(tNode) {
|
8005 | return tNode.type === 4 && tNode.value !== NG_TEMPLATE_SELECTOR;
|
8006 | }
|
8007 |
|
8008 |
|
8009 |
|
8010 |
|
8011 |
|
8012 |
|
8013 |
|
8014 |
|
8015 |
|
8016 |
|
8017 |
|
8018 | function hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) {
|
8019 | const tagNameToCompare = tNode.type === 4 && !isProjectionMode ? NG_TEMPLATE_SELECTOR : tNode.value;
|
8020 | return currentSelector === tagNameToCompare;
|
8021 | }
|
8022 |
|
8023 |
|
8024 |
|
8025 |
|
8026 |
|
8027 |
|
8028 |
|
8029 |
|
8030 |
|
8031 | function isNodeMatchingSelector(tNode, selector, isProjectionMode) {
|
8032 | ngDevMode && assertDefined(selector[0], 'Selector should have a tag name');
|
8033 | let mode = 4 ;
|
8034 | const nodeAttrs = tNode.attrs || [];
|
8035 |
|
8036 | const nameOnlyMarkerIdx = getNameOnlyMarkerIndex(nodeAttrs);
|
8037 |
|
8038 |
|
8039 | let skipToNextSelector = false;
|
8040 | for (let i = 0; i < selector.length; i++) {
|
8041 | const current = selector[i];
|
8042 | if (typeof current === 'number') {
|
8043 |
|
8044 | if (!skipToNextSelector && !isPositive(mode) && !isPositive(current)) {
|
8045 | return false;
|
8046 | }
|
8047 |
|
8048 |
|
8049 | if (skipToNextSelector && isPositive(current))
|
8050 | continue;
|
8051 | skipToNextSelector = false;
|
8052 | mode = current | (mode & 1 );
|
8053 | continue;
|
8054 | }
|
8055 | if (skipToNextSelector)
|
8056 | continue;
|
8057 | if (mode & 4 ) {
|
8058 | mode = 2 | mode & 1 ;
|
8059 | if (current !== '' && !hasTagAndTypeMatch(tNode, current, isProjectionMode) ||
|
8060 | current === '' && selector.length === 1) {
|
8061 | if (isPositive(mode))
|
8062 | return false;
|
8063 | skipToNextSelector = true;
|
8064 | }
|
8065 | }
|
8066 | else {
|
8067 | const selectorAttrValue = mode & 8 ? current : selector[++i];
|
8068 |
|
8069 |
|
8070 | if ((mode & 8 ) && tNode.attrs !== null) {
|
8071 | if (!isCssClassMatching(tNode.attrs, selectorAttrValue, isProjectionMode)) {
|
8072 | if (isPositive(mode))
|
8073 | return false;
|
8074 | skipToNextSelector = true;
|
8075 | }
|
8076 | continue;
|
8077 | }
|
8078 | const attrName = (mode & 8 ) ? 'class' : current;
|
8079 | const attrIndexInNode = findAttrIndexInNode(attrName, nodeAttrs, isInlineTemplate(tNode), isProjectionMode);
|
8080 | if (attrIndexInNode === -1) {
|
8081 | if (isPositive(mode))
|
8082 | return false;
|
8083 | skipToNextSelector = true;
|
8084 | continue;
|
8085 | }
|
8086 | if (selectorAttrValue !== '') {
|
8087 | let nodeAttrValue;
|
8088 | if (attrIndexInNode > nameOnlyMarkerIdx) {
|
8089 | nodeAttrValue = '';
|
8090 | }
|
8091 | else {
|
8092 | ngDevMode &&
|
8093 | assertNotEqual(nodeAttrs[attrIndexInNode], 0 , 'We do not match directives on namespaced attributes');
|
8094 |
|
8095 |
|
8096 |
|
8097 | nodeAttrValue = nodeAttrs[attrIndexInNode + 1].toLowerCase();
|
8098 | }
|
8099 | const compareAgainstClassName = mode & 8 ? nodeAttrValue : null;
|
8100 | if (compareAgainstClassName &&
|
8101 | classIndexOf(compareAgainstClassName, selectorAttrValue, 0) !== -1 ||
|
8102 | mode & 2 && selectorAttrValue !== nodeAttrValue) {
|
8103 | if (isPositive(mode))
|
8104 | return false;
|
8105 | skipToNextSelector = true;
|
8106 | }
|
8107 | }
|
8108 | }
|
8109 | }
|
8110 | return isPositive(mode) || skipToNextSelector;
|
8111 | }
|
8112 | function isPositive(mode) {
|
8113 | return (mode & 1 ) === 0;
|
8114 | }
|
8115 |
|
8116 |
|
8117 |
|
8118 |
|
8119 |
|
8120 |
|
8121 |
|
8122 |
|
8123 |
|
8124 |
|
8125 |
|
8126 |
|
8127 |
|
8128 |
|
8129 |
|
8130 |
|
8131 |
|
8132 |
|
8133 |
|
8134 |
|
8135 |
|
8136 |
|
8137 |
|
8138 |
|
8139 |
|
8140 |
|
8141 |
|
8142 |
|
8143 |
|
8144 | function findAttrIndexInNode(name, attrs, isInlineTemplate, isProjectionMode) {
|
8145 | if (attrs === null)
|
8146 | return -1;
|
8147 | let i = 0;
|
8148 | if (isProjectionMode || !isInlineTemplate) {
|
8149 | let bindingsMode = false;
|
8150 | while (i < attrs.length) {
|
8151 | const maybeAttrName = attrs[i];
|
8152 | if (maybeAttrName === name) {
|
8153 | return i;
|
8154 | }
|
8155 | else if (maybeAttrName === 3 || maybeAttrName === 6 ) {
|
8156 | bindingsMode = true;
|
8157 | }
|
8158 | else if (maybeAttrName === 1 || maybeAttrName === 2 ) {
|
8159 | let value = attrs[++i];
|
8160 |
|
8161 |
|
8162 | while (typeof value === 'string') {
|
8163 | value = attrs[++i];
|
8164 | }
|
8165 | continue;
|
8166 | }
|
8167 | else if (maybeAttrName === 4 ) {
|
8168 |
|
8169 | break;
|
8170 | }
|
8171 | else if (maybeAttrName === 0 ) {
|
8172 |
|
8173 | i += 4;
|
8174 | continue;
|
8175 | }
|
8176 |
|
8177 | i += bindingsMode ? 1 : 2;
|
8178 | }
|
8179 |
|
8180 | return -1;
|
8181 | }
|
8182 | else {
|
8183 | return matchTemplateAttribute(attrs, name);
|
8184 | }
|
8185 | }
|
8186 | function isNodeMatchingSelectorList(tNode, selector, isProjectionMode = false) {
|
8187 | for (let i = 0; i < selector.length; i++) {
|
8188 | if (isNodeMatchingSelector(tNode, selector[i], isProjectionMode)) {
|
8189 | return true;
|
8190 | }
|
8191 | }
|
8192 | return false;
|
8193 | }
|
8194 | function getProjectAsAttrValue(tNode) {
|
8195 | const nodeAttrs = tNode.attrs;
|
8196 | if (nodeAttrs != null) {
|
8197 | const ngProjectAsAttrIdx = nodeAttrs.indexOf(5 );
|
8198 |
|
8199 |
|
8200 | if ((ngProjectAsAttrIdx & 1) === 0) {
|
8201 | return nodeAttrs[ngProjectAsAttrIdx + 1];
|
8202 | }
|
8203 | }
|
8204 | return null;
|
8205 | }
|
8206 | function getNameOnlyMarkerIndex(nodeAttrs) {
|
8207 | for (let i = 0; i < nodeAttrs.length; i++) {
|
8208 | const nodeAttr = nodeAttrs[i];
|
8209 | if (isNameOnlyAttributeMarker(nodeAttr)) {
|
8210 | return i;
|
8211 | }
|
8212 | }
|
8213 | return nodeAttrs.length;
|
8214 | }
|
8215 | function matchTemplateAttribute(attrs, name) {
|
8216 | let i = attrs.indexOf(4 );
|
8217 | if (i > -1) {
|
8218 | i++;
|
8219 | while (i < attrs.length) {
|
8220 | const attr = attrs[i];
|
8221 |
|
8222 |
|
8223 | if (typeof attr === 'number')
|
8224 | return -1;
|
8225 | if (attr === name)
|
8226 | return i;
|
8227 | i++;
|
8228 | }
|
8229 | }
|
8230 | return -1;
|
8231 | }
|
8232 |
|
8233 |
|
8234 |
|
8235 |
|
8236 |
|
8237 | function isSelectorInSelectorList(selector, list) {
|
8238 | selectorListLoop: for (let i = 0; i < list.length; i++) {
|
8239 | const currentSelectorInList = list[i];
|
8240 | if (selector.length !== currentSelectorInList.length) {
|
8241 | continue;
|
8242 | }
|
8243 | for (let j = 0; j < selector.length; j++) {
|
8244 | if (selector[j] !== currentSelectorInList[j]) {
|
8245 | continue selectorListLoop;
|
8246 | }
|
8247 | }
|
8248 | return true;
|
8249 | }
|
8250 | return false;
|
8251 | }
|
8252 | function maybeWrapInNotSelector(isNegativeMode, chunk) {
|
8253 | return isNegativeMode ? ':not(' + chunk.trim() + ')' : chunk;
|
8254 | }
|
8255 | function stringifyCSSSelector(selector) {
|
8256 | let result = selector[0];
|
8257 | let i = 1;
|
8258 | let mode = 2 ;
|
8259 | let currentChunk = '';
|
8260 | let isNegativeMode = false;
|
8261 | while (i < selector.length) {
|
8262 | let valueOrMarker = selector[i];
|
8263 | if (typeof valueOrMarker === 'string') {
|
8264 | if (mode & 2 ) {
|
8265 | const attrValue = selector[++i];
|
8266 | currentChunk +=
|
8267 | '[' + valueOrMarker + (attrValue.length > 0 ? '="' + attrValue + '"' : '') + ']';
|
8268 | }
|
8269 | else if (mode & 8 ) {
|
8270 | currentChunk += '.' + valueOrMarker;
|
8271 | }
|
8272 | else if (mode & 4 ) {
|
8273 | currentChunk += ' ' + valueOrMarker;
|
8274 | }
|
8275 | }
|
8276 | else {
|
8277 |
|
8278 |
|
8279 |
|
8280 |
|
8281 |
|
8282 |
|
8283 |
|
8284 |
|
8285 |
|
8286 |
|
8287 |
|
8288 |
|
8289 |
|
8290 |
|
8291 |
|
8292 |
|
8293 |
|
8294 | if (currentChunk !== '' && !isPositive(valueOrMarker)) {
|
8295 | result += maybeWrapInNotSelector(isNegativeMode, currentChunk);
|
8296 | currentChunk = '';
|
8297 | }
|
8298 | mode = valueOrMarker;
|
8299 |
|
8300 |
|
8301 | isNegativeMode = isNegativeMode || !isPositive(mode);
|
8302 | }
|
8303 | i++;
|
8304 | }
|
8305 | if (currentChunk !== '') {
|
8306 | result += maybeWrapInNotSelector(isNegativeMode, currentChunk);
|
8307 | }
|
8308 | return result;
|
8309 | }
|
8310 |
|
8311 |
|
8312 |
|
8313 |
|
8314 |
|
8315 |
|
8316 |
|
8317 |
|
8318 |
|
8319 |
|
8320 |
|
8321 |
|
8322 | function stringifyCSSSelectorList(selectorList) {
|
8323 | return selectorList.map(stringifyCSSSelector).join(',');
|
8324 | }
|
8325 |
|
8326 |
|
8327 |
|
8328 |
|
8329 |
|
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 |
|
8335 | function extractAttrsAndClassesFromSelector(selector) {
|
8336 | const attrs = [];
|
8337 | const classes = [];
|
8338 | let i = 1;
|
8339 | let mode = 2 ;
|
8340 | while (i < selector.length) {
|
8341 | let valueOrMarker = selector[i];
|
8342 | if (typeof valueOrMarker === 'string') {
|
8343 | if (mode === 2 ) {
|
8344 | if (valueOrMarker !== '') {
|
8345 | attrs.push(valueOrMarker, selector[++i]);
|
8346 | }
|
8347 | }
|
8348 | else if (mode === 8 ) {
|
8349 | classes.push(valueOrMarker);
|
8350 | }
|
8351 | }
|
8352 | else {
|
8353 |
|
8354 |
|
8355 |
|
8356 | if (!isPositive(mode))
|
8357 | break;
|
8358 | mode = valueOrMarker;
|
8359 | }
|
8360 | i++;
|
8361 | }
|
8362 | return { attrs, classes };
|
8363 | }
|
8364 |
|
8365 |
|
8366 |
|
8367 |
|
8368 |
|
8369 |
|
8370 |
|
8371 |
|
8372 |
|
8373 | const NO_CHANGE = (typeof ngDevMode === 'undefined' || ngDevMode) ? { __brand__: 'NO_CHANGE' } : {};
|
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 |
|
8402 |
|
8403 |
|
8404 |
|
8405 | function ɵɵadvance(delta) {
|
8406 | ngDevMode && assertGreaterThan(delta, 0, 'Can only advance forward');
|
8407 | selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, isInCheckNoChangesMode());
|
8408 | }
|
8409 | function selectIndexInternal(tView, lView, index, checkNoChangesMode) {
|
8410 | ngDevMode && assertIndexInDeclRange(lView, index);
|
8411 |
|
8412 |
|
8413 | if (!checkNoChangesMode) {
|
8414 | const hooksInitPhaseCompleted = (lView[FLAGS] & 3 ) === 3 ;
|
8415 | if (hooksInitPhaseCompleted) {
|
8416 | const preOrderCheckHooks = tView.preOrderCheckHooks;
|
8417 | if (preOrderCheckHooks !== null) {
|
8418 | executeCheckHooks(lView, preOrderCheckHooks, index);
|
8419 | }
|
8420 | }
|
8421 | else {
|
8422 | const preOrderHooks = tView.preOrderHooks;
|
8423 | if (preOrderHooks !== null) {
|
8424 | executeInitAndCheckHooks(lView, preOrderHooks, 0 , index);
|
8425 | }
|
8426 | }
|
8427 | }
|
8428 |
|
8429 |
|
8430 |
|
8431 |
|
8432 | setSelectedIndex(index);
|
8433 | }
|
8434 |
|
8435 |
|
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 |
|
8443 |
|
8444 |
|
8445 |
|
8446 |
|
8447 |
|
8448 |
|
8449 |
|
8450 |
|
8451 |
|
8452 |
|
8453 |
|
8454 | function createNamedArrayType(name) {
|
8455 |
|
8456 | if (ngDevMode) {
|
8457 | try {
|
8458 |
|
8459 |
|
8460 |
|
8461 | return (newTrustedFunctionForDev('Array', `return class ${name} extends Array{}`))(Array);
|
8462 | }
|
8463 | catch (e) {
|
8464 |
|
8465 | return Array;
|
8466 | }
|
8467 | }
|
8468 | else {
|
8469 | throw new Error('Looks like we are in \'prod mode\', but we are creating a named Array type, which is wrong! Check your code');
|
8470 | }
|
8471 | }
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 |
|
8479 |
|
8480 | function toTStylingRange(prev, next) {
|
8481 | ngDevMode && assertNumberInRange(prev, 0, 32767 );
|
8482 | ngDevMode && assertNumberInRange(next, 0, 32767 );
|
8483 | return (prev << 17 | next << 2 );
|
8484 | }
|
8485 | function getTStylingRangePrev(tStylingRange) {
|
8486 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
8487 | return (tStylingRange >> 17 ) & 32767 ;
|
8488 | }
|
8489 | function getTStylingRangePrevDuplicate(tStylingRange) {
|
8490 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
8491 | return (tStylingRange & 2 ) ==
|
8492 | 2 ;
|
8493 | }
|
8494 | function setTStylingRangePrev(tStylingRange, previous) {
|
8495 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
8496 | ngDevMode && assertNumberInRange(previous, 0, 32767 );
|
8497 | return ((tStylingRange & ~4294836224 ) |
|
8498 | (previous << 17 ));
|
8499 | }
|
8500 | function setTStylingRangePrevDuplicate(tStylingRange) {
|
8501 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
8502 | return (tStylingRange | 2 );
|
8503 | }
|
8504 | function getTStylingRangeNext(tStylingRange) {
|
8505 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
8506 | return (tStylingRange & 131068 ) >> 2 ;
|
8507 | }
|
8508 | function setTStylingRangeNext(tStylingRange, next) {
|
8509 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
8510 | ngDevMode && assertNumberInRange(next, 0, 32767 );
|
8511 | return ((tStylingRange & ~131068 ) |
|
8512 | next << 2 );
|
8513 | }
|
8514 | function getTStylingRangeNextDuplicate(tStylingRange) {
|
8515 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
8516 | return (tStylingRange & 1 ) ===
|
8517 | 1 ;
|
8518 | }
|
8519 | function setTStylingRangeNextDuplicate(tStylingRange) {
|
8520 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
8521 | return (tStylingRange | 1 );
|
8522 | }
|
8523 | function getTStylingRangeTail(tStylingRange) {
|
8524 | ngDevMode && assertNumber(tStylingRange, 'expected number');
|
8525 | const next = getTStylingRangeNext(tStylingRange);
|
8526 | return next === 0 ? getTStylingRangePrev(tStylingRange) : next;
|
8527 | }
|
8528 |
|
8529 |
|
8530 |
|
8531 |
|
8532 |
|
8533 |
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 |
|
8540 |
|
8541 |
|
8542 |
|
8543 |
|
8544 | function attachDebugObject(obj, debug) {
|
8545 | if (ngDevMode) {
|
8546 | Object.defineProperty(obj, 'debug', { value: debug, enumerable: false });
|
8547 | }
|
8548 | else {
|
8549 | throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
|
8550 | }
|
8551 | }
|
8552 |
|
8553 |
|
8554 |
|
8555 |
|
8556 |
|
8557 |
|
8558 |
|
8559 |
|
8560 | function attachDebugGetter(obj, debugGetter) {
|
8561 | if (ngDevMode) {
|
8562 | Object.defineProperty(obj, 'debug', { get: debugGetter, enumerable: false });
|
8563 | }
|
8564 | else {
|
8565 | throw new Error('This method should be guarded with `ngDevMode` so that it can be tree shaken in production!');
|
8566 | }
|
8567 | }
|
8568 |
|
8569 |
|
8570 |
|
8571 |
|
8572 |
|
8573 |
|
8574 |
|
8575 |
|
8576 |
|
8577 |
|
8578 |
|
8579 |
|
8580 |
|
8581 |
|
8582 |
|
8583 |
|
8584 |
|
8585 |
|
8586 |
|
8587 |
|
8588 |
|
8589 |
|
8590 |
|
8591 |
|
8592 |
|
8593 |
|
8594 |
|
8595 |
|
8596 |
|
8597 |
|
8598 |
|
8599 |
|
8600 |
|
8601 |
|
8602 |
|
8603 |
|
8604 | let LVIEW_COMPONENT_CACHE;
|
8605 | let LVIEW_EMBEDDED_CACHE;
|
8606 | let LVIEW_ROOT;
|
8607 | let LVIEW_COMPONENT;
|
8608 | let LVIEW_EMBEDDED;
|
8609 |
|
8610 |
|
8611 |
|
8612 |
|
8613 |
|
8614 | function cloneToLViewFromTViewBlueprint(tView) {
|
8615 | const debugTView = tView;
|
8616 | const lView = getLViewToClone(debugTView.type, tView.template && tView.template.name);
|
8617 | return lView.concat(tView.blueprint);
|
8618 | }
|
8619 | class LRootView extends Array {
|
8620 | }
|
8621 | class LComponentView extends Array {
|
8622 | }
|
8623 | class LEmbeddedView extends Array {
|
8624 | }
|
8625 | function getLViewToClone(type, name) {
|
8626 | switch (type) {
|
8627 | case 0 :
|
8628 | if (LVIEW_ROOT === undefined)
|
8629 | LVIEW_ROOT = new LRootView();
|
8630 | return LVIEW_ROOT;
|
8631 | case 1 :
|
8632 | if (!ngDevMode || !ngDevMode.namedConstructors) {
|
8633 | if (LVIEW_COMPONENT === undefined)
|
8634 | LVIEW_COMPONENT = new LComponentView();
|
8635 | return LVIEW_COMPONENT;
|
8636 | }
|
8637 | if (LVIEW_COMPONENT_CACHE === undefined)
|
8638 | LVIEW_COMPONENT_CACHE = new Map();
|
8639 | let componentArray = LVIEW_COMPONENT_CACHE.get(name);
|
8640 | if (componentArray === undefined) {
|
8641 | componentArray = new (createNamedArrayType('LComponentView' + nameSuffix(name)))();
|
8642 | LVIEW_COMPONENT_CACHE.set(name, componentArray);
|
8643 | }
|
8644 | return componentArray;
|
8645 | case 2 :
|
8646 | if (!ngDevMode || !ngDevMode.namedConstructors) {
|
8647 | if (LVIEW_EMBEDDED === undefined)
|
8648 | LVIEW_EMBEDDED = new LEmbeddedView();
|
8649 | return LVIEW_EMBEDDED;
|
8650 | }
|
8651 | if (LVIEW_EMBEDDED_CACHE === undefined)
|
8652 | LVIEW_EMBEDDED_CACHE = new Map();
|
8653 | let embeddedArray = LVIEW_EMBEDDED_CACHE.get(name);
|
8654 | if (embeddedArray === undefined) {
|
8655 | embeddedArray = new (createNamedArrayType('LEmbeddedView' + nameSuffix(name)))();
|
8656 | LVIEW_EMBEDDED_CACHE.set(name, embeddedArray);
|
8657 | }
|
8658 | return embeddedArray;
|
8659 | }
|
8660 | }
|
8661 | function nameSuffix(text) {
|
8662 | if (text == null)
|
8663 | return '';
|
8664 | const index = text.lastIndexOf('_Template');
|
8665 | return '_' + (index === -1 ? text : text.substr(0, index));
|
8666 | }
|
8667 |
|
8668 |
|
8669 |
|
8670 |
|
8671 |
|
8672 | const TViewConstructor = class TView {
|
8673 | constructor(type, blueprint, template, queries, viewQuery, declTNode, data, bindingStartIndex, expandoStartIndex, hostBindingOpCodes, firstCreatePass, firstUpdatePass, staticViewQueries, staticContentQueries, preOrderHooks, preOrderCheckHooks, contentHooks, contentCheckHooks, viewHooks, viewCheckHooks, destroyHooks, cleanup, contentQueries, components, directiveRegistry, pipeRegistry, firstChild, schemas, consts, incompleteFirstPass, _decls, _vars) {
|
8674 | this.type = type;
|
8675 | this.blueprint = blueprint;
|
8676 | this.template = template;
|
8677 | this.queries = queries;
|
8678 | this.viewQuery = viewQuery;
|
8679 | this.declTNode = declTNode;
|
8680 | this.data = data;
|
8681 | this.bindingStartIndex = bindingStartIndex;
|
8682 | this.expandoStartIndex = expandoStartIndex;
|
8683 | this.hostBindingOpCodes = hostBindingOpCodes;
|
8684 | this.firstCreatePass = firstCreatePass;
|
8685 | this.firstUpdatePass = firstUpdatePass;
|
8686 | this.staticViewQueries = staticViewQueries;
|
8687 | this.staticContentQueries = staticContentQueries;
|
8688 | this.preOrderHooks = preOrderHooks;
|
8689 | this.preOrderCheckHooks = preOrderCheckHooks;
|
8690 | this.contentHooks = contentHooks;
|
8691 | this.contentCheckHooks = contentCheckHooks;
|
8692 | this.viewHooks = viewHooks;
|
8693 | this.viewCheckHooks = viewCheckHooks;
|
8694 | this.destroyHooks = destroyHooks;
|
8695 | this.cleanup = cleanup;
|
8696 | this.contentQueries = contentQueries;
|
8697 | this.components = components;
|
8698 | this.directiveRegistry = directiveRegistry;
|
8699 | this.pipeRegistry = pipeRegistry;
|
8700 | this.firstChild = firstChild;
|
8701 | this.schemas = schemas;
|
8702 | this.consts = consts;
|
8703 | this.incompleteFirstPass = incompleteFirstPass;
|
8704 | this._decls = _decls;
|
8705 | this._vars = _vars;
|
8706 | }
|
8707 | get template_() {
|
8708 | const buf = [];
|
8709 | processTNodeChildren(this.firstChild, buf);
|
8710 | return buf.join('');
|
8711 | }
|
8712 | get type_() {
|
8713 | return TViewTypeAsString[this.type] || `TViewType.?${this.type}?`;
|
8714 | }
|
8715 | };
|
8716 | class TNode {
|
8717 | constructor(tView_, //
|
8718 | type, //
|
8719 | index, //
|
8720 | insertBeforeIndex, //
|
8721 | injectorIndex, //
|
8722 | directiveStart, //
|
8723 | directiveEnd, //
|
8724 | directiveStylingLast, //
|
8725 | propertyBindings, //
|
8726 | flags, //
|
8727 | providerIndexes, //
|
8728 | value, //
|
8729 | attrs, //
|
8730 | mergedAttrs, //
|
8731 | localNames, //
|
8732 | initialInputs, //
|
8733 | inputs, //
|
8734 | outputs, //
|
8735 | tViews, //
|
8736 | next, //
|
8737 | projectionNext, //
|
8738 | child, //
|
8739 | parent, //
|
8740 | projection, //
|
8741 | styles, //
|
8742 | stylesWithoutHost, //
|
8743 | residualStyles, //
|
8744 | classes, //
|
8745 | classesWithoutHost, //
|
8746 | residualClasses, //
|
8747 | classBindings, //
|
8748 | styleBindings) {
|
8749 | this.tView_ = tView_;
|
8750 | this.type = type;
|
8751 | this.index = index;
|
8752 | this.insertBeforeIndex = insertBeforeIndex;
|
8753 | this.injectorIndex = injectorIndex;
|
8754 | this.directiveStart = directiveStart;
|
8755 | this.directiveEnd = directiveEnd;
|
8756 | this.directiveStylingLast = directiveStylingLast;
|
8757 | this.propertyBindings = propertyBindings;
|
8758 | this.flags = flags;
|
8759 | this.providerIndexes = providerIndexes;
|
8760 | this.value = value;
|
8761 | this.attrs = attrs;
|
8762 | this.mergedAttrs = mergedAttrs;
|
8763 | this.localNames = localNames;
|
8764 | this.initialInputs = initialInputs;
|
8765 | this.inputs = inputs;
|
8766 | this.outputs = outputs;
|
8767 | this.tViews = tViews;
|
8768 | this.next = next;
|
8769 | this.projectionNext = projectionNext;
|
8770 | this.child = child;
|
8771 | this.parent = parent;
|
8772 | this.projection = projection;
|
8773 | this.styles = styles;
|
8774 | this.stylesWithoutHost = stylesWithoutHost;
|
8775 | this.residualStyles = residualStyles;
|
8776 | this.classes = classes;
|
8777 | this.classesWithoutHost = classesWithoutHost;
|
8778 | this.residualClasses = residualClasses;
|
8779 | this.classBindings = classBindings;
|
8780 | this.styleBindings = styleBindings;
|
8781 | }
|
8782 | |
8783 |
|
8784 |
|
8785 |
|
8786 |
|
8787 |
|
8788 |
|
8789 |
|
8790 |
|
8791 |
|
8792 |
|
8793 |
|
8794 |
|
8795 | debugNodeInjectorPath(lView) {
|
8796 | const path = [];
|
8797 | let injectorIndex = getInjectorIndex(this, lView);
|
8798 | if (injectorIndex === -1) {
|
8799 |
|
8800 |
|
8801 | const parentLocation = getParentInjectorLocation(this, lView);
|
8802 | if (parentLocation !== NO_PARENT_INJECTOR) {
|
8803 |
|
8804 | injectorIndex = getParentInjectorIndex(parentLocation);
|
8805 | lView = getParentInjectorView(parentLocation, lView);
|
8806 | }
|
8807 | else {
|
8808 |
|
8809 | }
|
8810 | }
|
8811 | while (injectorIndex !== -1) {
|
8812 | ngDevMode && assertNodeInjector(lView, injectorIndex);
|
8813 | const tNode = lView[TVIEW].data[injectorIndex + 8 ];
|
8814 | path.push(buildDebugNode(tNode, lView));
|
8815 | const parentLocation = lView[injectorIndex + 8 ];
|
8816 | if (parentLocation === NO_PARENT_INJECTOR) {
|
8817 | injectorIndex = -1;
|
8818 | }
|
8819 | else {
|
8820 | injectorIndex = getParentInjectorIndex(parentLocation);
|
8821 | lView = getParentInjectorView(parentLocation, lView);
|
8822 | }
|
8823 | }
|
8824 | return path;
|
8825 | }
|
8826 | get type_() {
|
8827 | return toTNodeTypeAsString(this.type) || `TNodeType.?${this.type}?`;
|
8828 | }
|
8829 | get flags_() {
|
8830 | const flags = [];
|
8831 | if (this.flags & 16 )
|
8832 | flags.push('TNodeFlags.hasClassInput');
|
8833 | if (this.flags & 8 )
|
8834 | flags.push('TNodeFlags.hasContentQuery');
|
8835 | if (this.flags & 32 )
|
8836 | flags.push('TNodeFlags.hasStyleInput');
|
8837 | if (this.flags & 128 )
|
8838 | flags.push('TNodeFlags.hasHostBindings');
|
8839 | if (this.flags & 2 )
|
8840 | flags.push('TNodeFlags.isComponentHost');
|
8841 | if (this.flags & 1 )
|
8842 | flags.push('TNodeFlags.isDirectiveHost');
|
8843 | if (this.flags & 64 )
|
8844 | flags.push('TNodeFlags.isDetached');
|
8845 | if (this.flags & 4 )
|
8846 | flags.push('TNodeFlags.isProjected');
|
8847 | return flags.join('|');
|
8848 | }
|
8849 | get template_() {
|
8850 | if (this.type & 1 )
|
8851 | return this.value;
|
8852 | const buf = [];
|
8853 | const tagName = typeof this.value === 'string' && this.value || this.type_;
|
8854 | buf.push('<', tagName);
|
8855 | if (this.flags) {
|
8856 | buf.push(' ', this.flags_);
|
8857 | }
|
8858 | if (this.attrs) {
|
8859 | for (let i = 0; i < this.attrs.length;) {
|
8860 | const attrName = this.attrs[i++];
|
8861 | if (typeof attrName == 'number') {
|
8862 | break;
|
8863 | }
|
8864 | const attrValue = this.attrs[i++];
|
8865 | buf.push(' ', attrName, '="', attrValue, '"');
|
8866 | }
|
8867 | }
|
8868 | buf.push('>');
|
8869 | processTNodeChildren(this.child, buf);
|
8870 | buf.push('</', tagName, '>');
|
8871 | return buf.join('');
|
8872 | }
|
8873 | get styleBindings_() {
|
8874 | return toDebugStyleBinding(this, false);
|
8875 | }
|
8876 | get classBindings_() {
|
8877 | return toDebugStyleBinding(this, true);
|
8878 | }
|
8879 | get providerIndexStart_() {
|
8880 | return this.providerIndexes & 1048575 ;
|
8881 | }
|
8882 | get providerIndexEnd_() {
|
8883 | return this.providerIndexStart_ +
|
8884 | (this.providerIndexes >>> 20 );
|
8885 | }
|
8886 | }
|
8887 | const TNodeDebug = TNode;
|
8888 | function toDebugStyleBinding(tNode, isClassBased) {
|
8889 | const tData = tNode.tView_.data;
|
8890 | const bindings = [];
|
8891 | const range = isClassBased ? tNode.classBindings : tNode.styleBindings;
|
8892 | const prev = getTStylingRangePrev(range);
|
8893 | const next = getTStylingRangeNext(range);
|
8894 | let isTemplate = next !== 0;
|
8895 | let cursor = isTemplate ? next : prev;
|
8896 | while (cursor !== 0) {
|
8897 | const itemKey = tData[cursor];
|
8898 | const itemRange = tData[cursor + 1];
|
8899 | bindings.unshift({
|
8900 | key: itemKey,
|
8901 | index: cursor,
|
8902 | isTemplate: isTemplate,
|
8903 | prevDuplicate: getTStylingRangePrevDuplicate(itemRange),
|
8904 | nextDuplicate: getTStylingRangeNextDuplicate(itemRange),
|
8905 | nextIndex: getTStylingRangeNext(itemRange),
|
8906 | prevIndex: getTStylingRangePrev(itemRange),
|
8907 | });
|
8908 | if (cursor === prev)
|
8909 | isTemplate = false;
|
8910 | cursor = getTStylingRangePrev(itemRange);
|
8911 | }
|
8912 | bindings.push((isClassBased ? tNode.residualClasses : tNode.residualStyles) || null);
|
8913 | return bindings;
|
8914 | }
|
8915 | function processTNodeChildren(tNode, buf) {
|
8916 | while (tNode) {
|
8917 | buf.push(tNode.template_);
|
8918 | tNode = tNode.next;
|
8919 | }
|
8920 | }
|
8921 | class TViewData extends Array {
|
8922 | }
|
8923 | let TVIEWDATA_EMPTY;
|
8924 |
|
8925 |
|
8926 |
|
8927 |
|
8928 |
|
8929 |
|
8930 | function cloneToTViewData(list) {
|
8931 | if (TVIEWDATA_EMPTY === undefined)
|
8932 | TVIEWDATA_EMPTY = new TViewData();
|
8933 | return TVIEWDATA_EMPTY.concat(list);
|
8934 | }
|
8935 | class LViewBlueprint extends Array {
|
8936 | }
|
8937 | class MatchesArray extends Array {
|
8938 | }
|
8939 | class TViewComponents extends Array {
|
8940 | }
|
8941 | class TNodeLocalNames extends Array {
|
8942 | }
|
8943 | class TNodeInitialInputs extends Array {
|
8944 | }
|
8945 | class LCleanup extends Array {
|
8946 | }
|
8947 | class TCleanup extends Array {
|
8948 | }
|
8949 | function attachLViewDebug(lView) {
|
8950 | attachDebugObject(lView, new LViewDebug(lView));
|
8951 | }
|
8952 | function attachLContainerDebug(lContainer) {
|
8953 | attachDebugObject(lContainer, new LContainerDebug(lContainer));
|
8954 | }
|
8955 | function toDebug(obj) {
|
8956 | if (obj) {
|
8957 | const debug = obj.debug;
|
8958 | assertDefined(debug, 'Object does not have a debug representation.');
|
8959 | return debug;
|
8960 | }
|
8961 | else {
|
8962 | return obj;
|
8963 | }
|
8964 | }
|
8965 |
|
8966 |
|
8967 |
|
8968 |
|
8969 |
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 |
|
8976 | function toHtml(value, includeChildren = false) {
|
8977 | const node = unwrapRNode(value);
|
8978 | if (node) {
|
8979 | switch (node.nodeType) {
|
8980 | case Node.TEXT_NODE:
|
8981 | return node.textContent;
|
8982 | case Node.COMMENT_NODE:
|
8983 | return `<!--${node.textContent}-->`;
|
8984 | case Node.ELEMENT_NODE:
|
8985 | const outerHTML = node.outerHTML;
|
8986 | if (includeChildren) {
|
8987 | return outerHTML;
|
8988 | }
|
8989 | else {
|
8990 | const innerHTML = '>' + node.innerHTML + '<';
|
8991 | return (outerHTML.split(innerHTML)[0]) + '>';
|
8992 | }
|
8993 | }
|
8994 | }
|
8995 | return null;
|
8996 | }
|
8997 | class LViewDebug {
|
8998 | constructor(_raw_lView) {
|
8999 | this._raw_lView = _raw_lView;
|
9000 | }
|
9001 | |
9002 |
|
9003 |
|
9004 | get flags() {
|
9005 | const flags = this._raw_lView[FLAGS];
|
9006 | return {
|
9007 | __raw__flags__: flags,
|
9008 | initPhaseState: flags & 3 ,
|
9009 | creationMode: !!(flags & 4 ),
|
9010 | firstViewPass: !!(flags & 8 ),
|
9011 | checkAlways: !!(flags & 16 ),
|
9012 | dirty: !!(flags & 64 ),
|
9013 | attached: !!(flags & 128 ),
|
9014 | destroyed: !!(flags & 256 ),
|
9015 | isRoot: !!(flags & 512 ),
|
9016 | indexWithinInitPhase: flags >> 11 ,
|
9017 | };
|
9018 | }
|
9019 | get parent() {
|
9020 | return toDebug(this._raw_lView[PARENT]);
|
9021 | }
|
9022 | get hostHTML() {
|
9023 | return toHtml(this._raw_lView[HOST], true);
|
9024 | }
|
9025 | get html() {
|
9026 | return (this.nodes || []).map(mapToHTML).join('');
|
9027 | }
|
9028 | get context() {
|
9029 | return this._raw_lView[CONTEXT];
|
9030 | }
|
9031 | |
9032 |
|
9033 |
|
9034 |
|
9035 | get nodes() {
|
9036 | const lView = this._raw_lView;
|
9037 | const tNode = lView[TVIEW].firstChild;
|
9038 | return toDebugNodes(tNode, lView);
|
9039 | }
|
9040 | get template() {
|
9041 | return this.tView.template_;
|
9042 | }
|
9043 | get tView() {
|
9044 | return this._raw_lView[TVIEW];
|
9045 | }
|
9046 | get cleanup() {
|
9047 | return this._raw_lView[CLEANUP];
|
9048 | }
|
9049 | get injector() {
|
9050 | return this._raw_lView[INJECTOR$1];
|
9051 | }
|
9052 | get rendererFactory() {
|
9053 | return this._raw_lView[RENDERER_FACTORY];
|
9054 | }
|
9055 | get renderer() {
|
9056 | return this._raw_lView[RENDERER];
|
9057 | }
|
9058 | get sanitizer() {
|
9059 | return this._raw_lView[SANITIZER];
|
9060 | }
|
9061 | get childHead() {
|
9062 | return toDebug(this._raw_lView[CHILD_HEAD]);
|
9063 | }
|
9064 | get next() {
|
9065 | return toDebug(this._raw_lView[NEXT]);
|
9066 | }
|
9067 | get childTail() {
|
9068 | return toDebug(this._raw_lView[CHILD_TAIL]);
|
9069 | }
|
9070 | get declarationView() {
|
9071 | return toDebug(this._raw_lView[DECLARATION_VIEW]);
|
9072 | }
|
9073 | get queries() {
|
9074 | return this._raw_lView[QUERIES];
|
9075 | }
|
9076 | get tHost() {
|
9077 | return this._raw_lView[T_HOST];
|
9078 | }
|
9079 | get decls() {
|
9080 | return toLViewRange(this.tView, this._raw_lView, HEADER_OFFSET, this.tView.bindingStartIndex);
|
9081 | }
|
9082 | get vars() {
|
9083 | return toLViewRange(this.tView, this._raw_lView, this.tView.bindingStartIndex, this.tView.expandoStartIndex);
|
9084 | }
|
9085 | get expando() {
|
9086 | return toLViewRange(this.tView, this._raw_lView, this.tView.expandoStartIndex, this._raw_lView.length);
|
9087 | }
|
9088 | |
9089 |
|
9090 |
|
9091 | get childViews() {
|
9092 | const childViews = [];
|
9093 | let child = this.childHead;
|
9094 | while (child) {
|
9095 | childViews.push(child);
|
9096 | child = child.next;
|
9097 | }
|
9098 | return childViews;
|
9099 | }
|
9100 | }
|
9101 | function mapToHTML(node) {
|
9102 | if (node.type === 'ElementContainer') {
|
9103 | return (node.children || []).map(mapToHTML).join('');
|
9104 | }
|
9105 | else if (node.type === 'IcuContainer') {
|
9106 | throw new Error('Not implemented');
|
9107 | }
|
9108 | else {
|
9109 | return toHtml(node.native, true) || '';
|
9110 | }
|
9111 | }
|
9112 | function toLViewRange(tView, lView, start, end) {
|
9113 | let content = [];
|
9114 | for (let index = start; index < end; index++) {
|
9115 | content.push({ index: index, t: tView.data[index], l: lView[index] });
|
9116 | }
|
9117 | return { start: start, end: end, length: end - start, content: content };
|
9118 | }
|
9119 |
|
9120 |
|
9121 |
|
9122 |
|
9123 |
|
9124 |
|
9125 | function toDebugNodes(tNode, lView) {
|
9126 | if (tNode) {
|
9127 | const debugNodes = [];
|
9128 | let tNodeCursor = tNode;
|
9129 | while (tNodeCursor) {
|
9130 | debugNodes.push(buildDebugNode(tNodeCursor, lView));
|
9131 | tNodeCursor = tNodeCursor.next;
|
9132 | }
|
9133 | return debugNodes;
|
9134 | }
|
9135 | else {
|
9136 | return [];
|
9137 | }
|
9138 | }
|
9139 | function buildDebugNode(tNode, lView) {
|
9140 | const rawValue = lView[tNode.index];
|
9141 | const native = unwrapRNode(rawValue);
|
9142 | const factories = [];
|
9143 | const instances = [];
|
9144 | const tView = lView[TVIEW];
|
9145 | for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
|
9146 | const def = tView.data[i];
|
9147 | factories.push(def.type);
|
9148 | instances.push(lView[i]);
|
9149 | }
|
9150 | return {
|
9151 | html: toHtml(native),
|
9152 | type: toTNodeTypeAsString(tNode.type),
|
9153 | tNode,
|
9154 | native: native,
|
9155 | children: toDebugNodes(tNode.child, lView),
|
9156 | factories,
|
9157 | instances,
|
9158 | injector: buildNodeInjectorDebug(tNode, tView, lView),
|
9159 | get injectorResolutionPath() {
|
9160 | return tNode.debugNodeInjectorPath(lView);
|
9161 | },
|
9162 | };
|
9163 | }
|
9164 | function buildNodeInjectorDebug(tNode, tView, lView) {
|
9165 | const viewProviders = [];
|
9166 | for (let i = tNode.providerIndexStart_; i < tNode.providerIndexEnd_; i++) {
|
9167 | viewProviders.push(tView.data[i]);
|
9168 | }
|
9169 | const providers = [];
|
9170 | for (let i = tNode.providerIndexEnd_; i < tNode.directiveEnd; i++) {
|
9171 | providers.push(tView.data[i]);
|
9172 | }
|
9173 | const nodeInjectorDebug = {
|
9174 | bloom: toBloom(lView, tNode.injectorIndex),
|
9175 | cumulativeBloom: toBloom(tView.data, tNode.injectorIndex),
|
9176 | providers,
|
9177 | viewProviders,
|
9178 | parentInjectorIndex: lView[tNode.providerIndexStart_ - 1],
|
9179 | };
|
9180 | return nodeInjectorDebug;
|
9181 | }
|
9182 |
|
9183 |
|
9184 |
|
9185 |
|
9186 |
|
9187 |
|
9188 | function binary(array, idx) {
|
9189 | const value = array[idx];
|
9190 |
|
9191 |
|
9192 | if (typeof value !== 'number')
|
9193 | return '????????';
|
9194 |
|
9195 | const text = '00000000' + value.toString(2);
|
9196 | return text.substring(text.length - 8);
|
9197 | }
|
9198 |
|
9199 |
|
9200 |
|
9201 |
|
9202 |
|
9203 |
|
9204 | function toBloom(array, idx) {
|
9205 | if (idx < 0) {
|
9206 | return 'NO_NODE_INJECTOR';
|
9207 | }
|
9208 | return `${binary(array, idx + 7)}_${binary(array, idx + 6)}_${binary(array, idx + 5)}_${binary(array, idx + 4)}_${binary(array, idx + 3)}_${binary(array, idx + 2)}_${binary(array, idx + 1)}_${binary(array, idx + 0)}`;
|
9209 | }
|
9210 | class LContainerDebug {
|
9211 | constructor(_raw_lContainer) {
|
9212 | this._raw_lContainer = _raw_lContainer;
|
9213 | }
|
9214 | get hasTransplantedViews() {
|
9215 | return this._raw_lContainer[HAS_TRANSPLANTED_VIEWS];
|
9216 | }
|
9217 | get views() {
|
9218 | return this._raw_lContainer.slice(CONTAINER_HEADER_OFFSET)
|
9219 | .map(toDebug);
|
9220 | }
|
9221 | get parent() {
|
9222 | return toDebug(this._raw_lContainer[PARENT]);
|
9223 | }
|
9224 | get movedViews() {
|
9225 | return this._raw_lContainer[MOVED_VIEWS];
|
9226 | }
|
9227 | get host() {
|
9228 | return this._raw_lContainer[HOST];
|
9229 | }
|
9230 | get native() {
|
9231 | return this._raw_lContainer[NATIVE];
|
9232 | }
|
9233 | get next() {
|
9234 | return toDebug(this._raw_lContainer[NEXT]);
|
9235 | }
|
9236 | }
|
9237 |
|
9238 |
|
9239 |
|
9240 |
|
9241 |
|
9242 | const _CLEAN_PROMISE = (() => Promise.resolve(null))();
|
9243 |
|
9244 |
|
9245 |
|
9246 |
|
9247 |
|
9248 |
|
9249 |
|
9250 |
|
9251 |
|
9252 | function processHostBindingOpCodes(tView, lView) {
|
9253 | const hostBindingOpCodes = tView.hostBindingOpCodes;
|
9254 | if (hostBindingOpCodes === null)
|
9255 | return;
|
9256 | try {
|
9257 | for (let i = 0; i < hostBindingOpCodes.length; i++) {
|
9258 | const opCode = hostBindingOpCodes[i];
|
9259 | if (opCode < 0) {
|
9260 |
|
9261 | setSelectedIndex(~opCode);
|
9262 | }
|
9263 | else {
|
9264 |
|
9265 | const directiveIdx = opCode;
|
9266 | const bindingRootIndx = hostBindingOpCodes[++i];
|
9267 | const hostBindingFn = hostBindingOpCodes[++i];
|
9268 | setBindingRootForHostBindings(bindingRootIndx, directiveIdx);
|
9269 | const context = lView[directiveIdx];
|
9270 | hostBindingFn(2 , context);
|
9271 | }
|
9272 | }
|
9273 | }
|
9274 | finally {
|
9275 | setSelectedIndex(-1);
|
9276 | }
|
9277 | }
|
9278 |
|
9279 | function refreshContentQueries(tView, lView) {
|
9280 | const contentQueries = tView.contentQueries;
|
9281 | if (contentQueries !== null) {
|
9282 | for (let i = 0; i < contentQueries.length; i += 2) {
|
9283 | const queryStartIdx = contentQueries[i];
|
9284 | const directiveDefIdx = contentQueries[i + 1];
|
9285 | if (directiveDefIdx !== -1) {
|
9286 | const directiveDef = tView.data[directiveDefIdx];
|
9287 | ngDevMode && assertDefined(directiveDef, 'DirectiveDef not found.');
|
9288 | ngDevMode &&
|
9289 | assertDefined(directiveDef.contentQueries, 'contentQueries function should be defined');
|
9290 | setCurrentQueryIndex(queryStartIdx);
|
9291 | directiveDef.contentQueries(2 , lView[directiveDefIdx], directiveDefIdx);
|
9292 | }
|
9293 | }
|
9294 | }
|
9295 | }
|
9296 |
|
9297 | function refreshChildComponents(hostLView, components) {
|
9298 | for (let i = 0; i < components.length; i++) {
|
9299 | refreshComponent(hostLView, components[i]);
|
9300 | }
|
9301 | }
|
9302 |
|
9303 | function renderChildComponents(hostLView, components) {
|
9304 | for (let i = 0; i < components.length; i++) {
|
9305 | renderComponent$1(hostLView, components[i]);
|
9306 | }
|
9307 | }
|
9308 | function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector) {
|
9309 | const lView = ngDevMode ? cloneToLViewFromTViewBlueprint(tView) : tView.blueprint.slice();
|
9310 | lView[HOST] = host;
|
9311 | lView[FLAGS] = flags | 4 | 128 | 8 ;
|
9312 | resetPreOrderHookFlags(lView);
|
9313 | ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView);
|
9314 | lView[PARENT] = lView[DECLARATION_VIEW] = parentLView;
|
9315 | lView[CONTEXT] = context;
|
9316 | lView[RENDERER_FACTORY] = (rendererFactory || parentLView && parentLView[RENDERER_FACTORY]);
|
9317 | ngDevMode && assertDefined(lView[RENDERER_FACTORY], 'RendererFactory is required');
|
9318 | lView[RENDERER] = (renderer || parentLView && parentLView[RENDERER]);
|
9319 | ngDevMode && assertDefined(lView[RENDERER], 'Renderer is required');
|
9320 | lView[SANITIZER] = sanitizer || parentLView && parentLView[SANITIZER] || null;
|
9321 | lView[INJECTOR$1] = injector || parentLView && parentLView[INJECTOR$1] || null;
|
9322 | lView[T_HOST] = tHostNode;
|
9323 | ngDevMode &&
|
9324 | assertEqual(tView.type == 2 ? parentLView !== null : true, true, 'Embedded views must have parentLView');
|
9325 | lView[DECLARATION_COMPONENT_VIEW] =
|
9326 | tView.type == 2 ? parentLView[DECLARATION_COMPONENT_VIEW] : lView;
|
9327 | ngDevMode && attachLViewDebug(lView);
|
9328 | return lView;
|
9329 | }
|
9330 | function getOrCreateTNode(tView, index, type, name, attrs) {
|
9331 | ngDevMode && index !== 0 &&
|
9332 |
|
9333 | assertGreaterThanOrEqual(index, HEADER_OFFSET, 'TNodes can\'t be in the LView header.');
|
9334 |
|
9335 | ngDevMode && assertPureTNodeType(type);
|
9336 | let tNode = tView.data[index];
|
9337 | if (tNode === null) {
|
9338 | tNode = createTNodeAtIndex(tView, index, type, name, attrs);
|
9339 | if (isInI18nBlock()) {
|
9340 |
|
9341 |
|
9342 |
|
9343 |
|
9344 | tNode.flags |= 64 ;
|
9345 | }
|
9346 | }
|
9347 | else if (tNode.type & 64 ) {
|
9348 | tNode.type = type;
|
9349 | tNode.value = name;
|
9350 | tNode.attrs = attrs;
|
9351 | const parent = getCurrentParentTNode();
|
9352 | tNode.injectorIndex = parent === null ? -1 : parent.injectorIndex;
|
9353 | ngDevMode && assertTNodeForTView(tNode, tView);
|
9354 | ngDevMode && assertEqual(index, tNode.index, 'Expecting same index');
|
9355 | }
|
9356 | setCurrentTNode(tNode, true);
|
9357 | return tNode;
|
9358 | }
|
9359 | function createTNodeAtIndex(tView, index, type, name, attrs) {
|
9360 | const currentTNode = getCurrentTNodePlaceholderOk();
|
9361 | const isParent = isCurrentTNodeParent();
|
9362 | const parent = isParent ? currentTNode : currentTNode && currentTNode.parent;
|
9363 |
|
9364 | const tNode = tView.data[index] =
|
9365 | createTNode(tView, parent, type, index, name, attrs);
|
9366 |
|
9367 |
|
9368 |
|
9369 | if (tView.firstChild === null) {
|
9370 | tView.firstChild = tNode;
|
9371 | }
|
9372 | if (currentTNode !== null) {
|
9373 | if (isParent) {
|
9374 |
|
9375 | if (currentTNode.child == null && tNode.parent !== null) {
|
9376 |
|
9377 | currentTNode.child = tNode;
|
9378 | }
|
9379 | }
|
9380 | else {
|
9381 | if (currentTNode.next === null) {
|
9382 |
|
9383 |
|
9384 | currentTNode.next = tNode;
|
9385 | }
|
9386 | }
|
9387 | }
|
9388 | return tNode;
|
9389 | }
|
9390 |
|
9391 |
|
9392 |
|
9393 |
|
9394 |
|
9395 |
|
9396 |
|
9397 |
|
9398 |
|
9399 |
|
9400 | function allocExpando(tView, lView, numSlotsToAlloc, initialValue) {
|
9401 | if (numSlotsToAlloc === 0)
|
9402 | return -1;
|
9403 | if (ngDevMode) {
|
9404 | assertFirstCreatePass(tView);
|
9405 | assertSame(tView, lView[TVIEW], '`LView` must be associated with `TView`!');
|
9406 | assertEqual(tView.data.length, lView.length, 'Expecting LView to be same size as TView');
|
9407 | assertEqual(tView.data.length, tView.blueprint.length, 'Expecting Blueprint to be same size as TView');
|
9408 | assertFirstUpdatePass(tView);
|
9409 | }
|
9410 | const allocIdx = lView.length;
|
9411 | for (let i = 0; i < numSlotsToAlloc; i++) {
|
9412 | lView.push(initialValue);
|
9413 | tView.blueprint.push(initialValue);
|
9414 | tView.data.push(null);
|
9415 | }
|
9416 | return allocIdx;
|
9417 | }
|
9418 |
|
9419 |
|
9420 |
|
9421 |
|
9422 |
|
9423 |
|
9424 |
|
9425 |
|
9426 |
|
9427 |
|
9428 | function renderView(tView, lView, context) {
|
9429 | ngDevMode && assertEqual(isCreationMode(lView), true, 'Should be run in creation mode');
|
9430 | enterView(lView);
|
9431 | try {
|
9432 | const viewQuery = tView.viewQuery;
|
9433 | if (viewQuery !== null) {
|
9434 | executeViewQueryFn(1 , viewQuery, context);
|
9435 | }
|
9436 |
|
9437 |
|
9438 | const templateFn = tView.template;
|
9439 | if (templateFn !== null) {
|
9440 | executeTemplate(tView, lView, templateFn, 1 , context);
|
9441 | }
|
9442 |
|
9443 |
|
9444 |
|
9445 |
|
9446 |
|
9447 | if (tView.firstCreatePass) {
|
9448 | tView.firstCreatePass = false;
|
9449 | }
|
9450 |
|
9451 |
|
9452 |
|
9453 | if (tView.staticContentQueries) {
|
9454 | refreshContentQueries(tView, lView);
|
9455 | }
|
9456 |
|
9457 |
|
9458 |
|
9459 | if (tView.staticViewQueries) {
|
9460 | executeViewQueryFn(2 , tView.viewQuery, context);
|
9461 | }
|
9462 |
|
9463 | const components = tView.components;
|
9464 | if (components !== null) {
|
9465 | renderChildComponents(lView, components);
|
9466 | }
|
9467 | }
|
9468 | catch (error) {
|
9469 |
|
9470 |
|
9471 | if (tView.firstCreatePass) {
|
9472 | tView.incompleteFirstPass = true;
|
9473 | tView.firstCreatePass = false;
|
9474 | }
|
9475 | throw error;
|
9476 | }
|
9477 | finally {
|
9478 | lView[FLAGS] &= ~4 ;
|
9479 | leaveView();
|
9480 | }
|
9481 | }
|
9482 |
|
9483 |
|
9484 |
|
9485 |
|
9486 |
|
9487 |
|
9488 |
|
9489 |
|
9490 | function refreshView(tView, lView, templateFn, context) {
|
9491 | ngDevMode && assertEqual(isCreationMode(lView), false, 'Should be run in update mode');
|
9492 | const flags = lView[FLAGS];
|
9493 | if ((flags & 256 ) === 256 )
|
9494 | return;
|
9495 | enterView(lView);
|
9496 |
|
9497 |
|
9498 | const isInCheckNoChangesPass = isInCheckNoChangesMode();
|
9499 | try {
|
9500 | resetPreOrderHookFlags(lView);
|
9501 | setBindingIndex(tView.bindingStartIndex);
|
9502 | if (templateFn !== null) {
|
9503 | executeTemplate(tView, lView, templateFn, 2 , context);
|
9504 | }
|
9505 | const hooksInitPhaseCompleted = (flags & 3 ) === 3 ;
|
9506 |
|
9507 |
|
9508 | if (!isInCheckNoChangesPass) {
|
9509 | if (hooksInitPhaseCompleted) {
|
9510 | const preOrderCheckHooks = tView.preOrderCheckHooks;
|
9511 | if (preOrderCheckHooks !== null) {
|
9512 | executeCheckHooks(lView, preOrderCheckHooks, null);
|
9513 | }
|
9514 | }
|
9515 | else {
|
9516 | const preOrderHooks = tView.preOrderHooks;
|
9517 | if (preOrderHooks !== null) {
|
9518 | executeInitAndCheckHooks(lView, preOrderHooks, 0 , null);
|
9519 | }
|
9520 | incrementInitPhaseFlags(lView, 0 );
|
9521 | }
|
9522 | }
|
9523 |
|
9524 |
|
9525 |
|
9526 | markTransplantedViewsForRefresh(lView);
|
9527 | refreshEmbeddedViews(lView);
|
9528 |
|
9529 | if (tView.contentQueries !== null) {
|
9530 | refreshContentQueries(tView, lView);
|
9531 | }
|
9532 |
|
9533 |
|
9534 | if (!isInCheckNoChangesPass) {
|
9535 | if (hooksInitPhaseCompleted) {
|
9536 | const contentCheckHooks = tView.contentCheckHooks;
|
9537 | if (contentCheckHooks !== null) {
|
9538 | executeCheckHooks(lView, contentCheckHooks);
|
9539 | }
|
9540 | }
|
9541 | else {
|
9542 | const contentHooks = tView.contentHooks;
|
9543 | if (contentHooks !== null) {
|
9544 | executeInitAndCheckHooks(lView, contentHooks, 1 );
|
9545 | }
|
9546 | incrementInitPhaseFlags(lView, 1 );
|
9547 | }
|
9548 | }
|
9549 | processHostBindingOpCodes(tView, lView);
|
9550 |
|
9551 | const components = tView.components;
|
9552 | if (components !== null) {
|
9553 | refreshChildComponents(lView, components);
|
9554 | }
|
9555 |
|
9556 |
|
9557 |
|
9558 | const viewQuery = tView.viewQuery;
|
9559 | if (viewQuery !== null) {
|
9560 | executeViewQueryFn(2 , viewQuery, context);
|
9561 | }
|
9562 |
|
9563 |
|
9564 | if (!isInCheckNoChangesPass) {
|
9565 | if (hooksInitPhaseCompleted) {
|
9566 | const viewCheckHooks = tView.viewCheckHooks;
|
9567 | if (viewCheckHooks !== null) {
|
9568 | executeCheckHooks(lView, viewCheckHooks);
|
9569 | }
|
9570 | }
|
9571 | else {
|
9572 | const viewHooks = tView.viewHooks;
|
9573 | if (viewHooks !== null) {
|
9574 | executeInitAndCheckHooks(lView, viewHooks, 2 );
|
9575 | }
|
9576 | incrementInitPhaseFlags(lView, 2 );
|
9577 | }
|
9578 | }
|
9579 | if (tView.firstUpdatePass === true) {
|
9580 |
|
9581 |
|
9582 |
|
9583 |
|
9584 |
|
9585 |
|
9586 | tView.firstUpdatePass = false;
|
9587 | }
|
9588 |
|
9589 |
|
9590 |
|
9591 |
|
9592 |
|
9593 |
|
9594 | if (!isInCheckNoChangesPass) {
|
9595 | lView[FLAGS] &= ~(64 | 8 );
|
9596 | }
|
9597 | if (lView[FLAGS] & 1024 ) {
|
9598 | lView[FLAGS] &= ~1024 ;
|
9599 | updateTransplantedViewCount(lView[PARENT], -1);
|
9600 | }
|
9601 | }
|
9602 | finally {
|
9603 | leaveView();
|
9604 | }
|
9605 | }
|
9606 | function renderComponentOrTemplate(tView, lView, templateFn, context) {
|
9607 | const rendererFactory = lView[RENDERER_FACTORY];
|
9608 | const normalExecutionPath = !isInCheckNoChangesMode();
|
9609 | const creationModeIsActive = isCreationMode(lView);
|
9610 | try {
|
9611 | if (normalExecutionPath && !creationModeIsActive && rendererFactory.begin) {
|
9612 | rendererFactory.begin();
|
9613 | }
|
9614 | if (creationModeIsActive) {
|
9615 | renderView(tView, lView, context);
|
9616 | }
|
9617 | refreshView(tView, lView, templateFn, context);
|
9618 | }
|
9619 | finally {
|
9620 | if (normalExecutionPath && !creationModeIsActive && rendererFactory.end) {
|
9621 | rendererFactory.end();
|
9622 | }
|
9623 | }
|
9624 | }
|
9625 | function executeTemplate(tView, lView, templateFn, rf, context) {
|
9626 | const prevSelectedIndex = getSelectedIndex();
|
9627 | const isUpdatePhase = rf & 2 ;
|
9628 | try {
|
9629 | setSelectedIndex(-1);
|
9630 | if (isUpdatePhase && lView.length > HEADER_OFFSET) {
|
9631 |
|
9632 |
|
9633 | selectIndexInternal(tView, lView, HEADER_OFFSET, isInCheckNoChangesMode());
|
9634 | }
|
9635 | const preHookType = isUpdatePhase ? 2 : 0 ;
|
9636 | profiler(preHookType, context);
|
9637 | templateFn(rf, context);
|
9638 | }
|
9639 | finally {
|
9640 | setSelectedIndex(prevSelectedIndex);
|
9641 | const postHookType = isUpdatePhase ? 3 : 1 ;
|
9642 | profiler(postHookType, context);
|
9643 | }
|
9644 | }
|
9645 |
|
9646 |
|
9647 |
|
9648 | function executeContentQueries(tView, tNode, lView) {
|
9649 | if (isContentQueryHost(tNode)) {
|
9650 | const start = tNode.directiveStart;
|
9651 | const end = tNode.directiveEnd;
|
9652 | for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
|
9653 | const def = tView.data[directiveIndex];
|
9654 | if (def.contentQueries) {
|
9655 | def.contentQueries(1 , lView[directiveIndex], directiveIndex);
|
9656 | }
|
9657 | }
|
9658 | }
|
9659 | }
|
9660 |
|
9661 |
|
9662 |
|
9663 | function createDirectivesInstances(tView, lView, tNode) {
|
9664 | if (!getBindingsEnabled())
|
9665 | return;
|
9666 | instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView));
|
9667 | if ((tNode.flags & 128 ) === 128 ) {
|
9668 | invokeDirectivesHostBindings(tView, lView, tNode);
|
9669 | }
|
9670 | }
|
9671 |
|
9672 |
|
9673 |
|
9674 |
|
9675 | function saveResolvedLocalsInData(viewData, tNode, localRefExtractor = getNativeByTNode) {
|
9676 | const localNames = tNode.localNames;
|
9677 | if (localNames !== null) {
|
9678 | let localIndex = tNode.index + 1;
|
9679 | for (let i = 0; i < localNames.length; i += 2) {
|
9680 | const index = localNames[i + 1];
|
9681 | const value = index === -1 ?
|
9682 | localRefExtractor(tNode, viewData) :
|
9683 | viewData[index];
|
9684 | viewData[localIndex++] = value;
|
9685 | }
|
9686 | }
|
9687 | }
|
9688 |
|
9689 |
|
9690 |
|
9691 |
|
9692 |
|
9693 |
|
9694 |
|
9695 | function getOrCreateTComponentView(def) {
|
9696 | const tView = def.tView;
|
9697 |
|
9698 |
|
9699 | if (tView === null || tView.incompleteFirstPass) {
|
9700 |
|
9701 |
|
9702 | const declTNode = null;
|
9703 | return def.tView = createTView(1 , declTNode, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts);
|
9704 | }
|
9705 | return tView;
|
9706 | }
|
9707 |
|
9708 |
|
9709 |
|
9710 |
|
9711 |
|
9712 |
|
9713 |
|
9714 |
|
9715 |
|
9716 |
|
9717 |
|
9718 |
|
9719 |
|
9720 | function createTView(type, declTNode, templateFn, decls, vars, directives, pipes, viewQuery, schemas, constsOrFactory) {
|
9721 | ngDevMode && ngDevMode.tView++;
|
9722 | const bindingStartIndex = HEADER_OFFSET + decls;
|
9723 |
|
9724 |
|
9725 |
|
9726 | const initialViewLength = bindingStartIndex + vars;
|
9727 | const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength);
|
9728 | const consts = typeof constsOrFactory === 'function' ? constsOrFactory() : constsOrFactory;
|
9729 | const tView = blueprint[TVIEW] = ngDevMode ?
|
9730 | new TViewConstructor(type,
|
9731 | blueprint,
|
9732 | templateFn,
|
9733 | null,
|
9734 | viewQuery,
|
9735 | declTNode,
|
9736 | cloneToTViewData(blueprint).fill(null, bindingStartIndex),
|
9737 | bindingStartIndex,
|
9738 | initialViewLength,
|
9739 | null,
|
9740 | true,
|
9741 | true,
|
9742 | false,
|
9743 | false,
|
9744 | null,
|
9745 | null,
|
9746 | null,
|
9747 | null,
|
9748 | null,
|
9749 | null,
|
9750 | null,
|
9751 | null,
|
9752 | null,
|
9753 | null,
|
9754 | typeof directives === 'function' ?
|
9755 | directives() :
|
9756 | directives,
|
9757 | typeof pipes === 'function' ? pipes() : pipes,
|
9758 | null,
|
9759 | schemas,
|
9760 | consts,
|
9761 | false,
|
9762 | decls,
|
9763 | vars) :
|
9764 | {
|
9765 | type: type,
|
9766 | blueprint: blueprint,
|
9767 | template: templateFn,
|
9768 | queries: null,
|
9769 | viewQuery: viewQuery,
|
9770 | declTNode: declTNode,
|
9771 | data: blueprint.slice().fill(null, bindingStartIndex),
|
9772 | bindingStartIndex: bindingStartIndex,
|
9773 | expandoStartIndex: initialViewLength,
|
9774 | hostBindingOpCodes: null,
|
9775 | firstCreatePass: true,
|
9776 | firstUpdatePass: true,
|
9777 | staticViewQueries: false,
|
9778 | staticContentQueries: false,
|
9779 | preOrderHooks: null,
|
9780 | preOrderCheckHooks: null,
|
9781 | contentHooks: null,
|
9782 | contentCheckHooks: null,
|
9783 | viewHooks: null,
|
9784 | viewCheckHooks: null,
|
9785 | destroyHooks: null,
|
9786 | cleanup: null,
|
9787 | contentQueries: null,
|
9788 | components: null,
|
9789 | directiveRegistry: typeof directives === 'function' ? directives() : directives,
|
9790 | pipeRegistry: typeof pipes === 'function' ? pipes() : pipes,
|
9791 | firstChild: null,
|
9792 | schemas: schemas,
|
9793 | consts: consts,
|
9794 | incompleteFirstPass: false
|
9795 | };
|
9796 | if (ngDevMode) {
|
9797 |
|
9798 |
|
9799 |
|
9800 | Object.seal(tView);
|
9801 | }
|
9802 | return tView;
|
9803 | }
|
9804 | function createViewBlueprint(bindingStartIndex, initialViewLength) {
|
9805 | const blueprint = ngDevMode ? new LViewBlueprint() : [];
|
9806 | for (let i = 0; i < initialViewLength; i++) {
|
9807 | blueprint.push(i < bindingStartIndex ? null : NO_CHANGE);
|
9808 | }
|
9809 | return blueprint;
|
9810 | }
|
9811 | function createError(text, token) {
|
9812 | return new Error(`Renderer: ${text} [${stringifyForError(token)}]`);
|
9813 | }
|
9814 | function assertHostNodeExists(rElement, elementOrSelector) {
|
9815 | if (!rElement) {
|
9816 | if (typeof elementOrSelector === 'string') {
|
9817 | throw createError('Host node with selector not found:', elementOrSelector);
|
9818 | }
|
9819 | else {
|
9820 | throw createError('Host node is required:', elementOrSelector);
|
9821 | }
|
9822 | }
|
9823 | }
|
9824 |
|
9825 |
|
9826 |
|
9827 |
|
9828 |
|
9829 |
|
9830 |
|
9831 | function locateHostElement(renderer, elementOrSelector, encapsulation) {
|
9832 | if (isProceduralRenderer(renderer)) {
|
9833 |
|
9834 | const preserveContent = encapsulation === ViewEncapsulation$1.ShadowDom;
|
9835 | return renderer.selectRootElement(elementOrSelector, preserveContent);
|
9836 | }
|
9837 | let rElement = typeof elementOrSelector === 'string' ?
|
9838 | renderer.querySelector(elementOrSelector) :
|
9839 | elementOrSelector;
|
9840 | ngDevMode && assertHostNodeExists(rElement, elementOrSelector);
|
9841 |
|
9842 |
|
9843 |
|
9844 |
|
9845 | rElement.textContent = '';
|
9846 | return rElement;
|
9847 | }
|
9848 |
|
9849 |
|
9850 |
|
9851 |
|
9852 |
|
9853 |
|
9854 |
|
9855 |
|
9856 |
|
9857 |
|
9858 | function storeCleanupWithContext(tView, lView, context, cleanupFn) {
|
9859 | const lCleanup = getOrCreateLViewCleanup(lView);
|
9860 | if (context === null) {
|
9861 |
|
9862 |
|
9863 | if (ngDevMode) {
|
9864 | Object.freeze(getOrCreateTViewCleanup(tView));
|
9865 | }
|
9866 | lCleanup.push(cleanupFn);
|
9867 | }
|
9868 | else {
|
9869 | lCleanup.push(context);
|
9870 | if (tView.firstCreatePass) {
|
9871 | getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
|
9872 | }
|
9873 | }
|
9874 | }
|
9875 | function createTNode(tView, tParent, type, index, value, attrs) {
|
9876 | ngDevMode && index !== 0 &&
|
9877 |
|
9878 | assertGreaterThanOrEqual(index, HEADER_OFFSET, 'TNodes can\'t be in the LView header.');
|
9879 | ngDevMode && assertNotSame(attrs, undefined, '\'undefined\' is not valid value for \'attrs\'');
|
9880 | ngDevMode && ngDevMode.tNode++;
|
9881 | ngDevMode && tParent && assertTNodeForTView(tParent, tView);
|
9882 | let injectorIndex = tParent ? tParent.injectorIndex : -1;
|
9883 | const tNode = ngDevMode ?
|
9884 | new TNodeDebug(tView,
|
9885 | type,
|
9886 | index,
|
9887 | null,
|
9888 | injectorIndex,
|
9889 | -1,
|
9890 | -1,
|
9891 | -1,
|
9892 | null,
|
9893 | 0,
|
9894 | 0,
|
9895 | value,
|
9896 | attrs,
|
9897 | null,
|
9898 | null,
|
9899 | undefined,
|
9900 | null,
|
9901 | null,
|
9902 | null,
|
9903 | null,
|
9904 | null,
|
9905 | null,
|
9906 | tParent,
|
9907 | null,
|
9908 | null,
|
9909 | null,
|
9910 | undefined,
|
9911 | null,
|
9912 | null,
|
9913 | undefined,
|
9914 | 0,
|
9915 | 0) :
|
9916 | {
|
9917 | type,
|
9918 | index,
|
9919 | insertBeforeIndex: null,
|
9920 | injectorIndex,
|
9921 | directiveStart: -1,
|
9922 | directiveEnd: -1,
|
9923 | directiveStylingLast: -1,
|
9924 | propertyBindings: null,
|
9925 | flags: 0,
|
9926 | providerIndexes: 0,
|
9927 | value: value,
|
9928 | attrs: attrs,
|
9929 | mergedAttrs: null,
|
9930 | localNames: null,
|
9931 | initialInputs: undefined,
|
9932 | inputs: null,
|
9933 | outputs: null,
|
9934 | tViews: null,
|
9935 | next: null,
|
9936 | projectionNext: null,
|
9937 | child: null,
|
9938 | parent: tParent,
|
9939 | projection: null,
|
9940 | styles: null,
|
9941 | stylesWithoutHost: null,
|
9942 | residualStyles: undefined,
|
9943 | classes: null,
|
9944 | classesWithoutHost: null,
|
9945 | residualClasses: undefined,
|
9946 | classBindings: 0,
|
9947 | styleBindings: 0,
|
9948 | };
|
9949 | if (ngDevMode) {
|
9950 |
|
9951 |
|
9952 |
|
9953 | Object.seal(tNode);
|
9954 | }
|
9955 | return tNode;
|
9956 | }
|
9957 | function generatePropertyAliases(inputAliasMap, directiveDefIdx, propStore) {
|
9958 | for (let publicName in inputAliasMap) {
|
9959 | if (inputAliasMap.hasOwnProperty(publicName)) {
|
9960 | propStore = propStore === null ? {} : propStore;
|
9961 | const internalName = inputAliasMap[publicName];
|
9962 | if (propStore.hasOwnProperty(publicName)) {
|
9963 | propStore[publicName].push(directiveDefIdx, internalName);
|
9964 | }
|
9965 | else {
|
9966 | (propStore[publicName] = [directiveDefIdx, internalName]);
|
9967 | }
|
9968 | }
|
9969 | }
|
9970 | return propStore;
|
9971 | }
|
9972 |
|
9973 |
|
9974 |
|
9975 |
|
9976 | function initializeInputAndOutputAliases(tView, tNode) {
|
9977 | ngDevMode && assertFirstCreatePass(tView);
|
9978 | const start = tNode.directiveStart;
|
9979 | const end = tNode.directiveEnd;
|
9980 | const tViewData = tView.data;
|
9981 | const tNodeAttrs = tNode.attrs;
|
9982 | const inputsFromAttrs = ngDevMode ? new TNodeInitialInputs() : [];
|
9983 | let inputsStore = null;
|
9984 | let outputsStore = null;
|
9985 | for (let i = start; i < end; i++) {
|
9986 | const directiveDef = tViewData[i];
|
9987 | const directiveInputs = directiveDef.inputs;
|
9988 |
|
9989 |
|
9990 |
|
9991 |
|
9992 | const initialInputs = (tNodeAttrs !== null && !isInlineTemplate(tNode)) ?
|
9993 | generateInitialInputs(directiveInputs, tNodeAttrs) :
|
9994 | null;
|
9995 | inputsFromAttrs.push(initialInputs);
|
9996 | inputsStore = generatePropertyAliases(directiveInputs, i, inputsStore);
|
9997 | outputsStore = generatePropertyAliases(directiveDef.outputs, i, outputsStore);
|
9998 | }
|
9999 | if (inputsStore !== null) {
|
10000 | if (inputsStore.hasOwnProperty('class')) {
|
10001 | tNode.flags |= 16 ;
|
10002 | }
|
10003 | if (inputsStore.hasOwnProperty('style')) {
|
10004 | tNode.flags |= 32 ;
|
10005 | }
|
10006 | }
|
10007 | tNode.initialInputs = inputsFromAttrs;
|
10008 | tNode.inputs = inputsStore;
|
10009 | tNode.outputs = outputsStore;
|
10010 | }
|
10011 |
|
10012 |
|
10013 |
|
10014 |
|
10015 |
|
10016 |
|
10017 |
|
10018 |
|
10019 |
|
10020 |
|
10021 | function mapPropName(name) {
|
10022 | if (name === 'class')
|
10023 | return 'className';
|
10024 | if (name === 'for')
|
10025 | return 'htmlFor';
|
10026 | if (name === 'formaction')
|
10027 | return 'formAction';
|
10028 | if (name === 'innerHtml')
|
10029 | return 'innerHTML';
|
10030 | if (name === 'readonly')
|
10031 | return 'readOnly';
|
10032 | if (name === 'tabindex')
|
10033 | return 'tabIndex';
|
10034 | return name;
|
10035 | }
|
10036 | function elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, nativeOnly) {
|
10037 | ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
|
10038 | const element = getNativeByTNode(tNode, lView);
|
10039 | let inputData = tNode.inputs;
|
10040 | let dataValue;
|
10041 | if (!nativeOnly && inputData != null && (dataValue = inputData[propName])) {
|
10042 | setInputsForProperty(tView, lView, dataValue, propName, value);
|
10043 | if (isComponentHost(tNode))
|
10044 | markDirtyIfOnPush(lView, tNode.index);
|
10045 | if (ngDevMode) {
|
10046 | setNgReflectProperties(lView, element, tNode.type, dataValue, value);
|
10047 | }
|
10048 | }
|
10049 | else if (tNode.type & 3 ) {
|
10050 | propName = mapPropName(propName);
|
10051 | if (ngDevMode) {
|
10052 | validateAgainstEventProperties(propName);
|
10053 | if (!validateProperty(tView, element, propName, tNode)) {
|
10054 |
|
10055 | logUnknownPropertyError(propName, tNode);
|
10056 | return;
|
10057 | }
|
10058 | ngDevMode.rendererSetProperty++;
|
10059 | }
|
10060 |
|
10061 |
|
10062 | value = sanitizer != null ? sanitizer(value, tNode.value || '', propName) : value;
|
10063 | if (isProceduralRenderer(renderer)) {
|
10064 | renderer.setProperty(element, propName, value);
|
10065 | }
|
10066 | else if (!isAnimationProp(propName)) {
|
10067 | element.setProperty ? element.setProperty(propName, value) :
|
10068 | element[propName] = value;
|
10069 | }
|
10070 | }
|
10071 | else if (tNode.type & 12 ) {
|
10072 |
|
10073 |
|
10074 | if (ngDevMode && !matchingSchemas(tView, tNode.value)) {
|
10075 | logUnknownPropertyError(propName, tNode);
|
10076 | }
|
10077 | }
|
10078 | }
|
10079 |
|
10080 | function markDirtyIfOnPush(lView, viewIndex) {
|
10081 | ngDevMode && assertLView(lView);
|
10082 | const childComponentLView = getComponentLViewByIndex(viewIndex, lView);
|
10083 | if (!(childComponentLView[FLAGS] & 16 )) {
|
10084 | childComponentLView[FLAGS] |= 64 ;
|
10085 | }
|
10086 | }
|
10087 | function setNgReflectProperty(lView, element, type, attrName, value) {
|
10088 | const renderer = lView[RENDERER];
|
10089 | attrName = normalizeDebugBindingName(attrName);
|
10090 | const debugValue = normalizeDebugBindingValue(value);
|
10091 | if (type & 3 ) {
|
10092 | if (value == null) {
|
10093 | isProceduralRenderer(renderer) ? renderer.removeAttribute(element, attrName) :
|
10094 | element.removeAttribute(attrName);
|
10095 | }
|
10096 | else {
|
10097 | isProceduralRenderer(renderer) ?
|
10098 | renderer.setAttribute(element, attrName, debugValue) :
|
10099 | element.setAttribute(attrName, debugValue);
|
10100 | }
|
10101 | }
|
10102 | else {
|
10103 | const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`);
|
10104 | if (isProceduralRenderer(renderer)) {
|
10105 | renderer.setValue(element, textContent);
|
10106 | }
|
10107 | else {
|
10108 | element.textContent = textContent;
|
10109 | }
|
10110 | }
|
10111 | }
|
10112 | function setNgReflectProperties(lView, element, type, dataValue, value) {
|
10113 | if (type & (3 | 4 )) {
|
10114 | |
10115 |
|
10116 |
|
10117 |
|
10118 |
|
10119 |
|
10120 |
|
10121 |
|
10122 | for (let i = 0; i < dataValue.length; i += 2) {
|
10123 | setNgReflectProperty(lView, element, type, dataValue[i + 1], value);
|
10124 | }
|
10125 | }
|
10126 | }
|
10127 | function validateProperty(tView, element, propName, tNode) {
|
10128 |
|
10129 |
|
10130 |
|
10131 |
|
10132 | if (tView.schemas === null)
|
10133 | return true;
|
10134 |
|
10135 |
|
10136 | if (matchingSchemas(tView, tNode.value) || propName in element || isAnimationProp(propName)) {
|
10137 | return true;
|
10138 | }
|
10139 |
|
10140 |
|
10141 | return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
|
10142 | }
|
10143 | function matchingSchemas(tView, tagName) {
|
10144 | const schemas = tView.schemas;
|
10145 | if (schemas !== null) {
|
10146 | for (let i = 0; i < schemas.length; i++) {
|
10147 | const schema = schemas[i];
|
10148 | if (schema === NO_ERRORS_SCHEMA ||
|
10149 | schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
|
10150 | return true;
|
10151 | }
|
10152 | }
|
10153 | }
|
10154 | return false;
|
10155 | }
|
10156 |
|
10157 |
|
10158 |
|
10159 |
|
10160 |
|
10161 | function logUnknownPropertyError(propName, tNode) {
|
10162 | let message = `Can't bind to '${propName}' since it isn't a known property of '${tNode.value}'.`;
|
10163 | console.error(formatRuntimeError("303" , message));
|
10164 | }
|
10165 |
|
10166 |
|
10167 |
|
10168 | function instantiateRootComponent(tView, lView, def) {
|
10169 | const rootTNode = getCurrentTNode();
|
10170 | if (tView.firstCreatePass) {
|
10171 | if (def.providersResolver)
|
10172 | def.providersResolver(def);
|
10173 | const directiveIndex = allocExpando(tView, lView, 1, null);
|
10174 | ngDevMode &&
|
10175 | assertEqual(directiveIndex, rootTNode.directiveStart, 'Because this is a root component the allocated expando should match the TNode component.');
|
10176 | configureViewWithDirective(tView, rootTNode, lView, directiveIndex, def);
|
10177 | }
|
10178 | const directive = getNodeInjectable(lView, tView, rootTNode.directiveStart, rootTNode);
|
10179 | attachPatchData(directive, lView);
|
10180 | const native = getNativeByTNode(rootTNode, lView);
|
10181 | if (native) {
|
10182 | attachPatchData(native, lView);
|
10183 | }
|
10184 | return directive;
|
10185 | }
|
10186 |
|
10187 |
|
10188 |
|
10189 | function resolveDirectives(tView, lView, tNode, localRefs) {
|
10190 |
|
10191 |
|
10192 | ngDevMode && assertFirstCreatePass(tView);
|
10193 | let hasDirectives = false;
|
10194 | if (getBindingsEnabled()) {
|
10195 | const directiveDefs = findDirectiveDefMatches(tView, lView, tNode);
|
10196 | const exportsMap = localRefs === null ? null : { '': -1 };
|
10197 | if (directiveDefs !== null) {
|
10198 | hasDirectives = true;
|
10199 | initTNodeFlags(tNode, tView.data.length, directiveDefs.length);
|
10200 |
|
10201 |
|
10202 |
|
10203 |
|
10204 |
|
10205 |
|
10206 | for (let i = 0; i < directiveDefs.length; i++) {
|
10207 | const def = directiveDefs[i];
|
10208 | if (def.providersResolver)
|
10209 | def.providersResolver(def);
|
10210 | }
|
10211 | let preOrderHooksFound = false;
|
10212 | let preOrderCheckHooksFound = false;
|
10213 | let directiveIdx = allocExpando(tView, lView, directiveDefs.length, null);
|
10214 | ngDevMode &&
|
10215 | assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
|
10216 | for (let i = 0; i < directiveDefs.length; i++) {
|
10217 | const def = directiveDefs[i];
|
10218 |
|
10219 |
|
10220 | tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
|
10221 | configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
|
10222 | saveNameToExportMap(directiveIdx, def, exportsMap);
|
10223 | if (def.contentQueries !== null)
|
10224 | tNode.flags |= 8 ;
|
10225 | if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
|
10226 | tNode.flags |= 128 ;
|
10227 | const lifeCycleHooks = def.type.prototype;
|
10228 |
|
10229 |
|
10230 | if (!preOrderHooksFound &&
|
10231 | (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
|
10232 |
|
10233 |
|
10234 |
|
10235 | (tView.preOrderHooks || (tView.preOrderHooks = [])).push(tNode.index);
|
10236 | preOrderHooksFound = true;
|
10237 | }
|
10238 | if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
|
10239 | (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(tNode.index);
|
10240 | preOrderCheckHooksFound = true;
|
10241 | }
|
10242 | directiveIdx++;
|
10243 | }
|
10244 | initializeInputAndOutputAliases(tView, tNode);
|
10245 | }
|
10246 | if (exportsMap)
|
10247 | cacheMatchingLocalNames(tNode, localRefs, exportsMap);
|
10248 | }
|
10249 |
|
10250 | tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
|
10251 | return hasDirectives;
|
10252 | }
|
10253 |
|
10254 |
|
10255 |
|
10256 |
|
10257 |
|
10258 |
|
10259 |
|
10260 |
|
10261 |
|
10262 |
|
10263 | function registerHostBindingOpCodes(tView, tNode, lView, directiveIdx, directiveVarsIdx, def) {
|
10264 | ngDevMode && assertFirstCreatePass(tView);
|
10265 | const hostBindings = def.hostBindings;
|
10266 | if (hostBindings) {
|
10267 | let hostBindingOpCodes = tView.hostBindingOpCodes;
|
10268 | if (hostBindingOpCodes === null) {
|
10269 | hostBindingOpCodes = tView.hostBindingOpCodes = [];
|
10270 | }
|
10271 | const elementIndx = ~tNode.index;
|
10272 | if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) {
|
10273 |
|
10274 |
|
10275 |
|
10276 | hostBindingOpCodes.push(elementIndx);
|
10277 | }
|
10278 | hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings);
|
10279 | }
|
10280 | }
|
10281 |
|
10282 |
|
10283 |
|
10284 |
|
10285 |
|
10286 |
|
10287 |
|
10288 |
|
10289 | function lastSelectedElementIdx(hostBindingOpCodes) {
|
10290 | let i = hostBindingOpCodes.length;
|
10291 | while (i > 0) {
|
10292 | const value = hostBindingOpCodes[--i];
|
10293 | if (typeof value === 'number' && value < 0) {
|
10294 | return value;
|
10295 | }
|
10296 | }
|
10297 | return 0;
|
10298 | }
|
10299 |
|
10300 |
|
10301 |
|
10302 | function instantiateAllDirectives(tView, lView, tNode, native) {
|
10303 | const start = tNode.directiveStart;
|
10304 | const end = tNode.directiveEnd;
|
10305 | if (!tView.firstCreatePass) {
|
10306 | getOrCreateNodeInjectorForNode(tNode, lView);
|
10307 | }
|
10308 | attachPatchData(native, lView);
|
10309 | const initialInputs = tNode.initialInputs;
|
10310 | for (let i = start; i < end; i++) {
|
10311 | const def = tView.data[i];
|
10312 | const isComponent = isComponentDef(def);
|
10313 | if (isComponent) {
|
10314 | ngDevMode && assertTNodeType(tNode, 3 );
|
10315 | addComponentLogic(lView, tNode, def);
|
10316 | }
|
10317 | const directive = getNodeInjectable(lView, tView, i, tNode);
|
10318 | attachPatchData(directive, lView);
|
10319 | if (initialInputs !== null) {
|
10320 | setInputsFromAttrs(lView, i - start, directive, def, tNode, initialInputs);
|
10321 | }
|
10322 | if (isComponent) {
|
10323 | const componentView = getComponentLViewByIndex(tNode.index, lView);
|
10324 | componentView[CONTEXT] = directive;
|
10325 | }
|
10326 | }
|
10327 | }
|
10328 | function invokeDirectivesHostBindings(tView, lView, tNode) {
|
10329 | const start = tNode.directiveStart;
|
10330 | const end = tNode.directiveEnd;
|
10331 | const firstCreatePass = tView.firstCreatePass;
|
10332 | const elementIndex = tNode.index;
|
10333 | const currentDirectiveIndex = getCurrentDirectiveIndex();
|
10334 | try {
|
10335 | setSelectedIndex(elementIndex);
|
10336 | for (let dirIndex = start; dirIndex < end; dirIndex++) {
|
10337 | const def = tView.data[dirIndex];
|
10338 | const directive = lView[dirIndex];
|
10339 | setCurrentDirectiveIndex(dirIndex);
|
10340 | if (def.hostBindings !== null || def.hostVars !== 0 || def.hostAttrs !== null) {
|
10341 | invokeHostBindingsInCreationMode(def, directive);
|
10342 | }
|
10343 | }
|
10344 | }
|
10345 | finally {
|
10346 | setSelectedIndex(-1);
|
10347 | setCurrentDirectiveIndex(currentDirectiveIndex);
|
10348 | }
|
10349 | }
|
10350 |
|
10351 |
|
10352 |
|
10353 |
|
10354 |
|
10355 |
|
10356 | function invokeHostBindingsInCreationMode(def, directive) {
|
10357 | if (def.hostBindings !== null) {
|
10358 | def.hostBindings(1 , directive);
|
10359 | }
|
10360 | }
|
10361 |
|
10362 |
|
10363 |
|
10364 |
|
10365 | function findDirectiveDefMatches(tView, viewData, tNode) {
|
10366 | ngDevMode && assertFirstCreatePass(tView);
|
10367 | ngDevMode && assertTNodeType(tNode, 3 | 12 );
|
10368 | const registry = tView.directiveRegistry;
|
10369 | let matches = null;
|
10370 | if (registry) {
|
10371 | for (let i = 0; i < registry.length; i++) {
|
10372 | const def = registry[i];
|
10373 | if (isNodeMatchingSelectorList(tNode, def.selectors, false)) {
|
10374 | matches || (matches = ngDevMode ? new MatchesArray() : []);
|
10375 | diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, viewData), tView, def.type);
|
10376 | if (isComponentDef(def)) {
|
10377 | if (ngDevMode) {
|
10378 | assertTNodeType(tNode, 2 , `"${tNode.value}" tags cannot be used as component hosts. ` +
|
10379 | `Please use a different tag to activate the ${stringify(def.type)} component.`);
|
10380 | if (tNode.flags & 2 )
|
10381 | throwMultipleComponentError(tNode);
|
10382 | }
|
10383 | markAsComponentHost(tView, tNode);
|
10384 |
|
10385 | matches.unshift(def);
|
10386 | }
|
10387 | else {
|
10388 | matches.push(def);
|
10389 | }
|
10390 | }
|
10391 | }
|
10392 | }
|
10393 | return matches;
|
10394 | }
|
10395 |
|
10396 |
|
10397 |
|
10398 |
|
10399 |
|
10400 | function markAsComponentHost(tView, hostTNode) {
|
10401 | ngDevMode && assertFirstCreatePass(tView);
|
10402 | hostTNode.flags |= 2 ;
|
10403 | (tView.components || (tView.components = ngDevMode ? new TViewComponents() : []))
|
10404 | .push(hostTNode.index);
|
10405 | }
|
10406 |
|
10407 | function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
|
10408 | if (localRefs) {
|
10409 | const localNames = tNode.localNames = ngDevMode ? new TNodeLocalNames() : [];
|
10410 |
|
10411 |
|
10412 |
|
10413 | for (let i = 0; i < localRefs.length; i += 2) {
|
10414 | const index = exportsMap[localRefs[i + 1]];
|
10415 | if (index == null)
|
10416 | throw new RuntimeError("301" , `Export of name '${localRefs[i + 1]}' not found!`);
|
10417 | localNames.push(localRefs[i], index);
|
10418 | }
|
10419 | }
|
10420 | }
|
10421 |
|
10422 |
|
10423 |
|
10424 |
|
10425 | function saveNameToExportMap(directiveIdx, def, exportsMap) {
|
10426 | if (exportsMap) {
|
10427 | if (def.exportAs) {
|
10428 | for (let i = 0; i < def.exportAs.length; i++) {
|
10429 | exportsMap[def.exportAs[i]] = directiveIdx;
|
10430 | }
|
10431 | }
|
10432 | if (isComponentDef(def))
|
10433 | exportsMap[''] = directiveIdx;
|
10434 | }
|
10435 | }
|
10436 |
|
10437 |
|
10438 |
|
10439 |
|
10440 |
|
10441 | function initTNodeFlags(tNode, index, numberOfDirectives) {
|
10442 | ngDevMode &&
|
10443 | assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, 'Reached the max number of directives');
|
10444 | tNode.flags |= 1 ;
|
10445 |
|
10446 | tNode.directiveStart = index;
|
10447 | tNode.directiveEnd = index + numberOfDirectives;
|
10448 | tNode.providerIndexes = index;
|
10449 | }
|
10450 |
|
10451 |
|
10452 |
|
10453 |
|
10454 |
|
10455 |
|
10456 |
|
10457 |
|
10458 |
|
10459 |
|
10460 |
|
10461 |
|
10462 | function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
|
10463 | ngDevMode &&
|
10464 | assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, 'Must be in Expando section');
|
10465 | tView.data[directiveIndex] = def;
|
10466 | const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true));
|
10467 | const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), null);
|
10468 | tView.blueprint[directiveIndex] = nodeInjectorFactory;
|
10469 | lView[directiveIndex] = nodeInjectorFactory;
|
10470 | registerHostBindingOpCodes(tView, tNode, lView, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
|
10471 | }
|
10472 | function addComponentLogic(lView, hostTNode, def) {
|
10473 | const native = getNativeByTNode(hostTNode, lView);
|
10474 | const tView = getOrCreateTComponentView(def);
|
10475 |
|
10476 |
|
10477 | const rendererFactory = lView[RENDERER_FACTORY];
|
10478 | const componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 64 : 16 , native, hostTNode, rendererFactory, rendererFactory.createRenderer(native, def), null, null));
|
10479 |
|
10480 |
|
10481 | lView[hostTNode.index] = componentView;
|
10482 | }
|
10483 | function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace) {
|
10484 | if (ngDevMode) {
|
10485 | assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
|
10486 | validateAgainstEventAttributes(name);
|
10487 | assertTNodeType(tNode, 2 , `Attempted to set attribute \`${name}\` on a container node. ` +
|
10488 | `Host bindings are not valid on ng-container or ng-template.`);
|
10489 | }
|
10490 | const element = getNativeByTNode(tNode, lView);
|
10491 | setElementAttribute$1(lView[RENDERER], element, namespace, tNode.value, name, value, sanitizer);
|
10492 | }
|
10493 | function setElementAttribute$1(renderer, element, namespace, tagName, name, value, sanitizer) {
|
10494 | if (value == null) {
|
10495 | ngDevMode && ngDevMode.rendererRemoveAttribute++;
|
10496 | isProceduralRenderer(renderer) ? renderer.removeAttribute(element, name, namespace) :
|
10497 | element.removeAttribute(name);
|
10498 | }
|
10499 | else {
|
10500 | ngDevMode && ngDevMode.rendererSetAttribute++;
|
10501 | const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || '', name);
|
10502 | if (isProceduralRenderer(renderer)) {
|
10503 | renderer.setAttribute(element, name, strValue, namespace);
|
10504 | }
|
10505 | else {
|
10506 | namespace ? element.setAttributeNS(namespace, name, strValue) :
|
10507 | element.setAttribute(name, strValue);
|
10508 | }
|
10509 | }
|
10510 | }
|
10511 |
|
10512 |
|
10513 |
|
10514 |
|
10515 |
|
10516 |
|
10517 |
|
10518 |
|
10519 |
|
10520 | function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initialInputData) {
|
10521 | const initialInputs = initialInputData[directiveIndex];
|
10522 | if (initialInputs !== null) {
|
10523 | const setInput = def.setInput;
|
10524 | for (let i = 0; i < initialInputs.length;) {
|
10525 | const publicName = initialInputs[i++];
|
10526 | const privateName = initialInputs[i++];
|
10527 | const value = initialInputs[i++];
|
10528 | if (setInput !== null) {
|
10529 | def.setInput(instance, value, publicName, privateName);
|
10530 | }
|
10531 | else {
|
10532 | instance[privateName] = value;
|
10533 | }
|
10534 | if (ngDevMode) {
|
10535 | const nativeElement = getNativeByTNode(tNode, lView);
|
10536 | setNgReflectProperty(lView, nativeElement, tNode.type, privateName, value);
|
10537 | }
|
10538 | }
|
10539 | }
|
10540 | }
|
10541 |
|
10542 |
|
10543 |
|
10544 |
|
10545 |
|
10546 |
|
10547 |
|
10548 |
|
10549 |
|
10550 |
|
10551 |
|
10552 |
|
10553 |
|
10554 |
|
10555 | function generateInitialInputs(inputs, attrs) {
|
10556 | let inputsToStore = null;
|
10557 | let i = 0;
|
10558 | while (i < attrs.length) {
|
10559 | const attrName = attrs[i];
|
10560 | if (attrName === 0 ) {
|
10561 |
|
10562 | i += 4;
|
10563 | continue;
|
10564 | }
|
10565 | else if (attrName === 5 ) {
|
10566 |
|
10567 | i += 2;
|
10568 | continue;
|
10569 | }
|
10570 |
|
10571 | if (typeof attrName === 'number')
|
10572 | break;
|
10573 | if (inputs.hasOwnProperty(attrName)) {
|
10574 | if (inputsToStore === null)
|
10575 | inputsToStore = [];
|
10576 | inputsToStore.push(attrName, inputs[attrName], attrs[i + 1]);
|
10577 | }
|
10578 | i += 2;
|
10579 | }
|
10580 | return inputsToStore;
|
10581 | }
|
10582 |
|
10583 |
|
10584 |
|
10585 |
|
10586 | const LContainerArray = class LContainer extends Array {
|
10587 | };
|
10588 |
|
10589 |
|
10590 |
|
10591 |
|
10592 |
|
10593 |
|
10594 |
|
10595 |
|
10596 |
|
10597 |
|
10598 | function createLContainer(hostNative, currentView, native, tNode) {
|
10599 | ngDevMode && assertLView(currentView);
|
10600 | ngDevMode && !isProceduralRenderer(currentView[RENDERER]) && assertDomNode(native);
|
10601 |
|
10602 | const lContainer = new (ngDevMode ? LContainerArray : Array)(hostNative,
|
10603 | true,
|
10604 | false,
|
10605 | currentView,
|
10606 | null,
|
10607 | 0,
|
10608 | tNode,
|
10609 | native,
|
10610 | null,
|
10611 | null);
|
10612 | ngDevMode &&
|
10613 | assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, 'Should allocate correct number of slots for LContainer header.');
|
10614 | ngDevMode && attachLContainerDebug(lContainer);
|
10615 | return lContainer;
|
10616 | }
|
10617 |
|
10618 |
|
10619 |
|
10620 |
|
10621 | function refreshEmbeddedViews(lView) {
|
10622 | for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
|
10623 | for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
10624 | const embeddedLView = lContainer[i];
|
10625 | const embeddedTView = embeddedLView[TVIEW];
|
10626 | ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
|
10627 | if (viewAttachedToChangeDetector(embeddedLView)) {
|
10628 | refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
|
10629 | }
|
10630 | }
|
10631 | }
|
10632 | }
|
10633 |
|
10634 |
|
10635 |
|
10636 |
|
10637 |
|
10638 | function markTransplantedViewsForRefresh(lView) {
|
10639 | for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
|
10640 | if (!lContainer[HAS_TRANSPLANTED_VIEWS])
|
10641 | continue;
|
10642 | const movedViews = lContainer[MOVED_VIEWS];
|
10643 | ngDevMode && assertDefined(movedViews, 'Transplanted View flags set but missing MOVED_VIEWS');
|
10644 | for (let i = 0; i < movedViews.length; i++) {
|
10645 | const movedLView = movedViews[i];
|
10646 | const insertionLContainer = movedLView[PARENT];
|
10647 | ngDevMode && assertLContainer(insertionLContainer);
|
10648 |
|
10649 |
|
10650 | if ((movedLView[FLAGS] & 1024 ) === 0) {
|
10651 | updateTransplantedViewCount(insertionLContainer, 1);
|
10652 | }
|
10653 |
|
10654 |
|
10655 |
|
10656 |
|
10657 | movedLView[FLAGS] |= 1024 ;
|
10658 | }
|
10659 | }
|
10660 | }
|
10661 |
|
10662 |
|
10663 |
|
10664 |
|
10665 |
|
10666 |
|
10667 | function refreshComponent(hostLView, componentHostIdx) {
|
10668 | ngDevMode && assertEqual(isCreationMode(hostLView), false, 'Should be run in update mode');
|
10669 | const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
|
10670 |
|
10671 | if (viewAttachedToChangeDetector(componentView)) {
|
10672 | const tView = componentView[TVIEW];
|
10673 | if (componentView[FLAGS] & (16 | 64 )) {
|
10674 | refreshView(tView, componentView, tView.template, componentView[CONTEXT]);
|
10675 | }
|
10676 | else if (componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
|
10677 |
|
10678 | refreshContainsDirtyView(componentView);
|
10679 | }
|
10680 | }
|
10681 | }
|
10682 |
|
10683 |
|
10684 |
|
10685 |
|
10686 |
|
10687 |
|
10688 | function refreshContainsDirtyView(lView) {
|
10689 | for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
|
10690 | for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
10691 | const embeddedLView = lContainer[i];
|
10692 | if (embeddedLView[FLAGS] & 1024 ) {
|
10693 | const embeddedTView = embeddedLView[TVIEW];
|
10694 | ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
|
10695 | refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
|
10696 | }
|
10697 | else if (embeddedLView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
|
10698 | refreshContainsDirtyView(embeddedLView);
|
10699 | }
|
10700 | }
|
10701 | }
|
10702 | const tView = lView[TVIEW];
|
10703 |
|
10704 | const components = tView.components;
|
10705 | if (components !== null) {
|
10706 | for (let i = 0; i < components.length; i++) {
|
10707 | const componentView = getComponentLViewByIndex(components[i], lView);
|
10708 |
|
10709 | if (viewAttachedToChangeDetector(componentView) &&
|
10710 | componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
|
10711 | refreshContainsDirtyView(componentView);
|
10712 | }
|
10713 | }
|
10714 | }
|
10715 | }
|
10716 | function renderComponent$1(hostLView, componentHostIdx) {
|
10717 | ngDevMode && assertEqual(isCreationMode(hostLView), true, 'Should be run in creation mode');
|
10718 | const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
|
10719 | const componentTView = componentView[TVIEW];
|
10720 | syncViewWithBlueprint(componentTView, componentView);
|
10721 | renderView(componentTView, componentView, componentView[CONTEXT]);
|
10722 | }
|
10723 |
|
10724 |
|
10725 |
|
10726 |
|
10727 |
|
10728 |
|
10729 |
|
10730 |
|
10731 |
|
10732 |
|
10733 |
|
10734 |
|
10735 |
|
10736 |
|
10737 |
|
10738 |
|
10739 |
|
10740 |
|
10741 |
|
10742 |
|
10743 |
|
10744 |
|
10745 |
|
10746 |
|
10747 |
|
10748 |
|
10749 |
|
10750 | function syncViewWithBlueprint(tView, lView) {
|
10751 | for (let i = lView.length; i < tView.blueprint.length; i++) {
|
10752 | lView.push(tView.blueprint[i]);
|
10753 | }
|
10754 | }
|
10755 |
|
10756 |
|
10757 |
|
10758 |
|
10759 |
|
10760 |
|
10761 |
|
10762 |
|
10763 |
|
10764 |
|
10765 |
|
10766 | function addToViewTree(lView, lViewOrLContainer) {
|
10767 |
|
10768 |
|
10769 |
|
10770 |
|
10771 | if (lView[CHILD_HEAD]) {
|
10772 | lView[CHILD_TAIL][NEXT] = lViewOrLContainer;
|
10773 | }
|
10774 | else {
|
10775 | lView[CHILD_HEAD] = lViewOrLContainer;
|
10776 | }
|
10777 | lView[CHILD_TAIL] = lViewOrLContainer;
|
10778 | return lViewOrLContainer;
|
10779 | }
|
10780 |
|
10781 |
|
10782 |
|
10783 |
|
10784 |
|
10785 |
|
10786 |
|
10787 |
|
10788 |
|
10789 |
|
10790 |
|
10791 |
|
10792 |
|
10793 |
|
10794 | function markViewDirty(lView) {
|
10795 | while (lView) {
|
10796 | lView[FLAGS] |= 64 ;
|
10797 | const parent = getLViewParent(lView);
|
10798 |
|
10799 | if (isRootView(lView) && !parent) {
|
10800 | return lView;
|
10801 | }
|
10802 |
|
10803 | lView = parent;
|
10804 | }
|
10805 | return null;
|
10806 | }
|
10807 |
|
10808 |
|
10809 |
|
10810 |
|
10811 |
|
10812 |
|
10813 |
|
10814 |
|
10815 |
|
10816 |
|
10817 |
|
10818 | function scheduleTick(rootContext, flags) {
|
10819 | const nothingScheduled = rootContext.flags === 0 ;
|
10820 | if (nothingScheduled && rootContext.clean == _CLEAN_PROMISE) {
|
10821 |
|
10822 |
|
10823 | rootContext.flags |= flags;
|
10824 | let res;
|
10825 | rootContext.clean = new Promise((r) => res = r);
|
10826 | rootContext.scheduler(() => {
|
10827 | if (rootContext.flags & 1 ) {
|
10828 | rootContext.flags &= ~1 ;
|
10829 | tickRootContext(rootContext);
|
10830 | }
|
10831 | if (rootContext.flags & 2 ) {
|
10832 | rootContext.flags &= ~2 ;
|
10833 | const playerHandler = rootContext.playerHandler;
|
10834 | if (playerHandler) {
|
10835 | playerHandler.flushPlayers();
|
10836 | }
|
10837 | }
|
10838 | rootContext.clean = _CLEAN_PROMISE;
|
10839 | res(null);
|
10840 | });
|
10841 | }
|
10842 | }
|
10843 | function tickRootContext(rootContext) {
|
10844 | for (let i = 0; i < rootContext.components.length; i++) {
|
10845 | const rootComponent = rootContext.components[i];
|
10846 | const lView = readPatchedLView(rootComponent);
|
10847 | const tView = lView[TVIEW];
|
10848 | renderComponentOrTemplate(tView, lView, tView.template, rootComponent);
|
10849 | }
|
10850 | }
|
10851 | function detectChangesInternal(tView, lView, context) {
|
10852 | const rendererFactory = lView[RENDERER_FACTORY];
|
10853 | if (rendererFactory.begin)
|
10854 | rendererFactory.begin();
|
10855 | try {
|
10856 | refreshView(tView, lView, tView.template, context);
|
10857 | }
|
10858 | catch (error) {
|
10859 | handleError(lView, error);
|
10860 | throw error;
|
10861 | }
|
10862 | finally {
|
10863 | if (rendererFactory.end)
|
10864 | rendererFactory.end();
|
10865 | }
|
10866 | }
|
10867 |
|
10868 |
|
10869 |
|
10870 |
|
10871 |
|
10872 | function detectChangesInRootView(lView) {
|
10873 | tickRootContext(lView[CONTEXT]);
|
10874 | }
|
10875 | function checkNoChangesInternal(tView, view, context) {
|
10876 | setIsInCheckNoChangesMode(true);
|
10877 | try {
|
10878 | detectChangesInternal(tView, view, context);
|
10879 | }
|
10880 | finally {
|
10881 | setIsInCheckNoChangesMode(false);
|
10882 | }
|
10883 | }
|
10884 |
|
10885 |
|
10886 |
|
10887 |
|
10888 |
|
10889 |
|
10890 |
|
10891 |
|
10892 |
|
10893 | function checkNoChangesInRootView(lView) {
|
10894 | setIsInCheckNoChangesMode(true);
|
10895 | try {
|
10896 | detectChangesInRootView(lView);
|
10897 | }
|
10898 | finally {
|
10899 | setIsInCheckNoChangesMode(false);
|
10900 | }
|
10901 | }
|
10902 | function executeViewQueryFn(flags, viewQueryFn, component) {
|
10903 | ngDevMode && assertDefined(viewQueryFn, 'View queries function to execute must be defined.');
|
10904 | setCurrentQueryIndex(0);
|
10905 | viewQueryFn(flags, component);
|
10906 | }
|
10907 |
|
10908 |
|
10909 |
|
10910 |
|
10911 |
|
10912 |
|
10913 |
|
10914 |
|
10915 |
|
10916 |
|
10917 |
|
10918 |
|
10919 |
|
10920 |
|
10921 |
|
10922 |
|
10923 |
|
10924 |
|
10925 |
|
10926 |
|
10927 |
|
10928 |
|
10929 |
|
10930 |
|
10931 | function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex, ...interpolationParts) {
|
10932 |
|
10933 |
|
10934 |
|
10935 | if (tData[bindingIndex] === null) {
|
10936 | if (tNode.inputs == null || !tNode.inputs[propertyName]) {
|
10937 | const propBindingIdxs = tNode.propertyBindings || (tNode.propertyBindings = []);
|
10938 | propBindingIdxs.push(bindingIndex);
|
10939 | let bindingMetadata = propertyName;
|
10940 | if (interpolationParts.length > 0) {
|
10941 | bindingMetadata +=
|
10942 | INTERPOLATION_DELIMITER + interpolationParts.join(INTERPOLATION_DELIMITER);
|
10943 | }
|
10944 | tData[bindingIndex] = bindingMetadata;
|
10945 | }
|
10946 | }
|
10947 | }
|
10948 | const CLEAN_PROMISE = _CLEAN_PROMISE;
|
10949 | function getOrCreateLViewCleanup(view) {
|
10950 |
|
10951 | return view[CLEANUP] || (view[CLEANUP] = ngDevMode ? new LCleanup() : []);
|
10952 | }
|
10953 | function getOrCreateTViewCleanup(tView) {
|
10954 | return tView.cleanup || (tView.cleanup = ngDevMode ? new TCleanup() : []);
|
10955 | }
|
10956 |
|
10957 |
|
10958 |
|
10959 |
|
10960 | function loadComponentRenderer(currentDef, tNode, lView) {
|
10961 |
|
10962 |
|
10963 |
|
10964 |
|
10965 |
|
10966 |
|
10967 | if (currentDef === null || isComponentDef(currentDef)) {
|
10968 | lView = unwrapLView(lView[tNode.index]);
|
10969 | }
|
10970 | return lView[RENDERER];
|
10971 | }
|
10972 |
|
10973 | function handleError(lView, error) {
|
10974 | const injector = lView[INJECTOR$1];
|
10975 | const errorHandler = injector ? injector.get(ErrorHandler, null) : null;
|
10976 | errorHandler && errorHandler.handleError(error);
|
10977 | }
|
10978 |
|
10979 |
|
10980 |
|
10981 |
|
10982 |
|
10983 |
|
10984 |
|
10985 |
|
10986 |
|
10987 | function setInputsForProperty(tView, lView, inputs, publicName, value) {
|
10988 | for (let i = 0; i < inputs.length;) {
|
10989 | const index = inputs[i++];
|
10990 | const privateName = inputs[i++];
|
10991 | const instance = lView[index];
|
10992 | ngDevMode && assertIndexInRange(lView, index);
|
10993 | const def = tView.data[index];
|
10994 | if (def.setInput !== null) {
|
10995 | def.setInput(instance, value, publicName, privateName);
|
10996 | }
|
10997 | else {
|
10998 | instance[privateName] = value;
|
10999 | }
|
11000 | }
|
11001 | }
|
11002 |
|
11003 |
|
11004 |
|
11005 | function textBindingInternal(lView, index, value) {
|
11006 | ngDevMode && assertString(value, 'Value should be a string');
|
11007 | ngDevMode && assertNotSame(value, NO_CHANGE, 'value should not be NO_CHANGE');
|
11008 | ngDevMode && assertIndexInRange(lView, index);
|
11009 | const element = getNativeByIndex(index, lView);
|
11010 | ngDevMode && assertDefined(element, 'native element should exist');
|
11011 | updateTextNode(lView[RENDERER], element, value);
|
11012 | }
|
11013 |
|
11014 |
|
11015 |
|
11016 |
|
11017 |
|
11018 |
|
11019 |
|
11020 |
|
11021 |
|
11022 |
|
11023 |
|
11024 |
|
11025 |
|
11026 |
|
11027 |
|
11028 |
|
11029 |
|
11030 |
|
11031 |
|
11032 | function computeStaticStyling(tNode, attrs, writeToHost) {
|
11033 | ngDevMode &&
|
11034 | assertFirstCreatePass(getTView(), 'Expecting to be called in first template pass only');
|
11035 | let styles = writeToHost ? tNode.styles : null;
|
11036 | let classes = writeToHost ? tNode.classes : null;
|
11037 | let mode = 0;
|
11038 | if (attrs !== null) {
|
11039 | for (let i = 0; i < attrs.length; i++) {
|
11040 | const value = attrs[i];
|
11041 | if (typeof value === 'number') {
|
11042 | mode = value;
|
11043 | }
|
11044 | else if (mode == 1 ) {
|
11045 | classes = concatStringsWithSpace(classes, value);
|
11046 | }
|
11047 | else if (mode == 2 ) {
|
11048 | const style = value;
|
11049 | const styleValue = attrs[++i];
|
11050 | styles = concatStringsWithSpace(styles, style + ': ' + styleValue + ';');
|
11051 | }
|
11052 | }
|
11053 | }
|
11054 | writeToHost ? tNode.styles = styles : tNode.stylesWithoutHost = styles;
|
11055 | writeToHost ? tNode.classes = classes : tNode.classesWithoutHost = classes;
|
11056 | }
|
11057 |
|
11058 |
|
11059 |
|
11060 |
|
11061 |
|
11062 |
|
11063 |
|
11064 |
|
11065 |
|
11066 |
|
11067 |
|
11068 |
|
11069 |
|
11070 |
|
11071 |
|
11072 | function detectChanges(component) {
|
11073 | const view = getComponentViewByInstance(component);
|
11074 | detectChangesInternal(view[TVIEW], view, component);
|
11075 | }
|
11076 |
|
11077 |
|
11078 |
|
11079 |
|
11080 |
|
11081 |
|
11082 |
|
11083 |
|
11084 |
|
11085 | function markDirty(component) {
|
11086 | ngDevMode && assertDefined(component, 'component');
|
11087 | const rootView = markViewDirty(getComponentViewByInstance(component));
|
11088 | ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
|
11089 | scheduleTick(rootView[CONTEXT], 1 );
|
11090 | }
|
11091 |
|
11092 |
|
11093 |
|
11094 |
|
11095 |
|
11096 |
|
11097 |
|
11098 |
|
11099 |
|
11100 |
|
11101 |
|
11102 |
|
11103 | function tick(component) {
|
11104 | const rootView = getRootView(component);
|
11105 | const rootContext = rootView[CONTEXT];
|
11106 | tickRootContext(rootContext);
|
11107 | }
|
11108 |
|
11109 |
|
11110 |
|
11111 |
|
11112 |
|
11113 |
|
11114 |
|
11115 |
|
11116 |
|
11117 |
|
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 |
|
11123 |
|
11124 | const INJECTOR = new InjectionToken('INJECTOR',
|
11125 |
|
11126 |
|
11127 | -1 );
|
11128 |
|
11129 |
|
11130 |
|
11131 |
|
11132 |
|
11133 |
|
11134 |
|
11135 |
|
11136 | class NullInjector {
|
11137 | get(token, notFoundValue = THROW_IF_NOT_FOUND) {
|
11138 | if (notFoundValue === THROW_IF_NOT_FOUND) {
|
11139 | const error = new Error(`NullInjectorError: No provider for ${stringify(token)}!`);
|
11140 | error.name = 'NullInjectorError';
|
11141 | throw error;
|
11142 | }
|
11143 | return notFoundValue;
|
11144 | }
|
11145 | }
|
11146 |
|
11147 |
|
11148 |
|
11149 |
|
11150 |
|
11151 |
|
11152 |
|
11153 |
|
11154 |
|
11155 |
|
11156 |
|
11157 |
|
11158 |
|
11159 | const INJECTOR_SCOPE = new InjectionToken('Set Injector scope.');
|
11160 |
|
11161 |
|
11162 |
|
11163 |
|
11164 |
|
11165 |
|
11166 |
|
11167 |
|
11168 |
|
11169 |
|
11170 |
|
11171 | const NOT_YET = {};
|
11172 |
|
11173 |
|
11174 |
|
11175 |
|
11176 |
|
11177 |
|
11178 |
|
11179 | const CIRCULAR$1 = {};
|
11180 |
|
11181 |
|
11182 |
|
11183 | let NULL_INJECTOR$1 = undefined;
|
11184 | function getNullInjector() {
|
11185 | if (NULL_INJECTOR$1 === undefined) {
|
11186 | NULL_INJECTOR$1 = new NullInjector();
|
11187 | }
|
11188 | return NULL_INJECTOR$1;
|
11189 | }
|
11190 |
|
11191 |
|
11192 |
|
11193 |
|
11194 |
|
11195 | function createInjector$1(defType, parent = null, additionalProviders = null, name) {
|
11196 | const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name);
|
11197 | injector._resolveInjectorDefTypes();
|
11198 | return injector;
|
11199 | }
|
11200 |
|
11201 |
|
11202 |
|
11203 |
|
11204 |
|
11205 | function createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name) {
|
11206 | return new R3Injector(defType, additionalProviders, parent || getNullInjector(), name);
|
11207 | }
|
11208 | class R3Injector {
|
11209 | constructor(def, additionalProviders, parent, source = null) {
|
11210 | this.parent = parent;
|
11211 | |
11212 |
|
11213 |
|
11214 |
|
11215 |
|
11216 | this.records = new Map();
|
11217 | |
11218 |
|
11219 |
|
11220 | this.injectorDefTypes = new Set();
|
11221 | |
11222 |
|
11223 |
|
11224 | this.onDestroy = new Set();
|
11225 | this._destroyed = false;
|
11226 | const dedupStack = [];
|
11227 |
|
11228 |
|
11229 |
|
11230 | additionalProviders &&
|
11231 | deepForEach(additionalProviders, provider => this.processProvider(provider, def, additionalProviders));
|
11232 | deepForEach([def], injectorDef => this.processInjectorType(injectorDef, [], dedupStack));
|
11233 |
|
11234 | this.records.set(INJECTOR, makeRecord(undefined, this));
|
11235 |
|
11236 |
|
11237 | const record = this.records.get(INJECTOR_SCOPE);
|
11238 | this.scope = record != null ? record.value : null;
|
11239 |
|
11240 | this.source = source || (typeof def === 'object' ? null : stringify(def));
|
11241 | }
|
11242 | |
11243 |
|
11244 |
|
11245 | get destroyed() {
|
11246 | return this._destroyed;
|
11247 | }
|
11248 | |
11249 |
|
11250 |
|
11251 |
|
11252 |
|
11253 |
|
11254 | destroy() {
|
11255 | this.assertNotDestroyed();
|
11256 |
|
11257 | this._destroyed = true;
|
11258 | try {
|
11259 |
|
11260 | this.onDestroy.forEach(service => service.ngOnDestroy());
|
11261 | }
|
11262 | finally {
|
11263 |
|
11264 | this.records.clear();
|
11265 | this.onDestroy.clear();
|
11266 | this.injectorDefTypes.clear();
|
11267 | }
|
11268 | }
|
11269 | get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {
|
11270 | this.assertNotDestroyed();
|
11271 |
|
11272 | const previousInjector = setCurrentInjector(this);
|
11273 | const previousInjectImplementation = setInjectImplementation(undefined);
|
11274 | try {
|
11275 |
|
11276 | if (!(flags & InjectFlags.SkipSelf)) {
|
11277 |
|
11278 | let record = this.records.get(token);
|
11279 | if (record === undefined) {
|
11280 |
|
11281 |
|
11282 | const def = couldBeInjectableType(token) && getInjectableDef(token);
|
11283 | if (def && this.injectableDefInScope(def)) {
|
11284 |
|
11285 |
|
11286 | record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET);
|
11287 | }
|
11288 | else {
|
11289 | record = null;
|
11290 | }
|
11291 | this.records.set(token, record);
|
11292 | }
|
11293 |
|
11294 | if (record != null ) {
|
11295 | return this.hydrate(token, record);
|
11296 | }
|
11297 | }
|
11298 |
|
11299 |
|
11300 | const nextInjector = !(flags & InjectFlags.Self) ? this.parent : getNullInjector();
|
11301 |
|
11302 |
|
11303 | notFoundValue = (flags & InjectFlags.Optional) && notFoundValue === THROW_IF_NOT_FOUND ?
|
11304 | null :
|
11305 | notFoundValue;
|
11306 | return nextInjector.get(token, notFoundValue);
|
11307 | }
|
11308 | catch (e) {
|
11309 | if (e.name === 'NullInjectorError') {
|
11310 | const path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
|
11311 | path.unshift(stringify(token));
|
11312 | if (previousInjector) {
|
11313 |
|
11314 | throw e;
|
11315 | }
|
11316 | else {
|
11317 |
|
11318 | return catchInjectorError(e, token, 'R3InjectorError', this.source);
|
11319 | }
|
11320 | }
|
11321 | else {
|
11322 | throw e;
|
11323 | }
|
11324 | }
|
11325 | finally {
|
11326 |
|
11327 | setInjectImplementation(previousInjectImplementation);
|
11328 | setCurrentInjector(previousInjector);
|
11329 | }
|
11330 | }
|
11331 |
|
11332 | _resolveInjectorDefTypes() {
|
11333 | this.injectorDefTypes.forEach(defType => this.get(defType));
|
11334 | }
|
11335 | toString() {
|
11336 | const tokens = [], records = this.records;
|
11337 | records.forEach((v, token) => tokens.push(stringify(token)));
|
11338 | return `R3Injector[${tokens.join(', ')}]`;
|
11339 | }
|
11340 | assertNotDestroyed() {
|
11341 | if (this._destroyed) {
|
11342 | throw new Error('Injector has already been destroyed.');
|
11343 | }
|
11344 | }
|
11345 | |
11346 |
|
11347 |
|
11348 |
|
11349 |
|
11350 |
|
11351 |
|
11352 |
|
11353 |
|
11354 | processInjectorType(defOrWrappedDef, parents, dedupStack) {
|
11355 | defOrWrappedDef = resolveForwardRef(defOrWrappedDef);
|
11356 | if (!defOrWrappedDef)
|
11357 | return false;
|
11358 |
|
11359 |
|
11360 |
|
11361 |
|
11362 | let def = getInjectorDef(defOrWrappedDef);
|
11363 |
|
11364 | const ngModule = (def == null) && defOrWrappedDef.ngModule || undefined;
|
11365 |
|
11366 |
|
11367 |
|
11368 | const defType = (ngModule === undefined) ? defOrWrappedDef : ngModule;
|
11369 |
|
11370 | if (ngDevMode && parents.indexOf(defType) !== -1) {
|
11371 | const defName = stringify(defType);
|
11372 | const path = parents.map(stringify);
|
11373 | throwCyclicDependencyError(defName, path);
|
11374 | }
|
11375 |
|
11376 | const isDuplicate = dedupStack.indexOf(defType) !== -1;
|
11377 |
|
11378 |
|
11379 | if (ngModule !== undefined) {
|
11380 | def = getInjectorDef(ngModule);
|
11381 | }
|
11382 |
|
11383 | if (def == null) {
|
11384 | return false;
|
11385 | }
|
11386 |
|
11387 |
|
11388 | if (def.imports != null && !isDuplicate) {
|
11389 |
|
11390 |
|
11391 | ngDevMode && parents.push(defType);
|
11392 |
|
11393 | dedupStack.push(defType);
|
11394 | let importTypesWithProviders;
|
11395 | try {
|
11396 | deepForEach(def.imports, imported => {
|
11397 | if (this.processInjectorType(imported, parents, dedupStack)) {
|
11398 | if (importTypesWithProviders === undefined)
|
11399 | importTypesWithProviders = [];
|
11400 |
|
11401 |
|
11402 | importTypesWithProviders.push(imported);
|
11403 | }
|
11404 | });
|
11405 | }
|
11406 | finally {
|
11407 |
|
11408 | ngDevMode && parents.pop();
|
11409 | }
|
11410 |
|
11411 |
|
11412 |
|
11413 | if (importTypesWithProviders !== undefined) {
|
11414 | for (let i = 0; i < importTypesWithProviders.length; i++) {
|
11415 | const { ngModule, providers } = importTypesWithProviders[i];
|
11416 | deepForEach(providers, provider => this.processProvider(provider, ngModule, providers || EMPTY_ARRAY));
|
11417 | }
|
11418 | }
|
11419 | }
|
11420 |
|
11421 |
|
11422 | this.injectorDefTypes.add(defType);
|
11423 | const factory = getFactoryDef(defType) || (() => new defType());
|
11424 | this.records.set(defType, makeRecord(factory, NOT_YET));
|
11425 |
|
11426 | const defProviders = def.providers;
|
11427 | if (defProviders != null && !isDuplicate) {
|
11428 | const injectorType = defOrWrappedDef;
|
11429 | deepForEach(defProviders, provider => this.processProvider(provider, injectorType, defProviders));
|
11430 | }
|
11431 | return (ngModule !== undefined &&
|
11432 | defOrWrappedDef.providers !== undefined);
|
11433 | }
|
11434 | |
11435 |
|
11436 |
|
11437 | processProvider(provider, ngModuleType, providers) {
|
11438 |
|
11439 |
|
11440 | provider = resolveForwardRef(provider);
|
11441 | let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide);
|
11442 |
|
11443 | const record = providerToRecord(provider, ngModuleType, providers);
|
11444 | if (!isTypeProvider(provider) && provider.multi === true) {
|
11445 |
|
11446 |
|
11447 | let multiRecord = this.records.get(token);
|
11448 | if (multiRecord) {
|
11449 |
|
11450 | if (ngDevMode && multiRecord.multi === undefined) {
|
11451 | throwMixedMultiProviderError();
|
11452 | }
|
11453 | }
|
11454 | else {
|
11455 | multiRecord = makeRecord(undefined, NOT_YET, true);
|
11456 | multiRecord.factory = () => injectArgs(multiRecord.multi);
|
11457 | this.records.set(token, multiRecord);
|
11458 | }
|
11459 | token = provider;
|
11460 | multiRecord.multi.push(provider);
|
11461 | }
|
11462 | else {
|
11463 | const existing = this.records.get(token);
|
11464 | if (ngDevMode && existing && existing.multi !== undefined) {
|
11465 | throwMixedMultiProviderError();
|
11466 | }
|
11467 | }
|
11468 | this.records.set(token, record);
|
11469 | }
|
11470 | hydrate(token, record) {
|
11471 | if (ngDevMode && record.value === CIRCULAR$1) {
|
11472 | throwCyclicDependencyError(stringify(token));
|
11473 | }
|
11474 | else if (record.value === NOT_YET) {
|
11475 | record.value = CIRCULAR$1;
|
11476 | record.value = record.factory();
|
11477 | }
|
11478 | if (typeof record.value === 'object' && record.value && hasOnDestroy(record.value)) {
|
11479 | this.onDestroy.add(record.value);
|
11480 | }
|
11481 | return record.value;
|
11482 | }
|
11483 | injectableDefInScope(def) {
|
11484 | if (!def.providedIn) {
|
11485 | return false;
|
11486 | }
|
11487 | const providedIn = resolveForwardRef(def.providedIn);
|
11488 | if (typeof providedIn === 'string') {
|
11489 | return providedIn === 'any' || (providedIn === this.scope);
|
11490 | }
|
11491 | else {
|
11492 | return this.injectorDefTypes.has(providedIn);
|
11493 | }
|
11494 | }
|
11495 | }
|
11496 | function injectableDefOrInjectorDefFactory(token) {
|
11497 |
|
11498 | const injectableDef = getInjectableDef(token);
|
11499 | const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token);
|
11500 | if (factory !== null) {
|
11501 | return factory;
|
11502 | }
|
11503 |
|
11504 |
|
11505 | if (token instanceof InjectionToken) {
|
11506 | throw new Error(`Token ${stringify(token)} is missing a ɵprov definition.`);
|
11507 | }
|
11508 |
|
11509 | if (token instanceof Function) {
|
11510 | return getUndecoratedInjectableFactory(token);
|
11511 | }
|
11512 |
|
11513 | throw new Error('unreachable');
|
11514 | }
|
11515 | function getUndecoratedInjectableFactory(token) {
|
11516 |
|
11517 | const paramLength = token.length;
|
11518 | if (paramLength > 0) {
|
11519 | const args = newArray(paramLength, '?');
|
11520 | throw new Error(`Can't resolve all parameters for ${stringify(token)}: (${args.join(', ')}).`);
|
11521 | }
|
11522 |
|
11523 |
|
11524 |
|
11525 |
|
11526 |
|
11527 | const inheritedInjectableDef = getInheritedInjectableDef(token);
|
11528 | if (inheritedInjectableDef !== null) {
|
11529 | return () => inheritedInjectableDef.factory(token);
|
11530 | }
|
11531 | else {
|
11532 | return () => new token();
|
11533 | }
|
11534 | }
|
11535 | function providerToRecord(provider, ngModuleType, providers) {
|
11536 | if (isValueProvider(provider)) {
|
11537 | return makeRecord(undefined, provider.useValue);
|
11538 | }
|
11539 | else {
|
11540 | const factory = providerToFactory(provider, ngModuleType, providers);
|
11541 | return makeRecord(factory, NOT_YET);
|
11542 | }
|
11543 | }
|
11544 |
|
11545 |
|
11546 |
|
11547 |
|
11548 |
|
11549 | function providerToFactory(provider, ngModuleType, providers) {
|
11550 | let factory = undefined;
|
11551 | if (isTypeProvider(provider)) {
|
11552 | const unwrappedProvider = resolveForwardRef(provider);
|
11553 | return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider);
|
11554 | }
|
11555 | else {
|
11556 | if (isValueProvider(provider)) {
|
11557 | factory = () => resolveForwardRef(provider.useValue);
|
11558 | }
|
11559 | else if (isFactoryProvider(provider)) {
|
11560 | factory = () => provider.useFactory(...injectArgs(provider.deps || []));
|
11561 | }
|
11562 | else if (isExistingProvider(provider)) {
|
11563 | factory = () => ɵɵinject(resolveForwardRef(provider.useExisting));
|
11564 | }
|
11565 | else {
|
11566 | const classRef = resolveForwardRef(provider &&
|
11567 | (provider.useClass || provider.provide));
|
11568 | if (ngDevMode && !classRef) {
|
11569 | throwInvalidProviderError(ngModuleType, providers, provider);
|
11570 | }
|
11571 | if (hasDeps(provider)) {
|
11572 | factory = () => new (classRef)(...injectArgs(provider.deps));
|
11573 | }
|
11574 | else {
|
11575 | return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef);
|
11576 | }
|
11577 | }
|
11578 | }
|
11579 | return factory;
|
11580 | }
|
11581 | function makeRecord(factory, value, multi = false) {
|
11582 | return {
|
11583 | factory: factory,
|
11584 | value: value,
|
11585 | multi: multi ? [] : undefined,
|
11586 | };
|
11587 | }
|
11588 | function isValueProvider(value) {
|
11589 | return value !== null && typeof value == 'object' && USE_VALUE$2 in value;
|
11590 | }
|
11591 | function isExistingProvider(value) {
|
11592 | return !!(value && value.useExisting);
|
11593 | }
|
11594 | function isFactoryProvider(value) {
|
11595 | return !!(value && value.useFactory);
|
11596 | }
|
11597 | function isTypeProvider(value) {
|
11598 | return typeof value === 'function';
|
11599 | }
|
11600 | function isClassProvider(value) {
|
11601 | return !!value.useClass;
|
11602 | }
|
11603 | function hasDeps(value) {
|
11604 | return !!value.deps;
|
11605 | }
|
11606 | function hasOnDestroy(value) {
|
11607 | return value !== null && typeof value === 'object' &&
|
11608 | typeof value.ngOnDestroy === 'function';
|
11609 | }
|
11610 | function couldBeInjectableType(value) {
|
11611 | return (typeof value === 'function') ||
|
11612 | (typeof value === 'object' && value instanceof InjectionToken);
|
11613 | }
|
11614 |
|
11615 |
|
11616 |
|
11617 |
|
11618 |
|
11619 |
|
11620 |
|
11621 |
|
11622 | function INJECTOR_IMPL__PRE_R3__(providers, parent, name) {
|
11623 | return new StaticInjector(providers, parent, name);
|
11624 | }
|
11625 | function INJECTOR_IMPL__POST_R3__(providers, parent, name) {
|
11626 | return createInjector$1({ name: name }, parent, providers, name);
|
11627 | }
|
11628 | const INJECTOR_IMPL = INJECTOR_IMPL__POST_R3__;
|
11629 |
|
11630 |
|
11631 |
|
11632 |
|
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 |
|
11640 |
|
11641 |
|
11642 |
|
11643 |
|
11644 |
|
11645 |
|
11646 |
|
11647 |
|
11648 |
|
11649 |
|
11650 |
|
11651 |
|
11652 |
|
11653 | class Injector {
|
11654 | static create(options, parent) {
|
11655 | if (Array.isArray(options)) {
|
11656 | return INJECTOR_IMPL(options, parent, '');
|
11657 | }
|
11658 | else {
|
11659 | return INJECTOR_IMPL(options.providers, options.parent, options.name || '');
|
11660 | }
|
11661 | }
|
11662 | }
|
11663 | Injector.THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;
|
11664 | Injector.NULL = ( new NullInjector());
|
11665 |
|
11666 | Injector.ɵprov = ɵɵdefineInjectable({
|
11667 | token: Injector,
|
11668 | providedIn: 'any',
|
11669 | factory: () => ɵɵinject(INJECTOR),
|
11670 | });
|
11671 |
|
11672 |
|
11673 |
|
11674 |
|
11675 | Injector.__NG_ELEMENT_ID__ = -1 ;
|
11676 | const IDENT = function (value) {
|
11677 | return value;
|
11678 | };
|
11679 | const EMPTY = [];
|
11680 | const CIRCULAR = IDENT;
|
11681 | const MULTI_PROVIDER_FN = function () {
|
11682 | return Array.prototype.slice.call(arguments);
|
11683 | };
|
11684 | const NO_NEW_LINE = 'ɵ';
|
11685 | class StaticInjector {
|
11686 | constructor(providers, parent = Injector.NULL, source = null) {
|
11687 | this.parent = parent;
|
11688 | this.source = source;
|
11689 | const records = this._records = new Map();
|
11690 | records.set(Injector, { token: Injector, fn: IDENT, deps: EMPTY, value: this, useNew: false });
|
11691 | records.set(INJECTOR, { token: INJECTOR, fn: IDENT, deps: EMPTY, value: this, useNew: false });
|
11692 | this.scope = recursivelyProcessProviders(records, providers);
|
11693 | }
|
11694 | get(token, notFoundValue, flags = InjectFlags.Default) {
|
11695 | const records = this._records;
|
11696 | let record = records.get(token);
|
11697 | if (record === undefined) {
|
11698 |
|
11699 | const injectableDef = getInjectableDef(token);
|
11700 | if (injectableDef) {
|
11701 | const providedIn = injectableDef && resolveForwardRef(injectableDef.providedIn);
|
11702 | if (providedIn === 'any' || providedIn != null && providedIn === this.scope) {
|
11703 | records.set(token, record = resolveProvider$1({ provide: token, useFactory: injectableDef.factory, deps: EMPTY }));
|
11704 | }
|
11705 | }
|
11706 | if (record === undefined) {
|
11707 |
|
11708 | records.set(token, null);
|
11709 | }
|
11710 | }
|
11711 | let lastInjector = setCurrentInjector(this);
|
11712 | try {
|
11713 | return tryResolveToken(token, record, records, this.parent, notFoundValue, flags);
|
11714 | }
|
11715 | catch (e) {
|
11716 | return catchInjectorError(e, token, 'StaticInjectorError', this.source);
|
11717 | }
|
11718 | finally {
|
11719 | setCurrentInjector(lastInjector);
|
11720 | }
|
11721 | }
|
11722 | toString() {
|
11723 | const tokens = [], records = this._records;
|
11724 | records.forEach((v, token) => tokens.push(stringify(token)));
|
11725 | return `StaticInjector[${tokens.join(', ')}]`;
|
11726 | }
|
11727 | }
|
11728 | function resolveProvider$1(provider) {
|
11729 | const deps = computeDeps(provider);
|
11730 | let fn = IDENT;
|
11731 | let value = EMPTY;
|
11732 | let useNew = false;
|
11733 | let provide = resolveForwardRef(provider.provide);
|
11734 | if (USE_VALUE$2 in provider) {
|
11735 |
|
11736 | value = provider.useValue;
|
11737 | }
|
11738 | else if (provider.useFactory) {
|
11739 | fn = provider.useFactory;
|
11740 | }
|
11741 | else if (provider.useExisting) {
|
11742 |
|
11743 | }
|
11744 | else if (provider.useClass) {
|
11745 | useNew = true;
|
11746 | fn = resolveForwardRef(provider.useClass);
|
11747 | }
|
11748 | else if (typeof provide == 'function') {
|
11749 | useNew = true;
|
11750 | fn = provide;
|
11751 | }
|
11752 | else {
|
11753 | throw staticError('StaticProvider does not have [useValue|useFactory|useExisting|useClass] or [provide] is not newable', provider);
|
11754 | }
|
11755 | return { deps, fn, useNew, value };
|
11756 | }
|
11757 | function multiProviderMixError(token) {
|
11758 | return staticError('Cannot mix multi providers and regular providers', token);
|
11759 | }
|
11760 | function recursivelyProcessProviders(records, provider) {
|
11761 | let scope = null;
|
11762 | if (provider) {
|
11763 | provider = resolveForwardRef(provider);
|
11764 | if (Array.isArray(provider)) {
|
11765 |
|
11766 | for (let i = 0; i < provider.length; i++) {
|
11767 | scope = recursivelyProcessProviders(records, provider[i]) || scope;
|
11768 | }
|
11769 | }
|
11770 | else if (typeof provider === 'function') {
|
11771 |
|
11772 |
|
11773 | throw staticError('Function/Class not supported', provider);
|
11774 | }
|
11775 | else if (provider && typeof provider === 'object' && provider.provide) {
|
11776 |
|
11777 | let token = resolveForwardRef(provider.provide);
|
11778 | const resolvedProvider = resolveProvider$1(provider);
|
11779 | if (provider.multi === true) {
|
11780 |
|
11781 | let multiProvider = records.get(token);
|
11782 | if (multiProvider) {
|
11783 | if (multiProvider.fn !== MULTI_PROVIDER_FN) {
|
11784 | throw multiProviderMixError(token);
|
11785 | }
|
11786 | }
|
11787 | else {
|
11788 |
|
11789 | records.set(token, multiProvider = {
|
11790 | token: provider.provide,
|
11791 | deps: [],
|
11792 | useNew: false,
|
11793 | fn: MULTI_PROVIDER_FN,
|
11794 | value: EMPTY
|
11795 | });
|
11796 | }
|
11797 |
|
11798 | token = provider;
|
11799 | multiProvider.deps.push({ token, options: 6 });
|
11800 | }
|
11801 | const record = records.get(token);
|
11802 | if (record && record.fn == MULTI_PROVIDER_FN) {
|
11803 | throw multiProviderMixError(token);
|
11804 | }
|
11805 | if (token === INJECTOR_SCOPE) {
|
11806 | scope = resolvedProvider.value;
|
11807 | }
|
11808 | records.set(token, resolvedProvider);
|
11809 | }
|
11810 | else {
|
11811 | throw staticError('Unexpected provider', provider);
|
11812 | }
|
11813 | }
|
11814 | return scope;
|
11815 | }
|
11816 | function tryResolveToken(token, record, records, parent, notFoundValue, flags) {
|
11817 | try {
|
11818 | return resolveToken(token, record, records, parent, notFoundValue, flags);
|
11819 | }
|
11820 | catch (e) {
|
11821 |
|
11822 | if (!(e instanceof Error)) {
|
11823 | e = new Error(e);
|
11824 | }
|
11825 | const path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
|
11826 | path.unshift(token);
|
11827 | if (record && record.value == CIRCULAR) {
|
11828 |
|
11829 | record.value = EMPTY;
|
11830 | }
|
11831 | throw e;
|
11832 | }
|
11833 | }
|
11834 | function resolveToken(token, record, records, parent, notFoundValue, flags) {
|
11835 | let value;
|
11836 | if (record && !(flags & InjectFlags.SkipSelf)) {
|
11837 |
|
11838 |
|
11839 | value = record.value;
|
11840 | if (value == CIRCULAR) {
|
11841 | throw Error(NO_NEW_LINE + 'Circular dependency');
|
11842 | }
|
11843 | else if (value === EMPTY) {
|
11844 | record.value = CIRCULAR;
|
11845 | let obj = undefined;
|
11846 | let useNew = record.useNew;
|
11847 | let fn = record.fn;
|
11848 | let depRecords = record.deps;
|
11849 | let deps = EMPTY;
|
11850 | if (depRecords.length) {
|
11851 | deps = [];
|
11852 | for (let i = 0; i < depRecords.length; i++) {
|
11853 | const depRecord = depRecords[i];
|
11854 | const options = depRecord.options;
|
11855 | const childRecord = options & 2 ? records.get(depRecord.token) : undefined;
|
11856 | deps.push(tryResolveToken(
|
11857 |
|
11858 | depRecord.token,
|
11859 |
|
11860 |
|
11861 | childRecord,
|
11862 |
|
11863 | records,
|
11864 |
|
11865 |
|
11866 | !childRecord && !(options & 4 ) ? Injector.NULL : parent, options & 1 ? null : Injector.THROW_IF_NOT_FOUND, InjectFlags.Default));
|
11867 | }
|
11868 | }
|
11869 | record.value = value = useNew ? new fn(...deps) : fn.apply(obj, deps);
|
11870 | }
|
11871 | }
|
11872 | else if (!(flags & InjectFlags.Self)) {
|
11873 | value = parent.get(token, notFoundValue, InjectFlags.Default);
|
11874 | }
|
11875 | else if (!(flags & InjectFlags.Optional)) {
|
11876 | value = Injector.NULL.get(token, notFoundValue);
|
11877 | }
|
11878 | else {
|
11879 | value = Injector.NULL.get(token, typeof notFoundValue !== 'undefined' ? notFoundValue : null);
|
11880 | }
|
11881 | return value;
|
11882 | }
|
11883 | function computeDeps(provider) {
|
11884 | let deps = EMPTY;
|
11885 | const providerDeps = provider.deps;
|
11886 | if (providerDeps && providerDeps.length) {
|
11887 | deps = [];
|
11888 | for (let i = 0; i < providerDeps.length; i++) {
|
11889 | let options = 6 ;
|
11890 | let token = resolveForwardRef(providerDeps[i]);
|
11891 | if (Array.isArray(token)) {
|
11892 | for (let j = 0, annotations = token; j < annotations.length; j++) {
|
11893 | const annotation = annotations[j];
|
11894 | if (annotation instanceof Optional || annotation == Optional) {
|
11895 | options = options | 1 ;
|
11896 | }
|
11897 | else if (annotation instanceof SkipSelf || annotation == SkipSelf) {
|
11898 | options = options & ~2 ;
|
11899 | }
|
11900 | else if (annotation instanceof Self || annotation == Self) {
|
11901 | options = options & ~4 ;
|
11902 | }
|
11903 | else if (annotation instanceof Inject) {
|
11904 | token = annotation.token;
|
11905 | }
|
11906 | else {
|
11907 | token = resolveForwardRef(annotation);
|
11908 | }
|
11909 | }
|
11910 | }
|
11911 | deps.push({ token, options });
|
11912 | }
|
11913 | }
|
11914 | else if (provider.useExisting) {
|
11915 | const token = resolveForwardRef(provider.useExisting);
|
11916 | deps = [{ token, options: 6 }];
|
11917 | }
|
11918 | else if (!providerDeps && !(USE_VALUE$2 in provider)) {
|
11919 |
|
11920 | throw staticError('\'deps\' required', provider);
|
11921 | }
|
11922 | return deps;
|
11923 | }
|
11924 | function staticError(text, obj) {
|
11925 | return new Error(formatError(text, obj, 'StaticInjectorError'));
|
11926 | }
|
11927 |
|
11928 |
|
11929 |
|
11930 |
|
11931 |
|
11932 |
|
11933 |
|
11934 |
|
11935 |
|
11936 |
|
11937 |
|
11938 |
|
11939 |
|
11940 |
|
11941 |
|
11942 |
|
11943 |
|
11944 |
|
11945 |
|
11946 |
|
11947 |
|
11948 |
|
11949 |
|
11950 |
|
11951 |
|
11952 |
|
11953 |
|
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 |
|
11959 |
|
11960 |
|
11961 |
|
11962 | function getComponent$1(element) {
|
11963 | assertDomElement(element);
|
11964 | const context = getLContext(element);
|
11965 | if (context === null)
|
11966 | return null;
|
11967 | if (context.component === undefined) {
|
11968 | context.component = getComponentAtNodeIndex(context.nodeIndex, context.lView);
|
11969 | }
|
11970 | return context.component;
|
11971 | }
|
11972 |
|
11973 |
|
11974 |
|
11975 |
|
11976 |
|
11977 |
|
11978 |
|
11979 |
|
11980 |
|
11981 |
|
11982 |
|
11983 |
|
11984 | function getContext(element) {
|
11985 | assertDomElement(element);
|
11986 | const context = getLContext(element);
|
11987 | return context === null ? null : context.lView[CONTEXT];
|
11988 | }
|
11989 |
|
11990 |
|
11991 |
|
11992 |
|
11993 |
|
11994 |
|
11995 |
|
11996 |
|
11997 |
|
11998 |
|
11999 |
|
12000 |
|
12001 |
|
12002 |
|
12003 |
|
12004 | function getOwningComponent(elementOrDir) {
|
12005 | const context = getLContext(elementOrDir);
|
12006 | if (context === null)
|
12007 | return null;
|
12008 | let lView = context.lView;
|
12009 | let parent;
|
12010 | ngDevMode && assertLView(lView);
|
12011 | while (lView[TVIEW].type === 2 && (parent = getLViewParent(lView))) {
|
12012 | lView = parent;
|
12013 | }
|
12014 | return lView[FLAGS] & 512 ? null : lView[CONTEXT];
|
12015 | }
|
12016 |
|
12017 |
|
12018 |
|
12019 |
|
12020 |
|
12021 |
|
12022 |
|
12023 |
|
12024 |
|
12025 |
|
12026 |
|
12027 | function getRootComponents(elementOrDir) {
|
12028 | return [...getRootContext(elementOrDir).components];
|
12029 | }
|
12030 |
|
12031 |
|
12032 |
|
12033 |
|
12034 |
|
12035 |
|
12036 |
|
12037 |
|
12038 |
|
12039 |
|
12040 | function getInjector(elementOrDir) {
|
12041 | const context = getLContext(elementOrDir);
|
12042 | if (context === null)
|
12043 | return Injector.NULL;
|
12044 | const tNode = context.lView[TVIEW].data[context.nodeIndex];
|
12045 | return new NodeInjector(tNode, context.lView);
|
12046 | }
|
12047 |
|
12048 |
|
12049 |
|
12050 |
|
12051 |
|
12052 | function getInjectionTokens(element) {
|
12053 | const context = getLContext(element);
|
12054 | if (context === null)
|
12055 | return [];
|
12056 | const lView = context.lView;
|
12057 | const tView = lView[TVIEW];
|
12058 | const tNode = tView.data[context.nodeIndex];
|
12059 | const providerTokens = [];
|
12060 | const startIndex = tNode.providerIndexes & 1048575 ;
|
12061 | const endIndex = tNode.directiveEnd;
|
12062 | for (let i = startIndex; i < endIndex; i++) {
|
12063 | let value = tView.data[i];
|
12064 | if (isDirectiveDefHack(value)) {
|
12065 |
|
12066 |
|
12067 |
|
12068 |
|
12069 | value = value.type;
|
12070 | }
|
12071 | providerTokens.push(value);
|
12072 | }
|
12073 | return providerTokens;
|
12074 | }
|
12075 |
|
12076 |
|
12077 |
|
12078 |
|
12079 |
|
12080 |
|
12081 |
|
12082 |
|
12083 |
|
12084 |
|
12085 |
|
12086 |
|
12087 |
|
12088 |
|
12089 |
|
12090 |
|
12091 |
|
12092 |
|
12093 |
|
12094 |
|
12095 |
|
12096 |
|
12097 |
|
12098 |
|
12099 |
|
12100 | function getDirectives(node) {
|
12101 |
|
12102 | if (node instanceof Text) {
|
12103 | return [];
|
12104 | }
|
12105 | const context = getLContext(node);
|
12106 | if (context === null) {
|
12107 | return [];
|
12108 | }
|
12109 | const lView = context.lView;
|
12110 | const tView = lView[TVIEW];
|
12111 | const nodeIndex = context.nodeIndex;
|
12112 | if (!tView?.data[nodeIndex]) {
|
12113 | return [];
|
12114 | }
|
12115 | if (context.directives === undefined) {
|
12116 | context.directives = getDirectivesAtNodeIndex(nodeIndex, lView, false);
|
12117 | }
|
12118 |
|
12119 |
|
12120 | return context.directives === null ? [] : [...context.directives];
|
12121 | }
|
12122 |
|
12123 |
|
12124 |
|
12125 |
|
12126 |
|
12127 |
|
12128 |
|
12129 |
|
12130 |
|
12131 |
|
12132 |
|
12133 | function getDirectiveMetadata$1(directiveOrComponentInstance) {
|
12134 | const { constructor } = directiveOrComponentInstance;
|
12135 | if (!constructor) {
|
12136 | throw new Error('Unable to find the instance constructor');
|
12137 | }
|
12138 |
|
12139 |
|
12140 | const componentDef = getComponentDef(constructor);
|
12141 | if (componentDef) {
|
12142 | return {
|
12143 | inputs: componentDef.inputs,
|
12144 | outputs: componentDef.outputs,
|
12145 | encapsulation: componentDef.encapsulation,
|
12146 | changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush :
|
12147 | ChangeDetectionStrategy.Default
|
12148 | };
|
12149 | }
|
12150 | const directiveDef = getDirectiveDef(constructor);
|
12151 | if (directiveDef) {
|
12152 | return { inputs: directiveDef.inputs, outputs: directiveDef.outputs };
|
12153 | }
|
12154 | return null;
|
12155 | }
|
12156 |
|
12157 |
|
12158 |
|
12159 |
|
12160 |
|
12161 |
|
12162 |
|
12163 |
|
12164 | function getLocalRefs(target) {
|
12165 | const context = getLContext(target);
|
12166 | if (context === null)
|
12167 | return {};
|
12168 | if (context.localRefs === undefined) {
|
12169 | context.localRefs = discoverLocalRefs(context.lView, context.nodeIndex);
|
12170 | }
|
12171 | return context.localRefs || {};
|
12172 | }
|
12173 |
|
12174 |
|
12175 |
|
12176 |
|
12177 |
|
12178 |
|
12179 |
|
12180 |
|
12181 |
|
12182 |
|
12183 |
|
12184 | function getHostElement(componentOrDirective) {
|
12185 | return getLContext(componentOrDirective).native;
|
12186 | }
|
12187 |
|
12188 |
|
12189 |
|
12190 |
|
12191 |
|
12192 |
|
12193 |
|
12194 |
|
12195 |
|
12196 |
|
12197 | function getRenderedText(component) {
|
12198 | const hostElement = getHostElement(component);
|
12199 | return hostElement.textContent || '';
|
12200 | }
|
12201 |
|
12202 |
|
12203 |
|
12204 |
|
12205 |
|
12206 |
|
12207 |
|
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 |
|
12213 |
|
12214 |
|
12215 |
|
12216 |
|
12217 |
|
12218 |
|
12219 |
|
12220 |
|
12221 |
|
12222 |
|
12223 |
|
12224 |
|
12225 |
|
12226 |
|
12227 |
|
12228 |
|
12229 |
|
12230 |
|
12231 |
|
12232 | function getListeners(element) {
|
12233 | assertDomElement(element);
|
12234 | const lContext = getLContext(element);
|
12235 | if (lContext === null)
|
12236 | return [];
|
12237 | const lView = lContext.lView;
|
12238 | const tView = lView[TVIEW];
|
12239 | const lCleanup = lView[CLEANUP];
|
12240 | const tCleanup = tView.cleanup;
|
12241 | const listeners = [];
|
12242 | if (tCleanup && lCleanup) {
|
12243 | for (let i = 0; i < tCleanup.length;) {
|
12244 | const firstParam = tCleanup[i++];
|
12245 | const secondParam = tCleanup[i++];
|
12246 | if (typeof firstParam === 'string') {
|
12247 | const name = firstParam;
|
12248 | const listenerElement = unwrapRNode(lView[secondParam]);
|
12249 | const callback = lCleanup[tCleanup[i++]];
|
12250 | const useCaptureOrIndx = tCleanup[i++];
|
12251 |
|
12252 |
|
12253 |
|
12254 | const type = (typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0) ? 'dom' : 'output';
|
12255 | const useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : false;
|
12256 | if (element == listenerElement) {
|
12257 | listeners.push({ element, name, callback, useCapture, type });
|
12258 | }
|
12259 | }
|
12260 | }
|
12261 | }
|
12262 | listeners.sort(sortListeners);
|
12263 | return listeners;
|
12264 | }
|
12265 | function sortListeners(a, b) {
|
12266 | if (a.name == b.name)
|
12267 | return 0;
|
12268 | return a.name < b.name ? -1 : 1;
|
12269 | }
|
12270 |
|
12271 |
|
12272 |
|
12273 |
|
12274 |
|
12275 | function isDirectiveDefHack(obj) {
|
12276 | return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
|
12277 | }
|
12278 |
|
12279 |
|
12280 |
|
12281 |
|
12282 |
|
12283 | function getDebugNode$1(element) {
|
12284 | if (ngDevMode && !(element instanceof Node)) {
|
12285 | throw new Error('Expecting instance of DOM Element');
|
12286 | }
|
12287 | const lContext = getLContext(element);
|
12288 | if (lContext === null) {
|
12289 | return null;
|
12290 | }
|
12291 | const lView = lContext.lView;
|
12292 | const nodeIndex = lContext.nodeIndex;
|
12293 | if (nodeIndex !== -1) {
|
12294 | const valueInLView = lView[nodeIndex];
|
12295 |
|
12296 |
|
12297 | const tNode = isLView(valueInLView) ? valueInLView[T_HOST] : getTNode(lView[TVIEW], nodeIndex);
|
12298 | ngDevMode &&
|
12299 | assertEqual(tNode.index, nodeIndex, 'Expecting that TNode at index is same as index');
|
12300 | return buildDebugNode(tNode, lView);
|
12301 | }
|
12302 | return null;
|
12303 | }
|
12304 |
|
12305 |
|
12306 |
|
12307 |
|
12308 |
|
12309 |
|
12310 |
|
12311 |
|
12312 | function getComponentLView(target) {
|
12313 | const lContext = getLContext(target);
|
12314 | const nodeIndx = lContext.nodeIndex;
|
12315 | const lView = lContext.lView;
|
12316 | const componentLView = lView[nodeIndx];
|
12317 | ngDevMode && assertLView(componentLView);
|
12318 | return componentLView;
|
12319 | }
|
12320 |
|
12321 | function assertDomElement(value) {
|
12322 | if (typeof Element !== 'undefined' && !(value instanceof Element)) {
|
12323 | throw new Error('Expecting instance of DOM Element');
|
12324 | }
|
12325 | }
|
12326 |
|
12327 |
|
12328 |
|
12329 |
|
12330 |
|
12331 |
|
12332 |
|
12333 |
|
12334 |
|
12335 |
|
12336 |
|
12337 |
|
12338 |
|
12339 |
|
12340 |
|
12341 |
|
12342 |
|
12343 | function applyChanges(component) {
|
12344 | markDirty(component);
|
12345 | getRootComponents(component).forEach(rootComponent => detectChanges(rootComponent));
|
12346 | }
|
12347 |
|
12348 |
|
12349 |
|
12350 |
|
12351 |
|
12352 |
|
12353 |
|
12354 |
|
12355 |
|
12356 |
|
12357 |
|
12358 |
|
12359 |
|
12360 |
|
12361 |
|
12362 |
|
12363 |
|
12364 |
|
12365 |
|
12366 |
|
12367 |
|
12368 |
|
12369 | const GLOBAL_PUBLISH_EXPANDO_KEY = 'ng';
|
12370 | let _published = false;
|
12371 |
|
12372 |
|
12373 |
|
12374 |
|
12375 |
|
12376 |
|
12377 | function publishDefaultGlobalUtils$1() {
|
12378 | if (!_published) {
|
12379 | _published = true;
|
12380 | |
12381 |
|
12382 |
|
12383 |
|
12384 |
|
12385 | publishGlobalUtil('ɵsetProfiler', setProfiler);
|
12386 | publishGlobalUtil('getDirectiveMetadata', getDirectiveMetadata$1);
|
12387 | publishGlobalUtil('getComponent', getComponent$1);
|
12388 | publishGlobalUtil('getContext', getContext);
|
12389 | publishGlobalUtil('getListeners', getListeners);
|
12390 | publishGlobalUtil('getOwningComponent', getOwningComponent);
|
12391 | publishGlobalUtil('getHostElement', getHostElement);
|
12392 | publishGlobalUtil('getInjector', getInjector);
|
12393 | publishGlobalUtil('getRootComponents', getRootComponents);
|
12394 | publishGlobalUtil('getDirectives', getDirectives);
|
12395 | publishGlobalUtil('applyChanges', applyChanges);
|
12396 | }
|
12397 | }
|
12398 |
|
12399 |
|
12400 |
|
12401 |
|
12402 | function publishGlobalUtil(name, fn) {
|
12403 | if (typeof COMPILED === 'undefined' || !COMPILED) {
|
12404 |
|
12405 |
|
12406 |
|
12407 |
|
12408 | const w = _global;
|
12409 | ngDevMode && assertDefined(fn, 'function not defined');
|
12410 | if (w) {
|
12411 | let container = w[GLOBAL_PUBLISH_EXPANDO_KEY];
|
12412 | if (!container) {
|
12413 | container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {};
|
12414 | }
|
12415 | container[name] = fn;
|
12416 | }
|
12417 | }
|
12418 | }
|
12419 |
|
12420 |
|
12421 |
|
12422 |
|
12423 |
|
12424 |
|
12425 |
|
12426 |
|
12427 |
|
12428 | const NULL_INJECTOR = {
|
12429 | get: (token, notFoundValue) => {
|
12430 | throwProviderNotFoundError(token, 'NullInjector');
|
12431 | }
|
12432 | };
|
12433 |
|
12434 |
|
12435 |
|
12436 |
|
12437 |
|
12438 |
|
12439 |
|
12440 |
|
12441 |
|
12442 |
|
12443 |
|
12444 |
|
12445 |
|
12446 | function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts = {}) {
|
12447 | ngDevMode && publishDefaultGlobalUtils$1();
|
12448 | ngDevMode && assertComponentType(componentType);
|
12449 | const rendererFactory = opts.rendererFactory || domRendererFactory3;
|
12450 | const sanitizer = opts.sanitizer || null;
|
12451 | const componentDef = getComponentDef(componentType);
|
12452 | if (componentDef.type != componentType)
|
12453 | componentDef.type = componentType;
|
12454 |
|
12455 | const componentTag = componentDef.selectors[0][0];
|
12456 | const hostRenderer = rendererFactory.createRenderer(null, null);
|
12457 | const hostRNode = locateHostElement(hostRenderer, opts.host || componentTag, componentDef.encapsulation);
|
12458 | const rootFlags = componentDef.onPush ? 64 | 512 :
|
12459 | 16 | 512 ;
|
12460 | const rootContext = createRootContext(opts.scheduler, opts.playerHandler);
|
12461 | const renderer = rendererFactory.createRenderer(hostRNode, componentDef);
|
12462 | const rootTView = createTView(0 , null, null, 1, 0, null, null, null, null, null);
|
12463 | const rootView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, renderer, null, opts.injector || null);
|
12464 | enterView(rootView);
|
12465 | let component;
|
12466 | try {
|
12467 | if (rendererFactory.begin)
|
12468 | rendererFactory.begin();
|
12469 | const componentView = createRootComponentView(hostRNode, componentDef, rootView, rendererFactory, renderer, sanitizer);
|
12470 | component = createRootComponent(componentView, componentDef, rootView, rootContext, opts.hostFeatures || null);
|
12471 |
|
12472 | renderView(rootTView, rootView, null);
|
12473 |
|
12474 | refreshView(rootTView, rootView, null, null);
|
12475 | }
|
12476 | finally {
|
12477 | leaveView();
|
12478 | if (rendererFactory.end)
|
12479 | rendererFactory.end();
|
12480 | }
|
12481 | return component;
|
12482 | }
|
12483 |
|
12484 |
|
12485 |
|
12486 |
|
12487 |
|
12488 |
|
12489 |
|
12490 |
|
12491 |
|
12492 |
|
12493 |
|
12494 |
|
12495 | function createRootComponentView(rNode, def, rootView, rendererFactory, hostRenderer, sanitizer) {
|
12496 | const tView = rootView[TVIEW];
|
12497 | const index = HEADER_OFFSET;
|
12498 | ngDevMode && assertIndexInRange(rootView, index);
|
12499 | rootView[index] = rNode;
|
12500 |
|
12501 |
|
12502 |
|
12503 | const tNode = getOrCreateTNode(tView, index, 2 , '#host', null);
|
12504 | const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
|
12505 | if (mergedAttrs !== null) {
|
12506 | computeStaticStyling(tNode, mergedAttrs, true);
|
12507 | if (rNode !== null) {
|
12508 | setUpAttributes(hostRenderer, rNode, mergedAttrs);
|
12509 | if (tNode.classes !== null) {
|
12510 | writeDirectClass(hostRenderer, rNode, tNode.classes);
|
12511 | }
|
12512 | if (tNode.styles !== null) {
|
12513 | writeDirectStyle(hostRenderer, rNode, tNode.styles);
|
12514 | }
|
12515 | }
|
12516 | }
|
12517 | const viewRenderer = rendererFactory.createRenderer(rNode, def);
|
12518 | const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 64 : 16 , rootView[index], tNode, rendererFactory, viewRenderer, sanitizer || null, null);
|
12519 | if (tView.firstCreatePass) {
|
12520 | diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
|
12521 | markAsComponentHost(tView, tNode);
|
12522 | initTNodeFlags(tNode, rootView.length, 1);
|
12523 | }
|
12524 | addToViewTree(rootView, componentView);
|
12525 |
|
12526 | return rootView[index] = componentView;
|
12527 | }
|
12528 |
|
12529 |
|
12530 |
|
12531 |
|
12532 | function createRootComponent(componentView, componentDef, rootLView, rootContext, hostFeatures) {
|
12533 | const tView = rootLView[TVIEW];
|
12534 |
|
12535 | const component = instantiateRootComponent(tView, rootLView, componentDef);
|
12536 | rootContext.components.push(component);
|
12537 | componentView[CONTEXT] = component;
|
12538 | hostFeatures && hostFeatures.forEach((feature) => feature(component, componentDef));
|
12539 |
|
12540 |
|
12541 | if (componentDef.contentQueries) {
|
12542 | const tNode = getCurrentTNode();
|
12543 | ngDevMode && assertDefined(tNode, 'TNode expected');
|
12544 | componentDef.contentQueries(1 , component, tNode.directiveStart);
|
12545 | }
|
12546 | const rootTNode = getCurrentTNode();
|
12547 | ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
|
12548 | if (tView.firstCreatePass &&
|
12549 | (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
|
12550 | setSelectedIndex(rootTNode.index);
|
12551 | const rootTView = rootLView[TVIEW];
|
12552 | registerHostBindingOpCodes(rootTView, rootTNode, rootLView, rootTNode.directiveStart, rootTNode.directiveEnd, componentDef);
|
12553 | invokeHostBindingsInCreationMode(componentDef, component);
|
12554 | }
|
12555 | return component;
|
12556 | }
|
12557 | function createRootContext(scheduler, playerHandler) {
|
12558 | return {
|
12559 | components: [],
|
12560 | scheduler: scheduler || defaultScheduler,
|
12561 | clean: CLEAN_PROMISE,
|
12562 | playerHandler: playerHandler || null,
|
12563 | flags: 0
|
12564 | };
|
12565 | }
|
12566 |
|
12567 |
|
12568 |
|
12569 |
|
12570 |
|
12571 |
|
12572 |
|
12573 |
|
12574 |
|
12575 |
|
12576 |
|
12577 |
|
12578 |
|
12579 | function LifecycleHooksFeature(component, def) {
|
12580 | const lView = readPatchedLView(component);
|
12581 | ngDevMode && assertDefined(lView, 'LView is required');
|
12582 | const tView = lView[TVIEW];
|
12583 | const tNode = getCurrentTNode();
|
12584 | ngDevMode && assertDefined(tNode, 'TNode is required');
|
12585 | registerPostOrderHooks(tView, tNode);
|
12586 | }
|
12587 |
|
12588 |
|
12589 |
|
12590 |
|
12591 |
|
12592 |
|
12593 |
|
12594 |
|
12595 |
|
12596 |
|
12597 |
|
12598 |
|
12599 |
|
12600 |
|
12601 |
|
12602 |
|
12603 | function whenRendered(component) {
|
12604 | return getRootContext(component).clean;
|
12605 | }
|
12606 |
|
12607 |
|
12608 |
|
12609 |
|
12610 |
|
12611 |
|
12612 |
|
12613 |
|
12614 | function getSuperType(type) {
|
12615 | return Object.getPrototypeOf(type.prototype).constructor;
|
12616 | }
|
12617 |
|
12618 |
|
12619 |
|
12620 |
|
12621 |
|
12622 |
|
12623 | function ɵɵInheritDefinitionFeature(definition) {
|
12624 | let superType = getSuperType(definition.type);
|
12625 | let shouldInheritFields = true;
|
12626 | const inheritanceChain = [definition];
|
12627 | while (superType) {
|
12628 | let superDef = undefined;
|
12629 | if (isComponentDef(definition)) {
|
12630 |
|
12631 | superDef = superType.ɵcmp || superType.ɵdir;
|
12632 | }
|
12633 | else {
|
12634 | if (superType.ɵcmp) {
|
12635 | throw new Error('Directives cannot inherit Components');
|
12636 | }
|
12637 |
|
12638 | superDef = superType.ɵdir;
|
12639 | }
|
12640 | if (superDef) {
|
12641 | if (shouldInheritFields) {
|
12642 | inheritanceChain.push(superDef);
|
12643 |
|
12644 |
|
12645 | const writeableDef = definition;
|
12646 | writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
|
12647 | writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
|
12648 | writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
|
12649 |
|
12650 | const superHostBindings = superDef.hostBindings;
|
12651 | superHostBindings && inheritHostBindings(definition, superHostBindings);
|
12652 |
|
12653 | const superViewQuery = superDef.viewQuery;
|
12654 | const superContentQueries = superDef.contentQueries;
|
12655 | superViewQuery && inheritViewQuery(definition, superViewQuery);
|
12656 | superContentQueries && inheritContentQueries(definition, superContentQueries);
|
12657 |
|
12658 | fillProperties(definition.inputs, superDef.inputs);
|
12659 | fillProperties(definition.declaredInputs, superDef.declaredInputs);
|
12660 | fillProperties(definition.outputs, superDef.outputs);
|
12661 |
|
12662 |
|
12663 | if (isComponentDef(superDef) && superDef.data.animation) {
|
12664 |
|
12665 |
|
12666 | const defData = definition.data;
|
12667 | defData.animation = (defData.animation || []).concat(superDef.data.animation);
|
12668 | }
|
12669 | }
|
12670 |
|
12671 | const features = superDef.features;
|
12672 | if (features) {
|
12673 | for (let i = 0; i < features.length; i++) {
|
12674 | const feature = features[i];
|
12675 | if (feature && feature.ngInherit) {
|
12676 | feature(definition);
|
12677 | }
|
12678 |
|
12679 |
|
12680 |
|
12681 |
|
12682 |
|
12683 |
|
12684 |
|
12685 | if (feature === ɵɵInheritDefinitionFeature) {
|
12686 | shouldInheritFields = false;
|
12687 | }
|
12688 | }
|
12689 | }
|
12690 | }
|
12691 | superType = Object.getPrototypeOf(superType);
|
12692 | }
|
12693 | mergeHostAttrsAcrossInheritance(inheritanceChain);
|
12694 | }
|
12695 |
|
12696 |
|
12697 |
|
12698 |
|
12699 |
|
12700 |
|
12701 |
|
12702 | function mergeHostAttrsAcrossInheritance(inheritanceChain) {
|
12703 | let hostVars = 0;
|
12704 | let hostAttrs = null;
|
12705 |
|
12706 | for (let i = inheritanceChain.length - 1; i >= 0; i--) {
|
12707 | const def = inheritanceChain[i];
|
12708 |
|
12709 | def.hostVars = (hostVars += def.hostVars);
|
12710 |
|
12711 | def.hostAttrs =
|
12712 | mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
|
12713 | }
|
12714 | }
|
12715 | function maybeUnwrapEmpty(value) {
|
12716 | if (value === EMPTY_OBJ) {
|
12717 | return {};
|
12718 | }
|
12719 | else if (value === EMPTY_ARRAY) {
|
12720 | return [];
|
12721 | }
|
12722 | else {
|
12723 | return value;
|
12724 | }
|
12725 | }
|
12726 | function inheritViewQuery(definition, superViewQuery) {
|
12727 | const prevViewQuery = definition.viewQuery;
|
12728 | if (prevViewQuery) {
|
12729 | definition.viewQuery = (rf, ctx) => {
|
12730 | superViewQuery(rf, ctx);
|
12731 | prevViewQuery(rf, ctx);
|
12732 | };
|
12733 | }
|
12734 | else {
|
12735 | definition.viewQuery = superViewQuery;
|
12736 | }
|
12737 | }
|
12738 | function inheritContentQueries(definition, superContentQueries) {
|
12739 | const prevContentQueries = definition.contentQueries;
|
12740 | if (prevContentQueries) {
|
12741 | definition.contentQueries = (rf, ctx, directiveIndex) => {
|
12742 | superContentQueries(rf, ctx, directiveIndex);
|
12743 | prevContentQueries(rf, ctx, directiveIndex);
|
12744 | };
|
12745 | }
|
12746 | else {
|
12747 | definition.contentQueries = superContentQueries;
|
12748 | }
|
12749 | }
|
12750 | function inheritHostBindings(definition, superHostBindings) {
|
12751 | const prevHostBindings = definition.hostBindings;
|
12752 | if (prevHostBindings) {
|
12753 | definition.hostBindings = (rf, ctx) => {
|
12754 | superHostBindings(rf, ctx);
|
12755 | prevHostBindings(rf, ctx);
|
12756 | };
|
12757 | }
|
12758 | else {
|
12759 | definition.hostBindings = superHostBindings;
|
12760 | }
|
12761 | }
|
12762 |
|
12763 |
|
12764 |
|
12765 |
|
12766 |
|
12767 |
|
12768 |
|
12769 |
|
12770 |
|
12771 |
|
12772 |
|
12773 |
|
12774 | const COPY_DIRECTIVE_FIELDS = [
|
12775 |
|
12776 | 'providersResolver',
|
12777 |
|
12778 |
|
12779 | ];
|
12780 |
|
12781 |
|
12782 |
|
12783 |
|
12784 |
|
12785 |
|
12786 |
|
12787 | const COPY_COMPONENT_FIELDS = [
|
12788 |
|
12789 |
|
12790 | 'template',
|
12791 | 'decls',
|
12792 | 'consts',
|
12793 | 'vars',
|
12794 | 'onPush',
|
12795 | 'ngContentSelectors',
|
12796 |
|
12797 | 'styles',
|
12798 | 'encapsulation',
|
12799 |
|
12800 | 'schemas',
|
12801 | ];
|
12802 |
|
12803 |
|
12804 |
|
12805 |
|
12806 |
|
12807 |
|
12808 |
|
12809 |
|
12810 |
|
12811 |
|
12812 |
|
12813 |
|
12814 |
|
12815 |
|
12816 |
|
12817 |
|
12818 | function ɵɵCopyDefinitionFeature(definition) {
|
12819 | let superType = getSuperType(definition.type);
|
12820 | let superDef = undefined;
|
12821 | if (isComponentDef(definition)) {
|
12822 |
|
12823 | superDef = superType.ɵcmp;
|
12824 | }
|
12825 | else {
|
12826 |
|
12827 | superDef = superType.ɵdir;
|
12828 | }
|
12829 |
|
12830 | const defAny = definition;
|
12831 |
|
12832 | for (const field of COPY_DIRECTIVE_FIELDS) {
|
12833 | defAny[field] = superDef[field];
|
12834 | }
|
12835 | if (isComponentDef(superDef)) {
|
12836 |
|
12837 | for (const field of COPY_COMPONENT_FIELDS) {
|
12838 | defAny[field] = superDef[field];
|
12839 | }
|
12840 | }
|
12841 | }
|
12842 |
|
12843 |
|
12844 |
|
12845 |
|
12846 |
|
12847 |
|
12848 |
|
12849 |
|
12850 | let _symbolIterator = null;
|
12851 | function getSymbolIterator() {
|
12852 | if (!_symbolIterator) {
|
12853 | const Symbol = _global['Symbol'];
|
12854 | if (Symbol && Symbol.iterator) {
|
12855 | _symbolIterator = Symbol.iterator;
|
12856 | }
|
12857 | else {
|
12858 |
|
12859 | const keys = Object.getOwnPropertyNames(Map.prototype);
|
12860 | for (let i = 0; i < keys.length; ++i) {
|
12861 | const key = keys[i];
|
12862 | if (key !== 'entries' && key !== 'size' &&
|
12863 | Map.prototype[key] === Map.prototype['entries']) {
|
12864 | _symbolIterator = key;
|
12865 | }
|
12866 | }
|
12867 | }
|
12868 | }
|
12869 | return _symbolIterator;
|
12870 | }
|
12871 |
|
12872 |
|
12873 |
|
12874 |
|
12875 |
|
12876 |
|
12877 |
|
12878 |
|
12879 | function devModeEqual(a, b) {
|
12880 | const isListLikeIterableA = isListLikeIterable(a);
|
12881 | const isListLikeIterableB = isListLikeIterable(b);
|
12882 | if (isListLikeIterableA && isListLikeIterableB) {
|
12883 | return areIterablesEqual(a, b, devModeEqual);
|
12884 | }
|
12885 | else {
|
12886 | const isAObject = a && (typeof a === 'object' || typeof a === 'function');
|
12887 | const isBObject = b && (typeof b === 'object' || typeof b === 'function');
|
12888 | if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
|
12889 | return true;
|
12890 | }
|
12891 | else {
|
12892 | return Object.is(a, b);
|
12893 | }
|
12894 | }
|
12895 | }
|
12896 | function isListLikeIterable(obj) {
|
12897 | if (!isJsObject(obj))
|
12898 | return false;
|
12899 | return Array.isArray(obj) ||
|
12900 | (!(obj instanceof Map) &&
|
12901 | getSymbolIterator() in obj);
|
12902 | }
|
12903 | function areIterablesEqual(a, b, comparator) {
|
12904 | const iterator1 = a[getSymbolIterator()]();
|
12905 | const iterator2 = b[getSymbolIterator()]();
|
12906 | while (true) {
|
12907 | const item1 = iterator1.next();
|
12908 | const item2 = iterator2.next();
|
12909 | if (item1.done && item2.done)
|
12910 | return true;
|
12911 | if (item1.done || item2.done)
|
12912 | return false;
|
12913 | if (!comparator(item1.value, item2.value))
|
12914 | return false;
|
12915 | }
|
12916 | }
|
12917 | function iterateListLike(obj, fn) {
|
12918 | if (Array.isArray(obj)) {
|
12919 | for (let i = 0; i < obj.length; i++) {
|
12920 | fn(obj[i]);
|
12921 | }
|
12922 | }
|
12923 | else {
|
12924 | const iterator = obj[getSymbolIterator()]();
|
12925 | let item;
|
12926 | while (!((item = iterator.next()).done)) {
|
12927 | fn(item.value);
|
12928 | }
|
12929 | }
|
12930 | }
|
12931 | function isJsObject(o) {
|
12932 | return o !== null && (typeof o === 'function' || typeof o === 'object');
|
12933 | }
|
12934 |
|
12935 |
|
12936 |
|
12937 |
|
12938 |
|
12939 |
|
12940 |
|
12941 |
|
12942 |
|
12943 |
|
12944 | function updateBinding(lView, bindingIndex, value) {
|
12945 | return lView[bindingIndex] = value;
|
12946 | }
|
12947 |
|
12948 | function getBinding(lView, bindingIndex) {
|
12949 | ngDevMode && assertIndexInRange(lView, bindingIndex);
|
12950 | ngDevMode &&
|
12951 | assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
|
12952 | return lView[bindingIndex];
|
12953 | }
|
12954 |
|
12955 |
|
12956 |
|
12957 |
|
12958 |
|
12959 |
|
12960 |
|
12961 |
|
12962 |
|
12963 |
|
12964 |
|
12965 |
|
12966 |
|
12967 | function bindingUpdated(lView, bindingIndex, value) {
|
12968 | ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
|
12969 | ngDevMode &&
|
12970 | assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
|
12971 | const oldValue = lView[bindingIndex];
|
12972 | if (Object.is(oldValue, value)) {
|
12973 | return false;
|
12974 | }
|
12975 | else {
|
12976 | if (ngDevMode && isInCheckNoChangesMode()) {
|
12977 |
|
12978 |
|
12979 | const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined;
|
12980 | if (!devModeEqual(oldValueToCompare, value)) {
|
12981 | const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value);
|
12982 | throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName);
|
12983 | }
|
12984 |
|
12985 |
|
12986 |
|
12987 |
|
12988 | return false;
|
12989 | }
|
12990 | lView[bindingIndex] = value;
|
12991 | return true;
|
12992 | }
|
12993 | }
|
12994 |
|
12995 | function bindingUpdated2(lView, bindingIndex, exp1, exp2) {
|
12996 | const different = bindingUpdated(lView, bindingIndex, exp1);
|
12997 | return bindingUpdated(lView, bindingIndex + 1, exp2) || different;
|
12998 | }
|
12999 |
|
13000 | function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) {
|
13001 | const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
|
13002 | return bindingUpdated(lView, bindingIndex + 2, exp3) || different;
|
13003 | }
|
13004 |
|
13005 | function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
|
13006 | const different = bindingUpdated2(lView, bindingIndex, exp1, exp2);
|
13007 | return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
|
13008 | }
|
13009 |
|
13010 |
|
13011 |
|
13012 |
|
13013 |
|
13014 |
|
13015 |
|
13016 |
|
13017 |
|
13018 |
|
13019 |
|
13020 |
|
13021 |
|
13022 |
|
13023 |
|
13024 |
|
13025 |
|
13026 |
|
13027 |
|
13028 |
|
13029 |
|
13030 | function ɵɵattribute(name, value, sanitizer, namespace) {
|
13031 | const lView = getLView();
|
13032 | const bindingIndex = nextBindingIndex();
|
13033 | if (bindingUpdated(lView, bindingIndex, value)) {
|
13034 | const tView = getTView();
|
13035 | const tNode = getSelectedTNode();
|
13036 | elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
|
13037 | ngDevMode && storePropertyBindingMetadata(tView.data, tNode, 'attr.' + name, bindingIndex);
|
13038 | }
|
13039 | return ɵɵattribute;
|
13040 | }
|
13041 |
|
13042 |
|
13043 |
|
13044 |
|
13045 |
|
13046 |
|
13047 |
|
13048 |
|
13049 |
|
13050 |
|
13051 |
|
13052 |
|
13053 |
|
13054 |
|
13055 |
|
13056 |
|
13057 |
|
13058 |
|
13059 |
|
13060 |
|
13061 | function interpolationV(lView, values) {
|
13062 | ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
|
13063 | ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
|
13064 | let isBindingUpdated = false;
|
13065 | let bindingIndex = getBindingIndex();
|
13066 | for (let i = 1; i < values.length; i += 2) {
|
13067 |
|
13068 | isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
|
13069 | }
|
13070 | setBindingIndex(bindingIndex);
|
13071 | if (!isBindingUpdated) {
|
13072 | return NO_CHANGE;
|
13073 | }
|
13074 |
|
13075 | let content = values[0];
|
13076 | for (let i = 1; i < values.length; i += 2) {
|
13077 | content += renderStringify(values[i]) + values[i + 1];
|
13078 | }
|
13079 | return content;
|
13080 | }
|
13081 |
|
13082 |
|
13083 |
|
13084 |
|
13085 |
|
13086 |
|
13087 |
|
13088 | function interpolation1(lView, prefix, v0, suffix) {
|
13089 | const different = bindingUpdated(lView, nextBindingIndex(), v0);
|
13090 | return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
|
13091 | }
|
13092 |
|
13093 |
|
13094 |
|
13095 | function interpolation2(lView, prefix, v0, i0, v1, suffix) {
|
13096 | const bindingIndex = getBindingIndex();
|
13097 | const different = bindingUpdated2(lView, bindingIndex, v0, v1);
|
13098 | incrementBindingIndex(2);
|
13099 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
|
13100 | }
|
13101 |
|
13102 |
|
13103 |
|
13104 | function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
|
13105 | const bindingIndex = getBindingIndex();
|
13106 | const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
|
13107 | incrementBindingIndex(3);
|
13108 | return different ?
|
13109 | prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
|
13110 | NO_CHANGE;
|
13111 | }
|
13112 |
|
13113 |
|
13114 |
|
13115 | function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
|
13116 | const bindingIndex = getBindingIndex();
|
13117 | const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13118 | incrementBindingIndex(4);
|
13119 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
|
13120 | renderStringify(v2) + i2 + renderStringify(v3) + suffix :
|
13121 | NO_CHANGE;
|
13122 | }
|
13123 |
|
13124 |
|
13125 |
|
13126 | function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
|
13127 | const bindingIndex = getBindingIndex();
|
13128 | let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13129 | different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
|
13130 | incrementBindingIndex(5);
|
13131 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
|
13132 | renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix :
|
13133 | NO_CHANGE;
|
13134 | }
|
13135 |
|
13136 |
|
13137 |
|
13138 | function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
|
13139 | const bindingIndex = getBindingIndex();
|
13140 | let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13141 | different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
|
13142 | incrementBindingIndex(6);
|
13143 | return different ?
|
13144 | prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
|
13145 | renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
|
13146 | NO_CHANGE;
|
13147 | }
|
13148 |
|
13149 |
|
13150 |
|
13151 | function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
|
13152 | const bindingIndex = getBindingIndex();
|
13153 | let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13154 | different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
|
13155 | incrementBindingIndex(7);
|
13156 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
|
13157 | renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
|
13158 | renderStringify(v5) + i5 + renderStringify(v6) + suffix :
|
13159 | NO_CHANGE;
|
13160 | }
|
13161 |
|
13162 |
|
13163 |
|
13164 | function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
|
13165 | const bindingIndex = getBindingIndex();
|
13166 | let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
|
13167 | different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
|
13168 | incrementBindingIndex(8);
|
13169 | return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 +
|
13170 | renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 +
|
13171 | renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix :
|
13172 | NO_CHANGE;
|
13173 | }
|
13174 |
|
13175 |
|
13176 |
|
13177 |
|
13178 |
|
13179 |
|
13180 |
|
13181 |
|
13182 |
|
13183 |
|
13184 |
|
13185 |
|
13186 |
|
13187 |
|
13188 |
|
13189 |
|
13190 |
|
13191 |
|
13192 |
|
13193 |
|
13194 |
|
13195 |
|
13196 |
|
13197 |
|
13198 |
|
13199 | function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
|
13200 | const lView = getLView();
|
13201 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
13202 | if (interpolatedValue !== NO_CHANGE) {
|
13203 | const tNode = getSelectedTNode();
|
13204 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13205 | ngDevMode &&
|
13206 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 1, prefix, suffix);
|
13207 | }
|
13208 | return ɵɵattributeInterpolate1;
|
13209 | }
|
13210 |
|
13211 |
|
13212 |
|
13213 |
|
13214 |
|
13215 |
|
13216 |
|
13217 |
|
13218 |
|
13219 |
|
13220 |
|
13221 |
|
13222 |
|
13223 |
|
13224 |
|
13225 |
|
13226 |
|
13227 |
|
13228 |
|
13229 |
|
13230 |
|
13231 |
|
13232 |
|
13233 |
|
13234 |
|
13235 |
|
13236 | function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
|
13237 | const lView = getLView();
|
13238 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
13239 | if (interpolatedValue !== NO_CHANGE) {
|
13240 | const tNode = getSelectedTNode();
|
13241 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13242 | ngDevMode &&
|
13243 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 2, prefix, i0, suffix);
|
13244 | }
|
13245 | return ɵɵattributeInterpolate2;
|
13246 | }
|
13247 |
|
13248 |
|
13249 |
|
13250 |
|
13251 |
|
13252 |
|
13253 |
|
13254 |
|
13255 |
|
13256 |
|
13257 |
|
13258 |
|
13259 |
|
13260 |
|
13261 |
|
13262 |
|
13263 |
|
13264 |
|
13265 |
|
13266 |
|
13267 |
|
13268 |
|
13269 |
|
13270 |
|
13271 |
|
13272 |
|
13273 |
|
13274 |
|
13275 |
|
13276 | function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
|
13277 | const lView = getLView();
|
13278 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
13279 | if (interpolatedValue !== NO_CHANGE) {
|
13280 | const tNode = getSelectedTNode();
|
13281 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13282 | ngDevMode &&
|
13283 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 3, prefix, i0, i1, suffix);
|
13284 | }
|
13285 | return ɵɵattributeInterpolate3;
|
13286 | }
|
13287 |
|
13288 |
|
13289 |
|
13290 |
|
13291 |
|
13292 |
|
13293 |
|
13294 |
|
13295 |
|
13296 |
|
13297 |
|
13298 |
|
13299 |
|
13300 |
|
13301 |
|
13302 |
|
13303 |
|
13304 |
|
13305 |
|
13306 |
|
13307 |
|
13308 |
|
13309 |
|
13310 |
|
13311 |
|
13312 |
|
13313 |
|
13314 |
|
13315 |
|
13316 |
|
13317 |
|
13318 | function ɵɵattributeInterpolate4(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer, namespace) {
|
13319 | const lView = getLView();
|
13320 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
13321 | if (interpolatedValue !== NO_CHANGE) {
|
13322 | const tNode = getSelectedTNode();
|
13323 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13324 | ngDevMode &&
|
13325 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
|
13326 | }
|
13327 | return ɵɵattributeInterpolate4;
|
13328 | }
|
13329 |
|
13330 |
|
13331 |
|
13332 |
|
13333 |
|
13334 |
|
13335 |
|
13336 |
|
13337 |
|
13338 |
|
13339 |
|
13340 |
|
13341 |
|
13342 |
|
13343 |
|
13344 |
|
13345 |
|
13346 |
|
13347 |
|
13348 |
|
13349 |
|
13350 |
|
13351 |
|
13352 |
|
13353 |
|
13354 |
|
13355 |
|
13356 |
|
13357 |
|
13358 |
|
13359 |
|
13360 |
|
13361 |
|
13362 | function ɵɵattributeInterpolate5(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer, namespace) {
|
13363 | const lView = getLView();
|
13364 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
13365 | if (interpolatedValue !== NO_CHANGE) {
|
13366 | const tNode = getSelectedTNode();
|
13367 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13368 | ngDevMode &&
|
13369 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
|
13370 | }
|
13371 | return ɵɵattributeInterpolate5;
|
13372 | }
|
13373 |
|
13374 |
|
13375 |
|
13376 |
|
13377 |
|
13378 |
|
13379 |
|
13380 |
|
13381 |
|
13382 |
|
13383 |
|
13384 |
|
13385 |
|
13386 |
|
13387 |
|
13388 |
|
13389 |
|
13390 |
|
13391 |
|
13392 |
|
13393 |
|
13394 |
|
13395 |
|
13396 |
|
13397 |
|
13398 |
|
13399 |
|
13400 |
|
13401 |
|
13402 |
|
13403 |
|
13404 |
|
13405 |
|
13406 |
|
13407 |
|
13408 | function ɵɵattributeInterpolate6(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer, namespace) {
|
13409 | const lView = getLView();
|
13410 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
13411 | if (interpolatedValue !== NO_CHANGE) {
|
13412 | const tNode = getSelectedTNode();
|
13413 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13414 | ngDevMode &&
|
13415 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 6, prefix, i0, i1, i2, i3, i4, suffix);
|
13416 | }
|
13417 | return ɵɵattributeInterpolate6;
|
13418 | }
|
13419 |
|
13420 |
|
13421 |
|
13422 |
|
13423 |
|
13424 |
|
13425 |
|
13426 |
|
13427 |
|
13428 |
|
13429 |
|
13430 |
|
13431 |
|
13432 |
|
13433 |
|
13434 |
|
13435 |
|
13436 |
|
13437 |
|
13438 |
|
13439 |
|
13440 |
|
13441 |
|
13442 |
|
13443 |
|
13444 |
|
13445 |
|
13446 |
|
13447 |
|
13448 |
|
13449 |
|
13450 |
|
13451 |
|
13452 |
|
13453 |
|
13454 |
|
13455 |
|
13456 | function ɵɵattributeInterpolate7(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer, namespace) {
|
13457 | const lView = getLView();
|
13458 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
13459 | if (interpolatedValue !== NO_CHANGE) {
|
13460 | const tNode = getSelectedTNode();
|
13461 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13462 | ngDevMode &&
|
13463 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 7, prefix, i0, i1, i2, i3, i4, i5, suffix);
|
13464 | }
|
13465 | return ɵɵattributeInterpolate7;
|
13466 | }
|
13467 |
|
13468 |
|
13469 |
|
13470 |
|
13471 |
|
13472 |
|
13473 |
|
13474 |
|
13475 |
|
13476 |
|
13477 |
|
13478 |
|
13479 |
|
13480 |
|
13481 |
|
13482 |
|
13483 |
|
13484 |
|
13485 |
|
13486 |
|
13487 |
|
13488 |
|
13489 |
|
13490 |
|
13491 |
|
13492 |
|
13493 |
|
13494 |
|
13495 |
|
13496 |
|
13497 |
|
13498 |
|
13499 |
|
13500 |
|
13501 |
|
13502 |
|
13503 |
|
13504 |
|
13505 |
|
13506 | function ɵɵattributeInterpolate8(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer, namespace) {
|
13507 | const lView = getLView();
|
13508 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
13509 | if (interpolatedValue !== NO_CHANGE) {
|
13510 | const tNode = getSelectedTNode();
|
13511 | elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
|
13512 | ngDevMode &&
|
13513 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - 8, prefix, i0, i1, i2, i3, i4, i5, i6, suffix);
|
13514 | }
|
13515 | return ɵɵattributeInterpolate8;
|
13516 | }
|
13517 |
|
13518 |
|
13519 |
|
13520 |
|
13521 |
|
13522 |
|
13523 |
|
13524 |
|
13525 |
|
13526 |
|
13527 |
|
13528 |
|
13529 |
|
13530 |
|
13531 |
|
13532 |
|
13533 |
|
13534 |
|
13535 |
|
13536 |
|
13537 |
|
13538 |
|
13539 |
|
13540 |
|
13541 |
|
13542 |
|
13543 | function ɵɵattributeInterpolateV(attrName, values, sanitizer, namespace) {
|
13544 | const lView = getLView();
|
13545 | const interpolated = interpolationV(lView, values);
|
13546 | if (interpolated !== NO_CHANGE) {
|
13547 | const tNode = getSelectedTNode();
|
13548 | elementAttributeInternal(tNode, lView, attrName, interpolated, sanitizer, namespace);
|
13549 | if (ngDevMode) {
|
13550 | const interpolationInBetween = [values[0]];
|
13551 | for (let i = 2; i < values.length; i += 2) {
|
13552 | interpolationInBetween.push(values[i]);
|
13553 | }
|
13554 | storePropertyBindingMetadata(getTView().data, tNode, 'attr.' + attrName, getBindingIndex() - interpolationInBetween.length + 1, ...interpolationInBetween);
|
13555 | }
|
13556 | }
|
13557 | return ɵɵattributeInterpolateV;
|
13558 | }
|
13559 |
|
13560 |
|
13561 |
|
13562 |
|
13563 |
|
13564 |
|
13565 |
|
13566 |
|
13567 | function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) {
|
13568 | ngDevMode && assertFirstCreatePass(tView);
|
13569 | ngDevMode && ngDevMode.firstCreatePass++;
|
13570 | const tViewConsts = tView.consts;
|
13571 |
|
13572 | const tNode = getOrCreateTNode(tView, index, 4 , tagName || null, getConstant(tViewConsts, attrsIndex));
|
13573 | resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
|
13574 | registerPostOrderHooks(tView, tNode);
|
13575 | const embeddedTView = tNode.tViews = createTView(2 , tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts);
|
13576 | if (tView.queries !== null) {
|
13577 | tView.queries.template(tView, tNode);
|
13578 | embeddedTView.queries = tView.queries.embeddedTView(tNode);
|
13579 | }
|
13580 | return tNode;
|
13581 | }
|
13582 |
|
13583 |
|
13584 |
|
13585 |
|
13586 |
|
13587 |
|
13588 |
|
13589 |
|
13590 |
|
13591 |
|
13592 |
|
13593 |
|
13594 |
|
13595 |
|
13596 |
|
13597 |
|
13598 |
|
13599 |
|
13600 |
|
13601 | function ɵɵtemplate(index, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex, localRefExtractor) {
|
13602 | const lView = getLView();
|
13603 | const tView = getTView();
|
13604 | const adjustedIndex = index + HEADER_OFFSET;
|
13605 | const tNode = tView.firstCreatePass ? templateFirstCreatePass(adjustedIndex, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) :
|
13606 | tView.data[adjustedIndex];
|
13607 | setCurrentTNode(tNode, false);
|
13608 | const comment = lView[RENDERER].createComment(ngDevMode ? 'container' : '');
|
13609 | appendChild(tView, lView, comment, tNode);
|
13610 | attachPatchData(comment, lView);
|
13611 | addToViewTree(lView, lView[adjustedIndex] = createLContainer(comment, lView, comment, tNode));
|
13612 | if (isDirectiveHost(tNode)) {
|
13613 | createDirectivesInstances(tView, lView, tNode);
|
13614 | }
|
13615 | if (localRefsIndex != null) {
|
13616 | saveResolvedLocalsInData(lView, tNode, localRefExtractor);
|
13617 | }
|
13618 | }
|
13619 |
|
13620 |
|
13621 |
|
13622 |
|
13623 |
|
13624 |
|
13625 |
|
13626 |
|
13627 |
|
13628 | function store(tView, lView, index, value) {
|
13629 |
|
13630 |
|
13631 | if (index >= tView.data.length) {
|
13632 | tView.data[index] = null;
|
13633 | tView.blueprint[index] = null;
|
13634 | }
|
13635 | lView[index] = value;
|
13636 | }
|
13637 |
|
13638 |
|
13639 |
|
13640 |
|
13641 |
|
13642 |
|
13643 |
|
13644 |
|
13645 |
|
13646 |
|
13647 | function ɵɵreference(index) {
|
13648 | const contextLView = getContextLView();
|
13649 | return load(contextLView, HEADER_OFFSET + index);
|
13650 | }
|
13651 |
|
13652 |
|
13653 |
|
13654 |
|
13655 |
|
13656 |
|
13657 |
|
13658 |
|
13659 |
|
13660 |
|
13661 |
|
13662 |
|
13663 |
|
13664 | const angularCoreDiEnv = {
|
13665 | 'ɵɵdefineInjectable': ɵɵdefineInjectable,
|
13666 | 'ɵɵdefineInjector': ɵɵdefineInjector,
|
13667 | 'ɵɵinject': ɵɵinject,
|
13668 | 'ɵɵinvalidFactoryDep': ɵɵinvalidFactoryDep,
|
13669 | 'resolveForwardRef': resolveForwardRef,
|
13670 | };
|
13671 |
|
13672 |
|
13673 |
|
13674 |
|
13675 |
|
13676 |
|
13677 |
|
13678 |
|
13679 |
|
13680 |
|
13681 |
|
13682 |
|
13683 | function compileInjectable(type, meta) {
|
13684 | let ngInjectableDef = null;
|
13685 | let ngFactoryDef = null;
|
13686 |
|
13687 | if (!type.hasOwnProperty(NG_PROV_DEF)) {
|
13688 | Object.defineProperty(type, NG_PROV_DEF, {
|
13689 | get: () => {
|
13690 | if (ngInjectableDef === null) {
|
13691 | const compiler = getCompilerFacade({ usage: 0 , kind: 'injectable', type });
|
13692 | ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, `ng:///${type.name}/ɵprov.js`, getInjectableMetadata(type, meta));
|
13693 | }
|
13694 | return ngInjectableDef;
|
13695 | },
|
13696 | });
|
13697 | }
|
13698 |
|
13699 | if (!type.hasOwnProperty(NG_FACTORY_DEF)) {
|
13700 | Object.defineProperty(type, NG_FACTORY_DEF, {
|
13701 | get: () => {
|
13702 | if (ngFactoryDef === null) {
|
13703 | const compiler = getCompilerFacade({ usage: 0 , kind: 'injectable', type });
|
13704 | ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/ɵfac.js`, {
|
13705 | name: type.name,
|
13706 | type,
|
13707 | typeArgumentCount: 0,
|
13708 | deps: reflectDependencies(type),
|
13709 | target: compiler.FactoryTarget.Injectable
|
13710 | });
|
13711 | }
|
13712 | return ngFactoryDef;
|
13713 | },
|
13714 |
|
13715 | configurable: true
|
13716 | });
|
13717 | }
|
13718 | }
|
13719 | const USE_VALUE$1 = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty });
|
13720 | function isUseClassProvider(meta) {
|
13721 | return meta.useClass !== undefined;
|
13722 | }
|
13723 | function isUseValueProvider(meta) {
|
13724 | return USE_VALUE$1 in meta;
|
13725 | }
|
13726 | function isUseFactoryProvider(meta) {
|
13727 | return meta.useFactory !== undefined;
|
13728 | }
|
13729 | function isUseExistingProvider(meta) {
|
13730 | return meta.useExisting !== undefined;
|
13731 | }
|
13732 | function getInjectableMetadata(type, srcMeta) {
|
13733 |
|
13734 | const meta = srcMeta || { providedIn: null };
|
13735 | const compilerMeta = {
|
13736 | name: type.name,
|
13737 | type: type,
|
13738 | typeArgumentCount: 0,
|
13739 | providedIn: meta.providedIn,
|
13740 | };
|
13741 | if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== undefined) {
|
13742 | compilerMeta.deps = convertDependencies(meta.deps);
|
13743 | }
|
13744 |
|
13745 | if (isUseClassProvider(meta)) {
|
13746 | compilerMeta.useClass = meta.useClass;
|
13747 | }
|
13748 | else if (isUseValueProvider(meta)) {
|
13749 | compilerMeta.useValue = meta.useValue;
|
13750 | }
|
13751 | else if (isUseFactoryProvider(meta)) {
|
13752 | compilerMeta.useFactory = meta.useFactory;
|
13753 | }
|
13754 | else if (isUseExistingProvider(meta)) {
|
13755 | compilerMeta.useExisting = meta.useExisting;
|
13756 | }
|
13757 | return compilerMeta;
|
13758 | }
|
13759 |
|
13760 |
|
13761 |
|
13762 |
|
13763 |
|
13764 |
|
13765 |
|
13766 |
|
13767 | const USE_VALUE = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty });
|
13768 | function convertInjectableProviderToFactory(type, provider) {
|
13769 | if (!provider) {
|
13770 | const reflectionCapabilities = new ReflectionCapabilities();
|
13771 | const deps = reflectionCapabilities.parameters(type);
|
13772 |
|
13773 | return () => new type(...injectArgs(deps));
|
13774 | }
|
13775 | if (USE_VALUE in provider) {
|
13776 | const valueProvider = provider;
|
13777 | return () => valueProvider.useValue;
|
13778 | }
|
13779 | else if (provider.useExisting) {
|
13780 | const existingProvider = provider;
|
13781 | return () => ɵɵinject(resolveForwardRef(existingProvider.useExisting));
|
13782 | }
|
13783 | else if (provider.useFactory) {
|
13784 | const factoryProvider = provider;
|
13785 | return () => factoryProvider.useFactory(...injectArgs(factoryProvider.deps || EMPTY_ARRAY));
|
13786 | }
|
13787 | else if (provider.useClass) {
|
13788 | const classProvider = provider;
|
13789 | let deps = provider.deps;
|
13790 | if (!deps) {
|
13791 | const reflectionCapabilities = new ReflectionCapabilities();
|
13792 | deps = reflectionCapabilities.parameters(type);
|
13793 | }
|
13794 | return () => new (resolveForwardRef(classProvider.useClass))(...injectArgs(deps));
|
13795 | }
|
13796 | else {
|
13797 | let deps = provider.deps;
|
13798 | if (!deps) {
|
13799 | const reflectionCapabilities = new ReflectionCapabilities();
|
13800 | deps = reflectionCapabilities.parameters(type);
|
13801 | }
|
13802 | return () => new type(...injectArgs(deps));
|
13803 | }
|
13804 | }
|
13805 |
|
13806 |
|
13807 |
|
13808 |
|
13809 |
|
13810 |
|
13811 |
|
13812 | const Injectable = makeDecorator('Injectable', undefined, undefined, undefined, (type, meta) => SWITCH_COMPILE_INJECTABLE(type, meta));
|
13813 |
|
13814 |
|
13815 |
|
13816 | function render2CompileInjectable(injectableType, options) {
|
13817 | if (options && options.providedIn !== undefined && !getInjectableDef(injectableType)) {
|
13818 | injectableType.ɵprov = ɵɵdefineInjectable({
|
13819 | token: injectableType,
|
13820 | providedIn: options.providedIn,
|
13821 | factory: convertInjectableProviderToFactory(injectableType, options),
|
13822 | });
|
13823 | }
|
13824 | }
|
13825 | const SWITCH_COMPILE_INJECTABLE__POST_R3__ = compileInjectable;
|
13826 | const SWITCH_COMPILE_INJECTABLE__PRE_R3__ = render2CompileInjectable;
|
13827 | const SWITCH_COMPILE_INJECTABLE = SWITCH_COMPILE_INJECTABLE__POST_R3__;
|
13828 |
|
13829 |
|
13830 |
|
13831 |
|
13832 |
|
13833 |
|
13834 |
|
13835 |
|
13836 | function findFirstClosedCycle(keys) {
|
13837 | const res = [];
|
13838 | for (let i = 0; i < keys.length; ++i) {
|
13839 | if (res.indexOf(keys[i]) > -1) {
|
13840 | res.push(keys[i]);
|
13841 | return res;
|
13842 | }
|
13843 | res.push(keys[i]);
|
13844 | }
|
13845 | return res;
|
13846 | }
|
13847 | function constructResolvingPath(keys) {
|
13848 | if (keys.length > 1) {
|
13849 | const reversed = findFirstClosedCycle(keys.slice().reverse());
|
13850 | const tokenStrs = reversed.map(k => stringify(k.token));
|
13851 | return ' (' + tokenStrs.join(' -> ') + ')';
|
13852 | }
|
13853 | return '';
|
13854 | }
|
13855 | function injectionError(injector, key, constructResolvingMessage, originalError) {
|
13856 | const keys = [key];
|
13857 | const errMsg = constructResolvingMessage(keys);
|
13858 | const error = (originalError ? wrappedError(errMsg, originalError) : Error(errMsg));
|
13859 | error.addKey = addKey;
|
13860 | error.keys = keys;
|
13861 | error.injectors = [injector];
|
13862 | error.constructResolvingMessage = constructResolvingMessage;
|
13863 | error[ERROR_ORIGINAL_ERROR] = originalError;
|
13864 | return error;
|
13865 | }
|
13866 | function addKey(injector, key) {
|
13867 | this.injectors.push(injector);
|
13868 | this.keys.push(key);
|
13869 |
|
13870 | this.message = this.constructResolvingMessage(this.keys);
|
13871 | }
|
13872 |
|
13873 |
|
13874 |
|
13875 |
|
13876 |
|
13877 |
|
13878 |
|
13879 |
|
13880 |
|
13881 |
|
13882 |
|
13883 |
|
13884 |
|
13885 |
|
13886 |
|
13887 | function noProviderError(injector, key) {
|
13888 | return injectionError(injector, key, function (keys) {
|
13889 | const first = stringify(keys[0].token);
|
13890 | return `No provider for ${first}!${constructResolvingPath(keys)}`;
|
13891 | });
|
13892 | }
|
13893 |
|
13894 |
|
13895 |
|
13896 |
|
13897 |
|
13898 |
|
13899 |
|
13900 |
|
13901 |
|
13902 |
|
13903 |
|
13904 |
|
13905 |
|
13906 |
|
13907 |
|
13908 |
|
13909 |
|
13910 | function cyclicDependencyError(injector, key) {
|
13911 | return injectionError(injector, key, function (keys) {
|
13912 | return `Cannot instantiate cyclic dependency!${constructResolvingPath(keys)}`;
|
13913 | });
|
13914 | }
|
13915 |
|
13916 |
|
13917 |
|
13918 |
|
13919 |
|
13920 |
|
13921 |
|
13922 |
|
13923 |
|
13924 |
|
13925 |
|
13926 |
|
13927 |
|
13928 |
|
13929 |
|
13930 |
|
13931 |
|
13932 |
|
13933 |
|
13934 |
|
13935 |
|
13936 |
|
13937 |
|
13938 |
|
13939 |
|
13940 |
|
13941 |
|
13942 | function instantiationError(injector, originalException, originalStack, key) {
|
13943 | return injectionError(injector, key, function (keys) {
|
13944 | const first = stringify(keys[0].token);
|
13945 | return `${originalException.message}: Error during instantiation of ${first}!${constructResolvingPath(keys)}.`;
|
13946 | }, originalException);
|
13947 | }
|
13948 |
|
13949 |
|
13950 |
|
13951 |
|
13952 |
|
13953 |
|
13954 |
|
13955 |
|
13956 |
|
13957 |
|
13958 |
|
13959 | function invalidProviderError(provider) {
|
13960 | return Error(`Invalid provider - only instances of Provider and Type are allowed, got: ${provider}`);
|
13961 | }
|
13962 |
|
13963 |
|
13964 |
|
13965 |
|
13966 |
|
13967 |
|
13968 |
|
13969 |
|
13970 |
|
13971 |
|
13972 |
|
13973 |
|
13974 |
|
13975 |
|
13976 |
|
13977 |
|
13978 |
|
13979 |
|
13980 |
|
13981 |
|
13982 |
|
13983 |
|
13984 |
|
13985 |
|
13986 |
|
13987 |
|
13988 |
|
13989 |
|
13990 |
|
13991 |
|
13992 | function noAnnotationError(typeOrFunc, params) {
|
13993 | const signature = [];
|
13994 | for (let i = 0, ii = params.length; i < ii; i++) {
|
13995 | const parameter = params[i];
|
13996 | if (!parameter || parameter.length == 0) {
|
13997 | signature.push('?');
|
13998 | }
|
13999 | else {
|
14000 | signature.push(parameter.map(stringify).join(' '));
|
14001 | }
|
14002 | }
|
14003 | return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
|
14004 | signature.join(', ') + '). ' +
|
14005 | 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
|
14006 | stringify(typeOrFunc) + '\' is decorated with Injectable.');
|
14007 | }
|
14008 |
|
14009 |
|
14010 |
|
14011 |
|
14012 |
|
14013 |
|
14014 |
|
14015 |
|
14016 |
|
14017 |
|
14018 |
|
14019 |
|
14020 |
|
14021 |
|
14022 |
|
14023 | function outOfBoundsError(index) {
|
14024 | return Error(`Index ${index} is out-of-bounds.`);
|
14025 | }
|
14026 |
|
14027 |
|
14028 |
|
14029 |
|
14030 |
|
14031 |
|
14032 |
|
14033 |
|
14034 |
|
14035 |
|
14036 |
|
14037 |
|
14038 |
|
14039 |
|
14040 | function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
|
14041 | return Error(`Cannot mix multi providers and regular providers, got: ${provider1} ${provider2}`);
|
14042 | }
|
14043 |
|
14044 |
|
14045 |
|
14046 |
|
14047 |
|
14048 |
|
14049 |
|
14050 |
|
14051 |
|
14052 |
|
14053 |
|
14054 |
|
14055 |
|
14056 |
|
14057 |
|
14058 |
|
14059 |
|
14060 |
|
14061 |
|
14062 |
|
14063 |
|
14064 |
|
14065 |
|
14066 |
|
14067 |
|
14068 |
|
14069 | class ReflectiveKey {
|
14070 | |
14071 |
|
14072 |
|
14073 | constructor(token, id) {
|
14074 | this.token = token;
|
14075 | this.id = id;
|
14076 | if (!token) {
|
14077 | throw new Error('Token must be defined!');
|
14078 | }
|
14079 | this.displayName = stringify(this.token);
|
14080 | }
|
14081 | |
14082 |
|
14083 |
|
14084 | static get(token) {
|
14085 | return _globalKeyRegistry.get(resolveForwardRef(token));
|
14086 | }
|
14087 | |
14088 |
|
14089 |
|
14090 | static get numberOfKeys() {
|
14091 | return _globalKeyRegistry.numberOfKeys;
|
14092 | }
|
14093 | }
|
14094 | class KeyRegistry {
|
14095 | constructor() {
|
14096 | this._allKeys = new Map();
|
14097 | }
|
14098 | get(token) {
|
14099 | if (token instanceof ReflectiveKey)
|
14100 | return token;
|
14101 | if (this._allKeys.has(token)) {
|
14102 | return this._allKeys.get(token);
|
14103 | }
|
14104 | const newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
|
14105 | this._allKeys.set(token, newKey);
|
14106 | return newKey;
|
14107 | }
|
14108 | get numberOfKeys() {
|
14109 | return this._allKeys.size;
|
14110 | }
|
14111 | }
|
14112 | const _globalKeyRegistry = new KeyRegistry();
|
14113 |
|
14114 |
|
14115 |
|
14116 |
|
14117 |
|
14118 |
|
14119 |
|
14120 |
|
14121 |
|
14122 |
|
14123 |
|
14124 |
|
14125 | class Reflector {
|
14126 | constructor(reflectionCapabilities) {
|
14127 | this.reflectionCapabilities = reflectionCapabilities;
|
14128 | }
|
14129 | updateCapabilities(caps) {
|
14130 | this.reflectionCapabilities = caps;
|
14131 | }
|
14132 | factory(type) {
|
14133 | return this.reflectionCapabilities.factory(type);
|
14134 | }
|
14135 | parameters(typeOrFunc) {
|
14136 | return this.reflectionCapabilities.parameters(typeOrFunc);
|
14137 | }
|
14138 | annotations(typeOrFunc) {
|
14139 | return this.reflectionCapabilities.annotations(typeOrFunc);
|
14140 | }
|
14141 | propMetadata(typeOrFunc) {
|
14142 | return this.reflectionCapabilities.propMetadata(typeOrFunc);
|
14143 | }
|
14144 | hasLifecycleHook(type, lcProperty) {
|
14145 | return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
|
14146 | }
|
14147 | getter(name) {
|
14148 | return this.reflectionCapabilities.getter(name);
|
14149 | }
|
14150 | setter(name) {
|
14151 | return this.reflectionCapabilities.setter(name);
|
14152 | }
|
14153 | method(name) {
|
14154 | return this.reflectionCapabilities.method(name);
|
14155 | }
|
14156 | importUri(type) {
|
14157 | return this.reflectionCapabilities.importUri(type);
|
14158 | }
|
14159 | resourceUri(type) {
|
14160 | return this.reflectionCapabilities.resourceUri(type);
|
14161 | }
|
14162 | resolveIdentifier(name, moduleUrl, members, runtime) {
|
14163 | return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
|
14164 | }
|
14165 | resolveEnum(identifier, name) {
|
14166 | return this.reflectionCapabilities.resolveEnum(identifier, name);
|
14167 | }
|
14168 | }
|
14169 |
|
14170 |
|
14171 |
|
14172 |
|
14173 |
|
14174 |
|
14175 |
|
14176 |
|
14177 |
|
14178 |
|
14179 |
|
14180 |
|
14181 | const reflector = new Reflector(new ReflectionCapabilities());
|
14182 |
|
14183 |
|
14184 |
|
14185 |
|
14186 |
|
14187 |
|
14188 |
|
14189 |
|
14190 |
|
14191 |
|
14192 |
|
14193 |
|
14194 | class ReflectiveDependency {
|
14195 | constructor(key, optional, visibility) {
|
14196 | this.key = key;
|
14197 | this.optional = optional;
|
14198 | this.visibility = visibility;
|
14199 | }
|
14200 | static fromKey(key) {
|
14201 | return new ReflectiveDependency(key, false, null);
|
14202 | }
|
14203 | }
|
14204 | const _EMPTY_LIST = [];
|
14205 | class ResolvedReflectiveProvider_ {
|
14206 | constructor(key, resolvedFactories, multiProvider) {
|
14207 | this.key = key;
|
14208 | this.resolvedFactories = resolvedFactories;
|
14209 | this.multiProvider = multiProvider;
|
14210 | this.resolvedFactory = this.resolvedFactories[0];
|
14211 | }
|
14212 | }
|
14213 |
|
14214 |
|
14215 |
|
14216 |
|
14217 | class ResolvedReflectiveFactory {
|
14218 | constructor(
|
14219 | /**
|
14220 | * Factory function which can return an instance of an object represented by a key.
|
14221 | */
|
14222 | factory,
|
14223 | /**
|
14224 | * Arguments (dependencies) to the `factory` function.
|
14225 | */
|
14226 | dependencies) {
|
14227 | this.factory = factory;
|
14228 | this.dependencies = dependencies;
|
14229 | }
|
14230 | }
|
14231 |
|
14232 |
|
14233 |
|
14234 | function resolveReflectiveFactory(provider) {
|
14235 | let factoryFn;
|
14236 | let resolvedDeps;
|
14237 | if (provider.useClass) {
|
14238 | const useClass = resolveForwardRef(provider.useClass);
|
14239 | factoryFn = reflector.factory(useClass);
|
14240 | resolvedDeps = _dependenciesFor(useClass);
|
14241 | }
|
14242 | else if (provider.useExisting) {
|
14243 | factoryFn = (aliasInstance) => aliasInstance;
|
14244 | resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
|
14245 | }
|
14246 | else if (provider.useFactory) {
|
14247 | factoryFn = provider.useFactory;
|
14248 | resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
|
14249 | }
|
14250 | else {
|
14251 | factoryFn = () => provider.useValue;
|
14252 | resolvedDeps = _EMPTY_LIST;
|
14253 | }
|
14254 | return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
|
14255 | }
|
14256 |
|
14257 |
|
14258 |
|
14259 |
|
14260 |
|
14261 |
|
14262 | function resolveReflectiveProvider(provider) {
|
14263 | return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
|
14264 | }
|
14265 |
|
14266 |
|
14267 |
|
14268 | function resolveReflectiveProviders(providers) {
|
14269 | const normalized = _normalizeProviders(providers, []);
|
14270 | const resolved = normalized.map(resolveReflectiveProvider);
|
14271 | const resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
|
14272 | return Array.from(resolvedProviderMap.values());
|
14273 | }
|
14274 |
|
14275 |
|
14276 |
|
14277 |
|
14278 | function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
|
14279 | for (let i = 0; i < providers.length; i++) {
|
14280 | const provider = providers[i];
|
14281 | const existing = normalizedProvidersMap.get(provider.key.id);
|
14282 | if (existing) {
|
14283 | if (provider.multiProvider !== existing.multiProvider) {
|
14284 | throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
|
14285 | }
|
14286 | if (provider.multiProvider) {
|
14287 | for (let j = 0; j < provider.resolvedFactories.length; j++) {
|
14288 | existing.resolvedFactories.push(provider.resolvedFactories[j]);
|
14289 | }
|
14290 | }
|
14291 | else {
|
14292 | normalizedProvidersMap.set(provider.key.id, provider);
|
14293 | }
|
14294 | }
|
14295 | else {
|
14296 | let resolvedProvider;
|
14297 | if (provider.multiProvider) {
|
14298 | resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
|
14299 | }
|
14300 | else {
|
14301 | resolvedProvider = provider;
|
14302 | }
|
14303 | normalizedProvidersMap.set(provider.key.id, resolvedProvider);
|
14304 | }
|
14305 | }
|
14306 | return normalizedProvidersMap;
|
14307 | }
|
14308 | function _normalizeProviders(providers, res) {
|
14309 | providers.forEach(b => {
|
14310 | if (b instanceof Type) {
|
14311 | res.push({ provide: b, useClass: b });
|
14312 | }
|
14313 | else if (b && typeof b == 'object' && b.provide !== undefined) {
|
14314 | res.push(b);
|
14315 | }
|
14316 | else if (Array.isArray(b)) {
|
14317 | _normalizeProviders(b, res);
|
14318 | }
|
14319 | else {
|
14320 | throw invalidProviderError(b);
|
14321 | }
|
14322 | });
|
14323 | return res;
|
14324 | }
|
14325 | function constructDependencies(typeOrFunc, dependencies) {
|
14326 | if (!dependencies) {
|
14327 | return _dependenciesFor(typeOrFunc);
|
14328 | }
|
14329 | else {
|
14330 | const params = dependencies.map(t => [t]);
|
14331 | return dependencies.map(t => _extractToken(typeOrFunc, t, params));
|
14332 | }
|
14333 | }
|
14334 | function _dependenciesFor(typeOrFunc) {
|
14335 | const params = reflector.parameters(typeOrFunc);
|
14336 | if (!params)
|
14337 | return [];
|
14338 | if (params.some(p => p == null)) {
|
14339 | throw noAnnotationError(typeOrFunc, params);
|
14340 | }
|
14341 | return params.map(p => _extractToken(typeOrFunc, p, params));
|
14342 | }
|
14343 | function _extractToken(typeOrFunc, metadata, params) {
|
14344 | let token = null;
|
14345 | let optional = false;
|
14346 | if (!Array.isArray(metadata)) {
|
14347 | if (metadata instanceof Inject) {
|
14348 | return _createDependency(metadata.token, optional, null);
|
14349 | }
|
14350 | else {
|
14351 | return _createDependency(metadata, optional, null);
|
14352 | }
|
14353 | }
|
14354 | let visibility = null;
|
14355 | for (let i = 0; i < metadata.length; ++i) {
|
14356 | const paramMetadata = metadata[i];
|
14357 | if (paramMetadata instanceof Type) {
|
14358 | token = paramMetadata;
|
14359 | }
|
14360 | else if (paramMetadata instanceof Inject) {
|
14361 | token = paramMetadata.token;
|
14362 | }
|
14363 | else if (paramMetadata instanceof Optional) {
|
14364 | optional = true;
|
14365 | }
|
14366 | else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
|
14367 | visibility = paramMetadata;
|
14368 | }
|
14369 | else if (paramMetadata instanceof InjectionToken) {
|
14370 | token = paramMetadata;
|
14371 | }
|
14372 | }
|
14373 | token = resolveForwardRef(token);
|
14374 | if (token != null) {
|
14375 | return _createDependency(token, optional, visibility);
|
14376 | }
|
14377 | else {
|
14378 | throw noAnnotationError(typeOrFunc, params);
|
14379 | }
|
14380 | }
|
14381 | function _createDependency(token, optional, visibility) {
|
14382 | return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
|
14383 | }
|
14384 |
|
14385 |
|
14386 |
|
14387 |
|
14388 |
|
14389 |
|
14390 |
|
14391 |
|
14392 |
|
14393 | const UNDEFINED = {};
|
14394 |
|
14395 |
|
14396 |
|
14397 |
|
14398 |
|
14399 |
|
14400 |
|
14401 |
|
14402 |
|
14403 |
|
14404 |
|
14405 |
|
14406 |
|
14407 |
|
14408 |
|
14409 |
|
14410 |
|
14411 |
|
14412 |
|
14413 |
|
14414 |
|
14415 |
|
14416 |
|
14417 |
|
14418 |
|
14419 |
|
14420 |
|
14421 |
|
14422 |
|
14423 |
|
14424 |
|
14425 |
|
14426 |
|
14427 |
|
14428 |
|
14429 |
|
14430 |
|
14431 | class ReflectiveInjector {
|
14432 | |
14433 |
|
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 |
|
14461 |
|
14462 |
|
14463 |
|
14464 |
|
14465 | static resolve(providers) {
|
14466 | return resolveReflectiveProviders(providers);
|
14467 | }
|
14468 | |
14469 |
|
14470 |
|
14471 |
|
14472 |
|
14473 |
|
14474 |
|
14475 |
|
14476 |
|
14477 |
|
14478 |
|
14479 |
|
14480 |
|
14481 |
|
14482 |
|
14483 |
|
14484 |
|
14485 |
|
14486 |
|
14487 |
|
14488 |
|
14489 |
|
14490 |
|
14491 | static resolveAndCreate(providers, parent) {
|
14492 | const ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
14493 | return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
14494 | }
|
14495 | |
14496 |
|
14497 |
|
14498 |
|
14499 |
|
14500 |
|
14501 |
|
14502 |
|
14503 |
|
14504 |
|
14505 |
|
14506 |
|
14507 |
|
14508 |
|
14509 |
|
14510 |
|
14511 |
|
14512 |
|
14513 |
|
14514 |
|
14515 |
|
14516 |
|
14517 |
|
14518 | static fromResolvedProviders(providers, parent) {
|
14519 | return new ReflectiveInjector_(providers, parent);
|
14520 | }
|
14521 | }
|
14522 | class ReflectiveInjector_ {
|
14523 | |
14524 |
|
14525 |
|
14526 | constructor(_providers, _parent) {
|
14527 |
|
14528 | this._constructionCounter = 0;
|
14529 | this._providers = _providers;
|
14530 | this.parent = _parent || null;
|
14531 | const len = _providers.length;
|
14532 | this.keyIds = [];
|
14533 | this.objs = [];
|
14534 | for (let i = 0; i < len; i++) {
|
14535 | this.keyIds[i] = _providers[i].key.id;
|
14536 | this.objs[i] = UNDEFINED;
|
14537 | }
|
14538 | }
|
14539 | get(token, notFoundValue = THROW_IF_NOT_FOUND) {
|
14540 | return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
|
14541 | }
|
14542 | resolveAndCreateChild(providers) {
|
14543 | const ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
14544 | return this.createChildFromResolved(ResolvedReflectiveProviders);
|
14545 | }
|
14546 | createChildFromResolved(providers) {
|
14547 | const inj = new ReflectiveInjector_(providers);
|
14548 | inj.parent = this;
|
14549 | return inj;
|
14550 | }
|
14551 | resolveAndInstantiate(provider) {
|
14552 | return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
14553 | }
|
14554 | instantiateResolved(provider) {
|
14555 | return this._instantiateProvider(provider);
|
14556 | }
|
14557 | getProviderAtIndex(index) {
|
14558 | if (index < 0 || index >= this._providers.length) {
|
14559 | throw outOfBoundsError(index);
|
14560 | }
|
14561 | return this._providers[index];
|
14562 | }
|
14563 |
|
14564 | _new(provider) {
|
14565 | if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
|
14566 | throw cyclicDependencyError(this, provider.key);
|
14567 | }
|
14568 | return this._instantiateProvider(provider);
|
14569 | }
|
14570 | _getMaxNumberOfObjects() {
|
14571 | return this.objs.length;
|
14572 | }
|
14573 | _instantiateProvider(provider) {
|
14574 | if (provider.multiProvider) {
|
14575 | const res = [];
|
14576 | for (let i = 0; i < provider.resolvedFactories.length; ++i) {
|
14577 | res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
|
14578 | }
|
14579 | return res;
|
14580 | }
|
14581 | else {
|
14582 | return this._instantiate(provider, provider.resolvedFactories[0]);
|
14583 | }
|
14584 | }
|
14585 | _instantiate(provider, ResolvedReflectiveFactory) {
|
14586 | const factory = ResolvedReflectiveFactory.factory;
|
14587 | let deps;
|
14588 | try {
|
14589 | deps =
|
14590 | ResolvedReflectiveFactory.dependencies.map(dep => this._getByReflectiveDependency(dep));
|
14591 | }
|
14592 | catch (e) {
|
14593 | if (e.addKey) {
|
14594 | e.addKey(this, provider.key);
|
14595 | }
|
14596 | throw e;
|
14597 | }
|
14598 | let obj;
|
14599 | try {
|
14600 | obj = factory(...deps);
|
14601 | }
|
14602 | catch (e) {
|
14603 | throw instantiationError(this, e, e.stack, provider.key);
|
14604 | }
|
14605 | return obj;
|
14606 | }
|
14607 | _getByReflectiveDependency(dep) {
|
14608 | return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
|
14609 | }
|
14610 | _getByKey(key, visibility, notFoundValue) {
|
14611 | if (key === ReflectiveInjector_.INJECTOR_KEY) {
|
14612 | return this;
|
14613 | }
|
14614 | if (visibility instanceof Self) {
|
14615 | return this._getByKeySelf(key, notFoundValue);
|
14616 | }
|
14617 | else {
|
14618 | return this._getByKeyDefault(key, notFoundValue, visibility);
|
14619 | }
|
14620 | }
|
14621 | _getObjByKeyId(keyId) {
|
14622 | for (let i = 0; i < this.keyIds.length; i++) {
|
14623 | if (this.keyIds[i] === keyId) {
|
14624 | if (this.objs[i] === UNDEFINED) {
|
14625 | this.objs[i] = this._new(this._providers[i]);
|
14626 | }
|
14627 | return this.objs[i];
|
14628 | }
|
14629 | }
|
14630 | return UNDEFINED;
|
14631 | }
|
14632 |
|
14633 | _throwOrNull(key, notFoundValue) {
|
14634 | if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
14635 | return notFoundValue;
|
14636 | }
|
14637 | else {
|
14638 | throw noProviderError(this, key);
|
14639 | }
|
14640 | }
|
14641 |
|
14642 | _getByKeySelf(key, notFoundValue) {
|
14643 | const obj = this._getObjByKeyId(key.id);
|
14644 | return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
14645 | }
|
14646 |
|
14647 | _getByKeyDefault(key, notFoundValue, visibility) {
|
14648 | let inj;
|
14649 | if (visibility instanceof SkipSelf) {
|
14650 | inj = this.parent;
|
14651 | }
|
14652 | else {
|
14653 | inj = this;
|
14654 | }
|
14655 | while (inj instanceof ReflectiveInjector_) {
|
14656 | const inj_ = inj;
|
14657 | const obj = inj_._getObjByKeyId(key.id);
|
14658 | if (obj !== UNDEFINED)
|
14659 | return obj;
|
14660 | inj = inj_.parent;
|
14661 | }
|
14662 | if (inj !== null) {
|
14663 | return inj.get(key.token, notFoundValue);
|
14664 | }
|
14665 | else {
|
14666 | return this._throwOrNull(key, notFoundValue);
|
14667 | }
|
14668 | }
|
14669 | get displayName() {
|
14670 | const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
|
14671 | .join(', ');
|
14672 | return `ReflectiveInjector(providers: [${providers}])`;
|
14673 | }
|
14674 | toString() {
|
14675 | return this.displayName;
|
14676 | }
|
14677 | }
|
14678 | ReflectiveInjector_.INJECTOR_KEY = ( ReflectiveKey.get(Injector));
|
14679 | function _mapProviders(injector, fn) {
|
14680 | const res = [];
|
14681 | for (let i = 0; i < injector._providers.length; ++i) {
|
14682 | res[i] = fn(injector.getProviderAtIndex(i));
|
14683 | }
|
14684 | return res;
|
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 | function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
|
14711 | const lView = getLView();
|
14712 |
|
14713 |
|
14714 | if (lView === null) {
|
14715 |
|
14716 | ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
|
14717 | return ɵɵinject(token, flags);
|
14718 | }
|
14719 | const tNode = getCurrentTNode();
|
14720 | return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
|
14721 | }
|
14722 |
|
14723 |
|
14724 |
|
14725 |
|
14726 |
|
14727 |
|
14728 |
|
14729 |
|
14730 |
|
14731 |
|
14732 |
|
14733 |
|
14734 | function ɵɵinvalidFactory() {
|
14735 | const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
|
14736 | throw new Error(msg);
|
14737 | }
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 |
|
14749 |
|
14750 |
|
14751 |
|
14752 |
|
14753 |
|
14754 |
|
14755 |
|
14756 |
|
14757 |
|
14758 |
|
14759 |
|
14760 |
|
14761 |
|
14762 |
|
14763 |
|
14764 | function ɵɵproperty(propName, value, sanitizer) {
|
14765 | const lView = getLView();
|
14766 | const bindingIndex = nextBindingIndex();
|
14767 | if (bindingUpdated(lView, bindingIndex, value)) {
|
14768 | const tView = getTView();
|
14769 | const tNode = getSelectedTNode();
|
14770 | elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, false);
|
14771 | ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
|
14772 | }
|
14773 | return ɵɵproperty;
|
14774 | }
|
14775 |
|
14776 |
|
14777 |
|
14778 |
|
14779 | function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased) {
|
14780 | const inputs = tNode.inputs;
|
14781 | const property = isClassBased ? 'class' : 'style';
|
14782 |
|
14783 | setInputsForProperty(tView, lView, inputs[property], property, value);
|
14784 | }
|
14785 |
|
14786 |
|
14787 |
|
14788 |
|
14789 |
|
14790 |
|
14791 |
|
14792 |
|
14793 | function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
|
14794 | ngDevMode && assertFirstCreatePass(tView);
|
14795 | ngDevMode && ngDevMode.firstCreatePass++;
|
14796 | const tViewConsts = tView.consts;
|
14797 | const attrs = getConstant(tViewConsts, attrsIndex);
|
14798 | const tNode = getOrCreateTNode(tView, index, 2 , name, attrs);
|
14799 | const hasDirectives = resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
|
14800 | ngDevMode && logUnknownElementError(tView, native, tNode, hasDirectives);
|
14801 | if (tNode.attrs !== null) {
|
14802 | computeStaticStyling(tNode, tNode.attrs, false);
|
14803 | }
|
14804 | if (tNode.mergedAttrs !== null) {
|
14805 | computeStaticStyling(tNode, tNode.mergedAttrs, true);
|
14806 | }
|
14807 | if (tView.queries !== null) {
|
14808 | tView.queries.elementStart(tView, tNode);
|
14809 | }
|
14810 | return tNode;
|
14811 | }
|
14812 |
|
14813 |
|
14814 |
|
14815 |
|
14816 |
|
14817 |
|
14818 |
|
14819 |
|
14820 |
|
14821 |
|
14822 |
|
14823 |
|
14824 |
|
14825 |
|
14826 | function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
14827 | const lView = getLView();
|
14828 | const tView = getTView();
|
14829 | const adjustedIndex = HEADER_OFFSET + index;
|
14830 | ngDevMode &&
|
14831 | assertEqual(getBindingIndex(), tView.bindingStartIndex, 'elements should be created before any bindings');
|
14832 | ngDevMode && assertIndexInRange(lView, adjustedIndex);
|
14833 | const renderer = lView[RENDERER];
|
14834 | const native = lView[adjustedIndex] = createElementNode(renderer, name, getNamespace$1());
|
14835 | const tNode = tView.firstCreatePass ?
|
14836 | elementStartFirstCreatePass(adjustedIndex, tView, lView, native, name, attrsIndex, localRefsIndex) :
|
14837 | tView.data[adjustedIndex];
|
14838 | setCurrentTNode(tNode, true);
|
14839 | const mergedAttrs = tNode.mergedAttrs;
|
14840 | if (mergedAttrs !== null) {
|
14841 | setUpAttributes(renderer, native, mergedAttrs);
|
14842 | }
|
14843 | const classes = tNode.classes;
|
14844 | if (classes !== null) {
|
14845 | writeDirectClass(renderer, native, classes);
|
14846 | }
|
14847 | const styles = tNode.styles;
|
14848 | if (styles !== null) {
|
14849 | writeDirectStyle(renderer, native, styles);
|
14850 | }
|
14851 | if ((tNode.flags & 64 ) !== 64 ) {
|
14852 |
|
14853 |
|
14854 | appendChild(tView, lView, native, tNode);
|
14855 | }
|
14856 |
|
14857 |
|
14858 |
|
14859 | if (getElementDepthCount() === 0) {
|
14860 | attachPatchData(native, lView);
|
14861 | }
|
14862 | increaseElementDepthCount();
|
14863 | if (isDirectiveHost(tNode)) {
|
14864 | createDirectivesInstances(tView, lView, tNode);
|
14865 | executeContentQueries(tView, tNode, lView);
|
14866 | }
|
14867 | if (localRefsIndex !== null) {
|
14868 | saveResolvedLocalsInData(lView, tNode);
|
14869 | }
|
14870 | }
|
14871 |
|
14872 |
|
14873 |
|
14874 |
|
14875 |
|
14876 | function ɵɵelementEnd() {
|
14877 | let currentTNode = getCurrentTNode();
|
14878 | ngDevMode && assertDefined(currentTNode, 'No parent node to close.');
|
14879 | if (isCurrentTNodeParent()) {
|
14880 | setCurrentTNodeAsNotParent();
|
14881 | }
|
14882 | else {
|
14883 | ngDevMode && assertHasParent(getCurrentTNode());
|
14884 | currentTNode = currentTNode.parent;
|
14885 | setCurrentTNode(currentTNode, false);
|
14886 | }
|
14887 | const tNode = currentTNode;
|
14888 | ngDevMode && assertTNodeType(tNode, 3 );
|
14889 | decreaseElementDepthCount();
|
14890 | const tView = getTView();
|
14891 | if (tView.firstCreatePass) {
|
14892 | registerPostOrderHooks(tView, currentTNode);
|
14893 | if (isContentQueryHost(currentTNode)) {
|
14894 | tView.queries.elementEnd(currentTNode);
|
14895 | }
|
14896 | }
|
14897 | if (tNode.classesWithoutHost != null && hasClassInput(tNode)) {
|
14898 | setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.classesWithoutHost, true);
|
14899 | }
|
14900 | if (tNode.stylesWithoutHost != null && hasStyleInput(tNode)) {
|
14901 | setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.stylesWithoutHost, false);
|
14902 | }
|
14903 | }
|
14904 |
|
14905 |
|
14906 |
|
14907 |
|
14908 |
|
14909 |
|
14910 |
|
14911 |
|
14912 |
|
14913 |
|
14914 | function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
14915 | ɵɵelementStart(index, name, attrsIndex, localRefsIndex);
|
14916 | ɵɵelementEnd();
|
14917 | }
|
14918 | function logUnknownElementError(tView, element, tNode, hasDirectives) {
|
14919 | const schemas = tView.schemas;
|
14920 |
|
14921 |
|
14922 |
|
14923 |
|
14924 | if (schemas === null)
|
14925 | return;
|
14926 | const tagName = tNode.value;
|
14927 |
|
14928 | if (!hasDirectives && tagName !== null) {
|
14929 |
|
14930 |
|
14931 |
|
14932 | const isUnknown =
|
14933 |
|
14934 |
|
14935 | (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
|
14936 | element instanceof HTMLUnknownElement) ||
|
14937 | (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
14938 | !customElements.get(tagName));
|
14939 | if (isUnknown && !matchingSchemas(tView, tagName)) {
|
14940 | let message = `'${tagName}' is not a known element:\n`;
|
14941 | message += `1. If '${tagName}' is an Angular component, then verify that it is part of this module.\n`;
|
14942 | if (tagName && tagName.indexOf('-') > -1) {
|
14943 | message += `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.`;
|
14944 | }
|
14945 | else {
|
14946 | message +=
|
14947 | `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
14948 | }
|
14949 | console.error(formatRuntimeError("304" , message));
|
14950 | }
|
14951 | }
|
14952 | }
|
14953 |
|
14954 |
|
14955 |
|
14956 |
|
14957 |
|
14958 |
|
14959 |
|
14960 |
|
14961 | function elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, localRefsIndex) {
|
14962 | ngDevMode && ngDevMode.firstCreatePass++;
|
14963 | const tViewConsts = tView.consts;
|
14964 | const attrs = getConstant(tViewConsts, attrsIndex);
|
14965 | const tNode = getOrCreateTNode(tView, index, 8 , 'ng-container', attrs);
|
14966 |
|
14967 |
|
14968 | if (attrs !== null) {
|
14969 | computeStaticStyling(tNode, attrs, true);
|
14970 | }
|
14971 | const localRefs = getConstant(tViewConsts, localRefsIndex);
|
14972 | resolveDirectives(tView, lView, tNode, localRefs);
|
14973 | if (tView.queries !== null) {
|
14974 | tView.queries.elementStart(tView, tNode);
|
14975 | }
|
14976 | return tNode;
|
14977 | }
|
14978 |
|
14979 |
|
14980 |
|
14981 |
|
14982 |
|
14983 |
|
14984 |
|
14985 |
|
14986 |
|
14987 |
|
14988 |
|
14989 |
|
14990 |
|
14991 |
|
14992 | function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
|
14993 | const lView = getLView();
|
14994 | const tView = getTView();
|
14995 | const adjustedIndex = index + HEADER_OFFSET;
|
14996 | ngDevMode && assertIndexInRange(lView, adjustedIndex);
|
14997 | ngDevMode &&
|
14998 | assertEqual(getBindingIndex(), tView.bindingStartIndex, 'element containers should be created before any bindings');
|
14999 | const tNode = tView.firstCreatePass ?
|
15000 | elementContainerStartFirstCreatePass(adjustedIndex, tView, lView, attrsIndex, localRefsIndex) :
|
15001 | tView.data[adjustedIndex];
|
15002 | setCurrentTNode(tNode, true);
|
15003 | ngDevMode && ngDevMode.rendererCreateComment++;
|
15004 | const native = lView[adjustedIndex] =
|
15005 | lView[RENDERER].createComment(ngDevMode ? 'ng-container' : '');
|
15006 | appendChild(tView, lView, native, tNode);
|
15007 | attachPatchData(native, lView);
|
15008 | if (isDirectiveHost(tNode)) {
|
15009 | createDirectivesInstances(tView, lView, tNode);
|
15010 | executeContentQueries(tView, tNode, lView);
|
15011 | }
|
15012 | if (localRefsIndex != null) {
|
15013 | saveResolvedLocalsInData(lView, tNode);
|
15014 | }
|
15015 | }
|
15016 |
|
15017 |
|
15018 |
|
15019 |
|
15020 |
|
15021 | function ɵɵelementContainerEnd() {
|
15022 | let currentTNode = getCurrentTNode();
|
15023 | const tView = getTView();
|
15024 | if (isCurrentTNodeParent()) {
|
15025 | setCurrentTNodeAsNotParent();
|
15026 | }
|
15027 | else {
|
15028 | ngDevMode && assertHasParent(currentTNode);
|
15029 | currentTNode = currentTNode.parent;
|
15030 | setCurrentTNode(currentTNode, false);
|
15031 | }
|
15032 | ngDevMode && assertTNodeType(currentTNode, 8 );
|
15033 | if (tView.firstCreatePass) {
|
15034 | registerPostOrderHooks(tView, currentTNode);
|
15035 | if (isContentQueryHost(currentTNode)) {
|
15036 | tView.queries.elementEnd(currentTNode);
|
15037 | }
|
15038 | }
|
15039 | }
|
15040 |
|
15041 |
|
15042 |
|
15043 |
|
15044 |
|
15045 |
|
15046 |
|
15047 |
|
15048 |
|
15049 |
|
15050 | function ɵɵelementContainer(index, attrsIndex, localRefsIndex) {
|
15051 | ɵɵelementContainerStart(index, attrsIndex, localRefsIndex);
|
15052 | ɵɵelementContainerEnd();
|
15053 | }
|
15054 |
|
15055 |
|
15056 |
|
15057 |
|
15058 |
|
15059 |
|
15060 |
|
15061 |
|
15062 |
|
15063 |
|
15064 | function ɵɵgetCurrentView() {
|
15065 | return getLView();
|
15066 | }
|
15067 |
|
15068 |
|
15069 |
|
15070 |
|
15071 |
|
15072 |
|
15073 |
|
15074 |
|
15075 |
|
15076 |
|
15077 |
|
15078 | function isPromise(obj) {
|
15079 |
|
15080 |
|
15081 | return !!obj && typeof obj.then === 'function';
|
15082 | }
|
15083 |
|
15084 |
|
15085 |
|
15086 | function isSubscribable(obj) {
|
15087 | return !!obj && typeof obj.subscribe === 'function';
|
15088 | }
|
15089 |
|
15090 |
|
15091 |
|
15092 |
|
15093 |
|
15094 |
|
15095 |
|
15096 |
|
15097 |
|
15098 | const isObservable = isSubscribable;
|
15099 |
|
15100 |
|
15101 |
|
15102 |
|
15103 |
|
15104 |
|
15105 |
|
15106 |
|
15107 |
|
15108 |
|
15109 |
|
15110 |
|
15111 |
|
15112 |
|
15113 |
|
15114 |
|
15115 |
|
15116 |
|
15117 |
|
15118 |
|
15119 |
|
15120 |
|
15121 | function ɵɵlistener(eventName, listenerFn, useCapture, eventTargetResolver) {
|
15122 | const lView = getLView();
|
15123 | const tView = getTView();
|
15124 | const tNode = getCurrentTNode();
|
15125 | listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn, !!useCapture, eventTargetResolver);
|
15126 | return ɵɵlistener;
|
15127 | }
|
15128 |
|
15129 |
|
15130 |
|
15131 |
|
15132 |
|
15133 |
|
15134 |
|
15135 |
|
15136 |
|
15137 |
|
15138 |
|
15139 |
|
15140 |
|
15141 |
|
15142 |
|
15143 |
|
15144 |
|
15145 |
|
15146 |
|
15147 |
|
15148 |
|
15149 | function ɵɵsyntheticHostListener(eventName, listenerFn) {
|
15150 | const tNode = getCurrentTNode();
|
15151 | const lView = getLView();
|
15152 | const tView = getTView();
|
15153 | const currentDef = getCurrentDirectiveDef(tView.data);
|
15154 | const renderer = loadComponentRenderer(currentDef, tNode, lView);
|
15155 | listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, false);
|
15156 | return ɵɵsyntheticHostListener;
|
15157 | }
|
15158 |
|
15159 |
|
15160 |
|
15161 |
|
15162 |
|
15163 | function findExistingListener(tView, lView, eventName, tNodeIdx) {
|
15164 | const tCleanup = tView.cleanup;
|
15165 | if (tCleanup != null) {
|
15166 | for (let i = 0; i < tCleanup.length - 1; i += 2) {
|
15167 | const cleanupEventName = tCleanup[i];
|
15168 | if (cleanupEventName === eventName && tCleanup[i + 1] === tNodeIdx) {
|
15169 |
|
15170 |
|
15171 |
|
15172 | const lCleanup = lView[CLEANUP];
|
15173 | const listenerIdxInLCleanup = tCleanup[i + 2];
|
15174 | return lCleanup.length > listenerIdxInLCleanup ? lCleanup[listenerIdxInLCleanup] : null;
|
15175 | }
|
15176 |
|
15177 |
|
15178 |
|
15179 |
|
15180 |
|
15181 | if (typeof cleanupEventName === 'string') {
|
15182 | i += 2;
|
15183 | }
|
15184 | }
|
15185 | }
|
15186 | return null;
|
15187 | }
|
15188 | function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, useCapture, eventTargetResolver) {
|
15189 | const isTNodeDirectiveHost = isDirectiveHost(tNode);
|
15190 | const firstCreatePass = tView.firstCreatePass;
|
15191 | const tCleanup = firstCreatePass && getOrCreateTViewCleanup(tView);
|
15192 | const context = lView[CONTEXT];
|
15193 |
|
15194 |
|
15195 |
|
15196 | const lCleanup = getOrCreateLViewCleanup(lView);
|
15197 | ngDevMode && assertTNodeType(tNode, 3 | 12 );
|
15198 | let processOutputs = true;
|
15199 |
|
15200 |
|
15201 |
|
15202 |
|
15203 | if ((tNode.type & 3 ) || eventTargetResolver) {
|
15204 | const native = getNativeByTNode(tNode, lView);
|
15205 | const target = eventTargetResolver ? eventTargetResolver(native) : native;
|
15206 | const lCleanupIndex = lCleanup.length;
|
15207 | const idxOrTargetGetter = eventTargetResolver ?
|
15208 | (_lView) => eventTargetResolver(unwrapRNode(_lView[tNode.index])) :
|
15209 | tNode.index;
|
15210 |
|
15211 |
|
15212 | if (isProceduralRenderer(renderer)) {
|
15213 |
|
15214 |
|
15215 |
|
15216 |
|
15217 |
|
15218 |
|
15219 |
|
15220 |
|
15221 |
|
15222 |
|
15223 | let existingListener = null;
|
15224 |
|
15225 |
|
15226 |
|
15227 |
|
15228 |
|
15229 |
|
15230 | if (!eventTargetResolver && isTNodeDirectiveHost) {
|
15231 | existingListener = findExistingListener(tView, lView, eventName, tNode.index);
|
15232 | }
|
15233 | if (existingListener !== null) {
|
15234 |
|
15235 |
|
15236 |
|
15237 |
|
15238 | const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
|
15239 | lastListenerFn.__ngNextListenerFn__ = listenerFn;
|
15240 | existingListener.__ngLastListenerFn__ = listenerFn;
|
15241 | processOutputs = false;
|
15242 | }
|
15243 | else {
|
15244 | listenerFn = wrapListener(tNode, lView, context, listenerFn, false );
|
15245 | const cleanupFn = renderer.listen(target, eventName, listenerFn);
|
15246 | ngDevMode && ngDevMode.rendererAddEventListener++;
|
15247 | lCleanup.push(listenerFn, cleanupFn);
|
15248 | tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
|
15249 | }
|
15250 | }
|
15251 | else {
|
15252 | listenerFn = wrapListener(tNode, lView, context, listenerFn, true );
|
15253 | target.addEventListener(eventName, listenerFn, useCapture);
|
15254 | ngDevMode && ngDevMode.rendererAddEventListener++;
|
15255 | lCleanup.push(listenerFn);
|
15256 | tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, useCapture);
|
15257 | }
|
15258 | }
|
15259 | else {
|
15260 |
|
15261 |
|
15262 | listenerFn = wrapListener(tNode, lView, context, listenerFn, false );
|
15263 | }
|
15264 |
|
15265 | const outputs = tNode.outputs;
|
15266 | let props;
|
15267 | if (processOutputs && outputs !== null && (props = outputs[eventName])) {
|
15268 | const propsLength = props.length;
|
15269 | if (propsLength) {
|
15270 | for (let i = 0; i < propsLength; i += 2) {
|
15271 | const index = props[i];
|
15272 | ngDevMode && assertIndexInRange(lView, index);
|
15273 | const minifiedName = props[i + 1];
|
15274 | const directiveInstance = lView[index];
|
15275 | const output = directiveInstance[minifiedName];
|
15276 | if (ngDevMode && !isObservable(output)) {
|
15277 | throw new Error(`@Output ${minifiedName} not initialized in '${directiveInstance.constructor.name}'.`);
|
15278 | }
|
15279 | const subscription = output.subscribe(listenerFn);
|
15280 | const idx = lCleanup.length;
|
15281 | lCleanup.push(listenerFn, subscription);
|
15282 | tCleanup && tCleanup.push(eventName, tNode.index, idx, -(idx + 1));
|
15283 | }
|
15284 | }
|
15285 | }
|
15286 | }
|
15287 | function executeListenerWithErrorHandling(lView, context, listenerFn, e) {
|
15288 | try {
|
15289 | profiler(6 , context, listenerFn);
|
15290 |
|
15291 | return listenerFn(e) !== false;
|
15292 | }
|
15293 | catch (error) {
|
15294 | handleError(lView, error);
|
15295 | return false;
|
15296 | }
|
15297 | finally {
|
15298 | profiler(7 , context, listenerFn);
|
15299 | }
|
15300 | }
|
15301 |
|
15302 |
|
15303 |
|
15304 |
|
15305 |
|
15306 |
|
15307 |
|
15308 |
|
15309 |
|
15310 |
|
15311 | function wrapListener(tNode, lView, context, listenerFn, wrapWithPreventDefault) {
|
15312 |
|
15313 |
|
15314 | return function wrapListenerIn_markDirtyAndPreventDefault(e) {
|
15315 |
|
15316 |
|
15317 | if (e === Function) {
|
15318 | return listenerFn;
|
15319 | }
|
15320 |
|
15321 |
|
15322 | const startView = tNode.flags & 2 ?
|
15323 | getComponentLViewByIndex(tNode.index, lView) :
|
15324 | lView;
|
15325 |
|
15326 | if ((lView[FLAGS] & 32 ) === 0) {
|
15327 | markViewDirty(startView);
|
15328 | }
|
15329 | let result = executeListenerWithErrorHandling(lView, context, listenerFn, e);
|
15330 |
|
15331 |
|
15332 | let nextListenerFn = wrapListenerIn_markDirtyAndPreventDefault.__ngNextListenerFn__;
|
15333 | while (nextListenerFn) {
|
15334 |
|
15335 | result = executeListenerWithErrorHandling(lView, context, nextListenerFn, e) && result;
|
15336 | nextListenerFn = nextListenerFn.__ngNextListenerFn__;
|
15337 | }
|
15338 | if (wrapWithPreventDefault && result === false) {
|
15339 | e.preventDefault();
|
15340 |
|
15341 | e.returnValue = false;
|
15342 | }
|
15343 | return result;
|
15344 | };
|
15345 | }
|
15346 |
|
15347 |
|
15348 |
|
15349 |
|
15350 |
|
15351 |
|
15352 |
|
15353 |
|
15354 |
|
15355 |
|
15356 |
|
15357 |
|
15358 |
|
15359 |
|
15360 |
|
15361 |
|
15362 |
|
15363 |
|
15364 |
|
15365 |
|
15366 |
|
15367 |
|
15368 |
|
15369 |
|
15370 |
|
15371 |
|
15372 |
|
15373 |
|
15374 | function ɵɵnextContext(level = 1) {
|
15375 | return nextContextImpl(level);
|
15376 | }
|
15377 |
|
15378 |
|
15379 |
|
15380 |
|
15381 |
|
15382 |
|
15383 |
|
15384 |
|
15385 |
|
15386 |
|
15387 |
|
15388 |
|
15389 |
|
15390 |
|
15391 |
|
15392 |
|
15393 | function matchingProjectionSlotIndex(tNode, projectionSlots) {
|
15394 | let wildcardNgContentIndex = null;
|
15395 | const ngProjectAsAttrVal = getProjectAsAttrValue(tNode);
|
15396 | for (let i = 0; i < projectionSlots.length; i++) {
|
15397 | const slotValue = projectionSlots[i];
|
15398 |
|
15399 |
|
15400 | if (slotValue === '*') {
|
15401 | wildcardNgContentIndex = i;
|
15402 | continue;
|
15403 | }
|
15404 |
|
15405 |
|
15406 | if (ngProjectAsAttrVal === null ?
|
15407 | isNodeMatchingSelectorList(tNode, slotValue, true) :
|
15408 | isSelectorInSelectorList(ngProjectAsAttrVal, slotValue)) {
|
15409 | return i;
|
15410 | }
|
15411 | }
|
15412 | return wildcardNgContentIndex;
|
15413 | }
|
15414 |
|
15415 |
|
15416 |
|
15417 |
|
15418 |
|
15419 |
|
15420 |
|
15421 |
|
15422 |
|
15423 |
|
15424 |
|
15425 |
|
15426 |
|
15427 |
|
15428 |
|
15429 |
|
15430 |
|
15431 |
|
15432 |
|
15433 |
|
15434 |
|
15435 |
|
15436 |
|
15437 |
|
15438 |
|
15439 | function ɵɵprojectionDef(projectionSlots) {
|
15440 | const componentNode = getLView()[DECLARATION_COMPONENT_VIEW][T_HOST];
|
15441 | if (!componentNode.projection) {
|
15442 |
|
15443 |
|
15444 | const numProjectionSlots = projectionSlots ? projectionSlots.length : 1;
|
15445 | const projectionHeads = componentNode.projection =
|
15446 | newArray(numProjectionSlots, null);
|
15447 | const tails = projectionHeads.slice();
|
15448 | let componentChild = componentNode.child;
|
15449 | while (componentChild !== null) {
|
15450 | const slotIndex = projectionSlots ? matchingProjectionSlotIndex(componentChild, projectionSlots) : 0;
|
15451 | if (slotIndex !== null) {
|
15452 | if (tails[slotIndex]) {
|
15453 | tails[slotIndex].projectionNext = componentChild;
|
15454 | }
|
15455 | else {
|
15456 | projectionHeads[slotIndex] = componentChild;
|
15457 | }
|
15458 | tails[slotIndex] = componentChild;
|
15459 | }
|
15460 | componentChild = componentChild.next;
|
15461 | }
|
15462 | }
|
15463 | }
|
15464 |
|
15465 |
|
15466 |
|
15467 |
|
15468 |
|
15469 |
|
15470 |
|
15471 |
|
15472 |
|
15473 |
|
15474 |
|
15475 | function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs) {
|
15476 | const lView = getLView();
|
15477 | const tView = getTView();
|
15478 | const tProjectionNode = getOrCreateTNode(tView, HEADER_OFFSET + nodeIndex, 16 , null, attrs || null);
|
15479 |
|
15480 | if (tProjectionNode.projection === null)
|
15481 | tProjectionNode.projection = selectorIndex;
|
15482 |
|
15483 | setCurrentTNodeAsNotParent();
|
15484 | if ((tProjectionNode.flags & 64 ) !== 64 ) {
|
15485 |
|
15486 | applyProjection(tView, lView, tProjectionNode);
|
15487 | }
|
15488 | }
|
15489 |
|
15490 |
|
15491 |
|
15492 |
|
15493 |
|
15494 |
|
15495 |
|
15496 |
|
15497 |
|
15498 |
|
15499 |
|
15500 |
|
15501 |
|
15502 |
|
15503 |
|
15504 |
|
15505 |
|
15506 |
|
15507 |
|
15508 |
|
15509 |
|
15510 |
|
15511 |
|
15512 |
|
15513 |
|
15514 |
|
15515 |
|
15516 |
|
15517 |
|
15518 |
|
15519 | function ɵɵpropertyInterpolate(propName, v0, sanitizer) {
|
15520 | ɵɵpropertyInterpolate1(propName, '', v0, '', sanitizer);
|
15521 | return ɵɵpropertyInterpolate;
|
15522 | }
|
15523 |
|
15524 |
|
15525 |
|
15526 |
|
15527 |
|
15528 |
|
15529 |
|
15530 |
|
15531 |
|
15532 |
|
15533 |
|
15534 |
|
15535 |
|
15536 |
|
15537 |
|
15538 |
|
15539 |
|
15540 |
|
15541 |
|
15542 |
|
15543 |
|
15544 |
|
15545 |
|
15546 |
|
15547 |
|
15548 |
|
15549 |
|
15550 |
|
15551 | function ɵɵpropertyInterpolate1(propName, prefix, v0, suffix, sanitizer) {
|
15552 | const lView = getLView();
|
15553 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
15554 | if (interpolatedValue !== NO_CHANGE) {
|
15555 | const tView = getTView();
|
15556 | const tNode = getSelectedTNode();
|
15557 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
15558 | ngDevMode &&
|
15559 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 1, prefix, suffix);
|
15560 | }
|
15561 | return ɵɵpropertyInterpolate1;
|
15562 | }
|
15563 |
|
15564 |
|
15565 |
|
15566 |
|
15567 |
|
15568 |
|
15569 |
|
15570 |
|
15571 |
|
15572 |
|
15573 |
|
15574 |
|
15575 |
|
15576 |
|
15577 |
|
15578 |
|
15579 |
|
15580 |
|
15581 |
|
15582 |
|
15583 |
|
15584 |
|
15585 |
|
15586 |
|
15587 |
|
15588 |
|
15589 |
|
15590 |
|
15591 |
|
15592 |
|
15593 | function ɵɵpropertyInterpolate2(propName, prefix, v0, i0, v1, suffix, sanitizer) {
|
15594 | const lView = getLView();
|
15595 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
15596 | if (interpolatedValue !== NO_CHANGE) {
|
15597 | const tView = getTView();
|
15598 | const tNode = getSelectedTNode();
|
15599 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
15600 | ngDevMode &&
|
15601 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 2, prefix, i0, suffix);
|
15602 | }
|
15603 | return ɵɵpropertyInterpolate2;
|
15604 | }
|
15605 |
|
15606 |
|
15607 |
|
15608 |
|
15609 |
|
15610 |
|
15611 |
|
15612 |
|
15613 |
|
15614 |
|
15615 |
|
15616 |
|
15617 |
|
15618 |
|
15619 |
|
15620 |
|
15621 |
|
15622 |
|
15623 |
|
15624 |
|
15625 |
|
15626 |
|
15627 |
|
15628 |
|
15629 |
|
15630 |
|
15631 |
|
15632 |
|
15633 |
|
15634 |
|
15635 |
|
15636 |
|
15637 |
|
15638 | function ɵɵpropertyInterpolate3(propName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer) {
|
15639 | const lView = getLView();
|
15640 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
15641 | if (interpolatedValue !== NO_CHANGE) {
|
15642 | const tView = getTView();
|
15643 | const tNode = getSelectedTNode();
|
15644 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
15645 | ngDevMode &&
|
15646 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 3, prefix, i0, i1, suffix);
|
15647 | }
|
15648 | return ɵɵpropertyInterpolate3;
|
15649 | }
|
15650 |
|
15651 |
|
15652 |
|
15653 |
|
15654 |
|
15655 |
|
15656 |
|
15657 |
|
15658 |
|
15659 |
|
15660 |
|
15661 |
|
15662 |
|
15663 |
|
15664 |
|
15665 |
|
15666 |
|
15667 |
|
15668 |
|
15669 |
|
15670 |
|
15671 |
|
15672 |
|
15673 |
|
15674 |
|
15675 |
|
15676 |
|
15677 |
|
15678 |
|
15679 |
|
15680 |
|
15681 |
|
15682 |
|
15683 |
|
15684 |
|
15685 | function ɵɵpropertyInterpolate4(propName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer) {
|
15686 | const lView = getLView();
|
15687 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
15688 | if (interpolatedValue !== NO_CHANGE) {
|
15689 | const tView = getTView();
|
15690 | const tNode = getSelectedTNode();
|
15691 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
15692 | ngDevMode &&
|
15693 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
|
15694 | }
|
15695 | return ɵɵpropertyInterpolate4;
|
15696 | }
|
15697 |
|
15698 |
|
15699 |
|
15700 |
|
15701 |
|
15702 |
|
15703 |
|
15704 |
|
15705 |
|
15706 |
|
15707 |
|
15708 |
|
15709 |
|
15710 |
|
15711 |
|
15712 |
|
15713 |
|
15714 |
|
15715 |
|
15716 |
|
15717 |
|
15718 |
|
15719 |
|
15720 |
|
15721 |
|
15722 |
|
15723 |
|
15724 |
|
15725 |
|
15726 |
|
15727 |
|
15728 |
|
15729 |
|
15730 |
|
15731 |
|
15732 |
|
15733 |
|
15734 | function ɵɵpropertyInterpolate5(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer) {
|
15735 | const lView = getLView();
|
15736 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
15737 | if (interpolatedValue !== NO_CHANGE) {
|
15738 | const tView = getTView();
|
15739 | const tNode = getSelectedTNode();
|
15740 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
15741 | ngDevMode &&
|
15742 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
|
15743 | }
|
15744 | return ɵɵpropertyInterpolate5;
|
15745 | }
|
15746 |
|
15747 |
|
15748 |
|
15749 |
|
15750 |
|
15751 |
|
15752 |
|
15753 |
|
15754 |
|
15755 |
|
15756 |
|
15757 |
|
15758 |
|
15759 |
|
15760 |
|
15761 |
|
15762 |
|
15763 |
|
15764 |
|
15765 |
|
15766 |
|
15767 |
|
15768 |
|
15769 |
|
15770 |
|
15771 |
|
15772 |
|
15773 |
|
15774 |
|
15775 |
|
15776 |
|
15777 |
|
15778 |
|
15779 |
|
15780 |
|
15781 |
|
15782 |
|
15783 |
|
15784 |
|
15785 | function ɵɵpropertyInterpolate6(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer) {
|
15786 | const lView = getLView();
|
15787 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
15788 | if (interpolatedValue !== NO_CHANGE) {
|
15789 | const tView = getTView();
|
15790 | const tNode = getSelectedTNode();
|
15791 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
15792 | ngDevMode &&
|
15793 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 6, prefix, i0, i1, i2, i3, i4, suffix);
|
15794 | }
|
15795 | return ɵɵpropertyInterpolate6;
|
15796 | }
|
15797 |
|
15798 |
|
15799 |
|
15800 |
|
15801 |
|
15802 |
|
15803 |
|
15804 |
|
15805 |
|
15806 |
|
15807 |
|
15808 |
|
15809 |
|
15810 |
|
15811 |
|
15812 |
|
15813 |
|
15814 |
|
15815 |
|
15816 |
|
15817 |
|
15818 |
|
15819 |
|
15820 |
|
15821 |
|
15822 |
|
15823 |
|
15824 |
|
15825 |
|
15826 |
|
15827 |
|
15828 |
|
15829 |
|
15830 |
|
15831 |
|
15832 |
|
15833 |
|
15834 |
|
15835 |
|
15836 |
|
15837 |
|
15838 | function ɵɵpropertyInterpolate7(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer) {
|
15839 | const lView = getLView();
|
15840 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
15841 | if (interpolatedValue !== NO_CHANGE) {
|
15842 | const tView = getTView();
|
15843 | const tNode = getSelectedTNode();
|
15844 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
15845 | ngDevMode &&
|
15846 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 7, prefix, i0, i1, i2, i3, i4, i5, suffix);
|
15847 | }
|
15848 | return ɵɵpropertyInterpolate7;
|
15849 | }
|
15850 |
|
15851 |
|
15852 |
|
15853 |
|
15854 |
|
15855 |
|
15856 |
|
15857 |
|
15858 |
|
15859 |
|
15860 |
|
15861 |
|
15862 |
|
15863 |
|
15864 |
|
15865 |
|
15866 |
|
15867 |
|
15868 |
|
15869 |
|
15870 |
|
15871 |
|
15872 |
|
15873 |
|
15874 |
|
15875 |
|
15876 |
|
15877 |
|
15878 |
|
15879 |
|
15880 |
|
15881 |
|
15882 |
|
15883 |
|
15884 |
|
15885 |
|
15886 |
|
15887 |
|
15888 |
|
15889 |
|
15890 |
|
15891 |
|
15892 |
|
15893 | function ɵɵpropertyInterpolate8(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer) {
|
15894 | const lView = getLView();
|
15895 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
15896 | if (interpolatedValue !== NO_CHANGE) {
|
15897 | const tView = getTView();
|
15898 | const tNode = getSelectedTNode();
|
15899 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
15900 | ngDevMode &&
|
15901 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 8, prefix, i0, i1, i2, i3, i4, i5, i6, suffix);
|
15902 | }
|
15903 | return ɵɵpropertyInterpolate8;
|
15904 | }
|
15905 |
|
15906 |
|
15907 |
|
15908 |
|
15909 |
|
15910 |
|
15911 |
|
15912 |
|
15913 |
|
15914 |
|
15915 |
|
15916 |
|
15917 |
|
15918 |
|
15919 |
|
15920 |
|
15921 |
|
15922 |
|
15923 |
|
15924 |
|
15925 |
|
15926 |
|
15927 |
|
15928 |
|
15929 |
|
15930 |
|
15931 |
|
15932 |
|
15933 |
|
15934 |
|
15935 | function ɵɵpropertyInterpolateV(propName, values, sanitizer) {
|
15936 | const lView = getLView();
|
15937 | const interpolatedValue = interpolationV(lView, values);
|
15938 | if (interpolatedValue !== NO_CHANGE) {
|
15939 | const tView = getTView();
|
15940 | const tNode = getSelectedTNode();
|
15941 | elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
|
15942 | if (ngDevMode) {
|
15943 | const interpolationInBetween = [values[0]];
|
15944 | for (let i = 2; i < values.length; i += 2) {
|
15945 | interpolationInBetween.push(values[i]);
|
15946 | }
|
15947 | storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - interpolationInBetween.length + 1, ...interpolationInBetween);
|
15948 | }
|
15949 | }
|
15950 | return ɵɵpropertyInterpolateV;
|
15951 | }
|
15952 |
|
15953 |
|
15954 |
|
15955 |
|
15956 |
|
15957 |
|
15958 |
|
15959 |
|
15960 |
|
15961 |
|
15962 |
|
15963 |
|
15964 |
|
15965 |
|
15966 |
|
15967 |
|
15968 |
|
15969 |
|
15970 |
|
15971 |
|
15972 |
|
15973 |
|
15974 |
|
15975 |
|
15976 |
|
15977 |
|
15978 |
|
15979 |
|
15980 |
|
15981 |
|
15982 |
|
15983 |
|
15984 |
|
15985 |
|
15986 |
|
15987 |
|
15988 |
|
15989 |
|
15990 |
|
15991 |
|
15992 |
|
15993 |
|
15994 |
|
15995 |
|
15996 |
|
15997 |
|
15998 |
|
15999 |
|
16000 |
|
16001 |
|
16002 |
|
16003 |
|
16004 |
|
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 |
|
16059 |
|
16060 |
|
16061 |
|
16062 |
|
16063 |
|
16064 |
|
16065 |
|
16066 |
|
16067 |
|
16068 |
|
16069 |
|
16070 |
|
16071 |
|
16072 |
|
16073 |
|
16074 |
|
16075 |
|
16076 |
|
16077 |
|
16078 |
|
16079 |
|
16080 |
|
16081 |
|
16082 |
|
16083 |
|
16084 |
|
16085 |
|
16086 |
|
16087 |
|
16088 |
|
16089 |
|
16090 |
|
16091 |
|
16092 |
|
16093 |
|
16094 |
|
16095 |
|
16096 |
|
16097 |
|
16098 |
|
16099 |
|
16100 |
|
16101 |
|
16102 |
|
16103 |
|
16104 |
|
16105 |
|
16106 |
|
16107 |
|
16108 |
|
16109 |
|
16110 |
|
16111 |
|
16112 |
|
16113 | let __unused_const_as_closure_does_not_like_standalone_comment_blocks__;
|
16114 |
|
16115 |
|
16116 |
|
16117 |
|
16118 |
|
16119 |
|
16120 |
|
16121 |
|
16122 |
|
16123 |
|
16124 |
|
16125 |
|
16126 |
|
16127 |
|
16128 |
|
16129 |
|
16130 |
|
16131 |
|
16132 |
|
16133 |
|
16134 | function insertTStylingBinding(tData, tNode, tStylingKeyWithStatic, index, isHostBinding, isClassBinding) {
|
16135 | ngDevMode && assertFirstUpdatePass(getTView());
|
16136 | let tBindings = isClassBinding ? tNode.classBindings : tNode.styleBindings;
|
16137 | let tmplHead = getTStylingRangePrev(tBindings);
|
16138 | let tmplTail = getTStylingRangeNext(tBindings);
|
16139 | tData[index] = tStylingKeyWithStatic;
|
16140 | let isKeyDuplicateOfStatic = false;
|
16141 | let tStylingKey;
|
16142 | if (Array.isArray(tStylingKeyWithStatic)) {
|
16143 |
|
16144 | const staticKeyValueArray = tStylingKeyWithStatic;
|
16145 | tStylingKey = staticKeyValueArray[1];
|
16146 |
|
16147 | if (tStylingKey === null ||
|
16148 | keyValueArrayIndexOf(staticKeyValueArray, tStylingKey) > 0) {
|
16149 |
|
16150 | isKeyDuplicateOfStatic = true;
|
16151 | }
|
16152 | }
|
16153 | else {
|
16154 | tStylingKey = tStylingKeyWithStatic;
|
16155 | }
|
16156 | if (isHostBinding) {
|
16157 |
|
16158 |
|
16159 | const hasTemplateBindings = tmplTail !== 0;
|
16160 |
|
16161 |
|
16162 | if (hasTemplateBindings) {
|
16163 |
|
16164 | const previousNode = getTStylingRangePrev(tData[tmplHead + 1]);
|
16165 | tData[index + 1] = toTStylingRange(previousNode, tmplHead);
|
16166 |
|
16167 |
|
16168 | if (previousNode !== 0) {
|
16169 |
|
16170 | tData[previousNode + 1] =
|
16171 | setTStylingRangeNext(tData[previousNode + 1], index);
|
16172 | }
|
16173 |
|
16174 | tData[tmplHead + 1] = setTStylingRangePrev(tData[tmplHead + 1], index);
|
16175 | }
|
16176 | else {
|
16177 | tData[index + 1] = toTStylingRange(tmplHead, 0);
|
16178 |
|
16179 |
|
16180 | if (tmplHead !== 0) {
|
16181 |
|
16182 | tData[tmplHead + 1] = setTStylingRangeNext(tData[tmplHead + 1], index);
|
16183 | }
|
16184 |
|
16185 | tmplHead = index;
|
16186 | }
|
16187 | }
|
16188 | else {
|
16189 |
|
16190 |
|
16191 | tData[index + 1] = toTStylingRange(tmplTail, 0);
|
16192 | ngDevMode &&
|
16193 | assertEqual(tmplHead !== 0 && tmplTail === 0, false, 'Adding template bindings after hostBindings is not allowed.');
|
16194 | if (tmplHead === 0) {
|
16195 | tmplHead = index;
|
16196 | }
|
16197 | else {
|
16198 |
|
16199 | tData[tmplTail + 1] = setTStylingRangeNext(tData[tmplTail + 1], index);
|
16200 | }
|
16201 | tmplTail = index;
|
16202 | }
|
16203 |
|
16204 |
|
16205 | if (isKeyDuplicateOfStatic) {
|
16206 | tData[index + 1] = setTStylingRangePrevDuplicate(tData[index + 1]);
|
16207 | }
|
16208 | markDuplicates(tData, tStylingKey, index, true, isClassBinding);
|
16209 | markDuplicates(tData, tStylingKey, index, false, isClassBinding);
|
16210 | markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding);
|
16211 | tBindings = toTStylingRange(tmplHead, tmplTail);
|
16212 | if (isClassBinding) {
|
16213 | tNode.classBindings = tBindings;
|
16214 | }
|
16215 | else {
|
16216 | tNode.styleBindings = tBindings;
|
16217 | }
|
16218 | }
|
16219 |
|
16220 |
|
16221 |
|
16222 |
|
16223 |
|
16224 |
|
16225 |
|
16226 |
|
16227 |
|
16228 |
|
16229 | function markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding) {
|
16230 | const residual = isClassBinding ? tNode.residualClasses : tNode.residualStyles;
|
16231 | if (residual != null && typeof tStylingKey == 'string' &&
|
16232 | keyValueArrayIndexOf(residual, tStylingKey) >= 0) {
|
16233 |
|
16234 | tData[index + 1] = setTStylingRangeNextDuplicate(tData[index + 1]);
|
16235 | }
|
16236 | }
|
16237 |
|
16238 |
|
16239 |
|
16240 |
|
16241 |
|
16242 |
|
16243 |
|
16244 |
|
16245 |
|
16246 |
|
16247 |
|
16248 |
|
16249 |
|
16250 |
|
16251 |
|
16252 |
|
16253 |
|
16254 |
|
16255 |
|
16256 |
|
16257 |
|
16258 |
|
16259 |
|
16260 |
|
16261 |
|
16262 |
|
16263 |
|
16264 |
|
16265 |
|
16266 |
|
16267 |
|
16268 |
|
16269 |
|
16270 |
|
16271 |
|
16272 |
|
16273 |
|
16274 |
|
16275 |
|
16276 |
|
16277 |
|
16278 |
|
16279 |
|
16280 |
|
16281 |
|
16282 |
|
16283 |
|
16284 |
|
16285 |
|
16286 |
|
16287 |
|
16288 |
|
16289 |
|
16290 |
|
16291 |
|
16292 |
|
16293 | function markDuplicates(tData, tStylingKey, index, isPrevDir, isClassBinding) {
|
16294 | const tStylingAtIndex = tData[index + 1];
|
16295 | const isMap = tStylingKey === null;
|
16296 | let cursor = isPrevDir ? getTStylingRangePrev(tStylingAtIndex) : getTStylingRangeNext(tStylingAtIndex);
|
16297 | let foundDuplicate = false;
|
16298 |
|
16299 |
|
16300 |
|
16301 |
|
16302 |
|
16303 | while (cursor !== 0 && (foundDuplicate === false || isMap)) {
|
16304 | ngDevMode && assertIndexInRange(tData, cursor);
|
16305 | const tStylingValueAtCursor = tData[cursor];
|
16306 | const tStyleRangeAtCursor = tData[cursor + 1];
|
16307 | if (isStylingMatch(tStylingValueAtCursor, tStylingKey)) {
|
16308 | foundDuplicate = true;
|
16309 | tData[cursor + 1] = isPrevDir ? setTStylingRangeNextDuplicate(tStyleRangeAtCursor) :
|
16310 | setTStylingRangePrevDuplicate(tStyleRangeAtCursor);
|
16311 | }
|
16312 | cursor = isPrevDir ? getTStylingRangePrev(tStyleRangeAtCursor) :
|
16313 | getTStylingRangeNext(tStyleRangeAtCursor);
|
16314 | }
|
16315 | if (foundDuplicate) {
|
16316 |
|
16317 | tData[index + 1] = isPrevDir ? setTStylingRangePrevDuplicate(tStylingAtIndex) :
|
16318 | setTStylingRangeNextDuplicate(tStylingAtIndex);
|
16319 | }
|
16320 | }
|
16321 |
|
16322 |
|
16323 |
|
16324 |
|
16325 |
|
16326 |
|
16327 |
|
16328 |
|
16329 |
|
16330 |
|
16331 |
|
16332 |
|
16333 |
|
16334 |
|
16335 |
|
16336 |
|
16337 |
|
16338 |
|
16339 | function isStylingMatch(tStylingKeyCursor, tStylingKey) {
|
16340 | ngDevMode &&
|
16341 | assertNotEqual(Array.isArray(tStylingKey), true, 'Expected that \'tStylingKey\' has been unwrapped');
|
16342 | if (tStylingKeyCursor === null ||
|
16343 |
|
16344 | tStylingKey == null ||
|
16345 |
|
16346 | (Array.isArray(tStylingKeyCursor) ? tStylingKeyCursor[1] : tStylingKeyCursor) ===
|
16347 | tStylingKey
|
16348 | ) {
|
16349 | return true;
|
16350 | }
|
16351 | else if (Array.isArray(tStylingKeyCursor) && typeof tStylingKey === 'string') {
|
16352 |
|
16353 |
|
16354 | return keyValueArrayIndexOf(tStylingKeyCursor, tStylingKey) >=
|
16355 | 0;
|
16356 | }
|
16357 | return false;
|
16358 | }
|
16359 |
|
16360 |
|
16361 |
|
16362 |
|
16363 |
|
16364 |
|
16365 |
|
16366 |
|
16367 |
|
16368 | const parserState = {
|
16369 | textEnd: 0,
|
16370 | key: 0,
|
16371 | keyEnd: 0,
|
16372 | value: 0,
|
16373 | valueEnd: 0,
|
16374 | };
|
16375 |
|
16376 |
|
16377 |
|
16378 |
|
16379 | function getLastParsedKey(text) {
|
16380 | return text.substring(parserState.key, parserState.keyEnd);
|
16381 | }
|
16382 |
|
16383 |
|
16384 |
|
16385 |
|
16386 | function getLastParsedValue(text) {
|
16387 | return text.substring(parserState.value, parserState.valueEnd);
|
16388 | }
|
16389 |
|
16390 |
|
16391 |
|
16392 |
|
16393 |
|
16394 |
|
16395 |
|
16396 |
|
16397 |
|
16398 |
|
16399 |
|
16400 |
|
16401 |
|
16402 | function parseClassName(text) {
|
16403 | resetParserState(text);
|
16404 | return parseClassNameNext(text, consumeWhitespace(text, 0, parserState.textEnd));
|
16405 | }
|
16406 |
|
16407 |
|
16408 |
|
16409 |
|
16410 |
|
16411 |
|
16412 |
|
16413 |
|
16414 |
|
16415 |
|
16416 |
|
16417 |
|
16418 |
|
16419 |
|
16420 |
|
16421 | function parseClassNameNext(text, index) {
|
16422 | const end = parserState.textEnd;
|
16423 | if (end === index) {
|
16424 | return -1;
|
16425 | }
|
16426 | index = parserState.keyEnd = consumeClassToken(text, parserState.key = index, end);
|
16427 | return consumeWhitespace(text, index, end);
|
16428 | }
|
16429 |
|
16430 |
|
16431 |
|
16432 |
|
16433 |
|
16434 |
|
16435 |
|
16436 |
|
16437 |
|
16438 |
|
16439 |
|
16440 |
|
16441 |
|
16442 |
|
16443 | function parseStyle(text) {
|
16444 | resetParserState(text);
|
16445 | return parseStyleNext(text, consumeWhitespace(text, 0, parserState.textEnd));
|
16446 | }
|
16447 |
|
16448 |
|
16449 |
|
16450 |
|
16451 |
|
16452 |
|
16453 |
|
16454 |
|
16455 |
|
16456 |
|
16457 |
|
16458 |
|
16459 |
|
16460 |
|
16461 |
|
16462 | function parseStyleNext(text, startIndex) {
|
16463 | const end = parserState.textEnd;
|
16464 | let index = parserState.key = consumeWhitespace(text, startIndex, end);
|
16465 | if (end === index) {
|
16466 |
|
16467 | return -1;
|
16468 | }
|
16469 | index = parserState.keyEnd = consumeStyleKey(text, index, end);
|
16470 | index = consumeSeparator(text, index, end, 58 );
|
16471 | index = parserState.value = consumeWhitespace(text, index, end);
|
16472 | index = parserState.valueEnd = consumeStyleValue(text, index, end);
|
16473 | return consumeSeparator(text, index, end, 59 );
|
16474 | }
|
16475 |
|
16476 |
|
16477 |
|
16478 |
|
16479 | function resetParserState(text) {
|
16480 | parserState.key = 0;
|
16481 | parserState.keyEnd = 0;
|
16482 | parserState.value = 0;
|
16483 | parserState.valueEnd = 0;
|
16484 | parserState.textEnd = text.length;
|
16485 | }
|
16486 |
|
16487 |
|
16488 |
|
16489 |
|
16490 |
|
16491 |
|
16492 |
|
16493 |
|
16494 |
|
16495 | function consumeWhitespace(text, startIndex, endIndex) {
|
16496 | while (startIndex < endIndex && text.charCodeAt(startIndex) <= 32 ) {
|
16497 | startIndex++;
|
16498 | }
|
16499 | return startIndex;
|
16500 | }
|
16501 |
|
16502 |
|
16503 |
|
16504 |
|
16505 |
|
16506 |
|
16507 |
|
16508 |
|
16509 | function consumeClassToken(text, startIndex, endIndex) {
|
16510 | while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 ) {
|
16511 | startIndex++;
|
16512 | }
|
16513 | return startIndex;
|
16514 | }
|
16515 |
|
16516 |
|
16517 |
|
16518 |
|
16519 |
|
16520 |
|
16521 |
|
16522 |
|
16523 | function consumeStyleKey(text, startIndex, endIndex) {
|
16524 | let ch;
|
16525 | while (startIndex < endIndex &&
|
16526 | ((ch = text.charCodeAt(startIndex)) === 45 || ch === 95 ||
|
16527 | ((ch & -33 ) >= 65 && (ch & -33 ) <= 90 ) ||
|
16528 | (ch >= 48 && ch <= 57 ))) {
|
16529 | startIndex++;
|
16530 | }
|
16531 | return startIndex;
|
16532 | }
|
16533 |
|
16534 |
|
16535 |
|
16536 |
|
16537 |
|
16538 |
|
16539 |
|
16540 |
|
16541 | function consumeSeparator(text, startIndex, endIndex, separator) {
|
16542 | startIndex = consumeWhitespace(text, startIndex, endIndex);
|
16543 | if (startIndex < endIndex) {
|
16544 | if (ngDevMode && text.charCodeAt(startIndex) !== separator) {
|
16545 | malformedStyleError(text, String.fromCharCode(separator), startIndex);
|
16546 | }
|
16547 | startIndex++;
|
16548 | }
|
16549 | return startIndex;
|
16550 | }
|
16551 |
|
16552 |
|
16553 |
|
16554 |
|
16555 |
|
16556 |
|
16557 |
|
16558 |
|
16559 | function consumeStyleValue(text, startIndex, endIndex) {
|
16560 | let ch1 = -1;
|
16561 | let ch2 = -1;
|
16562 | let ch3 = -1;
|
16563 | let i = startIndex;
|
16564 | let lastChIndex = i;
|
16565 | while (i < endIndex) {
|
16566 | const ch = text.charCodeAt(i++);
|
16567 | if (ch === 59 ) {
|
16568 | return lastChIndex;
|
16569 | }
|
16570 | else if (ch === 34 || ch === 39 ) {
|
16571 | lastChIndex = i = consumeQuotedText(text, ch, i, endIndex);
|
16572 | }
|
16573 | else if (startIndex ===
|
16574 | i - 4 &&
|
16575 | ch3 === 85 &&
|
16576 | ch2 === 82 && ch1 === 76 && ch === 40 ) {
|
16577 | lastChIndex = i = consumeQuotedText(text, 41 , i, endIndex);
|
16578 | }
|
16579 | else if (ch > 32 ) {
|
16580 |
|
16581 | lastChIndex = i;
|
16582 | }
|
16583 | ch3 = ch2;
|
16584 | ch2 = ch1;
|
16585 | ch1 = ch & -33 ;
|
16586 | }
|
16587 | return lastChIndex;
|
16588 | }
|
16589 |
|
16590 |
|
16591 |
|
16592 |
|
16593 |
|
16594 |
|
16595 |
|
16596 |
|
16597 |
|
16598 | function consumeQuotedText(text, quoteCharCode, startIndex, endIndex) {
|
16599 | let ch1 = -1;
|
16600 | let index = startIndex;
|
16601 | while (index < endIndex) {
|
16602 | const ch = text.charCodeAt(index++);
|
16603 | if (ch == quoteCharCode && ch1 !== 92 ) {
|
16604 | return index;
|
16605 | }
|
16606 | if (ch == 92 && ch1 === 92 ) {
|
16607 |
|
16608 |
|
16609 | ch1 = 0;
|
16610 | }
|
16611 | else {
|
16612 | ch1 = ch;
|
16613 | }
|
16614 | }
|
16615 | throw ngDevMode ? malformedStyleError(text, String.fromCharCode(quoteCharCode), endIndex) :
|
16616 | new Error();
|
16617 | }
|
16618 | function malformedStyleError(text, expecting, index) {
|
16619 | ngDevMode && assertEqual(typeof text === 'string', true, 'String expected here');
|
16620 | throw throwError(`Malformed style at location ${index} in string '` + text.substring(0, index) + '[>>' +
|
16621 | text.substring(index, index + 1) + '<<]' + text.substr(index + 1) +
|
16622 | `'. Expecting '${expecting}'.`);
|
16623 | }
|
16624 |
|
16625 |
|
16626 |
|
16627 |
|
16628 |
|
16629 |
|
16630 |
|
16631 |
|
16632 |
|
16633 |
|
16634 |
|
16635 |
|
16636 |
|
16637 |
|
16638 |
|
16639 |
|
16640 |
|
16641 |
|
16642 |
|
16643 |
|
16644 |
|
16645 |
|
16646 |
|
16647 |
|
16648 |
|
16649 |
|
16650 |
|
16651 | function ɵɵstyleProp(prop, value, suffix) {
|
16652 | checkStylingProperty(prop, value, suffix, false);
|
16653 | return ɵɵstyleProp;
|
16654 | }
|
16655 |
|
16656 |
|
16657 |
|
16658 |
|
16659 |
|
16660 |
|
16661 |
|
16662 |
|
16663 |
|
16664 |
|
16665 |
|
16666 |
|
16667 |
|
16668 |
|
16669 |
|
16670 | function ɵɵclassProp(className, value) {
|
16671 | checkStylingProperty(className, value, null, true);
|
16672 | return ɵɵclassProp;
|
16673 | }
|
16674 |
|
16675 |
|
16676 |
|
16677 |
|
16678 |
|
16679 |
|
16680 |
|
16681 |
|
16682 |
|
16683 |
|
16684 |
|
16685 |
|
16686 |
|
16687 |
|
16688 |
|
16689 |
|
16690 |
|
16691 |
|
16692 |
|
16693 | function ɵɵstyleMap(styles) {
|
16694 | checkStylingMap(styleKeyValueArraySet, styleStringParser, styles, false);
|
16695 | }
|
16696 |
|
16697 |
|
16698 |
|
16699 |
|
16700 |
|
16701 |
|
16702 |
|
16703 |
|
16704 |
|
16705 | function styleStringParser(keyValueArray, text) {
|
16706 | for (let i = parseStyle(text); i >= 0; i = parseStyleNext(text, i)) {
|
16707 | styleKeyValueArraySet(keyValueArray, getLastParsedKey(text), getLastParsedValue(text));
|
16708 | }
|
16709 | }
|
16710 |
|
16711 |
|
16712 |
|
16713 |
|
16714 |
|
16715 |
|
16716 |
|
16717 |
|
16718 |
|
16719 |
|
16720 |
|
16721 |
|
16722 |
|
16723 |
|
16724 |
|
16725 |
|
16726 |
|
16727 |
|
16728 | function ɵɵclassMap(classes) {
|
16729 | checkStylingMap(keyValueArraySet, classStringParser, classes, true);
|
16730 | }
|
16731 |
|
16732 |
|
16733 |
|
16734 |
|
16735 |
|
16736 |
|
16737 |
|
16738 |
|
16739 |
|
16740 | function classStringParser(keyValueArray, text) {
|
16741 | for (let i = parseClassName(text); i >= 0; i = parseClassNameNext(text, i)) {
|
16742 | keyValueArraySet(keyValueArray, getLastParsedKey(text), true);
|
16743 | }
|
16744 | }
|
16745 |
|
16746 |
|
16747 |
|
16748 |
|
16749 |
|
16750 |
|
16751 |
|
16752 |
|
16753 | function checkStylingProperty(prop, value, suffix, isClassBased) {
|
16754 | const lView = getLView();
|
16755 | const tView = getTView();
|
16756 |
|
16757 |
|
16758 |
|
16759 | const bindingIndex = incrementBindingIndex(2);
|
16760 | if (tView.firstUpdatePass) {
|
16761 | stylingFirstUpdatePass(tView, prop, bindingIndex, isClassBased);
|
16762 | }
|
16763 | if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
|
16764 | const tNode = tView.data[getSelectedIndex()];
|
16765 | updateStyling(tView, tNode, lView, lView[RENDERER], prop, lView[bindingIndex + 1] = normalizeSuffix(value, suffix), isClassBased, bindingIndex);
|
16766 | }
|
16767 | }
|
16768 |
|
16769 |
|
16770 |
|
16771 |
|
16772 |
|
16773 |
|
16774 |
|
16775 |
|
16776 |
|
16777 |
|
16778 | function checkStylingMap(keyValueArraySet, stringParser, value, isClassBased) {
|
16779 | const tView = getTView();
|
16780 | const bindingIndex = incrementBindingIndex(2);
|
16781 | if (tView.firstUpdatePass) {
|
16782 | stylingFirstUpdatePass(tView, null, bindingIndex, isClassBased);
|
16783 | }
|
16784 | const lView = getLView();
|
16785 | if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
|
16786 |
|
16787 |
|
16788 | const tNode = tView.data[getSelectedIndex()];
|
16789 | if (hasStylingInputShadow(tNode, isClassBased) && !isInHostBindings(tView, bindingIndex)) {
|
16790 | if (ngDevMode) {
|
16791 |
|
16792 |
|
16793 | const tStylingKey = tView.data[bindingIndex];
|
16794 | assertEqual(Array.isArray(tStylingKey) ? tStylingKey[1] : tStylingKey, false, 'Styling linked list shadow input should be marked as \'false\'');
|
16795 | }
|
16796 |
|
16797 |
|
16798 |
|
16799 |
|
16800 |
|
16801 |
|
16802 |
|
16803 | let staticPrefix = isClassBased ? tNode.classesWithoutHost : tNode.stylesWithoutHost;
|
16804 | ngDevMode && isClassBased === false && staticPrefix !== null &&
|
16805 | assertEqual(staticPrefix.endsWith(';'), true, 'Expecting static portion to end with \';\'');
|
16806 | if (staticPrefix !== null) {
|
16807 |
|
16808 | value = concatStringsWithSpace(staticPrefix, value ? value : '');
|
16809 | }
|
16810 |
|
16811 |
|
16812 | setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased);
|
16813 | }
|
16814 | else {
|
16815 | updateStylingMap(tView, tNode, lView, lView[RENDERER], lView[bindingIndex + 1], lView[bindingIndex + 1] = toStylingKeyValueArray(keyValueArraySet, stringParser, value), isClassBased, bindingIndex);
|
16816 | }
|
16817 | }
|
16818 | }
|
16819 |
|
16820 |
|
16821 |
|
16822 |
|
16823 |
|
16824 |
|
16825 | function isInHostBindings(tView, bindingIndex) {
|
16826 |
|
16827 | return bindingIndex >= tView.expandoStartIndex;
|
16828 | }
|
16829 |
|
16830 |
|
16831 |
|
16832 |
|
16833 |
|
16834 |
|
16835 |
|
16836 |
|
16837 |
|
16838 | function stylingFirstUpdatePass(tView, tStylingKey, bindingIndex, isClassBased) {
|
16839 | ngDevMode && assertFirstUpdatePass(tView);
|
16840 | const tData = tView.data;
|
16841 | if (tData[bindingIndex + 1] === null) {
|
16842 |
|
16843 |
|
16844 |
|
16845 |
|
16846 |
|
16847 | const tNode = tData[getSelectedIndex()];
|
16848 | ngDevMode && assertDefined(tNode, 'TNode expected');
|
16849 | const isHostBindings = isInHostBindings(tView, bindingIndex);
|
16850 | if (hasStylingInputShadow(tNode, isClassBased) && tStylingKey === null && !isHostBindings) {
|
16851 |
|
16852 |
|
16853 |
|
16854 |
|
16855 | tStylingKey = false;
|
16856 | }
|
16857 | tStylingKey = wrapInStaticStylingKey(tData, tNode, tStylingKey, isClassBased);
|
16858 | insertTStylingBinding(tData, tNode, tStylingKey, bindingIndex, isHostBindings, isClassBased);
|
16859 | }
|
16860 | }
|
16861 |
|
16862 |
|
16863 |
|
16864 |
|
16865 |
|
16866 |
|
16867 |
|
16868 |
|
16869 |
|
16870 |
|
16871 |
|
16872 |
|
16873 |
|
16874 |
|
16875 | function wrapInStaticStylingKey(tData, tNode, stylingKey, isClassBased) {
|
16876 | const hostDirectiveDef = getCurrentDirectiveDef(tData);
|
16877 | let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
|
16878 | if (hostDirectiveDef === null) {
|
16879 |
|
16880 |
|
16881 |
|
16882 |
|
16883 | const isFirstStylingInstructionInTemplate = (isClassBased ? tNode.classBindings : tNode.styleBindings) === 0;
|
16884 | if (isFirstStylingInstructionInTemplate) {
|
16885 |
|
16886 |
|
16887 |
|
16888 | stylingKey = collectStylingFromDirectives(null, tData, tNode, stylingKey, isClassBased);
|
16889 | stylingKey = collectStylingFromTAttrs(stylingKey, tNode.attrs, isClassBased);
|
16890 |
|
16891 | residual = null;
|
16892 | }
|
16893 | }
|
16894 | else {
|
16895 |
|
16896 |
|
16897 | const directiveStylingLast = tNode.directiveStylingLast;
|
16898 | const isFirstStylingInstructionInHostBinding = directiveStylingLast === -1 || tData[directiveStylingLast] !== hostDirectiveDef;
|
16899 | if (isFirstStylingInstructionInHostBinding) {
|
16900 | stylingKey =
|
16901 | collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased);
|
16902 | if (residual === null) {
|
16903 |
|
16904 |
|
16905 |
|
16906 |
|
16907 |
|
16908 |
|
16909 | let templateStylingKey = getTemplateHeadTStylingKey(tData, tNode, isClassBased);
|
16910 | if (templateStylingKey !== undefined && Array.isArray(templateStylingKey)) {
|
16911 |
|
16912 |
|
16913 |
|
16914 | templateStylingKey = collectStylingFromDirectives(null, tData, tNode, templateStylingKey[1] , isClassBased);
|
16915 | templateStylingKey =
|
16916 | collectStylingFromTAttrs(templateStylingKey, tNode.attrs, isClassBased);
|
16917 | setTemplateHeadTStylingKey(tData, tNode, isClassBased, templateStylingKey);
|
16918 | }
|
16919 | }
|
16920 | else {
|
16921 |
|
16922 |
|
16923 |
|
16924 |
|
16925 |
|
16926 | residual = collectResidual(tData, tNode, isClassBased);
|
16927 | }
|
16928 | }
|
16929 | }
|
16930 | if (residual !== undefined) {
|
16931 | isClassBased ? (tNode.residualClasses = residual) : (tNode.residualStyles = residual);
|
16932 | }
|
16933 | return stylingKey;
|
16934 | }
|
16935 |
|
16936 |
|
16937 |
|
16938 |
|
16939 |
|
16940 |
|
16941 |
|
16942 |
|
16943 |
|
16944 |
|
16945 |
|
16946 |
|
16947 |
|
16948 | function getTemplateHeadTStylingKey(tData, tNode, isClassBased) {
|
16949 | const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
|
16950 | if (getTStylingRangeNext(bindings) === 0) {
|
16951 |
|
16952 | return undefined;
|
16953 | }
|
16954 | return tData[getTStylingRangePrev(bindings)];
|
16955 | }
|
16956 |
|
16957 |
|
16958 |
|
16959 |
|
16960 |
|
16961 |
|
16962 |
|
16963 |
|
16964 |
|
16965 |
|
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 |
|
17002 |
|
17003 |
|
17004 |
|
17005 |
|
17006 |
|
17007 |
|
17008 | function setTemplateHeadTStylingKey(tData, tNode, isClassBased, tStylingKey) {
|
17009 | const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
|
17010 | ngDevMode &&
|
17011 | assertNotEqual(getTStylingRangeNext(bindings), 0, 'Expecting to have at least one template styling binding.');
|
17012 | tData[getTStylingRangePrev(bindings)] = tStylingKey;
|
17013 | }
|
17014 |
|
17015 |
|
17016 |
|
17017 |
|
17018 |
|
17019 |
|
17020 |
|
17021 |
|
17022 |
|
17023 |
|
17024 | function collectResidual(tData, tNode, isClassBased) {
|
17025 | let residual = undefined;
|
17026 | const directiveEnd = tNode.directiveEnd;
|
17027 | ngDevMode &&
|
17028 | assertNotEqual(tNode.directiveStylingLast, -1, 'By the time this function gets called at least one hostBindings-node styling instruction must have executed.');
|
17029 |
|
17030 |
|
17031 | for (let i = 1 + tNode.directiveStylingLast; i < directiveEnd; i++) {
|
17032 | const attrs = tData[i].hostAttrs;
|
17033 | residual = collectStylingFromTAttrs(residual, attrs, isClassBased);
|
17034 | }
|
17035 | return collectStylingFromTAttrs(residual, tNode.attrs, isClassBased);
|
17036 | }
|
17037 |
|
17038 |
|
17039 |
|
17040 |
|
17041 |
|
17042 |
|
17043 |
|
17044 |
|
17045 |
|
17046 |
|
17047 |
|
17048 |
|
17049 | function collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased) {
|
17050 |
|
17051 |
|
17052 | let currentDirective = null;
|
17053 | const directiveEnd = tNode.directiveEnd;
|
17054 | let directiveStylingLast = tNode.directiveStylingLast;
|
17055 | if (directiveStylingLast === -1) {
|
17056 | directiveStylingLast = tNode.directiveStart;
|
17057 | }
|
17058 | else {
|
17059 | directiveStylingLast++;
|
17060 | }
|
17061 | while (directiveStylingLast < directiveEnd) {
|
17062 | currentDirective = tData[directiveStylingLast];
|
17063 | ngDevMode && assertDefined(currentDirective, 'expected to be defined');
|
17064 | stylingKey = collectStylingFromTAttrs(stylingKey, currentDirective.hostAttrs, isClassBased);
|
17065 | if (currentDirective === hostDirectiveDef)
|
17066 | break;
|
17067 | directiveStylingLast++;
|
17068 | }
|
17069 | if (hostDirectiveDef !== null) {
|
17070 |
|
17071 |
|
17072 |
|
17073 | tNode.directiveStylingLast = directiveStylingLast;
|
17074 | }
|
17075 | return stylingKey;
|
17076 | }
|
17077 |
|
17078 |
|
17079 |
|
17080 |
|
17081 |
|
17082 |
|
17083 |
|
17084 | function collectStylingFromTAttrs(stylingKey, attrs, isClassBased) {
|
17085 | const desiredMarker = isClassBased ? 1 : 2 ;
|
17086 | let currentMarker = -1 ;
|
17087 | if (attrs !== null) {
|
17088 | for (let i = 0; i < attrs.length; i++) {
|
17089 | const item = attrs[i];
|
17090 | if (typeof item === 'number') {
|
17091 | currentMarker = item;
|
17092 | }
|
17093 | else {
|
17094 | if (currentMarker === desiredMarker) {
|
17095 | if (!Array.isArray(stylingKey)) {
|
17096 | stylingKey = stylingKey === undefined ? [] : ['', stylingKey];
|
17097 | }
|
17098 | keyValueArraySet(stylingKey, item, isClassBased ? true : attrs[++i]);
|
17099 | }
|
17100 | }
|
17101 | }
|
17102 | }
|
17103 | return stylingKey === undefined ? null : stylingKey;
|
17104 | }
|
17105 |
|
17106 |
|
17107 |
|
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 |
|
17133 | function toStylingKeyValueArray(keyValueArraySet, stringParser, value) {
|
17134 | if (value == null || value === '')
|
17135 | return EMPTY_ARRAY;
|
17136 | const styleKeyValueArray = [];
|
17137 | const unwrappedValue = unwrapSafeValue(value);
|
17138 | if (Array.isArray(unwrappedValue)) {
|
17139 | for (let i = 0; i < unwrappedValue.length; i++) {
|
17140 | keyValueArraySet(styleKeyValueArray, unwrappedValue[i], true);
|
17141 | }
|
17142 | }
|
17143 | else if (typeof unwrappedValue === 'object') {
|
17144 | for (const key in unwrappedValue) {
|
17145 | if (unwrappedValue.hasOwnProperty(key)) {
|
17146 | keyValueArraySet(styleKeyValueArray, key, unwrappedValue[key]);
|
17147 | }
|
17148 | }
|
17149 | }
|
17150 | else if (typeof unwrappedValue === 'string') {
|
17151 | stringParser(styleKeyValueArray, unwrappedValue);
|
17152 | }
|
17153 | else {
|
17154 | ngDevMode &&
|
17155 | throwError('Unsupported styling type ' + typeof unwrappedValue + ': ' + unwrappedValue);
|
17156 | }
|
17157 | return styleKeyValueArray;
|
17158 | }
|
17159 |
|
17160 |
|
17161 |
|
17162 |
|
17163 |
|
17164 |
|
17165 |
|
17166 |
|
17167 |
|
17168 | function styleKeyValueArraySet(keyValueArray, key, value) {
|
17169 | keyValueArraySet(keyValueArray, key, unwrapSafeValue(value));
|
17170 | }
|
17171 |
|
17172 |
|
17173 |
|
17174 |
|
17175 |
|
17176 |
|
17177 |
|
17178 |
|
17179 |
|
17180 |
|
17181 |
|
17182 |
|
17183 |
|
17184 |
|
17185 |
|
17186 |
|
17187 |
|
17188 |
|
17189 | function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {
|
17190 | if (oldKeyValueArray === NO_CHANGE) {
|
17191 |
|
17192 | oldKeyValueArray = EMPTY_ARRAY;
|
17193 | }
|
17194 | let oldIndex = 0;
|
17195 | let newIndex = 0;
|
17196 | let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;
|
17197 | let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;
|
17198 | while (oldKey !== null || newKey !== null) {
|
17199 | ngDevMode && assertLessThan(oldIndex, 999, 'Are we stuck in infinite loop?');
|
17200 | ngDevMode && assertLessThan(newIndex, 999, 'Are we stuck in infinite loop?');
|
17201 | const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : undefined;
|
17202 | const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : undefined;
|
17203 | let setKey = null;
|
17204 | let setValue = undefined;
|
17205 | if (oldKey === newKey) {
|
17206 |
|
17207 | oldIndex += 2;
|
17208 | newIndex += 2;
|
17209 | if (oldValue !== newValue) {
|
17210 | setKey = newKey;
|
17211 | setValue = newValue;
|
17212 | }
|
17213 | }
|
17214 | else if (newKey === null || oldKey !== null && oldKey < newKey) {
|
17215 |
|
17216 |
|
17217 |
|
17218 |
|
17219 | oldIndex += 2;
|
17220 | setKey = oldKey;
|
17221 | }
|
17222 | else {
|
17223 |
|
17224 |
|
17225 |
|
17226 | ngDevMode && assertDefined(newKey, 'Expecting to have a valid key');
|
17227 | newIndex += 2;
|
17228 | setKey = newKey;
|
17229 | setValue = newValue;
|
17230 | }
|
17231 | if (setKey !== null) {
|
17232 | updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);
|
17233 | }
|
17234 | oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;
|
17235 | newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;
|
17236 | }
|
17237 | }
|
17238 |
|
17239 |
|
17240 |
|
17241 |
|
17242 |
|
17243 |
|
17244 |
|
17245 |
|
17246 |
|
17247 |
|
17248 |
|
17249 |
|
17250 |
|
17251 |
|
17252 |
|
17253 |
|
17254 |
|
17255 | function updateStyling(tView, tNode, lView, renderer, prop, value, isClassBased, bindingIndex) {
|
17256 | if (!(tNode.type & 3 )) {
|
17257 |
|
17258 |
|
17259 | return;
|
17260 | }
|
17261 | const tData = tView.data;
|
17262 | const tRange = tData[bindingIndex + 1];
|
17263 | const higherPriorityValue = getTStylingRangeNextDuplicate(tRange) ?
|
17264 | findStylingValue(tData, tNode, lView, prop, getTStylingRangeNext(tRange), isClassBased) :
|
17265 | undefined;
|
17266 | if (!isStylingValuePresent(higherPriorityValue)) {
|
17267 |
|
17268 | if (!isStylingValuePresent(value)) {
|
17269 |
|
17270 | if (getTStylingRangePrevDuplicate(tRange)) {
|
17271 |
|
17272 | value = findStylingValue(tData, null, lView, prop, bindingIndex, isClassBased);
|
17273 | }
|
17274 | }
|
17275 | const rNode = getNativeByIndex(getSelectedIndex(), lView);
|
17276 | applyStyling(renderer, isClassBased, rNode, prop, value);
|
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 | function findStylingValue(tData, tNode, lView, prop, index, isClassBased) {
|
17308 |
|
17309 |
|
17310 |
|
17311 |
|
17312 |
|
17313 | const isPrevDirection = tNode === null;
|
17314 | let value = undefined;
|
17315 | while (index > 0) {
|
17316 | const rawKey = tData[index];
|
17317 | const containsStatics = Array.isArray(rawKey);
|
17318 |
|
17319 | const key = containsStatics ? rawKey[1] : rawKey;
|
17320 | const isStylingMap = key === null;
|
17321 | let valueAtLViewIndex = lView[index + 1];
|
17322 | if (valueAtLViewIndex === NO_CHANGE) {
|
17323 |
|
17324 |
|
17325 |
|
17326 |
|
17327 |
|
17328 |
|
17329 |
|
17330 | valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY : undefined;
|
17331 | }
|
17332 | let currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) :
|
17333 | key === prop ? valueAtLViewIndex : undefined;
|
17334 | if (containsStatics && !isStylingValuePresent(currentValue)) {
|
17335 | currentValue = keyValueArrayGet(rawKey, prop);
|
17336 | }
|
17337 | if (isStylingValuePresent(currentValue)) {
|
17338 | value = currentValue;
|
17339 | if (isPrevDirection) {
|
17340 | return value;
|
17341 | }
|
17342 | }
|
17343 | const tRange = tData[index + 1];
|
17344 | index = isPrevDirection ? getTStylingRangePrev(tRange) : getTStylingRangeNext(tRange);
|
17345 | }
|
17346 | if (tNode !== null) {
|
17347 |
|
17348 |
|
17349 | let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
|
17350 | if (residual != null ) {
|
17351 | value = keyValueArrayGet(residual, prop);
|
17352 | }
|
17353 | }
|
17354 | return value;
|
17355 | }
|
17356 |
|
17357 |
|
17358 |
|
17359 |
|
17360 |
|
17361 |
|
17362 | function isStylingValuePresent(value) {
|
17363 |
|
17364 |
|
17365 |
|
17366 |
|
17367 | return value !== undefined;
|
17368 | }
|
17369 |
|
17370 |
|
17371 |
|
17372 |
|
17373 |
|
17374 |
|
17375 |
|
17376 | function normalizeSuffix(value, suffix) {
|
17377 | if (value == null ) {
|
17378 |
|
17379 | }
|
17380 | else if (typeof suffix === 'string') {
|
17381 | value = value + suffix;
|
17382 | }
|
17383 | else if (typeof value === 'object') {
|
17384 | value = stringify(unwrapSafeValue(value));
|
17385 | }
|
17386 | return value;
|
17387 | }
|
17388 |
|
17389 |
|
17390 |
|
17391 |
|
17392 |
|
17393 |
|
17394 |
|
17395 |
|
17396 |
|
17397 | function hasStylingInputShadow(tNode, isClassBased) {
|
17398 | return (tNode.flags & (isClassBased ? 16 : 32 )) !== 0;
|
17399 | }
|
17400 |
|
17401 |
|
17402 |
|
17403 |
|
17404 |
|
17405 |
|
17406 |
|
17407 |
|
17408 |
|
17409 |
|
17410 |
|
17411 |
|
17412 |
|
17413 |
|
17414 |
|
17415 |
|
17416 | function ɵɵtext(index, value = '') {
|
17417 | const lView = getLView();
|
17418 | const tView = getTView();
|
17419 | const adjustedIndex = index + HEADER_OFFSET;
|
17420 | ngDevMode &&
|
17421 | assertEqual(getBindingIndex(), tView.bindingStartIndex, 'text nodes should be created before any bindings');
|
17422 | ngDevMode && assertIndexInRange(lView, adjustedIndex);
|
17423 | const tNode = tView.firstCreatePass ?
|
17424 | getOrCreateTNode(tView, adjustedIndex, 1 , value, null) :
|
17425 | tView.data[adjustedIndex];
|
17426 | const textNative = lView[adjustedIndex] = createTextNode(lView[RENDERER], value);
|
17427 | appendChild(tView, lView, textNative, tNode);
|
17428 |
|
17429 | setCurrentTNode(tNode, false);
|
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 |
|
17457 |
|
17458 |
|
17459 | function ɵɵtextInterpolate(v0) {
|
17460 | ɵɵtextInterpolate1('', v0, '');
|
17461 | return ɵɵtextInterpolate;
|
17462 | }
|
17463 |
|
17464 |
|
17465 |
|
17466 |
|
17467 |
|
17468 |
|
17469 |
|
17470 |
|
17471 |
|
17472 |
|
17473 |
|
17474 |
|
17475 |
|
17476 |
|
17477 |
|
17478 |
|
17479 |
|
17480 |
|
17481 |
|
17482 | function ɵɵtextInterpolate1(prefix, v0, suffix) {
|
17483 | const lView = getLView();
|
17484 | const interpolated = interpolation1(lView, prefix, v0, suffix);
|
17485 | if (interpolated !== NO_CHANGE) {
|
17486 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
17487 | }
|
17488 | return ɵɵtextInterpolate1;
|
17489 | }
|
17490 |
|
17491 |
|
17492 |
|
17493 |
|
17494 |
|
17495 |
|
17496 |
|
17497 |
|
17498 |
|
17499 |
|
17500 |
|
17501 |
|
17502 |
|
17503 |
|
17504 |
|
17505 |
|
17506 |
|
17507 |
|
17508 |
|
17509 | function ɵɵtextInterpolate2(prefix, v0, i0, v1, suffix) {
|
17510 | const lView = getLView();
|
17511 | const interpolated = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
17512 | if (interpolated !== NO_CHANGE) {
|
17513 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
17514 | }
|
17515 | return ɵɵtextInterpolate2;
|
17516 | }
|
17517 |
|
17518 |
|
17519 |
|
17520 |
|
17521 |
|
17522 |
|
17523 |
|
17524 |
|
17525 |
|
17526 |
|
17527 |
|
17528 |
|
17529 |
|
17530 |
|
17531 |
|
17532 |
|
17533 |
|
17534 |
|
17535 |
|
17536 |
|
17537 | function ɵɵtextInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
|
17538 | const lView = getLView();
|
17539 | const interpolated = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
17540 | if (interpolated !== NO_CHANGE) {
|
17541 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
17542 | }
|
17543 | return ɵɵtextInterpolate3;
|
17544 | }
|
17545 |
|
17546 |
|
17547 |
|
17548 |
|
17549 |
|
17550 |
|
17551 |
|
17552 |
|
17553 |
|
17554 |
|
17555 |
|
17556 |
|
17557 |
|
17558 |
|
17559 |
|
17560 |
|
17561 |
|
17562 |
|
17563 |
|
17564 |
|
17565 | function ɵɵtextInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
|
17566 | const lView = getLView();
|
17567 | const interpolated = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
17568 | if (interpolated !== NO_CHANGE) {
|
17569 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
17570 | }
|
17571 | return ɵɵtextInterpolate4;
|
17572 | }
|
17573 |
|
17574 |
|
17575 |
|
17576 |
|
17577 |
|
17578 |
|
17579 |
|
17580 |
|
17581 |
|
17582 |
|
17583 |
|
17584 |
|
17585 |
|
17586 |
|
17587 |
|
17588 |
|
17589 |
|
17590 |
|
17591 |
|
17592 |
|
17593 | function ɵɵtextInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
|
17594 | const lView = getLView();
|
17595 | const interpolated = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
17596 | if (interpolated !== NO_CHANGE) {
|
17597 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
17598 | }
|
17599 | return ɵɵtextInterpolate5;
|
17600 | }
|
17601 |
|
17602 |
|
17603 |
|
17604 |
|
17605 |
|
17606 |
|
17607 |
|
17608 |
|
17609 |
|
17610 |
|
17611 |
|
17612 |
|
17613 |
|
17614 |
|
17615 |
|
17616 |
|
17617 |
|
17618 |
|
17619 |
|
17620 |
|
17621 |
|
17622 |
|
17623 | function ɵɵtextInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
|
17624 | const lView = getLView();
|
17625 | const interpolated = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
17626 | if (interpolated !== NO_CHANGE) {
|
17627 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
17628 | }
|
17629 | return ɵɵtextInterpolate6;
|
17630 | }
|
17631 |
|
17632 |
|
17633 |
|
17634 |
|
17635 |
|
17636 |
|
17637 |
|
17638 |
|
17639 |
|
17640 |
|
17641 |
|
17642 |
|
17643 |
|
17644 |
|
17645 |
|
17646 |
|
17647 |
|
17648 |
|
17649 |
|
17650 |
|
17651 | function ɵɵtextInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
|
17652 | const lView = getLView();
|
17653 | const interpolated = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
17654 | if (interpolated !== NO_CHANGE) {
|
17655 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
17656 | }
|
17657 | return ɵɵtextInterpolate7;
|
17658 | }
|
17659 |
|
17660 |
|
17661 |
|
17662 |
|
17663 |
|
17664 |
|
17665 |
|
17666 |
|
17667 |
|
17668 |
|
17669 |
|
17670 |
|
17671 |
|
17672 |
|
17673 |
|
17674 |
|
17675 |
|
17676 |
|
17677 |
|
17678 |
|
17679 | function ɵɵtextInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
|
17680 | const lView = getLView();
|
17681 | const interpolated = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
17682 | if (interpolated !== NO_CHANGE) {
|
17683 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
17684 | }
|
17685 | return ɵɵtextInterpolate8;
|
17686 | }
|
17687 |
|
17688 |
|
17689 |
|
17690 |
|
17691 |
|
17692 |
|
17693 |
|
17694 |
|
17695 |
|
17696 |
|
17697 |
|
17698 |
|
17699 |
|
17700 |
|
17701 |
|
17702 |
|
17703 |
|
17704 |
|
17705 |
|
17706 |
|
17707 |
|
17708 |
|
17709 |
|
17710 |
|
17711 | function ɵɵtextInterpolateV(values) {
|
17712 | const lView = getLView();
|
17713 | const interpolated = interpolationV(lView, values);
|
17714 | if (interpolated !== NO_CHANGE) {
|
17715 | textBindingInternal(lView, getSelectedIndex(), interpolated);
|
17716 | }
|
17717 | return ɵɵtextInterpolateV;
|
17718 | }
|
17719 |
|
17720 |
|
17721 |
|
17722 |
|
17723 |
|
17724 |
|
17725 |
|
17726 |
|
17727 |
|
17728 |
|
17729 |
|
17730 |
|
17731 |
|
17732 |
|
17733 |
|
17734 |
|
17735 |
|
17736 |
|
17737 |
|
17738 |
|
17739 |
|
17740 |
|
17741 |
|
17742 |
|
17743 |
|
17744 |
|
17745 |
|
17746 |
|
17747 |
|
17748 | function ɵɵclassMapInterpolate1(prefix, v0, suffix) {
|
17749 | const lView = getLView();
|
17750 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
17751 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17752 | }
|
17753 |
|
17754 |
|
17755 |
|
17756 |
|
17757 |
|
17758 |
|
17759 |
|
17760 |
|
17761 |
|
17762 |
|
17763 |
|
17764 |
|
17765 |
|
17766 |
|
17767 |
|
17768 |
|
17769 |
|
17770 |
|
17771 |
|
17772 |
|
17773 |
|
17774 |
|
17775 |
|
17776 | function ɵɵclassMapInterpolate2(prefix, v0, i0, v1, suffix) {
|
17777 | const lView = getLView();
|
17778 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
17779 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17780 | }
|
17781 |
|
17782 |
|
17783 |
|
17784 |
|
17785 |
|
17786 |
|
17787 |
|
17788 |
|
17789 |
|
17790 |
|
17791 |
|
17792 |
|
17793 |
|
17794 |
|
17795 |
|
17796 |
|
17797 |
|
17798 |
|
17799 |
|
17800 |
|
17801 |
|
17802 |
|
17803 |
|
17804 |
|
17805 |
|
17806 |
|
17807 | function ɵɵclassMapInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
|
17808 | const lView = getLView();
|
17809 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
17810 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17811 | }
|
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 | function ɵɵclassMapInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
|
17841 | const lView = getLView();
|
17842 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
17843 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17844 | }
|
17845 |
|
17846 |
|
17847 |
|
17848 |
|
17849 |
|
17850 |
|
17851 |
|
17852 |
|
17853 |
|
17854 |
|
17855 |
|
17856 |
|
17857 |
|
17858 |
|
17859 |
|
17860 |
|
17861 |
|
17862 |
|
17863 |
|
17864 |
|
17865 |
|
17866 |
|
17867 |
|
17868 |
|
17869 |
|
17870 |
|
17871 |
|
17872 |
|
17873 |
|
17874 |
|
17875 | function ɵɵclassMapInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
|
17876 | const lView = getLView();
|
17877 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
17878 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17879 | }
|
17880 |
|
17881 |
|
17882 |
|
17883 |
|
17884 |
|
17885 |
|
17886 |
|
17887 |
|
17888 |
|
17889 |
|
17890 |
|
17891 |
|
17892 |
|
17893 |
|
17894 |
|
17895 |
|
17896 |
|
17897 |
|
17898 |
|
17899 |
|
17900 |
|
17901 |
|
17902 |
|
17903 |
|
17904 |
|
17905 |
|
17906 |
|
17907 |
|
17908 |
|
17909 |
|
17910 |
|
17911 |
|
17912 | function ɵɵclassMapInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
|
17913 | const lView = getLView();
|
17914 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
17915 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17916 | }
|
17917 |
|
17918 |
|
17919 |
|
17920 |
|
17921 |
|
17922 |
|
17923 |
|
17924 |
|
17925 |
|
17926 |
|
17927 |
|
17928 |
|
17929 |
|
17930 |
|
17931 |
|
17932 |
|
17933 |
|
17934 |
|
17935 |
|
17936 |
|
17937 |
|
17938 |
|
17939 |
|
17940 |
|
17941 |
|
17942 |
|
17943 |
|
17944 |
|
17945 |
|
17946 |
|
17947 |
|
17948 |
|
17949 |
|
17950 |
|
17951 | function ɵɵclassMapInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
|
17952 | const lView = getLView();
|
17953 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
17954 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17955 | }
|
17956 |
|
17957 |
|
17958 |
|
17959 |
|
17960 |
|
17961 |
|
17962 |
|
17963 |
|
17964 |
|
17965 |
|
17966 |
|
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 |
|
17992 | function ɵɵclassMapInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
|
17993 | const lView = getLView();
|
17994 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
17995 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
17996 | }
|
17997 |
|
17998 |
|
17999 |
|
18000 |
|
18001 |
|
18002 |
|
18003 |
|
18004 |
|
18005 |
|
18006 |
|
18007 |
|
18008 |
|
18009 |
|
18010 |
|
18011 |
|
18012 |
|
18013 |
|
18014 |
|
18015 |
|
18016 |
|
18017 |
|
18018 |
|
18019 |
|
18020 | function ɵɵclassMapInterpolateV(values) {
|
18021 | const lView = getLView();
|
18022 | const interpolatedValue = interpolationV(lView, values);
|
18023 | checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
|
18024 | }
|
18025 |
|
18026 |
|
18027 |
|
18028 |
|
18029 |
|
18030 |
|
18031 |
|
18032 |
|
18033 |
|
18034 |
|
18035 |
|
18036 |
|
18037 |
|
18038 |
|
18039 |
|
18040 |
|
18041 |
|
18042 |
|
18043 |
|
18044 |
|
18045 |
|
18046 |
|
18047 |
|
18048 |
|
18049 |
|
18050 |
|
18051 |
|
18052 |
|
18053 |
|
18054 | function ɵɵstyleMapInterpolate1(prefix, v0, suffix) {
|
18055 | const lView = getLView();
|
18056 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
18057 | ɵɵstyleMap(interpolatedValue);
|
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 | function ɵɵstyleMapInterpolate2(prefix, v0, i0, v1, suffix) {
|
18083 | const lView = getLView();
|
18084 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
18085 | ɵɵstyleMap(interpolatedValue);
|
18086 | }
|
18087 |
|
18088 |
|
18089 |
|
18090 |
|
18091 |
|
18092 |
|
18093 |
|
18094 |
|
18095 |
|
18096 |
|
18097 |
|
18098 |
|
18099 |
|
18100 |
|
18101 |
|
18102 |
|
18103 |
|
18104 |
|
18105 |
|
18106 |
|
18107 |
|
18108 |
|
18109 |
|
18110 |
|
18111 |
|
18112 |
|
18113 | function ɵɵstyleMapInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
|
18114 | const lView = getLView();
|
18115 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
18116 | ɵɵstyleMap(interpolatedValue);
|
18117 | }
|
18118 |
|
18119 |
|
18120 |
|
18121 |
|
18122 |
|
18123 |
|
18124 |
|
18125 |
|
18126 |
|
18127 |
|
18128 |
|
18129 |
|
18130 |
|
18131 |
|
18132 |
|
18133 |
|
18134 |
|
18135 |
|
18136 |
|
18137 |
|
18138 |
|
18139 |
|
18140 |
|
18141 |
|
18142 |
|
18143 |
|
18144 |
|
18145 |
|
18146 | function ɵɵstyleMapInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
|
18147 | const lView = getLView();
|
18148 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
18149 | ɵɵstyleMap(interpolatedValue);
|
18150 | }
|
18151 |
|
18152 |
|
18153 |
|
18154 |
|
18155 |
|
18156 |
|
18157 |
|
18158 |
|
18159 |
|
18160 |
|
18161 |
|
18162 |
|
18163 |
|
18164 |
|
18165 |
|
18166 |
|
18167 |
|
18168 |
|
18169 |
|
18170 |
|
18171 |
|
18172 |
|
18173 |
|
18174 |
|
18175 |
|
18176 |
|
18177 |
|
18178 |
|
18179 |
|
18180 |
|
18181 | function ɵɵstyleMapInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
|
18182 | const lView = getLView();
|
18183 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
18184 | ɵɵstyleMap(interpolatedValue);
|
18185 | }
|
18186 |
|
18187 |
|
18188 |
|
18189 |
|
18190 |
|
18191 |
|
18192 |
|
18193 |
|
18194 |
|
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 |
|
18220 | function ɵɵstyleMapInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
|
18221 | const lView = getLView();
|
18222 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
18223 | ɵɵstyleMap(interpolatedValue);
|
18224 | }
|
18225 |
|
18226 |
|
18227 |
|
18228 |
|
18229 |
|
18230 |
|
18231 |
|
18232 |
|
18233 |
|
18234 |
|
18235 |
|
18236 |
|
18237 |
|
18238 |
|
18239 |
|
18240 |
|
18241 |
|
18242 |
|
18243 |
|
18244 |
|
18245 |
|
18246 |
|
18247 |
|
18248 |
|
18249 |
|
18250 |
|
18251 |
|
18252 |
|
18253 |
|
18254 |
|
18255 |
|
18256 |
|
18257 |
|
18258 |
|
18259 |
|
18260 |
|
18261 | function ɵɵstyleMapInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
|
18262 | const lView = getLView();
|
18263 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
18264 | ɵɵstyleMap(interpolatedValue);
|
18265 | }
|
18266 |
|
18267 |
|
18268 |
|
18269 |
|
18270 |
|
18271 |
|
18272 |
|
18273 |
|
18274 |
|
18275 |
|
18276 |
|
18277 |
|
18278 |
|
18279 |
|
18280 |
|
18281 |
|
18282 |
|
18283 |
|
18284 |
|
18285 |
|
18286 |
|
18287 |
|
18288 |
|
18289 |
|
18290 |
|
18291 |
|
18292 |
|
18293 |
|
18294 |
|
18295 |
|
18296 |
|
18297 |
|
18298 |
|
18299 |
|
18300 |
|
18301 |
|
18302 |
|
18303 |
|
18304 | function ɵɵstyleMapInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
|
18305 | const lView = getLView();
|
18306 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
18307 | ɵɵstyleMap(interpolatedValue);
|
18308 | }
|
18309 |
|
18310 |
|
18311 |
|
18312 |
|
18313 |
|
18314 |
|
18315 |
|
18316 |
|
18317 |
|
18318 |
|
18319 |
|
18320 |
|
18321 |
|
18322 |
|
18323 |
|
18324 |
|
18325 |
|
18326 |
|
18327 |
|
18328 |
|
18329 |
|
18330 |
|
18331 |
|
18332 |
|
18333 | function ɵɵstyleMapInterpolateV(values) {
|
18334 | const lView = getLView();
|
18335 | const interpolatedValue = interpolationV(lView, values);
|
18336 | ɵɵstyleMap(interpolatedValue);
|
18337 | }
|
18338 |
|
18339 |
|
18340 |
|
18341 |
|
18342 |
|
18343 |
|
18344 |
|
18345 |
|
18346 |
|
18347 |
|
18348 |
|
18349 |
|
18350 |
|
18351 |
|
18352 |
|
18353 |
|
18354 |
|
18355 |
|
18356 |
|
18357 |
|
18358 |
|
18359 |
|
18360 |
|
18361 |
|
18362 |
|
18363 |
|
18364 |
|
18365 |
|
18366 |
|
18367 |
|
18368 |
|
18369 |
|
18370 |
|
18371 |
|
18372 | function ɵɵstylePropInterpolate1(prop, prefix, v0, suffix, valueSuffix) {
|
18373 | const lView = getLView();
|
18374 | const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
|
18375 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
18376 | return ɵɵstylePropInterpolate1;
|
18377 | }
|
18378 |
|
18379 |
|
18380 |
|
18381 |
|
18382 |
|
18383 |
|
18384 |
|
18385 |
|
18386 |
|
18387 |
|
18388 |
|
18389 |
|
18390 |
|
18391 |
|
18392 |
|
18393 |
|
18394 |
|
18395 |
|
18396 |
|
18397 |
|
18398 |
|
18399 |
|
18400 |
|
18401 |
|
18402 |
|
18403 |
|
18404 |
|
18405 |
|
18406 | function ɵɵstylePropInterpolate2(prop, prefix, v0, i0, v1, suffix, valueSuffix) {
|
18407 | const lView = getLView();
|
18408 | const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
|
18409 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
18410 | return ɵɵstylePropInterpolate2;
|
18411 | }
|
18412 |
|
18413 |
|
18414 |
|
18415 |
|
18416 |
|
18417 |
|
18418 |
|
18419 |
|
18420 |
|
18421 |
|
18422 |
|
18423 |
|
18424 |
|
18425 |
|
18426 |
|
18427 |
|
18428 |
|
18429 |
|
18430 |
|
18431 |
|
18432 |
|
18433 |
|
18434 |
|
18435 |
|
18436 |
|
18437 |
|
18438 |
|
18439 |
|
18440 |
|
18441 |
|
18442 | function ɵɵstylePropInterpolate3(prop, prefix, v0, i0, v1, i1, v2, suffix, valueSuffix) {
|
18443 | const lView = getLView();
|
18444 | const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
|
18445 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
18446 | return ɵɵstylePropInterpolate3;
|
18447 | }
|
18448 |
|
18449 |
|
18450 |
|
18451 |
|
18452 |
|
18453 |
|
18454 |
|
18455 |
|
18456 |
|
18457 |
|
18458 |
|
18459 |
|
18460 |
|
18461 |
|
18462 |
|
18463 |
|
18464 |
|
18465 |
|
18466 |
|
18467 |
|
18468 |
|
18469 |
|
18470 |
|
18471 |
|
18472 |
|
18473 |
|
18474 |
|
18475 |
|
18476 |
|
18477 |
|
18478 |
|
18479 |
|
18480 | function ɵɵstylePropInterpolate4(prop, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, valueSuffix) {
|
18481 | const lView = getLView();
|
18482 | const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
|
18483 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
18484 | return ɵɵstylePropInterpolate4;
|
18485 | }
|
18486 |
|
18487 |
|
18488 |
|
18489 |
|
18490 |
|
18491 |
|
18492 |
|
18493 |
|
18494 |
|
18495 |
|
18496 |
|
18497 |
|
18498 |
|
18499 |
|
18500 |
|
18501 |
|
18502 |
|
18503 |
|
18504 |
|
18505 |
|
18506 |
|
18507 |
|
18508 |
|
18509 |
|
18510 |
|
18511 |
|
18512 |
|
18513 |
|
18514 |
|
18515 |
|
18516 |
|
18517 |
|
18518 |
|
18519 |
|
18520 | function ɵɵstylePropInterpolate5(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, valueSuffix) {
|
18521 | const lView = getLView();
|
18522 | const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
|
18523 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
18524 | return ɵɵstylePropInterpolate5;
|
18525 | }
|
18526 |
|
18527 |
|
18528 |
|
18529 |
|
18530 |
|
18531 |
|
18532 |
|
18533 |
|
18534 |
|
18535 |
|
18536 |
|
18537 |
|
18538 |
|
18539 |
|
18540 |
|
18541 |
|
18542 |
|
18543 |
|
18544 |
|
18545 |
|
18546 |
|
18547 |
|
18548 |
|
18549 |
|
18550 |
|
18551 |
|
18552 |
|
18553 |
|
18554 |
|
18555 |
|
18556 |
|
18557 |
|
18558 |
|
18559 |
|
18560 |
|
18561 |
|
18562 | function ɵɵstylePropInterpolate6(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, valueSuffix) {
|
18563 | const lView = getLView();
|
18564 | const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
|
18565 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
18566 | return ɵɵstylePropInterpolate6;
|
18567 | }
|
18568 |
|
18569 |
|
18570 |
|
18571 |
|
18572 |
|
18573 |
|
18574 |
|
18575 |
|
18576 |
|
18577 |
|
18578 |
|
18579 |
|
18580 |
|
18581 |
|
18582 |
|
18583 |
|
18584 |
|
18585 |
|
18586 |
|
18587 |
|
18588 |
|
18589 |
|
18590 |
|
18591 |
|
18592 |
|
18593 |
|
18594 |
|
18595 |
|
18596 |
|
18597 |
|
18598 |
|
18599 |
|
18600 |
|
18601 |
|
18602 |
|
18603 |
|
18604 |
|
18605 |
|
18606 |
|
18607 | function ɵɵstylePropInterpolate7(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, valueSuffix) {
|
18608 | const lView = getLView();
|
18609 | const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
|
18610 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
18611 | return ɵɵstylePropInterpolate7;
|
18612 | }
|
18613 |
|
18614 |
|
18615 |
|
18616 |
|
18617 |
|
18618 |
|
18619 |
|
18620 |
|
18621 |
|
18622 |
|
18623 |
|
18624 |
|
18625 |
|
18626 |
|
18627 |
|
18628 |
|
18629 |
|
18630 |
|
18631 |
|
18632 |
|
18633 |
|
18634 |
|
18635 |
|
18636 |
|
18637 |
|
18638 |
|
18639 |
|
18640 |
|
18641 |
|
18642 |
|
18643 |
|
18644 |
|
18645 |
|
18646 |
|
18647 |
|
18648 |
|
18649 |
|
18650 |
|
18651 |
|
18652 |
|
18653 |
|
18654 | function ɵɵstylePropInterpolate8(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, valueSuffix) {
|
18655 | const lView = getLView();
|
18656 | const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
|
18657 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
18658 | return ɵɵstylePropInterpolate8;
|
18659 | }
|
18660 |
|
18661 |
|
18662 |
|
18663 |
|
18664 |
|
18665 |
|
18666 |
|
18667 |
|
18668 |
|
18669 |
|
18670 |
|
18671 |
|
18672 |
|
18673 |
|
18674 |
|
18675 |
|
18676 |
|
18677 |
|
18678 |
|
18679 |
|
18680 |
|
18681 |
|
18682 |
|
18683 |
|
18684 |
|
18685 |
|
18686 |
|
18687 |
|
18688 |
|
18689 |
|
18690 | function ɵɵstylePropInterpolateV(prop, values, valueSuffix) {
|
18691 | const lView = getLView();
|
18692 | const interpolatedValue = interpolationV(lView, values);
|
18693 | checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
|
18694 | return ɵɵstylePropInterpolateV;
|
18695 | }
|
18696 |
|
18697 |
|
18698 |
|
18699 |
|
18700 |
|
18701 |
|
18702 |
|
18703 |
|
18704 |
|
18705 |
|
18706 |
|
18707 |
|
18708 |
|
18709 |
|
18710 |
|
18711 |
|
18712 |
|
18713 |
|
18714 |
|
18715 |
|
18716 |
|
18717 |
|
18718 | function ɵɵhostProperty(propName, value, sanitizer) {
|
18719 | const lView = getLView();
|
18720 | const bindingIndex = nextBindingIndex();
|
18721 | if (bindingUpdated(lView, bindingIndex, value)) {
|
18722 | const tView = getTView();
|
18723 | const tNode = getSelectedTNode();
|
18724 | elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, true);
|
18725 | ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
|
18726 | }
|
18727 | return ɵɵhostProperty;
|
18728 | }
|
18729 |
|
18730 |
|
18731 |
|
18732 |
|
18733 |
|
18734 |
|
18735 |
|
18736 |
|
18737 |
|
18738 |
|
18739 |
|
18740 |
|
18741 |
|
18742 |
|
18743 |
|
18744 |
|
18745 |
|
18746 |
|
18747 |
|
18748 |
|
18749 |
|
18750 | function ɵɵsyntheticHostProperty(propName, value, sanitizer) {
|
18751 | const lView = getLView();
|
18752 | const bindingIndex = nextBindingIndex();
|
18753 | if (bindingUpdated(lView, bindingIndex, value)) {
|
18754 | const tView = getTView();
|
18755 | const tNode = getSelectedTNode();
|
18756 | const currentDef = getCurrentDirectiveDef(tView.data);
|
18757 | const renderer = loadComponentRenderer(currentDef, tNode, lView);
|
18758 | elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, true);
|
18759 | ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
|
18760 | }
|
18761 | return ɵɵsyntheticHostProperty;
|
18762 | }
|
18763 |
|
18764 |
|
18765 |
|
18766 |
|
18767 |
|
18768 |
|
18769 |
|
18770 |
|
18771 |
|
18772 |
|
18773 |
|
18774 | if (typeof ngI18nClosureMode === 'undefined') {
|
18775 |
|
18776 |
|
18777 |
|
18778 |
|
18779 | (function () {
|
18780 |
|
18781 | _global['ngI18nClosureMode'] =
|
18782 |
|
18783 |
|
18784 | typeof goog !== 'undefined' && typeof goog.getMsg === 'function';
|
18785 | })();
|
18786 | }
|
18787 |
|
18788 |
|
18789 |
|
18790 |
|
18791 |
|
18792 |
|
18793 |
|
18794 |
|
18795 |
|
18796 | const u = undefined;
|
18797 | function plural(val) {
|
18798 | const n = val, i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\.?/, '').length;
|
18799 | if (i === 1 && v === 0)
|
18800 | return 1;
|
18801 | return 5;
|
18802 | }
|
18803 | var localeEn = ["en", [["a", "p"], ["AM", "PM"], u], [["AM", "PM"], u, u], [["S", "M", "T", "W", "T", "F", "S"], ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]], u, [["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]], u, [["B", "A"], ["BC", "AD"], ["Before Christ", "Anno Domini"]], 0, [6, 0], ["M/d/yy", "MMM d, y", "MMMM d, y", "EEEE, MMMM d, y"], ["h:mm a", "h:mm:ss a", "h:mm:ss a z", "h:mm:ss a zzzz"], ["{1}, {0}", u, "{1} 'at' {0}", u], [".", ",", ";", "%", "+", "-", "E", "×", "‰", "∞", "NaN", ":"], ["#,##0.###", "#,##0%", "¤#,##0.00", "#E0"], "USD", "$", "US Dollar", {}, "ltr", plural];
|
18804 |
|
18805 |
|
18806 |
|
18807 |
|
18808 |
|
18809 |
|
18810 |
|
18811 |
|
18812 |
|
18813 |
|
18814 |
|
18815 | let LOCALE_DATA = {};
|
18816 |
|
18817 |
|
18818 |
|
18819 |
|
18820 |
|
18821 |
|
18822 |
|
18823 | function registerLocaleData(data, localeId, extraData) {
|
18824 | if (typeof localeId !== 'string') {
|
18825 | extraData = localeId;
|
18826 | localeId = data[LocaleDataIndex.LocaleId];
|
18827 | }
|
18828 | localeId = localeId.toLowerCase().replace(/_/g, '-');
|
18829 | LOCALE_DATA[localeId] = data;
|
18830 | if (extraData) {
|
18831 | LOCALE_DATA[localeId][LocaleDataIndex.ExtraData] = extraData;
|
18832 | }
|
18833 | }
|
18834 |
|
18835 |
|
18836 |
|
18837 |
|
18838 |
|
18839 |
|
18840 |
|
18841 | function findLocaleData(locale) {
|
18842 | const normalizedLocale = normalizeLocale(locale);
|
18843 | let match = getLocaleData(normalizedLocale);
|
18844 | if (match) {
|
18845 | return match;
|
18846 | }
|
18847 |
|
18848 | const parentLocale = normalizedLocale.split('-')[0];
|
18849 | match = getLocaleData(parentLocale);
|
18850 | if (match) {
|
18851 | return match;
|
18852 | }
|
18853 | if (parentLocale === 'en') {
|
18854 | return localeEn;
|
18855 | }
|
18856 | throw new Error(`Missing locale data for the locale "${locale}".`);
|
18857 | }
|
18858 |
|
18859 |
|
18860 |
|
18861 |
|
18862 |
|
18863 |
|
18864 |
|
18865 |
|
18866 |
|
18867 | function getLocaleCurrencyCode(locale) {
|
18868 | const data = findLocaleData(locale);
|
18869 | return data[LocaleDataIndex.CurrencyCode] || null;
|
18870 | }
|
18871 |
|
18872 |
|
18873 |
|
18874 |
|
18875 |
|
18876 |
|
18877 |
|
18878 |
|
18879 | function getLocalePluralCase(locale) {
|
18880 | const data = findLocaleData(locale);
|
18881 | return data[LocaleDataIndex.PluralCase];
|
18882 | }
|
18883 |
|
18884 |
|
18885 |
|
18886 |
|
18887 | function getLocaleData(normalizedLocale) {
|
18888 | if (!(normalizedLocale in LOCALE_DATA)) {
|
18889 | LOCALE_DATA[normalizedLocale] = _global.ng && _global.ng.common && _global.ng.common.locales &&
|
18890 | _global.ng.common.locales[normalizedLocale];
|
18891 | }
|
18892 | return LOCALE_DATA[normalizedLocale];
|
18893 | }
|
18894 |
|
18895 |
|
18896 |
|
18897 | function unregisterAllLocaleData() {
|
18898 | LOCALE_DATA = {};
|
18899 | }
|
18900 |
|
18901 |
|
18902 |
|
18903 | var LocaleDataIndex;
|
18904 | (function (LocaleDataIndex) {
|
18905 | LocaleDataIndex[LocaleDataIndex["LocaleId"] = 0] = "LocaleId";
|
18906 | LocaleDataIndex[LocaleDataIndex["DayPeriodsFormat"] = 1] = "DayPeriodsFormat";
|
18907 | LocaleDataIndex[LocaleDataIndex["DayPeriodsStandalone"] = 2] = "DayPeriodsStandalone";
|
18908 | LocaleDataIndex[LocaleDataIndex["DaysFormat"] = 3] = "DaysFormat";
|
18909 | LocaleDataIndex[LocaleDataIndex["DaysStandalone"] = 4] = "DaysStandalone";
|
18910 | LocaleDataIndex[LocaleDataIndex["MonthsFormat"] = 5] = "MonthsFormat";
|
18911 | LocaleDataIndex[LocaleDataIndex["MonthsStandalone"] = 6] = "MonthsStandalone";
|
18912 | LocaleDataIndex[LocaleDataIndex["Eras"] = 7] = "Eras";
|
18913 | LocaleDataIndex[LocaleDataIndex["FirstDayOfWeek"] = 8] = "FirstDayOfWeek";
|
18914 | LocaleDataIndex[LocaleDataIndex["WeekendRange"] = 9] = "WeekendRange";
|
18915 | LocaleDataIndex[LocaleDataIndex["DateFormat"] = 10] = "DateFormat";
|
18916 | LocaleDataIndex[LocaleDataIndex["TimeFormat"] = 11] = "TimeFormat";
|
18917 | LocaleDataIndex[LocaleDataIndex["DateTimeFormat"] = 12] = "DateTimeFormat";
|
18918 | LocaleDataIndex[LocaleDataIndex["NumberSymbols"] = 13] = "NumberSymbols";
|
18919 | LocaleDataIndex[LocaleDataIndex["NumberFormats"] = 14] = "NumberFormats";
|
18920 | LocaleDataIndex[LocaleDataIndex["CurrencyCode"] = 15] = "CurrencyCode";
|
18921 | LocaleDataIndex[LocaleDataIndex["CurrencySymbol"] = 16] = "CurrencySymbol";
|
18922 | LocaleDataIndex[LocaleDataIndex["CurrencyName"] = 17] = "CurrencyName";
|
18923 | LocaleDataIndex[LocaleDataIndex["Currencies"] = 18] = "Currencies";
|
18924 | LocaleDataIndex[LocaleDataIndex["Directionality"] = 19] = "Directionality";
|
18925 | LocaleDataIndex[LocaleDataIndex["PluralCase"] = 20] = "PluralCase";
|
18926 | LocaleDataIndex[LocaleDataIndex["ExtraData"] = 21] = "ExtraData";
|
18927 | })(LocaleDataIndex || (LocaleDataIndex = {}));
|
18928 |
|
18929 |
|
18930 |
|
18931 | function normalizeLocale(locale) {
|
18932 | return locale.toLowerCase().replace(/_/g, '-');
|
18933 | }
|
18934 |
|
18935 |
|
18936 |
|
18937 |
|
18938 |
|
18939 |
|
18940 |
|
18941 |
|
18942 | const pluralMapping = ['zero', 'one', 'two', 'few', 'many'];
|
18943 |
|
18944 |
|
18945 |
|
18946 | function getPluralCase(value, locale) {
|
18947 | const plural = getLocalePluralCase(locale)(parseInt(value, 10));
|
18948 | const result = pluralMapping[plural];
|
18949 | return (result !== undefined) ? result : 'other';
|
18950 | }
|
18951 |
|
18952 |
|
18953 |
|
18954 | const DEFAULT_LOCALE_ID = 'en-US';
|
18955 |
|
18956 |
|
18957 |
|
18958 |
|
18959 | const USD_CURRENCY_CODE = 'USD';
|
18960 |
|
18961 |
|
18962 |
|
18963 |
|
18964 |
|
18965 |
|
18966 |
|
18967 |
|
18968 |
|
18969 |
|
18970 |
|
18971 |
|
18972 |
|
18973 | const ELEMENT_MARKER = {
|
18974 | marker: 'element'
|
18975 | };
|
18976 |
|
18977 |
|
18978 |
|
18979 |
|
18980 |
|
18981 | const ICU_MARKER = {
|
18982 | marker: 'ICU'
|
18983 | };
|
18984 |
|
18985 |
|
18986 |
|
18987 | var I18nCreateOpCode;
|
18988 | (function (I18nCreateOpCode) {
|
18989 | |
18990 |
|
18991 |
|
18992 |
|
18993 | I18nCreateOpCode[I18nCreateOpCode["SHIFT"] = 2] = "SHIFT";
|
18994 | |
18995 |
|
18996 |
|
18997 | I18nCreateOpCode[I18nCreateOpCode["APPEND_EAGERLY"] = 1] = "APPEND_EAGERLY";
|
18998 | |
18999 |
|
19000 |
|
19001 | I18nCreateOpCode[I18nCreateOpCode["COMMENT"] = 2] = "COMMENT";
|
19002 | })(I18nCreateOpCode || (I18nCreateOpCode = {}));
|
19003 |
|
19004 |
|
19005 | const unusedValueExportToPlacateAjd$2 = 1;
|
19006 |
|
19007 |
|
19008 |
|
19009 |
|
19010 |
|
19011 |
|
19012 |
|
19013 |
|
19014 |
|
19015 |
|
19016 |
|
19017 |
|
19018 |
|
19019 | let LOCALE_ID$1 = DEFAULT_LOCALE_ID;
|
19020 |
|
19021 |
|
19022 |
|
19023 |
|
19024 |
|
19025 |
|
19026 |
|
19027 | function setLocaleId(localeId) {
|
19028 | assertDefined(localeId, `Expected localeId to be defined`);
|
19029 | if (typeof localeId === 'string') {
|
19030 | LOCALE_ID$1 = localeId.toLowerCase().replace(/_/g, '-');
|
19031 | }
|
19032 | }
|
19033 |
|
19034 |
|
19035 |
|
19036 |
|
19037 |
|
19038 | function getLocaleId() {
|
19039 | return LOCALE_ID$1;
|
19040 | }
|
19041 |
|
19042 |
|
19043 |
|
19044 |
|
19045 |
|
19046 |
|
19047 |
|
19048 |
|
19049 |
|
19050 |
|
19051 |
|
19052 |
|
19053 |
|
19054 |
|
19055 |
|
19056 |
|
19057 |
|
19058 |
|
19059 | function getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView) {
|
19060 | const tNodeInsertBeforeIndex = currentTNode.insertBeforeIndex;
|
19061 | const insertBeforeIndex = Array.isArray(tNodeInsertBeforeIndex) ? tNodeInsertBeforeIndex[0] : tNodeInsertBeforeIndex;
|
19062 | if (insertBeforeIndex === null) {
|
19063 | return getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView);
|
19064 | }
|
19065 | else {
|
19066 | ngDevMode && assertIndexInRange(lView, insertBeforeIndex);
|
19067 | return unwrapRNode(lView[insertBeforeIndex]);
|
19068 | }
|
19069 | }
|
19070 |
|
19071 |
|
19072 |
|
19073 |
|
19074 |
|
19075 | function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRElement) {
|
19076 | const tNodeInsertBeforeIndex = childTNode.insertBeforeIndex;
|
19077 | if (Array.isArray(tNodeInsertBeforeIndex)) {
|
19078 |
|
19079 |
|
19080 |
|
19081 |
|
19082 |
|
19083 | ngDevMode && assertDomNode(childRNode);
|
19084 | let i18nParent = childRNode;
|
19085 | let anchorRNode = null;
|
19086 | if (!(childTNode.type & 3 )) {
|
19087 | anchorRNode = i18nParent;
|
19088 | i18nParent = parentRElement;
|
19089 | }
|
19090 | if (i18nParent !== null && (childTNode.flags & 2 ) === 0) {
|
19091 | for (let i = 1; i < tNodeInsertBeforeIndex.length; i++) {
|
19092 |
|
19093 |
|
19094 | const i18nChild = lView[tNodeInsertBeforeIndex[i]];
|
19095 | nativeInsertBefore(renderer, i18nParent, i18nChild, anchorRNode, false);
|
19096 | }
|
19097 | }
|
19098 | }
|
19099 | }
|
19100 |
|
19101 |
|
19102 |
|
19103 |
|
19104 |
|
19105 |
|
19106 |
|
19107 |
|
19108 |
|
19109 |
|
19110 |
|
19111 |
|
19112 |
|
19113 |
|
19114 |
|
19115 |
|
19116 |
|
19117 |
|
19118 |
|
19119 |
|
19120 |
|
19121 |
|
19122 |
|
19123 |
|
19124 |
|
19125 |
|
19126 |
|
19127 |
|
19128 |
|
19129 |
|
19130 |
|
19131 |
|
19132 |
|
19133 |
|
19134 |
|
19135 |
|
19136 |
|
19137 |
|
19138 | function addTNodeAndUpdateInsertBeforeIndex(previousTNodes, newTNode) {
|
19139 |
|
19140 | ngDevMode &&
|
19141 | assertEqual(newTNode.insertBeforeIndex, null, 'We expect that insertBeforeIndex is not set');
|
19142 | previousTNodes.push(newTNode);
|
19143 | if (previousTNodes.length > 1) {
|
19144 | for (let i = previousTNodes.length - 2; i >= 0; i--) {
|
19145 | const existingTNode = previousTNodes[i];
|
19146 |
|
19147 |
|
19148 | if (!isI18nText(existingTNode)) {
|
19149 | if (isNewTNodeCreatedBefore(existingTNode, newTNode) &&
|
19150 | getInsertBeforeIndex(existingTNode) === null) {
|
19151 |
|
19152 |
|
19153 | setInsertBeforeIndex(existingTNode, newTNode.index);
|
19154 | }
|
19155 | }
|
19156 | }
|
19157 | }
|
19158 | }
|
19159 | function isI18nText(tNode) {
|
19160 | return !(tNode.type & 64 );
|
19161 | }
|
19162 | function isNewTNodeCreatedBefore(existingTNode, newTNode) {
|
19163 | return isI18nText(newTNode) || existingTNode.index > newTNode.index;
|
19164 | }
|
19165 | function getInsertBeforeIndex(tNode) {
|
19166 | const index = tNode.insertBeforeIndex;
|
19167 | return Array.isArray(index) ? index[0] : index;
|
19168 | }
|
19169 | function setInsertBeforeIndex(tNode, value) {
|
19170 | const index = tNode.insertBeforeIndex;
|
19171 | if (Array.isArray(index)) {
|
19172 |
|
19173 | index[0] = value;
|
19174 | }
|
19175 | else {
|
19176 | setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore);
|
19177 | tNode.insertBeforeIndex = value;
|
19178 | }
|
19179 | }
|
19180 |
|
19181 |
|
19182 |
|
19183 |
|
19184 |
|
19185 |
|
19186 |
|
19187 |
|
19188 |
|
19189 |
|
19190 |
|
19191 |
|
19192 |
|
19193 |
|
19194 |
|
19195 |
|
19196 |
|
19197 |
|
19198 |
|
19199 |
|
19200 |
|
19201 | function getTIcu(tView, index) {
|
19202 | const value = tView.data[index];
|
19203 | if (value === null || typeof value === 'string')
|
19204 | return null;
|
19205 | if (ngDevMode &&
|
19206 | !(value.hasOwnProperty('tViews') || value.hasOwnProperty('currentCaseLViewIndex'))) {
|
19207 | throwError('We expect to get \'null\'|\'TIcu\'|\'TIcuContainer\', but got: ' + value);
|
19208 | }
|
19209 |
|
19210 |
|
19211 |
|
19212 |
|
19213 | const tIcu = value.hasOwnProperty('currentCaseLViewIndex') ? value :
|
19214 | value.value;
|
19215 | ngDevMode && assertTIcu(tIcu);
|
19216 | return tIcu;
|
19217 | }
|
19218 |
|
19219 |
|
19220 |
|
19221 |
|
19222 |
|
19223 |
|
19224 |
|
19225 |
|
19226 |
|
19227 |
|
19228 |
|
19229 |
|
19230 |
|
19231 |
|
19232 | function setTIcu(tView, index, tIcu) {
|
19233 | const tNode = tView.data[index];
|
19234 | ngDevMode &&
|
19235 | assertEqual(tNode === null || tNode.hasOwnProperty('tViews'), true, 'We expect to get \'null\'|\'TIcuContainer\'');
|
19236 | if (tNode === null) {
|
19237 | tView.data[index] = tIcu;
|
19238 | }
|
19239 | else {
|
19240 | ngDevMode && assertTNodeType(tNode, 32 );
|
19241 | tNode.value = tIcu;
|
19242 | }
|
19243 | }
|
19244 |
|
19245 |
|
19246 |
|
19247 |
|
19248 |
|
19249 | function setTNodeInsertBeforeIndex(tNode, index) {
|
19250 | ngDevMode && assertTNode(tNode);
|
19251 | let insertBeforeIndex = tNode.insertBeforeIndex;
|
19252 | if (insertBeforeIndex === null) {
|
19253 | setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore);
|
19254 | insertBeforeIndex = tNode.insertBeforeIndex =
|
19255 | [null , index];
|
19256 | }
|
19257 | else {
|
19258 | assertEqual(Array.isArray(insertBeforeIndex), true, 'Expecting array here');
|
19259 | insertBeforeIndex.push(index);
|
19260 | }
|
19261 | }
|
19262 |
|
19263 |
|
19264 |
|
19265 |
|
19266 |
|
19267 | function createTNodePlaceholder(tView, previousTNodes, index) {
|
19268 | const tNode = createTNodeAtIndex(tView, index, 64 , null, null);
|
19269 | addTNodeAndUpdateInsertBeforeIndex(previousTNodes, tNode);
|
19270 | return tNode;
|
19271 | }
|
19272 |
|
19273 |
|
19274 |
|
19275 |
|
19276 |
|
19277 |
|
19278 |
|
19279 |
|
19280 | function getCurrentICUCaseIndex(tIcu, lView) {
|
19281 | const currentCase = lView[tIcu.currentCaseLViewIndex];
|
19282 | return currentCase === null ? currentCase : (currentCase < 0 ? ~currentCase : currentCase);
|
19283 | }
|
19284 | function getParentFromIcuCreateOpCode(mergedCode) {
|
19285 | return mergedCode >>> 17 ;
|
19286 | }
|
19287 | function getRefFromIcuCreateOpCode(mergedCode) {
|
19288 | return (mergedCode & 131070 ) >>> 1 ;
|
19289 | }
|
19290 | function getInstructionFromIcuCreateOpCode(mergedCode) {
|
19291 | return mergedCode & 1 ;
|
19292 | }
|
19293 | function icuCreateOpCode(opCode, parentIdx, refIdx) {
|
19294 | ngDevMode && assertGreaterThanOrEqual(parentIdx, 0, 'Missing parent index');
|
19295 | ngDevMode && assertGreaterThan(refIdx, 0, 'Missing ref index');
|
19296 | return opCode | parentIdx << 17 | refIdx << 1 ;
|
19297 | }
|
19298 |
|
19299 |
|
19300 |
|
19301 |
|
19302 |
|
19303 |
|
19304 |
|
19305 |
|
19306 |
|
19307 |
|
19308 |
|
19309 |
|
19310 |
|
19311 |
|
19312 |
|
19313 |
|
19314 |
|
19315 |
|
19316 |
|
19317 |
|
19318 |
|
19319 | let changeMask = 0b0;
|
19320 |
|
19321 |
|
19322 |
|
19323 |
|
19324 |
|
19325 | let changeMaskCounter = 0;
|
19326 |
|
19327 |
|
19328 |
|
19329 |
|
19330 |
|
19331 |
|
19332 |
|
19333 | function setMaskBit(hasChange) {
|
19334 | if (hasChange) {
|
19335 | changeMask = changeMask | (1 << Math.min(changeMaskCounter, 31));
|
19336 | }
|
19337 | changeMaskCounter++;
|
19338 | }
|
19339 | function applyI18n(tView, lView, index) {
|
19340 | if (changeMaskCounter > 0) {
|
19341 | ngDevMode && assertDefined(tView, `tView should be defined`);
|
19342 | const tI18n = tView.data[index];
|
19343 |
|
19344 | const updateOpCodes = Array.isArray(tI18n) ? tI18n : tI18n.update;
|
19345 | const bindingsStartIndex = getBindingIndex() - changeMaskCounter - 1;
|
19346 | applyUpdateOpCodes(tView, lView, updateOpCodes, bindingsStartIndex, changeMask);
|
19347 | }
|
19348 |
|
19349 | changeMask = 0b0;
|
19350 | changeMaskCounter = 0;
|
19351 | }
|
19352 |
|
19353 |
|
19354 |
|
19355 |
|
19356 |
|
19357 |
|
19358 |
|
19359 |
|
19360 |
|
19361 |
|
19362 |
|
19363 | function applyCreateOpCodes(lView, createOpCodes, parentRNode, insertInFrontOf) {
|
19364 | const renderer = lView[RENDERER];
|
19365 | for (let i = 0; i < createOpCodes.length; i++) {
|
19366 | const opCode = createOpCodes[i++];
|
19367 | const text = createOpCodes[i];
|
19368 | const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT;
|
19369 | const appendNow = (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY;
|
19370 | const index = opCode >>> I18nCreateOpCode.SHIFT;
|
19371 | let rNode = lView[index];
|
19372 | if (rNode === null) {
|
19373 |
|
19374 |
|
19375 | rNode = lView[index] =
|
19376 | isComment ? renderer.createComment(text) : createTextNode(renderer, text);
|
19377 | }
|
19378 | if (appendNow && parentRNode !== null) {
|
19379 | nativeInsertBefore(renderer, parentRNode, rNode, insertInFrontOf, false);
|
19380 | }
|
19381 | }
|
19382 | }
|
19383 |
|
19384 |
|
19385 |
|
19386 |
|
19387 |
|
19388 |
|
19389 |
|
19390 |
|
19391 | function applyMutableOpCodes(tView, mutableOpCodes, lView, anchorRNode) {
|
19392 | ngDevMode && assertDomNode(anchorRNode);
|
19393 | const renderer = lView[RENDERER];
|
19394 |
|
19395 | let rootIdx = null;
|
19396 |
|
19397 |
|
19398 |
|
19399 |
|
19400 |
|
19401 | let rootRNode;
|
19402 | for (let i = 0; i < mutableOpCodes.length; i++) {
|
19403 | const opCode = mutableOpCodes[i];
|
19404 | if (typeof opCode == 'string') {
|
19405 | const textNodeIndex = mutableOpCodes[++i];
|
19406 | if (lView[textNodeIndex] === null) {
|
19407 | ngDevMode && ngDevMode.rendererCreateTextNode++;
|
19408 | ngDevMode && assertIndexInRange(lView, textNodeIndex);
|
19409 | lView[textNodeIndex] = createTextNode(renderer, opCode);
|
19410 | }
|
19411 | }
|
19412 | else if (typeof opCode == 'number') {
|
19413 | switch (opCode & 1 ) {
|
19414 | case 0 :
|
19415 | const parentIdx = getParentFromIcuCreateOpCode(opCode);
|
19416 | if (rootIdx === null) {
|
19417 |
|
19418 |
|
19419 |
|
19420 | rootIdx = parentIdx;
|
19421 | rootRNode = nativeParentNode(renderer, anchorRNode);
|
19422 | }
|
19423 | let insertInFrontOf;
|
19424 | let parentRNode;
|
19425 | if (parentIdx === rootIdx) {
|
19426 | insertInFrontOf = anchorRNode;
|
19427 | parentRNode = rootRNode;
|
19428 | }
|
19429 | else {
|
19430 | insertInFrontOf = null;
|
19431 | parentRNode = unwrapRNode(lView[parentIdx]);
|
19432 | }
|
19433 |
|
19434 | if (parentRNode !== null) {
|
19435 |
|
19436 |
|
19437 |
|
19438 |
|
19439 | ngDevMode && assertDomNode(parentRNode);
|
19440 | const refIdx = getRefFromIcuCreateOpCode(opCode);
|
19441 | ngDevMode && assertGreaterThan(refIdx, HEADER_OFFSET, 'Missing ref');
|
19442 |
|
19443 |
|
19444 | const child = lView[refIdx];
|
19445 | ngDevMode && assertDomNode(child);
|
19446 | nativeInsertBefore(renderer, parentRNode, child, insertInFrontOf, false);
|
19447 | const tIcu = getTIcu(tView, refIdx);
|
19448 | if (tIcu !== null && typeof tIcu === 'object') {
|
19449 |
|
19450 |
|
19451 | ngDevMode && assertTIcu(tIcu);
|
19452 | const caseIndex = getCurrentICUCaseIndex(tIcu, lView);
|
19453 | if (caseIndex !== null) {
|
19454 | applyMutableOpCodes(tView, tIcu.create[caseIndex], lView, lView[tIcu.anchorIdx]);
|
19455 | }
|
19456 | }
|
19457 | }
|
19458 | break;
|
19459 | case 1 :
|
19460 | const elementNodeIndex = opCode >>> 1 ;
|
19461 | const attrName = mutableOpCodes[++i];
|
19462 | const attrValue = mutableOpCodes[++i];
|
19463 |
|
19464 |
|
19465 | setElementAttribute$1(renderer, getNativeByIndex(elementNodeIndex, lView), null, null, attrName, attrValue, null);
|
19466 | break;
|
19467 | default:
|
19468 | throw new Error(`Unable to determine the type of mutate operation for "${opCode}"`);
|
19469 | }
|
19470 | }
|
19471 | else {
|
19472 | switch (opCode) {
|
19473 | case ICU_MARKER:
|
19474 | const commentValue = mutableOpCodes[++i];
|
19475 | const commentNodeIndex = mutableOpCodes[++i];
|
19476 | if (lView[commentNodeIndex] === null) {
|
19477 | ngDevMode &&
|
19478 | assertEqual(typeof commentValue, 'string', `Expected "${commentValue}" to be a comment node value`);
|
19479 | ngDevMode && ngDevMode.rendererCreateComment++;
|
19480 | ngDevMode && assertIndexInExpandoRange(lView, commentNodeIndex);
|
19481 | const commentRNode = lView[commentNodeIndex] =
|
19482 | createCommentNode(renderer, commentValue);
|
19483 |
|
19484 | attachPatchData(commentRNode, lView);
|
19485 | }
|
19486 | break;
|
19487 | case ELEMENT_MARKER:
|
19488 | const tagName = mutableOpCodes[++i];
|
19489 | const elementNodeIndex = mutableOpCodes[++i];
|
19490 | if (lView[elementNodeIndex] === null) {
|
19491 | ngDevMode &&
|
19492 | assertEqual(typeof tagName, 'string', `Expected "${tagName}" to be an element node tag name`);
|
19493 | ngDevMode && ngDevMode.rendererCreateElement++;
|
19494 | ngDevMode && assertIndexInExpandoRange(lView, elementNodeIndex);
|
19495 | const elementRNode = lView[elementNodeIndex] =
|
19496 | createElementNode(renderer, tagName, null);
|
19497 |
|
19498 | attachPatchData(elementRNode, lView);
|
19499 | }
|
19500 | break;
|
19501 | default:
|
19502 | ngDevMode &&
|
19503 | throwError(`Unable to determine the type of mutate operation for "${opCode}"`);
|
19504 | }
|
19505 | }
|
19506 | }
|
19507 | }
|
19508 |
|
19509 |
|
19510 |
|
19511 |
|
19512 |
|
19513 |
|
19514 |
|
19515 |
|
19516 |
|
19517 |
|
19518 | function applyUpdateOpCodes(tView, lView, updateOpCodes, bindingsStartIndex, changeMask) {
|
19519 | for (let i = 0; i < updateOpCodes.length; i++) {
|
19520 |
|
19521 | const checkBit = updateOpCodes[i];
|
19522 |
|
19523 | const skipCodes = updateOpCodes[++i];
|
19524 | if (checkBit & changeMask) {
|
19525 |
|
19526 | let value = '';
|
19527 | for (let j = i + 1; j <= (i + skipCodes); j++) {
|
19528 | const opCode = updateOpCodes[j];
|
19529 | if (typeof opCode == 'string') {
|
19530 | value += opCode;
|
19531 | }
|
19532 | else if (typeof opCode == 'number') {
|
19533 | if (opCode < 0) {
|
19534 |
|
19535 | value += renderStringify(lView[bindingsStartIndex - opCode]);
|
19536 | }
|
19537 | else {
|
19538 | const nodeIndex = (opCode >>> 2 );
|
19539 | switch (opCode & 3 ) {
|
19540 | case 1 :
|
19541 | const propName = updateOpCodes[++j];
|
19542 | const sanitizeFn = updateOpCodes[++j];
|
19543 | const tNodeOrTagName = tView.data[nodeIndex];
|
19544 | ngDevMode && assertDefined(tNodeOrTagName, 'Experting TNode or string');
|
19545 | if (typeof tNodeOrTagName === 'string') {
|
19546 |
|
19547 |
|
19548 |
|
19549 | setElementAttribute$1(lView[RENDERER], lView[nodeIndex], null, tNodeOrTagName, propName, value, sanitizeFn);
|
19550 | }
|
19551 | else {
|
19552 | elementPropertyInternal(tView, tNodeOrTagName, lView, propName, value, lView[RENDERER], sanitizeFn, false);
|
19553 | }
|
19554 | break;
|
19555 | case 0 :
|
19556 | const rText = lView[nodeIndex];
|
19557 | rText !== null && updateTextNode(lView[RENDERER], rText, value);
|
19558 | break;
|
19559 | case 2 :
|
19560 | applyIcuSwitchCase(tView, getTIcu(tView, nodeIndex), lView, value);
|
19561 | break;
|
19562 | case 3 :
|
19563 | applyIcuUpdateCase(tView, getTIcu(tView, nodeIndex), bindingsStartIndex, lView);
|
19564 | break;
|
19565 | }
|
19566 | }
|
19567 | }
|
19568 | }
|
19569 | }
|
19570 | else {
|
19571 | const opCode = updateOpCodes[i + 1];
|
19572 | if (opCode > 0 && (opCode & 3 ) === 3 ) {
|
19573 |
|
19574 |
|
19575 |
|
19576 |
|
19577 | const nodeIndex = (opCode >>> 2 );
|
19578 | const tIcu = getTIcu(tView, nodeIndex);
|
19579 | const currentIndex = lView[tIcu.currentCaseLViewIndex];
|
19580 | if (currentIndex < 0) {
|
19581 | applyIcuUpdateCase(tView, tIcu, bindingsStartIndex, lView);
|
19582 | }
|
19583 | }
|
19584 | }
|
19585 | i += skipCodes;
|
19586 | }
|
19587 | }
|
19588 |
|
19589 |
|
19590 |
|
19591 |
|
19592 |
|
19593 |
|
19594 |
|
19595 |
|
19596 | function applyIcuUpdateCase(tView, tIcu, bindingsStartIndex, lView) {
|
19597 | ngDevMode && assertIndexInRange(lView, tIcu.currentCaseLViewIndex);
|
19598 | let activeCaseIndex = lView[tIcu.currentCaseLViewIndex];
|
19599 | if (activeCaseIndex !== null) {
|
19600 | let mask = changeMask;
|
19601 | if (activeCaseIndex < 0) {
|
19602 |
|
19603 |
|
19604 | activeCaseIndex = lView[tIcu.currentCaseLViewIndex] = ~activeCaseIndex;
|
19605 |
|
19606 | mask = -1;
|
19607 | }
|
19608 | applyUpdateOpCodes(tView, lView, tIcu.update[activeCaseIndex], bindingsStartIndex, mask);
|
19609 | }
|
19610 | }
|
19611 |
|
19612 |
|
19613 |
|
19614 |
|
19615 |
|
19616 |
|
19617 |
|
19618 |
|
19619 |
|
19620 |
|
19621 | function applyIcuSwitchCase(tView, tIcu, lView, value) {
|
19622 |
|
19623 | const caseIndex = getCaseIndex(tIcu, value);
|
19624 | let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
|
19625 | if (activeCaseIndex !== caseIndex) {
|
19626 | applyIcuSwitchCaseRemove(tView, tIcu, lView);
|
19627 | lView[tIcu.currentCaseLViewIndex] = caseIndex === null ? null : ~caseIndex;
|
19628 | if (caseIndex !== null) {
|
19629 |
|
19630 | const anchorRNode = lView[tIcu.anchorIdx];
|
19631 | if (anchorRNode) {
|
19632 | ngDevMode && assertDomNode(anchorRNode);
|
19633 | applyMutableOpCodes(tView, tIcu.create[caseIndex], lView, anchorRNode);
|
19634 | }
|
19635 | }
|
19636 | }
|
19637 | }
|
19638 |
|
19639 |
|
19640 |
|
19641 |
|
19642 |
|
19643 |
|
19644 |
|
19645 |
|
19646 |
|
19647 | function applyIcuSwitchCaseRemove(tView, tIcu, lView) {
|
19648 | let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
|
19649 | if (activeCaseIndex !== null) {
|
19650 | const removeCodes = tIcu.remove[activeCaseIndex];
|
19651 | for (let i = 0; i < removeCodes.length; i++) {
|
19652 | const nodeOrIcuIndex = removeCodes[i];
|
19653 | if (nodeOrIcuIndex > 0) {
|
19654 |
|
19655 | const rNode = getNativeByIndex(nodeOrIcuIndex, lView);
|
19656 | rNode !== null && nativeRemoveNode(lView[RENDERER], rNode);
|
19657 | }
|
19658 | else {
|
19659 |
|
19660 | applyIcuSwitchCaseRemove(tView, getTIcu(tView, ~nodeOrIcuIndex), lView);
|
19661 | }
|
19662 | }
|
19663 | }
|
19664 | }
|
19665 |
|
19666 |
|
19667 |
|
19668 |
|
19669 |
|
19670 |
|
19671 | function getCaseIndex(icuExpression, bindingValue) {
|
19672 | let index = icuExpression.cases.indexOf(bindingValue);
|
19673 | if (index === -1) {
|
19674 | switch (icuExpression.type) {
|
19675 | case 1 : {
|
19676 | const resolvedCase = getPluralCase(bindingValue, getLocaleId());
|
19677 | index = icuExpression.cases.indexOf(resolvedCase);
|
19678 | if (index === -1 && resolvedCase !== 'other') {
|
19679 | index = icuExpression.cases.indexOf('other');
|
19680 | }
|
19681 | break;
|
19682 | }
|
19683 | case 0 : {
|
19684 | index = icuExpression.cases.indexOf('other');
|
19685 | break;
|
19686 | }
|
19687 | }
|
19688 | }
|
19689 | return index === -1 ? null : index;
|
19690 | }
|
19691 |
|
19692 |
|
19693 |
|
19694 |
|
19695 |
|
19696 |
|
19697 |
|
19698 |
|
19699 | function loadIcuContainerVisitor() {
|
19700 | const _stack = [];
|
19701 | let _index = -1;
|
19702 | let _lView;
|
19703 | let _removes;
|
19704 | |
19705 |
|
19706 |
|
19707 |
|
19708 |
|
19709 |
|
19710 |
|
19711 |
|
19712 |
|
19713 |
|
19714 |
|
19715 |
|
19716 |
|
19717 |
|
19718 |
|
19719 |
|
19720 | function icuContainerIteratorStart(tIcuContainerNode, lView) {
|
19721 | _lView = lView;
|
19722 | while (_stack.length)
|
19723 | _stack.pop();
|
19724 | ngDevMode && assertTNodeForLView(tIcuContainerNode, lView);
|
19725 | enterIcu(tIcuContainerNode.value, lView);
|
19726 | return icuContainerIteratorNext;
|
19727 | }
|
19728 | function enterIcu(tIcu, lView) {
|
19729 | _index = 0;
|
19730 | const currentCase = getCurrentICUCaseIndex(tIcu, lView);
|
19731 | if (currentCase !== null) {
|
19732 | ngDevMode && assertNumberInRange(currentCase, 0, tIcu.cases.length - 1);
|
19733 | _removes = tIcu.remove[currentCase];
|
19734 | }
|
19735 | else {
|
19736 | _removes = EMPTY_ARRAY;
|
19737 | }
|
19738 | }
|
19739 | function icuContainerIteratorNext() {
|
19740 | if (_index < _removes.length) {
|
19741 | const removeOpCode = _removes[_index++];
|
19742 | ngDevMode && assertNumber(removeOpCode, 'Expecting OpCode number');
|
19743 | if (removeOpCode > 0) {
|
19744 | const rNode = _lView[removeOpCode];
|
19745 | ngDevMode && assertDomNode(rNode);
|
19746 | return rNode;
|
19747 | }
|
19748 | else {
|
19749 | _stack.push(_index, _removes);
|
19750 |
|
19751 | const tIcuIndex = ~removeOpCode;
|
19752 | const tIcu = _lView[TVIEW].data[tIcuIndex];
|
19753 | ngDevMode && assertTIcu(tIcu);
|
19754 | enterIcu(tIcu, _lView);
|
19755 | return icuContainerIteratorNext();
|
19756 | }
|
19757 | }
|
19758 | else {
|
19759 | if (_stack.length === 0) {
|
19760 | return null;
|
19761 | }
|
19762 | else {
|
19763 | _removes = _stack.pop();
|
19764 | _index = _stack.pop();
|
19765 | return icuContainerIteratorNext();
|
19766 | }
|
19767 | }
|
19768 | }
|
19769 | return icuContainerIteratorStart;
|
19770 | }
|
19771 |
|
19772 |
|
19773 |
|
19774 |
|
19775 |
|
19776 |
|
19777 |
|
19778 |
|
19779 |
|
19780 |
|
19781 |
|
19782 |
|
19783 |
|
19784 |
|
19785 |
|
19786 |
|
19787 |
|
19788 |
|
19789 | function i18nCreateOpCodesToString(opcodes) {
|
19790 | const createOpCodes = opcodes || (Array.isArray(this) ? this : []);
|
19791 | let lines = [];
|
19792 | for (let i = 0; i < createOpCodes.length; i++) {
|
19793 | const opCode = createOpCodes[i++];
|
19794 | const text = createOpCodes[i];
|
19795 | const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT;
|
19796 | const appendNow = (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY;
|
19797 | const index = opCode >>> I18nCreateOpCode.SHIFT;
|
19798 | lines.push(`lView[${index}] = document.${isComment ? 'createComment' : 'createText'}(${JSON.stringify(text)});`);
|
19799 | if (appendNow) {
|
19800 | lines.push(`parent.appendChild(lView[${index}]);`);
|
19801 | }
|
19802 | }
|
19803 | return lines;
|
19804 | }
|
19805 |
|
19806 |
|
19807 |
|
19808 |
|
19809 |
|
19810 |
|
19811 |
|
19812 |
|
19813 |
|
19814 |
|
19815 | function i18nUpdateOpCodesToString(opcodes) {
|
19816 | const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
|
19817 | let lines = [];
|
19818 | function consumeOpCode(value) {
|
19819 | const ref = value >>> 2 ;
|
19820 | const opCode = value & 3 ;
|
19821 | switch (opCode) {
|
19822 | case 0 :
|
19823 | return `(lView[${ref}] as Text).textContent = $$$`;
|
19824 | case 1 :
|
19825 | const attrName = parser.consumeString();
|
19826 | const sanitizationFn = parser.consumeFunction();
|
19827 | const value = sanitizationFn ? `(${sanitizationFn})($$$)` : '$$$';
|
19828 | return `(lView[${ref}] as Element).setAttribute('${attrName}', ${value})`;
|
19829 | case 2 :
|
19830 | return `icuSwitchCase(${ref}, $$$)`;
|
19831 | case 3 :
|
19832 | return `icuUpdateCase(${ref})`;
|
19833 | }
|
19834 | throw new Error('unexpected OpCode');
|
19835 | }
|
19836 | while (parser.hasMore()) {
|
19837 | let mask = parser.consumeNumber();
|
19838 | let size = parser.consumeNumber();
|
19839 | const end = parser.i + size;
|
19840 | const statements = [];
|
19841 | let statement = '';
|
19842 | while (parser.i < end) {
|
19843 | let value = parser.consumeNumberOrString();
|
19844 | if (typeof value === 'string') {
|
19845 | statement += value;
|
19846 | }
|
19847 | else if (value < 0) {
|
19848 |
|
19849 |
|
19850 |
|
19851 | statement += '${lView[i' + value + ']}';
|
19852 | }
|
19853 | else {
|
19854 |
|
19855 | const opCodeText = consumeOpCode(value);
|
19856 | statements.push(opCodeText.replace('$$$', '`' + statement + '`') + ';');
|
19857 | statement = '';
|
19858 | }
|
19859 | }
|
19860 | lines.push(`if (mask & 0b${mask.toString(2)}) { ${statements.join(' ')} }`);
|
19861 | }
|
19862 | return lines;
|
19863 | }
|
19864 |
|
19865 |
|
19866 |
|
19867 |
|
19868 |
|
19869 |
|
19870 |
|
19871 |
|
19872 |
|
19873 |
|
19874 | function icuCreateOpCodesToString(opcodes) {
|
19875 | const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
|
19876 | let lines = [];
|
19877 | function consumeOpCode(opCode) {
|
19878 | const parent = getParentFromIcuCreateOpCode(opCode);
|
19879 | const ref = getRefFromIcuCreateOpCode(opCode);
|
19880 | switch (getInstructionFromIcuCreateOpCode(opCode)) {
|
19881 | case 0 :
|
19882 | return `(lView[${parent}] as Element).appendChild(lView[${lastRef}])`;
|
19883 | case 1 :
|
19884 | return `(lView[${ref}] as Element).setAttribute("${parser.consumeString()}", "${parser.consumeString()}")`;
|
19885 | }
|
19886 | throw new Error('Unexpected OpCode: ' + getInstructionFromIcuCreateOpCode(opCode));
|
19887 | }
|
19888 | let lastRef = -1;
|
19889 | while (parser.hasMore()) {
|
19890 | let value = parser.consumeNumberStringOrMarker();
|
19891 | if (value === ICU_MARKER) {
|
19892 | const text = parser.consumeString();
|
19893 | lastRef = parser.consumeNumber();
|
19894 | lines.push(`lView[${lastRef}] = document.createComment("${text}")`);
|
19895 | }
|
19896 | else if (value === ELEMENT_MARKER) {
|
19897 | const text = parser.consumeString();
|
19898 | lastRef = parser.consumeNumber();
|
19899 | lines.push(`lView[${lastRef}] = document.createElement("${text}")`);
|
19900 | }
|
19901 | else if (typeof value === 'string') {
|
19902 | lastRef = parser.consumeNumber();
|
19903 | lines.push(`lView[${lastRef}] = document.createTextNode("${value}")`);
|
19904 | }
|
19905 | else if (typeof value === 'number') {
|
19906 | const line = consumeOpCode(value);
|
19907 | line && lines.push(line);
|
19908 | }
|
19909 | else {
|
19910 | throw new Error('Unexpected value');
|
19911 | }
|
19912 | }
|
19913 | return lines;
|
19914 | }
|
19915 |
|
19916 |
|
19917 |
|
19918 |
|
19919 |
|
19920 |
|
19921 |
|
19922 |
|
19923 |
|
19924 |
|
19925 | function i18nRemoveOpCodesToString(opcodes) {
|
19926 | const removeCodes = opcodes || (Array.isArray(this) ? this : []);
|
19927 | let lines = [];
|
19928 | for (let i = 0; i < removeCodes.length; i++) {
|
19929 | const nodeOrIcuIndex = removeCodes[i];
|
19930 | if (nodeOrIcuIndex > 0) {
|
19931 |
|
19932 | lines.push(`remove(lView[${nodeOrIcuIndex}])`);
|
19933 | }
|
19934 | else {
|
19935 |
|
19936 | lines.push(`removeNestedICU(${~nodeOrIcuIndex})`);
|
19937 | }
|
19938 | }
|
19939 | return lines;
|
19940 | }
|
19941 | class OpCodeParser {
|
19942 | constructor(codes) {
|
19943 | this.i = 0;
|
19944 | this.codes = codes;
|
19945 | }
|
19946 | hasMore() {
|
19947 | return this.i < this.codes.length;
|
19948 | }
|
19949 | consumeNumber() {
|
19950 | let value = this.codes[this.i++];
|
19951 | assertNumber(value, 'expecting number in OpCode');
|
19952 | return value;
|
19953 | }
|
19954 | consumeString() {
|
19955 | let value = this.codes[this.i++];
|
19956 | assertString(value, 'expecting string in OpCode');
|
19957 | return value;
|
19958 | }
|
19959 | consumeFunction() {
|
19960 | let value = this.codes[this.i++];
|
19961 | if (value === null || typeof value === 'function') {
|
19962 | return value;
|
19963 | }
|
19964 | throw new Error('expecting function in OpCode');
|
19965 | }
|
19966 | consumeNumberOrString() {
|
19967 | let value = this.codes[this.i++];
|
19968 | if (typeof value === 'string') {
|
19969 | return value;
|
19970 | }
|
19971 | assertNumber(value, 'expecting number or string in OpCode');
|
19972 | return value;
|
19973 | }
|
19974 | consumeNumberStringOrMarker() {
|
19975 | let value = this.codes[this.i++];
|
19976 | if (typeof value === 'string' || typeof value === 'number' || value == ICU_MARKER ||
|
19977 | value == ELEMENT_MARKER) {
|
19978 | return value;
|
19979 | }
|
19980 | assertNumber(value, 'expecting number, string, ICU_MARKER or ELEMENT_MARKER in OpCode');
|
19981 | return value;
|
19982 | }
|
19983 | }
|
19984 |
|
19985 |
|
19986 |
|
19987 |
|
19988 |
|
19989 |
|
19990 |
|
19991 |
|
19992 | const BINDING_REGEXP = /�(\d+):?\d*�/gi;
|
19993 | const ICU_REGEXP = /({\s*�\d+:?\d*�\s*,\s*\S{6}\s*,[\s\S]*})/gi;
|
19994 | const NESTED_ICU = /�(\d+)�/;
|
19995 | const ICU_BLOCK_REGEXP = /^\s*(�\d+:?\d*�)\s*,\s*(select|plural)\s*,/;
|
19996 | const MARKER = `�`;
|
19997 | const SUBTEMPLATE_REGEXP = /�\/?\*(\d+:\d+)�/gi;
|
19998 | const PH_REGEXP = /�(\/?[#*]\d+):?\d*�/gi;
|
19999 |
|
20000 |
|
20001 |
|
20002 |
|
20003 |
|
20004 |
|
20005 |
|
20006 | const NGSP_UNICODE_REGEXP = /\uE500/g;
|
20007 | function replaceNgsp(value) {
|
20008 | return value.replace(NGSP_UNICODE_REGEXP, ' ');
|
20009 | }
|
20010 |
|
20011 |
|
20012 |
|
20013 |
|
20014 |
|
20015 |
|
20016 |
|
20017 |
|
20018 |
|
20019 |
|
20020 |
|
20021 |
|
20022 |
|
20023 |
|
20024 | function i18nStartFirstCreatePass(tView, parentTNodeIndex, lView, index, message, subTemplateIndex) {
|
20025 | const rootTNode = getCurrentParentTNode();
|
20026 | const createOpCodes = [];
|
20027 | const updateOpCodes = [];
|
20028 | const existingTNodeStack = [[]];
|
20029 | if (ngDevMode) {
|
20030 | attachDebugGetter(createOpCodes, i18nCreateOpCodesToString);
|
20031 | attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
|
20032 | }
|
20033 | message = getTranslationForTemplate(message, subTemplateIndex);
|
20034 | const msgParts = replaceNgsp(message).split(PH_REGEXP);
|
20035 | for (let i = 0; i < msgParts.length; i++) {
|
20036 | let value = msgParts[i];
|
20037 | if ((i & 1) === 0) {
|
20038 |
|
20039 | const parts = i18nParseTextIntoPartsAndICU(value);
|
20040 | for (let j = 0; j < parts.length; j++) {
|
20041 | let part = parts[j];
|
20042 | if ((j & 1) === 0) {
|
20043 |
|
20044 | const text = part;
|
20045 | ngDevMode && assertString(text, 'Parsed ICU part should be string');
|
20046 | if (text !== '') {
|
20047 | i18nStartFirstCreatePassProcessTextNode(tView, rootTNode, existingTNodeStack[0], createOpCodes, updateOpCodes, lView, text);
|
20048 | }
|
20049 | }
|
20050 | else {
|
20051 |
|
20052 | const icuExpression = part;
|
20053 |
|
20054 |
|
20055 |
|
20056 |
|
20057 |
|
20058 |
|
20059 | if (typeof icuExpression !== 'object') {
|
20060 | throw new Error(`Unable to parse ICU expression in "${message}" message.`);
|
20061 | }
|
20062 | const icuContainerTNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodeStack[0], lView, createOpCodes, ngDevMode ? `ICU ${index}:${icuExpression.mainBinding}` : '', true);
|
20063 | const icuNodeIndex = icuContainerTNode.index;
|
20064 | ngDevMode &&
|
20065 | assertGreaterThanOrEqual(icuNodeIndex, HEADER_OFFSET, 'Index must be in absolute LView offset');
|
20066 | icuStart(tView, lView, updateOpCodes, parentTNodeIndex, icuExpression, icuNodeIndex);
|
20067 | }
|
20068 | }
|
20069 | }
|
20070 | else {
|
20071 |
|
20072 |
|
20073 | const isClosing = value.charCodeAt(0) === 47 ;
|
20074 | const type = value.charCodeAt(isClosing ? 1 : 0);
|
20075 | ngDevMode && assertOneOf(type, 42 , 35 );
|
20076 | const index = HEADER_OFFSET + Number.parseInt(value.substring((isClosing ? 2 : 1)));
|
20077 | if (isClosing) {
|
20078 | existingTNodeStack.shift();
|
20079 | setCurrentTNode(getCurrentParentTNode(), false);
|
20080 | }
|
20081 | else {
|
20082 | const tNode = createTNodePlaceholder(tView, existingTNodeStack[0], index);
|
20083 | existingTNodeStack.unshift([]);
|
20084 | setCurrentTNode(tNode, true);
|
20085 | }
|
20086 | }
|
20087 | }
|
20088 | tView.data[index] = {
|
20089 | create: createOpCodes,
|
20090 | update: updateOpCodes,
|
20091 | };
|
20092 | }
|
20093 |
|
20094 |
|
20095 |
|
20096 |
|
20097 |
|
20098 |
|
20099 |
|
20100 |
|
20101 |
|
20102 |
|
20103 |
|
20104 |
|
20105 | function createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, text, isICU) {
|
20106 | const i18nNodeIdx = allocExpando(tView, lView, 1, null);
|
20107 | let opCode = i18nNodeIdx << I18nCreateOpCode.SHIFT;
|
20108 | let parentTNode = getCurrentParentTNode();
|
20109 | if (rootTNode === parentTNode) {
|
20110 |
|
20111 |
|
20112 |
|
20113 | parentTNode = null;
|
20114 | }
|
20115 | if (parentTNode === null) {
|
20116 |
|
20117 |
|
20118 |
|
20119 |
|
20120 | opCode |= I18nCreateOpCode.APPEND_EAGERLY;
|
20121 | }
|
20122 | if (isICU) {
|
20123 | opCode |= I18nCreateOpCode.COMMENT;
|
20124 | ensureIcuContainerVisitorLoaded(loadIcuContainerVisitor);
|
20125 | }
|
20126 | createOpCodes.push(opCode, text === null ? '' : text);
|
20127 |
|
20128 |
|
20129 | const tNode = createTNodeAtIndex(tView, i18nNodeIdx, isICU ? 32 : 1 , text === null ? (ngDevMode ? '{{?}}' : '') : text, null);
|
20130 | addTNodeAndUpdateInsertBeforeIndex(existingTNodes, tNode);
|
20131 | const tNodeIdx = tNode.index;
|
20132 | setCurrentTNode(tNode, false );
|
20133 | if (parentTNode !== null && rootTNode !== parentTNode) {
|
20134 |
|
20135 |
|
20136 | setTNodeInsertBeforeIndex(parentTNode, tNodeIdx);
|
20137 | }
|
20138 | return tNode;
|
20139 | }
|
20140 |
|
20141 |
|
20142 |
|
20143 |
|
20144 |
|
20145 |
|
20146 |
|
20147 |
|
20148 |
|
20149 |
|
20150 |
|
20151 |
|
20152 |
|
20153 |
|
20154 |
|
20155 |
|
20156 |
|
20157 |
|
20158 |
|
20159 | function i18nStartFirstCreatePassProcessTextNode(tView, rootTNode, existingTNodes, createOpCodes, updateOpCodes, lView, text) {
|
20160 | const hasBinding = text.match(BINDING_REGEXP);
|
20161 | const tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);
|
20162 | if (hasBinding) {
|
20163 | generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index, null, 0, null);
|
20164 | }
|
20165 | }
|
20166 |
|
20167 |
|
20168 |
|
20169 | function i18nAttributesFirstPass(tView, index, values) {
|
20170 | const previousElement = getCurrentTNode();
|
20171 | const previousElementIndex = previousElement.index;
|
20172 | const updateOpCodes = [];
|
20173 | if (ngDevMode) {
|
20174 | attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
|
20175 | }
|
20176 | if (tView.firstCreatePass && tView.data[index] === null) {
|
20177 | for (let i = 0; i < values.length; i += 2) {
|
20178 | const attrName = values[i];
|
20179 | const message = values[i + 1];
|
20180 | if (message !== '') {
|
20181 |
|
20182 |
|
20183 |
|
20184 |
|
20185 |
|
20186 | if (ICU_REGEXP.test(message)) {
|
20187 | throw new Error(`ICU expressions are not supported in attributes. Message: "${message}".`);
|
20188 | }
|
20189 |
|
20190 |
|
20191 |
|
20192 |
|
20193 | generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName, countBindings(updateOpCodes), null);
|
20194 | }
|
20195 | }
|
20196 | tView.data[index] = updateOpCodes;
|
20197 | }
|
20198 | }
|
20199 |
|
20200 |
|
20201 |
|
20202 |
|
20203 |
|
20204 |
|
20205 |
|
20206 |
|
20207 |
|
20208 |
|
20209 |
|
20210 | function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, bindingStart, sanitizeFn) {
|
20211 | ngDevMode &&
|
20212 | assertGreaterThanOrEqual(destinationNode, HEADER_OFFSET, 'Index must be in absolute LView offset');
|
20213 | const maskIndex = updateOpCodes.length;
|
20214 | const sizeIndex = maskIndex + 1;
|
20215 | updateOpCodes.push(null, null);
|
20216 | const startIndex = maskIndex + 2;
|
20217 | if (ngDevMode) {
|
20218 | attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
|
20219 | }
|
20220 | const textParts = str.split(BINDING_REGEXP);
|
20221 | let mask = 0;
|
20222 | for (let j = 0; j < textParts.length; j++) {
|
20223 | const textValue = textParts[j];
|
20224 | if (j & 1) {
|
20225 |
|
20226 | const bindingIndex = bindingStart + parseInt(textValue, 10);
|
20227 | updateOpCodes.push(-1 - bindingIndex);
|
20228 | mask = mask | toMaskBit(bindingIndex);
|
20229 | }
|
20230 | else if (textValue !== '') {
|
20231 |
|
20232 | updateOpCodes.push(textValue);
|
20233 | }
|
20234 | }
|
20235 | updateOpCodes.push(destinationNode << 2 |
|
20236 | (attrName ? 1 : 0 ));
|
20237 | if (attrName) {
|
20238 | updateOpCodes.push(attrName, sanitizeFn);
|
20239 | }
|
20240 | updateOpCodes[maskIndex] = mask;
|
20241 | updateOpCodes[sizeIndex] = updateOpCodes.length - startIndex;
|
20242 | return mask;
|
20243 | }
|
20244 |
|
20245 |
|
20246 |
|
20247 |
|
20248 |
|
20249 |
|
20250 |
|
20251 |
|
20252 |
|
20253 |
|
20254 |
|
20255 | function countBindings(opCodes) {
|
20256 | let count = 0;
|
20257 | for (let i = 0; i < opCodes.length; i++) {
|
20258 | const opCode = opCodes[i];
|
20259 |
|
20260 | if (typeof opCode === 'number' && opCode < 0) {
|
20261 | count++;
|
20262 | }
|
20263 | }
|
20264 | return count;
|
20265 | }
|
20266 |
|
20267 |
|
20268 |
|
20269 |
|
20270 |
|
20271 |
|
20272 |
|
20273 |
|
20274 | function toMaskBit(bindingIndex) {
|
20275 | return 1 << Math.min(bindingIndex, 31);
|
20276 | }
|
20277 | function isRootTemplateMessage(subTemplateIndex) {
|
20278 | return subTemplateIndex === -1;
|
20279 | }
|
20280 |
|
20281 |
|
20282 |
|
20283 | function removeInnerTemplateTranslation(message) {
|
20284 | let match;
|
20285 | let res = '';
|
20286 | let index = 0;
|
20287 | let inTemplate = false;
|
20288 | let tagMatched;
|
20289 | while ((match = SUBTEMPLATE_REGEXP.exec(message)) !== null) {
|
20290 | if (!inTemplate) {
|
20291 | res += message.substring(index, match.index + match[0].length);
|
20292 | tagMatched = match[1];
|
20293 | inTemplate = true;
|
20294 | }
|
20295 | else {
|
20296 | if (match[0] === `${MARKER}/*${tagMatched}${MARKER}`) {
|
20297 | index = match.index;
|
20298 | inTemplate = false;
|
20299 | }
|
20300 | }
|
20301 | }
|
20302 | ngDevMode &&
|
20303 | assertEqual(inTemplate, false, `Tag mismatch: unable to find the end of the sub-template in the translation "${message}"`);
|
20304 | res += message.substr(index);
|
20305 | return res;
|
20306 | }
|
20307 |
|
20308 |
|
20309 |
|
20310 |
|
20311 |
|
20312 |
|
20313 |
|
20314 |
|
20315 |
|
20316 |
|
20317 |
|
20318 |
|
20319 |
|
20320 |
|
20321 |
|
20322 | function getTranslationForTemplate(message, subTemplateIndex) {
|
20323 | if (isRootTemplateMessage(subTemplateIndex)) {
|
20324 |
|
20325 | return removeInnerTemplateTranslation(message);
|
20326 | }
|
20327 | else {
|
20328 |
|
20329 | const start = message.indexOf(`:${subTemplateIndex}${MARKER}`) + 2 + subTemplateIndex.toString().length;
|
20330 | const end = message.search(new RegExp(`${MARKER}\\/\\*\\d+:${subTemplateIndex}${MARKER}`));
|
20331 | return removeInnerTemplateTranslation(message.substring(start, end));
|
20332 | }
|
20333 | }
|
20334 |
|
20335 |
|
20336 |
|
20337 |
|
20338 |
|
20339 |
|
20340 |
|
20341 |
|
20342 | function icuStart(tView, lView, updateOpCodes, parentIdx, icuExpression, anchorIdx) {
|
20343 | ngDevMode && assertDefined(icuExpression, 'ICU expression must be defined');
|
20344 | let bindingMask = 0;
|
20345 | const tIcu = {
|
20346 | type: icuExpression.type,
|
20347 | currentCaseLViewIndex: allocExpando(tView, lView, 1, null),
|
20348 | anchorIdx,
|
20349 | cases: [],
|
20350 | create: [],
|
20351 | remove: [],
|
20352 | update: []
|
20353 | };
|
20354 | addUpdateIcuSwitch(updateOpCodes, icuExpression, anchorIdx);
|
20355 | setTIcu(tView, anchorIdx, tIcu);
|
20356 | const values = icuExpression.values;
|
20357 | for (let i = 0; i < values.length; i++) {
|
20358 |
|
20359 | const valueArr = values[i];
|
20360 | const nestedIcus = [];
|
20361 | for (let j = 0; j < valueArr.length; j++) {
|
20362 | const value = valueArr[j];
|
20363 | if (typeof value !== 'string') {
|
20364 |
|
20365 | const icuIndex = nestedIcus.push(value) - 1;
|
20366 |
|
20367 | valueArr[j] = `<!--�${icuIndex}�-->`;
|
20368 | }
|
20369 | }
|
20370 | bindingMask = parseIcuCase(tView, tIcu, lView, updateOpCodes, parentIdx, icuExpression.cases[i], valueArr.join(''), nestedIcus) |
|
20371 | bindingMask;
|
20372 | }
|
20373 | if (bindingMask) {
|
20374 | addUpdateIcuUpdate(updateOpCodes, bindingMask, anchorIdx);
|
20375 | }
|
20376 | }
|
20377 |
|
20378 |
|
20379 |
|
20380 |
|
20381 |
|
20382 |
|
20383 |
|
20384 | function parseICUBlock(pattern) {
|
20385 | const cases = [];
|
20386 | const values = [];
|
20387 | let icuType = 1 ;
|
20388 | let mainBinding = 0;
|
20389 | pattern = pattern.replace(ICU_BLOCK_REGEXP, function (str, binding, type) {
|
20390 | if (type === 'select') {
|
20391 | icuType = 0 ;
|
20392 | }
|
20393 | else {
|
20394 | icuType = 1 ;
|
20395 | }
|
20396 | mainBinding = parseInt(binding.substr(1), 10);
|
20397 | return '';
|
20398 | });
|
20399 | const parts = i18nParseTextIntoPartsAndICU(pattern);
|
20400 |
|
20401 | for (let pos = 0; pos < parts.length;) {
|
20402 | let key = parts[pos++].trim();
|
20403 | if (icuType === 1 ) {
|
20404 |
|
20405 | key = key.replace(/\s*(?:=)?(\w+)\s*/, '$1');
|
20406 | }
|
20407 | if (key.length) {
|
20408 | cases.push(key);
|
20409 | }
|
20410 | const blocks = i18nParseTextIntoPartsAndICU(parts[pos++]);
|
20411 | if (cases.length > values.length) {
|
20412 | values.push(blocks);
|
20413 | }
|
20414 | }
|
20415 |
|
20416 | return { type: icuType, mainBinding: mainBinding, cases, values };
|
20417 | }
|
20418 |
|
20419 |
|
20420 |
|
20421 |
|
20422 |
|
20423 |
|
20424 |
|
20425 |
|
20426 |
|
20427 |
|
20428 | function i18nParseTextIntoPartsAndICU(pattern) {
|
20429 | if (!pattern) {
|
20430 | return [];
|
20431 | }
|
20432 | let prevPos = 0;
|
20433 | const braceStack = [];
|
20434 | const results = [];
|
20435 | const braces = /[{}]/g;
|
20436 |
|
20437 | braces.lastIndex = 0;
|
20438 | let match;
|
20439 | while (match = braces.exec(pattern)) {
|
20440 | const pos = match.index;
|
20441 | if (match[0] == '}') {
|
20442 | braceStack.pop();
|
20443 | if (braceStack.length == 0) {
|
20444 |
|
20445 | const block = pattern.substring(prevPos, pos);
|
20446 | if (ICU_BLOCK_REGEXP.test(block)) {
|
20447 | results.push(parseICUBlock(block));
|
20448 | }
|
20449 | else {
|
20450 | results.push(block);
|
20451 | }
|
20452 | prevPos = pos + 1;
|
20453 | }
|
20454 | }
|
20455 | else {
|
20456 | if (braceStack.length == 0) {
|
20457 | const substring = pattern.substring(prevPos, pos);
|
20458 | results.push(substring);
|
20459 | prevPos = pos + 1;
|
20460 | }
|
20461 | braceStack.push('{');
|
20462 | }
|
20463 | }
|
20464 | const substring = pattern.substring(prevPos);
|
20465 | results.push(substring);
|
20466 | return results;
|
20467 | }
|
20468 |
|
20469 |
|
20470 |
|
20471 |
|
20472 | function parseIcuCase(tView, tIcu, lView, updateOpCodes, parentIdx, caseName, unsafeCaseHtml, nestedIcus) {
|
20473 | const create = [];
|
20474 | const remove = [];
|
20475 | const update = [];
|
20476 | if (ngDevMode) {
|
20477 | attachDebugGetter(create, icuCreateOpCodesToString);
|
20478 | attachDebugGetter(remove, i18nRemoveOpCodesToString);
|
20479 | attachDebugGetter(update, i18nUpdateOpCodesToString);
|
20480 | }
|
20481 | tIcu.cases.push(caseName);
|
20482 | tIcu.create.push(create);
|
20483 | tIcu.remove.push(remove);
|
20484 | tIcu.update.push(update);
|
20485 | const inertBodyHelper = getInertBodyHelper(getDocument());
|
20486 | const inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeCaseHtml);
|
20487 | ngDevMode && assertDefined(inertBodyElement, 'Unable to generate inert body element');
|
20488 | const inertRootNode = getTemplateContent(inertBodyElement) || inertBodyElement;
|
20489 | if (inertRootNode) {
|
20490 | return walkIcuTree(tView, tIcu, lView, updateOpCodes, create, remove, update, inertRootNode, parentIdx, nestedIcus, 0);
|
20491 | }
|
20492 | else {
|
20493 | return 0;
|
20494 | }
|
20495 | }
|
20496 | function walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove, update, parentNode, parentIdx, nestedIcus, depth) {
|
20497 | let bindingMask = 0;
|
20498 | let currentNode = parentNode.firstChild;
|
20499 | while (currentNode) {
|
20500 | const newIndex = allocExpando(tView, lView, 1, null);
|
20501 | switch (currentNode.nodeType) {
|
20502 | case Node.ELEMENT_NODE:
|
20503 | const element = currentNode;
|
20504 | const tagName = element.tagName.toLowerCase();
|
20505 | if (VALID_ELEMENTS.hasOwnProperty(tagName)) {
|
20506 | addCreateNodeAndAppend(create, ELEMENT_MARKER, tagName, parentIdx, newIndex);
|
20507 | tView.data[newIndex] = tagName;
|
20508 | const elAttrs = element.attributes;
|
20509 | for (let i = 0; i < elAttrs.length; i++) {
|
20510 | const attr = elAttrs.item(i);
|
20511 | const lowerAttrName = attr.name.toLowerCase();
|
20512 | const hasBinding = !!attr.value.match(BINDING_REGEXP);
|
20513 |
|
20514 | if (hasBinding) {
|
20515 | if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
|
20516 | if (URI_ATTRS[lowerAttrName]) {
|
20517 | generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, _sanitizeUrl);
|
20518 | }
|
20519 | else if (SRCSET_ATTRS[lowerAttrName]) {
|
20520 | generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, sanitizeSrcset);
|
20521 | }
|
20522 | else {
|
20523 | generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
|
20524 | }
|
20525 | }
|
20526 | else {
|
20527 | ngDevMode &&
|
20528 | console.warn(`WARNING: ignoring unsafe attribute value ` +
|
20529 | `${lowerAttrName} on element ${tagName} ` +
|
20530 | `(see https://g.co/ng/security#xss)`);
|
20531 | }
|
20532 | }
|
20533 | else {
|
20534 | addCreateAttribute(create, newIndex, attr);
|
20535 | }
|
20536 | }
|
20537 |
|
20538 | bindingMask = walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove, update, currentNode, newIndex, nestedIcus, depth + 1) |
|
20539 | bindingMask;
|
20540 | addRemoveNode(remove, newIndex, depth);
|
20541 | }
|
20542 | break;
|
20543 | case Node.TEXT_NODE:
|
20544 | const value = currentNode.textContent || '';
|
20545 | const hasBinding = value.match(BINDING_REGEXP);
|
20546 | addCreateNodeAndAppend(create, null, hasBinding ? '' : value, parentIdx, newIndex);
|
20547 | addRemoveNode(remove, newIndex, depth);
|
20548 | if (hasBinding) {
|
20549 | bindingMask =
|
20550 | generateBindingUpdateOpCodes(update, value, newIndex, null, 0, null) | bindingMask;
|
20551 | }
|
20552 | break;
|
20553 | case Node.COMMENT_NODE:
|
20554 |
|
20555 | const isNestedIcu = NESTED_ICU.exec(currentNode.textContent || '');
|
20556 | if (isNestedIcu) {
|
20557 | const nestedIcuIndex = parseInt(isNestedIcu[1], 10);
|
20558 | const icuExpression = nestedIcus[nestedIcuIndex];
|
20559 |
|
20560 | addCreateNodeAndAppend(create, ICU_MARKER, ngDevMode ? `nested ICU ${nestedIcuIndex}` : '', parentIdx, newIndex);
|
20561 | icuStart(tView, lView, sharedUpdateOpCodes, parentIdx, icuExpression, newIndex);
|
20562 | addRemoveNestedIcu(remove, newIndex, depth);
|
20563 | }
|
20564 | break;
|
20565 | }
|
20566 | currentNode = currentNode.nextSibling;
|
20567 | }
|
20568 | return bindingMask;
|
20569 | }
|
20570 | function addRemoveNode(remove, index, depth) {
|
20571 | if (depth === 0) {
|
20572 | remove.push(index);
|
20573 | }
|
20574 | }
|
20575 | function addRemoveNestedIcu(remove, index, depth) {
|
20576 | if (depth === 0) {
|
20577 | remove.push(~index);
|
20578 | remove.push(index);
|
20579 | }
|
20580 | }
|
20581 | function addUpdateIcuSwitch(update, icuExpression, index) {
|
20582 | update.push(toMaskBit(icuExpression.mainBinding), 2, -1 - icuExpression.mainBinding, index << 2 | 2 );
|
20583 | }
|
20584 | function addUpdateIcuUpdate(update, bindingMask, index) {
|
20585 | update.push(bindingMask, 1, index << 2 | 3 );
|
20586 | }
|
20587 | function addCreateNodeAndAppend(create, marker, text, appendToParentIdx, createAtIdx) {
|
20588 | if (marker !== null) {
|
20589 | create.push(marker);
|
20590 | }
|
20591 | create.push(text, createAtIdx, icuCreateOpCode(0 , appendToParentIdx, createAtIdx));
|
20592 | }
|
20593 | function addCreateAttribute(create, newIndex, attr) {
|
20594 | create.push(newIndex << 1 | 1 , attr.name, attr.value);
|
20595 | }
|
20596 |
|
20597 |
|
20598 |
|
20599 |
|
20600 |
|
20601 |
|
20602 |
|
20603 |
|
20604 |
|
20605 | const ROOT_TEMPLATE_ID = 0;
|
20606 | const PP_MULTI_VALUE_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]/;
|
20607 | const PP_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]|(�\/?\*\d+:\d+�)/g;
|
20608 | const PP_ICU_VARS_REGEXP = /({\s*)(VAR_(PLURAL|SELECT)(_\d+)?)(\s*,)/g;
|
20609 | const PP_ICU_PLACEHOLDERS_REGEXP = /{([A-Z0-9_]+)}/g;
|
20610 | const PP_ICUS_REGEXP = /�I18N_EXP_(ICU(_\d+)?)�/g;
|
20611 | const PP_CLOSE_TEMPLATE_REGEXP = /\/\*/;
|
20612 | const PP_TEMPLATE_ID_REGEXP = /\d+\:(\d+)/;
|
20613 |
|
20614 |
|
20615 |
|
20616 |
|
20617 |
|
20618 |
|
20619 |
|
20620 |
|
20621 |
|
20622 |
|
20623 |
|
20624 |
|
20625 |
|
20626 |
|
20627 |
|
20628 |
|
20629 |
|
20630 |
|
20631 |
|
20632 |
|
20633 | function i18nPostprocess(message, replacements = {}) {
|
20634 | |
20635 |
|
20636 |
|
20637 |
|
20638 |
|
20639 |
|
20640 |
|
20641 |
|
20642 |
|
20643 |
|
20644 | let result = message;
|
20645 | if (PP_MULTI_VALUE_PLACEHOLDERS_REGEXP.test(message)) {
|
20646 | const matches = {};
|
20647 | const templateIdsStack = [ROOT_TEMPLATE_ID];
|
20648 | result = result.replace(PP_PLACEHOLDERS_REGEXP, (m, phs, tmpl) => {
|
20649 | const content = phs || tmpl;
|
20650 | const placeholders = matches[content] || [];
|
20651 | if (!placeholders.length) {
|
20652 | content.split('|').forEach((placeholder) => {
|
20653 | const match = placeholder.match(PP_TEMPLATE_ID_REGEXP);
|
20654 | const templateId = match ? parseInt(match[1], 10) : ROOT_TEMPLATE_ID;
|
20655 | const isCloseTemplateTag = PP_CLOSE_TEMPLATE_REGEXP.test(placeholder);
|
20656 | placeholders.push([templateId, isCloseTemplateTag, placeholder]);
|
20657 | });
|
20658 | matches[content] = placeholders;
|
20659 | }
|
20660 | if (!placeholders.length) {
|
20661 | throw new Error(`i18n postprocess: unmatched placeholder - ${content}`);
|
20662 | }
|
20663 | const currentTemplateId = templateIdsStack[templateIdsStack.length - 1];
|
20664 | let idx = 0;
|
20665 |
|
20666 | for (let i = 0; i < placeholders.length; i++) {
|
20667 | if (placeholders[i][0] === currentTemplateId) {
|
20668 | idx = i;
|
20669 | break;
|
20670 | }
|
20671 | }
|
20672 |
|
20673 | const [templateId, isCloseTemplateTag, placeholder] = placeholders[idx];
|
20674 | if (isCloseTemplateTag) {
|
20675 | templateIdsStack.pop();
|
20676 | }
|
20677 | else if (currentTemplateId !== templateId) {
|
20678 | templateIdsStack.push(templateId);
|
20679 | }
|
20680 |
|
20681 | placeholders.splice(idx, 1);
|
20682 | return placeholder;
|
20683 | });
|
20684 | }
|
20685 |
|
20686 | if (!Object.keys(replacements).length) {
|
20687 | return result;
|
20688 | }
|
20689 | |
20690 |
|
20691 |
|
20692 | result = result.replace(PP_ICU_VARS_REGEXP, (match, start, key, _type, _idx, end) => {
|
20693 | return replacements.hasOwnProperty(key) ? `${start}${replacements[key]}${end}` : match;
|
20694 | });
|
20695 | |
20696 |
|
20697 |
|
20698 | result = result.replace(PP_ICU_PLACEHOLDERS_REGEXP, (match, key) => {
|
20699 | return replacements.hasOwnProperty(key) ? replacements[key] : match;
|
20700 | });
|
20701 | |
20702 |
|
20703 |
|
20704 |
|
20705 | result = result.replace(PP_ICUS_REGEXP, (match, key) => {
|
20706 | if (replacements.hasOwnProperty(key)) {
|
20707 | const list = replacements[key];
|
20708 | if (!list.length) {
|
20709 | throw new Error(`i18n postprocess: unmatched ICU - ${match} with key: ${key}`);
|
20710 | }
|
20711 | return list.shift();
|
20712 | }
|
20713 | return match;
|
20714 | });
|
20715 | return result;
|
20716 | }
|
20717 |
|
20718 |
|
20719 |
|
20720 |
|
20721 |
|
20722 |
|
20723 |
|
20724 |
|
20725 |
|
20726 |
|
20727 |
|
20728 |
|
20729 |
|
20730 |
|
20731 |
|
20732 |
|
20733 |
|
20734 |
|
20735 |
|
20736 |
|
20737 |
|
20738 |
|
20739 |
|
20740 |
|
20741 |
|
20742 |
|
20743 |
|
20744 |
|
20745 |
|
20746 |
|
20747 |
|
20748 |
|
20749 |
|
20750 | function ɵɵi18nStart(index, messageIndex, subTemplateIndex = -1) {
|
20751 | const tView = getTView();
|
20752 | const lView = getLView();
|
20753 | const adjustedIndex = HEADER_OFFSET + index;
|
20754 | ngDevMode && assertDefined(tView, `tView should be defined`);
|
20755 | const message = getConstant(tView.consts, messageIndex);
|
20756 | const parentTNode = getCurrentParentTNode();
|
20757 | if (tView.firstCreatePass) {
|
20758 | i18nStartFirstCreatePass(tView, parentTNode === null ? 0 : parentTNode.index, lView, adjustedIndex, message, subTemplateIndex);
|
20759 | }
|
20760 | const tI18n = tView.data[adjustedIndex];
|
20761 | const sameViewParentTNode = parentTNode === lView[T_HOST] ? null : parentTNode;
|
20762 | const parentRNode = getClosestRElement(tView, sameViewParentTNode, lView);
|
20763 |
|
20764 |
|
20765 | const insertInFrontOf = parentTNode && (parentTNode.type & 8 ) ?
|
20766 | lView[parentTNode.index] :
|
20767 | null;
|
20768 | applyCreateOpCodes(lView, tI18n.create, parentRNode, insertInFrontOf);
|
20769 | setInI18nBlock(true);
|
20770 | }
|
20771 |
|
20772 |
|
20773 |
|
20774 |
|
20775 |
|
20776 |
|
20777 | function ɵɵi18nEnd() {
|
20778 | setInI18nBlock(false);
|
20779 | }
|
20780 |
|
20781 |
|
20782 |
|
20783 |
|
20784 |
|
20785 |
|
20786 |
|
20787 |
|
20788 |
|
20789 |
|
20790 |
|
20791 |
|
20792 |
|
20793 |
|
20794 |
|
20795 |
|
20796 |
|
20797 |
|
20798 |
|
20799 |
|
20800 |
|
20801 |
|
20802 |
|
20803 |
|
20804 |
|
20805 |
|
20806 | function ɵɵi18n(index, messageIndex, subTemplateIndex) {
|
20807 | ɵɵi18nStart(index, messageIndex, subTemplateIndex);
|
20808 | ɵɵi18nEnd();
|
20809 | }
|
20810 |
|
20811 |
|
20812 |
|
20813 |
|
20814 |
|
20815 |
|
20816 |
|
20817 |
|
20818 | function ɵɵi18nAttributes(index, attrsIndex) {
|
20819 | const tView = getTView();
|
20820 | ngDevMode && assertDefined(tView, `tView should be defined`);
|
20821 | const attrs = getConstant(tView.consts, attrsIndex);
|
20822 | i18nAttributesFirstPass(tView, index + HEADER_OFFSET, attrs);
|
20823 | }
|
20824 |
|
20825 |
|
20826 |
|
20827 |
|
20828 |
|
20829 |
|
20830 |
|
20831 |
|
20832 |
|
20833 |
|
20834 | function ɵɵi18nExp(value) {
|
20835 | const lView = getLView();
|
20836 | setMaskBit(bindingUpdated(lView, nextBindingIndex(), value));
|
20837 | return ɵɵi18nExp;
|
20838 | }
|
20839 |
|
20840 |
|
20841 |
|
20842 |
|
20843 |
|
20844 |
|
20845 |
|
20846 |
|
20847 | function ɵɵi18nApply(index) {
|
20848 | applyI18n(getTView(), getLView(), index + HEADER_OFFSET);
|
20849 | }
|
20850 |
|
20851 |
|
20852 |
|
20853 |
|
20854 |
|
20855 |
|
20856 |
|
20857 |
|
20858 |
|
20859 |
|
20860 |
|
20861 |
|
20862 |
|
20863 |
|
20864 |
|
20865 |
|
20866 |
|
20867 |
|
20868 |
|
20869 |
|
20870 | function ɵɵi18nPostprocess(message, replacements = {}) {
|
20871 | return i18nPostprocess(message, replacements);
|
20872 | }
|
20873 |
|
20874 |
|
20875 |
|
20876 |
|
20877 |
|
20878 |
|
20879 |
|
20880 |
|
20881 |
|
20882 |
|
20883 |
|
20884 |
|
20885 |
|
20886 |
|
20887 |
|
20888 |
|
20889 |
|
20890 |
|
20891 |
|
20892 |
|
20893 |
|
20894 |
|
20895 |
|
20896 |
|
20897 |
|
20898 |
|
20899 |
|
20900 |
|
20901 |
|
20902 |
|
20903 |
|
20904 |
|
20905 |
|
20906 |
|
20907 | function providersResolver(def, providers, viewProviders) {
|
20908 | const tView = getTView();
|
20909 | if (tView.firstCreatePass) {
|
20910 | const isComponent = isComponentDef(def);
|
20911 |
|
20912 | resolveProvider(viewProviders, tView.data, tView.blueprint, isComponent, true);
|
20913 |
|
20914 | resolveProvider(providers, tView.data, tView.blueprint, isComponent, false);
|
20915 | }
|
20916 | }
|
20917 |
|
20918 |
|
20919 |
|
20920 | function resolveProvider(provider, tInjectables, lInjectablesBlueprint, isComponent, isViewProvider) {
|
20921 | provider = resolveForwardRef(provider);
|
20922 | if (Array.isArray(provider)) {
|
20923 |
|
20924 |
|
20925 |
|
20926 | for (let i = 0; i < provider.length; i++) {
|
20927 | resolveProvider(provider[i], tInjectables, lInjectablesBlueprint, isComponent, isViewProvider);
|
20928 | }
|
20929 | }
|
20930 | else {
|
20931 | const tView = getTView();
|
20932 | const lView = getLView();
|
20933 | let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
|
20934 | let providerFactory = providerToFactory(provider);
|
20935 | const tNode = getCurrentTNode();
|
20936 | const beginIndex = tNode.providerIndexes & 1048575 ;
|
20937 | const endIndex = tNode.directiveStart;
|
20938 | const cptViewProvidersCount = tNode.providerIndexes >> 20 ;
|
20939 | if (isTypeProvider(provider) || !provider.multi) {
|
20940 |
|
20941 | const factory = new NodeInjectorFactory(providerFactory, isViewProvider, ɵɵdirectiveInject);
|
20942 | const existingFactoryIndex = indexOf(token, tInjectables, isViewProvider ? beginIndex : beginIndex + cptViewProvidersCount, endIndex);
|
20943 | if (existingFactoryIndex === -1) {
|
20944 | diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
|
20945 | registerDestroyHooksIfSupported(tView, provider, tInjectables.length);
|
20946 | tInjectables.push(token);
|
20947 | tNode.directiveStart++;
|
20948 | tNode.directiveEnd++;
|
20949 | if (isViewProvider) {
|
20950 | tNode.providerIndexes += 1048576 ;
|
20951 | }
|
20952 | lInjectablesBlueprint.push(factory);
|
20953 | lView.push(factory);
|
20954 | }
|
20955 | else {
|
20956 | lInjectablesBlueprint[existingFactoryIndex] = factory;
|
20957 | lView[existingFactoryIndex] = factory;
|
20958 | }
|
20959 | }
|
20960 | else {
|
20961 |
|
20962 |
|
20963 |
|
20964 |
|
20965 |
|
20966 |
|
20967 |
|
20968 |
|
20969 |
|
20970 |
|
20971 |
|
20972 |
|
20973 |
|
20974 |
|
20975 |
|
20976 |
|
20977 |
|
20978 |
|
20979 |
|
20980 |
|
20981 | const existingProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex + cptViewProvidersCount, endIndex);
|
20982 | const existingViewProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex, beginIndex + cptViewProvidersCount);
|
20983 | const doesProvidersFactoryExist = existingProvidersFactoryIndex >= 0 &&
|
20984 | lInjectablesBlueprint[existingProvidersFactoryIndex];
|
20985 | const doesViewProvidersFactoryExist = existingViewProvidersFactoryIndex >= 0 &&
|
20986 | lInjectablesBlueprint[existingViewProvidersFactoryIndex];
|
20987 | if (isViewProvider && !doesViewProvidersFactoryExist ||
|
20988 | !isViewProvider && !doesProvidersFactoryExist) {
|
20989 |
|
20990 | diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
|
20991 | const factory = multiFactory(isViewProvider ? multiViewProvidersFactoryResolver : multiProvidersFactoryResolver, lInjectablesBlueprint.length, isViewProvider, isComponent, providerFactory);
|
20992 | if (!isViewProvider && doesViewProvidersFactoryExist) {
|
20993 | lInjectablesBlueprint[existingViewProvidersFactoryIndex].providerFactory = factory;
|
20994 | }
|
20995 | registerDestroyHooksIfSupported(tView, provider, tInjectables.length, 0);
|
20996 | tInjectables.push(token);
|
20997 | tNode.directiveStart++;
|
20998 | tNode.directiveEnd++;
|
20999 | if (isViewProvider) {
|
21000 | tNode.providerIndexes += 1048576 ;
|
21001 | }
|
21002 | lInjectablesBlueprint.push(factory);
|
21003 | lView.push(factory);
|
21004 | }
|
21005 | else {
|
21006 |
|
21007 | const indexInFactory = multiFactoryAdd(lInjectablesBlueprint[isViewProvider ? existingViewProvidersFactoryIndex :
|
21008 | existingProvidersFactoryIndex], providerFactory, !isViewProvider && isComponent);
|
21009 | registerDestroyHooksIfSupported(tView, provider, existingProvidersFactoryIndex > -1 ? existingProvidersFactoryIndex :
|
21010 | existingViewProvidersFactoryIndex, indexInFactory);
|
21011 | }
|
21012 | if (!isViewProvider && isComponent && doesViewProvidersFactoryExist) {
|
21013 | lInjectablesBlueprint[existingViewProvidersFactoryIndex].componentProviders++;
|
21014 | }
|
21015 | }
|
21016 | }
|
21017 | }
|
21018 |
|
21019 |
|
21020 |
|
21021 |
|
21022 |
|
21023 |
|
21024 |
|
21025 |
|
21026 | function registerDestroyHooksIfSupported(tView, provider, contextIndex, indexInFactory) {
|
21027 | const providerIsTypeProvider = isTypeProvider(provider);
|
21028 | if (providerIsTypeProvider || isClassProvider(provider)) {
|
21029 | const prototype = (provider.useClass || provider).prototype;
|
21030 | const ngOnDestroy = prototype.ngOnDestroy;
|
21031 | if (ngOnDestroy) {
|
21032 | const hooks = tView.destroyHooks || (tView.destroyHooks = []);
|
21033 | if (!providerIsTypeProvider && provider.multi) {
|
21034 | ngDevMode &&
|
21035 | assertDefined(indexInFactory, 'indexInFactory when registering multi factory destroy hook');
|
21036 | const existingCallbacksIndex = hooks.indexOf(contextIndex);
|
21037 | if (existingCallbacksIndex === -1) {
|
21038 | hooks.push(contextIndex, [indexInFactory, ngOnDestroy]);
|
21039 | }
|
21040 | else {
|
21041 | hooks[existingCallbacksIndex + 1].push(indexInFactory, ngOnDestroy);
|
21042 | }
|
21043 | }
|
21044 | else {
|
21045 | hooks.push(contextIndex, ngOnDestroy);
|
21046 | }
|
21047 | }
|
21048 | }
|
21049 | }
|
21050 |
|
21051 |
|
21052 |
|
21053 |
|
21054 | function multiFactoryAdd(multiFactory, factory, isComponentProvider) {
|
21055 | if (isComponentProvider) {
|
21056 | multiFactory.componentProviders++;
|
21057 | }
|
21058 | return multiFactory.multi.push(factory) - 1;
|
21059 | }
|
21060 |
|
21061 |
|
21062 |
|
21063 | function indexOf(item, arr, begin, end) {
|
21064 | for (let i = begin; i < end; i++) {
|
21065 | if (arr[i] === item)
|
21066 | return i;
|
21067 | }
|
21068 | return -1;
|
21069 | }
|
21070 |
|
21071 |
|
21072 |
|
21073 | function multiProvidersFactoryResolver(_, tData, lData, tNode) {
|
21074 | return multiResolve(this.multi, []);
|
21075 | }
|
21076 |
|
21077 |
|
21078 |
|
21079 |
|
21080 |
|
21081 | function multiViewProvidersFactoryResolver(_, tData, lView, tNode) {
|
21082 | const factories = this.multi;
|
21083 | let result;
|
21084 | if (this.providerFactory) {
|
21085 | const componentCount = this.providerFactory.componentProviders;
|
21086 | const multiProviders = getNodeInjectable(lView, lView[TVIEW], this.providerFactory.index, tNode);
|
21087 |
|
21088 | result = multiProviders.slice(0, componentCount);
|
21089 |
|
21090 | multiResolve(factories, result);
|
21091 |
|
21092 | for (let i = componentCount; i < multiProviders.length; i++) {
|
21093 | result.push(multiProviders[i]);
|
21094 | }
|
21095 | }
|
21096 | else {
|
21097 | result = [];
|
21098 |
|
21099 | multiResolve(factories, result);
|
21100 | }
|
21101 | return result;
|
21102 | }
|
21103 |
|
21104 |
|
21105 |
|
21106 | function multiResolve(factories, result) {
|
21107 | for (let i = 0; i < factories.length; i++) {
|
21108 | const factory = factories[i];
|
21109 | result.push(factory());
|
21110 | }
|
21111 | return result;
|
21112 | }
|
21113 |
|
21114 |
|
21115 |
|
21116 | function multiFactory(factoryFn, index, isViewProvider, isComponent, f) {
|
21117 | const factory = new NodeInjectorFactory(factoryFn, isViewProvider, ɵɵdirectiveInject);
|
21118 | factory.multi = [];
|
21119 | factory.index = index;
|
21120 | factory.componentProviders = 0;
|
21121 | multiFactoryAdd(factory, f, isComponent && !isViewProvider);
|
21122 | return factory;
|
21123 | }
|
21124 |
|
21125 |
|
21126 |
|
21127 |
|
21128 |
|
21129 |
|
21130 |
|
21131 |
|
21132 |
|
21133 |
|
21134 |
|
21135 |
|
21136 |
|
21137 |
|
21138 |
|
21139 |
|
21140 |
|
21141 |
|
21142 |
|
21143 |
|
21144 |
|
21145 |
|
21146 |
|
21147 |
|
21148 |
|
21149 |
|
21150 |
|
21151 |
|
21152 |
|
21153 |
|
21154 |
|
21155 |
|
21156 |
|
21157 | function ɵɵProvidersFeature(providers, viewProviders = []) {
|
21158 | return (definition) => {
|
21159 | definition.providersResolver =
|
21160 | (def, processProvidersFn) => {
|
21161 | return providersResolver(def,
|
21162 | processProvidersFn ? processProvidersFn(providers) : providers,
|
21163 | viewProviders);
|
21164 | };
|
21165 | };
|
21166 | }
|
21167 |
|
21168 |
|
21169 |
|
21170 |
|
21171 |
|
21172 |
|
21173 |
|
21174 |
|
21175 |
|
21176 |
|
21177 |
|
21178 |
|
21179 |
|
21180 |
|
21181 |
|
21182 | class ComponentRef$1 {
|
21183 | }
|
21184 |
|
21185 |
|
21186 |
|
21187 |
|
21188 |
|
21189 |
|
21190 |
|
21191 |
|
21192 |
|
21193 | class ComponentFactory$1 {
|
21194 | }
|
21195 |
|
21196 |
|
21197 |
|
21198 |
|
21199 |
|
21200 |
|
21201 |
|
21202 |
|
21203 | function noComponentFactoryError(component) {
|
21204 | const error = Error(`No component factory found for ${stringify(component)}. Did you add it to @NgModule.entryComponents?`);
|
21205 | error[ERROR_COMPONENT] = component;
|
21206 | return error;
|
21207 | }
|
21208 | const ERROR_COMPONENT = 'ngComponent';
|
21209 | function getComponent(error) {
|
21210 | return error[ERROR_COMPONENT];
|
21211 | }
|
21212 | class _NullComponentFactoryResolver {
|
21213 | resolveComponentFactory(component) {
|
21214 | throw noComponentFactoryError(component);
|
21215 | }
|
21216 | }
|
21217 |
|
21218 |
|
21219 |
|
21220 |
|
21221 |
|
21222 |
|
21223 |
|
21224 |
|
21225 |
|
21226 |
|
21227 |
|
21228 |
|
21229 | class ComponentFactoryResolver$1 {
|
21230 | }
|
21231 | ComponentFactoryResolver$1.NULL = ( new _NullComponentFactoryResolver());
|
21232 | class CodegenComponentFactoryResolver {
|
21233 | constructor(factories, _parent, _ngModule) {
|
21234 | this._parent = _parent;
|
21235 | this._ngModule = _ngModule;
|
21236 | this._factories = new Map();
|
21237 | for (let i = 0; i < factories.length; i++) {
|
21238 | const factory = factories[i];
|
21239 | this._factories.set(factory.componentType, factory);
|
21240 | }
|
21241 | }
|
21242 | resolveComponentFactory(component) {
|
21243 | let factory = this._factories.get(component);
|
21244 | if (!factory && this._parent) {
|
21245 | factory = this._parent.resolveComponentFactory(component);
|
21246 | }
|
21247 | if (!factory) {
|
21248 | throw noComponentFactoryError(component);
|
21249 | }
|
21250 | return new ComponentFactoryBoundToModule(factory, this._ngModule);
|
21251 | }
|
21252 | }
|
21253 | class ComponentFactoryBoundToModule extends ComponentFactory$1 {
|
21254 | constructor(factory, ngModule) {
|
21255 | super();
|
21256 | this.factory = factory;
|
21257 | this.ngModule = ngModule;
|
21258 | this.selector = factory.selector;
|
21259 | this.componentType = factory.componentType;
|
21260 | this.ngContentSelectors = factory.ngContentSelectors;
|
21261 | this.inputs = factory.inputs;
|
21262 | this.outputs = factory.outputs;
|
21263 | }
|
21264 | create(injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
21265 | return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
|
21266 | }
|
21267 | }
|
21268 |
|
21269 |
|
21270 |
|
21271 |
|
21272 |
|
21273 |
|
21274 |
|
21275 |
|
21276 | function noop(...args) {
|
21277 |
|
21278 | }
|
21279 |
|
21280 |
|
21281 |
|
21282 |
|
21283 |
|
21284 |
|
21285 | function injectElementRef() {
|
21286 | return createElementRef(getCurrentTNode(), getLView());
|
21287 | }
|
21288 |
|
21289 |
|
21290 |
|
21291 |
|
21292 |
|
21293 |
|
21294 |
|
21295 | function createElementRef(tNode, lView) {
|
21296 | return new ElementRef(getNativeByTNode(tNode, lView));
|
21297 | }
|
21298 | const SWITCH_ELEMENT_REF_FACTORY__POST_R3__ = injectElementRef;
|
21299 | const SWITCH_ELEMENT_REF_FACTORY__PRE_R3__ = noop;
|
21300 | const SWITCH_ELEMENT_REF_FACTORY = SWITCH_ELEMENT_REF_FACTORY__POST_R3__;
|
21301 |
|
21302 |
|
21303 |
|
21304 |
|
21305 |
|
21306 |
|
21307 |
|
21308 |
|
21309 |
|
21310 |
|
21311 |
|
21312 |
|
21313 |
|
21314 |
|
21315 |
|
21316 | class ElementRef {
|
21317 | constructor(nativeElement) {
|
21318 | this.nativeElement = nativeElement;
|
21319 | }
|
21320 | }
|
21321 |
|
21322 |
|
21323 |
|
21324 |
|
21325 | ElementRef.__NG_ELEMENT_ID__ = SWITCH_ELEMENT_REF_FACTORY;
|
21326 |
|
21327 |
|
21328 |
|
21329 |
|
21330 |
|
21331 |
|
21332 | function unwrapElementRef(value) {
|
21333 | return value instanceof ElementRef ? value.nativeElement : value;
|
21334 | }
|
21335 |
|
21336 |
|
21337 |
|
21338 |
|
21339 |
|
21340 |
|
21341 |
|
21342 |
|
21343 | const Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
21344 |
|
21345 |
|
21346 |
|
21347 |
|
21348 |
|
21349 | class RendererFactory2 {
|
21350 | }
|
21351 |
|
21352 |
|
21353 |
|
21354 |
|
21355 |
|
21356 |
|
21357 |
|
21358 |
|
21359 |
|
21360 |
|
21361 |
|
21362 |
|
21363 |
|
21364 |
|
21365 |
|
21366 | class Renderer2 {
|
21367 | }
|
21368 |
|
21369 |
|
21370 |
|
21371 |
|
21372 | Renderer2.__NG_ELEMENT_ID__ = () => SWITCH_RENDERER2_FACTORY();
|
21373 | const SWITCH_RENDERER2_FACTORY__POST_R3__ = injectRenderer2;
|
21374 | const SWITCH_RENDERER2_FACTORY__PRE_R3__ = noop;
|
21375 | const SWITCH_RENDERER2_FACTORY = SWITCH_RENDERER2_FACTORY__POST_R3__;
|
21376 |
|
21377 | function getOrCreateRenderer2(lView) {
|
21378 | const renderer = lView[RENDERER];
|
21379 | if (ngDevMode && !isProceduralRenderer(renderer)) {
|
21380 | throw new Error('Cannot inject Renderer2 when the application uses Renderer3!');
|
21381 | }
|
21382 | return renderer;
|
21383 | }
|
21384 |
|
21385 | function injectRenderer2() {
|
21386 |
|
21387 |
|
21388 | const lView = getLView();
|
21389 | const tNode = getCurrentTNode();
|
21390 | const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
|
21391 | return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView);
|
21392 | }
|
21393 |
|
21394 |
|
21395 |
|
21396 |
|
21397 |
|
21398 |
|
21399 |
|
21400 |
|
21401 |
|
21402 |
|
21403 |
|
21404 |
|
21405 |
|
21406 | class Sanitizer {
|
21407 | }
|
21408 |
|
21409 | Sanitizer.ɵprov = ɵɵdefineInjectable({
|
21410 | token: Sanitizer,
|
21411 | providedIn: 'root',
|
21412 | factory: () => null,
|
21413 | });
|
21414 |
|
21415 |
|
21416 |
|
21417 |
|
21418 |
|
21419 |
|
21420 |
|
21421 |
|
21422 |
|
21423 |
|
21424 |
|
21425 |
|
21426 |
|
21427 | class Version {
|
21428 | constructor(full) {
|
21429 | this.full = full;
|
21430 | this.major = full.split('.')[0];
|
21431 | this.minor = full.split('.')[1];
|
21432 | this.patch = full.split('.').slice(2).join('.');
|
21433 | }
|
21434 | }
|
21435 |
|
21436 |
|
21437 |
|
21438 | const VERSION = new Version('13.0.2');
|
21439 |
|
21440 |
|
21441 |
|
21442 |
|
21443 |
|
21444 |
|
21445 |
|
21446 |
|
21447 |
|
21448 |
|
21449 |
|
21450 |
|
21451 |
|
21452 |
|
21453 |
|
21454 |
|
21455 |
|
21456 |
|
21457 |
|
21458 |
|
21459 |
|
21460 |
|
21461 |
|
21462 |
|
21463 |
|
21464 | const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
|
21465 |
|
21466 |
|
21467 |
|
21468 |
|
21469 |
|
21470 |
|
21471 |
|
21472 |
|
21473 | function collectNativeNodes(tView, lView, tNode, result, isProjection = false) {
|
21474 | while (tNode !== null) {
|
21475 | ngDevMode &&
|
21476 | assertTNodeType(tNode, 3 | 12 | 16 | 32 );
|
21477 | const lNode = lView[tNode.index];
|
21478 | if (lNode !== null) {
|
21479 | result.push(unwrapRNode(lNode));
|
21480 | }
|
21481 |
|
21482 |
|
21483 |
|
21484 | if (isLContainer(lNode)) {
|
21485 | for (let i = CONTAINER_HEADER_OFFSET; i < lNode.length; i++) {
|
21486 | const lViewInAContainer = lNode[i];
|
21487 | const lViewFirstChildTNode = lViewInAContainer[TVIEW].firstChild;
|
21488 | if (lViewFirstChildTNode !== null) {
|
21489 | collectNativeNodes(lViewInAContainer[TVIEW], lViewInAContainer, lViewFirstChildTNode, result);
|
21490 | }
|
21491 | }
|
21492 | }
|
21493 | const tNodeType = tNode.type;
|
21494 | if (tNodeType & 8 ) {
|
21495 | collectNativeNodes(tView, lView, tNode.child, result);
|
21496 | }
|
21497 | else if (tNodeType & 32 ) {
|
21498 | const nextRNode = icuContainerIterate(tNode, lView);
|
21499 | let rNode;
|
21500 | while (rNode = nextRNode()) {
|
21501 | result.push(rNode);
|
21502 | }
|
21503 | }
|
21504 | else if (tNodeType & 16 ) {
|
21505 | const nodesInSlot = getProjectionNodes(lView, tNode);
|
21506 | if (Array.isArray(nodesInSlot)) {
|
21507 | result.push(...nodesInSlot);
|
21508 | }
|
21509 | else {
|
21510 | const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]);
|
21511 | ngDevMode && assertParentView(parentView);
|
21512 | collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true);
|
21513 | }
|
21514 | }
|
21515 | tNode = isProjection ? tNode.projectionNext : tNode.next;
|
21516 | }
|
21517 | return result;
|
21518 | }
|
21519 |
|
21520 |
|
21521 |
|
21522 |
|
21523 |
|
21524 |
|
21525 |
|
21526 |
|
21527 | class ViewRef$1 {
|
21528 | constructor(
|
21529 | /**
|
21530 | * This represents `LView` associated with the component when ViewRef is a ChangeDetectorRef.
|
21531 | *
|
21532 | * When ViewRef is created for a dynamic component, this also represents the `LView` for the
|
21533 | * component.
|
21534 | *
|
21535 | * For a "regular" ViewRef created for an embedded view, this is the `LView` for the embedded
|
21536 | * view.
|
21537 | *
|
21538 | * @internal
|
21539 | */
|
21540 | _lView,
|
21541 | /**
|
21542 | * This represents the `LView` associated with the point where `ChangeDetectorRef` was
|
21543 | * requested.
|
21544 | *
|
21545 | * This may be different from `_lView` if the `_cdRefInjectingView` is an embedded view.
|
21546 | */
|
21547 | _cdRefInjectingView) {
|
21548 | this._lView = _lView;
|
21549 | this._cdRefInjectingView = _cdRefInjectingView;
|
21550 | this._appRef = null;
|
21551 | this._attachedToViewContainer = false;
|
21552 | }
|
21553 | get rootNodes() {
|
21554 | const lView = this._lView;
|
21555 | const tView = lView[TVIEW];
|
21556 | return collectNativeNodes(tView, lView, tView.firstChild, []);
|
21557 | }
|
21558 | get context() {
|
21559 | return this._lView[CONTEXT];
|
21560 | }
|
21561 | set context(value) {
|
21562 | this._lView[CONTEXT] = value;
|
21563 | }
|
21564 | get destroyed() {
|
21565 | return (this._lView[FLAGS] & 256 ) === 256 ;
|
21566 | }
|
21567 | destroy() {
|
21568 | if (this._appRef) {
|
21569 | this._appRef.detachView(this);
|
21570 | }
|
21571 | else if (this._attachedToViewContainer) {
|
21572 | const parent = this._lView[PARENT];
|
21573 | if (isLContainer(parent)) {
|
21574 | const viewRefs = parent[VIEW_REFS];
|
21575 | const index = viewRefs ? viewRefs.indexOf(this) : -1;
|
21576 | if (index > -1) {
|
21577 | ngDevMode &&
|
21578 | assertEqual(index, parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, 'An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array.');
|
21579 | detachView(parent, index);
|
21580 | removeFromArray(viewRefs, index);
|
21581 | }
|
21582 | }
|
21583 | this._attachedToViewContainer = false;
|
21584 | }
|
21585 | destroyLView(this._lView[TVIEW], this._lView);
|
21586 | }
|
21587 | onDestroy(callback) {
|
21588 | storeCleanupWithContext(this._lView[TVIEW], this._lView, null, callback);
|
21589 | }
|
21590 | |
21591 |
|
21592 |
|
21593 |
|
21594 |
|
21595 |
|
21596 |
|
21597 |
|
21598 |
|
21599 |
|
21600 |
|
21601 |
|
21602 |
|
21603 |
|
21604 |
|
21605 |
|
21606 |
|
21607 |
|
21608 |
|
21609 |
|
21610 |
|
21611 |
|
21612 |
|
21613 |
|
21614 |
|
21615 |
|
21616 |
|
21617 |
|
21618 |
|
21619 |
|
21620 |
|
21621 | markForCheck() {
|
21622 | markViewDirty(this._cdRefInjectingView || this._lView);
|
21623 | }
|
21624 | |
21625 |
|
21626 |
|
21627 |
|
21628 |
|
21629 |
|
21630 |
|
21631 |
|
21632 |
|
21633 |
|
21634 |
|
21635 |
|
21636 |
|
21637 |
|
21638 |
|
21639 |
|
21640 |
|
21641 |
|
21642 |
|
21643 |
|
21644 |
|
21645 |
|
21646 |
|
21647 |
|
21648 |
|
21649 |
|
21650 |
|
21651 |
|
21652 |
|
21653 |
|
21654 |
|
21655 |
|
21656 |
|
21657 |
|
21658 |
|
21659 |
|
21660 |
|
21661 |
|
21662 |
|
21663 |
|
21664 |
|
21665 |
|
21666 |
|
21667 |
|
21668 |
|
21669 |
|
21670 |
|
21671 |
|
21672 |
|
21673 |
|
21674 |
|
21675 |
|
21676 |
|
21677 | detach() {
|
21678 | this._lView[FLAGS] &= ~128 ;
|
21679 | }
|
21680 | |
21681 |
|
21682 |
|
21683 |
|
21684 |
|
21685 |
|
21686 |
|
21687 |
|
21688 |
|
21689 |
|
21690 |
|
21691 |
|
21692 |
|
21693 |
|
21694 |
|
21695 |
|
21696 |
|
21697 |
|
21698 |
|
21699 |
|
21700 |
|
21701 |
|
21702 |
|
21703 |
|
21704 |
|
21705 |
|
21706 |
|
21707 |
|
21708 |
|
21709 |
|
21710 |
|
21711 |
|
21712 |
|
21713 |
|
21714 |
|
21715 |
|
21716 |
|
21717 |
|
21718 |
|
21719 |
|
21720 |
|
21721 |
|
21722 |
|
21723 |
|
21724 |
|
21725 |
|
21726 |
|
21727 |
|
21728 |
|
21729 |
|
21730 |
|
21731 |
|
21732 |
|
21733 |
|
21734 |
|
21735 |
|
21736 | reattach() {
|
21737 | this._lView[FLAGS] |= 128 ;
|
21738 | }
|
21739 | |
21740 |
|
21741 |
|
21742 |
|
21743 |
|
21744 |
|
21745 |
|
21746 |
|
21747 |
|
21748 |
|
21749 |
|
21750 |
|
21751 |
|
21752 |
|
21753 |
|
21754 |
|
21755 |
|
21756 |
|
21757 |
|
21758 |
|
21759 |
|
21760 | detectChanges() {
|
21761 | detectChangesInternal(this._lView[TVIEW], this._lView, this.context);
|
21762 | }
|
21763 | |
21764 |
|
21765 |
|
21766 |
|
21767 |
|
21768 |
|
21769 | checkNoChanges() {
|
21770 | checkNoChangesInternal(this._lView[TVIEW], this._lView, this.context);
|
21771 | }
|
21772 | attachToViewContainerRef() {
|
21773 | if (this._appRef) {
|
21774 | throw new Error('This view is already attached directly to the ApplicationRef!');
|
21775 | }
|
21776 | this._attachedToViewContainer = true;
|
21777 | }
|
21778 | detachFromAppRef() {
|
21779 | this._appRef = null;
|
21780 | renderDetachView$1(this._lView[TVIEW], this._lView);
|
21781 | }
|
21782 | attachToAppRef(appRef) {
|
21783 | if (this._attachedToViewContainer) {
|
21784 | throw new Error('This view is already attached to a ViewContainer!');
|
21785 | }
|
21786 | this._appRef = appRef;
|
21787 | }
|
21788 | }
|
21789 |
|
21790 | class RootViewRef extends ViewRef$1 {
|
21791 | constructor(_view) {
|
21792 | super(_view);
|
21793 | this._view = _view;
|
21794 | }
|
21795 | detectChanges() {
|
21796 | detectChangesInRootView(this._view);
|
21797 | }
|
21798 | checkNoChanges() {
|
21799 | checkNoChangesInRootView(this._view);
|
21800 | }
|
21801 | get context() {
|
21802 | return null;
|
21803 | }
|
21804 | }
|
21805 |
|
21806 |
|
21807 |
|
21808 |
|
21809 |
|
21810 |
|
21811 |
|
21812 |
|
21813 | class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
|
21814 | |
21815 |
|
21816 |
|
21817 | constructor(ngModule) {
|
21818 | super();
|
21819 | this.ngModule = ngModule;
|
21820 | }
|
21821 | resolveComponentFactory(component) {
|
21822 | ngDevMode && assertComponentType(component);
|
21823 | const componentDef = getComponentDef(component);
|
21824 | return new ComponentFactory(componentDef, this.ngModule);
|
21825 | }
|
21826 | }
|
21827 | function toRefArray(map) {
|
21828 | const array = [];
|
21829 | for (let nonMinified in map) {
|
21830 | if (map.hasOwnProperty(nonMinified)) {
|
21831 | const minified = map[nonMinified];
|
21832 | array.push({ propName: minified, templateName: nonMinified });
|
21833 | }
|
21834 | }
|
21835 | return array;
|
21836 | }
|
21837 | function getNamespace(elementName) {
|
21838 | const name = elementName.toLowerCase();
|
21839 | return name === 'svg' ? SVG_NAMESPACE : (name === 'math' ? MATH_ML_NAMESPACE : null);
|
21840 | }
|
21841 |
|
21842 |
|
21843 |
|
21844 |
|
21845 | const SCHEDULER = new InjectionToken('SCHEDULER_TOKEN', {
|
21846 | providedIn: 'root',
|
21847 | factory: () => defaultScheduler,
|
21848 | });
|
21849 | function createChainedInjector(rootViewInjector, moduleInjector) {
|
21850 | return {
|
21851 | get: (token, notFoundValue, flags) => {
|
21852 | const value = rootViewInjector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
|
21853 | if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
21854 | notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
21855 |
|
21856 |
|
21857 |
|
21858 |
|
21859 |
|
21860 | return value;
|
21861 | }
|
21862 | return moduleInjector.get(token, notFoundValue, flags);
|
21863 | }
|
21864 | };
|
21865 | }
|
21866 |
|
21867 |
|
21868 |
|
21869 | class ComponentFactory extends ComponentFactory$1 {
|
21870 | |
21871 |
|
21872 |
|
21873 |
|
21874 | constructor(componentDef, ngModule) {
|
21875 | super();
|
21876 | this.componentDef = componentDef;
|
21877 | this.ngModule = ngModule;
|
21878 | this.componentType = componentDef.type;
|
21879 | this.selector = stringifyCSSSelectorList(componentDef.selectors);
|
21880 | this.ngContentSelectors =
|
21881 | componentDef.ngContentSelectors ? componentDef.ngContentSelectors : [];
|
21882 | this.isBoundToModule = !!ngModule;
|
21883 | }
|
21884 | get inputs() {
|
21885 | return toRefArray(this.componentDef.inputs);
|
21886 | }
|
21887 | get outputs() {
|
21888 | return toRefArray(this.componentDef.outputs);
|
21889 | }
|
21890 | create(injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
21891 | ngModule = ngModule || this.ngModule;
|
21892 | const rootViewInjector = ngModule ? createChainedInjector(injector, ngModule.injector) : injector;
|
21893 | const rendererFactory = rootViewInjector.get(RendererFactory2, domRendererFactory3);
|
21894 | const sanitizer = rootViewInjector.get(Sanitizer, null);
|
21895 | const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
|
21896 |
|
21897 |
|
21898 | const elementName = this.componentDef.selectors[0][0] || 'div';
|
21899 | const hostRNode = rootSelectorOrNode ?
|
21900 | locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :
|
21901 | createElementNode(rendererFactory.createRenderer(null, this.componentDef), elementName, getNamespace(elementName));
|
21902 | const rootFlags = this.componentDef.onPush ? 64 | 512 :
|
21903 | 16 | 512 ;
|
21904 | const rootContext = createRootContext();
|
21905 |
|
21906 | const rootTView = createTView(0 , null, null, 1, 0, null, null, null, null, null);
|
21907 | const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector);
|
21908 |
|
21909 |
|
21910 |
|
21911 |
|
21912 |
|
21913 | enterView(rootLView);
|
21914 | let component;
|
21915 | let tElementNode;
|
21916 | try {
|
21917 | const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);
|
21918 | if (hostRNode) {
|
21919 | if (rootSelectorOrNode) {
|
21920 | setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);
|
21921 | }
|
21922 | else {
|
21923 |
|
21924 |
|
21925 |
|
21926 | const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
|
21927 | if (attrs) {
|
21928 | setUpAttributes(hostRenderer, hostRNode, attrs);
|
21929 | }
|
21930 | if (classes && classes.length > 0) {
|
21931 | writeDirectClass(hostRenderer, hostRNode, classes.join(' '));
|
21932 | }
|
21933 | }
|
21934 | }
|
21935 | tElementNode = getTNode(rootTView, HEADER_OFFSET);
|
21936 | if (projectableNodes !== undefined) {
|
21937 | const projection = tElementNode.projection = [];
|
21938 | for (let i = 0; i < this.ngContentSelectors.length; i++) {
|
21939 | const nodesforSlot = projectableNodes[i];
|
21940 |
|
21941 |
|
21942 |
|
21943 |
|
21944 |
|
21945 | projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
|
21946 | }
|
21947 | }
|
21948 |
|
21949 |
|
21950 |
|
21951 | component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
|
21952 | renderView(rootTView, rootLView, null);
|
21953 | }
|
21954 | finally {
|
21955 | leaveView();
|
21956 | }
|
21957 | return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
|
21958 | }
|
21959 | }
|
21960 | const componentFactoryResolver = new ComponentFactoryResolver();
|
21961 |
|
21962 |
|
21963 |
|
21964 |
|
21965 |
|
21966 |
|
21967 |
|
21968 | function injectComponentFactoryResolver() {
|
21969 | return componentFactoryResolver;
|
21970 | }
|
21971 |
|
21972 |
|
21973 |
|
21974 |
|
21975 |
|
21976 |
|
21977 |
|
21978 |
|
21979 | class ComponentRef extends ComponentRef$1 {
|
21980 | constructor(componentType, instance, location, _rootLView, _tNode) {
|
21981 | super();
|
21982 | this.location = location;
|
21983 | this._rootLView = _rootLView;
|
21984 | this._tNode = _tNode;
|
21985 | this.instance = instance;
|
21986 | this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
|
21987 | this.componentType = componentType;
|
21988 | }
|
21989 | get injector() {
|
21990 | return new NodeInjector(this._tNode, this._rootLView);
|
21991 | }
|
21992 | destroy() {
|
21993 | this.hostView.destroy();
|
21994 | }
|
21995 | onDestroy(callback) {
|
21996 | this.hostView.onDestroy(callback);
|
21997 | }
|
21998 | }
|
21999 |
|
22000 |
|
22001 |
|
22002 |
|
22003 |
|
22004 |
|
22005 |
|
22006 |
|
22007 |
|
22008 |
|
22009 |
|
22010 |
|
22011 |
|
22012 |
|
22013 |
|
22014 |
|
22015 |
|
22016 | function setClassMetadata(type, decorators, ctorParameters, propDecorators) {
|
22017 | return noSideEffects(() => {
|
22018 | const clazz = type;
|
22019 | if (decorators !== null) {
|
22020 | if (clazz.hasOwnProperty('decorators') && clazz.decorators !== undefined) {
|
22021 | clazz.decorators.push(...decorators);
|
22022 | }
|
22023 | else {
|
22024 | clazz.decorators = decorators;
|
22025 | }
|
22026 | }
|
22027 | if (ctorParameters !== null) {
|
22028 |
|
22029 |
|
22030 |
|
22031 | clazz.ctorParameters = ctorParameters;
|
22032 | }
|
22033 | if (propDecorators !== null) {
|
22034 |
|
22035 |
|
22036 |
|
22037 |
|
22038 | if (clazz.hasOwnProperty('propDecorators') && clazz.propDecorators !== undefined) {
|
22039 | clazz.propDecorators = { ...clazz.propDecorators, ...propDecorators };
|
22040 | }
|
22041 | else {
|
22042 | clazz.propDecorators = propDecorators;
|
22043 | }
|
22044 | }
|
22045 | });
|
22046 | }
|
22047 |
|
22048 |
|
22049 |
|
22050 |
|
22051 |
|
22052 |
|
22053 |
|
22054 |
|
22055 |
|
22056 |
|
22057 |
|
22058 |
|
22059 |
|
22060 |
|
22061 | class NgModuleRef$1 {
|
22062 | }
|
22063 |
|
22064 |
|
22065 |
|
22066 |
|
22067 |
|
22068 |
|
22069 |
|
22070 |
|
22071 |
|
22072 |
|
22073 |
|
22074 | class NgModuleFactory$1 {
|
22075 | }
|
22076 |
|
22077 |
|
22078 |
|
22079 |
|
22080 |
|
22081 |
|
22082 |
|
22083 |
|
22084 |
|
22085 |
|
22086 |
|
22087 |
|
22088 |
|
22089 | const modules = new Map();
|
22090 |
|
22091 |
|
22092 |
|
22093 |
|
22094 | function registerModuleFactory(id, factory) {
|
22095 | const existing = modules.get(id);
|
22096 | assertSameOrNotExisting(id, existing && existing.moduleType, factory.moduleType);
|
22097 | modules.set(id, factory);
|
22098 | }
|
22099 | function assertSameOrNotExisting(id, type, incoming) {
|
22100 | if (type && type !== incoming) {
|
22101 | throw new Error(`Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}`);
|
22102 | }
|
22103 | }
|
22104 | function registerNgModuleType(ngModuleType) {
|
22105 | const visited = new Set();
|
22106 | recurse(ngModuleType);
|
22107 | function recurse(ngModuleType) {
|
22108 |
|
22109 |
|
22110 | const def = getNgModuleDef(ngModuleType, true);
|
22111 | const id = def.id;
|
22112 | if (id !== null) {
|
22113 | const existing = modules.get(id);
|
22114 | assertSameOrNotExisting(id, existing, ngModuleType);
|
22115 | modules.set(id, ngModuleType);
|
22116 | }
|
22117 | const imports = maybeUnwrapFn(def.imports);
|
22118 | for (const i of imports) {
|
22119 | if (!visited.has(i)) {
|
22120 | visited.add(i);
|
22121 | recurse(i);
|
22122 | }
|
22123 | }
|
22124 | }
|
22125 | }
|
22126 | function clearModulesForTest() {
|
22127 | modules.clear();
|
22128 | }
|
22129 | function getRegisteredNgModuleType(id) {
|
22130 | return (modules.get(id) || autoRegisterModuleById[id]);
|
22131 | }
|
22132 |
|
22133 |
|
22134 |
|
22135 |
|
22136 |
|
22137 |
|
22138 |
|
22139 |
|
22140 | function createNgModuleRef__PRE_R3__(ngModule, parentInjector) {
|
22141 | throw new Error(`This API is Ivy-only and is not supported in ViewEngine`);
|
22142 | }
|
22143 | function createNgModuleRef__POST_R3__(ngModule, parentInjector) {
|
22144 | return new NgModuleRef(ngModule, parentInjector ?? null);
|
22145 | }
|
22146 |
|
22147 |
|
22148 |
|
22149 |
|
22150 |
|
22151 |
|
22152 |
|
22153 | const createNgModuleRef$1 = createNgModuleRef__POST_R3__;
|
22154 | class NgModuleRef extends NgModuleRef$1 {
|
22155 | constructor(ngModuleType, _parent) {
|
22156 | super();
|
22157 | this._parent = _parent;
|
22158 |
|
22159 | this._bootstrapComponents = [];
|
22160 | this.injector = this;
|
22161 | this.destroyCbs = [];
|
22162 |
|
22163 |
|
22164 |
|
22165 |
|
22166 |
|
22167 |
|
22168 | this.componentFactoryResolver = new ComponentFactoryResolver(this);
|
22169 | const ngModuleDef = getNgModuleDef(ngModuleType);
|
22170 | ngDevMode &&
|
22171 | assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
|
22172 | this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
|
22173 | this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
|
22174 | { provide: NgModuleRef$1, useValue: this }, {
|
22175 | provide: ComponentFactoryResolver$1,
|
22176 | useValue: this.componentFactoryResolver
|
22177 | }
|
22178 | ], stringify(ngModuleType));
|
22179 |
|
22180 |
|
22181 |
|
22182 | this._r3Injector._resolveInjectorDefTypes();
|
22183 | this.instance = this.get(ngModuleType);
|
22184 | }
|
22185 | get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
|
22186 | if (token === Injector || token === NgModuleRef$1 || token === INJECTOR) {
|
22187 | return this;
|
22188 | }
|
22189 | return this._r3Injector.get(token, notFoundValue, injectFlags);
|
22190 | }
|
22191 | destroy() {
|
22192 | ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
|
22193 | const injector = this._r3Injector;
|
22194 | !injector.destroyed && injector.destroy();
|
22195 | this.destroyCbs.forEach(fn => fn());
|
22196 | this.destroyCbs = null;
|
22197 | }
|
22198 | onDestroy(callback) {
|
22199 | ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
|
22200 | this.destroyCbs.push(callback);
|
22201 | }
|
22202 | }
|
22203 | class NgModuleFactory extends NgModuleFactory$1 {
|
22204 | constructor(moduleType) {
|
22205 | super();
|
22206 | this.moduleType = moduleType;
|
22207 | const ngModuleDef = getNgModuleDef(moduleType);
|
22208 | if (ngModuleDef !== null) {
|
22209 |
|
22210 |
|
22211 |
|
22212 |
|
22213 |
|
22214 |
|
22215 |
|
22216 |
|
22217 |
|
22218 |
|
22219 |
|
22220 |
|
22221 |
|
22222 |
|
22223 |
|
22224 |
|
22225 |
|
22226 |
|
22227 |
|
22228 |
|
22229 |
|
22230 |
|
22231 |
|
22232 | registerNgModuleType(moduleType);
|
22233 | }
|
22234 | }
|
22235 | create(parentInjector) {
|
22236 | return new NgModuleRef(this.moduleType, parentInjector);
|
22237 | }
|
22238 | }
|
22239 |
|
22240 |
|
22241 |
|
22242 |
|
22243 |
|
22244 |
|
22245 |
|
22246 |
|
22247 |
|
22248 |
|
22249 |
|
22250 |
|
22251 |
|
22252 |
|
22253 |
|
22254 |
|
22255 |
|
22256 |
|
22257 |
|
22258 |
|
22259 |
|
22260 |
|
22261 |
|
22262 |
|
22263 |
|
22264 |
|
22265 |
|
22266 |
|
22267 |
|
22268 |
|
22269 |
|
22270 |
|
22271 |
|
22272 |
|
22273 |
|
22274 |
|
22275 | function ɵɵpureFunction0(slotOffset, pureFn, thisArg) {
|
22276 | const bindingIndex = getBindingRoot() + slotOffset;
|
22277 | const lView = getLView();
|
22278 | return lView[bindingIndex] === NO_CHANGE ?
|
22279 | updateBinding(lView, bindingIndex, thisArg ? pureFn.call(thisArg) : pureFn()) :
|
22280 | getBinding(lView, bindingIndex);
|
22281 | }
|
22282 |
|
22283 |
|
22284 |
|
22285 |
|
22286 |
|
22287 |
|
22288 |
|
22289 |
|
22290 |
|
22291 |
|
22292 |
|
22293 |
|
22294 | function ɵɵpureFunction1(slotOffset, pureFn, exp, thisArg) {
|
22295 | return pureFunction1Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp, thisArg);
|
22296 | }
|
22297 |
|
22298 |
|
22299 |
|
22300 |
|
22301 |
|
22302 |
|
22303 |
|
22304 |
|
22305 |
|
22306 |
|
22307 |
|
22308 |
|
22309 |
|
22310 | function ɵɵpureFunction2(slotOffset, pureFn, exp1, exp2, thisArg) {
|
22311 | return pureFunction2Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, thisArg);
|
22312 | }
|
22313 |
|
22314 |
|
22315 |
|
22316 |
|
22317 |
|
22318 |
|
22319 |
|
22320 |
|
22321 |
|
22322 |
|
22323 |
|
22324 |
|
22325 |
|
22326 |
|
22327 | function ɵɵpureFunction3(slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
|
22328 | return pureFunction3Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, thisArg);
|
22329 | }
|
22330 |
|
22331 |
|
22332 |
|
22333 |
|
22334 |
|
22335 |
|
22336 |
|
22337 |
|
22338 |
|
22339 |
|
22340 |
|
22341 |
|
22342 |
|
22343 |
|
22344 |
|
22345 | function ɵɵpureFunction4(slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
|
22346 | return pureFunction4Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg);
|
22347 | }
|
22348 |
|
22349 |
|
22350 |
|
22351 |
|
22352 |
|
22353 |
|
22354 |
|
22355 |
|
22356 |
|
22357 |
|
22358 |
|
22359 |
|
22360 |
|
22361 |
|
22362 |
|
22363 |
|
22364 | function ɵɵpureFunction5(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, thisArg) {
|
22365 | const bindingIndex = getBindingRoot() + slotOffset;
|
22366 | const lView = getLView();
|
22367 | const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
|
22368 | return bindingUpdated(lView, bindingIndex + 4, exp5) || different ?
|
22369 | updateBinding(lView, bindingIndex + 5, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5) :
|
22370 | pureFn(exp1, exp2, exp3, exp4, exp5)) :
|
22371 | getBinding(lView, bindingIndex + 5);
|
22372 | }
|
22373 |
|
22374 |
|
22375 |
|
22376 |
|
22377 |
|
22378 |
|
22379 |
|
22380 |
|
22381 |
|
22382 |
|
22383 |
|
22384 |
|
22385 |
|
22386 |
|
22387 |
|
22388 |
|
22389 |
|
22390 | function ɵɵpureFunction6(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, thisArg) {
|
22391 | const bindingIndex = getBindingRoot() + slotOffset;
|
22392 | const lView = getLView();
|
22393 | const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
|
22394 | return bindingUpdated2(lView, bindingIndex + 4, exp5, exp6) || different ?
|
22395 | updateBinding(lView, bindingIndex + 6, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6) :
|
22396 | pureFn(exp1, exp2, exp3, exp4, exp5, exp6)) :
|
22397 | getBinding(lView, bindingIndex + 6);
|
22398 | }
|
22399 |
|
22400 |
|
22401 |
|
22402 |
|
22403 |
|
22404 |
|
22405 |
|
22406 |
|
22407 |
|
22408 |
|
22409 |
|
22410 |
|
22411 |
|
22412 |
|
22413 |
|
22414 |
|
22415 |
|
22416 |
|
22417 | function ɵɵpureFunction7(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, thisArg) {
|
22418 | const bindingIndex = getBindingRoot() + slotOffset;
|
22419 | const lView = getLView();
|
22420 | let different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
|
22421 | return bindingUpdated3(lView, bindingIndex + 4, exp5, exp6, exp7) || different ?
|
22422 | updateBinding(lView, bindingIndex + 7, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7) :
|
22423 | pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7)) :
|
22424 | getBinding(lView, bindingIndex + 7);
|
22425 | }
|
22426 |
|
22427 |
|
22428 |
|
22429 |
|
22430 |
|
22431 |
|
22432 |
|
22433 |
|
22434 |
|
22435 |
|
22436 |
|
22437 |
|
22438 |
|
22439 |
|
22440 |
|
22441 |
|
22442 |
|
22443 |
|
22444 |
|
22445 | function ɵɵpureFunction8(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, thisArg) {
|
22446 | const bindingIndex = getBindingRoot() + slotOffset;
|
22447 | const lView = getLView();
|
22448 | const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
|
22449 | return bindingUpdated4(lView, bindingIndex + 4, exp5, exp6, exp7, exp8) || different ?
|
22450 | updateBinding(lView, bindingIndex + 8, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8) :
|
22451 | pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8)) :
|
22452 | getBinding(lView, bindingIndex + 8);
|
22453 | }
|
22454 |
|
22455 |
|
22456 |
|
22457 |
|
22458 |
|
22459 |
|
22460 |
|
22461 |
|
22462 |
|
22463 |
|
22464 |
|
22465 |
|
22466 |
|
22467 |
|
22468 |
|
22469 | function ɵɵpureFunctionV(slotOffset, pureFn, exps, thisArg) {
|
22470 | return pureFunctionVInternal(getLView(), getBindingRoot(), slotOffset, pureFn, exps, thisArg);
|
22471 | }
|
22472 |
|
22473 |
|
22474 |
|
22475 |
|
22476 |
|
22477 |
|
22478 |
|
22479 | function getPureFunctionReturnValue(lView, returnValueIndex) {
|
22480 | ngDevMode && assertIndexInRange(lView, returnValueIndex);
|
22481 | const lastReturnValue = lView[returnValueIndex];
|
22482 | return lastReturnValue === NO_CHANGE ? undefined : lastReturnValue;
|
22483 | }
|
22484 |
|
22485 |
|
22486 |
|
22487 |
|
22488 |
|
22489 |
|
22490 |
|
22491 |
|
22492 |
|
22493 |
|
22494 |
|
22495 |
|
22496 | function pureFunction1Internal(lView, bindingRoot, slotOffset, pureFn, exp, thisArg) {
|
22497 | const bindingIndex = bindingRoot + slotOffset;
|
22498 | return bindingUpdated(lView, bindingIndex, exp) ?
|
22499 | updateBinding(lView, bindingIndex + 1, thisArg ? pureFn.call(thisArg, exp) : pureFn(exp)) :
|
22500 | getPureFunctionReturnValue(lView, bindingIndex + 1);
|
22501 | }
|
22502 |
|
22503 |
|
22504 |
|
22505 |
|
22506 |
|
22507 |
|
22508 |
|
22509 |
|
22510 |
|
22511 |
|
22512 |
|
22513 |
|
22514 |
|
22515 | function pureFunction2Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, thisArg) {
|
22516 | const bindingIndex = bindingRoot + slotOffset;
|
22517 | return bindingUpdated2(lView, bindingIndex, exp1, exp2) ?
|
22518 | updateBinding(lView, bindingIndex + 2, thisArg ? pureFn.call(thisArg, exp1, exp2) : pureFn(exp1, exp2)) :
|
22519 | getPureFunctionReturnValue(lView, bindingIndex + 2);
|
22520 | }
|
22521 |
|
22522 |
|
22523 |
|
22524 |
|
22525 |
|
22526 |
|
22527 |
|
22528 |
|
22529 |
|
22530 |
|
22531 |
|
22532 |
|
22533 |
|
22534 |
|
22535 | function pureFunction3Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
|
22536 | const bindingIndex = bindingRoot + slotOffset;
|
22537 | return bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) ?
|
22538 | updateBinding(lView, bindingIndex + 3, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3) : pureFn(exp1, exp2, exp3)) :
|
22539 | getPureFunctionReturnValue(lView, bindingIndex + 3);
|
22540 | }
|
22541 |
|
22542 |
|
22543 |
|
22544 |
|
22545 |
|
22546 |
|
22547 |
|
22548 |
|
22549 |
|
22550 |
|
22551 |
|
22552 |
|
22553 |
|
22554 |
|
22555 |
|
22556 |
|
22557 | function pureFunction4Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
|
22558 | const bindingIndex = bindingRoot + slotOffset;
|
22559 | return bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) ?
|
22560 | updateBinding(lView, bindingIndex + 4, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4) : pureFn(exp1, exp2, exp3, exp4)) :
|
22561 | getPureFunctionReturnValue(lView, bindingIndex + 4);
|
22562 | }
|
22563 |
|
22564 |
|
22565 |
|
22566 |
|
22567 |
|
22568 |
|
22569 |
|
22570 |
|
22571 |
|
22572 |
|
22573 |
|
22574 |
|
22575 |
|
22576 |
|
22577 |
|
22578 | function pureFunctionVInternal(lView, bindingRoot, slotOffset, pureFn, exps, thisArg) {
|
22579 | let bindingIndex = bindingRoot + slotOffset;
|
22580 | let different = false;
|
22581 | for (let i = 0; i < exps.length; i++) {
|
22582 | bindingUpdated(lView, bindingIndex++, exps[i]) && (different = true);
|
22583 | }
|
22584 | return different ? updateBinding(lView, bindingIndex, pureFn.apply(thisArg, exps)) :
|
22585 | getPureFunctionReturnValue(lView, bindingIndex);
|
22586 | }
|
22587 |
|
22588 |
|
22589 |
|
22590 |
|
22591 |
|
22592 |
|
22593 |
|
22594 |
|
22595 |
|
22596 |
|
22597 |
|
22598 |
|
22599 |
|
22600 |
|
22601 |
|
22602 |
|
22603 |
|
22604 | function ɵɵpipe(index, pipeName) {
|
22605 | const tView = getTView();
|
22606 | let pipeDef;
|
22607 | const adjustedIndex = index + HEADER_OFFSET;
|
22608 | if (tView.firstCreatePass) {
|
22609 | pipeDef = getPipeDef(pipeName, tView.pipeRegistry);
|
22610 | tView.data[adjustedIndex] = pipeDef;
|
22611 | if (pipeDef.onDestroy) {
|
22612 | (tView.destroyHooks || (tView.destroyHooks = [])).push(adjustedIndex, pipeDef.onDestroy);
|
22613 | }
|
22614 | }
|
22615 | else {
|
22616 | pipeDef = tView.data[adjustedIndex];
|
22617 | }
|
22618 | const pipeFactory = pipeDef.factory || (pipeDef.factory = getFactoryDef(pipeDef.type, true));
|
22619 | const previousInjectImplementation = setInjectImplementation(ɵɵdirectiveInject);
|
22620 | try {
|
22621 |
|
22622 |
|
22623 | const previousIncludeViewProviders = setIncludeViewProviders(false);
|
22624 | const pipeInstance = pipeFactory();
|
22625 | setIncludeViewProviders(previousIncludeViewProviders);
|
22626 | store(tView, getLView(), adjustedIndex, pipeInstance);
|
22627 | return pipeInstance;
|
22628 | }
|
22629 | finally {
|
22630 |
|
22631 |
|
22632 | setInjectImplementation(previousInjectImplementation);
|
22633 | }
|
22634 | }
|
22635 |
|
22636 |
|
22637 |
|
22638 |
|
22639 |
|
22640 |
|
22641 |
|
22642 |
|
22643 | function getPipeDef(name, registry) {
|
22644 | if (registry) {
|
22645 | for (let i = registry.length - 1; i >= 0; i--) {
|
22646 | const pipeDef = registry[i];
|
22647 | if (name === pipeDef.name) {
|
22648 | return pipeDef;
|
22649 | }
|
22650 | }
|
22651 | }
|
22652 | throw new RuntimeError("302" , `The pipe '${name}' could not be found!`);
|
22653 | }
|
22654 |
|
22655 |
|
22656 |
|
22657 |
|
22658 |
|
22659 |
|
22660 |
|
22661 |
|
22662 |
|
22663 |
|
22664 |
|
22665 |
|
22666 | function ɵɵpipeBind1(index, slotOffset, v1) {
|
22667 | const adjustedIndex = index + HEADER_OFFSET;
|
22668 | const lView = getLView();
|
22669 | const pipeInstance = load(lView, adjustedIndex);
|
22670 | return isPure(lView, adjustedIndex) ?
|
22671 | pureFunction1Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, pipeInstance) :
|
22672 | pipeInstance.transform(v1);
|
22673 | }
|
22674 |
|
22675 |
|
22676 |
|
22677 |
|
22678 |
|
22679 |
|
22680 |
|
22681 |
|
22682 |
|
22683 |
|
22684 |
|
22685 |
|
22686 |
|
22687 | function ɵɵpipeBind2(index, slotOffset, v1, v2) {
|
22688 | const adjustedIndex = index + HEADER_OFFSET;
|
22689 | const lView = getLView();
|
22690 | const pipeInstance = load(lView, adjustedIndex);
|
22691 | return isPure(lView, adjustedIndex) ?
|
22692 | pureFunction2Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, pipeInstance) :
|
22693 | pipeInstance.transform(v1, v2);
|
22694 | }
|
22695 |
|
22696 |
|
22697 |
|
22698 |
|
22699 |
|
22700 |
|
22701 |
|
22702 |
|
22703 |
|
22704 |
|
22705 |
|
22706 |
|
22707 |
|
22708 |
|
22709 | function ɵɵpipeBind3(index, slotOffset, v1, v2, v3) {
|
22710 | const adjustedIndex = index + HEADER_OFFSET;
|
22711 | const lView = getLView();
|
22712 | const pipeInstance = load(lView, adjustedIndex);
|
22713 | return isPure(lView, adjustedIndex) ?
|
22714 | pureFunction3Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) :
|
22715 | pipeInstance.transform(v1, v2, v3);
|
22716 | }
|
22717 |
|
22718 |
|
22719 |
|
22720 |
|
22721 |
|
22722 |
|
22723 |
|
22724 |
|
22725 |
|
22726 |
|
22727 |
|
22728 |
|
22729 |
|
22730 |
|
22731 |
|
22732 | function ɵɵpipeBind4(index, slotOffset, v1, v2, v3, v4) {
|
22733 | const adjustedIndex = index + HEADER_OFFSET;
|
22734 | const lView = getLView();
|
22735 | const pipeInstance = load(lView, adjustedIndex);
|
22736 | return isPure(lView, adjustedIndex) ? pureFunction4Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) :
|
22737 | pipeInstance.transform(v1, v2, v3, v4);
|
22738 | }
|
22739 |
|
22740 |
|
22741 |
|
22742 |
|
22743 |
|
22744 |
|
22745 |
|
22746 |
|
22747 |
|
22748 |
|
22749 |
|
22750 |
|
22751 | function ɵɵpipeBindV(index, slotOffset, values) {
|
22752 | const adjustedIndex = index + HEADER_OFFSET;
|
22753 | const lView = getLView();
|
22754 | const pipeInstance = load(lView, adjustedIndex);
|
22755 | return isPure(lView, adjustedIndex) ?
|
22756 | pureFunctionVInternal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, values, pipeInstance) :
|
22757 | pipeInstance.transform.apply(pipeInstance, values);
|
22758 | }
|
22759 | function isPure(lView, index) {
|
22760 | return lView[TVIEW].data[index].pure;
|
22761 | }
|
22762 |
|
22763 |
|
22764 |
|
22765 |
|
22766 |
|
22767 |
|
22768 |
|
22769 |
|
22770 | class EventEmitter_ extends Subject {
|
22771 | constructor(isAsync = false) {
|
22772 | super();
|
22773 | this.__isAsync = isAsync;
|
22774 | }
|
22775 | emit(value) {
|
22776 | super.next(value);
|
22777 | }
|
22778 | subscribe(observerOrNext, error, complete) {
|
22779 | let nextFn = observerOrNext;
|
22780 | let errorFn = error || (() => null);
|
22781 | let completeFn = complete;
|
22782 | if (observerOrNext && typeof observerOrNext === 'object') {
|
22783 | const observer = observerOrNext;
|
22784 | nextFn = observer.next?.bind(observer);
|
22785 | errorFn = observer.error?.bind(observer);
|
22786 | completeFn = observer.complete?.bind(observer);
|
22787 | }
|
22788 | if (this.__isAsync) {
|
22789 | errorFn = _wrapInTimeout(errorFn);
|
22790 | if (nextFn) {
|
22791 | nextFn = _wrapInTimeout(nextFn);
|
22792 | }
|
22793 | if (completeFn) {
|
22794 | completeFn = _wrapInTimeout(completeFn);
|
22795 | }
|
22796 | }
|
22797 | const sink = super.subscribe({ next: nextFn, error: errorFn, complete: completeFn });
|
22798 | if (observerOrNext instanceof Subscription) {
|
22799 | observerOrNext.add(sink);
|
22800 | }
|
22801 | return sink;
|
22802 | }
|
22803 | }
|
22804 | function _wrapInTimeout(fn) {
|
22805 | return (value) => {
|
22806 | setTimeout(fn, undefined, value);
|
22807 | };
|
22808 | }
|
22809 |
|
22810 |
|
22811 |
|
22812 | const EventEmitter = EventEmitter_;
|
22813 |
|
22814 |
|
22815 |
|
22816 |
|
22817 |
|
22818 |
|
22819 |
|
22820 |
|
22821 | function symbolIterator() {
|
22822 | return this._results[getSymbolIterator()]();
|
22823 | }
|
22824 |
|
22825 |
|
22826 |
|
22827 |
|
22828 |
|
22829 |
|
22830 |
|
22831 |
|
22832 |
|
22833 |
|
22834 |
|
22835 |
|
22836 |
|
22837 |
|
22838 |
|
22839 |
|
22840 |
|
22841 |
|
22842 |
|
22843 |
|
22844 |
|
22845 |
|
22846 |
|
22847 |
|
22848 |
|
22849 |
|
22850 | class QueryList {
|
22851 | |
22852 |
|
22853 |
|
22854 |
|
22855 |
|
22856 | constructor(_emitDistinctChangesOnly = false) {
|
22857 | this._emitDistinctChangesOnly = _emitDistinctChangesOnly;
|
22858 | this.dirty = true;
|
22859 | this._results = [];
|
22860 | this._changesDetected = false;
|
22861 | this._changes = null;
|
22862 | this.length = 0;
|
22863 | this.first = undefined;
|
22864 | this.last = undefined;
|
22865 |
|
22866 |
|
22867 |
|
22868 |
|
22869 | const symbol = getSymbolIterator();
|
22870 | const proto = QueryList.prototype;
|
22871 | if (!proto[symbol])
|
22872 | proto[symbol] = symbolIterator;
|
22873 | }
|
22874 | |
22875 |
|
22876 |
|
22877 | get changes() {
|
22878 | return this._changes || (this._changes = new EventEmitter());
|
22879 | }
|
22880 | |
22881 |
|
22882 |
|
22883 | get(index) {
|
22884 | return this._results[index];
|
22885 | }
|
22886 | |
22887 |
|
22888 |
|
22889 |
|
22890 | map(fn) {
|
22891 | return this._results.map(fn);
|
22892 | }
|
22893 | |
22894 |
|
22895 |
|
22896 |
|
22897 | filter(fn) {
|
22898 | return this._results.filter(fn);
|
22899 | }
|
22900 | |
22901 |
|
22902 |
|
22903 |
|
22904 | find(fn) {
|
22905 | return this._results.find(fn);
|
22906 | }
|
22907 | |
22908 |
|
22909 |
|
22910 |
|
22911 | reduce(fn, init) {
|
22912 | return this._results.reduce(fn, init);
|
22913 | }
|
22914 | |
22915 |
|
22916 |
|
22917 |
|
22918 | forEach(fn) {
|
22919 | this._results.forEach(fn);
|
22920 | }
|
22921 | |
22922 |
|
22923 |
|
22924 |
|
22925 | some(fn) {
|
22926 | return this._results.some(fn);
|
22927 | }
|
22928 | |
22929 |
|
22930 |
|
22931 | toArray() {
|
22932 | return this._results.slice();
|
22933 | }
|
22934 | toString() {
|
22935 | return this._results.toString();
|
22936 | }
|
22937 | |
22938 |
|
22939 |
|
22940 |
|
22941 |
|
22942 |
|
22943 |
|
22944 |
|
22945 |
|
22946 |
|
22947 |
|
22948 |
|
22949 | reset(resultsTree, identityAccessor) {
|
22950 |
|
22951 |
|
22952 | const self = this;
|
22953 | self.dirty = false;
|
22954 | const newResultFlat = flatten(resultsTree);
|
22955 | if (this._changesDetected = !arrayEquals(self._results, newResultFlat, identityAccessor)) {
|
22956 | self._results = newResultFlat;
|
22957 | self.length = newResultFlat.length;
|
22958 | self.last = newResultFlat[this.length - 1];
|
22959 | self.first = newResultFlat[0];
|
22960 | }
|
22961 | }
|
22962 | |
22963 |
|
22964 |
|
22965 | notifyOnChanges() {
|
22966 | if (this._changes && (this._changesDetected || !this._emitDistinctChangesOnly))
|
22967 | this._changes.emit(this);
|
22968 | }
|
22969 |
|
22970 | setDirty() {
|
22971 | this.dirty = true;
|
22972 | }
|
22973 |
|
22974 | destroy() {
|
22975 | this.changes.complete();
|
22976 | this.changes.unsubscribe();
|
22977 | }
|
22978 | }
|
22979 | Symbol.iterator;
|
22980 |
|
22981 |
|
22982 |
|
22983 |
|
22984 |
|
22985 |
|
22986 |
|
22987 |
|
22988 | const SWITCH_TEMPLATE_REF_FACTORY__POST_R3__ = injectTemplateRef;
|
22989 | const SWITCH_TEMPLATE_REF_FACTORY__PRE_R3__ = noop;
|
22990 | const SWITCH_TEMPLATE_REF_FACTORY = SWITCH_TEMPLATE_REF_FACTORY__POST_R3__;
|
22991 |
|
22992 |
|
22993 |
|
22994 |
|
22995 |
|
22996 |
|
22997 |
|
22998 |
|
22999 |
|
23000 |
|
23001 |
|
23002 |
|
23003 |
|
23004 |
|
23005 |
|
23006 |
|
23007 |
|
23008 |
|
23009 | class TemplateRef {
|
23010 | }
|
23011 |
|
23012 |
|
23013 |
|
23014 |
|
23015 | TemplateRef.__NG_ELEMENT_ID__ = SWITCH_TEMPLATE_REF_FACTORY;
|
23016 | const ViewEngineTemplateRef = TemplateRef;
|
23017 | const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
|
23018 | constructor(_declarationLView, _declarationTContainer, elementRef) {
|
23019 | super();
|
23020 | this._declarationLView = _declarationLView;
|
23021 | this._declarationTContainer = _declarationTContainer;
|
23022 | this.elementRef = elementRef;
|
23023 | }
|
23024 | createEmbeddedView(context) {
|
23025 | const embeddedTView = this._declarationTContainer.tViews;
|
23026 | const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 , null, embeddedTView.declTNode, null, null, null, null);
|
23027 | const declarationLContainer = this._declarationLView[this._declarationTContainer.index];
|
23028 | ngDevMode && assertLContainer(declarationLContainer);
|
23029 | embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
|
23030 | const declarationViewLQueries = this._declarationLView[QUERIES];
|
23031 | if (declarationViewLQueries !== null) {
|
23032 | embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView);
|
23033 | }
|
23034 | renderView(embeddedTView, embeddedLView, context);
|
23035 | return new ViewRef$1(embeddedLView);
|
23036 | }
|
23037 | };
|
23038 |
|
23039 |
|
23040 |
|
23041 |
|
23042 |
|
23043 | function injectTemplateRef() {
|
23044 | return createTemplateRef(getCurrentTNode(), getLView());
|
23045 | }
|
23046 |
|
23047 |
|
23048 |
|
23049 |
|
23050 |
|
23051 |
|
23052 |
|
23053 | function createTemplateRef(hostTNode, hostLView) {
|
23054 | if (hostTNode.type & 4 ) {
|
23055 | ngDevMode && assertDefined(hostTNode.tViews, 'TView must be allocated');
|
23056 | return new R3TemplateRef(hostLView, hostTNode, createElementRef(hostTNode, hostLView));
|
23057 | }
|
23058 | return null;
|
23059 | }
|
23060 |
|
23061 | const SWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__ = injectViewContainerRef;
|
23062 | const SWITCH_VIEW_CONTAINER_REF_FACTORY__PRE_R3__ = noop;
|
23063 | const SWITCH_VIEW_CONTAINER_REF_FACTORY = SWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__;
|
23064 |
|
23065 |
|
23066 |
|
23067 |
|
23068 |
|
23069 |
|
23070 |
|
23071 |
|
23072 |
|
23073 |
|
23074 |
|
23075 |
|
23076 |
|
23077 |
|
23078 |
|
23079 | class ViewContainerRef {
|
23080 | }
|
23081 |
|
23082 |
|
23083 |
|
23084 |
|
23085 | ViewContainerRef.__NG_ELEMENT_ID__ = SWITCH_VIEW_CONTAINER_REF_FACTORY;
|
23086 |
|
23087 |
|
23088 |
|
23089 |
|
23090 |
|
23091 |
|
23092 | function injectViewContainerRef() {
|
23093 | const previousTNode = getCurrentTNode();
|
23094 | return createContainerRef(previousTNode, getLView());
|
23095 | }
|
23096 | const VE_ViewContainerRef = ViewContainerRef;
|
23097 | const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
|
23098 | constructor(_lContainer, _hostTNode, _hostLView) {
|
23099 | super();
|
23100 | this._lContainer = _lContainer;
|
23101 | this._hostTNode = _hostTNode;
|
23102 | this._hostLView = _hostLView;
|
23103 | }
|
23104 | get element() {
|
23105 | return createElementRef(this._hostTNode, this._hostLView);
|
23106 | }
|
23107 | get injector() {
|
23108 | return new NodeInjector(this._hostTNode, this._hostLView);
|
23109 | }
|
23110 |
|
23111 | get parentInjector() {
|
23112 | const parentLocation = getParentInjectorLocation(this._hostTNode, this._hostLView);
|
23113 | if (hasParentInjector(parentLocation)) {
|
23114 | const parentView = getParentInjectorView(parentLocation, this._hostLView);
|
23115 | const injectorIndex = getParentInjectorIndex(parentLocation);
|
23116 | ngDevMode && assertNodeInjector(parentView, injectorIndex);
|
23117 | const parentTNode = parentView[TVIEW].data[injectorIndex + 8 ];
|
23118 | return new NodeInjector(parentTNode, parentView);
|
23119 | }
|
23120 | else {
|
23121 | return new NodeInjector(null, this._hostLView);
|
23122 | }
|
23123 | }
|
23124 | clear() {
|
23125 | while (this.length > 0) {
|
23126 | this.remove(this.length - 1);
|
23127 | }
|
23128 | }
|
23129 | get(index) {
|
23130 | const viewRefs = getViewRefs(this._lContainer);
|
23131 | return viewRefs !== null && viewRefs[index] || null;
|
23132 | }
|
23133 | get length() {
|
23134 | return this._lContainer.length - CONTAINER_HEADER_OFFSET;
|
23135 | }
|
23136 | createEmbeddedView(templateRef, context, index) {
|
23137 | const viewRef = templateRef.createEmbeddedView(context || {});
|
23138 | this.insert(viewRef, index);
|
23139 | return viewRef;
|
23140 | }
|
23141 | createComponent(componentFactoryOrType, indexOrOptions, injector, projectableNodes, ngModuleRef) {
|
23142 | const isComponentFactory = componentFactoryOrType && !isType(componentFactoryOrType);
|
23143 | let index;
|
23144 |
|
23145 |
|
23146 |
|
23147 |
|
23148 |
|
23149 | if (isComponentFactory) {
|
23150 | if (ngDevMode) {
|
23151 | assertEqual(typeof indexOrOptions !== 'object', true, 'It looks like Component factory was provided as the first argument ' +
|
23152 | 'and an options object as the second argument. This combination of arguments ' +
|
23153 | 'is incompatible. You can either change the first argument to provide Component ' +
|
23154 | 'type or change the second argument to be a number (representing an index at ' +
|
23155 | 'which to insert the new component\'s host view into this container)');
|
23156 | }
|
23157 | index = indexOrOptions;
|
23158 | }
|
23159 | else {
|
23160 | if (ngDevMode) {
|
23161 | assertDefined(getComponentDef(componentFactoryOrType), `Provided Component class doesn't contain Component definition. ` +
|
23162 | `Please check whether provided class has @Component decorator.`);
|
23163 | assertEqual(typeof indexOrOptions !== 'number', true, 'It looks like Component type was provided as the first argument ' +
|
23164 | 'and a number (representing an index at which to insert the new component\'s ' +
|
23165 | 'host view into this container as the second argument. This combination of arguments ' +
|
23166 | 'is incompatible. Please use an object as the second argument instead.');
|
23167 | }
|
23168 | const options = (indexOrOptions || {});
|
23169 | index = options.index;
|
23170 | injector = options.injector;
|
23171 | projectableNodes = options.projectableNodes;
|
23172 | ngModuleRef = options.ngModuleRef;
|
23173 | }
|
23174 | const componentFactory = isComponentFactory ?
|
23175 | componentFactoryOrType :
|
23176 | new ComponentFactory(getComponentDef(componentFactoryOrType));
|
23177 | const contextInjector = injector || this.parentInjector;
|
23178 | if (!ngModuleRef && componentFactory.ngModule == null && contextInjector) {
|
23179 |
|
23180 |
|
23181 |
|
23182 | const result = contextInjector.get(NgModuleRef$1, null);
|
23183 | if (result) {
|
23184 | ngModuleRef = result;
|
23185 | }
|
23186 | }
|
23187 | const componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
|
23188 | this.insert(componentRef.hostView, index);
|
23189 | return componentRef;
|
23190 | }
|
23191 | insert(viewRef, index) {
|
23192 | const lView = viewRef._lView;
|
23193 | const tView = lView[TVIEW];
|
23194 | if (ngDevMode && viewRef.destroyed) {
|
23195 | throw new Error('Cannot insert a destroyed View in a ViewContainer!');
|
23196 | }
|
23197 | if (viewAttachedToContainer(lView)) {
|
23198 |
|
23199 | const prevIdx = this.indexOf(viewRef);
|
23200 |
|
23201 |
|
23202 |
|
23203 |
|
23204 | if (prevIdx !== -1) {
|
23205 | this.detach(prevIdx);
|
23206 | }
|
23207 | else {
|
23208 | const prevLContainer = lView[PARENT];
|
23209 | ngDevMode &&
|
23210 | assertEqual(isLContainer(prevLContainer), true, 'An attached view should have its PARENT point to a container.');
|
23211 |
|
23212 |
|
23213 | const prevVCRef = new R3ViewContainerRef(prevLContainer, prevLContainer[T_HOST], prevLContainer[PARENT]);
|
23214 | prevVCRef.detach(prevVCRef.indexOf(viewRef));
|
23215 | }
|
23216 | }
|
23217 |
|
23218 | const adjustedIdx = this._adjustIndex(index);
|
23219 | const lContainer = this._lContainer;
|
23220 | insertView(tView, lView, lContainer, adjustedIdx);
|
23221 |
|
23222 | const beforeNode = getBeforeNodeForView(adjustedIdx, lContainer);
|
23223 | const renderer = lView[RENDERER];
|
23224 | const parentRNode = nativeParentNode(renderer, lContainer[NATIVE]);
|
23225 | if (parentRNode !== null) {
|
23226 | addViewToContainer(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode);
|
23227 | }
|
23228 | viewRef.attachToViewContainerRef();
|
23229 | addToArray(getOrCreateViewRefs(lContainer), adjustedIdx, viewRef);
|
23230 | return viewRef;
|
23231 | }
|
23232 | move(viewRef, newIndex) {
|
23233 | if (ngDevMode && viewRef.destroyed) {
|
23234 | throw new Error('Cannot move a destroyed View in a ViewContainer!');
|
23235 | }
|
23236 | return this.insert(viewRef, newIndex);
|
23237 | }
|
23238 | indexOf(viewRef) {
|
23239 | const viewRefsArr = getViewRefs(this._lContainer);
|
23240 | return viewRefsArr !== null ? viewRefsArr.indexOf(viewRef) : -1;
|
23241 | }
|
23242 | remove(index) {
|
23243 | const adjustedIdx = this._adjustIndex(index, -1);
|
23244 | const detachedView = detachView(this._lContainer, adjustedIdx);
|
23245 | if (detachedView) {
|
23246 |
|
23247 |
|
23248 |
|
23249 |
|
23250 |
|
23251 |
|
23252 | removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx);
|
23253 | destroyLView(detachedView[TVIEW], detachedView);
|
23254 | }
|
23255 | }
|
23256 | detach(index) {
|
23257 | const adjustedIdx = this._adjustIndex(index, -1);
|
23258 | const view = detachView(this._lContainer, adjustedIdx);
|
23259 | const wasDetached = view && removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx) != null;
|
23260 | return wasDetached ? new ViewRef$1(view) : null;
|
23261 | }
|
23262 | _adjustIndex(index, shift = 0) {
|
23263 | if (index == null) {
|
23264 | return this.length + shift;
|
23265 | }
|
23266 | if (ngDevMode) {
|
23267 | assertGreaterThan(index, -1, `ViewRef index must be positive, got ${index}`);
|
23268 |
|
23269 | assertLessThan(index, this.length + 1 + shift, 'index');
|
23270 | }
|
23271 | return index;
|
23272 | }
|
23273 | };
|
23274 | function getViewRefs(lContainer) {
|
23275 | return lContainer[VIEW_REFS];
|
23276 | }
|
23277 | function getOrCreateViewRefs(lContainer) {
|
23278 | return (lContainer[VIEW_REFS] || (lContainer[VIEW_REFS] = []));
|
23279 | }
|
23280 |
|
23281 |
|
23282 |
|
23283 |
|
23284 |
|
23285 |
|
23286 |
|
23287 |
|
23288 |
|
23289 | function createContainerRef(hostTNode, hostLView) {
|
23290 | ngDevMode && assertTNodeType(hostTNode, 12 | 3 );
|
23291 | let lContainer;
|
23292 | const slotValue = hostLView[hostTNode.index];
|
23293 | if (isLContainer(slotValue)) {
|
23294 |
|
23295 | lContainer = slotValue;
|
23296 | }
|
23297 | else {
|
23298 | let commentNode;
|
23299 |
|
23300 |
|
23301 |
|
23302 |
|
23303 | if (hostTNode.type & 8 ) {
|
23304 | commentNode = unwrapRNode(slotValue);
|
23305 | }
|
23306 | else {
|
23307 |
|
23308 |
|
23309 |
|
23310 | const renderer = hostLView[RENDERER];
|
23311 | ngDevMode && ngDevMode.rendererCreateComment++;
|
23312 | commentNode = renderer.createComment(ngDevMode ? 'container' : '');
|
23313 | const hostNative = getNativeByTNode(hostTNode, hostLView);
|
23314 | const parentOfHostNative = nativeParentNode(renderer, hostNative);
|
23315 | nativeInsertBefore(renderer, parentOfHostNative, commentNode, nativeNextSibling(renderer, hostNative), false);
|
23316 | }
|
23317 | hostLView[hostTNode.index] = lContainer =
|
23318 | createLContainer(slotValue, hostLView, commentNode, hostTNode);
|
23319 | addToViewTree(hostLView, lContainer);
|
23320 | }
|
23321 | return new R3ViewContainerRef(lContainer, hostTNode, hostLView);
|
23322 | }
|
23323 |
|
23324 |
|
23325 |
|
23326 |
|
23327 |
|
23328 |
|
23329 |
|
23330 |
|
23331 |
|
23332 |
|
23333 | const unusedValueExportToPlacateAjd$1 = 1;
|
23334 |
|
23335 |
|
23336 |
|
23337 |
|
23338 |
|
23339 |
|
23340 |
|
23341 |
|
23342 |
|
23343 |
|
23344 | const unusedValueExportToPlacateAjd = 1;
|
23345 |
|
23346 |
|
23347 |
|
23348 |
|
23349 |
|
23350 |
|
23351 |
|
23352 |
|
23353 | const unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd;
|
23354 | class LQuery_ {
|
23355 | constructor(queryList) {
|
23356 | this.queryList = queryList;
|
23357 | this.matches = null;
|
23358 | }
|
23359 | clone() {
|
23360 | return new LQuery_(this.queryList);
|
23361 | }
|
23362 | setDirty() {
|
23363 | this.queryList.setDirty();
|
23364 | }
|
23365 | }
|
23366 | class LQueries_ {
|
23367 | constructor(queries = []) {
|
23368 | this.queries = queries;
|
23369 | }
|
23370 | createEmbeddedView(tView) {
|
23371 | const tQueries = tView.queries;
|
23372 | if (tQueries !== null) {
|
23373 | const noOfInheritedQueries = tView.contentQueries !== null ? tView.contentQueries[0] : tQueries.length;
|
23374 | const viewLQueries = [];
|
23375 |
|
23376 |
|
23377 |
|
23378 |
|
23379 | for (let i = 0; i < noOfInheritedQueries; i++) {
|
23380 | const tQuery = tQueries.getByIndex(i);
|
23381 | const parentLQuery = this.queries[tQuery.indexInDeclarationView];
|
23382 | viewLQueries.push(parentLQuery.clone());
|
23383 | }
|
23384 | return new LQueries_(viewLQueries);
|
23385 | }
|
23386 | return null;
|
23387 | }
|
23388 | insertView(tView) {
|
23389 | this.dirtyQueriesWithMatches(tView);
|
23390 | }
|
23391 | detachView(tView) {
|
23392 | this.dirtyQueriesWithMatches(tView);
|
23393 | }
|
23394 | dirtyQueriesWithMatches(tView) {
|
23395 | for (let i = 0; i < this.queries.length; i++) {
|
23396 | if (getTQuery(tView, i).matches !== null) {
|
23397 | this.queries[i].setDirty();
|
23398 | }
|
23399 | }
|
23400 | }
|
23401 | }
|
23402 | class TQueryMetadata_ {
|
23403 | constructor(predicate, flags, read = null) {
|
23404 | this.predicate = predicate;
|
23405 | this.flags = flags;
|
23406 | this.read = read;
|
23407 | }
|
23408 | }
|
23409 | class TQueries_ {
|
23410 | constructor(queries = []) {
|
23411 | this.queries = queries;
|
23412 | }
|
23413 | elementStart(tView, tNode) {
|
23414 | ngDevMode &&
|
23415 | assertFirstCreatePass(tView, 'Queries should collect results on the first template pass only');
|
23416 | for (let i = 0; i < this.queries.length; i++) {
|
23417 | this.queries[i].elementStart(tView, tNode);
|
23418 | }
|
23419 | }
|
23420 | elementEnd(tNode) {
|
23421 | for (let i = 0; i < this.queries.length; i++) {
|
23422 | this.queries[i].elementEnd(tNode);
|
23423 | }
|
23424 | }
|
23425 | embeddedTView(tNode) {
|
23426 | let queriesForTemplateRef = null;
|
23427 | for (let i = 0; i < this.length; i++) {
|
23428 | const childQueryIndex = queriesForTemplateRef !== null ? queriesForTemplateRef.length : 0;
|
23429 | const tqueryClone = this.getByIndex(i).embeddedTView(tNode, childQueryIndex);
|
23430 | if (tqueryClone) {
|
23431 | tqueryClone.indexInDeclarationView = i;
|
23432 | if (queriesForTemplateRef !== null) {
|
23433 | queriesForTemplateRef.push(tqueryClone);
|
23434 | }
|
23435 | else {
|
23436 | queriesForTemplateRef = [tqueryClone];
|
23437 | }
|
23438 | }
|
23439 | }
|
23440 | return queriesForTemplateRef !== null ? new TQueries_(queriesForTemplateRef) : null;
|
23441 | }
|
23442 | template(tView, tNode) {
|
23443 | ngDevMode &&
|
23444 | assertFirstCreatePass(tView, 'Queries should collect results on the first template pass only');
|
23445 | for (let i = 0; i < this.queries.length; i++) {
|
23446 | this.queries[i].template(tView, tNode);
|
23447 | }
|
23448 | }
|
23449 | getByIndex(index) {
|
23450 | ngDevMode && assertIndexInRange(this.queries, index);
|
23451 | return this.queries[index];
|
23452 | }
|
23453 | get length() {
|
23454 | return this.queries.length;
|
23455 | }
|
23456 | track(tquery) {
|
23457 | this.queries.push(tquery);
|
23458 | }
|
23459 | }
|
23460 | class TQuery_ {
|
23461 | constructor(metadata, nodeIndex = -1) {
|
23462 | this.metadata = metadata;
|
23463 | this.matches = null;
|
23464 | this.indexInDeclarationView = -1;
|
23465 | this.crossesNgTemplate = false;
|
23466 | |
23467 |
|
23468 |
|
23469 |
|
23470 |
|
23471 | this._appliesToNextNode = true;
|
23472 | this._declarationNodeIndex = nodeIndex;
|
23473 | }
|
23474 | elementStart(tView, tNode) {
|
23475 | if (this.isApplyingToNode(tNode)) {
|
23476 | this.matchTNode(tView, tNode);
|
23477 | }
|
23478 | }
|
23479 | elementEnd(tNode) {
|
23480 | if (this._declarationNodeIndex === tNode.index) {
|
23481 | this._appliesToNextNode = false;
|
23482 | }
|
23483 | }
|
23484 | template(tView, tNode) {
|
23485 | this.elementStart(tView, tNode);
|
23486 | }
|
23487 | embeddedTView(tNode, childQueryIndex) {
|
23488 | if (this.isApplyingToNode(tNode)) {
|
23489 | this.crossesNgTemplate = true;
|
23490 |
|
23491 |
|
23492 | this.addMatch(-tNode.index, childQueryIndex);
|
23493 | return new TQuery_(this.metadata);
|
23494 | }
|
23495 | return null;
|
23496 | }
|
23497 | isApplyingToNode(tNode) {
|
23498 | if (this._appliesToNextNode &&
|
23499 | (this.metadata.flags & 1 ) !== 1 ) {
|
23500 | const declarationNodeIdx = this._declarationNodeIndex;
|
23501 | let parent = tNode.parent;
|
23502 |
|
23503 |
|
23504 |
|
23505 |
|
23506 |
|
23507 |
|
23508 |
|
23509 |
|
23510 |
|
23511 |
|
23512 | while (parent !== null && (parent.type & 8 ) &&
|
23513 | parent.index !== declarationNodeIdx) {
|
23514 | parent = parent.parent;
|
23515 | }
|
23516 | return declarationNodeIdx === (parent !== null ? parent.index : -1);
|
23517 | }
|
23518 | return this._appliesToNextNode;
|
23519 | }
|
23520 | matchTNode(tView, tNode) {
|
23521 | const predicate = this.metadata.predicate;
|
23522 | if (Array.isArray(predicate)) {
|
23523 | for (let i = 0; i < predicate.length; i++) {
|
23524 | const name = predicate[i];
|
23525 | this.matchTNodeWithReadOption(tView, tNode, getIdxOfMatchingSelector(tNode, name));
|
23526 |
|
23527 | this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, name, false, false));
|
23528 | }
|
23529 | }
|
23530 | else {
|
23531 | if (predicate === TemplateRef) {
|
23532 | if (tNode.type & 4 ) {
|
23533 | this.matchTNodeWithReadOption(tView, tNode, -1);
|
23534 | }
|
23535 | }
|
23536 | else {
|
23537 | this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, predicate, false, false));
|
23538 | }
|
23539 | }
|
23540 | }
|
23541 | matchTNodeWithReadOption(tView, tNode, nodeMatchIdx) {
|
23542 | if (nodeMatchIdx !== null) {
|
23543 | const read = this.metadata.read;
|
23544 | if (read !== null) {
|
23545 | if (read === ElementRef || read === ViewContainerRef ||
|
23546 | read === TemplateRef && (tNode.type & 4 )) {
|
23547 | this.addMatch(tNode.index, -2);
|
23548 | }
|
23549 | else {
|
23550 | const directiveOrProviderIdx = locateDirectiveOrProvider(tNode, tView, read, false, false);
|
23551 | if (directiveOrProviderIdx !== null) {
|
23552 | this.addMatch(tNode.index, directiveOrProviderIdx);
|
23553 | }
|
23554 | }
|
23555 | }
|
23556 | else {
|
23557 | this.addMatch(tNode.index, nodeMatchIdx);
|
23558 | }
|
23559 | }
|
23560 | }
|
23561 | addMatch(tNodeIdx, matchIdx) {
|
23562 | if (this.matches === null) {
|
23563 | this.matches = [tNodeIdx, matchIdx];
|
23564 | }
|
23565 | else {
|
23566 | this.matches.push(tNodeIdx, matchIdx);
|
23567 | }
|
23568 | }
|
23569 | }
|
23570 |
|
23571 |
|
23572 |
|
23573 |
|
23574 |
|
23575 |
|
23576 |
|
23577 |
|
23578 | function getIdxOfMatchingSelector(tNode, selector) {
|
23579 | const localNames = tNode.localNames;
|
23580 | if (localNames !== null) {
|
23581 | for (let i = 0; i < localNames.length; i += 2) {
|
23582 | if (localNames[i] === selector) {
|
23583 | return localNames[i + 1];
|
23584 | }
|
23585 | }
|
23586 | }
|
23587 | return null;
|
23588 | }
|
23589 | function createResultByTNodeType(tNode, currentView) {
|
23590 | if (tNode.type & (3 | 8 )) {
|
23591 | return createElementRef(tNode, currentView);
|
23592 | }
|
23593 | else if (tNode.type & 4 ) {
|
23594 | return createTemplateRef(tNode, currentView);
|
23595 | }
|
23596 | return null;
|
23597 | }
|
23598 | function createResultForNode(lView, tNode, matchingIdx, read) {
|
23599 | if (matchingIdx === -1) {
|
23600 |
|
23601 | return createResultByTNodeType(tNode, lView);
|
23602 | }
|
23603 | else if (matchingIdx === -2) {
|
23604 |
|
23605 | return createSpecialToken(lView, tNode, read);
|
23606 | }
|
23607 | else {
|
23608 |
|
23609 | return getNodeInjectable(lView, lView[TVIEW], matchingIdx, tNode);
|
23610 | }
|
23611 | }
|
23612 | function createSpecialToken(lView, tNode, read) {
|
23613 | if (read === ElementRef) {
|
23614 | return createElementRef(tNode, lView);
|
23615 | }
|
23616 | else if (read === TemplateRef) {
|
23617 | return createTemplateRef(tNode, lView);
|
23618 | }
|
23619 | else if (read === ViewContainerRef) {
|
23620 | ngDevMode && assertTNodeType(tNode, 3 | 12 );
|
23621 | return createContainerRef(tNode, lView);
|
23622 | }
|
23623 | else {
|
23624 | ngDevMode &&
|
23625 | throwError(`Special token to read should be one of ElementRef, TemplateRef or ViewContainerRef but got ${stringify(read)}.`);
|
23626 | }
|
23627 | }
|
23628 |
|
23629 |
|
23630 |
|
23631 |
|
23632 |
|
23633 | function materializeViewResults(tView, lView, tQuery, queryIndex) {
|
23634 | const lQuery = lView[QUERIES].queries[queryIndex];
|
23635 | if (lQuery.matches === null) {
|
23636 | const tViewData = tView.data;
|
23637 | const tQueryMatches = tQuery.matches;
|
23638 | const result = [];
|
23639 | for (let i = 0; i < tQueryMatches.length; i += 2) {
|
23640 | const matchedNodeIdx = tQueryMatches[i];
|
23641 | if (matchedNodeIdx < 0) {
|
23642 |
|
23643 |
|
23644 |
|
23645 | result.push(null);
|
23646 | }
|
23647 | else {
|
23648 | ngDevMode && assertIndexInRange(tViewData, matchedNodeIdx);
|
23649 | const tNode = tViewData[matchedNodeIdx];
|
23650 | result.push(createResultForNode(lView, tNode, tQueryMatches[i + 1], tQuery.metadata.read));
|
23651 | }
|
23652 | }
|
23653 | lQuery.matches = result;
|
23654 | }
|
23655 | return lQuery.matches;
|
23656 | }
|
23657 |
|
23658 |
|
23659 |
|
23660 |
|
23661 | function collectQueryResults(tView, lView, queryIndex, result) {
|
23662 | const tQuery = tView.queries.getByIndex(queryIndex);
|
23663 | const tQueryMatches = tQuery.matches;
|
23664 | if (tQueryMatches !== null) {
|
23665 | const lViewResults = materializeViewResults(tView, lView, tQuery, queryIndex);
|
23666 | for (let i = 0; i < tQueryMatches.length; i += 2) {
|
23667 | const tNodeIdx = tQueryMatches[i];
|
23668 | if (tNodeIdx > 0) {
|
23669 | result.push(lViewResults[i / 2]);
|
23670 | }
|
23671 | else {
|
23672 | const childQueryIndex = tQueryMatches[i + 1];
|
23673 | const declarationLContainer = lView[-tNodeIdx];
|
23674 | ngDevMode && assertLContainer(declarationLContainer);
|
23675 |
|
23676 | for (let i = CONTAINER_HEADER_OFFSET; i < declarationLContainer.length; i++) {
|
23677 | const embeddedLView = declarationLContainer[i];
|
23678 | if (embeddedLView[DECLARATION_LCONTAINER] === embeddedLView[PARENT]) {
|
23679 | collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result);
|
23680 | }
|
23681 | }
|
23682 |
|
23683 |
|
23684 | if (declarationLContainer[MOVED_VIEWS] !== null) {
|
23685 | const embeddedLViews = declarationLContainer[MOVED_VIEWS];
|
23686 | for (let i = 0; i < embeddedLViews.length; i++) {
|
23687 | const embeddedLView = embeddedLViews[i];
|
23688 | collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result);
|
23689 | }
|
23690 | }
|
23691 | }
|
23692 | }
|
23693 | }
|
23694 | return result;
|
23695 | }
|
23696 |
|
23697 |
|
23698 |
|
23699 |
|
23700 |
|
23701 |
|
23702 |
|
23703 |
|
23704 |
|
23705 | function ɵɵqueryRefresh(queryList) {
|
23706 | const lView = getLView();
|
23707 | const tView = getTView();
|
23708 | const queryIndex = getCurrentQueryIndex();
|
23709 | setCurrentQueryIndex(queryIndex + 1);
|
23710 | const tQuery = getTQuery(tView, queryIndex);
|
23711 | if (queryList.dirty &&
|
23712 | (isCreationMode(lView) ===
|
23713 | ((tQuery.metadata.flags & 2 ) === 2 ))) {
|
23714 | if (tQuery.matches === null) {
|
23715 | queryList.reset([]);
|
23716 | }
|
23717 | else {
|
23718 | const result = tQuery.crossesNgTemplate ?
|
23719 | collectQueryResults(tView, lView, queryIndex, []) :
|
23720 | materializeViewResults(tView, lView, tQuery, queryIndex);
|
23721 | queryList.reset(result, unwrapElementRef);
|
23722 | queryList.notifyOnChanges();
|
23723 | }
|
23724 | return true;
|
23725 | }
|
23726 | return false;
|
23727 | }
|
23728 |
|
23729 |
|
23730 |
|
23731 |
|
23732 |
|
23733 |
|
23734 |
|
23735 |
|
23736 |
|
23737 | function ɵɵviewQuery(predicate, flags, read) {
|
23738 | ngDevMode && assertNumber(flags, 'Expecting flags');
|
23739 | const tView = getTView();
|
23740 | if (tView.firstCreatePass) {
|
23741 | createTQuery(tView, new TQueryMetadata_(predicate, flags, read), -1);
|
23742 | if ((flags & 2 ) === 2 ) {
|
23743 | tView.staticViewQueries = true;
|
23744 | }
|
23745 | }
|
23746 | createLQuery(tView, getLView(), flags);
|
23747 | }
|
23748 |
|
23749 |
|
23750 |
|
23751 |
|
23752 |
|
23753 |
|
23754 |
|
23755 |
|
23756 |
|
23757 |
|
23758 |
|
23759 |
|
23760 | function ɵɵcontentQuery(directiveIndex, predicate, flags, read) {
|
23761 | ngDevMode && assertNumber(flags, 'Expecting flags');
|
23762 | const tView = getTView();
|
23763 | if (tView.firstCreatePass) {
|
23764 | const tNode = getCurrentTNode();
|
23765 | createTQuery(tView, new TQueryMetadata_(predicate, flags, read), tNode.index);
|
23766 | saveContentQueryAndDirectiveIndex(tView, directiveIndex);
|
23767 | if ((flags & 2 ) === 2 ) {
|
23768 | tView.staticContentQueries = true;
|
23769 | }
|
23770 | }
|
23771 | createLQuery(tView, getLView(), flags);
|
23772 | }
|
23773 |
|
23774 |
|
23775 |
|
23776 |
|
23777 |
|
23778 | function ɵɵloadQuery() {
|
23779 | return loadQueryInternal(getLView(), getCurrentQueryIndex());
|
23780 | }
|
23781 | function loadQueryInternal(lView, queryIndex) {
|
23782 | ngDevMode &&
|
23783 | assertDefined(lView[QUERIES], 'LQueries should be defined when trying to load a query');
|
23784 | ngDevMode && assertIndexInRange(lView[QUERIES].queries, queryIndex);
|
23785 | return lView[QUERIES].queries[queryIndex].queryList;
|
23786 | }
|
23787 | function createLQuery(tView, lView, flags) {
|
23788 | const queryList = new QueryList((flags & 4 ) === 4 );
|
23789 | storeCleanupWithContext(tView, lView, queryList, queryList.destroy);
|
23790 | if (lView[QUERIES] === null)
|
23791 | lView[QUERIES] = new LQueries_();
|
23792 | lView[QUERIES].queries.push(new LQuery_(queryList));
|
23793 | }
|
23794 | function createTQuery(tView, metadata, nodeIndex) {
|
23795 | if (tView.queries === null)
|
23796 | tView.queries = new TQueries_();
|
23797 | tView.queries.track(new TQuery_(metadata, nodeIndex));
|
23798 | }
|
23799 | function saveContentQueryAndDirectiveIndex(tView, directiveIndex) {
|
23800 | const tViewContentQueries = tView.contentQueries || (tView.contentQueries = []);
|
23801 | const lastSavedDirectiveIndex = tViewContentQueries.length ? tViewContentQueries[tViewContentQueries.length - 1] : -1;
|
23802 | if (directiveIndex !== lastSavedDirectiveIndex) {
|
23803 | tViewContentQueries.push(tView.queries.length - 1, directiveIndex);
|
23804 | }
|
23805 | }
|
23806 | function getTQuery(tView, index) {
|
23807 | ngDevMode && assertDefined(tView.queries, 'TQueries must be defined to retrieve a TQuery');
|
23808 | return tView.queries.getByIndex(index);
|
23809 | }
|
23810 |
|
23811 |
|
23812 |
|
23813 |
|
23814 |
|
23815 |
|
23816 |
|
23817 |
|
23818 |
|
23819 |
|
23820 |
|
23821 |
|
23822 |
|
23823 |
|
23824 | function ɵɵtemplateRefExtractor(tNode, lView) {
|
23825 | return createTemplateRef(tNode, lView);
|
23826 | }
|
23827 |
|
23828 |
|
23829 |
|
23830 |
|
23831 |
|
23832 |
|
23833 |
|
23834 |
|
23835 |
|
23836 |
|
23837 |
|
23838 |
|
23839 |
|
23840 |
|
23841 |
|
23842 |
|
23843 |
|
23844 |
|
23845 |
|
23846 |
|
23847 |
|
23848 | const angularCoreEnv = (() => ({
|
23849 | 'ɵɵattribute': ɵɵattribute,
|
23850 | 'ɵɵattributeInterpolate1': ɵɵattributeInterpolate1,
|
23851 | 'ɵɵattributeInterpolate2': ɵɵattributeInterpolate2,
|
23852 | 'ɵɵattributeInterpolate3': ɵɵattributeInterpolate3,
|
23853 | 'ɵɵattributeInterpolate4': ɵɵattributeInterpolate4,
|
23854 | 'ɵɵattributeInterpolate5': ɵɵattributeInterpolate5,
|
23855 | 'ɵɵattributeInterpolate6': ɵɵattributeInterpolate6,
|
23856 | 'ɵɵattributeInterpolate7': ɵɵattributeInterpolate7,
|
23857 | 'ɵɵattributeInterpolate8': ɵɵattributeInterpolate8,
|
23858 | 'ɵɵattributeInterpolateV': ɵɵattributeInterpolateV,
|
23859 | 'ɵɵdefineComponent': ɵɵdefineComponent,
|
23860 | 'ɵɵdefineDirective': ɵɵdefineDirective,
|
23861 | 'ɵɵdefineInjectable': ɵɵdefineInjectable,
|
23862 | 'ɵɵdefineInjector': ɵɵdefineInjector,
|
23863 | 'ɵɵdefineNgModule': ɵɵdefineNgModule,
|
23864 | 'ɵɵdefinePipe': ɵɵdefinePipe,
|
23865 | 'ɵɵdirectiveInject': ɵɵdirectiveInject,
|
23866 | 'ɵɵgetInheritedFactory': ɵɵgetInheritedFactory,
|
23867 | 'ɵɵinject': ɵɵinject,
|
23868 | 'ɵɵinjectAttribute': ɵɵinjectAttribute,
|
23869 | 'ɵɵinvalidFactory': ɵɵinvalidFactory,
|
23870 | 'ɵɵinvalidFactoryDep': ɵɵinvalidFactoryDep,
|
23871 | 'ɵɵtemplateRefExtractor': ɵɵtemplateRefExtractor,
|
23872 | 'ɵɵNgOnChangesFeature': ɵɵNgOnChangesFeature,
|
23873 | 'ɵɵProvidersFeature': ɵɵProvidersFeature,
|
23874 | 'ɵɵCopyDefinitionFeature': ɵɵCopyDefinitionFeature,
|
23875 | 'ɵɵInheritDefinitionFeature': ɵɵInheritDefinitionFeature,
|
23876 | 'ɵɵnextContext': ɵɵnextContext,
|
23877 | 'ɵɵnamespaceHTML': ɵɵnamespaceHTML,
|
23878 | 'ɵɵnamespaceMathML': ɵɵnamespaceMathML,
|
23879 | 'ɵɵnamespaceSVG': ɵɵnamespaceSVG,
|
23880 | 'ɵɵenableBindings': ɵɵenableBindings,
|
23881 | 'ɵɵdisableBindings': ɵɵdisableBindings,
|
23882 | 'ɵɵelementStart': ɵɵelementStart,
|
23883 | 'ɵɵelementEnd': ɵɵelementEnd,
|
23884 | 'ɵɵelement': ɵɵelement,
|
23885 | 'ɵɵelementContainerStart': ɵɵelementContainerStart,
|
23886 | 'ɵɵelementContainerEnd': ɵɵelementContainerEnd,
|
23887 | 'ɵɵelementContainer': ɵɵelementContainer,
|
23888 | 'ɵɵpureFunction0': ɵɵpureFunction0,
|
23889 | 'ɵɵpureFunction1': ɵɵpureFunction1,
|
23890 | 'ɵɵpureFunction2': ɵɵpureFunction2,
|
23891 | 'ɵɵpureFunction3': ɵɵpureFunction3,
|
23892 | 'ɵɵpureFunction4': ɵɵpureFunction4,
|
23893 | 'ɵɵpureFunction5': ɵɵpureFunction5,
|
23894 | 'ɵɵpureFunction6': ɵɵpureFunction6,
|
23895 | 'ɵɵpureFunction7': ɵɵpureFunction7,
|
23896 | 'ɵɵpureFunction8': ɵɵpureFunction8,
|
23897 | 'ɵɵpureFunctionV': ɵɵpureFunctionV,
|
23898 | 'ɵɵgetCurrentView': ɵɵgetCurrentView,
|
23899 | 'ɵɵrestoreView': ɵɵrestoreView,
|
23900 | 'ɵɵlistener': ɵɵlistener,
|
23901 | 'ɵɵprojection': ɵɵprojection,
|
23902 | 'ɵɵsyntheticHostProperty': ɵɵsyntheticHostProperty,
|
23903 | 'ɵɵsyntheticHostListener': ɵɵsyntheticHostListener,
|
23904 | 'ɵɵpipeBind1': ɵɵpipeBind1,
|
23905 | 'ɵɵpipeBind2': ɵɵpipeBind2,
|
23906 | 'ɵɵpipeBind3': ɵɵpipeBind3,
|
23907 | 'ɵɵpipeBind4': ɵɵpipeBind4,
|
23908 | 'ɵɵpipeBindV': ɵɵpipeBindV,
|
23909 | 'ɵɵprojectionDef': ɵɵprojectionDef,
|
23910 | 'ɵɵhostProperty': ɵɵhostProperty,
|
23911 | 'ɵɵproperty': ɵɵproperty,
|
23912 | 'ɵɵpropertyInterpolate': ɵɵpropertyInterpolate,
|
23913 | 'ɵɵpropertyInterpolate1': ɵɵpropertyInterpolate1,
|
23914 | 'ɵɵpropertyInterpolate2': ɵɵpropertyInterpolate2,
|
23915 | 'ɵɵpropertyInterpolate3': ɵɵpropertyInterpolate3,
|
23916 | 'ɵɵpropertyInterpolate4': ɵɵpropertyInterpolate4,
|
23917 | 'ɵɵpropertyInterpolate5': ɵɵpropertyInterpolate5,
|
23918 | 'ɵɵpropertyInterpolate6': ɵɵpropertyInterpolate6,
|
23919 | 'ɵɵpropertyInterpolate7': ɵɵpropertyInterpolate7,
|
23920 | 'ɵɵpropertyInterpolate8': ɵɵpropertyInterpolate8,
|
23921 | 'ɵɵpropertyInterpolateV': ɵɵpropertyInterpolateV,
|
23922 | 'ɵɵpipe': ɵɵpipe,
|
23923 | 'ɵɵqueryRefresh': ɵɵqueryRefresh,
|
23924 | 'ɵɵviewQuery': ɵɵviewQuery,
|
23925 | 'ɵɵloadQuery': ɵɵloadQuery,
|
23926 | 'ɵɵcontentQuery': ɵɵcontentQuery,
|
23927 | 'ɵɵreference': ɵɵreference,
|
23928 | 'ɵɵclassMap': ɵɵclassMap,
|
23929 | 'ɵɵclassMapInterpolate1': ɵɵclassMapInterpolate1,
|
23930 | 'ɵɵclassMapInterpolate2': ɵɵclassMapInterpolate2,
|
23931 | 'ɵɵclassMapInterpolate3': ɵɵclassMapInterpolate3,
|
23932 | 'ɵɵclassMapInterpolate4': ɵɵclassMapInterpolate4,
|
23933 | 'ɵɵclassMapInterpolate5': ɵɵclassMapInterpolate5,
|
23934 | 'ɵɵclassMapInterpolate6': ɵɵclassMapInterpolate6,
|
23935 | 'ɵɵclassMapInterpolate7': ɵɵclassMapInterpolate7,
|
23936 | 'ɵɵclassMapInterpolate8': ɵɵclassMapInterpolate8,
|
23937 | 'ɵɵclassMapInterpolateV': ɵɵclassMapInterpolateV,
|
23938 | 'ɵɵstyleMap': ɵɵstyleMap,
|
23939 | 'ɵɵstyleMapInterpolate1': ɵɵstyleMapInterpolate1,
|
23940 | 'ɵɵstyleMapInterpolate2': ɵɵstyleMapInterpolate2,
|
23941 | 'ɵɵstyleMapInterpolate3': ɵɵstyleMapInterpolate3,
|
23942 | 'ɵɵstyleMapInterpolate4': ɵɵstyleMapInterpolate4,
|
23943 | 'ɵɵstyleMapInterpolate5': ɵɵstyleMapInterpolate5,
|
23944 | 'ɵɵstyleMapInterpolate6': ɵɵstyleMapInterpolate6,
|
23945 | 'ɵɵstyleMapInterpolate7': ɵɵstyleMapInterpolate7,
|
23946 | 'ɵɵstyleMapInterpolate8': ɵɵstyleMapInterpolate8,
|
23947 | 'ɵɵstyleMapInterpolateV': ɵɵstyleMapInterpolateV,
|
23948 | 'ɵɵstyleProp': ɵɵstyleProp,
|
23949 | 'ɵɵstylePropInterpolate1': ɵɵstylePropInterpolate1,
|
23950 | 'ɵɵstylePropInterpolate2': ɵɵstylePropInterpolate2,
|
23951 | 'ɵɵstylePropInterpolate3': ɵɵstylePropInterpolate3,
|
23952 | 'ɵɵstylePropInterpolate4': ɵɵstylePropInterpolate4,
|
23953 | 'ɵɵstylePropInterpolate5': ɵɵstylePropInterpolate5,
|
23954 | 'ɵɵstylePropInterpolate6': ɵɵstylePropInterpolate6,
|
23955 | 'ɵɵstylePropInterpolate7': ɵɵstylePropInterpolate7,
|
23956 | 'ɵɵstylePropInterpolate8': ɵɵstylePropInterpolate8,
|
23957 | 'ɵɵstylePropInterpolateV': ɵɵstylePropInterpolateV,
|
23958 | 'ɵɵclassProp': ɵɵclassProp,
|
23959 | 'ɵɵadvance': ɵɵadvance,
|
23960 | 'ɵɵtemplate': ɵɵtemplate,
|
23961 | 'ɵɵtext': ɵɵtext,
|
23962 | 'ɵɵtextInterpolate': ɵɵtextInterpolate,
|
23963 | 'ɵɵtextInterpolate1': ɵɵtextInterpolate1,
|
23964 | 'ɵɵtextInterpolate2': ɵɵtextInterpolate2,
|
23965 | 'ɵɵtextInterpolate3': ɵɵtextInterpolate3,
|
23966 | 'ɵɵtextInterpolate4': ɵɵtextInterpolate4,
|
23967 | 'ɵɵtextInterpolate5': ɵɵtextInterpolate5,
|
23968 | 'ɵɵtextInterpolate6': ɵɵtextInterpolate6,
|
23969 | 'ɵɵtextInterpolate7': ɵɵtextInterpolate7,
|
23970 | 'ɵɵtextInterpolate8': ɵɵtextInterpolate8,
|
23971 | 'ɵɵtextInterpolateV': ɵɵtextInterpolateV,
|
23972 | 'ɵɵi18n': ɵɵi18n,
|
23973 | 'ɵɵi18nAttributes': ɵɵi18nAttributes,
|
23974 | 'ɵɵi18nExp': ɵɵi18nExp,
|
23975 | 'ɵɵi18nStart': ɵɵi18nStart,
|
23976 | 'ɵɵi18nEnd': ɵɵi18nEnd,
|
23977 | 'ɵɵi18nApply': ɵɵi18nApply,
|
23978 | 'ɵɵi18nPostprocess': ɵɵi18nPostprocess,
|
23979 | 'ɵɵresolveWindow': ɵɵresolveWindow,
|
23980 | 'ɵɵresolveDocument': ɵɵresolveDocument,
|
23981 | 'ɵɵresolveBody': ɵɵresolveBody,
|
23982 | 'ɵɵsetComponentScope': ɵɵsetComponentScope,
|
23983 | 'ɵɵsetNgModuleScope': ɵɵsetNgModuleScope,
|
23984 | 'ɵɵsanitizeHtml': ɵɵsanitizeHtml,
|
23985 | 'ɵɵsanitizeStyle': ɵɵsanitizeStyle,
|
23986 | 'ɵɵsanitizeResourceUrl': ɵɵsanitizeResourceUrl,
|
23987 | 'ɵɵsanitizeScript': ɵɵsanitizeScript,
|
23988 | 'ɵɵsanitizeUrl': ɵɵsanitizeUrl,
|
23989 | 'ɵɵsanitizeUrlOrResourceUrl': ɵɵsanitizeUrlOrResourceUrl,
|
23990 | 'ɵɵtrustConstantHtml': ɵɵtrustConstantHtml,
|
23991 | 'ɵɵtrustConstantResourceUrl': ɵɵtrustConstantResourceUrl,
|
23992 | 'forwardRef': forwardRef,
|
23993 | 'resolveForwardRef': resolveForwardRef,
|
23994 | }))();
|
23995 |
|
23996 | let jitOptions = null;
|
23997 | function setJitOptions(options) {
|
23998 | if (jitOptions !== null) {
|
23999 | if (options.defaultEncapsulation !== jitOptions.defaultEncapsulation) {
|
24000 | ngDevMode &&
|
24001 | console.error('Provided value for `defaultEncapsulation` can not be changed once it has been set.');
|
24002 | return;
|
24003 | }
|
24004 | if (options.preserveWhitespaces !== jitOptions.preserveWhitespaces) {
|
24005 | ngDevMode &&
|
24006 | console.error('Provided value for `preserveWhitespaces` can not be changed once it has been set.');
|
24007 | return;
|
24008 | }
|
24009 | }
|
24010 | jitOptions = options;
|
24011 | }
|
24012 | function getJitOptions() {
|
24013 | return jitOptions;
|
24014 | }
|
24015 | function resetJitOptions() {
|
24016 | jitOptions = null;
|
24017 | }
|
24018 |
|
24019 |
|
24020 |
|
24021 |
|
24022 |
|
24023 |
|
24024 |
|
24025 |
|
24026 | const moduleQueue = [];
|
24027 |
|
24028 |
|
24029 |
|
24030 |
|
24031 | function enqueueModuleForDelayedScoping(moduleType, ngModule) {
|
24032 | moduleQueue.push({ moduleType, ngModule });
|
24033 | }
|
24034 | let flushingModuleQueue = false;
|
24035 |
|
24036 |
|
24037 |
|
24038 |
|
24039 |
|
24040 | function flushModuleScopingQueueAsMuchAsPossible() {
|
24041 | if (!flushingModuleQueue) {
|
24042 | flushingModuleQueue = true;
|
24043 | try {
|
24044 | for (let i = moduleQueue.length - 1; i >= 0; i--) {
|
24045 | const { moduleType, ngModule } = moduleQueue[i];
|
24046 | if (ngModule.declarations && ngModule.declarations.every(isResolvedDeclaration)) {
|
24047 |
|
24048 | moduleQueue.splice(i, 1);
|
24049 | setScopeOnDeclaredComponents(moduleType, ngModule);
|
24050 | }
|
24051 | }
|
24052 | }
|
24053 | finally {
|
24054 | flushingModuleQueue = false;
|
24055 | }
|
24056 | }
|
24057 | }
|
24058 |
|
24059 |
|
24060 |
|
24061 |
|
24062 |
|
24063 | function isResolvedDeclaration(declaration) {
|
24064 | if (Array.isArray(declaration)) {
|
24065 | return declaration.every(isResolvedDeclaration);
|
24066 | }
|
24067 | return !!resolveForwardRef(declaration);
|
24068 | }
|
24069 |
|
24070 |
|
24071 |
|
24072 |
|
24073 |
|
24074 | function compileNgModule(moduleType, ngModule = {}) {
|
24075 | compileNgModuleDefs(moduleType, ngModule);
|
24076 |
|
24077 |
|
24078 |
|
24079 |
|
24080 | enqueueModuleForDelayedScoping(moduleType, ngModule);
|
24081 | }
|
24082 |
|
24083 |
|
24084 |
|
24085 |
|
24086 |
|
24087 |
|
24088 | function compileNgModuleDefs(moduleType, ngModule, allowDuplicateDeclarationsInRoot = false) {
|
24089 | ngDevMode && assertDefined(moduleType, 'Required value moduleType');
|
24090 | ngDevMode && assertDefined(ngModule, 'Required value ngModule');
|
24091 | const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
|
24092 | let ngModuleDef = null;
|
24093 | Object.defineProperty(moduleType, NG_MOD_DEF, {
|
24094 | configurable: true,
|
24095 | get: () => {
|
24096 | if (ngModuleDef === null) {
|
24097 | if (ngDevMode && ngModule.imports && ngModule.imports.indexOf(moduleType) > -1) {
|
24098 |
|
24099 |
|
24100 | throw new Error(`'${stringifyForError(moduleType)}' module can't import itself`);
|
24101 | }
|
24102 | const compiler = getCompilerFacade({ usage: 0 , kind: 'NgModule', type: moduleType });
|
24103 | ngModuleDef = compiler.compileNgModule(angularCoreEnv, `ng:///${moduleType.name}/ɵmod.js`, {
|
24104 | type: moduleType,
|
24105 | bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY).map(resolveForwardRef),
|
24106 | declarations: declarations.map(resolveForwardRef),
|
24107 | imports: flatten(ngModule.imports || EMPTY_ARRAY)
|
24108 | .map(resolveForwardRef)
|
24109 | .map(expandModuleWithProviders),
|
24110 | exports: flatten(ngModule.exports || EMPTY_ARRAY)
|
24111 | .map(resolveForwardRef)
|
24112 | .map(expandModuleWithProviders),
|
24113 | schemas: ngModule.schemas ? flatten(ngModule.schemas) : null,
|
24114 | id: ngModule.id || null,
|
24115 | });
|
24116 |
|
24117 |
|
24118 |
|
24119 |
|
24120 | if (!ngModuleDef.schemas) {
|
24121 | ngModuleDef.schemas = [];
|
24122 | }
|
24123 | }
|
24124 | return ngModuleDef;
|
24125 | }
|
24126 | });
|
24127 | let ngFactoryDef = null;
|
24128 | Object.defineProperty(moduleType, NG_FACTORY_DEF, {
|
24129 | get: () => {
|
24130 | if (ngFactoryDef === null) {
|
24131 | const compiler = getCompilerFacade({ usage: 0 , kind: 'NgModule', type: moduleType });
|
24132 | ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${moduleType.name}/ɵfac.js`, {
|
24133 | name: moduleType.name,
|
24134 | type: moduleType,
|
24135 | deps: reflectDependencies(moduleType),
|
24136 | target: compiler.FactoryTarget.NgModule,
|
24137 | typeArgumentCount: 0,
|
24138 | });
|
24139 | }
|
24140 | return ngFactoryDef;
|
24141 | },
|
24142 |
|
24143 | configurable: !!ngDevMode,
|
24144 | });
|
24145 | let ngInjectorDef = null;
|
24146 | Object.defineProperty(moduleType, NG_INJ_DEF, {
|
24147 | get: () => {
|
24148 | if (ngInjectorDef === null) {
|
24149 | ngDevMode &&
|
24150 | verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot);
|
24151 | const meta = {
|
24152 | name: moduleType.name,
|
24153 | type: moduleType,
|
24154 | providers: ngModule.providers || EMPTY_ARRAY,
|
24155 | imports: [
|
24156 | (ngModule.imports || EMPTY_ARRAY).map(resolveForwardRef),
|
24157 | (ngModule.exports || EMPTY_ARRAY).map(resolveForwardRef),
|
24158 | ],
|
24159 | };
|
24160 | const compiler = getCompilerFacade({ usage: 0 , kind: 'NgModule', type: moduleType });
|
24161 | ngInjectorDef =
|
24162 | compiler.compileInjector(angularCoreEnv, `ng:///${moduleType.name}/ɵinj.js`, meta);
|
24163 | }
|
24164 | return ngInjectorDef;
|
24165 | },
|
24166 |
|
24167 | configurable: !!ngDevMode,
|
24168 | });
|
24169 | }
|
24170 | function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot, importingModule) {
|
24171 | if (verifiedNgModule.get(moduleType))
|
24172 | return;
|
24173 | verifiedNgModule.set(moduleType, true);
|
24174 | moduleType = resolveForwardRef(moduleType);
|
24175 | let ngModuleDef;
|
24176 | if (importingModule) {
|
24177 | ngModuleDef = getNgModuleDef(moduleType);
|
24178 | if (!ngModuleDef) {
|
24179 | throw new Error(`Unexpected value '${moduleType.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
|
24180 | }
|
24181 | }
|
24182 | else {
|
24183 | ngModuleDef = getNgModuleDef(moduleType, true);
|
24184 | }
|
24185 | const errors = [];
|
24186 | const declarations = maybeUnwrapFn(ngModuleDef.declarations);
|
24187 | const imports = maybeUnwrapFn(ngModuleDef.imports);
|
24188 | flatten(imports).map(unwrapModuleWithProvidersImports).forEach(mod => {
|
24189 | verifySemanticsOfNgModuleImport(mod, moduleType);
|
24190 | verifySemanticsOfNgModuleDef(mod, false, moduleType);
|
24191 | });
|
24192 | const exports = maybeUnwrapFn(ngModuleDef.exports);
|
24193 | declarations.forEach(verifyDeclarationsHaveDefinitions);
|
24194 | declarations.forEach(verifyDirectivesHaveSelector);
|
24195 | const combinedDeclarations = [
|
24196 | ...declarations.map(resolveForwardRef),
|
24197 | ...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef),
|
24198 | ];
|
24199 | exports.forEach(verifyExportsAreDeclaredOrReExported);
|
24200 | declarations.forEach(decl => verifyDeclarationIsUnique(decl, allowDuplicateDeclarationsInRoot));
|
24201 | declarations.forEach(verifyComponentEntryComponentsIsPartOfNgModule);
|
24202 | const ngModule = getAnnotation(moduleType, 'NgModule');
|
24203 | if (ngModule) {
|
24204 | ngModule.imports &&
|
24205 | flatten(ngModule.imports).map(unwrapModuleWithProvidersImports).forEach(mod => {
|
24206 | verifySemanticsOfNgModuleImport(mod, moduleType);
|
24207 | verifySemanticsOfNgModuleDef(mod, false, moduleType);
|
24208 | });
|
24209 | ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyCorrectBootstrapType);
|
24210 | ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyComponentIsPartOfNgModule);
|
24211 | ngModule.entryComponents &&
|
24212 | deepForEach(ngModule.entryComponents, verifyComponentIsPartOfNgModule);
|
24213 | }
|
24214 |
|
24215 | if (errors.length) {
|
24216 | throw new Error(errors.join('\n'));
|
24217 | }
|
24218 |
|
24219 | function verifyDeclarationsHaveDefinitions(type) {
|
24220 | type = resolveForwardRef(type);
|
24221 | const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
|
24222 | if (!def) {
|
24223 | errors.push(`Unexpected value '${stringifyForError(type)}' declared by the module '${stringifyForError(moduleType)}'. Please add a @Pipe/@Directive/@Component annotation.`);
|
24224 | }
|
24225 | }
|
24226 | function verifyDirectivesHaveSelector(type) {
|
24227 | type = resolveForwardRef(type);
|
24228 | const def = getDirectiveDef(type);
|
24229 | if (!getComponentDef(type) && def && def.selectors.length == 0) {
|
24230 | errors.push(`Directive ${stringifyForError(type)} has no selector, please add it!`);
|
24231 | }
|
24232 | }
|
24233 | function verifyExportsAreDeclaredOrReExported(type) {
|
24234 | type = resolveForwardRef(type);
|
24235 | const kind = getComponentDef(type) && 'component' || getDirectiveDef(type) && 'directive' ||
|
24236 | getPipeDef$1(type) && 'pipe';
|
24237 | if (kind) {
|
24238 |
|
24239 |
|
24240 | if (combinedDeclarations.lastIndexOf(type) === -1) {
|
24241 |
|
24242 | errors.push(`Can't export ${kind} ${stringifyForError(type)} from ${stringifyForError(moduleType)} as it was neither declared nor imported!`);
|
24243 | }
|
24244 | }
|
24245 | }
|
24246 | function verifyDeclarationIsUnique(type, suppressErrors) {
|
24247 | type = resolveForwardRef(type);
|
24248 | const existingModule = ownerNgModule.get(type);
|
24249 | if (existingModule && existingModule !== moduleType) {
|
24250 | if (!suppressErrors) {
|
24251 | const modules = [existingModule, moduleType].map(stringifyForError).sort();
|
24252 | errors.push(`Type ${stringifyForError(type)} is part of the declarations of 2 modules: ${modules[0]} and ${modules[1]}! ` +
|
24253 | `Please consider moving ${stringifyForError(type)} to a higher module that imports ${modules[0]} and ${modules[1]}. ` +
|
24254 | `You can also create a new NgModule that exports and includes ${stringifyForError(type)} then import that NgModule in ${modules[0]} and ${modules[1]}.`);
|
24255 | }
|
24256 | }
|
24257 | else {
|
24258 |
|
24259 | ownerNgModule.set(type, moduleType);
|
24260 | }
|
24261 | }
|
24262 | function verifyComponentIsPartOfNgModule(type) {
|
24263 | type = resolveForwardRef(type);
|
24264 | const existingModule = ownerNgModule.get(type);
|
24265 | if (!existingModule) {
|
24266 | errors.push(`Component ${stringifyForError(type)} is not part of any NgModule or the module has not been imported into your module.`);
|
24267 | }
|
24268 | }
|
24269 | function verifyCorrectBootstrapType(type) {
|
24270 | type = resolveForwardRef(type);
|
24271 | if (!getComponentDef(type)) {
|
24272 | errors.push(`${stringifyForError(type)} cannot be used as an entry component.`);
|
24273 | }
|
24274 | }
|
24275 | function verifyComponentEntryComponentsIsPartOfNgModule(type) {
|
24276 | type = resolveForwardRef(type);
|
24277 | if (getComponentDef(type)) {
|
24278 |
|
24279 | const component = getAnnotation(type, 'Component');
|
24280 | if (component && component.entryComponents) {
|
24281 | deepForEach(component.entryComponents, verifyComponentIsPartOfNgModule);
|
24282 | }
|
24283 | }
|
24284 | }
|
24285 | function verifySemanticsOfNgModuleImport(type, importingModule) {
|
24286 | type = resolveForwardRef(type);
|
24287 | if (getComponentDef(type) || getDirectiveDef(type)) {
|
24288 | throw new Error(`Unexpected directive '${type.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
|
24289 | }
|
24290 | if (getPipeDef$1(type)) {
|
24291 | throw new Error(`Unexpected pipe '${type.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
|
24292 | }
|
24293 | }
|
24294 | }
|
24295 | function unwrapModuleWithProvidersImports(typeOrWithProviders) {
|
24296 | typeOrWithProviders = resolveForwardRef(typeOrWithProviders);
|
24297 | return typeOrWithProviders.ngModule || typeOrWithProviders;
|
24298 | }
|
24299 | function getAnnotation(type, name) {
|
24300 | let annotation = null;
|
24301 | collect(type.__annotations__);
|
24302 | collect(type.decorators);
|
24303 | return annotation;
|
24304 | function collect(annotations) {
|
24305 | if (annotations) {
|
24306 | annotations.forEach(readAnnotation);
|
24307 | }
|
24308 | }
|
24309 | function readAnnotation(decorator) {
|
24310 | if (!annotation) {
|
24311 | const proto = Object.getPrototypeOf(decorator);
|
24312 | if (proto.ngMetadataName == name) {
|
24313 | annotation = decorator;
|
24314 | }
|
24315 | else if (decorator.type) {
|
24316 | const proto = Object.getPrototypeOf(decorator.type);
|
24317 | if (proto.ngMetadataName == name) {
|
24318 | annotation = decorator.args[0];
|
24319 | }
|
24320 | }
|
24321 | }
|
24322 | }
|
24323 | }
|
24324 |
|
24325 |
|
24326 |
|
24327 |
|
24328 |
|
24329 |
|
24330 | let ownerNgModule = new WeakMap();
|
24331 | let verifiedNgModule = new WeakMap();
|
24332 | function resetCompiledComponents() {
|
24333 | ownerNgModule = new WeakMap();
|
24334 | verifiedNgModule = new WeakMap();
|
24335 | moduleQueue.length = 0;
|
24336 | }
|
24337 |
|
24338 |
|
24339 |
|
24340 |
|
24341 |
|
24342 | function computeCombinedExports(type) {
|
24343 | type = resolveForwardRef(type);
|
24344 | const ngModuleDef = getNgModuleDef(type, true);
|
24345 | return [...flatten(maybeUnwrapFn(ngModuleDef.exports).map((type) => {
|
24346 | const ngModuleDef = getNgModuleDef(type);
|
24347 | if (ngModuleDef) {
|
24348 | verifySemanticsOfNgModuleDef(type, false);
|
24349 | return computeCombinedExports(type);
|
24350 | }
|
24351 | else {
|
24352 | return type;
|
24353 | }
|
24354 | }))];
|
24355 | }
|
24356 |
|
24357 |
|
24358 |
|
24359 |
|
24360 |
|
24361 | function setScopeOnDeclaredComponents(moduleType, ngModule) {
|
24362 | const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
|
24363 | const transitiveScopes = transitiveScopesFor(moduleType);
|
24364 | declarations.forEach(declaration => {
|
24365 | if (declaration.hasOwnProperty(NG_COMP_DEF)) {
|
24366 |
|
24367 | const component = declaration;
|
24368 | const componentDef = getComponentDef(component);
|
24369 | patchComponentDefWithScope(componentDef, transitiveScopes);
|
24370 | }
|
24371 | else if (!declaration.hasOwnProperty(NG_DIR_DEF) && !declaration.hasOwnProperty(NG_PIPE_DEF)) {
|
24372 |
|
24373 | declaration.ngSelectorScope = moduleType;
|
24374 | }
|
24375 | });
|
24376 | }
|
24377 |
|
24378 |
|
24379 |
|
24380 |
|
24381 | function patchComponentDefWithScope(componentDef, transitiveScopes) {
|
24382 | componentDef.directiveDefs = () => Array.from(transitiveScopes.compilation.directives)
|
24383 | .map(dir => dir.hasOwnProperty(NG_COMP_DEF) ? getComponentDef(dir) : getDirectiveDef(dir))
|
24384 | .filter(def => !!def);
|
24385 | componentDef.pipeDefs = () => Array.from(transitiveScopes.compilation.pipes).map(pipe => getPipeDef$1(pipe));
|
24386 | componentDef.schemas = transitiveScopes.schemas;
|
24387 |
|
24388 |
|
24389 |
|
24390 |
|
24391 | componentDef.tView = null;
|
24392 | }
|
24393 |
|
24394 |
|
24395 |
|
24396 |
|
24397 |
|
24398 |
|
24399 |
|
24400 |
|
24401 |
|
24402 | function transitiveScopesFor(moduleType) {
|
24403 | if (!isNgModule(moduleType)) {
|
24404 | throw new Error(`${moduleType.name} does not have a module def (ɵmod property)`);
|
24405 | }
|
24406 | const def = getNgModuleDef(moduleType);
|
24407 | if (def.transitiveCompileScopes !== null) {
|
24408 | return def.transitiveCompileScopes;
|
24409 | }
|
24410 | const scopes = {
|
24411 | schemas: def.schemas || null,
|
24412 | compilation: {
|
24413 | directives: new Set(),
|
24414 | pipes: new Set(),
|
24415 | },
|
24416 | exported: {
|
24417 | directives: new Set(),
|
24418 | pipes: new Set(),
|
24419 | },
|
24420 | };
|
24421 | maybeUnwrapFn(def.imports).forEach((imported) => {
|
24422 | const importedType = imported;
|
24423 | if (!isNgModule(importedType)) {
|
24424 | throw new Error(`Importing ${importedType.name} which does not have a ɵmod property`);
|
24425 | }
|
24426 |
|
24427 |
|
24428 | const importedScope = transitiveScopesFor(importedType);
|
24429 | importedScope.exported.directives.forEach(entry => scopes.compilation.directives.add(entry));
|
24430 | importedScope.exported.pipes.forEach(entry => scopes.compilation.pipes.add(entry));
|
24431 | });
|
24432 | maybeUnwrapFn(def.declarations).forEach(declared => {
|
24433 | const declaredWithDefs = declared;
|
24434 | if (getPipeDef$1(declaredWithDefs)) {
|
24435 | scopes.compilation.pipes.add(declared);
|
24436 | }
|
24437 | else {
|
24438 |
|
24439 |
|
24440 |
|
24441 | scopes.compilation.directives.add(declared);
|
24442 | }
|
24443 | });
|
24444 | maybeUnwrapFn(def.exports).forEach((exported) => {
|
24445 | const exportedType = exported;
|
24446 |
|
24447 |
|
24448 | if (isNgModule(exportedType)) {
|
24449 |
|
24450 |
|
24451 | const exportedScope = transitiveScopesFor(exportedType);
|
24452 | exportedScope.exported.directives.forEach(entry => {
|
24453 | scopes.compilation.directives.add(entry);
|
24454 | scopes.exported.directives.add(entry);
|
24455 | });
|
24456 | exportedScope.exported.pipes.forEach(entry => {
|
24457 | scopes.compilation.pipes.add(entry);
|
24458 | scopes.exported.pipes.add(entry);
|
24459 | });
|
24460 | }
|
24461 | else if (getPipeDef$1(exportedType)) {
|
24462 | scopes.exported.pipes.add(exportedType);
|
24463 | }
|
24464 | else {
|
24465 | scopes.exported.directives.add(exportedType);
|
24466 | }
|
24467 | });
|
24468 | def.transitiveCompileScopes = scopes;
|
24469 | return scopes;
|
24470 | }
|
24471 | function expandModuleWithProviders(value) {
|
24472 | if (isModuleWithProviders(value)) {
|
24473 | return value.ngModule;
|
24474 | }
|
24475 | return value;
|
24476 | }
|
24477 | function isModuleWithProviders(value) {
|
24478 | return value.ngModule !== undefined;
|
24479 | }
|
24480 | function isNgModule(value) {
|
24481 | return !!getNgModuleDef(value);
|
24482 | }
|
24483 |
|
24484 |
|
24485 |
|
24486 |
|
24487 |
|
24488 |
|
24489 |
|
24490 |
|
24491 |
|
24492 |
|
24493 |
|
24494 |
|
24495 |
|
24496 |
|
24497 |
|
24498 |
|
24499 |
|
24500 |
|
24501 |
|
24502 |
|
24503 |
|
24504 | let compilationDepth = 0;
|
24505 |
|
24506 |
|
24507 |
|
24508 |
|
24509 |
|
24510 |
|
24511 |
|
24512 |
|
24513 |
|
24514 | function compileComponent(type, metadata) {
|
24515 |
|
24516 |
|
24517 | (typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();
|
24518 | let ngComponentDef = null;
|
24519 |
|
24520 | maybeQueueResolutionOfComponentResources(type, metadata);
|
24521 |
|
24522 |
|
24523 |
|
24524 | addDirectiveFactoryDef(type, metadata);
|
24525 | Object.defineProperty(type, NG_COMP_DEF, {
|
24526 | get: () => {
|
24527 | if (ngComponentDef === null) {
|
24528 | const compiler = getCompilerFacade({ usage: 0 , kind: 'component', type: type });
|
24529 | if (componentNeedsResolution(metadata)) {
|
24530 | const error = [`Component '${type.name}' is not resolved:`];
|
24531 | if (metadata.templateUrl) {
|
24532 | error.push(` - templateUrl: ${metadata.templateUrl}`);
|
24533 | }
|
24534 | if (metadata.styleUrls && metadata.styleUrls.length) {
|
24535 | error.push(` - styleUrls: ${JSON.stringify(metadata.styleUrls)}`);
|
24536 | }
|
24537 | error.push(`Did you run and wait for 'resolveComponentResources()'?`);
|
24538 | throw new Error(error.join('\n'));
|
24539 | }
|
24540 |
|
24541 |
|
24542 |
|
24543 |
|
24544 | const options = getJitOptions();
|
24545 | let preserveWhitespaces = metadata.preserveWhitespaces;
|
24546 | if (preserveWhitespaces === undefined) {
|
24547 | if (options !== null && options.preserveWhitespaces !== undefined) {
|
24548 | preserveWhitespaces = options.preserveWhitespaces;
|
24549 | }
|
24550 | else {
|
24551 | preserveWhitespaces = false;
|
24552 | }
|
24553 | }
|
24554 | let encapsulation = metadata.encapsulation;
|
24555 | if (encapsulation === undefined) {
|
24556 | if (options !== null && options.defaultEncapsulation !== undefined) {
|
24557 | encapsulation = options.defaultEncapsulation;
|
24558 | }
|
24559 | else {
|
24560 | encapsulation = ViewEncapsulation$1.Emulated;
|
24561 | }
|
24562 | }
|
24563 | const templateUrl = metadata.templateUrl || `ng:///${type.name}/template.html`;
|
24564 | const meta = {
|
24565 | ...directiveMetadata(type, metadata),
|
24566 | typeSourceSpan: compiler.createParseSourceSpan('Component', type.name, templateUrl),
|
24567 | template: metadata.template || '',
|
24568 | preserveWhitespaces,
|
24569 | styles: metadata.styles || EMPTY_ARRAY,
|
24570 | animations: metadata.animations,
|
24571 | directives: [],
|
24572 | changeDetection: metadata.changeDetection,
|
24573 | pipes: new Map(),
|
24574 | encapsulation,
|
24575 | interpolation: metadata.interpolation,
|
24576 | viewProviders: metadata.viewProviders || null,
|
24577 | };
|
24578 | compilationDepth++;
|
24579 | try {
|
24580 | if (meta.usesInheritance) {
|
24581 | addDirectiveDefToUndecoratedParents(type);
|
24582 | }
|
24583 | ngComponentDef = compiler.compileComponent(angularCoreEnv, templateUrl, meta);
|
24584 | }
|
24585 | finally {
|
24586 |
|
24587 | compilationDepth--;
|
24588 | }
|
24589 | if (compilationDepth === 0) {
|
24590 |
|
24591 |
|
24592 |
|
24593 |
|
24594 |
|
24595 | flushModuleScopingQueueAsMuchAsPossible();
|
24596 | }
|
24597 |
|
24598 |
|
24599 |
|
24600 |
|
24601 | if (hasSelectorScope(type)) {
|
24602 | const scopes = transitiveScopesFor(type.ngSelectorScope);
|
24603 | patchComponentDefWithScope(ngComponentDef, scopes);
|
24604 | }
|
24605 | }
|
24606 | return ngComponentDef;
|
24607 | },
|
24608 |
|
24609 | configurable: !!ngDevMode,
|
24610 | });
|
24611 | }
|
24612 | function hasSelectorScope(component) {
|
24613 | return component.ngSelectorScope !== undefined;
|
24614 | }
|
24615 |
|
24616 |
|
24617 |
|
24618 |
|
24619 |
|
24620 |
|
24621 |
|
24622 | function compileDirective(type, directive) {
|
24623 | let ngDirectiveDef = null;
|
24624 | addDirectiveFactoryDef(type, directive || {});
|
24625 | Object.defineProperty(type, NG_DIR_DEF, {
|
24626 | get: () => {
|
24627 | if (ngDirectiveDef === null) {
|
24628 |
|
24629 |
|
24630 |
|
24631 | const meta = getDirectiveMetadata(type, directive || {});
|
24632 | const compiler = getCompilerFacade({ usage: 0 , kind: 'directive', type });
|
24633 | ngDirectiveDef =
|
24634 | compiler.compileDirective(angularCoreEnv, meta.sourceMapUrl, meta.metadata);
|
24635 | }
|
24636 | return ngDirectiveDef;
|
24637 | },
|
24638 |
|
24639 | configurable: !!ngDevMode,
|
24640 | });
|
24641 | }
|
24642 | function getDirectiveMetadata(type, metadata) {
|
24643 | const name = type && type.name;
|
24644 | const sourceMapUrl = `ng:///${name}/ɵdir.js`;
|
24645 | const compiler = getCompilerFacade({ usage: 0 , kind: 'directive', type });
|
24646 | const facade = directiveMetadata(type, metadata);
|
24647 | facade.typeSourceSpan = compiler.createParseSourceSpan('Directive', name, sourceMapUrl);
|
24648 | if (facade.usesInheritance) {
|
24649 | addDirectiveDefToUndecoratedParents(type);
|
24650 | }
|
24651 | return { metadata: facade, sourceMapUrl };
|
24652 | }
|
24653 | function addDirectiveFactoryDef(type, metadata) {
|
24654 | let ngFactoryDef = null;
|
24655 | Object.defineProperty(type, NG_FACTORY_DEF, {
|
24656 | get: () => {
|
24657 | if (ngFactoryDef === null) {
|
24658 | const meta = getDirectiveMetadata(type, metadata);
|
24659 | const compiler = getCompilerFacade({ usage: 0 , kind: 'directive', type });
|
24660 | ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${type.name}/ɵfac.js`, {
|
24661 | name: meta.metadata.name,
|
24662 | type: meta.metadata.type,
|
24663 | typeArgumentCount: 0,
|
24664 | deps: reflectDependencies(type),
|
24665 | target: compiler.FactoryTarget.Directive
|
24666 | });
|
24667 | }
|
24668 | return ngFactoryDef;
|
24669 | },
|
24670 |
|
24671 | configurable: !!ngDevMode,
|
24672 | });
|
24673 | }
|
24674 | function extendsDirectlyFromObject(type) {
|
24675 | return Object.getPrototypeOf(type.prototype) === Object.prototype;
|
24676 | }
|
24677 |
|
24678 |
|
24679 |
|
24680 |
|
24681 | function directiveMetadata(type, metadata) {
|
24682 |
|
24683 | const reflect = getReflect();
|
24684 | const propMetadata = reflect.ownPropMetadata(type);
|
24685 | return {
|
24686 | name: type.name,
|
24687 | type: type,
|
24688 | selector: metadata.selector !== undefined ? metadata.selector : null,
|
24689 | host: metadata.host || EMPTY_OBJ,
|
24690 | propMetadata: propMetadata,
|
24691 | inputs: metadata.inputs || EMPTY_ARRAY,
|
24692 | outputs: metadata.outputs || EMPTY_ARRAY,
|
24693 | queries: extractQueriesMetadata(type, propMetadata, isContentQuery),
|
24694 | lifecycle: { usesOnChanges: reflect.hasLifecycleHook(type, 'ngOnChanges') },
|
24695 | typeSourceSpan: null,
|
24696 | usesInheritance: !extendsDirectlyFromObject(type),
|
24697 | exportAs: extractExportAs(metadata.exportAs),
|
24698 | providers: metadata.providers || null,
|
24699 | viewQueries: extractQueriesMetadata(type, propMetadata, isViewQuery)
|
24700 | };
|
24701 | }
|
24702 |
|
24703 |
|
24704 |
|
24705 | function addDirectiveDefToUndecoratedParents(type) {
|
24706 | const objPrototype = Object.prototype;
|
24707 | let parent = Object.getPrototypeOf(type.prototype).constructor;
|
24708 |
|
24709 | while (parent && parent !== objPrototype) {
|
24710 |
|
24711 |
|
24712 | if (!getDirectiveDef(parent) && !getComponentDef(parent) &&
|
24713 | shouldAddAbstractDirective(parent)) {
|
24714 | compileDirective(parent, null);
|
24715 | }
|
24716 | parent = Object.getPrototypeOf(parent);
|
24717 | }
|
24718 | }
|
24719 | function convertToR3QueryPredicate(selector) {
|
24720 | return typeof selector === 'string' ? splitByComma(selector) : resolveForwardRef(selector);
|
24721 | }
|
24722 | function convertToR3QueryMetadata(propertyName, ann) {
|
24723 | return {
|
24724 | propertyName: propertyName,
|
24725 | predicate: convertToR3QueryPredicate(ann.selector),
|
24726 | descendants: ann.descendants,
|
24727 | first: ann.first,
|
24728 | read: ann.read ? ann.read : null,
|
24729 | static: !!ann.static,
|
24730 | emitDistinctChangesOnly: !!ann.emitDistinctChangesOnly,
|
24731 | };
|
24732 | }
|
24733 | function extractQueriesMetadata(type, propMetadata, isQueryAnn) {
|
24734 | const queriesMeta = [];
|
24735 | for (const field in propMetadata) {
|
24736 | if (propMetadata.hasOwnProperty(field)) {
|
24737 | const annotations = propMetadata[field];
|
24738 | annotations.forEach(ann => {
|
24739 | if (isQueryAnn(ann)) {
|
24740 | if (!ann.selector) {
|
24741 | throw new Error(`Can't construct a query for the property "${field}" of ` +
|
24742 | `"${stringifyForError(type)}" since the query selector wasn't defined.`);
|
24743 | }
|
24744 | if (annotations.some(isInputAnnotation)) {
|
24745 | throw new Error(`Cannot combine @Input decorators with query decorators`);
|
24746 | }
|
24747 | queriesMeta.push(convertToR3QueryMetadata(field, ann));
|
24748 | }
|
24749 | });
|
24750 | }
|
24751 | }
|
24752 | return queriesMeta;
|
24753 | }
|
24754 | function extractExportAs(exportAs) {
|
24755 | return exportAs === undefined ? null : splitByComma(exportAs);
|
24756 | }
|
24757 | function isContentQuery(value) {
|
24758 | const name = value.ngMetadataName;
|
24759 | return name === 'ContentChild' || name === 'ContentChildren';
|
24760 | }
|
24761 | function isViewQuery(value) {
|
24762 | const name = value.ngMetadataName;
|
24763 | return name === 'ViewChild' || name === 'ViewChildren';
|
24764 | }
|
24765 | function isInputAnnotation(value) {
|
24766 | return value.ngMetadataName === 'Input';
|
24767 | }
|
24768 | function splitByComma(value) {
|
24769 | return value.split(',').map(piece => piece.trim());
|
24770 | }
|
24771 | const LIFECYCLE_HOOKS = [
|
24772 | 'ngOnChanges', 'ngOnInit', 'ngOnDestroy', 'ngDoCheck', 'ngAfterViewInit', 'ngAfterViewChecked',
|
24773 | 'ngAfterContentInit', 'ngAfterContentChecked'
|
24774 | ];
|
24775 | function shouldAddAbstractDirective(type) {
|
24776 | const reflect = getReflect();
|
24777 | if (LIFECYCLE_HOOKS.some(hookName => reflect.hasLifecycleHook(type, hookName))) {
|
24778 | return true;
|
24779 | }
|
24780 | const propMetadata = reflect.propMetadata(type);
|
24781 | for (const field in propMetadata) {
|
24782 | const annotations = propMetadata[field];
|
24783 | for (let i = 0; i < annotations.length; i++) {
|
24784 | const current = annotations[i];
|
24785 | const metadataName = current.ngMetadataName;
|
24786 | if (isInputAnnotation(current) || isContentQuery(current) || isViewQuery(current) ||
|
24787 | metadataName === 'Output' || metadataName === 'HostBinding' ||
|
24788 | metadataName === 'HostListener') {
|
24789 | return true;
|
24790 | }
|
24791 | }
|
24792 | }
|
24793 | return false;
|
24794 | }
|
24795 |
|
24796 |
|
24797 |
|
24798 |
|
24799 |
|
24800 |
|
24801 |
|
24802 |
|
24803 | function compilePipe(type, meta) {
|
24804 | let ngPipeDef = null;
|
24805 | let ngFactoryDef = null;
|
24806 | Object.defineProperty(type, NG_FACTORY_DEF, {
|
24807 | get: () => {
|
24808 | if (ngFactoryDef === null) {
|
24809 | const metadata = getPipeMetadata(type, meta);
|
24810 | const compiler = getCompilerFacade({ usage: 0 , kind: 'pipe', type: metadata.type });
|
24811 | ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${metadata.name}/ɵfac.js`, {
|
24812 | name: metadata.name,
|
24813 | type: metadata.type,
|
24814 | typeArgumentCount: 0,
|
24815 | deps: reflectDependencies(type),
|
24816 | target: compiler.FactoryTarget.Pipe
|
24817 | });
|
24818 | }
|
24819 | return ngFactoryDef;
|
24820 | },
|
24821 |
|
24822 | configurable: !!ngDevMode,
|
24823 | });
|
24824 | Object.defineProperty(type, NG_PIPE_DEF, {
|
24825 | get: () => {
|
24826 | if (ngPipeDef === null) {
|
24827 | const metadata = getPipeMetadata(type, meta);
|
24828 | const compiler = getCompilerFacade({ usage: 0 , kind: 'pipe', type: metadata.type });
|
24829 | ngPipeDef =
|
24830 | compiler.compilePipe(angularCoreEnv, `ng:///${metadata.name}/ɵpipe.js`, metadata);
|
24831 | }
|
24832 | return ngPipeDef;
|
24833 | },
|
24834 |
|
24835 | configurable: !!ngDevMode,
|
24836 | });
|
24837 | }
|
24838 | function getPipeMetadata(type, meta) {
|
24839 | return {
|
24840 | type: type,
|
24841 | name: type.name,
|
24842 | pipeName: meta.name,
|
24843 | pure: meta.pure !== undefined ? meta.pure : true
|
24844 | };
|
24845 | }
|
24846 |
|
24847 |
|
24848 |
|
24849 |
|
24850 |
|
24851 |
|
24852 |
|
24853 |
|
24854 |
|
24855 |
|
24856 |
|
24857 |
|
24858 |
|
24859 | const Directive = makeDecorator('Directive', (dir = {}) => dir, undefined, undefined, (type, meta) => SWITCH_COMPILE_DIRECTIVE(type, meta));
|
24860 |
|
24861 |
|
24862 |
|
24863 |
|
24864 |
|
24865 |
|
24866 | const Component = makeDecorator('Component', (c = {}) => ({ changeDetection: ChangeDetectionStrategy.Default, ...c }), Directive, undefined, (type, meta) => SWITCH_COMPILE_COMPONENT(type, meta));
|
24867 |
|
24868 |
|
24869 |
|
24870 |
|
24871 | const Pipe = makeDecorator('Pipe', (p) => ({ pure: true, ...p }), undefined, undefined, (type, meta) => SWITCH_COMPILE_PIPE(type, meta));
|
24872 |
|
24873 |
|
24874 |
|
24875 |
|
24876 | const Input = makePropDecorator('Input', (bindingPropertyName) => ({ bindingPropertyName }));
|
24877 |
|
24878 |
|
24879 |
|
24880 |
|
24881 | const Output = makePropDecorator('Output', (bindingPropertyName) => ({ bindingPropertyName }));
|
24882 |
|
24883 |
|
24884 |
|
24885 |
|
24886 | const HostBinding = makePropDecorator('HostBinding', (hostPropertyName) => ({ hostPropertyName }));
|
24887 |
|
24888 |
|
24889 |
|
24890 |
|
24891 |
|
24892 |
|
24893 |
|
24894 |
|
24895 |
|
24896 |
|
24897 |
|
24898 |
|
24899 |
|
24900 |
|
24901 |
|
24902 |
|
24903 |
|
24904 |
|
24905 |
|
24906 |
|
24907 |
|
24908 |
|
24909 |
|
24910 |
|
24911 |
|
24912 |
|
24913 |
|
24914 |
|
24915 |
|
24916 |
|
24917 |
|
24918 |
|
24919 |
|
24920 |
|
24921 |
|
24922 |
|
24923 |
|
24924 |
|
24925 |
|
24926 |
|
24927 |
|
24928 |
|
24929 |
|
24930 |
|
24931 |
|
24932 |
|
24933 |
|
24934 |
|
24935 |
|
24936 |
|
24937 |
|
24938 |
|
24939 |
|
24940 |
|
24941 |
|
24942 |
|
24943 | const HostListener = makePropDecorator('HostListener', (eventName, args) => ({ eventName, args }));
|
24944 | const SWITCH_COMPILE_COMPONENT__POST_R3__ = compileComponent;
|
24945 | const SWITCH_COMPILE_DIRECTIVE__POST_R3__ = compileDirective;
|
24946 | const SWITCH_COMPILE_PIPE__POST_R3__ = compilePipe;
|
24947 | const SWITCH_COMPILE_COMPONENT__PRE_R3__ = noop;
|
24948 | const SWITCH_COMPILE_DIRECTIVE__PRE_R3__ = noop;
|
24949 | const SWITCH_COMPILE_PIPE__PRE_R3__ = noop;
|
24950 | const SWITCH_COMPILE_COMPONENT = SWITCH_COMPILE_COMPONENT__POST_R3__;
|
24951 | const SWITCH_COMPILE_DIRECTIVE = SWITCH_COMPILE_DIRECTIVE__POST_R3__;
|
24952 | const SWITCH_COMPILE_PIPE = SWITCH_COMPILE_PIPE__POST_R3__;
|
24953 |
|
24954 |
|
24955 |
|
24956 |
|
24957 |
|
24958 |
|
24959 |
|
24960 |
|
24961 |
|
24962 |
|
24963 |
|
24964 |
|
24965 | const NgModule = makeDecorator('NgModule', (ngModule) => ngModule, undefined, undefined,
|
24966 |
|
24967 |
|
24968 |
|
24969 |
|
24970 |
|
24971 |
|
24972 |
|
24973 |
|
24974 |
|
24975 |
|
24976 |
|
24977 | (type, meta) => SWITCH_COMPILE_NGMODULE(type, meta));
|
24978 | function preR3NgModuleCompile(moduleType, metadata) {
|
24979 | let imports = (metadata && metadata.imports) || [];
|
24980 | if (metadata && metadata.exports) {
|
24981 | imports = [...imports, metadata.exports];
|
24982 | }
|
24983 | const moduleInjectorType = moduleType;
|
24984 | moduleInjectorType.ɵfac = convertInjectableProviderToFactory(moduleType, { useClass: moduleType });
|
24985 | moduleInjectorType.ɵinj =
|
24986 | ɵɵdefineInjector({ providers: metadata && metadata.providers, imports: imports });
|
24987 | }
|
24988 | const SWITCH_COMPILE_NGMODULE__POST_R3__ = compileNgModule;
|
24989 | const SWITCH_COMPILE_NGMODULE__PRE_R3__ = preR3NgModuleCompile;
|
24990 | const SWITCH_COMPILE_NGMODULE = SWITCH_COMPILE_NGMODULE__POST_R3__;
|
24991 |
|
24992 |
|
24993 |
|
24994 |
|
24995 |
|
24996 |
|
24997 |
|
24998 |
|
24999 |
|
25000 |
|
25001 |
|
25002 |
|
25003 |
|
25004 |
|
25005 |
|
25006 |
|
25007 |
|
25008 |
|
25009 |
|
25010 |
|
25011 |
|
25012 |
|
25013 |
|
25014 |
|
25015 |
|
25016 |
|
25017 |
|
25018 |
|
25019 | const ITS_JUST_ANGULAR = true;
|
25020 |
|
25021 |
|
25022 |
|
25023 |
|
25024 |
|
25025 |
|
25026 |
|
25027 |
|
25028 |
|
25029 |
|
25030 |
|
25031 |
|
25032 |
|
25033 |
|
25034 |
|
25035 |
|
25036 |
|
25037 |
|
25038 |
|
25039 |
|
25040 |
|
25041 |
|
25042 |
|
25043 |
|
25044 |
|
25045 |
|
25046 |
|
25047 |
|
25048 |
|
25049 |
|
25050 |
|
25051 |
|
25052 |
|
25053 |
|
25054 |
|
25055 |
|
25056 |
|
25057 |
|
25058 |
|
25059 |
|
25060 |
|
25061 |
|
25062 |
|
25063 |
|
25064 |
|
25065 |
|
25066 |
|
25067 |
|
25068 |
|
25069 |
|
25070 |
|
25071 |
|
25072 |
|
25073 |
|
25074 |
|
25075 |
|
25076 |
|
25077 |
|
25078 |
|
25079 |
|
25080 |
|
25081 |
|
25082 |
|
25083 |
|
25084 |
|
25085 |
|
25086 |
|
25087 |
|
25088 |
|
25089 |
|
25090 |
|
25091 | const APP_INITIALIZER = new InjectionToken('Application Initializer');
|
25092 |
|
25093 |
|
25094 |
|
25095 |
|
25096 |
|
25097 | class ApplicationInitStatus {
|
25098 | constructor(appInits) {
|
25099 | this.appInits = appInits;
|
25100 | this.resolve = noop;
|
25101 | this.reject = noop;
|
25102 | this.initialized = false;
|
25103 | this.done = false;
|
25104 | this.donePromise = new Promise((res, rej) => {
|
25105 | this.resolve = res;
|
25106 | this.reject = rej;
|
25107 | });
|
25108 | }
|
25109 |
|
25110 | runInitializers() {
|
25111 | if (this.initialized) {
|
25112 | return;
|
25113 | }
|
25114 | const asyncInitPromises = [];
|
25115 | const complete = () => {
|
25116 | this.done = true;
|
25117 | this.resolve();
|
25118 | };
|
25119 | if (this.appInits) {
|
25120 | for (let i = 0; i < this.appInits.length; i++) {
|
25121 | const initResult = this.appInits[i]();
|
25122 | if (isPromise(initResult)) {
|
25123 | asyncInitPromises.push(initResult);
|
25124 | }
|
25125 | else if (isObservable(initResult)) {
|
25126 | const observableAsPromise = new Promise((resolve, reject) => {
|
25127 | initResult.subscribe({ complete: resolve, error: reject });
|
25128 | });
|
25129 | asyncInitPromises.push(observableAsPromise);
|
25130 | }
|
25131 | }
|
25132 | }
|
25133 | Promise.all(asyncInitPromises)
|
25134 | .then(() => {
|
25135 | complete();
|
25136 | })
|
25137 | .catch(e => {
|
25138 | this.reject(e);
|
25139 | });
|
25140 | if (asyncInitPromises.length === 0) {
|
25141 | complete();
|
25142 | }
|
25143 | this.initialized = true;
|
25144 | }
|
25145 | }
|
25146 | ApplicationInitStatus.ɵfac = function ApplicationInitStatus_Factory(t) { return new (t || ApplicationInitStatus)(ɵɵinject(APP_INITIALIZER, 8)); };
|
25147 | ApplicationInitStatus.ɵprov = ɵɵdefineInjectable({ token: ApplicationInitStatus, factory: ApplicationInitStatus.ɵfac });
|
25148 | (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationInitStatus, [{
|
25149 | type: Injectable
|
25150 | }], function () { return [{ type: undefined, decorators: [{
|
25151 | type: Inject,
|
25152 | args: [APP_INITIALIZER]
|
25153 | }, {
|
25154 | type: Optional
|
25155 | }] }]; }, null); })();
|
25156 |
|
25157 |
|
25158 |
|
25159 |
|
25160 |
|
25161 |
|
25162 |
|
25163 |
|
25164 |
|
25165 |
|
25166 |
|
25167 |
|
25168 |
|
25169 |
|
25170 |
|
25171 |
|
25172 |
|
25173 |
|
25174 |
|
25175 | const APP_ID = new InjectionToken('AppId');
|
25176 | function _appIdRandomProviderFactory() {
|
25177 | return `${_randomChar()}${_randomChar()}${_randomChar()}`;
|
25178 | }
|
25179 |
|
25180 |
|
25181 |
|
25182 |
|
25183 | const APP_ID_RANDOM_PROVIDER = {
|
25184 | provide: APP_ID,
|
25185 | useFactory: _appIdRandomProviderFactory,
|
25186 | deps: [],
|
25187 | };
|
25188 | function _randomChar() {
|
25189 | return String.fromCharCode(97 + Math.floor(Math.random() * 25));
|
25190 | }
|
25191 |
|
25192 |
|
25193 |
|
25194 |
|
25195 | const PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
|
25196 |
|
25197 |
|
25198 |
|
25199 |
|
25200 | const PLATFORM_ID = new InjectionToken('Platform ID');
|
25201 |
|
25202 |
|
25203 |
|
25204 |
|
25205 |
|
25206 |
|
25207 |
|
25208 |
|
25209 |
|
25210 |
|
25211 | const APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
|
25212 |
|
25213 |
|
25214 |
|
25215 |
|
25216 |
|
25217 | const PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
|
25218 |
|
25219 |
|
25220 |
|
25221 |
|
25222 |
|
25223 |
|
25224 |
|
25225 |
|
25226 | class Console {
|
25227 | log(message) {
|
25228 |
|
25229 | console.log(message);
|
25230 | }
|
25231 |
|
25232 | warn(message) {
|
25233 |
|
25234 | console.warn(message);
|
25235 | }
|
25236 | }
|
25237 | Console.ɵfac = function Console_Factory(t) { return new (t || Console)(); };
|
25238 | Console.ɵprov = ɵɵdefineInjectable({ token: Console, factory: Console.ɵfac });
|
25239 | (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Console, [{
|
25240 | type: Injectable
|
25241 | }], null, null); })();
|
25242 |
|
25243 |
|
25244 |
|
25245 |
|
25246 |
|
25247 |
|
25248 |
|
25249 |
|
25250 |
|
25251 |
|
25252 |
|
25253 |
|
25254 |
|
25255 |
|
25256 |
|
25257 |
|
25258 |
|
25259 |
|
25260 |
|
25261 |
|
25262 |
|
25263 |
|
25264 |
|
25265 |
|
25266 |
|
25267 |
|
25268 |
|
25269 |
|
25270 |
|
25271 |
|
25272 | const LOCALE_ID = new InjectionToken('LocaleId');
|
25273 |
|
25274 |
|
25275 |
|
25276 |
|
25277 |
|
25278 |
|
25279 |
|
25280 |
|
25281 |
|
25282 |
|
25283 |
|
25284 |
|
25285 |
|
25286 |
|
25287 |
|
25288 |
|
25289 |
|
25290 |
|
25291 |
|
25292 |
|
25293 |
|
25294 |
|
25295 |
|
25296 |
|
25297 |
|
25298 |
|
25299 |
|
25300 |
|
25301 |
|
25302 |
|
25303 |
|
25304 |
|
25305 |
|
25306 |
|
25307 |
|
25308 |
|
25309 |
|
25310 |
|
25311 | const DEFAULT_CURRENCY_CODE = new InjectionToken('DefaultCurrencyCode');
|
25312 |
|
25313 |
|
25314 |
|
25315 |
|
25316 |
|
25317 |
|
25318 |
|
25319 |
|
25320 |
|
25321 |
|
25322 |
|
25323 |
|
25324 |
|
25325 |
|
25326 |
|
25327 |
|
25328 |
|
25329 |
|
25330 |
|
25331 |
|
25332 |
|
25333 |
|
25334 |
|
25335 |
|
25336 | const TRANSLATIONS = new InjectionToken('Translations');
|
25337 |
|
25338 |
|
25339 |
|
25340 |
|
25341 |
|
25342 |
|
25343 |
|
25344 |
|
25345 |
|
25346 |
|
25347 |
|
25348 |
|
25349 |
|
25350 |
|
25351 |
|
25352 |
|
25353 |
|
25354 |
|
25355 |
|
25356 |
|
25357 |
|
25358 | const TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
|
25359 |
|
25360 |
|
25361 |
|
25362 |
|
25363 |
|
25364 |
|
25365 |
|
25366 |
|
25367 |
|
25368 |
|
25369 |
|
25370 |
|
25371 |
|
25372 |
|
25373 |
|
25374 |
|
25375 |
|
25376 |
|
25377 |
|
25378 |
|
25379 |
|
25380 |
|
25381 |
|
25382 | var MissingTranslationStrategy;
|
25383 | (function (MissingTranslationStrategy) {
|
25384 | MissingTranslationStrategy[MissingTranslationStrategy["Error"] = 0] = "Error";
|
25385 | MissingTranslationStrategy[MissingTranslationStrategy["Warning"] = 1] = "Warning";
|
25386 | MissingTranslationStrategy[MissingTranslationStrategy["Ignore"] = 2] = "Ignore";
|
25387 | })(MissingTranslationStrategy || (MissingTranslationStrategy = {}));
|
25388 |
|
25389 |
|
25390 |
|
25391 |
|
25392 |
|
25393 |
|
25394 |
|
25395 |
|
25396 | const SWITCH_IVY_ENABLED__POST_R3__ = true;
|
25397 | const SWITCH_IVY_ENABLED__PRE_R3__ = false;
|
25398 | const ivyEnabled = SWITCH_IVY_ENABLED__POST_R3__;
|
25399 |
|
25400 |
|
25401 |
|
25402 |
|
25403 |
|
25404 |
|
25405 |
|
25406 |
|
25407 |
|
25408 |
|
25409 |
|
25410 |
|
25411 |
|
25412 |
|
25413 |
|
25414 |
|
25415 |
|
25416 |
|
25417 | class ModuleWithComponentFactories {
|
25418 | constructor(ngModuleFactory, componentFactories) {
|
25419 | this.ngModuleFactory = ngModuleFactory;
|
25420 | this.componentFactories = componentFactories;
|
25421 | }
|
25422 | }
|
25423 | function _throwError() {
|
25424 | throw new Error(`Runtime compiler is not loaded`);
|
25425 | }
|
25426 | const Compiler_compileModuleSync__PRE_R3__ = _throwError;
|
25427 | const Compiler_compileModuleSync__POST_R3__ = function (moduleType) {
|
25428 | return new NgModuleFactory(moduleType);
|
25429 | };
|
25430 | const Compiler_compileModuleSync = Compiler_compileModuleSync__POST_R3__;
|
25431 | const Compiler_compileModuleAsync__PRE_R3__ = _throwError;
|
25432 | const Compiler_compileModuleAsync__POST_R3__ = function (moduleType) {
|
25433 | return Promise.resolve(Compiler_compileModuleSync__POST_R3__(moduleType));
|
25434 | };
|
25435 | const Compiler_compileModuleAsync = Compiler_compileModuleAsync__POST_R3__;
|
25436 | const Compiler_compileModuleAndAllComponentsSync__PRE_R3__ = _throwError;
|
25437 | const Compiler_compileModuleAndAllComponentsSync__POST_R3__ = function (moduleType) {
|
25438 | const ngModuleFactory = Compiler_compileModuleSync__POST_R3__(moduleType);
|
25439 | const moduleDef = getNgModuleDef(moduleType);
|
25440 | const componentFactories = maybeUnwrapFn(moduleDef.declarations)
|
25441 | .reduce((factories, declaration) => {
|
25442 | const componentDef = getComponentDef(declaration);
|
25443 | componentDef && factories.push(new ComponentFactory(componentDef));
|
25444 | return factories;
|
25445 | }, []);
|
25446 | return new ModuleWithComponentFactories(ngModuleFactory, componentFactories);
|
25447 | };
|
25448 | const Compiler_compileModuleAndAllComponentsSync = Compiler_compileModuleAndAllComponentsSync__POST_R3__;
|
25449 | const Compiler_compileModuleAndAllComponentsAsync__PRE_R3__ = _throwError;
|
25450 | const Compiler_compileModuleAndAllComponentsAsync__POST_R3__ = function (moduleType) {
|
25451 | return Promise.resolve(Compiler_compileModuleAndAllComponentsSync__POST_R3__(moduleType));
|
25452 | };
|
25453 | const Compiler_compileModuleAndAllComponentsAsync = Compiler_compileModuleAndAllComponentsAsync__POST_R3__;
|
25454 |
|
25455 |
|
25456 |
|
25457 |
|
25458 |
|
25459 |
|
25460 |
|
25461 |
|
25462 |
|
25463 |
|
25464 |
|
25465 |
|
25466 |
|
25467 |
|
25468 |
|
25469 |
|
25470 | class Compiler {
|
25471 | constructor() {
|
25472 | |
25473 |
|
25474 |
|
25475 |
|
25476 | this.compileModuleSync = Compiler_compileModuleSync;
|
25477 | |
25478 |
|
25479 |
|
25480 | this.compileModuleAsync = Compiler_compileModuleAsync;
|
25481 | |
25482 |
|
25483 |
|
25484 | this.compileModuleAndAllComponentsSync = Compiler_compileModuleAndAllComponentsSync;
|
25485 | |
25486 |
|
25487 |
|
25488 | this.compileModuleAndAllComponentsAsync = Compiler_compileModuleAndAllComponentsAsync;
|
25489 | }
|
25490 | |
25491 |
|
25492 |
|
25493 | clearCache() { }
|
25494 | |
25495 |
|
25496 |
|
25497 | clearCacheFor(type) { }
|
25498 | |
25499 |
|
25500 |
|
25501 | getModuleId(moduleType) {
|
25502 | return undefined;
|
25503 | }
|
25504 | }
|
25505 | Compiler.ɵfac = function Compiler_Factory(t) { return new (t || Compiler)(); };
|
25506 | Compiler.ɵprov = ɵɵdefineInjectable({ token: Compiler, factory: Compiler.ɵfac });
|
25507 | (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Compiler, [{
|
25508 | type: Injectable
|
25509 | }], null, null); })();
|
25510 |
|
25511 |
|
25512 |
|
25513 |
|
25514 |
|
25515 | const COMPILER_OPTIONS = new InjectionToken('compilerOptions');
|
25516 |
|
25517 |
|
25518 |
|
25519 |
|
25520 |
|
25521 |
|
25522 |
|
25523 |
|
25524 |
|
25525 |
|
25526 | class CompilerFactory {
|
25527 | }
|
25528 |
|
25529 |
|
25530 |
|
25531 |
|
25532 |
|
25533 |
|
25534 |
|
25535 |
|
25536 | const promise = (() => Promise.resolve(0))();
|
25537 | function scheduleMicroTask(fn) {
|
25538 | if (typeof Zone === 'undefined') {
|
25539 |
|
25540 | promise.then(() => {
|
25541 | fn && fn.apply(null, null);
|
25542 | });
|
25543 | }
|
25544 | else {
|
25545 | Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
|
25546 | }
|
25547 | }
|
25548 |
|
25549 |
|
25550 |
|
25551 |
|
25552 |
|
25553 |
|
25554 |
|
25555 |
|
25556 | function getNativeRequestAnimationFrame() {
|
25557 | let nativeRequestAnimationFrame = _global['requestAnimationFrame'];
|
25558 | let nativeCancelAnimationFrame = _global['cancelAnimationFrame'];
|
25559 | if (typeof Zone !== 'undefined' && nativeRequestAnimationFrame && nativeCancelAnimationFrame) {
|
25560 |
|
25561 |
|
25562 | const unpatchedRequestAnimationFrame = nativeRequestAnimationFrame[Zone.__symbol__('OriginalDelegate')];
|
25563 | if (unpatchedRequestAnimationFrame) {
|
25564 | nativeRequestAnimationFrame = unpatchedRequestAnimationFrame;
|
25565 | }
|
25566 | const unpatchedCancelAnimationFrame = nativeCancelAnimationFrame[Zone.__symbol__('OriginalDelegate')];
|
25567 | if (unpatchedCancelAnimationFrame) {
|
25568 | nativeCancelAnimationFrame = unpatchedCancelAnimationFrame;
|
25569 | }
|
25570 | }
|
25571 | return { nativeRequestAnimationFrame, nativeCancelAnimationFrame };
|
25572 | }
|
25573 |
|
25574 |
|
25575 |
|
25576 |
|
25577 |
|
25578 |
|
25579 |
|
25580 |
|
25581 |
|
25582 |
|
25583 |
|
25584 |
|
25585 |
|
25586 |
|
25587 |
|
25588 |
|
25589 |
|
25590 |
|
25591 |
|
25592 |
|
25593 |
|
25594 |
|
25595 |
|
25596 |
|
25597 |
|
25598 |
|
25599 |
|
25600 |
|
25601 |
|
25602 |
|
25603 |
|
25604 |
|
25605 |
|
25606 |
|
25607 |
|
25608 |
|
25609 |
|
25610 |
|
25611 |
|
25612 |
|
25613 |
|
25614 |
|
25615 |
|
25616 |
|
25617 |
|
25618 |
|
25619 |
|
25620 |
|
25621 |
|
25622 |
|
25623 |
|
25624 |
|
25625 |
|
25626 |
|
25627 |
|
25628 |
|
25629 |
|
25630 |
|
25631 |
|
25632 |
|
25633 |
|
25634 |
|
25635 |
|
25636 |
|
25637 |
|
25638 |
|
25639 |
|
25640 |
|
25641 |
|
25642 |
|
25643 |
|
25644 |
|
25645 |
|
25646 |
|
25647 |
|
25648 |
|
25649 |
|
25650 |
|
25651 |
|
25652 |
|
25653 |
|
25654 |
|
25655 | class NgZone {
|
25656 | constructor({ enableLongStackTrace = false, shouldCoalesceEventChangeDetection = false, shouldCoalesceRunChangeDetection = false }) {
|
25657 | this.hasPendingMacrotasks = false;
|
25658 | this.hasPendingMicrotasks = false;
|
25659 | |
25660 |
|
25661 |
|
25662 | this.isStable = true;
|
25663 | |
25664 |
|
25665 |
|
25666 | this.onUnstable = new EventEmitter(false);
|
25667 | |
25668 |
|
25669 |
|
25670 |
|
25671 |
|
25672 | this.onMicrotaskEmpty = new EventEmitter(false);
|
25673 | |
25674 |
|
25675 |
|
25676 |
|
25677 |
|
25678 | this.onStable = new EventEmitter(false);
|
25679 | |
25680 |
|
25681 |
|
25682 | this.onError = new EventEmitter(false);
|
25683 | if (typeof Zone == 'undefined') {
|
25684 | throw new Error(`In this configuration Angular requires Zone.js`);
|
25685 | }
|
25686 | Zone.assertZonePatched();
|
25687 | const self = this;
|
25688 | self._nesting = 0;
|
25689 | self._outer = self._inner = Zone.current;
|
25690 | if (Zone['TaskTrackingZoneSpec']) {
|
25691 | self._inner = self._inner.fork(new Zone['TaskTrackingZoneSpec']);
|
25692 | }
|
25693 | if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {
|
25694 | self._inner = self._inner.fork(Zone['longStackTraceZoneSpec']);
|
25695 | }
|
25696 |
|
25697 |
|
25698 | self.shouldCoalesceEventChangeDetection =
|
25699 | !shouldCoalesceRunChangeDetection && shouldCoalesceEventChangeDetection;
|
25700 | self.shouldCoalesceRunChangeDetection = shouldCoalesceRunChangeDetection;
|
25701 | self.lastRequestAnimationFrameId = -1;
|
25702 | self.nativeRequestAnimationFrame = getNativeRequestAnimationFrame().nativeRequestAnimationFrame;
|
25703 | forkInnerZoneWithAngularBehavior(self);
|
25704 | }
|
25705 | static isInAngularZone() {
|
25706 | return Zone.current.get('isAngularZone') === true;
|
25707 | }
|
25708 | static assertInAngularZone() {
|
25709 | if (!NgZone.isInAngularZone()) {
|
25710 | throw new Error('Expected to be in Angular Zone, but it is not!');
|
25711 | }
|
25712 | }
|
25713 | static assertNotInAngularZone() {
|
25714 | if (NgZone.isInAngularZone()) {
|
25715 | throw new Error('Expected to not be in Angular Zone, but it is!');
|
25716 | }
|
25717 | }
|
25718 | |
25719 |
|
25720 |
|
25721 |
|
25722 |
|
25723 |
|
25724 |
|
25725 |
|
25726 |
|
25727 |
|
25728 |
|
25729 |
|
25730 | run(fn, applyThis, applyArgs) {
|
25731 | return this._inner.run(fn, applyThis, applyArgs);
|
25732 | }
|
25733 | |
25734 |
|
25735 |
|
25736 |
|
25737 |
|
25738 |
|
25739 |
|
25740 |
|
25741 |
|
25742 |
|
25743 |
|
25744 |
|
25745 | runTask(fn, applyThis, applyArgs, name) {
|
25746 | const zone = this._inner;
|
25747 | const task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop, noop);
|
25748 | try {
|
25749 | return zone.runTask(task, applyThis, applyArgs);
|
25750 | }
|
25751 | finally {
|
25752 | zone.cancelTask(task);
|
25753 | }
|
25754 | }
|
25755 | |
25756 |
|
25757 |
|
25758 |
|
25759 | runGuarded(fn, applyThis, applyArgs) {
|
25760 | return this._inner.runGuarded(fn, applyThis, applyArgs);
|
25761 | }
|
25762 | |
25763 |
|
25764 |
|
25765 |
|
25766 |
|
25767 |
|
25768 |
|
25769 |
|
25770 |
|
25771 |
|
25772 |
|
25773 |
|
25774 |
|
25775 | runOutsideAngular(fn) {
|
25776 | return this._outer.run(fn);
|
25777 | }
|
25778 | }
|
25779 | const EMPTY_PAYLOAD = {};
|
25780 | function checkStable(zone) {
|
25781 |
|
25782 |
|
25783 |
|
25784 |
|
25785 |
|
25786 |
|
25787 |
|
25788 |
|
25789 |
|
25790 |
|
25791 |
|
25792 |
|
25793 |
|
25794 |
|
25795 |
|
25796 | if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
|
25797 | try {
|
25798 | zone._nesting++;
|
25799 | zone.onMicrotaskEmpty.emit(null);
|
25800 | }
|
25801 | finally {
|
25802 | zone._nesting--;
|
25803 | if (!zone.hasPendingMicrotasks) {
|
25804 | try {
|
25805 | zone.runOutsideAngular(() => zone.onStable.emit(null));
|
25806 | }
|
25807 | finally {
|
25808 | zone.isStable = true;
|
25809 | }
|
25810 | }
|
25811 | }
|
25812 | }
|
25813 | }
|
25814 | function delayChangeDetectionForEvents(zone) {
|
25815 | |
25816 |
|
25817 |
|
25818 |
|
25819 |
|
25820 |
|
25821 |
|
25822 |
|
25823 |
|
25824 |
|
25825 |
|
25826 |
|
25827 |
|
25828 | if (zone.isCheckStableRunning || zone.lastRequestAnimationFrameId !== -1) {
|
25829 | return;
|
25830 | }
|
25831 | zone.lastRequestAnimationFrameId = zone.nativeRequestAnimationFrame.call(_global, () => {
|
25832 |
|
25833 |
|
25834 |
|
25835 |
|
25836 |
|
25837 |
|
25838 |
|
25839 |
|
25840 |
|
25841 | if (!zone.fakeTopEventTask) {
|
25842 | zone.fakeTopEventTask = Zone.root.scheduleEventTask('fakeTopEventTask', () => {
|
25843 | zone.lastRequestAnimationFrameId = -1;
|
25844 | updateMicroTaskStatus(zone);
|
25845 | zone.isCheckStableRunning = true;
|
25846 | checkStable(zone);
|
25847 | zone.isCheckStableRunning = false;
|
25848 | }, undefined, () => { }, () => { });
|
25849 | }
|
25850 | zone.fakeTopEventTask.invoke();
|
25851 | });
|
25852 | updateMicroTaskStatus(zone);
|
25853 | }
|
25854 | function forkInnerZoneWithAngularBehavior(zone) {
|
25855 | const delayChangeDetectionForEventsDelegate = () => {
|
25856 | delayChangeDetectionForEvents(zone);
|
25857 | };
|
25858 | zone._inner = zone._inner.fork({
|
25859 | name: 'angular',
|
25860 | properties: { 'isAngularZone': true },
|
25861 | onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => {
|
25862 | try {
|
25863 | onEnter(zone);
|
25864 | return delegate.invokeTask(target, task, applyThis, applyArgs);
|
25865 | }
|
25866 | finally {
|
25867 | if ((zone.shouldCoalesceEventChangeDetection && task.type === 'eventTask') ||
|
25868 | zone.shouldCoalesceRunChangeDetection) {
|
25869 | delayChangeDetectionForEventsDelegate();
|
25870 | }
|
25871 | onLeave(zone);
|
25872 | }
|
25873 | },
|
25874 | onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => {
|
25875 | try {
|
25876 | onEnter(zone);
|
25877 | return delegate.invoke(target, callback, applyThis, applyArgs, source);
|
25878 | }
|
25879 | finally {
|
25880 | if (zone.shouldCoalesceRunChangeDetection) {
|
25881 | delayChangeDetectionForEventsDelegate();
|
25882 | }
|
25883 | onLeave(zone);
|
25884 | }
|
25885 | },
|
25886 | onHasTask: (delegate, current, target, hasTaskState) => {
|
25887 | delegate.hasTask(target, hasTaskState);
|
25888 | if (current === target) {
|
25889 |
|
25890 |
|
25891 | if (hasTaskState.change == 'microTask') {
|
25892 | zone._hasPendingMicrotasks = hasTaskState.microTask;
|
25893 | updateMicroTaskStatus(zone);
|
25894 | checkStable(zone);
|
25895 | }
|
25896 | else if (hasTaskState.change == 'macroTask') {
|
25897 | zone.hasPendingMacrotasks = hasTaskState.macroTask;
|
25898 | }
|
25899 | }
|
25900 | },
|
25901 | onHandleError: (delegate, current, target, error) => {
|
25902 | delegate.handleError(target, error);
|
25903 | zone.runOutsideAngular(() => zone.onError.emit(error));
|
25904 | return false;
|
25905 | }
|
25906 | });
|
25907 | }
|
25908 | function updateMicroTaskStatus(zone) {
|
25909 | if (zone._hasPendingMicrotasks ||
|
25910 | ((zone.shouldCoalesceEventChangeDetection || zone.shouldCoalesceRunChangeDetection) &&
|
25911 | zone.lastRequestAnimationFrameId !== -1)) {
|
25912 | zone.hasPendingMicrotasks = true;
|
25913 | }
|
25914 | else {
|
25915 | zone.hasPendingMicrotasks = false;
|
25916 | }
|
25917 | }
|
25918 | function onEnter(zone) {
|
25919 | zone._nesting++;
|
25920 | if (zone.isStable) {
|
25921 | zone.isStable = false;
|
25922 | zone.onUnstable.emit(null);
|
25923 | }
|
25924 | }
|
25925 | function onLeave(zone) {
|
25926 | zone._nesting--;
|
25927 | checkStable(zone);
|
25928 | }
|
25929 |
|
25930 |
|
25931 |
|
25932 |
|
25933 | class NoopNgZone {
|
25934 | constructor() {
|
25935 | this.hasPendingMicrotasks = false;
|
25936 | this.hasPendingMacrotasks = false;
|
25937 | this.isStable = true;
|
25938 | this.onUnstable = new EventEmitter();
|
25939 | this.onMicrotaskEmpty = new EventEmitter();
|
25940 | this.onStable = new EventEmitter();
|
25941 | this.onError = new EventEmitter();
|
25942 | }
|
25943 | run(fn, applyThis, applyArgs) {
|
25944 | return fn.apply(applyThis, applyArgs);
|
25945 | }
|
25946 | runGuarded(fn, applyThis, applyArgs) {
|
25947 | return fn.apply(applyThis, applyArgs);
|
25948 | }
|
25949 | runOutsideAngular(fn) {
|
25950 | return fn();
|
25951 | }
|
25952 | runTask(fn, applyThis, applyArgs, name) {
|
25953 | return fn.apply(applyThis, applyArgs);
|
25954 | }
|
25955 | }
|
25956 |
|
25957 |
|
25958 |
|
25959 |
|
25960 |
|
25961 |
|
25962 |
|
25963 |
|
25964 |
|
25965 |
|
25966 |
|
25967 |
|
25968 |
|
25969 |
|
25970 | class Testability {
|
25971 | constructor(_ngZone) {
|
25972 | this._ngZone = _ngZone;
|
25973 | this._pendingCount = 0;
|
25974 | this._isZoneStable = true;
|
25975 | |
25976 |
|
25977 |
|
25978 |
|
25979 |
|
25980 |
|
25981 | this._didWork = false;
|
25982 | this._callbacks = [];
|
25983 | this.taskTrackingZone = null;
|
25984 | this._watchAngularEvents();
|
25985 | _ngZone.run(() => {
|
25986 | this.taskTrackingZone =
|
25987 | typeof Zone == 'undefined' ? null : Zone.current.get('TaskTrackingZone');
|
25988 | });
|
25989 | }
|
25990 | _watchAngularEvents() {
|
25991 | this._ngZone.onUnstable.subscribe({
|
25992 | next: () => {
|
25993 | this._didWork = true;
|
25994 | this._isZoneStable = false;
|
25995 | }
|
25996 | });
|
25997 | this._ngZone.runOutsideAngular(() => {
|
25998 | this._ngZone.onStable.subscribe({
|
25999 | next: () => {
|
26000 | NgZone.assertNotInAngularZone();
|
26001 | scheduleMicroTask(() => {
|
26002 | this._isZoneStable = true;
|
26003 | this._runCallbacksIfReady();
|
26004 | });
|
26005 | }
|
26006 | });
|
26007 | });
|
26008 | }
|
26009 | |
26010 |
|
26011 |
|
26012 |
|
26013 | increasePendingRequestCount() {
|
26014 | this._pendingCount += 1;
|
26015 | this._didWork = true;
|
26016 | return this._pendingCount;
|
26017 | }
|
26018 | |
26019 |
|
26020 |
|
26021 |
|
26022 | decreasePendingRequestCount() {
|
26023 | this._pendingCount -= 1;
|
26024 | if (this._pendingCount < 0) {
|
26025 | throw new Error('pending async requests below zero');
|
26026 | }
|
26027 | this._runCallbacksIfReady();
|
26028 | return this._pendingCount;
|
26029 | }
|
26030 | |
26031 |
|
26032 |
|
26033 | isStable() {
|
26034 | return this._isZoneStable && this._pendingCount === 0 && !this._ngZone.hasPendingMacrotasks;
|
26035 | }
|
26036 | _runCallbacksIfReady() {
|
26037 | if (this.isStable()) {
|
26038 |
|
26039 | scheduleMicroTask(() => {
|
26040 | while (this._callbacks.length !== 0) {
|
26041 | let cb = this._callbacks.pop();
|
26042 | clearTimeout(cb.timeoutId);
|
26043 | cb.doneCb(this._didWork);
|
26044 | }
|
26045 | this._didWork = false;
|
26046 | });
|
26047 | }
|
26048 | else {
|
26049 |
|
26050 | let pending = this.getPendingTasks();
|
26051 | this._callbacks = this._callbacks.filter((cb) => {
|
26052 | if (cb.updateCb && cb.updateCb(pending)) {
|
26053 | clearTimeout(cb.timeoutId);
|
26054 | return false;
|
26055 | }
|
26056 | return true;
|
26057 | });
|
26058 | this._didWork = true;
|
26059 | }
|
26060 | }
|
26061 | getPendingTasks() {
|
26062 | if (!this.taskTrackingZone) {
|
26063 | return [];
|
26064 | }
|
26065 |
|
26066 | return this.taskTrackingZone.macroTasks.map((t) => {
|
26067 | return {
|
26068 | source: t.source,
|
26069 |
|
26070 |
|
26071 | creationLocation: t.creationLocation,
|
26072 | data: t.data
|
26073 | };
|
26074 | });
|
26075 | }
|
26076 | addCallback(cb, timeout, updateCb) {
|
26077 | let timeoutId = -1;
|
26078 | if (timeout && timeout > 0) {
|
26079 | timeoutId = setTimeout(() => {
|
26080 | this._callbacks = this._callbacks.filter((cb) => cb.timeoutId !== timeoutId);
|
26081 | cb(this._didWork, this.getPendingTasks());
|
26082 | }, timeout);
|
26083 | }
|
26084 | this._callbacks.push({ doneCb: cb, timeoutId: timeoutId, updateCb: updateCb });
|
26085 | }
|
26086 | |
26087 |
|
26088 |
|
26089 |
|
26090 |
|
26091 |
|
26092 |
|
26093 |
|
26094 |
|
26095 |
|
26096 |
|
26097 |
|
26098 | whenStable(doneCb, timeout, updateCb) {
|
26099 | if (updateCb && !this.taskTrackingZone) {
|
26100 | throw new Error('Task tracking zone is required when passing an update callback to ' +
|
26101 | 'whenStable(). Is "zone.js/plugins/task-tracking" loaded?');
|
26102 | }
|
26103 |
|
26104 | this.addCallback(doneCb, timeout, updateCb);
|
26105 | this._runCallbacksIfReady();
|
26106 | }
|
26107 | |
26108 |
|
26109 |
|
26110 |
|
26111 | getPendingRequestCount() {
|
26112 | return this._pendingCount;
|
26113 | }
|
26114 | |
26115 |
|
26116 |
|
26117 |
|
26118 |
|
26119 |
|
26120 | findProviders(using, provider, exactMatch) {
|
26121 |
|
26122 | return [];
|
26123 | }
|
26124 | }
|
26125 | Testability.ɵfac = function Testability_Factory(t) { return new (t || Testability)(ɵɵinject(NgZone)); };
|
26126 | Testability.ɵprov = ɵɵdefineInjectable({ token: Testability, factory: Testability.ɵfac });
|
26127 | (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Testability, [{
|
26128 | type: Injectable
|
26129 | }], function () { return [{ type: NgZone }]; }, null); })();
|
26130 |
|
26131 |
|
26132 |
|
26133 |
|
26134 | class TestabilityRegistry {
|
26135 | constructor() {
|
26136 |
|
26137 | this._applications = new Map();
|
26138 | _testabilityGetter.addToWindow(this);
|
26139 | }
|
26140 | |
26141 |
|
26142 |
|
26143 |
|
26144 |
|
26145 | registerApplication(token, testability) {
|
26146 | this._applications.set(token, testability);
|
26147 | }
|
26148 | |
26149 |
|
26150 |
|
26151 |
|
26152 | unregisterApplication(token) {
|
26153 | this._applications.delete(token);
|
26154 | }
|
26155 | |
26156 |
|
26157 |
|
26158 | unregisterAllApplications() {
|
26159 | this._applications.clear();
|
26160 | }
|
26161 | |
26162 |
|
26163 |
|
26164 |
|
26165 | getTestability(elem) {
|
26166 | return this._applications.get(elem) || null;
|
26167 | }
|
26168 | |
26169 |
|
26170 |
|
26171 | getAllTestabilities() {
|
26172 | return Array.from(this._applications.values());
|
26173 | }
|
26174 | |
26175 |
|
26176 |
|
26177 | getAllRootElements() {
|
26178 | return Array.from(this._applications.keys());
|
26179 | }
|
26180 | |
26181 |
|
26182 |
|
26183 |
|
26184 |
|
26185 |
|
26186 | findTestabilityInTree(elem, findInAncestors = true) {
|
26187 | return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
|
26188 | }
|
26189 | }
|
26190 | TestabilityRegistry.ɵfac = function TestabilityRegistry_Factory(t) { return new (t || TestabilityRegistry)(); };
|
26191 | TestabilityRegistry.ɵprov = ɵɵdefineInjectable({ token: TestabilityRegistry, factory: TestabilityRegistry.ɵfac });
|
26192 | (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TestabilityRegistry, [{
|
26193 | type: Injectable
|
26194 | }], function () { return []; }, null); })();
|
26195 | class _NoopGetTestability {
|
26196 | addToWindow(registry) { }
|
26197 | findTestabilityInTree(registry, elem, findInAncestors) {
|
26198 | return null;
|
26199 | }
|
26200 | }
|
26201 |
|
26202 |
|
26203 |
|
26204 |
|
26205 | function setTestabilityGetter(getter) {
|
26206 | _testabilityGetter = getter;
|
26207 | }
|
26208 | let _testabilityGetter = new _NoopGetTestability();
|
26209 |
|
26210 |
|
26211 |
|
26212 |
|
26213 |
|
26214 |
|
26215 |
|
26216 |
|
26217 |
|
26218 |
|
26219 |
|
26220 |
|
26221 |
|
26222 |
|
26223 | let _devMode = true;
|
26224 | let _runModeLocked = false;
|
26225 |
|
26226 |
|
26227 |
|
26228 |
|
26229 |
|
26230 |
|
26231 |
|
26232 |
|
26233 | function isDevMode() {
|
26234 | _runModeLocked = true;
|
26235 | return _devMode;
|
26236 | }
|
26237 |
|
26238 |
|
26239 |
|
26240 |
|
26241 |
|
26242 |
|
26243 |
|
26244 |
|
26245 |
|
26246 |
|
26247 | function enableProdMode() {
|
26248 | if (_runModeLocked) {
|
26249 | throw new Error('Cannot enable prod mode after platform setup.');
|
26250 | }
|
26251 |
|
26252 |
|
26253 | if (typeof ngDevMode === undefined || !!ngDevMode) {
|
26254 | _global['ngDevMode'] = false;
|
26255 | }
|
26256 | _devMode = false;
|
26257 | }
|
26258 |
|
26259 |
|
26260 |
|
26261 |
|
26262 |
|
26263 |
|
26264 |
|
26265 |
|
26266 | let _platform;
|
26267 | let compileNgModuleFactory = compileNgModuleFactory__POST_R3__;
|
26268 | function compileNgModuleFactory__PRE_R3__(injector, options, moduleType) {
|
26269 | const compilerFactory = injector.get(CompilerFactory);
|
26270 | const compiler = compilerFactory.createCompiler([options]);
|
26271 | return compiler.compileModuleAsync(moduleType);
|
26272 | }
|
26273 | function compileNgModuleFactory__POST_R3__(injector, options, moduleType) {
|
26274 | ngDevMode && assertNgModuleType(moduleType);
|
26275 | const moduleFactory = new NgModuleFactory(moduleType);
|
26276 |
|
26277 | if (typeof ngJitMode !== 'undefined' && !ngJitMode) {
|
26278 | return Promise.resolve(moduleFactory);
|
26279 | }
|
26280 | const compilerOptions = injector.get(COMPILER_OPTIONS, []).concat(options);
|
26281 |
|
26282 |
|
26283 |
|
26284 | setJitOptions({
|
26285 | defaultEncapsulation: _lastDefined(compilerOptions.map(opts => opts.defaultEncapsulation)),
|
26286 | preserveWhitespaces: _lastDefined(compilerOptions.map(opts => opts.preserveWhitespaces)),
|
26287 | });
|
26288 | if (isComponentResourceResolutionQueueEmpty()) {
|
26289 | return Promise.resolve(moduleFactory);
|
26290 | }
|
26291 | const compilerProviders = _mergeArrays(compilerOptions.map(o => o.providers));
|
26292 |
|
26293 |
|
26294 |
|
26295 |
|
26296 | if (compilerProviders.length === 0) {
|
26297 | return Promise.resolve(moduleFactory);
|
26298 | }
|
26299 | const compiler = getCompilerFacade({
|
26300 | usage: 0 ,
|
26301 | kind: 'NgModule',
|
26302 | type: moduleType,
|
26303 | });
|
26304 | const compilerInjector = Injector.create({ providers: compilerProviders });
|
26305 | const resourceLoader = compilerInjector.get(compiler.ResourceLoader);
|
26306 |
|
26307 |
|
26308 | return resolveComponentResources(url => Promise.resolve(resourceLoader.get(url)))
|
26309 | .then(() => moduleFactory);
|
26310 | }
|
26311 |
|
26312 |
|
26313 |
|
26314 | function publishDefaultGlobalUtils__PRE_R3__() { }
|
26315 | function publishDefaultGlobalUtils__POST_R3__() {
|
26316 | ngDevMode && publishDefaultGlobalUtils$1();
|
26317 | }
|
26318 | let publishDefaultGlobalUtils = publishDefaultGlobalUtils__POST_R3__;
|
26319 | let isBoundToModule = isBoundToModule__POST_R3__;
|
26320 | function isBoundToModule__PRE_R3__(cf) {
|
26321 | return cf instanceof ComponentFactoryBoundToModule;
|
26322 | }
|
26323 | function isBoundToModule__POST_R3__(cf) {
|
26324 | return cf.isBoundToModule;
|
26325 | }
|
26326 | const ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
|
26327 |
|
26328 |
|
26329 |
|
26330 |
|
26331 |
|
26332 | class NgProbeToken {
|
26333 | constructor(name, token) {
|
26334 | this.name = name;
|
26335 | this.token = token;
|
26336 | }
|
26337 | }
|
26338 |
|
26339 |
|
26340 |
|
26341 |
|
26342 |
|
26343 |
|
26344 | function createPlatform(injector) {
|
26345 | if (_platform && !_platform.destroyed &&
|
26346 | !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
26347 | throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
|
26348 | }
|
26349 | publishDefaultGlobalUtils();
|
26350 | _platform = injector.get(PlatformRef);
|
26351 | const inits = injector.get(PLATFORM_INITIALIZER, null);
|
26352 | if (inits)
|
26353 | inits.forEach((init) => init());
|
26354 | return _platform;
|
26355 | }
|
26356 |
|
26357 |
|
26358 |
|
26359 |
|
26360 |
|
26361 |
|
26362 |
|
26363 |
|
26364 |
|
26365 |
|
26366 |
|
26367 | function createPlatformFactory(parentPlatformFactory, name, providers = []) {
|
26368 | const desc = `Platform: ${name}`;
|
26369 | const marker = new InjectionToken(desc);
|
26370 | return (extraProviders = []) => {
|
26371 | let platform = getPlatform();
|
26372 | if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
26373 | if (parentPlatformFactory) {
|
26374 | parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
|
26375 | }
|
26376 | else {
|
26377 | const injectedProviders = providers.concat(extraProviders).concat({ provide: marker, useValue: true }, {
|
26378 | provide: INJECTOR_SCOPE,
|
26379 | useValue: 'platform'
|
26380 | });
|
26381 | createPlatform(Injector.create({ providers: injectedProviders, name: desc }));
|
26382 | }
|
26383 | }
|
26384 | return assertPlatform(marker);
|
26385 | };
|
26386 | }
|
26387 |
|
26388 |
|
26389 |
|
26390 |
|
26391 |
|
26392 | function assertPlatform(requiredToken) {
|
26393 | const platform = getPlatform();
|
26394 | if (!platform) {
|
26395 | throw new Error('No platform exists!');
|
26396 | }
|
26397 | if (!platform.injector.get(requiredToken, null)) {
|
26398 | throw new Error('A platform with a different configuration has been created. Please destroy it first.');
|
26399 | }
|
26400 | return platform;
|
26401 | }
|
26402 |
|
26403 |
|
26404 |
|
26405 |
|
26406 |
|
26407 |
|
26408 | function destroyPlatform() {
|
26409 | if (_platform && !_platform.destroyed) {
|
26410 | _platform.destroy();
|
26411 | }
|
26412 | }
|
26413 |
|
26414 |
|
26415 |
|
26416 |
|
26417 |
|
26418 | function getPlatform() {
|
26419 | return _platform && !_platform.destroyed ? _platform : null;
|
26420 | }
|
26421 |
|
26422 |
|
26423 |
|
26424 |
|
26425 |
|
26426 |
|
26427 |
|
26428 |
|
26429 |
|
26430 | class PlatformRef {
|
26431 |
|
26432 | constructor(_injector) {
|
26433 | this._injector = _injector;
|
26434 | this._modules = [];
|
26435 | this._destroyListeners = [];
|
26436 | this._destroyed = false;
|
26437 | }
|
26438 | |
26439 |
|
26440 |
|
26441 |
|
26442 |
|
26443 |
|
26444 |
|
26445 |
|
26446 |
|
26447 |
|
26448 |
|
26449 |
|
26450 |
|
26451 |
|
26452 |
|
26453 |
|
26454 |
|
26455 |
|
26456 |
|
26457 |
|
26458 |
|
26459 |
|
26460 |
|
26461 |
|
26462 |
|
26463 | bootstrapModuleFactory(moduleFactory, options) {
|
26464 |
|
26465 |
|
26466 |
|
26467 |
|
26468 | const ngZoneOption = options ? options.ngZone : undefined;
|
26469 | const ngZoneEventCoalescing = (options && options.ngZoneEventCoalescing) || false;
|
26470 | const ngZoneRunCoalescing = (options && options.ngZoneRunCoalescing) || false;
|
26471 | const ngZone = getNgZone(ngZoneOption, { ngZoneEventCoalescing, ngZoneRunCoalescing });
|
26472 | const providers = [{ provide: NgZone, useValue: ngZone }];
|
26473 |
|
26474 |
|
26475 |
|
26476 |
|
26477 | return ngZone.run(() => {
|
26478 | const ngZoneInjector = Injector.create({ providers: providers, parent: this.injector, name: moduleFactory.moduleType.name });
|
26479 | const moduleRef = moduleFactory.create(ngZoneInjector);
|
26480 | const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
|
26481 | if (!exceptionHandler) {
|
26482 | throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
|
26483 | }
|
26484 | ngZone.runOutsideAngular(() => {
|
26485 | const subscription = ngZone.onError.subscribe({
|
26486 | next: (error) => {
|
26487 | exceptionHandler.handleError(error);
|
26488 | }
|
26489 | });
|
26490 | moduleRef.onDestroy(() => {
|
26491 | remove(this._modules, moduleRef);
|
26492 | subscription.unsubscribe();
|
26493 | });
|
26494 | });
|
26495 | return _callAndReportToErrorHandler(exceptionHandler, ngZone, () => {
|
26496 | const initStatus = moduleRef.injector.get(ApplicationInitStatus);
|
26497 | initStatus.runInitializers();
|
26498 | return initStatus.donePromise.then(() => {
|
26499 | if (ivyEnabled) {
|
26500 |
|
26501 | const localeId = moduleRef.injector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
|
26502 | setLocaleId(localeId || DEFAULT_LOCALE_ID);
|
26503 | }
|
26504 | this._moduleDoBootstrap(moduleRef);
|
26505 | return moduleRef;
|
26506 | });
|
26507 | });
|
26508 | });
|
26509 | }
|
26510 | |
26511 |
|
26512 |
|
26513 |
|
26514 |
|
26515 |
|
26516 |
|
26517 |
|
26518 |
|
26519 |
|
26520 |
|
26521 |
|
26522 |
|
26523 |
|
26524 |
|
26525 |
|
26526 | bootstrapModule(moduleType, compilerOptions = []) {
|
26527 | const options = optionsReducer({}, compilerOptions);
|
26528 | return compileNgModuleFactory(this.injector, options, moduleType)
|
26529 | .then(moduleFactory => this.bootstrapModuleFactory(moduleFactory, options));
|
26530 | }
|
26531 | _moduleDoBootstrap(moduleRef) {
|
26532 | const appRef = moduleRef.injector.get(ApplicationRef);
|
26533 | if (moduleRef._bootstrapComponents.length > 0) {
|
26534 | moduleRef._bootstrapComponents.forEach(f => appRef.bootstrap(f));
|
26535 | }
|
26536 | else if (moduleRef.instance.ngDoBootstrap) {
|
26537 | moduleRef.instance.ngDoBootstrap(appRef);
|
26538 | }
|
26539 | else {
|
26540 | throw new Error(`The module ${stringify(moduleRef.instance
|
26541 | .constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
|
26542 | `Please define one of these.`);
|
26543 | }
|
26544 | this._modules.push(moduleRef);
|
26545 | }
|
26546 | |
26547 |
|
26548 |
|
26549 | onDestroy(callback) {
|
26550 | this._destroyListeners.push(callback);
|
26551 | }
|
26552 | |
26553 |
|
26554 |
|
26555 |
|
26556 | get injector() {
|
26557 | return this._injector;
|
26558 | }
|
26559 | |
26560 |
|
26561 |
|
26562 |
|
26563 | destroy() {
|
26564 | if (this._destroyed) {
|
26565 | throw new Error('The platform has already been destroyed!');
|
26566 | }
|
26567 | this._modules.slice().forEach(module => module.destroy());
|
26568 | this._destroyListeners.forEach(listener => listener());
|
26569 | this._destroyed = true;
|
26570 | }
|
26571 | get destroyed() {
|
26572 | return this._destroyed;
|
26573 | }
|
26574 | }
|
26575 | PlatformRef.ɵfac = function PlatformRef_Factory(t) { return new (t || PlatformRef)(ɵɵinject(Injector)); };
|
26576 | PlatformRef.ɵprov = ɵɵdefineInjectable({ token: PlatformRef, factory: PlatformRef.ɵfac });
|
26577 | (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformRef, [{
|
26578 | type: Injectable
|
26579 | }], function () { return [{ type: Injector }]; }, null); })();
|
26580 | function getNgZone(ngZoneOption, extra) {
|
26581 | let ngZone;
|
26582 | if (ngZoneOption === 'noop') {
|
26583 | ngZone = new NoopNgZone();
|
26584 | }
|
26585 | else {
|
26586 | ngZone = (ngZoneOption === 'zone.js' ? undefined : ngZoneOption) || new NgZone({
|
26587 | enableLongStackTrace: isDevMode(),
|
26588 | shouldCoalesceEventChangeDetection: !!extra?.ngZoneEventCoalescing,
|
26589 | shouldCoalesceRunChangeDetection: !!extra?.ngZoneRunCoalescing
|
26590 | });
|
26591 | }
|
26592 | return ngZone;
|
26593 | }
|
26594 | function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
|
26595 | try {
|
26596 | const result = callback();
|
26597 | if (isPromise(result)) {
|
26598 | return result.catch((e) => {
|
26599 | ngZone.runOutsideAngular(() => errorHandler.handleError(e));
|
26600 |
|
26601 | throw e;
|
26602 | });
|
26603 | }
|
26604 | return result;
|
26605 | }
|
26606 | catch (e) {
|
26607 | ngZone.runOutsideAngular(() => errorHandler.handleError(e));
|
26608 |
|
26609 | throw e;
|
26610 | }
|
26611 | }
|
26612 | function optionsReducer(dst, objs) {
|
26613 | if (Array.isArray(objs)) {
|
26614 | dst = objs.reduce(optionsReducer, dst);
|
26615 | }
|
26616 | else {
|
26617 | dst = { ...dst, ...objs };
|
26618 | }
|
26619 | return dst;
|
26620 | }
|
26621 |
|
26622 |
|
26623 |
|
26624 |
|
26625 |
|
26626 |
|
26627 |
|
26628 |
|
26629 |
|
26630 |
|
26631 |
|
26632 |
|
26633 |
|
26634 |
|
26635 |
|
26636 |
|
26637 |
|
26638 |
|
26639 |
|
26640 |
|
26641 |
|
26642 |
|
26643 |
|
26644 |
|
26645 |
|
26646 |
|
26647 |
|
26648 |
|
26649 |
|
26650 |
|
26651 |
|
26652 |
|
26653 |
|
26654 |
|
26655 |
|
26656 |
|
26657 |
|
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 |
|
26700 |
|
26701 |
|
26702 |
|
26703 |
|
26704 |
|
26705 |
|
26706 |
|
26707 |
|
26708 |
|
26709 |
|
26710 |
|
26711 |
|
26712 |
|
26713 |
|
26714 | class ApplicationRef {
|
26715 |
|
26716 | constructor(_zone, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
|
26717 | this._zone = _zone;
|
26718 | this._injector = _injector;
|
26719 | this._exceptionHandler = _exceptionHandler;
|
26720 | this._componentFactoryResolver = _componentFactoryResolver;
|
26721 | this._initStatus = _initStatus;
|
26722 |
|
26723 | this._bootstrapListeners = [];
|
26724 | this._views = [];
|
26725 | this._runningTick = false;
|
26726 | this._stable = true;
|
26727 | |
26728 |
|
26729 |
|
26730 |
|
26731 | this.componentTypes = [];
|
26732 | |
26733 |
|
26734 |
|
26735 | this.components = [];
|
26736 | this._onMicrotaskEmptySubscription = this._zone.onMicrotaskEmpty.subscribe({
|
26737 | next: () => {
|
26738 | this._zone.run(() => {
|
26739 | this.tick();
|
26740 | });
|
26741 | }
|
26742 | });
|
26743 | const isCurrentlyStable = new Observable((observer) => {
|
26744 | this._stable = this._zone.isStable && !this._zone.hasPendingMacrotasks &&
|
26745 | !this._zone.hasPendingMicrotasks;
|
26746 | this._zone.runOutsideAngular(() => {
|
26747 | observer.next(this._stable);
|
26748 | observer.complete();
|
26749 | });
|
26750 | });
|
26751 | const isStable = new Observable((observer) => {
|
26752 |
|
26753 |
|
26754 | let stableSub;
|
26755 | this._zone.runOutsideAngular(() => {
|
26756 | stableSub = this._zone.onStable.subscribe(() => {
|
26757 | NgZone.assertNotInAngularZone();
|
26758 |
|
26759 |
|
26760 | scheduleMicroTask(() => {
|
26761 | if (!this._stable && !this._zone.hasPendingMacrotasks &&
|
26762 | !this._zone.hasPendingMicrotasks) {
|
26763 | this._stable = true;
|
26764 | observer.next(true);
|
26765 | }
|
26766 | });
|
26767 | });
|
26768 | });
|
26769 | const unstableSub = this._zone.onUnstable.subscribe(() => {
|
26770 | NgZone.assertInAngularZone();
|
26771 | if (this._stable) {
|
26772 | this._stable = false;
|
26773 | this._zone.runOutsideAngular(() => {
|
26774 | observer.next(false);
|
26775 | });
|
26776 | }
|
26777 | });
|
26778 | return () => {
|
26779 | stableSub.unsubscribe();
|
26780 | unstableSub.unsubscribe();
|
26781 | };
|
26782 | });
|
26783 | this.isStable =
|
26784 | merge$1(isCurrentlyStable, isStable.pipe(share()));
|
26785 | }
|
26786 | |
26787 |
|
26788 |
|
26789 |
|
26790 |
|
26791 |
|
26792 |
|
26793 |
|
26794 |
|
26795 |
|
26796 |
|
26797 |
|
26798 |
|
26799 |
|
26800 |
|
26801 |
|
26802 |
|
26803 |
|
26804 |
|
26805 |
|
26806 |
|
26807 |
|
26808 |
|
26809 |
|
26810 |
|
26811 |
|
26812 |
|
26813 |
|
26814 |
|
26815 |
|
26816 |
|
26817 |
|
26818 |
|
26819 |
|
26820 |
|
26821 |
|
26822 |
|
26823 | bootstrap(componentOrFactory, rootSelectorOrNode) {
|
26824 | if (!this._initStatus.done) {
|
26825 | throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
26826 | }
|
26827 | let componentFactory;
|
26828 | if (componentOrFactory instanceof ComponentFactory$1) {
|
26829 | componentFactory = componentOrFactory;
|
26830 | }
|
26831 | else {
|
26832 | componentFactory =
|
26833 | this._componentFactoryResolver.resolveComponentFactory(componentOrFactory);
|
26834 | }
|
26835 | this.componentTypes.push(componentFactory.componentType);
|
26836 |
|
26837 | const ngModule = isBoundToModule(componentFactory) ? undefined : this._injector.get(NgModuleRef$1);
|
26838 | const selectorOrNode = rootSelectorOrNode || componentFactory.selector;
|
26839 | const compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
|
26840 | const nativeElement = compRef.location.nativeElement;
|
26841 | const testability = compRef.injector.get(Testability, null);
|
26842 | const testabilityRegistry = testability && compRef.injector.get(TestabilityRegistry);
|
26843 | if (testability && testabilityRegistry) {
|
26844 | testabilityRegistry.registerApplication(nativeElement, testability);
|
26845 | }
|
26846 | compRef.onDestroy(() => {
|
26847 | this.detachView(compRef.hostView);
|
26848 | remove(this.components, compRef);
|
26849 | if (testabilityRegistry) {
|
26850 | testabilityRegistry.unregisterApplication(nativeElement);
|
26851 | }
|
26852 | });
|
26853 | this._loadComponent(compRef);
|
26854 |
|
26855 |
|
26856 | if ((typeof ngDevMode === 'undefined' || ngDevMode) && isDevMode()) {
|
26857 | const _console = this._injector.get(Console);
|
26858 | _console.log(`Angular is running in development mode. Call enableProdMode() to enable production mode.`);
|
26859 | }
|
26860 | return compRef;
|
26861 | }
|
26862 | |
26863 |
|
26864 |
|
26865 |
|
26866 |
|
26867 |
|
26868 |
|
26869 |
|
26870 |
|
26871 |
|
26872 | tick() {
|
26873 | if (this._runningTick) {
|
26874 | throw new Error('ApplicationRef.tick is called recursively');
|
26875 | }
|
26876 | try {
|
26877 | this._runningTick = true;
|
26878 | for (let view of this._views) {
|
26879 | view.detectChanges();
|
26880 | }
|
26881 |
|
26882 |
|
26883 | if ((typeof ngDevMode === 'undefined' || ngDevMode) && isDevMode()) {
|
26884 | for (let view of this._views) {
|
26885 | view.checkNoChanges();
|
26886 | }
|
26887 | }
|
26888 | }
|
26889 | catch (e) {
|
26890 |
|
26891 | this._zone.runOutsideAngular(() => this._exceptionHandler.handleError(e));
|
26892 | }
|
26893 | finally {
|
26894 | this._runningTick = false;
|
26895 | }
|
26896 | }
|
26897 | |
26898 |
|
26899 |
|
26900 |
|
26901 |
|
26902 | attachView(viewRef) {
|
26903 | const view = viewRef;
|
26904 | this._views.push(view);
|
26905 | view.attachToAppRef(this);
|
26906 | }
|
26907 | |
26908 |
|
26909 |
|
26910 | detachView(viewRef) {
|
26911 | const view = viewRef;
|
26912 | remove(this._views, view);
|
26913 | view.detachFromAppRef();
|
26914 | }
|
26915 | _loadComponent(componentRef) {
|
26916 | this.attachView(componentRef.hostView);
|
26917 | this.tick();
|
26918 | this.components.push(componentRef);
|
26919 |
|
26920 | const listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
|
26921 | listeners.forEach((listener) => listener(componentRef));
|
26922 | }
|
26923 |
|
26924 | ngOnDestroy() {
|
26925 | this._views.slice().forEach((view) => view.destroy());
|
26926 | this._onMicrotaskEmptySubscription.unsubscribe();
|
26927 | }
|
26928 | |
26929 |
|
26930 |
|
26931 | get viewCount() {
|
26932 | return this._views.length;
|
26933 | }
|
26934 | }
|
26935 | ApplicationRef.ɵfac = function ApplicationRef_Factory(t) { return new (t || ApplicationRef)(ɵɵinject(NgZone), ɵɵinject(Injector), ɵɵinject(ErrorHandler), ɵɵinject(ComponentFactoryResolver$1), ɵɵinject(ApplicationInitStatus)); };
|
26936 | ApplicationRef.ɵprov = ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac });
|
26937 | (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
|
26938 | type: Injectable
|
26939 | }], function () { return [{ type: NgZone }, { type: Injector }, { type: ErrorHandler }, { type: ComponentFactoryResolver$1 }, { type: ApplicationInitStatus }]; }, null); })();
|
26940 | function remove(list, el) {
|
26941 | const index = list.indexOf(el);
|
26942 | if (index > -1) {
|
26943 | list.splice(index, 1);
|
26944 | }
|
26945 | }
|
26946 | function _lastDefined(args) {
|
26947 | for (let i = args.length - 1; i >= 0; i--) {
|
26948 | if (args[i] !== undefined) {
|
26949 | return args[i];
|
26950 | }
|
26951 | }
|
26952 | return undefined;
|
26953 | }
|
26954 | function _mergeArrays(parts) {
|
26955 | const result = [];
|
26956 | parts.forEach((part) => part && result.push(...part));
|
26957 | return result;
|
26958 | }
|
26959 |
|
26960 |
|
26961 |
|
26962 |
|
26963 |
|
26964 |
|
26965 |
|
26966 |
|
26967 |
|
26968 |
|
26969 |
|
26970 |
|
26971 |
|
26972 |
|
26973 |
|
26974 |
|
26975 |
|
26976 | function getModuleFactory__PRE_R3__(id) {
|
26977 | const factory = getRegisteredNgModuleType(id);
|
26978 | if (!factory)
|
26979 | throw noModuleError(id);
|
26980 | return factory;
|
26981 | }
|
26982 | function getModuleFactory__POST_R3__(id) {
|
26983 | const type = getRegisteredNgModuleType(id);
|
26984 | if (!type)
|
26985 | throw noModuleError(id);
|
26986 | return new NgModuleFactory(type);
|
26987 | }
|
26988 | function getNgModuleById__PRE_R3__(id) {
|
26989 | throw new Error(`ViewEngine doesn't support retrieving NgModule classes by id`);
|
26990 | }
|
26991 | function getNgModuleById__POST_R3__(id) {
|
26992 | const type = getRegisteredNgModuleType(id);
|
26993 | if (!type)
|
26994 | throw noModuleError(id);
|
26995 | return type;
|
26996 | }
|
26997 |
|
26998 |
|
26999 |
|
27000 |
|
27001 |
|
27002 |
|
27003 |
|
27004 | const getModuleFactory = getModuleFactory__POST_R3__;
|
27005 |
|
27006 |
|
27007 |
|
27008 |
|
27009 |
|
27010 |
|
27011 | const getNgModuleById = getNgModuleById__POST_R3__;
|
27012 | function noModuleError(id) {
|
27013 | return new Error(`No module with ID ${id} loaded`);
|
27014 | }
|
27015 |
|
27016 | const SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__ = injectChangeDetectorRef;
|
27017 | const SWITCH_CHANGE_DETECTOR_REF_FACTORY__PRE_R3__ = noop;
|
27018 | const SWITCH_CHANGE_DETECTOR_REF_FACTORY = SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__;
|
27019 |
|
27020 |
|
27021 |
|
27022 |
|
27023 |
|
27024 |
|
27025 |
|
27026 |
|
27027 |
|
27028 |
|
27029 |
|
27030 |
|
27031 |
|
27032 |
|
27033 |
|
27034 |
|
27035 |
|
27036 |
|
27037 |
|
27038 |
|
27039 |
|
27040 |
|
27041 |
|
27042 |
|
27043 |
|
27044 |
|
27045 |
|
27046 |
|
27047 |
|
27048 |
|
27049 |
|
27050 |
|
27051 |
|
27052 |
|
27053 |
|
27054 |
|
27055 |
|
27056 |
|
27057 |
|
27058 |
|
27059 |
|
27060 |
|
27061 |
|
27062 |
|
27063 |
|
27064 | class ChangeDetectorRef {
|
27065 | }
|
27066 |
|
27067 |
|
27068 |
|
27069 |
|
27070 | ChangeDetectorRef.__NG_ELEMENT_ID__ = SWITCH_CHANGE_DETECTOR_REF_FACTORY;
|
27071 |
|
27072 | function injectChangeDetectorRef(flags) {
|
27073 | return createViewRef(getCurrentTNode(), getLView(), (flags & 16 ) === 16 );
|
27074 | }
|
27075 |
|
27076 |
|
27077 |
|
27078 |
|
27079 |
|
27080 |
|
27081 |
|
27082 |
|
27083 | function createViewRef(tNode, lView, isPipe) {
|
27084 | if (isComponentHost(tNode) && !isPipe) {
|
27085 |
|
27086 |
|
27087 | const componentView = getComponentLViewByIndex(tNode.index, lView);
|
27088 | return new ViewRef$1(componentView, componentView);
|
27089 | }
|
27090 | else if (tNode.type & (3 | 12 | 32 )) {
|
27091 |
|
27092 |
|
27093 | const hostComponentView = lView[DECLARATION_COMPONENT_VIEW];
|
27094 | return new ViewRef$1(hostComponentView, lView);
|
27095 | }
|
27096 | return null;
|
27097 | }
|
27098 |
|
27099 |
|
27100 |
|
27101 |
|
27102 |
|
27103 |
|
27104 |
|
27105 |
|
27106 |
|
27107 |
|
27108 |
|
27109 |
|
27110 |
|
27111 |
|
27112 |
|
27113 | class ViewRef extends ChangeDetectorRef {
|
27114 | }
|
27115 |
|
27116 |
|
27117 |
|
27118 |
|
27119 |
|
27120 |
|
27121 |
|
27122 |
|
27123 |
|
27124 |
|
27125 |
|
27126 |
|
27127 |
|
27128 |
|
27129 |
|
27130 |
|
27131 |
|
27132 |
|
27133 |
|
27134 |
|
27135 |
|
27136 |
|
27137 |
|
27138 |
|
27139 |
|
27140 |
|
27141 |
|
27142 |
|
27143 |
|
27144 |
|
27145 |
|
27146 |
|
27147 |
|
27148 |
|
27149 |
|
27150 |
|
27151 |
|
27152 |
|
27153 |
|
27154 |
|
27155 |
|
27156 |
|
27157 |
|
27158 |
|
27159 |
|
27160 |
|
27161 |
|
27162 |
|
27163 |
|
27164 |
|
27165 |
|
27166 |
|
27167 |
|
27168 | class EmbeddedViewRef extends ViewRef {
|
27169 | }
|
27170 |
|
27171 |
|
27172 |
|
27173 |
|
27174 |
|
27175 |
|
27176 |
|
27177 |
|
27178 |
|
27179 |
|
27180 |
|
27181 |
|
27182 |
|
27183 |
|
27184 |
|
27185 |
|
27186 |
|
27187 | var ng_module_factory_loader_impl = {};
|
27188 |
|
27189 |
|
27190 |
|
27191 |
|
27192 | class DebugEventListener {
|
27193 | constructor(name, callback) {
|
27194 | this.name = name;
|
27195 | this.callback = callback;
|
27196 | }
|
27197 | }
|
27198 | class DebugNode__PRE_R3__ {
|
27199 | constructor(nativeNode, parent, _debugContext) {
|
27200 | this.listeners = [];
|
27201 | this.parent = null;
|
27202 | this._debugContext = _debugContext;
|
27203 | this.nativeNode = nativeNode;
|
27204 | if (parent && parent instanceof DebugElement__PRE_R3__) {
|
27205 | parent.addChild(this);
|
27206 | }
|
27207 | }
|
27208 | get injector() {
|
27209 | return this._debugContext.injector;
|
27210 | }
|
27211 | get componentInstance() {
|
27212 | return this._debugContext.component;
|
27213 | }
|
27214 | get context() {
|
27215 | return this._debugContext.context;
|
27216 | }
|
27217 | get references() {
|
27218 | return this._debugContext.references;
|
27219 | }
|
27220 | get providerTokens() {
|
27221 | return this._debugContext.providerTokens;
|
27222 | }
|
27223 | }
|
27224 | class DebugElement__PRE_R3__ extends DebugNode__PRE_R3__ {
|
27225 | constructor(nativeNode, parent, _debugContext) {
|
27226 | super(nativeNode, parent, _debugContext);
|
27227 | this.properties = {};
|
27228 | this.attributes = {};
|
27229 | this.classes = {};
|
27230 | this.styles = {};
|
27231 | this.childNodes = [];
|
27232 | this.nativeElement = nativeNode;
|
27233 | }
|
27234 | addChild(child) {
|
27235 | if (child) {
|
27236 | this.childNodes.push(child);
|
27237 | child.parent = this;
|
27238 | }
|
27239 | }
|
27240 | removeChild(child) {
|
27241 | const childIndex = this.childNodes.indexOf(child);
|
27242 | if (childIndex !== -1) {
|
27243 | child.parent = null;
|
27244 | this.childNodes.splice(childIndex, 1);
|
27245 | }
|
27246 | }
|
27247 | insertChildrenAfter(child, newChildren) {
|
27248 | const siblingIndex = this.childNodes.indexOf(child);
|
27249 | if (siblingIndex !== -1) {
|
27250 | this.childNodes.splice(siblingIndex + 1, 0, ...newChildren);
|
27251 | newChildren.forEach(c => {
|
27252 | if (c.parent) {
|
27253 | c.parent.removeChild(c);
|
27254 | }
|
27255 | child.parent = this;
|
27256 | });
|
27257 | }
|
27258 | }
|
27259 | insertBefore(refChild, newChild) {
|
27260 | const refIndex = this.childNodes.indexOf(refChild);
|
27261 | if (refIndex === -1) {
|
27262 | this.addChild(newChild);
|
27263 | }
|
27264 | else {
|
27265 | if (newChild.parent) {
|
27266 | newChild.parent.removeChild(newChild);
|
27267 | }
|
27268 | newChild.parent = this;
|
27269 | this.childNodes.splice(refIndex, 0, newChild);
|
27270 | }
|
27271 | }
|
27272 | query(predicate) {
|
27273 | const results = this.queryAll(predicate);
|
27274 | return results[0] || null;
|
27275 | }
|
27276 | queryAll(predicate) {
|
27277 | const matches = [];
|
27278 | _queryElementChildren(this, predicate, matches);
|
27279 | return matches;
|
27280 | }
|
27281 | queryAllNodes(predicate) {
|
27282 | const matches = [];
|
27283 | _queryNodeChildren(this, predicate, matches);
|
27284 | return matches;
|
27285 | }
|
27286 | get children() {
|
27287 | return this.childNodes
|
27288 | .filter((node) => node instanceof DebugElement__PRE_R3__);
|
27289 | }
|
27290 | triggerEventHandler(eventName, eventObj) {
|
27291 | this.listeners.forEach((listener) => {
|
27292 | if (listener.name == eventName) {
|
27293 | listener.callback(eventObj);
|
27294 | }
|
27295 | });
|
27296 | }
|
27297 | }
|
27298 |
|
27299 |
|
27300 |
|
27301 | function asNativeElements(debugEls) {
|
27302 | return debugEls.map((el) => el.nativeElement);
|
27303 | }
|
27304 | function _queryElementChildren(element, predicate, matches) {
|
27305 | element.childNodes.forEach(node => {
|
27306 | if (node instanceof DebugElement__PRE_R3__) {
|
27307 | if (predicate(node)) {
|
27308 | matches.push(node);
|
27309 | }
|
27310 | _queryElementChildren(node, predicate, matches);
|
27311 | }
|
27312 | });
|
27313 | }
|
27314 | function _queryNodeChildren(parentNode, predicate, matches) {
|
27315 | if (parentNode instanceof DebugElement__PRE_R3__) {
|
27316 | parentNode.childNodes.forEach(node => {
|
27317 | if (predicate(node)) {
|
27318 | matches.push(node);
|
27319 | }
|
27320 | if (node instanceof DebugElement__PRE_R3__) {
|
27321 | _queryNodeChildren(node, predicate, matches);
|
27322 | }
|
27323 | });
|
27324 | }
|
27325 | }
|
27326 | class DebugNode__POST_R3__ {
|
27327 | constructor(nativeNode) {
|
27328 | this.nativeNode = nativeNode;
|
27329 | }
|
27330 | get parent() {
|
27331 | const parent = this.nativeNode.parentNode;
|
27332 | return parent ? new DebugElement__POST_R3__(parent) : null;
|
27333 | }
|
27334 | get injector() {
|
27335 | return getInjector(this.nativeNode);
|
27336 | }
|
27337 | get componentInstance() {
|
27338 | const nativeElement = this.nativeNode;
|
27339 | return nativeElement &&
|
27340 | (getComponent$1(nativeElement) || getOwningComponent(nativeElement));
|
27341 | }
|
27342 | get context() {
|
27343 | return getComponent$1(this.nativeNode) || getContext(this.nativeNode);
|
27344 | }
|
27345 | get listeners() {
|
27346 | return getListeners(this.nativeNode).filter(listener => listener.type === 'dom');
|
27347 | }
|
27348 | get references() {
|
27349 | return getLocalRefs(this.nativeNode);
|
27350 | }
|
27351 | get providerTokens() {
|
27352 | return getInjectionTokens(this.nativeNode);
|
27353 | }
|
27354 | }
|
27355 | class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
27356 | constructor(nativeNode) {
|
27357 | ngDevMode && assertDomNode(nativeNode);
|
27358 | super(nativeNode);
|
27359 | }
|
27360 | get nativeElement() {
|
27361 | return this.nativeNode.nodeType == Node.ELEMENT_NODE ? this.nativeNode : null;
|
27362 | }
|
27363 | get name() {
|
27364 | const context = getLContext(this.nativeNode);
|
27365 | if (context !== null) {
|
27366 | const lView = context.lView;
|
27367 | const tData = lView[TVIEW].data;
|
27368 | const tNode = tData[context.nodeIndex];
|
27369 | return tNode.value;
|
27370 | }
|
27371 | else {
|
27372 | return this.nativeNode.nodeName;
|
27373 | }
|
27374 | }
|
27375 | |
27376 |
|
27377 |
|
27378 |
|
27379 |
|
27380 |
|
27381 |
|
27382 |
|
27383 |
|
27384 |
|
27385 |
|
27386 |
|
27387 | get properties() {
|
27388 | const context = getLContext(this.nativeNode);
|
27389 | if (context === null) {
|
27390 | return {};
|
27391 | }
|
27392 | const lView = context.lView;
|
27393 | const tData = lView[TVIEW].data;
|
27394 | const tNode = tData[context.nodeIndex];
|
27395 | const properties = {};
|
27396 |
|
27397 | copyDomProperties(this.nativeElement, properties);
|
27398 |
|
27399 |
|
27400 | collectPropertyBindings(properties, tNode, lView, tData);
|
27401 | return properties;
|
27402 | }
|
27403 | get attributes() {
|
27404 | const attributes = {};
|
27405 | const element = this.nativeElement;
|
27406 | if (!element) {
|
27407 | return attributes;
|
27408 | }
|
27409 | const context = getLContext(element);
|
27410 | if (context === null) {
|
27411 | return {};
|
27412 | }
|
27413 | const lView = context.lView;
|
27414 | const tNodeAttrs = lView[TVIEW].data[context.nodeIndex].attrs;
|
27415 | const lowercaseTNodeAttrs = [];
|
27416 |
|
27417 |
|
27418 |
|
27419 |
|
27420 |
|
27421 |
|
27422 |
|
27423 | if (tNodeAttrs) {
|
27424 | let i = 0;
|
27425 | while (i < tNodeAttrs.length) {
|
27426 | const attrName = tNodeAttrs[i];
|
27427 |
|
27428 |
|
27429 | if (typeof attrName !== 'string')
|
27430 | break;
|
27431 | const attrValue = tNodeAttrs[i + 1];
|
27432 | attributes[attrName] = attrValue;
|
27433 | lowercaseTNodeAttrs.push(attrName.toLowerCase());
|
27434 | i += 2;
|
27435 | }
|
27436 | }
|
27437 | const eAttrs = element.attributes;
|
27438 | for (let i = 0; i < eAttrs.length; i++) {
|
27439 | const attr = eAttrs[i];
|
27440 | const lowercaseName = attr.name.toLowerCase();
|
27441 |
|
27442 |
|
27443 | if (lowercaseTNodeAttrs.indexOf(lowercaseName) === -1) {
|
27444 |
|
27445 |
|
27446 | attributes[lowercaseName] = attr.value;
|
27447 | }
|
27448 | }
|
27449 | return attributes;
|
27450 | }
|
27451 | get styles() {
|
27452 | if (this.nativeElement && this.nativeElement.style) {
|
27453 | return this.nativeElement.style;
|
27454 | }
|
27455 | return {};
|
27456 | }
|
27457 | get classes() {
|
27458 | const result = {};
|
27459 | const element = this.nativeElement;
|
27460 |
|
27461 | const className = element.className;
|
27462 | const classes = typeof className !== 'string' ? className.baseVal.split(' ') : className.split(' ');
|
27463 | classes.forEach((value) => result[value] = true);
|
27464 | return result;
|
27465 | }
|
27466 | get childNodes() {
|
27467 | const childNodes = this.nativeNode.childNodes;
|
27468 | const children = [];
|
27469 | for (let i = 0; i < childNodes.length; i++) {
|
27470 | const element = childNodes[i];
|
27471 | children.push(getDebugNode__POST_R3__(element));
|
27472 | }
|
27473 | return children;
|
27474 | }
|
27475 | get children() {
|
27476 | const nativeElement = this.nativeElement;
|
27477 | if (!nativeElement)
|
27478 | return [];
|
27479 | const childNodes = nativeElement.children;
|
27480 | const children = [];
|
27481 | for (let i = 0; i < childNodes.length; i++) {
|
27482 | const element = childNodes[i];
|
27483 | children.push(getDebugNode__POST_R3__(element));
|
27484 | }
|
27485 | return children;
|
27486 | }
|
27487 | query(predicate) {
|
27488 | const results = this.queryAll(predicate);
|
27489 | return results[0] || null;
|
27490 | }
|
27491 | queryAll(predicate) {
|
27492 | const matches = [];
|
27493 | _queryAllR3(this, predicate, matches, true);
|
27494 | return matches;
|
27495 | }
|
27496 | queryAllNodes(predicate) {
|
27497 | const matches = [];
|
27498 | _queryAllR3(this, predicate, matches, false);
|
27499 | return matches;
|
27500 | }
|
27501 | triggerEventHandler(eventName, eventObj) {
|
27502 | const node = this.nativeNode;
|
27503 | const invokedListeners = [];
|
27504 | this.listeners.forEach(listener => {
|
27505 | if (listener.name === eventName) {
|
27506 | const callback = listener.callback;
|
27507 | callback.call(node, eventObj);
|
27508 | invokedListeners.push(callback);
|
27509 | }
|
27510 | });
|
27511 |
|
27512 |
|
27513 | if (typeof node.eventListeners === 'function') {
|
27514 |
|
27515 |
|
27516 |
|
27517 | node.eventListeners(eventName).forEach((listener) => {
|
27518 |
|
27519 |
|
27520 |
|
27521 |
|
27522 |
|
27523 |
|
27524 | if (listener.toString().indexOf('__ngUnwrap__') !== -1) {
|
27525 | const unwrappedListener = listener('__ngUnwrap__');
|
27526 | return invokedListeners.indexOf(unwrappedListener) === -1 &&
|
27527 | unwrappedListener.call(node, eventObj);
|
27528 | }
|
27529 | });
|
27530 | }
|
27531 | }
|
27532 | }
|
27533 | function copyDomProperties(element, properties) {
|
27534 | if (element) {
|
27535 |
|
27536 | let obj = Object.getPrototypeOf(element);
|
27537 | const NodePrototype = Node.prototype;
|
27538 | while (obj !== null && obj !== NodePrototype) {
|
27539 | const descriptors = Object.getOwnPropertyDescriptors(obj);
|
27540 | for (let key in descriptors) {
|
27541 | if (!key.startsWith('__') && !key.startsWith('on')) {
|
27542 |
|
27543 |
|
27544 |
|
27545 | const value = element[key];
|
27546 | if (isPrimitiveValue(value)) {
|
27547 | properties[key] = value;
|
27548 | }
|
27549 | }
|
27550 | }
|
27551 | obj = Object.getPrototypeOf(obj);
|
27552 | }
|
27553 | }
|
27554 | }
|
27555 | function isPrimitiveValue(value) {
|
27556 | return typeof value === 'string' || typeof value === 'boolean' || typeof value === 'number' ||
|
27557 | value === null;
|
27558 | }
|
27559 | function _queryAllR3(parentElement, predicate, matches, elementsOnly) {
|
27560 | const context = getLContext(parentElement.nativeNode);
|
27561 | if (context !== null) {
|
27562 | const parentTNode = context.lView[TVIEW].data[context.nodeIndex];
|
27563 | _queryNodeChildrenR3(parentTNode, context.lView, predicate, matches, elementsOnly, parentElement.nativeNode);
|
27564 | }
|
27565 | else {
|
27566 |
|
27567 |
|
27568 | _queryNativeNodeDescendants(parentElement.nativeNode, predicate, matches, elementsOnly);
|
27569 | }
|
27570 | }
|
27571 |
|
27572 |
|
27573 |
|
27574 |
|
27575 |
|
27576 |
|
27577 |
|
27578 |
|
27579 |
|
27580 |
|
27581 | function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, rootNativeNode) {
|
27582 | ngDevMode && assertTNodeForLView(tNode, lView);
|
27583 | const nativeNode = getNativeByTNodeOrNull(tNode, lView);
|
27584 |
|
27585 | if (tNode.type & (3 | 8 )) {
|
27586 |
|
27587 |
|
27588 | _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
|
27589 | if (isComponentHost(tNode)) {
|
27590 |
|
27591 |
|
27592 | const componentView = getComponentLViewByIndex(tNode.index, lView);
|
27593 | if (componentView && componentView[TVIEW].firstChild) {
|
27594 | _queryNodeChildrenR3(componentView[TVIEW].firstChild, componentView, predicate, matches, elementsOnly, rootNativeNode);
|
27595 | }
|
27596 | }
|
27597 | else {
|
27598 | if (tNode.child) {
|
27599 |
|
27600 | _queryNodeChildrenR3(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
|
27601 | }
|
27602 |
|
27603 |
|
27604 |
|
27605 |
|
27606 |
|
27607 |
|
27608 |
|
27609 |
|
27610 | nativeNode && _queryNativeNodeDescendants(nativeNode, predicate, matches, elementsOnly);
|
27611 | }
|
27612 |
|
27613 |
|
27614 | const nodeOrContainer = lView[tNode.index];
|
27615 | if (isLContainer(nodeOrContainer)) {
|
27616 | _queryNodeChildrenInContainerR3(nodeOrContainer, predicate, matches, elementsOnly, rootNativeNode);
|
27617 | }
|
27618 | }
|
27619 | else if (tNode.type & 4 ) {
|
27620 |
|
27621 |
|
27622 | const lContainer = lView[tNode.index];
|
27623 | _addQueryMatchR3(lContainer[NATIVE], predicate, matches, elementsOnly, rootNativeNode);
|
27624 |
|
27625 | _queryNodeChildrenInContainerR3(lContainer, predicate, matches, elementsOnly, rootNativeNode);
|
27626 | }
|
27627 | else if (tNode.type & 16 ) {
|
27628 |
|
27629 |
|
27630 | const componentView = lView[DECLARATION_COMPONENT_VIEW];
|
27631 | const componentHost = componentView[T_HOST];
|
27632 | const head = componentHost.projection[tNode.projection];
|
27633 | if (Array.isArray(head)) {
|
27634 | for (let nativeNode of head) {
|
27635 | _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
|
27636 | }
|
27637 | }
|
27638 | else if (head) {
|
27639 | const nextLView = componentView[PARENT];
|
27640 | const nextTNode = nextLView[TVIEW].data[head.index];
|
27641 | _queryNodeChildrenR3(nextTNode, nextLView, predicate, matches, elementsOnly, rootNativeNode);
|
27642 | }
|
27643 | }
|
27644 | else if (tNode.child) {
|
27645 |
|
27646 | _queryNodeChildrenR3(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
|
27647 | }
|
27648 |
|
27649 | if (rootNativeNode !== nativeNode) {
|
27650 |
|
27651 |
|
27652 | const nextTNode = (tNode.flags & 4 ) ? tNode.projectionNext : tNode.next;
|
27653 | if (nextTNode) {
|
27654 | _queryNodeChildrenR3(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
|
27655 | }
|
27656 | }
|
27657 | }
|
27658 |
|
27659 |
|
27660 |
|
27661 |
|
27662 |
|
27663 |
|
27664 |
|
27665 |
|
27666 |
|
27667 | function _queryNodeChildrenInContainerR3(lContainer, predicate, matches, elementsOnly, rootNativeNode) {
|
27668 | for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
27669 | const childView = lContainer[i];
|
27670 | const firstChild = childView[TVIEW].firstChild;
|
27671 | if (firstChild) {
|
27672 | _queryNodeChildrenR3(firstChild, childView, predicate, matches, elementsOnly, rootNativeNode);
|
27673 | }
|
27674 | }
|
27675 | }
|
27676 |
|
27677 |
|
27678 |
|
27679 |
|
27680 |
|
27681 |
|
27682 |
|
27683 |
|
27684 |
|
27685 | function _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode) {
|
27686 | if (rootNativeNode !== nativeNode) {
|
27687 | const debugNode = getDebugNode(nativeNode);
|
27688 | if (!debugNode) {
|
27689 | return;
|
27690 | }
|
27691 |
|
27692 |
|
27693 |
|
27694 | if (elementsOnly && debugNode instanceof DebugElement__POST_R3__ && predicate(debugNode) &&
|
27695 | matches.indexOf(debugNode) === -1) {
|
27696 | matches.push(debugNode);
|
27697 | }
|
27698 | else if (!elementsOnly && predicate(debugNode) &&
|
27699 | matches.indexOf(debugNode) === -1) {
|
27700 | matches.push(debugNode);
|
27701 | }
|
27702 | }
|
27703 | }
|
27704 |
|
27705 |
|
27706 |
|
27707 |
|
27708 |
|
27709 |
|
27710 |
|
27711 |
|
27712 | function _queryNativeNodeDescendants(parentNode, predicate, matches, elementsOnly) {
|
27713 | const nodes = parentNode.childNodes;
|
27714 | const length = nodes.length;
|
27715 | for (let i = 0; i < length; i++) {
|
27716 | const node = nodes[i];
|
27717 | const debugNode = getDebugNode(node);
|
27718 | if (debugNode) {
|
27719 | if (elementsOnly && debugNode instanceof DebugElement__POST_R3__ && predicate(debugNode) &&
|
27720 | matches.indexOf(debugNode) === -1) {
|
27721 | matches.push(debugNode);
|
27722 | }
|
27723 | else if (!elementsOnly && predicate(debugNode) &&
|
27724 | matches.indexOf(debugNode) === -1) {
|
27725 | matches.push(debugNode);
|
27726 | }
|
27727 | _queryNativeNodeDescendants(node, predicate, matches, elementsOnly);
|
27728 | }
|
27729 | }
|
27730 | }
|
27731 |
|
27732 |
|
27733 |
|
27734 |
|
27735 |
|
27736 | function collectPropertyBindings(properties, tNode, lView, tData) {
|
27737 | let bindingIndexes = tNode.propertyBindings;
|
27738 | if (bindingIndexes !== null) {
|
27739 | for (let i = 0; i < bindingIndexes.length; i++) {
|
27740 | const bindingIndex = bindingIndexes[i];
|
27741 | const propMetadata = tData[bindingIndex];
|
27742 | const metadataParts = propMetadata.split(INTERPOLATION_DELIMITER);
|
27743 | const propertyName = metadataParts[0];
|
27744 | if (metadataParts.length > 1) {
|
27745 | let value = metadataParts[1];
|
27746 | for (let j = 1; j < metadataParts.length - 1; j++) {
|
27747 | value += renderStringify(lView[bindingIndex + j - 1]) + metadataParts[j + 1];
|
27748 | }
|
27749 | properties[propertyName] = value;
|
27750 | }
|
27751 | else {
|
27752 | properties[propertyName] = lView[bindingIndex];
|
27753 | }
|
27754 | }
|
27755 | }
|
27756 | }
|
27757 |
|
27758 | const _nativeNodeToDebugNode = new Map();
|
27759 | function getDebugNode__PRE_R3__(nativeNode) {
|
27760 | return _nativeNodeToDebugNode.get(nativeNode) || null;
|
27761 | }
|
27762 | const NG_DEBUG_PROPERTY = '__ng_debug__';
|
27763 | function getDebugNode__POST_R3__(nativeNode) {
|
27764 | if (nativeNode instanceof Node) {
|
27765 | if (!(nativeNode.hasOwnProperty(NG_DEBUG_PROPERTY))) {
|
27766 | nativeNode[NG_DEBUG_PROPERTY] = nativeNode.nodeType == Node.ELEMENT_NODE ?
|
27767 | new DebugElement__POST_R3__(nativeNode) :
|
27768 | new DebugNode__POST_R3__(nativeNode);
|
27769 | }
|
27770 | return nativeNode[NG_DEBUG_PROPERTY];
|
27771 | }
|
27772 | return null;
|
27773 | }
|
27774 |
|
27775 |
|
27776 |
|
27777 | const getDebugNode = getDebugNode__POST_R3__;
|
27778 | function getDebugNodeR2__PRE_R3__(nativeNode) {
|
27779 | return getDebugNode__PRE_R3__(nativeNode);
|
27780 | }
|
27781 | function getDebugNodeR2__POST_R3__(_nativeNode) {
|
27782 | return null;
|
27783 | }
|
27784 | const getDebugNodeR2 = getDebugNodeR2__POST_R3__;
|
27785 | function getAllDebugNodes() {
|
27786 | return Array.from(_nativeNodeToDebugNode.values());
|
27787 | }
|
27788 | function indexDebugNode(node) {
|
27789 | _nativeNodeToDebugNode.set(node.nativeNode, node);
|
27790 | }
|
27791 | function removeDebugNodeFromIndex(node) {
|
27792 | _nativeNodeToDebugNode.delete(node.nativeNode);
|
27793 | }
|
27794 |
|
27795 |
|
27796 |
|
27797 | const DebugNode = DebugNode__POST_R3__;
|
27798 |
|
27799 |
|
27800 |
|
27801 | const DebugElement = DebugElement__POST_R3__;
|
27802 |
|
27803 |
|
27804 |
|
27805 |
|
27806 |
|
27807 |
|
27808 |
|
27809 |
|
27810 | class DefaultIterableDifferFactory {
|
27811 | constructor() { }
|
27812 | supports(obj) {
|
27813 | return isListLikeIterable(obj);
|
27814 | }
|
27815 | create(trackByFn) {
|
27816 | return new DefaultIterableDiffer(trackByFn);
|
27817 | }
|
27818 | }
|
27819 | const trackByIdentity = (index, item) => item;
|
27820 |
|
27821 |
|
27822 |
|
27823 |
|
27824 | class DefaultIterableDiffer {
|
27825 | constructor(trackByFn) {
|
27826 | this.length = 0;
|
27827 |
|
27828 | this._linkedRecords = null;
|
27829 |
|
27830 | this._unlinkedRecords = null;
|
27831 | this._previousItHead = null;
|
27832 | this._itHead = null;
|
27833 | this._itTail = null;
|
27834 | this._additionsHead = null;
|
27835 | this._additionsTail = null;
|
27836 | this._movesHead = null;
|
27837 | this._movesTail = null;
|
27838 | this._removalsHead = null;
|
27839 | this._removalsTail = null;
|
27840 |
|
27841 | this._identityChangesHead = null;
|
27842 | this._identityChangesTail = null;
|
27843 | this._trackByFn = trackByFn || trackByIdentity;
|
27844 | }
|
27845 | forEachItem(fn) {
|
27846 | let record;
|
27847 | for (record = this._itHead; record !== null; record = record._next) {
|
27848 | fn(record);
|
27849 | }
|
27850 | }
|
27851 | forEachOperation(fn) {
|
27852 | let nextIt = this._itHead;
|
27853 | let nextRemove = this._removalsHead;
|
27854 | let addRemoveOffset = 0;
|
27855 | let moveOffsets = null;
|
27856 | while (nextIt || nextRemove) {
|
27857 |
|
27858 |
|
27859 | const record = !nextRemove ||
|
27860 | nextIt &&
|
27861 | nextIt.currentIndex <
|
27862 | getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ?
|
27863 | nextIt :
|
27864 | nextRemove;
|
27865 | const adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
|
27866 | const currentIndex = record.currentIndex;
|
27867 |
|
27868 | if (record === nextRemove) {
|
27869 | addRemoveOffset--;
|
27870 | nextRemove = nextRemove._nextRemoved;
|
27871 | }
|
27872 | else {
|
27873 | nextIt = nextIt._next;
|
27874 | if (record.previousIndex == null) {
|
27875 | addRemoveOffset++;
|
27876 | }
|
27877 | else {
|
27878 |
|
27879 | if (!moveOffsets)
|
27880 | moveOffsets = [];
|
27881 | const localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
|
27882 | const localCurrentIndex = currentIndex - addRemoveOffset;
|
27883 | if (localMovePreviousIndex != localCurrentIndex) {
|
27884 | for (let i = 0; i < localMovePreviousIndex; i++) {
|
27885 | const offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
|
27886 | const index = offset + i;
|
27887 | if (localCurrentIndex <= index && index < localMovePreviousIndex) {
|
27888 | moveOffsets[i] = offset + 1;
|
27889 | }
|
27890 | }
|
27891 | const previousIndex = record.previousIndex;
|
27892 | moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
|
27893 | }
|
27894 | }
|
27895 | }
|
27896 | if (adjPreviousIndex !== currentIndex) {
|
27897 | fn(record, adjPreviousIndex, currentIndex);
|
27898 | }
|
27899 | }
|
27900 | }
|
27901 | forEachPreviousItem(fn) {
|
27902 | let record;
|
27903 | for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
|
27904 | fn(record);
|
27905 | }
|
27906 | }
|
27907 | forEachAddedItem(fn) {
|
27908 | let record;
|
27909 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
27910 | fn(record);
|
27911 | }
|
27912 | }
|
27913 | forEachMovedItem(fn) {
|
27914 | let record;
|
27915 | for (record = this._movesHead; record !== null; record = record._nextMoved) {
|
27916 | fn(record);
|
27917 | }
|
27918 | }
|
27919 | forEachRemovedItem(fn) {
|
27920 | let record;
|
27921 | for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
27922 | fn(record);
|
27923 | }
|
27924 | }
|
27925 | forEachIdentityChange(fn) {
|
27926 | let record;
|
27927 | for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
|
27928 | fn(record);
|
27929 | }
|
27930 | }
|
27931 | diff(collection) {
|
27932 | if (collection == null)
|
27933 | collection = [];
|
27934 | if (!isListLikeIterable(collection)) {
|
27935 | throw new Error(`Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
|
27936 | }
|
27937 | if (this.check(collection)) {
|
27938 | return this;
|
27939 | }
|
27940 | else {
|
27941 | return null;
|
27942 | }
|
27943 | }
|
27944 | onDestroy() { }
|
27945 | check(collection) {
|
27946 | this._reset();
|
27947 | let record = this._itHead;
|
27948 | let mayBeDirty = false;
|
27949 | let index;
|
27950 | let item;
|
27951 | let itemTrackBy;
|
27952 | if (Array.isArray(collection)) {
|
27953 | this.length = collection.length;
|
27954 | for (let index = 0; index < this.length; index++) {
|
27955 | item = collection[index];
|
27956 | itemTrackBy = this._trackByFn(index, item);
|
27957 | if (record === null || !Object.is(record.trackById, itemTrackBy)) {
|
27958 | record = this._mismatch(record, item, itemTrackBy, index);
|
27959 | mayBeDirty = true;
|
27960 | }
|
27961 | else {
|
27962 | if (mayBeDirty) {
|
27963 |
|
27964 | record = this._verifyReinsertion(record, item, itemTrackBy, index);
|
27965 | }
|
27966 | if (!Object.is(record.item, item))
|
27967 | this._addIdentityChange(record, item);
|
27968 | }
|
27969 | record = record._next;
|
27970 | }
|
27971 | }
|
27972 | else {
|
27973 | index = 0;
|
27974 | iterateListLike(collection, (item) => {
|
27975 | itemTrackBy = this._trackByFn(index, item);
|
27976 | if (record === null || !Object.is(record.trackById, itemTrackBy)) {
|
27977 | record = this._mismatch(record, item, itemTrackBy, index);
|
27978 | mayBeDirty = true;
|
27979 | }
|
27980 | else {
|
27981 | if (mayBeDirty) {
|
27982 |
|
27983 | record = this._verifyReinsertion(record, item, itemTrackBy, index);
|
27984 | }
|
27985 | if (!Object.is(record.item, item))
|
27986 | this._addIdentityChange(record, item);
|
27987 | }
|
27988 | record = record._next;
|
27989 | index++;
|
27990 | });
|
27991 | this.length = index;
|
27992 | }
|
27993 | this._truncate(record);
|
27994 | this.collection = collection;
|
27995 | return this.isDirty;
|
27996 | }
|
27997 | |
27998 |
|
27999 |
|
28000 | get isDirty() {
|
28001 | return this._additionsHead !== null || this._movesHead !== null ||
|
28002 | this._removalsHead !== null || this._identityChangesHead !== null;
|
28003 | }
|
28004 | |
28005 |
|
28006 |
|
28007 |
|
28008 |
|
28009 |
|
28010 |
|
28011 |
|
28012 | _reset() {
|
28013 | if (this.isDirty) {
|
28014 | let record;
|
28015 | for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
|
28016 | record._nextPrevious = record._next;
|
28017 | }
|
28018 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
28019 | record.previousIndex = record.currentIndex;
|
28020 | }
|
28021 | this._additionsHead = this._additionsTail = null;
|
28022 | for (record = this._movesHead; record !== null; record = record._nextMoved) {
|
28023 | record.previousIndex = record.currentIndex;
|
28024 | }
|
28025 | this._movesHead = this._movesTail = null;
|
28026 | this._removalsHead = this._removalsTail = null;
|
28027 | this._identityChangesHead = this._identityChangesTail = null;
|
28028 |
|
28029 |
|
28030 | }
|
28031 | }
|
28032 | |
28033 |
|
28034 |
|
28035 |
|
28036 |
|
28037 |
|
28038 |
|
28039 |
|
28040 |
|
28041 |
|
28042 | _mismatch(record, item, itemTrackBy, index) {
|
28043 |
|
28044 | let previousRecord;
|
28045 | if (record === null) {
|
28046 | previousRecord = this._itTail;
|
28047 | }
|
28048 | else {
|
28049 | previousRecord = record._prev;
|
28050 |
|
28051 | this._remove(record);
|
28052 | }
|
28053 |
|
28054 | record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
28055 | if (record !== null) {
|
28056 |
|
28057 |
|
28058 | if (!Object.is(record.item, item))
|
28059 | this._addIdentityChange(record, item);
|
28060 | this._reinsertAfter(record, previousRecord, index);
|
28061 | }
|
28062 | else {
|
28063 |
|
28064 | record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
|
28065 | if (record !== null) {
|
28066 |
|
28067 |
|
28068 |
|
28069 | if (!Object.is(record.item, item))
|
28070 | this._addIdentityChange(record, item);
|
28071 | this._moveAfter(record, previousRecord, index);
|
28072 | }
|
28073 | else {
|
28074 |
|
28075 | record =
|
28076 | this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
|
28077 | }
|
28078 | }
|
28079 | return record;
|
28080 | }
|
28081 | |
28082 |
|
28083 |
|
28084 |
|
28085 |
|
28086 |
|
28087 |
|
28088 |
|
28089 |
|
28090 |
|
28091 |
|
28092 |
|
28093 |
|
28094 |
|
28095 |
|
28096 |
|
28097 |
|
28098 |
|
28099 |
|
28100 |
|
28101 |
|
28102 |
|
28103 |
|
28104 |
|
28105 |
|
28106 |
|
28107 |
|
28108 | _verifyReinsertion(record, item, itemTrackBy, index) {
|
28109 | let reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
28110 | if (reinsertRecord !== null) {
|
28111 | record = this._reinsertAfter(reinsertRecord, record._prev, index);
|
28112 | }
|
28113 | else if (record.currentIndex != index) {
|
28114 | record.currentIndex = index;
|
28115 | this._addToMoves(record, index);
|
28116 | }
|
28117 | return record;
|
28118 | }
|
28119 | |
28120 |
|
28121 |
|
28122 |
|
28123 |
|
28124 |
|
28125 |
|
28126 | _truncate(record) {
|
28127 |
|
28128 | while (record !== null) {
|
28129 | const nextRecord = record._next;
|
28130 | this._addToRemovals(this._unlink(record));
|
28131 | record = nextRecord;
|
28132 | }
|
28133 | if (this._unlinkedRecords !== null) {
|
28134 | this._unlinkedRecords.clear();
|
28135 | }
|
28136 | if (this._additionsTail !== null) {
|
28137 | this._additionsTail._nextAdded = null;
|
28138 | }
|
28139 | if (this._movesTail !== null) {
|
28140 | this._movesTail._nextMoved = null;
|
28141 | }
|
28142 | if (this._itTail !== null) {
|
28143 | this._itTail._next = null;
|
28144 | }
|
28145 | if (this._removalsTail !== null) {
|
28146 | this._removalsTail._nextRemoved = null;
|
28147 | }
|
28148 | if (this._identityChangesTail !== null) {
|
28149 | this._identityChangesTail._nextIdentityChange = null;
|
28150 | }
|
28151 | }
|
28152 |
|
28153 | _reinsertAfter(record, prevRecord, index) {
|
28154 | if (this._unlinkedRecords !== null) {
|
28155 | this._unlinkedRecords.remove(record);
|
28156 | }
|
28157 | const prev = record._prevRemoved;
|
28158 | const next = record._nextRemoved;
|
28159 | if (prev === null) {
|
28160 | this._removalsHead = next;
|
28161 | }
|
28162 | else {
|
28163 | prev._nextRemoved = next;
|
28164 | }
|
28165 | if (next === null) {
|
28166 | this._removalsTail = prev;
|
28167 | }
|
28168 | else {
|
28169 | next._prevRemoved = prev;
|
28170 | }
|
28171 | this._insertAfter(record, prevRecord, index);
|
28172 | this._addToMoves(record, index);
|
28173 | return record;
|
28174 | }
|
28175 |
|
28176 | _moveAfter(record, prevRecord, index) {
|
28177 | this._unlink(record);
|
28178 | this._insertAfter(record, prevRecord, index);
|
28179 | this._addToMoves(record, index);
|
28180 | return record;
|
28181 | }
|
28182 |
|
28183 | _addAfter(record, prevRecord, index) {
|
28184 | this._insertAfter(record, prevRecord, index);
|
28185 | if (this._additionsTail === null) {
|
28186 |
|
28187 |
|
28188 | this._additionsTail = this._additionsHead = record;
|
28189 | }
|
28190 | else {
|
28191 |
|
28192 |
|
28193 |
|
28194 | this._additionsTail = this._additionsTail._nextAdded = record;
|
28195 | }
|
28196 | return record;
|
28197 | }
|
28198 |
|
28199 | _insertAfter(record, prevRecord, index) {
|
28200 |
|
28201 |
|
28202 |
|
28203 |
|
28204 | const next = prevRecord === null ? this._itHead : prevRecord._next;
|
28205 |
|
28206 |
|
28207 |
|
28208 | record._next = next;
|
28209 | record._prev = prevRecord;
|
28210 | if (next === null) {
|
28211 | this._itTail = record;
|
28212 | }
|
28213 | else {
|
28214 | next._prev = record;
|
28215 | }
|
28216 | if (prevRecord === null) {
|
28217 | this._itHead = record;
|
28218 | }
|
28219 | else {
|
28220 | prevRecord._next = record;
|
28221 | }
|
28222 | if (this._linkedRecords === null) {
|
28223 | this._linkedRecords = new _DuplicateMap();
|
28224 | }
|
28225 | this._linkedRecords.put(record);
|
28226 | record.currentIndex = index;
|
28227 | return record;
|
28228 | }
|
28229 |
|
28230 | _remove(record) {
|
28231 | return this._addToRemovals(this._unlink(record));
|
28232 | }
|
28233 |
|
28234 | _unlink(record) {
|
28235 | if (this._linkedRecords !== null) {
|
28236 | this._linkedRecords.remove(record);
|
28237 | }
|
28238 | const prev = record._prev;
|
28239 | const next = record._next;
|
28240 |
|
28241 |
|
28242 |
|
28243 | if (prev === null) {
|
28244 | this._itHead = next;
|
28245 | }
|
28246 | else {
|
28247 | prev._next = next;
|
28248 | }
|
28249 | if (next === null) {
|
28250 | this._itTail = prev;
|
28251 | }
|
28252 | else {
|
28253 | next._prev = prev;
|
28254 | }
|
28255 | return record;
|
28256 | }
|
28257 |
|
28258 | _addToMoves(record, toIndex) {
|
28259 |
|
28260 |
|
28261 | if (record.previousIndex === toIndex) {
|
28262 | return record;
|
28263 | }
|
28264 | if (this._movesTail === null) {
|
28265 |
|
28266 |
|
28267 | this._movesTail = this._movesHead = record;
|
28268 | }
|
28269 | else {
|
28270 |
|
28271 |
|
28272 | this._movesTail = this._movesTail._nextMoved = record;
|
28273 | }
|
28274 | return record;
|
28275 | }
|
28276 | _addToRemovals(record) {
|
28277 | if (this._unlinkedRecords === null) {
|
28278 | this._unlinkedRecords = new _DuplicateMap();
|
28279 | }
|
28280 | this._unlinkedRecords.put(record);
|
28281 | record.currentIndex = null;
|
28282 | record._nextRemoved = null;
|
28283 | if (this._removalsTail === null) {
|
28284 |
|
28285 |
|
28286 | this._removalsTail = this._removalsHead = record;
|
28287 | record._prevRemoved = null;
|
28288 | }
|
28289 | else {
|
28290 |
|
28291 |
|
28292 |
|
28293 | record._prevRemoved = this._removalsTail;
|
28294 | this._removalsTail = this._removalsTail._nextRemoved = record;
|
28295 | }
|
28296 | return record;
|
28297 | }
|
28298 |
|
28299 | _addIdentityChange(record, item) {
|
28300 | record.item = item;
|
28301 | if (this._identityChangesTail === null) {
|
28302 | this._identityChangesTail = this._identityChangesHead = record;
|
28303 | }
|
28304 | else {
|
28305 | this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
|
28306 | }
|
28307 | return record;
|
28308 | }
|
28309 | }
|
28310 | class IterableChangeRecord_ {
|
28311 | constructor(item, trackById) {
|
28312 | this.item = item;
|
28313 | this.trackById = trackById;
|
28314 | this.currentIndex = null;
|
28315 | this.previousIndex = null;
|
28316 |
|
28317 | this._nextPrevious = null;
|
28318 |
|
28319 | this._prev = null;
|
28320 |
|
28321 | this._next = null;
|
28322 |
|
28323 | this._prevDup = null;
|
28324 |
|
28325 | this._nextDup = null;
|
28326 |
|
28327 | this._prevRemoved = null;
|
28328 |
|
28329 | this._nextRemoved = null;
|
28330 |
|
28331 | this._nextAdded = null;
|
28332 |
|
28333 | this._nextMoved = null;
|
28334 |
|
28335 | this._nextIdentityChange = null;
|
28336 | }
|
28337 | }
|
28338 |
|
28339 | class _DuplicateItemRecordList {
|
28340 | constructor() {
|
28341 |
|
28342 | this._head = null;
|
28343 |
|
28344 | this._tail = null;
|
28345 | }
|
28346 | |
28347 |
|
28348 |
|
28349 |
|
28350 |
|
28351 | add(record) {
|
28352 | if (this._head === null) {
|
28353 | this._head = this._tail = record;
|
28354 | record._nextDup = null;
|
28355 | record._prevDup = null;
|
28356 | }
|
28357 | else {
|
28358 |
|
28359 |
|
28360 |
|
28361 | this._tail._nextDup = record;
|
28362 | record._prevDup = this._tail;
|
28363 | record._nextDup = null;
|
28364 | this._tail = record;
|
28365 | }
|
28366 | }
|
28367 |
|
28368 |
|
28369 | get(trackById, atOrAfterIndex) {
|
28370 | let record;
|
28371 | for (record = this._head; record !== null; record = record._nextDup) {
|
28372 | if ((atOrAfterIndex === null || atOrAfterIndex <= record.currentIndex) &&
|
28373 | Object.is(record.trackById, trackById)) {
|
28374 | return record;
|
28375 | }
|
28376 | }
|
28377 | return null;
|
28378 | }
|
28379 | |
28380 |
|
28381 |
|
28382 |
|
28383 |
|
28384 | remove(record) {
|
28385 |
|
28386 |
|
28387 |
|
28388 |
|
28389 |
|
28390 |
|
28391 |
|
28392 |
|
28393 | const prev = record._prevDup;
|
28394 | const next = record._nextDup;
|
28395 | if (prev === null) {
|
28396 | this._head = next;
|
28397 | }
|
28398 | else {
|
28399 | prev._nextDup = next;
|
28400 | }
|
28401 | if (next === null) {
|
28402 | this._tail = prev;
|
28403 | }
|
28404 | else {
|
28405 | next._prevDup = prev;
|
28406 | }
|
28407 | return this._head === null;
|
28408 | }
|
28409 | }
|
28410 | class _DuplicateMap {
|
28411 | constructor() {
|
28412 | this.map = new Map();
|
28413 | }
|
28414 | put(record) {
|
28415 | const key = record.trackById;
|
28416 | let duplicates = this.map.get(key);
|
28417 | if (!duplicates) {
|
28418 | duplicates = new _DuplicateItemRecordList();
|
28419 | this.map.set(key, duplicates);
|
28420 | }
|
28421 | duplicates.add(record);
|
28422 | }
|
28423 | |
28424 |
|
28425 |
|
28426 |
|
28427 |
|
28428 |
|
28429 |
|
28430 | get(trackById, atOrAfterIndex) {
|
28431 | const key = trackById;
|
28432 | const recordList = this.map.get(key);
|
28433 | return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
|
28434 | }
|
28435 | |
28436 |
|
28437 |
|
28438 |
|
28439 |
|
28440 | remove(record) {
|
28441 | const key = record.trackById;
|
28442 | const recordList = this.map.get(key);
|
28443 |
|
28444 | if (recordList.remove(record)) {
|
28445 | this.map.delete(key);
|
28446 | }
|
28447 | return record;
|
28448 | }
|
28449 | get isEmpty() {
|
28450 | return this.map.size === 0;
|
28451 | }
|
28452 | clear() {
|
28453 | this.map.clear();
|
28454 | }
|
28455 | }
|
28456 | function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
|
28457 | const previousIndex = item.previousIndex;
|
28458 | if (previousIndex === null)
|
28459 | return previousIndex;
|
28460 | let moveOffset = 0;
|
28461 | if (moveOffsets && previousIndex < moveOffsets.length) {
|
28462 | moveOffset = moveOffsets[previousIndex];
|
28463 | }
|
28464 | return previousIndex + addRemoveOffset + moveOffset;
|
28465 | }
|
28466 |
|
28467 |
|
28468 |
|
28469 |
|
28470 |
|
28471 |
|
28472 |
|
28473 |
|
28474 | class DefaultKeyValueDifferFactory {
|
28475 | constructor() { }
|
28476 | supports(obj) {
|
28477 | return obj instanceof Map || isJsObject(obj);
|
28478 | }
|
28479 | create() {
|
28480 | return new DefaultKeyValueDiffer();
|
28481 | }
|
28482 | }
|
28483 | class DefaultKeyValueDiffer {
|
28484 | constructor() {
|
28485 | this._records = new Map();
|
28486 | this._mapHead = null;
|
28487 |
|
28488 | this._appendAfter = null;
|
28489 | this._previousMapHead = null;
|
28490 | this._changesHead = null;
|
28491 | this._changesTail = null;
|
28492 | this._additionsHead = null;
|
28493 | this._additionsTail = null;
|
28494 | this._removalsHead = null;
|
28495 | this._removalsTail = null;
|
28496 | }
|
28497 | get isDirty() {
|
28498 | return this._additionsHead !== null || this._changesHead !== null ||
|
28499 | this._removalsHead !== null;
|
28500 | }
|
28501 | forEachItem(fn) {
|
28502 | let record;
|
28503 | for (record = this._mapHead; record !== null; record = record._next) {
|
28504 | fn(record);
|
28505 | }
|
28506 | }
|
28507 | forEachPreviousItem(fn) {
|
28508 | let record;
|
28509 | for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
|
28510 | fn(record);
|
28511 | }
|
28512 | }
|
28513 | forEachChangedItem(fn) {
|
28514 | let record;
|
28515 | for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
28516 | fn(record);
|
28517 | }
|
28518 | }
|
28519 | forEachAddedItem(fn) {
|
28520 | let record;
|
28521 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
28522 | fn(record);
|
28523 | }
|
28524 | }
|
28525 | forEachRemovedItem(fn) {
|
28526 | let record;
|
28527 | for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
28528 | fn(record);
|
28529 | }
|
28530 | }
|
28531 | diff(map) {
|
28532 | if (!map) {
|
28533 | map = new Map();
|
28534 | }
|
28535 | else if (!(map instanceof Map || isJsObject(map))) {
|
28536 | throw new Error(`Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
|
28537 | }
|
28538 | return this.check(map) ? this : null;
|
28539 | }
|
28540 | onDestroy() { }
|
28541 | |
28542 |
|
28543 |
|
28544 |
|
28545 | check(map) {
|
28546 | this._reset();
|
28547 | let insertBefore = this._mapHead;
|
28548 | this._appendAfter = null;
|
28549 | this._forEach(map, (value, key) => {
|
28550 | if (insertBefore && insertBefore.key === key) {
|
28551 | this._maybeAddToChanges(insertBefore, value);
|
28552 | this._appendAfter = insertBefore;
|
28553 | insertBefore = insertBefore._next;
|
28554 | }
|
28555 | else {
|
28556 | const record = this._getOrCreateRecordForKey(key, value);
|
28557 | insertBefore = this._insertBeforeOrAppend(insertBefore, record);
|
28558 | }
|
28559 | });
|
28560 |
|
28561 | if (insertBefore) {
|
28562 | if (insertBefore._prev) {
|
28563 | insertBefore._prev._next = null;
|
28564 | }
|
28565 | this._removalsHead = insertBefore;
|
28566 | for (let record = insertBefore; record !== null; record = record._nextRemoved) {
|
28567 | if (record === this._mapHead) {
|
28568 | this._mapHead = null;
|
28569 | }
|
28570 | this._records.delete(record.key);
|
28571 | record._nextRemoved = record._next;
|
28572 | record.previousValue = record.currentValue;
|
28573 | record.currentValue = null;
|
28574 | record._prev = null;
|
28575 | record._next = null;
|
28576 | }
|
28577 | }
|
28578 |
|
28579 | if (this._changesTail)
|
28580 | this._changesTail._nextChanged = null;
|
28581 | if (this._additionsTail)
|
28582 | this._additionsTail._nextAdded = null;
|
28583 | return this.isDirty;
|
28584 | }
|
28585 | |
28586 |
|
28587 |
|
28588 |
|
28589 |
|
28590 |
|
28591 |
|
28592 |
|
28593 | _insertBeforeOrAppend(before, record) {
|
28594 | if (before) {
|
28595 | const prev = before._prev;
|
28596 | record._next = before;
|
28597 | record._prev = prev;
|
28598 | before._prev = record;
|
28599 | if (prev) {
|
28600 | prev._next = record;
|
28601 | }
|
28602 | if (before === this._mapHead) {
|
28603 | this._mapHead = record;
|
28604 | }
|
28605 | this._appendAfter = before;
|
28606 | return before;
|
28607 | }
|
28608 | if (this._appendAfter) {
|
28609 | this._appendAfter._next = record;
|
28610 | record._prev = this._appendAfter;
|
28611 | }
|
28612 | else {
|
28613 | this._mapHead = record;
|
28614 | }
|
28615 | this._appendAfter = record;
|
28616 | return null;
|
28617 | }
|
28618 | _getOrCreateRecordForKey(key, value) {
|
28619 | if (this._records.has(key)) {
|
28620 | const record = this._records.get(key);
|
28621 | this._maybeAddToChanges(record, value);
|
28622 | const prev = record._prev;
|
28623 | const next = record._next;
|
28624 | if (prev) {
|
28625 | prev._next = next;
|
28626 | }
|
28627 | if (next) {
|
28628 | next._prev = prev;
|
28629 | }
|
28630 | record._next = null;
|
28631 | record._prev = null;
|
28632 | return record;
|
28633 | }
|
28634 | const record = new KeyValueChangeRecord_(key);
|
28635 | this._records.set(key, record);
|
28636 | record.currentValue = value;
|
28637 | this._addToAdditions(record);
|
28638 | return record;
|
28639 | }
|
28640 |
|
28641 | _reset() {
|
28642 | if (this.isDirty) {
|
28643 | let record;
|
28644 |
|
28645 | this._previousMapHead = this._mapHead;
|
28646 | for (record = this._previousMapHead; record !== null; record = record._next) {
|
28647 | record._nextPrevious = record._next;
|
28648 | }
|
28649 |
|
28650 |
|
28651 | for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
28652 | record.previousValue = record.currentValue;
|
28653 | }
|
28654 | for (record = this._additionsHead; record != null; record = record._nextAdded) {
|
28655 | record.previousValue = record.currentValue;
|
28656 | }
|
28657 | this._changesHead = this._changesTail = null;
|
28658 | this._additionsHead = this._additionsTail = null;
|
28659 | this._removalsHead = null;
|
28660 | }
|
28661 | }
|
28662 |
|
28663 | _maybeAddToChanges(record, newValue) {
|
28664 | if (!Object.is(newValue, record.currentValue)) {
|
28665 | record.previousValue = record.currentValue;
|
28666 | record.currentValue = newValue;
|
28667 | this._addToChanges(record);
|
28668 | }
|
28669 | }
|
28670 | _addToAdditions(record) {
|
28671 | if (this._additionsHead === null) {
|
28672 | this._additionsHead = this._additionsTail = record;
|
28673 | }
|
28674 | else {
|
28675 | this._additionsTail._nextAdded = record;
|
28676 | this._additionsTail = record;
|
28677 | }
|
28678 | }
|
28679 | _addToChanges(record) {
|
28680 | if (this._changesHead === null) {
|
28681 | this._changesHead = this._changesTail = record;
|
28682 | }
|
28683 | else {
|
28684 | this._changesTail._nextChanged = record;
|
28685 | this._changesTail = record;
|
28686 | }
|
28687 | }
|
28688 |
|
28689 | _forEach(obj, fn) {
|
28690 | if (obj instanceof Map) {
|
28691 | obj.forEach(fn);
|
28692 | }
|
28693 | else {
|
28694 | Object.keys(obj).forEach(k => fn(obj[k], k));
|
28695 | }
|
28696 | }
|
28697 | }
|
28698 | class KeyValueChangeRecord_ {
|
28699 | constructor(key) {
|
28700 | this.key = key;
|
28701 | this.previousValue = null;
|
28702 | this.currentValue = null;
|
28703 |
|
28704 | this._nextPrevious = null;
|
28705 |
|
28706 | this._next = null;
|
28707 |
|
28708 | this._prev = null;
|
28709 |
|
28710 | this._nextAdded = null;
|
28711 |
|
28712 | this._nextRemoved = null;
|
28713 |
|
28714 | this._nextChanged = null;
|
28715 | }
|
28716 | }
|
28717 |
|
28718 |
|
28719 |
|
28720 |
|
28721 |
|
28722 |
|
28723 |
|
28724 |
|
28725 | function defaultIterableDiffersFactory() {
|
28726 | return new IterableDiffers([new DefaultIterableDifferFactory()]);
|
28727 | }
|
28728 |
|
28729 |
|
28730 |
|
28731 |
|
28732 |
|
28733 | class IterableDiffers {
|
28734 | constructor(factories) {
|
28735 | this.factories = factories;
|
28736 | }
|
28737 | static create(factories, parent) {
|
28738 | if (parent != null) {
|
28739 | const copied = parent.factories.slice();
|
28740 | factories = factories.concat(copied);
|
28741 | }
|
28742 | return new IterableDiffers(factories);
|
28743 | }
|
28744 | |
28745 |
|
28746 |
|
28747 |
|
28748 |
|
28749 |
|
28750 |
|
28751 |
|
28752 |
|
28753 |
|
28754 |
|
28755 |
|
28756 |
|
28757 |
|
28758 |
|
28759 |
|
28760 |
|
28761 |
|
28762 |
|
28763 |
|
28764 | static extend(factories) {
|
28765 | return {
|
28766 | provide: IterableDiffers,
|
28767 | useFactory: (parent) => {
|
28768 |
|
28769 |
|
28770 |
|
28771 | return IterableDiffers.create(factories, parent || defaultIterableDiffersFactory());
|
28772 | },
|
28773 |
|
28774 | deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
|
28775 | };
|
28776 | }
|
28777 | find(iterable) {
|
28778 | const factory = this.factories.find(f => f.supports(iterable));
|
28779 | if (factory != null) {
|
28780 | return factory;
|
28781 | }
|
28782 | else {
|
28783 | throw new Error(`Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
|
28784 | }
|
28785 | }
|
28786 | }
|
28787 |
|
28788 | IterableDiffers.ɵprov = ɵɵdefineInjectable({ token: IterableDiffers, providedIn: 'root', factory: defaultIterableDiffersFactory });
|
28789 | function getTypeNameForDebugging(type) {
|
28790 | return type['name'] || typeof type;
|
28791 | }
|
28792 |
|
28793 |
|
28794 |
|
28795 |
|
28796 |
|
28797 |
|
28798 |
|
28799 |
|
28800 | function defaultKeyValueDiffersFactory() {
|
28801 | return new KeyValueDiffers([new DefaultKeyValueDifferFactory()]);
|
28802 | }
|
28803 |
|
28804 |
|
28805 |
|
28806 |
|
28807 |
|
28808 | class KeyValueDiffers {
|
28809 | constructor(factories) {
|
28810 | this.factories = factories;
|
28811 | }
|
28812 | static create(factories, parent) {
|
28813 | if (parent) {
|
28814 | const copied = parent.factories.slice();
|
28815 | factories = factories.concat(copied);
|
28816 | }
|
28817 | return new KeyValueDiffers(factories);
|
28818 | }
|
28819 | |
28820 |
|
28821 |
|
28822 |
|
28823 |
|
28824 |
|
28825 |
|
28826 |
|
28827 |
|
28828 |
|
28829 |
|
28830 |
|
28831 |
|
28832 |
|
28833 |
|
28834 |
|
28835 |
|
28836 |
|
28837 |
|
28838 |
|
28839 | static extend(factories) {
|
28840 | return {
|
28841 | provide: KeyValueDiffers,
|
28842 | useFactory: (parent) => {
|
28843 |
|
28844 |
|
28845 |
|
28846 | return KeyValueDiffers.create(factories, parent || defaultKeyValueDiffersFactory());
|
28847 | },
|
28848 |
|
28849 | deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
|
28850 | };
|
28851 | }
|
28852 | find(kv) {
|
28853 | const factory = this.factories.find(f => f.supports(kv));
|
28854 | if (factory) {
|
28855 | return factory;
|
28856 | }
|
28857 | throw new Error(`Cannot find a differ supporting object '${kv}'`);
|
28858 | }
|
28859 | }
|
28860 |
|
28861 | KeyValueDiffers.ɵprov = ɵɵdefineInjectable({ token: KeyValueDiffers, providedIn: 'root', factory: defaultKeyValueDiffersFactory });
|
28862 |
|
28863 |
|
28864 |
|
28865 |
|
28866 |
|
28867 |
|
28868 |
|
28869 |
|
28870 |
|
28871 |
|
28872 |
|
28873 | const keyValDiff = [new DefaultKeyValueDifferFactory()];
|
28874 |
|
28875 |
|
28876 |
|
28877 | const iterableDiff = [new DefaultIterableDifferFactory()];
|
28878 | const defaultIterableDiffers = new IterableDiffers(iterableDiff);
|
28879 | const defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
|
28880 |
|
28881 |
|
28882 |
|
28883 |
|
28884 |
|
28885 |
|
28886 |
|
28887 |
|
28888 |
|
28889 |
|
28890 |
|
28891 |
|
28892 |
|
28893 |
|
28894 |
|
28895 |
|
28896 | const _CORE_PLATFORM_PROVIDERS = [
|
28897 |
|
28898 | { provide: PLATFORM_ID, useValue: 'unknown' },
|
28899 | { provide: PlatformRef, deps: [Injector] },
|
28900 | { provide: TestabilityRegistry, deps: [] },
|
28901 | { provide: Console, deps: [] },
|
28902 | ];
|
28903 |
|
28904 |
|
28905 |
|
28906 |
|
28907 |
|
28908 | const platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
|
28909 |
|
28910 |
|
28911 |
|
28912 |
|
28913 |
|
28914 |
|
28915 |
|
28916 |
|
28917 | function _iterableDiffersFactory() {
|
28918 | return defaultIterableDiffers;
|
28919 | }
|
28920 | function _keyValueDiffersFactory() {
|
28921 | return defaultKeyValueDiffers;
|
28922 | }
|
28923 | function _localeFactory(locale) {
|
28924 | return locale || getGlobalLocale();
|
28925 | }
|
28926 |
|
28927 |
|
28928 |
|
28929 |
|
28930 |
|
28931 |
|
28932 | function getGlobalLocale() {
|
28933 | if (typeof ngI18nClosureMode !== 'undefined' && ngI18nClosureMode &&
|
28934 | typeof goog !== 'undefined' && goog.getLocale() !== 'en') {
|
28935 |
|
28936 |
|
28937 |
|
28938 | return goog.getLocale();
|
28939 | }
|
28940 | else {
|
28941 |
|
28942 |
|
28943 |
|
28944 |
|
28945 |
|
28946 |
|
28947 |
|
28948 |
|
28949 |
|
28950 | return (ivyEnabled && typeof $localize !== 'undefined' && $localize.locale) ||
|
28951 | DEFAULT_LOCALE_ID;
|
28952 | }
|
28953 | }
|
28954 |
|
28955 |
|
28956 |
|
28957 |
|
28958 | const APPLICATION_MODULE_PROVIDERS = [
|
28959 | {
|
28960 | provide: ApplicationRef,
|
28961 | useClass: ApplicationRef,
|
28962 | deps: [NgZone, Injector, ErrorHandler, ComponentFactoryResolver$1, ApplicationInitStatus]
|
28963 | },
|
28964 | { provide: SCHEDULER, deps: [NgZone], useFactory: zoneSchedulerFactory },
|
28965 | {
|
28966 | provide: ApplicationInitStatus,
|
28967 | useClass: ApplicationInitStatus,
|
28968 | deps: [[new Optional(), APP_INITIALIZER]]
|
28969 | },
|
28970 | { provide: Compiler, useClass: Compiler, deps: [] },
|
28971 | APP_ID_RANDOM_PROVIDER,
|
28972 | { provide: IterableDiffers, useFactory: _iterableDiffersFactory, deps: [] },
|
28973 | { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory, deps: [] },
|
28974 | {
|
28975 | provide: LOCALE_ID,
|
28976 | useFactory: _localeFactory,
|
28977 | deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
|
28978 | },
|
28979 | { provide: DEFAULT_CURRENCY_CODE, useValue: USD_CURRENCY_CODE },
|
28980 | ];
|
28981 |
|
28982 |
|
28983 |
|
28984 |
|
28985 |
|
28986 |
|
28987 |
|
28988 |
|
28989 |
|
28990 | function zoneSchedulerFactory(ngZone) {
|
28991 | let queue = [];
|
28992 | ngZone.onStable.subscribe(() => {
|
28993 | while (queue.length) {
|
28994 | queue.pop()();
|
28995 | }
|
28996 | });
|
28997 | return function (fn) {
|
28998 | queue.push(fn);
|
28999 | };
|
29000 | }
|
29001 |
|
29002 |
|
29003 |
|
29004 |
|
29005 |
|
29006 |
|
29007 |
|
29008 |
|
29009 |
|
29010 |
|
29011 | class ApplicationModule {
|
29012 |
|
29013 | constructor(appRef) { }
|
29014 | }
|
29015 | ApplicationModule.ɵfac = function ApplicationModule_Factory(t) { return new (t || ApplicationModule)(ɵɵinject(ApplicationRef)); };
|
29016 | ApplicationModule.ɵmod = ɵɵdefineNgModule({ type: ApplicationModule });
|
29017 | ApplicationModule.ɵinj = ɵɵdefineInjector({ providers: APPLICATION_MODULE_PROVIDERS });
|
29018 | (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationModule, [{
|
29019 | type: NgModule,
|
29020 | args: [{ providers: APPLICATION_MODULE_PROVIDERS }]
|
29021 | }], function () { return [{ type: ApplicationRef }]; }, null); })();
|
29022 |
|
29023 |
|
29024 |
|
29025 |
|
29026 |
|
29027 |
|
29028 |
|
29029 |
|
29030 |
|
29031 |
|
29032 |
|
29033 |
|
29034 | function shiftInitState(view, priorInitState, newInitState) {
|
29035 |
|
29036 |
|
29037 |
|
29038 |
|
29039 |
|
29040 |
|
29041 |
|
29042 |
|
29043 |
|
29044 | const state = view.state;
|
29045 | const initState = state & 1792 ;
|
29046 | if (initState === priorInitState) {
|
29047 | view.state = (state & ~1792 ) | newInitState;
|
29048 | view.initIndex = -1;
|
29049 | return true;
|
29050 | }
|
29051 | return initState === newInitState;
|
29052 | }
|
29053 |
|
29054 |
|
29055 | function shouldCallLifecycleInitHook(view, initState, index) {
|
29056 | if ((view.state & 1792 ) === initState && view.initIndex <= index) {
|
29057 | view.initIndex = index + 1;
|
29058 | return true;
|
29059 | }
|
29060 | return false;
|
29061 | }
|
29062 |
|
29063 |
|
29064 |
|
29065 |
|
29066 |
|
29067 |
|
29068 |
|
29069 |
|
29070 |
|
29071 |
|
29072 |
|
29073 | class NodeData {
|
29074 | }
|
29075 |
|
29076 |
|
29077 |
|
29078 | function asTextData(view, index) {
|
29079 | return view.nodes[index];
|
29080 | }
|
29081 |
|
29082 |
|
29083 |
|
29084 | function asElementData(view, index) {
|
29085 | return view.nodes[index];
|
29086 | }
|
29087 |
|
29088 |
|
29089 |
|
29090 | function asProviderData(view, index) {
|
29091 | return view.nodes[index];
|
29092 | }
|
29093 |
|
29094 |
|
29095 |
|
29096 | function asPureExpressionData(view, index) {
|
29097 | return view.nodes[index];
|
29098 | }
|
29099 |
|
29100 |
|
29101 |
|
29102 | function asQueryList(view, index) {
|
29103 | return view.nodes[index];
|
29104 | }
|
29105 | class DebugContext {
|
29106 | }
|
29107 |
|
29108 |
|
29109 |
|
29110 |
|
29111 | const Services = {
|
29112 | setCurrentNode: undefined,
|
29113 | createRootView: undefined,
|
29114 | createEmbeddedView: undefined,
|
29115 | createComponentView: undefined,
|
29116 | createNgModuleRef: undefined,
|
29117 | overrideProvider: undefined,
|
29118 | overrideComponentView: undefined,
|
29119 | clearOverrides: undefined,
|
29120 | checkAndUpdateView: undefined,
|
29121 | checkNoChangesView: undefined,
|
29122 | destroyView: undefined,
|
29123 | resolveDep: undefined,
|
29124 | createDebugContext: undefined,
|
29125 | handleEvent: undefined,
|
29126 | updateDirectives: undefined,
|
29127 | updateRenderer: undefined,
|
29128 | dirtyParentQueries: undefined,
|
29129 | };
|
29130 |
|
29131 |
|
29132 |
|
29133 |
|
29134 |
|
29135 |
|
29136 |
|
29137 |
|
29138 | function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
|
29139 | let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '${oldValue}'. Current value: '${currValue}'.`;
|
29140 | if (isFirstCheck) {
|
29141 | msg +=
|
29142 | ` It seems like the view has been created after its parent and its children have been dirty checked.` +
|
29143 | ` Has it been created in a change detection hook ?`;
|
29144 | }
|
29145 | return viewDebugError(msg, context);
|
29146 | }
|
29147 | function viewWrappedDebugError(err, context) {
|
29148 | if (!(err instanceof Error)) {
|
29149 |
|
29150 |
|
29151 | err = new Error(err.toString());
|
29152 | }
|
29153 | _addDebugContext(err, context);
|
29154 | return err;
|
29155 | }
|
29156 | function viewDebugError(msg, context) {
|
29157 | const err = new Error(msg);
|
29158 | _addDebugContext(err, context);
|
29159 | return err;
|
29160 | }
|
29161 | function _addDebugContext(err, context) {
|
29162 | err[ERROR_DEBUG_CONTEXT] = context;
|
29163 | err[ERROR_LOGGER] = context.logError.bind(context);
|
29164 | }
|
29165 | function isViewDebugError(err) {
|
29166 | return !!getDebugContext(err);
|
29167 | }
|
29168 | function viewDestroyedError(action) {
|
29169 | return new Error(`ViewDestroyedError: Attempt to use a destroyed view: ${action}`);
|
29170 | }
|
29171 |
|
29172 |
|
29173 |
|
29174 |
|
29175 |
|
29176 |
|
29177 |
|
29178 |
|
29179 | const NOOP = () => { };
|
29180 | const _tokenKeyCache = new Map();
|
29181 | function tokenKey(token) {
|
29182 | let key = _tokenKeyCache.get(token);
|
29183 | if (!key) {
|
29184 | key = stringify(token) + '_' + _tokenKeyCache.size;
|
29185 | _tokenKeyCache.set(token, key);
|
29186 | }
|
29187 | return key;
|
29188 | }
|
29189 | const UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
|
29190 | const EMPTY_RENDERER_TYPE_ID = '$$empty';
|
29191 |
|
29192 |
|
29193 | function createRendererType2(values) {
|
29194 | return {
|
29195 | id: UNDEFINED_RENDERER_TYPE_ID,
|
29196 | styles: values.styles,
|
29197 | encapsulation: values.encapsulation,
|
29198 | data: values.data
|
29199 | };
|
29200 | }
|
29201 | let _renderCompCount = 0;
|
29202 | function resolveRendererType2(type) {
|
29203 | if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
|
29204 |
|
29205 | const isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation$1.None) ||
|
29206 | type.styles.length || Object.keys(type.data).length);
|
29207 | if (isFilled) {
|
29208 | type.id = `c${_renderCompCount++}`;
|
29209 | }
|
29210 | else {
|
29211 | type.id = EMPTY_RENDERER_TYPE_ID;
|
29212 | }
|
29213 | }
|
29214 | if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
|
29215 | type = null;
|
29216 | }
|
29217 | return type || null;
|
29218 | }
|
29219 | function checkBinding(view, def, bindingIdx, value) {
|
29220 | const oldValues = view.oldValues;
|
29221 | if ((view.state & 2 ) ||
|
29222 | !Object.is(oldValues[def.bindingIndex + bindingIdx], value)) {
|
29223 | return true;
|
29224 | }
|
29225 | return false;
|
29226 | }
|
29227 | function checkAndUpdateBinding(view, def, bindingIdx, value) {
|
29228 | if (checkBinding(view, def, bindingIdx, value)) {
|
29229 | view.oldValues[def.bindingIndex + bindingIdx] = value;
|
29230 | return true;
|
29231 | }
|
29232 | return false;
|
29233 | }
|
29234 | function checkBindingNoChanges(view, def, bindingIdx, value) {
|
29235 | const oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
29236 | if ((view.state & 1 ) || !devModeEqual(oldValue, value)) {
|
29237 | const bindingName = def.bindings[bindingIdx].name;
|
29238 | throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.nodeIndex), `${bindingName}: ${oldValue}`, `${bindingName}: ${value}`, (view.state & 1 ) !== 0);
|
29239 | }
|
29240 | }
|
29241 | function markParentViewsForCheck(view) {
|
29242 | let currView = view;
|
29243 | while (currView) {
|
29244 | if (currView.def.flags & 2 ) {
|
29245 | currView.state |= 8 ;
|
29246 | }
|
29247 | currView = currView.viewContainerParent || currView.parent;
|
29248 | }
|
29249 | }
|
29250 | function markParentViewsForCheckProjectedViews(view, endView) {
|
29251 | let currView = view;
|
29252 | while (currView && currView !== endView) {
|
29253 | currView.state |= 64 ;
|
29254 | currView = currView.viewContainerParent || currView.parent;
|
29255 | }
|
29256 | }
|
29257 | function dispatchEvent(view, nodeIndex, eventName, event) {
|
29258 | try {
|
29259 | const nodeDef = view.def.nodes[nodeIndex];
|
29260 | const startView = nodeDef.flags & 33554432 ?
|
29261 | asElementData(view, nodeIndex).componentView :
|
29262 | view;
|
29263 | markParentViewsForCheck(startView);
|
29264 | return Services.handleEvent(view, nodeIndex, eventName, event);
|
29265 | }
|
29266 | catch (e) {
|
29267 |
|
29268 | view.root.errorHandler.handleError(e);
|
29269 | }
|
29270 | }
|
29271 | function declaredViewContainer(view) {
|
29272 | if (view.parent) {
|
29273 | const parentView = view.parent;
|
29274 | return asElementData(parentView, view.parentNodeDef.nodeIndex);
|
29275 | }
|
29276 | return null;
|
29277 | }
|
29278 |
|
29279 |
|
29280 |
|
29281 |
|
29282 |
|
29283 | function viewParentEl(view) {
|
29284 | const parentView = view.parent;
|
29285 | if (parentView) {
|
29286 | return view.parentNodeDef.parent;
|
29287 | }
|
29288 | else {
|
29289 | return null;
|
29290 | }
|
29291 | }
|
29292 | function renderNode(view, def) {
|
29293 | switch (def.flags & 201347067 ) {
|
29294 | case 1 :
|
29295 | return asElementData(view, def.nodeIndex).renderElement;
|
29296 | case 2 :
|
29297 | return asTextData(view, def.nodeIndex).renderText;
|
29298 | }
|
29299 | }
|
29300 | function elementEventFullName(target, name) {
|
29301 | return target ? `${target}:${name}` : name;
|
29302 | }
|
29303 | function isComponentView(view) {
|
29304 | return !!view.parent && !!(view.parentNodeDef.flags & 32768 );
|
29305 | }
|
29306 | function isEmbeddedView(view) {
|
29307 | return !!view.parent && !(view.parentNodeDef.flags & 32768 );
|
29308 | }
|
29309 | function filterQueryId(queryId) {
|
29310 | return 1 << (queryId % 32);
|
29311 | }
|
29312 | function splitMatchedQueriesDsl(matchedQueriesDsl) {
|
29313 | const matchedQueries = {};
|
29314 | let matchedQueryIds = 0;
|
29315 | const references = {};
|
29316 | if (matchedQueriesDsl) {
|
29317 | matchedQueriesDsl.forEach(([queryId, valueType]) => {
|
29318 | if (typeof queryId === 'number') {
|
29319 | matchedQueries[queryId] = valueType;
|
29320 | matchedQueryIds |= filterQueryId(queryId);
|
29321 | }
|
29322 | else {
|
29323 | references[queryId] = valueType;
|
29324 | }
|
29325 | });
|
29326 | }
|
29327 | return { matchedQueries, references, matchedQueryIds };
|
29328 | }
|
29329 | function splitDepsDsl(deps, sourceName) {
|
29330 | return deps.map(value => {
|
29331 | let token;
|
29332 | let flags;
|
29333 | if (Array.isArray(value)) {
|
29334 | [flags, token] = value;
|
29335 | }
|
29336 | else {
|
29337 | flags = 0 ;
|
29338 | token = value;
|
29339 | }
|
29340 | if (token && (typeof token === 'function' || typeof token === 'object') && sourceName) {
|
29341 | Object.defineProperty(token, SOURCE, { value: sourceName, configurable: true });
|
29342 | }
|
29343 | return { flags, token, tokenKey: tokenKey(token) };
|
29344 | });
|
29345 | }
|
29346 | function getParentRenderElement(view, renderHost, def) {
|
29347 | let renderParent = def.renderParent;
|
29348 | if (renderParent) {
|
29349 | if ((renderParent.flags & 1 ) === 0 ||
|
29350 | (renderParent.flags & 33554432 ) === 0 ||
|
29351 | (renderParent.element.componentRendererType &&
|
29352 | (renderParent.element.componentRendererType.encapsulation ===
|
29353 | ViewEncapsulation$1.ShadowDom ||
|
29354 |
|
29355 |
|
29356 |
|
29357 | renderParent.element.componentRendererType.encapsulation === 1))) {
|
29358 |
|
29359 |
|
29360 | return asElementData(view, def.renderParent.nodeIndex).renderElement;
|
29361 | }
|
29362 | }
|
29363 | else {
|
29364 | return renderHost;
|
29365 | }
|
29366 | }
|
29367 | const DEFINITION_CACHE = new WeakMap();
|
29368 | function resolveDefinition(factory) {
|
29369 | let value = DEFINITION_CACHE.get(factory);
|
29370 | if (!value) {
|
29371 | value = factory(() => NOOP);
|
29372 | value.factory = factory;
|
29373 | DEFINITION_CACHE.set(factory, value);
|
29374 | }
|
29375 | return value;
|
29376 | }
|
29377 | function rootRenderNodes(view) {
|
29378 | const renderNodes = [];
|
29379 | visitRootRenderNodes(view, 0 , undefined, undefined, renderNodes);
|
29380 | return renderNodes;
|
29381 | }
|
29382 | function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
|
29383 |
|
29384 | if (action === 3 ) {
|
29385 | parentNode = view.renderer.parentNode(renderNode(view, view.def.lastRenderRootNode));
|
29386 | }
|
29387 | visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
|
29388 | }
|
29389 | function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
|
29390 | for (let i = startIndex; i <= endIndex; i++) {
|
29391 | const nodeDef = view.def.nodes[i];
|
29392 | if (nodeDef.flags & (1 | 2 | 8 )) {
|
29393 | visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
|
29394 | }
|
29395 |
|
29396 | i += nodeDef.childCount;
|
29397 | }
|
29398 | }
|
29399 | function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
|
29400 | let compView = view;
|
29401 | while (compView && !isComponentView(compView)) {
|
29402 | compView = compView.parent;
|
29403 | }
|
29404 | const hostView = compView.parent;
|
29405 | const hostElDef = viewParentEl(compView);
|
29406 | const startIndex = hostElDef.nodeIndex + 1;
|
29407 | const endIndex = hostElDef.nodeIndex + hostElDef.childCount;
|
29408 | for (let i = startIndex; i <= endIndex; i++) {
|
29409 | const nodeDef = hostView.def.nodes[i];
|
29410 | if (nodeDef.ngContentIndex === ngContentIndex) {
|
29411 | visitRenderNode(hostView, nodeDef, action, parentNode, nextSibling, target);
|
29412 | }
|
29413 |
|
29414 | i += nodeDef.childCount;
|
29415 | }
|
29416 | if (!hostView.parent) {
|
29417 |
|
29418 | const projectedNodes = view.root.projectableNodes[ngContentIndex];
|
29419 | if (projectedNodes) {
|
29420 | for (let i = 0; i < projectedNodes.length; i++) {
|
29421 | execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
|
29422 | }
|
29423 | }
|
29424 | }
|
29425 | }
|
29426 | function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
|
29427 | if (nodeDef.flags & 8 ) {
|
29428 | visitProjectedRenderNodes(view, nodeDef.ngContent.index, action, parentNode, nextSibling, target);
|
29429 | }
|
29430 | else {
|
29431 | const rn = renderNode(view, nodeDef);
|
29432 | if (action === 3 && (nodeDef.flags & 33554432 ) &&
|
29433 | (nodeDef.bindingFlags & 48 )) {
|
29434 |
|
29435 | if (nodeDef.bindingFlags & (16 )) {
|
29436 | execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
29437 | }
|
29438 | if (nodeDef.bindingFlags & (32 )) {
|
29439 | const compView = asElementData(view, nodeDef.nodeIndex).componentView;
|
29440 | execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
|
29441 | }
|
29442 | }
|
29443 | else {
|
29444 | execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
29445 | }
|
29446 | if (nodeDef.flags & 16777216 ) {
|
29447 | const embeddedViews = asElementData(view, nodeDef.nodeIndex).viewContainer._embeddedViews;
|
29448 | for (let k = 0; k < embeddedViews.length; k++) {
|
29449 | visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
|
29450 | }
|
29451 | }
|
29452 | if (nodeDef.flags & 1 && !nodeDef.element.name) {
|
29453 | visitSiblingRenderNodes(view, action, nodeDef.nodeIndex + 1, nodeDef.nodeIndex + nodeDef.childCount, parentNode, nextSibling, target);
|
29454 | }
|
29455 | }
|
29456 | }
|
29457 | function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
|
29458 | const renderer = view.renderer;
|
29459 | switch (action) {
|
29460 | case 1 :
|
29461 | renderer.appendChild(parentNode, renderNode);
|
29462 | break;
|
29463 | case 2 :
|
29464 | renderer.insertBefore(parentNode, renderNode, nextSibling);
|
29465 | break;
|
29466 | case 3 :
|
29467 | renderer.removeChild(parentNode, renderNode);
|
29468 | break;
|
29469 | case 0 :
|
29470 | target.push(renderNode);
|
29471 | break;
|
29472 | }
|
29473 | }
|
29474 | const NS_PREFIX_RE = /^:([^:]+):(.+)$/;
|
29475 | function splitNamespace(name) {
|
29476 | if (name[0] === ':') {
|
29477 | const match = name.match(NS_PREFIX_RE);
|
29478 | return [match[1], match[2]];
|
29479 | }
|
29480 | return ['', name];
|
29481 | }
|
29482 | function calcBindingFlags(bindings) {
|
29483 | let flags = 0;
|
29484 | for (let i = 0; i < bindings.length; i++) {
|
29485 | flags |= bindings[i].flags;
|
29486 | }
|
29487 | return flags;
|
29488 | }
|
29489 | function interpolate(valueCount, constAndInterp) {
|
29490 | let result = '';
|
29491 | for (let i = 0; i < valueCount * 2; i = i + 2) {
|
29492 | result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
|
29493 | }
|
29494 | return result + constAndInterp[valueCount * 2];
|
29495 | }
|
29496 | function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
|
29497 | switch (valueCount) {
|
29498 | case 1:
|
29499 | return c0 + _toStringWithNull(a1) + c1;
|
29500 | case 2:
|
29501 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
|
29502 | case 3:
|
29503 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
29504 | c3;
|
29505 | case 4:
|
29506 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
29507 | c3 + _toStringWithNull(a4) + c4;
|
29508 | case 5:
|
29509 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
29510 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
|
29511 | case 6:
|
29512 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
29513 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
|
29514 | case 7:
|
29515 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
29516 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
29517 | c6 + _toStringWithNull(a7) + c7;
|
29518 | case 8:
|
29519 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
29520 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
29521 | c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
|
29522 | case 9:
|
29523 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
29524 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
29525 | c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
|
29526 | default:
|
29527 | throw new Error(`Does not support more than 9 expressions`);
|
29528 | }
|
29529 | }
|
29530 | function _toStringWithNull(v) {
|
29531 | return v != null ? v.toString() : '';
|
29532 | }
|
29533 | const EMPTY_MAP = {};
|
29534 |
|
29535 |
|
29536 |
|
29537 |
|
29538 |
|
29539 |
|
29540 |
|
29541 |
|
29542 | function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
|
29543 | flags |= 1 ;
|
29544 | const { matchedQueries, references, matchedQueryIds } = splitMatchedQueriesDsl(matchedQueriesDsl);
|
29545 | const template = templateFactory ? resolveDefinition(templateFactory) : null;
|
29546 | return {
|
29547 |
|
29548 | nodeIndex: -1,
|
29549 | parent: null,
|
29550 | renderParent: null,
|
29551 | bindingIndex: -1,
|
29552 | outputIndex: -1,
|
29553 |
|
29554 | flags,
|
29555 | checkIndex: -1,
|
29556 | childFlags: 0,
|
29557 | directChildFlags: 0,
|
29558 | childMatchedQueries: 0,
|
29559 | matchedQueries,
|
29560 | matchedQueryIds,
|
29561 | references,
|
29562 | ngContentIndex,
|
29563 | childCount,
|
29564 | bindings: [],
|
29565 | bindingFlags: 0,
|
29566 | outputs: [],
|
29567 | element: {
|
29568 | ns: null,
|
29569 | name: null,
|
29570 | attrs: null,
|
29571 | template,
|
29572 | componentProvider: null,
|
29573 | componentView: null,
|
29574 | componentRendererType: null,
|
29575 | publicProviders: null,
|
29576 | allProviders: null,
|
29577 | handleEvent: handleEvent || NOOP
|
29578 | },
|
29579 | provider: null,
|
29580 | text: null,
|
29581 | query: null,
|
29582 | ngContent: null
|
29583 | };
|
29584 | }
|
29585 | function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs = [], bindings, outputs, handleEvent, componentView, componentRendererType) {
|
29586 | if (!handleEvent) {
|
29587 | handleEvent = NOOP;
|
29588 | }
|
29589 | const { matchedQueries, references, matchedQueryIds } = splitMatchedQueriesDsl(matchedQueriesDsl);
|
29590 | let ns = null;
|
29591 | let name = null;
|
29592 | if (namespaceAndName) {
|
29593 | [ns, name] = splitNamespace(namespaceAndName);
|
29594 | }
|
29595 | bindings = bindings || [];
|
29596 | const bindingDefs = [];
|
29597 | for (let i = 0; i < bindings.length; i++) {
|
29598 | const [bindingFlags, namespaceAndName, suffixOrSecurityContext] = bindings[i];
|
29599 | const [ns, name] = splitNamespace(namespaceAndName);
|
29600 | let securityContext = undefined;
|
29601 | let suffix = undefined;
|
29602 | switch (bindingFlags & 15 ) {
|
29603 | case 4 :
|
29604 | suffix = suffixOrSecurityContext;
|
29605 | break;
|
29606 | case 1 :
|
29607 | case 8 :
|
29608 | securityContext = suffixOrSecurityContext;
|
29609 | break;
|
29610 | }
|
29611 | bindingDefs[i] =
|
29612 | { flags: bindingFlags, ns, name, nonMinifiedName: name, securityContext, suffix };
|
29613 | }
|
29614 | outputs = outputs || [];
|
29615 | const outputDefs = [];
|
29616 | for (let i = 0; i < outputs.length; i++) {
|
29617 | const [target, eventName] = outputs[i];
|
29618 | outputDefs[i] =
|
29619 | { type: 0 , target: target, eventName, propName: null };
|
29620 | }
|
29621 | fixedAttrs = fixedAttrs || [];
|
29622 | const attrs = fixedAttrs.map(([namespaceAndName, value]) => {
|
29623 | const [ns, name] = splitNamespace(namespaceAndName);
|
29624 | return [ns, name, value];
|
29625 | });
|
29626 | componentRendererType = resolveRendererType2(componentRendererType);
|
29627 | if (componentView) {
|
29628 | flags |= 33554432 ;
|
29629 | }
|
29630 | flags |= 1 ;
|
29631 | return {
|
29632 |
|
29633 | nodeIndex: -1,
|
29634 | parent: null,
|
29635 | renderParent: null,
|
29636 | bindingIndex: -1,
|
29637 | outputIndex: -1,
|
29638 |
|
29639 | checkIndex,
|
29640 | flags,
|
29641 | childFlags: 0,
|
29642 | directChildFlags: 0,
|
29643 | childMatchedQueries: 0,
|
29644 | matchedQueries,
|
29645 | matchedQueryIds,
|
29646 | references,
|
29647 | ngContentIndex,
|
29648 | childCount,
|
29649 | bindings: bindingDefs,
|
29650 | bindingFlags: calcBindingFlags(bindingDefs),
|
29651 | outputs: outputDefs,
|
29652 | element: {
|
29653 | ns,
|
29654 | name,
|
29655 | attrs,
|
29656 | template: null,
|
29657 |
|
29658 | componentProvider: null,
|
29659 | componentView: componentView || null,
|
29660 | componentRendererType: componentRendererType,
|
29661 | publicProviders: null,
|
29662 | allProviders: null,
|
29663 | handleEvent: handleEvent || NOOP,
|
29664 | },
|
29665 | provider: null,
|
29666 | text: null,
|
29667 | query: null,
|
29668 | ngContent: null
|
29669 | };
|
29670 | }
|
29671 | function createElement(view, renderHost, def) {
|
29672 | const elDef = def.element;
|
29673 | const rootSelectorOrNode = view.root.selectorOrNode;
|
29674 | const renderer = view.renderer;
|
29675 | let el;
|
29676 | if (view.parent || !rootSelectorOrNode) {
|
29677 | if (elDef.name) {
|
29678 | el = renderer.createElement(elDef.name, elDef.ns);
|
29679 | }
|
29680 | else {
|
29681 | el = renderer.createComment('');
|
29682 | }
|
29683 | const parentEl = getParentRenderElement(view, renderHost, def);
|
29684 | if (parentEl) {
|
29685 | renderer.appendChild(parentEl, el);
|
29686 | }
|
29687 | }
|
29688 | else {
|
29689 |
|
29690 | const preserveContent = (!!elDef.componentRendererType &&
|
29691 | elDef.componentRendererType.encapsulation === ViewEncapsulation$1.ShadowDom);
|
29692 | el = renderer.selectRootElement(rootSelectorOrNode, preserveContent);
|
29693 | }
|
29694 | if (elDef.attrs) {
|
29695 | for (let i = 0; i < elDef.attrs.length; i++) {
|
29696 | const [ns, name, value] = elDef.attrs[i];
|
29697 | renderer.setAttribute(el, name, value, ns);
|
29698 | }
|
29699 | }
|
29700 | return el;
|
29701 | }
|
29702 | function listenToElementOutputs(view, compView, def, el) {
|
29703 | for (let i = 0; i < def.outputs.length; i++) {
|
29704 | const output = def.outputs[i];
|
29705 | const handleEventClosure = renderEventHandlerClosure(view, def.nodeIndex, elementEventFullName(output.target, output.eventName));
|
29706 | let listenTarget = output.target;
|
29707 | let listenerView = view;
|
29708 | if (output.target === 'component') {
|
29709 | listenTarget = null;
|
29710 | listenerView = compView;
|
29711 | }
|
29712 | const disposable = listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure);
|
29713 | view.disposables[def.outputIndex + i] = disposable;
|
29714 | }
|
29715 | }
|
29716 | function renderEventHandlerClosure(view, index, eventName) {
|
29717 | return (event) => dispatchEvent(view, index, eventName, event);
|
29718 | }
|
29719 | function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
29720 | const bindLen = def.bindings.length;
|
29721 | let changed = false;
|
29722 | if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
|
29723 | changed = true;
|
29724 | if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
|
29725 | changed = true;
|
29726 | if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
|
29727 | changed = true;
|
29728 | if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
|
29729 | changed = true;
|
29730 | if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
|
29731 | changed = true;
|
29732 | if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
|
29733 | changed = true;
|
29734 | if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
|
29735 | changed = true;
|
29736 | if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
|
29737 | changed = true;
|
29738 | if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
|
29739 | changed = true;
|
29740 | if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
|
29741 | changed = true;
|
29742 | return changed;
|
29743 | }
|
29744 | function checkAndUpdateElementDynamic(view, def, values) {
|
29745 | let changed = false;
|
29746 | for (let i = 0; i < values.length; i++) {
|
29747 | if (checkAndUpdateElementValue(view, def, i, values[i]))
|
29748 | changed = true;
|
29749 | }
|
29750 | return changed;
|
29751 | }
|
29752 | function checkAndUpdateElementValue(view, def, bindingIdx, value) {
|
29753 | if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
|
29754 | return false;
|
29755 | }
|
29756 | const binding = def.bindings[bindingIdx];
|
29757 | const elData = asElementData(view, def.nodeIndex);
|
29758 | const renderNode = elData.renderElement;
|
29759 | const name = binding.name;
|
29760 | switch (binding.flags & 15 ) {
|
29761 | case 1 :
|
29762 | setElementAttribute(view, binding, renderNode, binding.ns, name, value);
|
29763 | break;
|
29764 | case 2 :
|
29765 | setElementClass(view, renderNode, name, value);
|
29766 | break;
|
29767 | case 4 :
|
29768 | setElementStyle(view, binding, renderNode, name, value);
|
29769 | break;
|
29770 | case 8 :
|
29771 | const bindView = (def.flags & 33554432 &&
|
29772 | binding.flags & 32 ) ?
|
29773 | elData.componentView :
|
29774 | view;
|
29775 | setElementProperty(bindView, binding, renderNode, name, value);
|
29776 | break;
|
29777 | }
|
29778 | return true;
|
29779 | }
|
29780 | function setElementAttribute(view, binding, renderNode, ns, name, value) {
|
29781 | const securityContext = binding.securityContext;
|
29782 | let renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
29783 | renderValue = renderValue != null ? renderValue.toString() : null;
|
29784 | const renderer = view.renderer;
|
29785 | if (value != null) {
|
29786 | renderer.setAttribute(renderNode, name, renderValue, ns);
|
29787 | }
|
29788 | else {
|
29789 | renderer.removeAttribute(renderNode, name, ns);
|
29790 | }
|
29791 | }
|
29792 | function setElementClass(view, renderNode, name, value) {
|
29793 | const renderer = view.renderer;
|
29794 | if (value) {
|
29795 | renderer.addClass(renderNode, name);
|
29796 | }
|
29797 | else {
|
29798 | renderer.removeClass(renderNode, name);
|
29799 | }
|
29800 | }
|
29801 | function setElementStyle(view, binding, renderNode, name, value) {
|
29802 | let renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, value);
|
29803 | if (renderValue != null) {
|
29804 | renderValue = renderValue.toString();
|
29805 | const unit = binding.suffix;
|
29806 | if (unit != null) {
|
29807 | renderValue = renderValue + unit;
|
29808 | }
|
29809 | }
|
29810 | else {
|
29811 | renderValue = null;
|
29812 | }
|
29813 | const renderer = view.renderer;
|
29814 | if (renderValue != null) {
|
29815 | renderer.setStyle(renderNode, name, renderValue);
|
29816 | }
|
29817 | else {
|
29818 | renderer.removeStyle(renderNode, name);
|
29819 | }
|
29820 | }
|
29821 | function setElementProperty(view, binding, renderNode, name, value) {
|
29822 | const securityContext = binding.securityContext;
|
29823 | let renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
29824 | view.renderer.setProperty(renderNode, name, renderValue);
|
29825 | }
|
29826 |
|
29827 |
|
29828 |
|
29829 |
|
29830 |
|
29831 |
|
29832 |
|
29833 |
|
29834 | const UNDEFINED_VALUE = {};
|
29835 | const InjectorRefTokenKey$1 = tokenKey(Injector);
|
29836 | const INJECTORRefTokenKey$1 = tokenKey(INJECTOR);
|
29837 | const NgModuleRefTokenKey = tokenKey(NgModuleRef$1);
|
29838 | function moduleProvideDef(flags, token, value, deps) {
|
29839 |
|
29840 |
|
29841 |
|
29842 | value = resolveForwardRef(value);
|
29843 | const depDefs = splitDepsDsl(deps, stringify(token));
|
29844 | return {
|
29845 |
|
29846 | index: -1,
|
29847 | deps: depDefs,
|
29848 | flags,
|
29849 | token,
|
29850 | value
|
29851 | };
|
29852 | }
|
29853 | function moduleDef(providers) {
|
29854 | const providersByKey = {};
|
29855 | const modules = [];
|
29856 | let scope = null;
|
29857 | for (let i = 0; i < providers.length; i++) {
|
29858 | const provider = providers[i];
|
29859 | if (provider.token === INJECTOR_SCOPE) {
|
29860 | scope = provider.value;
|
29861 | }
|
29862 | if (provider.flags & 1073741824 ) {
|
29863 | modules.push(provider.token);
|
29864 | }
|
29865 | provider.index = i;
|
29866 | providersByKey[tokenKey(provider.token)] = provider;
|
29867 | }
|
29868 | return {
|
29869 |
|
29870 | factory: null,
|
29871 | providersByKey,
|
29872 | providers,
|
29873 | modules,
|
29874 | scope: scope,
|
29875 | };
|
29876 | }
|
29877 | function initNgModule(data) {
|
29878 | const def = data._def;
|
29879 | const providers = data._providers = newArray(def.providers.length);
|
29880 | for (let i = 0; i < def.providers.length; i++) {
|
29881 | const provDef = def.providers[i];
|
29882 | if (!(provDef.flags & 4096 )) {
|
29883 |
|
29884 | if (providers[i] === undefined) {
|
29885 | providers[i] = _createProviderInstance$1(data, provDef);
|
29886 | }
|
29887 | }
|
29888 | }
|
29889 | }
|
29890 | function resolveNgModuleDep(data, depDef, notFoundValue = Injector.THROW_IF_NOT_FOUND) {
|
29891 | const former = setCurrentInjector(data);
|
29892 | try {
|
29893 | if (depDef.flags & 8 ) {
|
29894 | return depDef.token;
|
29895 | }
|
29896 | if (depDef.flags & 2 ) {
|
29897 | notFoundValue = null;
|
29898 | }
|
29899 | if (depDef.flags & 1 ) {
|
29900 | return data._parent.get(depDef.token, notFoundValue);
|
29901 | }
|
29902 | const tokenKey = depDef.tokenKey;
|
29903 | switch (tokenKey) {
|
29904 | case InjectorRefTokenKey$1:
|
29905 | case INJECTORRefTokenKey$1:
|
29906 | case NgModuleRefTokenKey:
|
29907 | return data;
|
29908 | }
|
29909 | const providerDef = data._def.providersByKey[tokenKey];
|
29910 | let injectableDef;
|
29911 | if (providerDef) {
|
29912 | let providerInstance = data._providers[providerDef.index];
|
29913 | if (providerInstance === undefined) {
|
29914 | providerInstance = data._providers[providerDef.index] =
|
29915 | _createProviderInstance$1(data, providerDef);
|
29916 | }
|
29917 | return providerInstance === UNDEFINED_VALUE ? undefined : providerInstance;
|
29918 | }
|
29919 | else if ((injectableDef = getInjectableDef(depDef.token)) && targetsModule(data, injectableDef)) {
|
29920 | const index = data._providers.length;
|
29921 | data._def.providers[index] = data._def.providersByKey[depDef.tokenKey] = {
|
29922 | flags: 1024 | 4096 ,
|
29923 | value: injectableDef.factory,
|
29924 | deps: [],
|
29925 | index,
|
29926 | token: depDef.token,
|
29927 | };
|
29928 | data._providers[index] = UNDEFINED_VALUE;
|
29929 | return (data._providers[index] =
|
29930 | _createProviderInstance$1(data, data._def.providersByKey[depDef.tokenKey]));
|
29931 | }
|
29932 | else if (depDef.flags & 4 ) {
|
29933 | return notFoundValue;
|
29934 | }
|
29935 | return data._parent.get(depDef.token, notFoundValue);
|
29936 | }
|
29937 | finally {
|
29938 | setCurrentInjector(former);
|
29939 | }
|
29940 | }
|
29941 | function moduleTransitivelyPresent(ngModule, scope) {
|
29942 | return ngModule._def.modules.indexOf(scope) > -1;
|
29943 | }
|
29944 | function targetsModule(ngModule, def) {
|
29945 | const providedIn = resolveForwardRef(def.providedIn);
|
29946 | return providedIn != null &&
|
29947 | (providedIn === 'any' || providedIn === ngModule._def.scope ||
|
29948 | moduleTransitivelyPresent(ngModule, providedIn));
|
29949 | }
|
29950 | function _createProviderInstance$1(ngModule, providerDef) {
|
29951 | let injectable;
|
29952 | switch (providerDef.flags & 201347067 ) {
|
29953 | case 512 :
|
29954 | injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
|
29955 | break;
|
29956 | case 1024 :
|
29957 | injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
|
29958 | break;
|
29959 | case 2048 :
|
29960 | injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
|
29961 | break;
|
29962 | case 256 :
|
29963 | injectable = providerDef.value;
|
29964 | break;
|
29965 | }
|
29966 |
|
29967 |
|
29968 |
|
29969 |
|
29970 | if (injectable !== UNDEFINED_VALUE && injectable !== null && typeof injectable === 'object' &&
|
29971 | !(providerDef.flags & 131072 ) && typeof injectable.ngOnDestroy === 'function') {
|
29972 | providerDef.flags |= 131072 ;
|
29973 | }
|
29974 | return injectable === undefined ? UNDEFINED_VALUE : injectable;
|
29975 | }
|
29976 | function _createClass(ngModule, ctor, deps) {
|
29977 | const len = deps.length;
|
29978 | switch (len) {
|
29979 | case 0:
|
29980 | return new ctor();
|
29981 | case 1:
|
29982 | return new ctor(resolveNgModuleDep(ngModule, deps[0]));
|
29983 | case 2:
|
29984 | return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
|
29985 | case 3:
|
29986 | return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
|
29987 | default:
|
29988 | const depValues = [];
|
29989 | for (let i = 0; i < len; i++) {
|
29990 | depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
|
29991 | }
|
29992 | return new ctor(...depValues);
|
29993 | }
|
29994 | }
|
29995 | function _callFactory(ngModule, factory, deps) {
|
29996 | const len = deps.length;
|
29997 | switch (len) {
|
29998 | case 0:
|
29999 | return factory();
|
30000 | case 1:
|
30001 | return factory(resolveNgModuleDep(ngModule, deps[0]));
|
30002 | case 2:
|
30003 | return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
|
30004 | case 3:
|
30005 | return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
|
30006 | default:
|
30007 | const depValues = [];
|
30008 | for (let i = 0; i < len; i++) {
|
30009 | depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
|
30010 | }
|
30011 | return factory(...depValues);
|
30012 | }
|
30013 | }
|
30014 | function callNgModuleLifecycle(ngModule, lifecycles) {
|
30015 | const def = ngModule._def;
|
30016 | const destroyed = new Set();
|
30017 | for (let i = 0; i < def.providers.length; i++) {
|
30018 | const provDef = def.providers[i];
|
30019 | if (provDef.flags & 131072 ) {
|
30020 | const instance = ngModule._providers[i];
|
30021 | if (instance && instance !== UNDEFINED_VALUE) {
|
30022 | const onDestroy = instance.ngOnDestroy;
|
30023 | if (typeof onDestroy === 'function' && !destroyed.has(instance)) {
|
30024 | onDestroy.apply(instance);
|
30025 | destroyed.add(instance);
|
30026 | }
|
30027 | }
|
30028 | }
|
30029 | }
|
30030 | }
|
30031 |
|
30032 |
|
30033 |
|
30034 |
|
30035 |
|
30036 |
|
30037 |
|
30038 |
|
30039 | function attachEmbeddedView(parentView, elementData, viewIndex, view) {
|
30040 | let embeddedViews = elementData.viewContainer._embeddedViews;
|
30041 | if (viewIndex === null || viewIndex === undefined) {
|
30042 | viewIndex = embeddedViews.length;
|
30043 | }
|
30044 | view.viewContainerParent = parentView;
|
30045 | addToArray(embeddedViews, viewIndex, view);
|
30046 | attachProjectedView(elementData, view);
|
30047 | Services.dirtyParentQueries(view);
|
30048 | const prevView = viewIndex > 0 ? embeddedViews[viewIndex - 1] : null;
|
30049 | renderAttachEmbeddedView(elementData, prevView, view);
|
30050 | }
|
30051 | function attachProjectedView(vcElementData, view) {
|
30052 | const dvcElementData = declaredViewContainer(view);
|
30053 | if (!dvcElementData || dvcElementData === vcElementData ||
|
30054 | view.state & 16 ) {
|
30055 | return;
|
30056 | }
|
30057 |
|
30058 |
|
30059 |
|
30060 |
|
30061 |
|
30062 |
|
30063 |
|
30064 | view.state |= 16 ;
|
30065 | let projectedViews = dvcElementData.template._projectedViews;
|
30066 | if (!projectedViews) {
|
30067 | projectedViews = dvcElementData.template._projectedViews = [];
|
30068 | }
|
30069 | projectedViews.push(view);
|
30070 |
|
30071 |
|
30072 | markNodeAsProjectedTemplate(view.parent.def, view.parentNodeDef);
|
30073 | }
|
30074 | function markNodeAsProjectedTemplate(viewDef, nodeDef) {
|
30075 | if (nodeDef.flags & 4 ) {
|
30076 | return;
|
30077 | }
|
30078 | viewDef.nodeFlags |= 4 ;
|
30079 | nodeDef.flags |= 4 ;
|
30080 | let parentNodeDef = nodeDef.parent;
|
30081 | while (parentNodeDef) {
|
30082 | parentNodeDef.childFlags |= 4 ;
|
30083 | parentNodeDef = parentNodeDef.parent;
|
30084 | }
|
30085 | }
|
30086 | function detachEmbeddedView(elementData, viewIndex) {
|
30087 | const embeddedViews = elementData.viewContainer._embeddedViews;
|
30088 | if (viewIndex == null || viewIndex >= embeddedViews.length) {
|
30089 | viewIndex = embeddedViews.length - 1;
|
30090 | }
|
30091 | if (viewIndex < 0) {
|
30092 | return null;
|
30093 | }
|
30094 | const view = embeddedViews[viewIndex];
|
30095 | view.viewContainerParent = null;
|
30096 | removeFromArray(embeddedViews, viewIndex);
|
30097 |
|
30098 | Services.dirtyParentQueries(view);
|
30099 | renderDetachView(view);
|
30100 | return view;
|
30101 | }
|
30102 | function detachProjectedView(view) {
|
30103 | if (!(view.state & 16 )) {
|
30104 | return;
|
30105 | }
|
30106 | const dvcElementData = declaredViewContainer(view);
|
30107 | if (dvcElementData) {
|
30108 | const projectedViews = dvcElementData.template._projectedViews;
|
30109 | if (projectedViews) {
|
30110 | removeFromArray(projectedViews, projectedViews.indexOf(view));
|
30111 | Services.dirtyParentQueries(view);
|
30112 | }
|
30113 | }
|
30114 | }
|
30115 | function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
|
30116 | const embeddedViews = elementData.viewContainer._embeddedViews;
|
30117 | const view = embeddedViews[oldViewIndex];
|
30118 | removeFromArray(embeddedViews, oldViewIndex);
|
30119 | if (newViewIndex == null) {
|
30120 | newViewIndex = embeddedViews.length;
|
30121 | }
|
30122 | addToArray(embeddedViews, newViewIndex, view);
|
30123 |
|
30124 |
|
30125 | Services.dirtyParentQueries(view);
|
30126 | renderDetachView(view);
|
30127 | const prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
|
30128 | renderAttachEmbeddedView(elementData, prevView, view);
|
30129 | return view;
|
30130 | }
|
30131 | function renderAttachEmbeddedView(elementData, prevView, view) {
|
30132 | const prevRenderNode = prevView ? renderNode(prevView, prevView.def.lastRenderRootNode) : elementData.renderElement;
|
30133 | const parentNode = view.renderer.parentNode(prevRenderNode);
|
30134 | const nextSibling = view.renderer.nextSibling(prevRenderNode);
|
30135 |
|
30136 |
|
30137 | visitRootRenderNodes(view, 2 , parentNode, nextSibling, undefined);
|
30138 | }
|
30139 | function renderDetachView(view) {
|
30140 | visitRootRenderNodes(view, 3 , null, null, undefined);
|
30141 | }
|
30142 |
|
30143 |
|
30144 |
|
30145 |
|
30146 |
|
30147 |
|
30148 |
|
30149 |
|
30150 | const EMPTY_CONTEXT = {};
|
30151 |
|
30152 |
|
30153 | function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
|
30154 | return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
|
30155 | }
|
30156 | function getComponentViewDefinitionFactory(componentFactory) {
|
30157 | return componentFactory.viewDefFactory;
|
30158 | }
|
30159 | class ComponentFactory_ extends ComponentFactory$1 {
|
30160 | constructor(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
|
30161 |
|
30162 |
|
30163 | super();
|
30164 | this.selector = selector;
|
30165 | this.componentType = componentType;
|
30166 | this._inputs = _inputs;
|
30167 | this._outputs = _outputs;
|
30168 | this.ngContentSelectors = ngContentSelectors;
|
30169 | this.viewDefFactory = viewDefFactory;
|
30170 | }
|
30171 | get inputs() {
|
30172 | const inputsArr = [];
|
30173 | const inputs = this._inputs;
|
30174 | for (let propName in inputs) {
|
30175 | const templateName = inputs[propName];
|
30176 | inputsArr.push({ propName, templateName });
|
30177 | }
|
30178 | return inputsArr;
|
30179 | }
|
30180 | get outputs() {
|
30181 | const outputsArr = [];
|
30182 | for (let propName in this._outputs) {
|
30183 | const templateName = this._outputs[propName];
|
30184 | outputsArr.push({ propName, templateName });
|
30185 | }
|
30186 | return outputsArr;
|
30187 | }
|
30188 | |
30189 |
|
30190 |
|
30191 | create(injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
30192 | if (!ngModule) {
|
30193 | throw new Error('ngModule should be provided');
|
30194 | }
|
30195 | const viewDef = resolveDefinition(this.viewDefFactory);
|
30196 | const componentNodeIndex = viewDef.nodes[0].element.componentProvider.nodeIndex;
|
30197 | const view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
|
30198 | const component = asProviderData(view, componentNodeIndex).instance;
|
30199 | if (rootSelectorOrNode) {
|
30200 | view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
|
30201 | }
|
30202 | return new ComponentRef_(view, new ViewRef_(view), component);
|
30203 | }
|
30204 | }
|
30205 | class ComponentRef_ extends ComponentRef$1 {
|
30206 | constructor(_view, _viewRef, _component) {
|
30207 | super();
|
30208 | this._view = _view;
|
30209 | this._viewRef = _viewRef;
|
30210 | this._component = _component;
|
30211 | this._elDef = this._view.def.nodes[0];
|
30212 | this.hostView = _viewRef;
|
30213 | this.changeDetectorRef = _viewRef;
|
30214 | this.instance = _component;
|
30215 | }
|
30216 | get location() {
|
30217 | return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement);
|
30218 | }
|
30219 | get injector() {
|
30220 | return new Injector_(this._view, this._elDef);
|
30221 | }
|
30222 | get componentType() {
|
30223 | return this._component.constructor;
|
30224 | }
|
30225 | destroy() {
|
30226 | this._viewRef.destroy();
|
30227 | }
|
30228 | onDestroy(callback) {
|
30229 | this._viewRef.onDestroy(callback);
|
30230 | }
|
30231 | }
|
30232 | function createViewContainerData(view, elDef, elData) {
|
30233 | return new ViewContainerRef_(view, elDef, elData);
|
30234 | }
|
30235 | class ViewContainerRef_ {
|
30236 | constructor(_view, _elDef, _data) {
|
30237 | this._view = _view;
|
30238 | this._elDef = _elDef;
|
30239 | this._data = _data;
|
30240 | |
30241 |
|
30242 |
|
30243 | this._embeddedViews = [];
|
30244 | }
|
30245 | get element() {
|
30246 | return new ElementRef(this._data.renderElement);
|
30247 | }
|
30248 | get injector() {
|
30249 | return new Injector_(this._view, this._elDef);
|
30250 | }
|
30251 |
|
30252 | get parentInjector() {
|
30253 | let view = this._view;
|
30254 | let elDef = this._elDef.parent;
|
30255 | while (!elDef && view) {
|
30256 | elDef = viewParentEl(view);
|
30257 | view = view.parent;
|
30258 | }
|
30259 | return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
|
30260 | }
|
30261 | clear() {
|
30262 | const len = this._embeddedViews.length;
|
30263 | for (let i = len - 1; i >= 0; i--) {
|
30264 | const view = detachEmbeddedView(this._data, i);
|
30265 | Services.destroyView(view);
|
30266 | }
|
30267 | }
|
30268 | get(index) {
|
30269 | const view = this._embeddedViews[index];
|
30270 | if (view) {
|
30271 | const ref = new ViewRef_(view);
|
30272 | ref.attachToViewContainerRef(this);
|
30273 | return ref;
|
30274 | }
|
30275 | return null;
|
30276 | }
|
30277 | get length() {
|
30278 | return this._embeddedViews.length;
|
30279 | }
|
30280 | createEmbeddedView(templateRef, context, index) {
|
30281 | const viewRef = templateRef.createEmbeddedView(context || {});
|
30282 | this.insert(viewRef, index);
|
30283 | return viewRef;
|
30284 | }
|
30285 | createComponent(componentFactoryOrType, indexOrOptions, injector, projectableNodes, ngModuleRef) {
|
30286 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
30287 | assertEqual(typeof componentFactoryOrType !== 'function', true, 'ViewEngine does not support Type as an argument for \'componentFactoryOrType\'');
|
30288 | assertEqual(typeof indexOrOptions !== 'object', true, 'ViewEngine does not support options as an object provided via second argument');
|
30289 | }
|
30290 | const index = indexOrOptions;
|
30291 | const contextInjector = injector || this.parentInjector;
|
30292 | const componentFactory = componentFactoryOrType;
|
30293 | if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
|
30294 | ngModuleRef = contextInjector.get(NgModuleRef$1);
|
30295 | }
|
30296 | const componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
|
30297 | this.insert(componentRef.hostView, index);
|
30298 | return componentRef;
|
30299 | }
|
30300 | insert(viewRef, index) {
|
30301 | if (viewRef.destroyed) {
|
30302 | throw new Error('Cannot insert a destroyed View in a ViewContainer!');
|
30303 | }
|
30304 | const viewRef_ = viewRef;
|
30305 | const viewData = viewRef_._view;
|
30306 | attachEmbeddedView(this._view, this._data, index, viewData);
|
30307 | viewRef_.attachToViewContainerRef(this);
|
30308 | return viewRef;
|
30309 | }
|
30310 | move(viewRef, currentIndex) {
|
30311 | if (viewRef.destroyed) {
|
30312 | throw new Error('Cannot move a destroyed View in a ViewContainer!');
|
30313 | }
|
30314 | const previousIndex = this._embeddedViews.indexOf(viewRef._view);
|
30315 | moveEmbeddedView(this._data, previousIndex, currentIndex);
|
30316 | return viewRef;
|
30317 | }
|
30318 | indexOf(viewRef) {
|
30319 | return this._embeddedViews.indexOf(viewRef._view);
|
30320 | }
|
30321 | remove(index) {
|
30322 | const viewData = detachEmbeddedView(this._data, index);
|
30323 | if (viewData) {
|
30324 | Services.destroyView(viewData);
|
30325 | }
|
30326 | }
|
30327 | detach(index) {
|
30328 | const view = detachEmbeddedView(this._data, index);
|
30329 | return view ? new ViewRef_(view) : null;
|
30330 | }
|
30331 | }
|
30332 | function createChangeDetectorRef(view) {
|
30333 | return new ViewRef_(view);
|
30334 | }
|
30335 | class ViewRef_ {
|
30336 | constructor(_view) {
|
30337 | this._view = _view;
|
30338 | this._viewContainerRef = null;
|
30339 | this._appRef = null;
|
30340 | }
|
30341 | get rootNodes() {
|
30342 | return rootRenderNodes(this._view);
|
30343 | }
|
30344 | get context() {
|
30345 | return this._view.context;
|
30346 | }
|
30347 | set context(value) {
|
30348 | this._view.context = value;
|
30349 | }
|
30350 | get destroyed() {
|
30351 | return (this._view.state & 128 ) !== 0;
|
30352 | }
|
30353 | markForCheck() {
|
30354 | markParentViewsForCheck(this._view);
|
30355 | }
|
30356 | detach() {
|
30357 | this._view.state &= ~4 ;
|
30358 | }
|
30359 | detectChanges() {
|
30360 | const fs = this._view.root.rendererFactory;
|
30361 | if (fs.begin) {
|
30362 | fs.begin();
|
30363 | }
|
30364 | try {
|
30365 | Services.checkAndUpdateView(this._view);
|
30366 | }
|
30367 | finally {
|
30368 | if (fs.end) {
|
30369 | fs.end();
|
30370 | }
|
30371 | }
|
30372 | }
|
30373 | checkNoChanges() {
|
30374 | Services.checkNoChangesView(this._view);
|
30375 | }
|
30376 | reattach() {
|
30377 | this._view.state |= 4 ;
|
30378 | }
|
30379 | onDestroy(callback) {
|
30380 | if (!this._view.disposables) {
|
30381 | this._view.disposables = [];
|
30382 | }
|
30383 | this._view.disposables.push(callback);
|
30384 | }
|
30385 | destroy() {
|
30386 | if (this._appRef) {
|
30387 | this._appRef.detachView(this);
|
30388 | }
|
30389 | else if (this._viewContainerRef) {
|
30390 | this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
|
30391 | }
|
30392 | Services.destroyView(this._view);
|
30393 | }
|
30394 | detachFromAppRef() {
|
30395 | this._appRef = null;
|
30396 | renderDetachView(this._view);
|
30397 | Services.dirtyParentQueries(this._view);
|
30398 | }
|
30399 | attachToAppRef(appRef) {
|
30400 | if (this._viewContainerRef) {
|
30401 | throw new Error('This view is already attached to a ViewContainer!');
|
30402 | }
|
30403 | this._appRef = appRef;
|
30404 | }
|
30405 | attachToViewContainerRef(vcRef) {
|
30406 | if (this._appRef) {
|
30407 | throw new Error('This view is already attached directly to the ApplicationRef!');
|
30408 | }
|
30409 | this._viewContainerRef = vcRef;
|
30410 | }
|
30411 | }
|
30412 | function createTemplateData(view, def) {
|
30413 | return new TemplateRef_(view, def);
|
30414 | }
|
30415 | class TemplateRef_ extends TemplateRef {
|
30416 | constructor(_parentView, _def) {
|
30417 | super();
|
30418 | this._parentView = _parentView;
|
30419 | this._def = _def;
|
30420 | }
|
30421 | createEmbeddedView(context) {
|
30422 | return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, this._def.element.template, context));
|
30423 | }
|
30424 | get elementRef() {
|
30425 | return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement);
|
30426 | }
|
30427 | }
|
30428 | function createInjector(view, elDef) {
|
30429 | return new Injector_(view, elDef);
|
30430 | }
|
30431 | class Injector_ {
|
30432 | constructor(view, elDef) {
|
30433 | this.view = view;
|
30434 | this.elDef = elDef;
|
30435 | }
|
30436 | get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND) {
|
30437 | const allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 ) !== 0 : false;
|
30438 | return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 , token, tokenKey: tokenKey(token) }, notFoundValue);
|
30439 | }
|
30440 | }
|
30441 | function nodeValue(view, index) {
|
30442 | const def = view.def.nodes[index];
|
30443 | if (def.flags & 1 ) {
|
30444 | const elData = asElementData(view, def.nodeIndex);
|
30445 | return def.element.template ? elData.template : elData.renderElement;
|
30446 | }
|
30447 | else if (def.flags & 2 ) {
|
30448 | return asTextData(view, def.nodeIndex).renderText;
|
30449 | }
|
30450 | else if (def.flags & (20224 | 16 )) {
|
30451 | return asProviderData(view, def.nodeIndex).instance;
|
30452 | }
|
30453 | throw new Error(`Illegal state: read nodeValue for node index ${index}`);
|
30454 | }
|
30455 | function createNgModuleRef(moduleType, parent, bootstrapComponents, def) {
|
30456 | return new NgModuleRef_(moduleType, parent, bootstrapComponents, def);
|
30457 | }
|
30458 | class NgModuleRef_ {
|
30459 | constructor(_moduleType, _parent, _bootstrapComponents, _def) {
|
30460 | this._moduleType = _moduleType;
|
30461 | this._parent = _parent;
|
30462 | this._bootstrapComponents = _bootstrapComponents;
|
30463 | this._def = _def;
|
30464 | this._destroyListeners = [];
|
30465 | this._destroyed = false;
|
30466 | this.injector = this;
|
30467 | initNgModule(this);
|
30468 | }
|
30469 | get(token, notFoundValue = Injector.THROW_IF_NOT_FOUND, injectFlags = InjectFlags.Default) {
|
30470 | let flags = 0 ;
|
30471 | if (injectFlags & InjectFlags.SkipSelf) {
|
30472 | flags |= 1 ;
|
30473 | }
|
30474 | else if (injectFlags & InjectFlags.Self) {
|
30475 | flags |= 4 ;
|
30476 | }
|
30477 | return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: flags }, notFoundValue);
|
30478 | }
|
30479 | get instance() {
|
30480 | return this.get(this._moduleType);
|
30481 | }
|
30482 | get componentFactoryResolver() {
|
30483 | return this.get(ComponentFactoryResolver$1);
|
30484 | }
|
30485 | destroy() {
|
30486 | if (this._destroyed) {
|
30487 | throw new Error(`The ng module ${stringify(this.instance.constructor)} has already been destroyed.`);
|
30488 | }
|
30489 | this._destroyed = true;
|
30490 | callNgModuleLifecycle(this, 131072 );
|
30491 | this._destroyListeners.forEach((listener) => listener());
|
30492 | }
|
30493 | onDestroy(callback) {
|
30494 | this._destroyListeners.push(callback);
|
30495 | }
|
30496 | }
|
30497 |
|
30498 |
|
30499 |
|
30500 |
|
30501 |
|
30502 |
|
30503 |
|
30504 |
|
30505 | const Renderer2TokenKey = tokenKey(Renderer2);
|
30506 | const ElementRefTokenKey = tokenKey(ElementRef);
|
30507 | const ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
|
30508 | const TemplateRefTokenKey = tokenKey(TemplateRef);
|
30509 | const ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
|
30510 | const InjectorRefTokenKey = tokenKey(Injector);
|
30511 | const INJECTORRefTokenKey = tokenKey(INJECTOR);
|
30512 | function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps, props, outputs) {
|
30513 | const bindings = [];
|
30514 | if (props) {
|
30515 | for (let prop in props) {
|
30516 | const [bindingIndex, nonMinifiedName] = props[prop];
|
30517 | bindings[bindingIndex] = {
|
30518 | flags: 8 ,
|
30519 | name: prop,
|
30520 | nonMinifiedName,
|
30521 | ns: null,
|
30522 | securityContext: null,
|
30523 | suffix: null
|
30524 | };
|
30525 | }
|
30526 | }
|
30527 | const outputDefs = [];
|
30528 | if (outputs) {
|
30529 | for (let propName in outputs) {
|
30530 | outputDefs.push({ type: 1 , propName, target: null, eventName: outputs[propName] });
|
30531 | }
|
30532 | }
|
30533 | flags |= 16384 ;
|
30534 | return _def(checkIndex, flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
|
30535 | }
|
30536 | function pipeDef(flags, ctor, deps) {
|
30537 | flags |= 16 ;
|
30538 | return _def(-1, flags, null, 0, ctor, ctor, deps);
|
30539 | }
|
30540 | function providerDef(flags, matchedQueries, token, value, deps) {
|
30541 | return _def(-1, flags, matchedQueries, 0, token, value, deps);
|
30542 | }
|
30543 | function _def(checkIndex, flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
|
30544 | const { matchedQueries, references, matchedQueryIds } = splitMatchedQueriesDsl(matchedQueriesDsl);
|
30545 | if (!outputs) {
|
30546 | outputs = [];
|
30547 | }
|
30548 | if (!bindings) {
|
30549 | bindings = [];
|
30550 | }
|
30551 |
|
30552 |
|
30553 |
|
30554 | value = resolveForwardRef(value);
|
30555 | const depDefs = splitDepsDsl(deps, stringify(token));
|
30556 | return {
|
30557 |
|
30558 | nodeIndex: -1,
|
30559 | parent: null,
|
30560 | renderParent: null,
|
30561 | bindingIndex: -1,
|
30562 | outputIndex: -1,
|
30563 |
|
30564 | checkIndex,
|
30565 | flags,
|
30566 | childFlags: 0,
|
30567 | directChildFlags: 0,
|
30568 | childMatchedQueries: 0,
|
30569 | matchedQueries,
|
30570 | matchedQueryIds,
|
30571 | references,
|
30572 | ngContentIndex: -1,
|
30573 | childCount,
|
30574 | bindings,
|
30575 | bindingFlags: calcBindingFlags(bindings),
|
30576 | outputs,
|
30577 | element: null,
|
30578 | provider: { token, value, deps: depDefs },
|
30579 | text: null,
|
30580 | query: null,
|
30581 | ngContent: null
|
30582 | };
|
30583 | }
|
30584 | function createProviderInstance(view, def) {
|
30585 | return _createProviderInstance(view, def);
|
30586 | }
|
30587 | function createPipeInstance(view, def) {
|
30588 |
|
30589 | let compView = view;
|
30590 | while (compView.parent && !isComponentView(compView)) {
|
30591 | compView = compView.parent;
|
30592 | }
|
30593 |
|
30594 | const allowPrivateServices = true;
|
30595 |
|
30596 | return createClass(compView.parent, viewParentEl(compView), allowPrivateServices, def.provider.value, def.provider.deps);
|
30597 | }
|
30598 | function createDirectiveInstance(view, def) {
|
30599 |
|
30600 | const allowPrivateServices = (def.flags & 32768 ) > 0;
|
30601 |
|
30602 | const instance = createClass(view, def.parent, allowPrivateServices, def.provider.value, def.provider.deps);
|
30603 | if (def.outputs.length) {
|
30604 | for (let i = 0; i < def.outputs.length; i++) {
|
30605 | const output = def.outputs[i];
|
30606 | const outputObservable = instance[output.propName];
|
30607 | if (isObservable(outputObservable)) {
|
30608 | const subscription = outputObservable.subscribe(eventHandlerClosure(view, def.parent.nodeIndex, output.eventName));
|
30609 | view.disposables[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
|
30610 | }
|
30611 | else {
|
30612 | throw new Error(`@Output ${output.propName} not initialized in '${instance.constructor.name}'.`);
|
30613 | }
|
30614 | }
|
30615 | }
|
30616 | return instance;
|
30617 | }
|
30618 | function eventHandlerClosure(view, index, eventName) {
|
30619 | return (event) => dispatchEvent(view, index, eventName, event);
|
30620 | }
|
30621 | function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
30622 | const providerData = asProviderData(view, def.nodeIndex);
|
30623 | const directive = providerData.instance;
|
30624 | let changed = false;
|
30625 | let changes = undefined;
|
30626 | const bindLen = def.bindings.length;
|
30627 | if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
|
30628 | changed = true;
|
30629 | changes = updateProp(view, providerData, def, 0, v0, changes);
|
30630 | }
|
30631 | if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
|
30632 | changed = true;
|
30633 | changes = updateProp(view, providerData, def, 1, v1, changes);
|
30634 | }
|
30635 | if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
|
30636 | changed = true;
|
30637 | changes = updateProp(view, providerData, def, 2, v2, changes);
|
30638 | }
|
30639 | if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
|
30640 | changed = true;
|
30641 | changes = updateProp(view, providerData, def, 3, v3, changes);
|
30642 | }
|
30643 | if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
|
30644 | changed = true;
|
30645 | changes = updateProp(view, providerData, def, 4, v4, changes);
|
30646 | }
|
30647 | if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
|
30648 | changed = true;
|
30649 | changes = updateProp(view, providerData, def, 5, v5, changes);
|
30650 | }
|
30651 | if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
|
30652 | changed = true;
|
30653 | changes = updateProp(view, providerData, def, 6, v6, changes);
|
30654 | }
|
30655 | if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
|
30656 | changed = true;
|
30657 | changes = updateProp(view, providerData, def, 7, v7, changes);
|
30658 | }
|
30659 | if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
|
30660 | changed = true;
|
30661 | changes = updateProp(view, providerData, def, 8, v8, changes);
|
30662 | }
|
30663 | if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
|
30664 | changed = true;
|
30665 | changes = updateProp(view, providerData, def, 9, v9, changes);
|
30666 | }
|
30667 | if (changes) {
|
30668 | directive.ngOnChanges(changes);
|
30669 | }
|
30670 | if ((def.flags & 65536 ) &&
|
30671 | shouldCallLifecycleInitHook(view, 256 , def.nodeIndex)) {
|
30672 | directive.ngOnInit();
|
30673 | }
|
30674 | if (def.flags & 262144 ) {
|
30675 | directive.ngDoCheck();
|
30676 | }
|
30677 | return changed;
|
30678 | }
|
30679 | function checkAndUpdateDirectiveDynamic(view, def, values) {
|
30680 | const providerData = asProviderData(view, def.nodeIndex);
|
30681 | const directive = providerData.instance;
|
30682 | let changed = false;
|
30683 | let changes = undefined;
|
30684 | for (let i = 0; i < values.length; i++) {
|
30685 | if (checkBinding(view, def, i, values[i])) {
|
30686 | changed = true;
|
30687 | changes = updateProp(view, providerData, def, i, values[i], changes);
|
30688 | }
|
30689 | }
|
30690 | if (changes) {
|
30691 | directive.ngOnChanges(changes);
|
30692 | }
|
30693 | if ((def.flags & 65536 ) &&
|
30694 | shouldCallLifecycleInitHook(view, 256 , def.nodeIndex)) {
|
30695 | directive.ngOnInit();
|
30696 | }
|
30697 | if (def.flags & 262144 ) {
|
30698 | directive.ngDoCheck();
|
30699 | }
|
30700 | return changed;
|
30701 | }
|
30702 | function _createProviderInstance(view, def) {
|
30703 |
|
30704 | const allowPrivateServices = (def.flags & 8192 ) > 0;
|
30705 | const providerDef = def.provider;
|
30706 | switch (def.flags & 201347067 ) {
|
30707 | case 512 :
|
30708 | return createClass(view, def.parent, allowPrivateServices, providerDef.value, providerDef.deps);
|
30709 | case 1024 :
|
30710 | return callFactory(view, def.parent, allowPrivateServices, providerDef.value, providerDef.deps);
|
30711 | case 2048 :
|
30712 | return resolveDep(view, def.parent, allowPrivateServices, providerDef.deps[0]);
|
30713 | case 256 :
|
30714 | return providerDef.value;
|
30715 | }
|
30716 | }
|
30717 | function createClass(view, elDef, allowPrivateServices, ctor, deps) {
|
30718 | const len = deps.length;
|
30719 | switch (len) {
|
30720 | case 0:
|
30721 | return new ctor();
|
30722 | case 1:
|
30723 | return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
30724 | case 2:
|
30725 | return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
30726 | case 3:
|
30727 | return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
30728 | default:
|
30729 | const depValues = [];
|
30730 | for (let i = 0; i < len; i++) {
|
30731 | depValues.push(resolveDep(view, elDef, allowPrivateServices, deps[i]));
|
30732 | }
|
30733 | return new ctor(...depValues);
|
30734 | }
|
30735 | }
|
30736 | function callFactory(view, elDef, allowPrivateServices, factory, deps) {
|
30737 | const len = deps.length;
|
30738 | switch (len) {
|
30739 | case 0:
|
30740 | return factory();
|
30741 | case 1:
|
30742 | return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
30743 | case 2:
|
30744 | return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
30745 | case 3:
|
30746 | return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
30747 | default:
|
30748 | const depValues = [];
|
30749 | for (let i = 0; i < len; i++) {
|
30750 | depValues.push(resolveDep(view, elDef, allowPrivateServices, deps[i]));
|
30751 | }
|
30752 | return factory(...depValues);
|
30753 | }
|
30754 | }
|
30755 | function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue = Injector.THROW_IF_NOT_FOUND) {
|
30756 | if (depDef.flags & 8 ) {
|
30757 | return depDef.token;
|
30758 | }
|
30759 | const startView = view;
|
30760 | if (depDef.flags & 2 ) {
|
30761 | notFoundValue = null;
|
30762 | }
|
30763 | const tokenKey = depDef.tokenKey;
|
30764 | if (tokenKey === ChangeDetectorRefTokenKey) {
|
30765 |
|
30766 |
|
30767 | allowPrivateServices = !!(elDef && elDef.element.componentView);
|
30768 | }
|
30769 | if (elDef && (depDef.flags & 1 )) {
|
30770 | allowPrivateServices = false;
|
30771 | elDef = elDef.parent;
|
30772 | }
|
30773 | let searchView = view;
|
30774 | while (searchView) {
|
30775 | if (elDef) {
|
30776 | switch (tokenKey) {
|
30777 | case Renderer2TokenKey: {
|
30778 | const compView = findCompView(searchView, elDef, allowPrivateServices);
|
30779 | return compView.renderer;
|
30780 | }
|
30781 | case ElementRefTokenKey:
|
30782 | return new ElementRef(asElementData(searchView, elDef.nodeIndex).renderElement);
|
30783 | case ViewContainerRefTokenKey:
|
30784 | return asElementData(searchView, elDef.nodeIndex).viewContainer;
|
30785 | case TemplateRefTokenKey: {
|
30786 | if (elDef.element.template) {
|
30787 | return asElementData(searchView, elDef.nodeIndex).template;
|
30788 | }
|
30789 | break;
|
30790 | }
|
30791 | case ChangeDetectorRefTokenKey: {
|
30792 | let cdView = findCompView(searchView, elDef, allowPrivateServices);
|
30793 | return createChangeDetectorRef(cdView);
|
30794 | }
|
30795 | case InjectorRefTokenKey:
|
30796 | case INJECTORRefTokenKey:
|
30797 | return createInjector(searchView, elDef);
|
30798 | default:
|
30799 | const providerDef = (allowPrivateServices ? elDef.element.allProviders :
|
30800 | elDef.element.publicProviders)[tokenKey];
|
30801 | if (providerDef) {
|
30802 | let providerData = asProviderData(searchView, providerDef.nodeIndex);
|
30803 | if (!providerData) {
|
30804 | providerData = { instance: _createProviderInstance(searchView, providerDef) };
|
30805 | searchView.nodes[providerDef.nodeIndex] = providerData;
|
30806 | }
|
30807 | return providerData.instance;
|
30808 | }
|
30809 | }
|
30810 | }
|
30811 | allowPrivateServices = isComponentView(searchView);
|
30812 | elDef = viewParentEl(searchView);
|
30813 | searchView = searchView.parent;
|
30814 | if (depDef.flags & 4 ) {
|
30815 | searchView = null;
|
30816 | }
|
30817 | }
|
30818 | const value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
|
30819 | if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
30820 | notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
30821 |
|
30822 |
|
30823 |
|
30824 |
|
30825 |
|
30826 | return value;
|
30827 | }
|
30828 | return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
|
30829 | }
|
30830 | function findCompView(view, elDef, allowPrivateServices) {
|
30831 | let compView;
|
30832 | if (allowPrivateServices) {
|
30833 | compView = asElementData(view, elDef.nodeIndex).componentView;
|
30834 | }
|
30835 | else {
|
30836 | compView = view;
|
30837 | while (compView.parent && !isComponentView(compView)) {
|
30838 | compView = compView.parent;
|
30839 | }
|
30840 | }
|
30841 | return compView;
|
30842 | }
|
30843 | function updateProp(view, providerData, def, bindingIdx, value, changes) {
|
30844 | if (def.flags & 32768 ) {
|
30845 | const compView = asElementData(view, def.parent.nodeIndex).componentView;
|
30846 | if (compView.def.flags & 2 ) {
|
30847 | compView.state |= 8 ;
|
30848 | }
|
30849 | }
|
30850 | const binding = def.bindings[bindingIdx];
|
30851 | const propName = binding.name;
|
30852 |
|
30853 |
|
30854 |
|
30855 | providerData.instance[propName] = value;
|
30856 | if (def.flags & 524288 ) {
|
30857 | changes = changes || {};
|
30858 | const oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
30859 | const binding = def.bindings[bindingIdx];
|
30860 | changes[binding.nonMinifiedName] =
|
30861 | new SimpleChange(oldValue, value, (view.state & 2 ) !== 0);
|
30862 | }
|
30863 | view.oldValues[def.bindingIndex + bindingIdx] = value;
|
30864 | return changes;
|
30865 | }
|
30866 |
|
30867 |
|
30868 |
|
30869 |
|
30870 |
|
30871 |
|
30872 |
|
30873 |
|
30874 |
|
30875 |
|
30876 |
|
30877 |
|
30878 |
|
30879 |
|
30880 |
|
30881 |
|
30882 |
|
30883 |
|
30884 |
|
30885 |
|
30886 |
|
30887 |
|
30888 |
|
30889 |
|
30890 |
|
30891 |
|
30892 |
|
30893 |
|
30894 |
|
30895 |
|
30896 |
|
30897 |
|
30898 |
|
30899 |
|
30900 |
|
30901 |
|
30902 |
|
30903 |
|
30904 |
|
30905 |
|
30906 |
|
30907 |
|
30908 |
|
30909 | function callLifecycleHooksChildrenFirst(view, lifecycles) {
|
30910 | if (!(view.def.nodeFlags & lifecycles)) {
|
30911 | return;
|
30912 | }
|
30913 | const nodes = view.def.nodes;
|
30914 | let initIndex = 0;
|
30915 | for (let i = 0; i < nodes.length; i++) {
|
30916 | const nodeDef = nodes[i];
|
30917 | let parent = nodeDef.parent;
|
30918 | if (!parent && nodeDef.flags & lifecycles) {
|
30919 |
|
30920 | callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
|
30921 | }
|
30922 | if ((nodeDef.childFlags & lifecycles) === 0) {
|
30923 |
|
30924 | i += nodeDef.childCount;
|
30925 | }
|
30926 | while (parent && (parent.flags & 1 ) &&
|
30927 | i === parent.nodeIndex + parent.childCount) {
|
30928 |
|
30929 | if (parent.directChildFlags & lifecycles) {
|
30930 | initIndex = callElementProvidersLifecycles(view, parent, lifecycles, initIndex);
|
30931 | }
|
30932 | parent = parent.parent;
|
30933 | }
|
30934 | }
|
30935 | }
|
30936 | function callElementProvidersLifecycles(view, elDef, lifecycles, initIndex) {
|
30937 | for (let i = elDef.nodeIndex + 1; i <= elDef.nodeIndex + elDef.childCount; i++) {
|
30938 | const nodeDef = view.def.nodes[i];
|
30939 | if (nodeDef.flags & lifecycles) {
|
30940 | callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
|
30941 | }
|
30942 |
|
30943 | i += nodeDef.childCount;
|
30944 | }
|
30945 | return initIndex;
|
30946 | }
|
30947 | function callProviderLifecycles(view, index, lifecycles, initIndex) {
|
30948 | const providerData = asProviderData(view, index);
|
30949 | if (!providerData) {
|
30950 | return;
|
30951 | }
|
30952 | const provider = providerData.instance;
|
30953 | if (!provider) {
|
30954 | return;
|
30955 | }
|
30956 | Services.setCurrentNode(view, index);
|
30957 | if (lifecycles & 1048576 &&
|
30958 | shouldCallLifecycleInitHook(view, 512 , initIndex)) {
|
30959 | provider.ngAfterContentInit();
|
30960 | }
|
30961 | if (lifecycles & 2097152 ) {
|
30962 | provider.ngAfterContentChecked();
|
30963 | }
|
30964 | if (lifecycles & 4194304 &&
|
30965 | shouldCallLifecycleInitHook(view, 768 , initIndex)) {
|
30966 | provider.ngAfterViewInit();
|
30967 | }
|
30968 | if (lifecycles & 8388608 ) {
|
30969 | provider.ngAfterViewChecked();
|
30970 | }
|
30971 | if (lifecycles & 131072 ) {
|
30972 | provider.ngOnDestroy();
|
30973 | }
|
30974 | }
|
30975 |
|
30976 |
|
30977 |
|
30978 |
|
30979 |
|
30980 |
|
30981 |
|
30982 |
|
30983 | function queryDef(flags, id, bindings) {
|
30984 | let bindingDefs = [];
|
30985 | for (let propName in bindings) {
|
30986 | const bindingType = bindings[propName];
|
30987 | bindingDefs.push({ propName, bindingType });
|
30988 | }
|
30989 | return {
|
30990 |
|
30991 | nodeIndex: -1,
|
30992 | parent: null,
|
30993 | renderParent: null,
|
30994 | bindingIndex: -1,
|
30995 | outputIndex: -1,
|
30996 |
|
30997 |
|
30998 | checkIndex: -1,
|
30999 | flags,
|
31000 | childFlags: 0,
|
31001 | directChildFlags: 0,
|
31002 | childMatchedQueries: 0,
|
31003 | ngContentIndex: -1,
|
31004 | matchedQueries: {},
|
31005 | matchedQueryIds: 0,
|
31006 | references: {},
|
31007 | childCount: 0,
|
31008 | bindings: [],
|
31009 | bindingFlags: 0,
|
31010 | outputs: [],
|
31011 | element: null,
|
31012 | provider: null,
|
31013 | text: null,
|
31014 | query: { id, filterId: filterQueryId(id), bindings: bindingDefs },
|
31015 | ngContent: null
|
31016 | };
|
31017 | }
|
31018 | function createQuery(emitDistinctChangesOnly) {
|
31019 | return new QueryList(emitDistinctChangesOnly);
|
31020 | }
|
31021 | function dirtyParentQueries(view) {
|
31022 | const queryIds = view.def.nodeMatchedQueries;
|
31023 | while (view.parent && isEmbeddedView(view)) {
|
31024 | let tplDef = view.parentNodeDef;
|
31025 | view = view.parent;
|
31026 |
|
31027 | const end = tplDef.nodeIndex + tplDef.childCount;
|
31028 | for (let i = 0; i <= end; i++) {
|
31029 | const nodeDef = view.def.nodes[i];
|
31030 | if ((nodeDef.flags & 67108864 ) &&
|
31031 | (nodeDef.flags & 536870912 ) &&
|
31032 | (nodeDef.query.filterId & queryIds) === nodeDef.query.filterId) {
|
31033 | asQueryList(view, i).setDirty();
|
31034 | }
|
31035 | if ((nodeDef.flags & 1 && i + nodeDef.childCount < tplDef.nodeIndex) ||
|
31036 | !(nodeDef.childFlags & 67108864 ) ||
|
31037 | !(nodeDef.childFlags & 536870912 )) {
|
31038 |
|
31039 | i += nodeDef.childCount;
|
31040 | }
|
31041 | }
|
31042 | }
|
31043 |
|
31044 | if (view.def.nodeFlags & 134217728 ) {
|
31045 | for (let i = 0; i < view.def.nodes.length; i++) {
|
31046 | const nodeDef = view.def.nodes[i];
|
31047 | if ((nodeDef.flags & 134217728 ) && (nodeDef.flags & 536870912 )) {
|
31048 | asQueryList(view, i).setDirty();
|
31049 | }
|
31050 |
|
31051 | i += nodeDef.childCount;
|
31052 | }
|
31053 | }
|
31054 | }
|
31055 | function checkAndUpdateQuery(view, nodeDef) {
|
31056 | const queryList = asQueryList(view, nodeDef.nodeIndex);
|
31057 | if (!queryList.dirty) {
|
31058 | return;
|
31059 | }
|
31060 | let directiveInstance;
|
31061 | let newValues = undefined;
|
31062 | if (nodeDef.flags & 67108864 ) {
|
31063 | const elementDef = nodeDef.parent.parent;
|
31064 | newValues = calcQueryValues(view, elementDef.nodeIndex, elementDef.nodeIndex + elementDef.childCount, nodeDef.query, []);
|
31065 | directiveInstance = asProviderData(view, nodeDef.parent.nodeIndex).instance;
|
31066 | }
|
31067 | else if (nodeDef.flags & 134217728 ) {
|
31068 | newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, nodeDef.query, []);
|
31069 | directiveInstance = view.component;
|
31070 | }
|
31071 | queryList.reset(newValues, unwrapElementRef);
|
31072 | const bindings = nodeDef.query.bindings;
|
31073 | let notify = false;
|
31074 | for (let i = 0; i < bindings.length; i++) {
|
31075 | const binding = bindings[i];
|
31076 | let boundValue;
|
31077 | switch (binding.bindingType) {
|
31078 | case 0 :
|
31079 | boundValue = queryList.first;
|
31080 | break;
|
31081 | case 1 :
|
31082 | boundValue = queryList;
|
31083 | notify = true;
|
31084 | break;
|
31085 | }
|
31086 | directiveInstance[binding.propName] = boundValue;
|
31087 | }
|
31088 | if (notify) {
|
31089 | queryList.notifyOnChanges();
|
31090 | }
|
31091 | }
|
31092 | function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
|
31093 | for (let i = startIndex; i <= endIndex; i++) {
|
31094 | const nodeDef = view.def.nodes[i];
|
31095 | const valueType = nodeDef.matchedQueries[queryDef.id];
|
31096 | if (valueType != null) {
|
31097 | values.push(getQueryValue(view, nodeDef, valueType));
|
31098 | }
|
31099 | if (nodeDef.flags & 1 && nodeDef.element.template &&
|
31100 | (nodeDef.element.template.nodeMatchedQueries & queryDef.filterId) ===
|
31101 | queryDef.filterId) {
|
31102 | const elementData = asElementData(view, i);
|
31103 |
|
31104 |
|
31105 | if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) {
|
31106 | calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values);
|
31107 | i += nodeDef.childCount;
|
31108 | }
|
31109 | if (nodeDef.flags & 16777216 ) {
|
31110 | const embeddedViews = elementData.viewContainer._embeddedViews;
|
31111 | for (let k = 0; k < embeddedViews.length; k++) {
|
31112 | const embeddedView = embeddedViews[k];
|
31113 | const dvc = declaredViewContainer(embeddedView);
|
31114 | if (dvc && dvc === elementData) {
|
31115 | calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
|
31116 | }
|
31117 | }
|
31118 | }
|
31119 | const projectedViews = elementData.template._projectedViews;
|
31120 | if (projectedViews) {
|
31121 | for (let k = 0; k < projectedViews.length; k++) {
|
31122 | const projectedView = projectedViews[k];
|
31123 | calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
|
31124 | }
|
31125 | }
|
31126 | }
|
31127 | if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
|
31128 |
|
31129 | i += nodeDef.childCount;
|
31130 | }
|
31131 | }
|
31132 | return values;
|
31133 | }
|
31134 | function getQueryValue(view, nodeDef, queryValueType) {
|
31135 | if (queryValueType != null) {
|
31136 |
|
31137 | switch (queryValueType) {
|
31138 | case 1 :
|
31139 | return asElementData(view, nodeDef.nodeIndex).renderElement;
|
31140 | case 0 :
|
31141 | return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement);
|
31142 | case 2 :
|
31143 | return asElementData(view, nodeDef.nodeIndex).template;
|
31144 | case 3 :
|
31145 | return asElementData(view, nodeDef.nodeIndex).viewContainer;
|
31146 | case 4 :
|
31147 | return asProviderData(view, nodeDef.nodeIndex).instance;
|
31148 | }
|
31149 | }
|
31150 | }
|
31151 |
|
31152 |
|
31153 |
|
31154 |
|
31155 |
|
31156 |
|
31157 |
|
31158 |
|
31159 | function ngContentDef(ngContentIndex, index) {
|
31160 | return {
|
31161 |
|
31162 | nodeIndex: -1,
|
31163 | parent: null,
|
31164 | renderParent: null,
|
31165 | bindingIndex: -1,
|
31166 | outputIndex: -1,
|
31167 |
|
31168 | checkIndex: -1,
|
31169 | flags: 8 ,
|
31170 | childFlags: 0,
|
31171 | directChildFlags: 0,
|
31172 | childMatchedQueries: 0,
|
31173 | matchedQueries: {},
|
31174 | matchedQueryIds: 0,
|
31175 | references: {},
|
31176 | ngContentIndex,
|
31177 | childCount: 0,
|
31178 | bindings: [],
|
31179 | bindingFlags: 0,
|
31180 | outputs: [],
|
31181 | element: null,
|
31182 | provider: null,
|
31183 | text: null,
|
31184 | query: null,
|
31185 | ngContent: { index }
|
31186 | };
|
31187 | }
|
31188 | function appendNgContent(view, renderHost, def) {
|
31189 | const parentEl = getParentRenderElement(view, renderHost, def);
|
31190 | if (!parentEl) {
|
31191 |
|
31192 | return;
|
31193 | }
|
31194 | const ngContentIndex = def.ngContent.index;
|
31195 | visitProjectedRenderNodes(view, ngContentIndex, 1 , parentEl, null, undefined);
|
31196 | }
|
31197 |
|
31198 |
|
31199 |
|
31200 |
|
31201 |
|
31202 |
|
31203 |
|
31204 |
|
31205 | function purePipeDef(checkIndex, argCount) {
|
31206 |
|
31207 | return _pureExpressionDef(128 , checkIndex, newArray(argCount + 1));
|
31208 | }
|
31209 | function pureArrayDef(checkIndex, argCount) {
|
31210 | return _pureExpressionDef(32 , checkIndex, newArray(argCount));
|
31211 | }
|
31212 | function pureObjectDef(checkIndex, propToIndex) {
|
31213 | const keys = Object.keys(propToIndex);
|
31214 | const nbKeys = keys.length;
|
31215 | const propertyNames = [];
|
31216 | for (let i = 0; i < nbKeys; i++) {
|
31217 | const key = keys[i];
|
31218 | const index = propToIndex[key];
|
31219 | propertyNames.push(key);
|
31220 | }
|
31221 | return _pureExpressionDef(64 , checkIndex, propertyNames);
|
31222 | }
|
31223 | function _pureExpressionDef(flags, checkIndex, propertyNames) {
|
31224 | const bindings = [];
|
31225 | for (let i = 0; i < propertyNames.length; i++) {
|
31226 | const prop = propertyNames[i];
|
31227 | bindings.push({
|
31228 | flags: 8 ,
|
31229 | name: prop,
|
31230 | ns: null,
|
31231 | nonMinifiedName: prop,
|
31232 | securityContext: null,
|
31233 | suffix: null
|
31234 | });
|
31235 | }
|
31236 | return {
|
31237 |
|
31238 | nodeIndex: -1,
|
31239 | parent: null,
|
31240 | renderParent: null,
|
31241 | bindingIndex: -1,
|
31242 | outputIndex: -1,
|
31243 |
|
31244 | checkIndex,
|
31245 | flags,
|
31246 | childFlags: 0,
|
31247 | directChildFlags: 0,
|
31248 | childMatchedQueries: 0,
|
31249 | matchedQueries: {},
|
31250 | matchedQueryIds: 0,
|
31251 | references: {},
|
31252 | ngContentIndex: -1,
|
31253 | childCount: 0,
|
31254 | bindings,
|
31255 | bindingFlags: calcBindingFlags(bindings),
|
31256 | outputs: [],
|
31257 | element: null,
|
31258 | provider: null,
|
31259 | text: null,
|
31260 | query: null,
|
31261 | ngContent: null
|
31262 | };
|
31263 | }
|
31264 | function createPureExpression(view, def) {
|
31265 | return { value: undefined };
|
31266 | }
|
31267 | function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
31268 | const bindings = def.bindings;
|
31269 | let changed = false;
|
31270 | const bindLen = bindings.length;
|
31271 | if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
31272 | changed = true;
|
31273 | if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
31274 | changed = true;
|
31275 | if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
31276 | changed = true;
|
31277 | if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
31278 | changed = true;
|
31279 | if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
31280 | changed = true;
|
31281 | if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
31282 | changed = true;
|
31283 | if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
31284 | changed = true;
|
31285 | if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
31286 | changed = true;
|
31287 | if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
31288 | changed = true;
|
31289 | if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
31290 | changed = true;
|
31291 | if (changed) {
|
31292 | const data = asPureExpressionData(view, def.nodeIndex);
|
31293 | let value;
|
31294 | switch (def.flags & 201347067 ) {
|
31295 | case 32 :
|
31296 | value = [];
|
31297 | if (bindLen > 0)
|
31298 | value.push(v0);
|
31299 | if (bindLen > 1)
|
31300 | value.push(v1);
|
31301 | if (bindLen > 2)
|
31302 | value.push(v2);
|
31303 | if (bindLen > 3)
|
31304 | value.push(v3);
|
31305 | if (bindLen > 4)
|
31306 | value.push(v4);
|
31307 | if (bindLen > 5)
|
31308 | value.push(v5);
|
31309 | if (bindLen > 6)
|
31310 | value.push(v6);
|
31311 | if (bindLen > 7)
|
31312 | value.push(v7);
|
31313 | if (bindLen > 8)
|
31314 | value.push(v8);
|
31315 | if (bindLen > 9)
|
31316 | value.push(v9);
|
31317 | break;
|
31318 | case 64 :
|
31319 | value = {};
|
31320 | if (bindLen > 0)
|
31321 | value[bindings[0].name] = v0;
|
31322 | if (bindLen > 1)
|
31323 | value[bindings[1].name] = v1;
|
31324 | if (bindLen > 2)
|
31325 | value[bindings[2].name] = v2;
|
31326 | if (bindLen > 3)
|
31327 | value[bindings[3].name] = v3;
|
31328 | if (bindLen > 4)
|
31329 | value[bindings[4].name] = v4;
|
31330 | if (bindLen > 5)
|
31331 | value[bindings[5].name] = v5;
|
31332 | if (bindLen > 6)
|
31333 | value[bindings[6].name] = v6;
|
31334 | if (bindLen > 7)
|
31335 | value[bindings[7].name] = v7;
|
31336 | if (bindLen > 8)
|
31337 | value[bindings[8].name] = v8;
|
31338 | if (bindLen > 9)
|
31339 | value[bindings[9].name] = v9;
|
31340 | break;
|
31341 | case 128 :
|
31342 | const pipe = v0;
|
31343 | switch (bindLen) {
|
31344 | case 1:
|
31345 | value = pipe.transform(v0);
|
31346 | break;
|
31347 | case 2:
|
31348 | value = pipe.transform(v1);
|
31349 | break;
|
31350 | case 3:
|
31351 | value = pipe.transform(v1, v2);
|
31352 | break;
|
31353 | case 4:
|
31354 | value = pipe.transform(v1, v2, v3);
|
31355 | break;
|
31356 | case 5:
|
31357 | value = pipe.transform(v1, v2, v3, v4);
|
31358 | break;
|
31359 | case 6:
|
31360 | value = pipe.transform(v1, v2, v3, v4, v5);
|
31361 | break;
|
31362 | case 7:
|
31363 | value = pipe.transform(v1, v2, v3, v4, v5, v6);
|
31364 | break;
|
31365 | case 8:
|
31366 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
|
31367 | break;
|
31368 | case 9:
|
31369 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
|
31370 | break;
|
31371 | case 10:
|
31372 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
31373 | break;
|
31374 | }
|
31375 | break;
|
31376 | }
|
31377 | data.value = value;
|
31378 | }
|
31379 | return changed;
|
31380 | }
|
31381 | function checkAndUpdatePureExpressionDynamic(view, def, values) {
|
31382 | const bindings = def.bindings;
|
31383 | let changed = false;
|
31384 | for (let i = 0; i < values.length; i++) {
|
31385 |
|
31386 |
|
31387 | if (checkAndUpdateBinding(view, def, i, values[i])) {
|
31388 | changed = true;
|
31389 | }
|
31390 | }
|
31391 | if (changed) {
|
31392 | const data = asPureExpressionData(view, def.nodeIndex);
|
31393 | let value;
|
31394 | switch (def.flags & 201347067 ) {
|
31395 | case 32 :
|
31396 | value = values;
|
31397 | break;
|
31398 | case 64 :
|
31399 | value = {};
|
31400 | for (let i = 0; i < values.length; i++) {
|
31401 | value[bindings[i].name] = values[i];
|
31402 | }
|
31403 | break;
|
31404 | case 128 :
|
31405 | const pipe = values[0];
|
31406 | const params = values.slice(1);
|
31407 | value = pipe.transform(...params);
|
31408 | break;
|
31409 | }
|
31410 | data.value = value;
|
31411 | }
|
31412 | return changed;
|
31413 | }
|
31414 |
|
31415 |
|
31416 |
|
31417 |
|
31418 |
|
31419 |
|
31420 |
|
31421 |
|
31422 | function textDef(checkIndex, ngContentIndex, staticText) {
|
31423 | const bindings = [];
|
31424 | for (let i = 1; i < staticText.length; i++) {
|
31425 | bindings[i - 1] = {
|
31426 | flags: 8 ,
|
31427 | name: null,
|
31428 | ns: null,
|
31429 | nonMinifiedName: null,
|
31430 | securityContext: null,
|
31431 | suffix: staticText[i],
|
31432 | };
|
31433 | }
|
31434 | return {
|
31435 |
|
31436 | nodeIndex: -1,
|
31437 | parent: null,
|
31438 | renderParent: null,
|
31439 | bindingIndex: -1,
|
31440 | outputIndex: -1,
|
31441 |
|
31442 | checkIndex,
|
31443 | flags: 2 ,
|
31444 | childFlags: 0,
|
31445 | directChildFlags: 0,
|
31446 | childMatchedQueries: 0,
|
31447 | matchedQueries: {},
|
31448 | matchedQueryIds: 0,
|
31449 | references: {},
|
31450 | ngContentIndex,
|
31451 | childCount: 0,
|
31452 | bindings,
|
31453 | bindingFlags: 8 ,
|
31454 | outputs: [],
|
31455 | element: null,
|
31456 | provider: null,
|
31457 | text: { prefix: staticText[0] },
|
31458 | query: null,
|
31459 | ngContent: null,
|
31460 | };
|
31461 | }
|
31462 | function createText(view, renderHost, def) {
|
31463 | let renderNode;
|
31464 | const renderer = view.renderer;
|
31465 | renderNode = renderer.createText(def.text.prefix);
|
31466 | const parentEl = getParentRenderElement(view, renderHost, def);
|
31467 | if (parentEl) {
|
31468 | renderer.appendChild(parentEl, renderNode);
|
31469 | }
|
31470 | return { renderText: renderNode };
|
31471 | }
|
31472 | function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
31473 | let changed = false;
|
31474 | const bindings = def.bindings;
|
31475 | const bindLen = bindings.length;
|
31476 | if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
31477 | changed = true;
|
31478 | if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
31479 | changed = true;
|
31480 | if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
31481 | changed = true;
|
31482 | if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
31483 | changed = true;
|
31484 | if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
31485 | changed = true;
|
31486 | if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
31487 | changed = true;
|
31488 | if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
31489 | changed = true;
|
31490 | if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
31491 | changed = true;
|
31492 | if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
31493 | changed = true;
|
31494 | if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
31495 | changed = true;
|
31496 | if (changed) {
|
31497 | let value = def.text.prefix;
|
31498 | if (bindLen > 0)
|
31499 | value += _addInterpolationPart(v0, bindings[0]);
|
31500 | if (bindLen > 1)
|
31501 | value += _addInterpolationPart(v1, bindings[1]);
|
31502 | if (bindLen > 2)
|
31503 | value += _addInterpolationPart(v2, bindings[2]);
|
31504 | if (bindLen > 3)
|
31505 | value += _addInterpolationPart(v3, bindings[3]);
|
31506 | if (bindLen > 4)
|
31507 | value += _addInterpolationPart(v4, bindings[4]);
|
31508 | if (bindLen > 5)
|
31509 | value += _addInterpolationPart(v5, bindings[5]);
|
31510 | if (bindLen > 6)
|
31511 | value += _addInterpolationPart(v6, bindings[6]);
|
31512 | if (bindLen > 7)
|
31513 | value += _addInterpolationPart(v7, bindings[7]);
|
31514 | if (bindLen > 8)
|
31515 | value += _addInterpolationPart(v8, bindings[8]);
|
31516 | if (bindLen > 9)
|
31517 | value += _addInterpolationPart(v9, bindings[9]);
|
31518 | const renderNode = asTextData(view, def.nodeIndex).renderText;
|
31519 | view.renderer.setValue(renderNode, value);
|
31520 | }
|
31521 | return changed;
|
31522 | }
|
31523 | function checkAndUpdateTextDynamic(view, def, values) {
|
31524 | const bindings = def.bindings;
|
31525 | let changed = false;
|
31526 | for (let i = 0; i < values.length; i++) {
|
31527 |
|
31528 |
|
31529 | if (checkAndUpdateBinding(view, def, i, values[i])) {
|
31530 | changed = true;
|
31531 | }
|
31532 | }
|
31533 | if (changed) {
|
31534 | let value = '';
|
31535 | for (let i = 0; i < values.length; i++) {
|
31536 | value = value + _addInterpolationPart(values[i], bindings[i]);
|
31537 | }
|
31538 | value = def.text.prefix + value;
|
31539 | const renderNode = asTextData(view, def.nodeIndex).renderText;
|
31540 | view.renderer.setValue(renderNode, value);
|
31541 | }
|
31542 | return changed;
|
31543 | }
|
31544 | function _addInterpolationPart(value, binding) {
|
31545 | const valueStr = value != null ? value.toString() : '';
|
31546 | return valueStr + binding.suffix;
|
31547 | }
|
31548 |
|
31549 |
|
31550 |
|
31551 |
|
31552 |
|
31553 |
|
31554 |
|
31555 |
|
31556 | function viewDef(flags, nodes, updateDirectives, updateRenderer) {
|
31557 |
|
31558 | let viewBindingCount = 0;
|
31559 | let viewDisposableCount = 0;
|
31560 | let viewNodeFlags = 0;
|
31561 | let viewRootNodeFlags = 0;
|
31562 | let viewMatchedQueries = 0;
|
31563 | let currentParent = null;
|
31564 | let currentRenderParent = null;
|
31565 | let currentElementHasPublicProviders = false;
|
31566 | let currentElementHasPrivateProviders = false;
|
31567 | let lastRenderRootNode = null;
|
31568 | for (let i = 0; i < nodes.length; i++) {
|
31569 | const node = nodes[i];
|
31570 | node.nodeIndex = i;
|
31571 | node.parent = currentParent;
|
31572 | node.bindingIndex = viewBindingCount;
|
31573 | node.outputIndex = viewDisposableCount;
|
31574 | node.renderParent = currentRenderParent;
|
31575 | viewNodeFlags |= node.flags;
|
31576 | viewMatchedQueries |= node.matchedQueryIds;
|
31577 | if (node.element) {
|
31578 | const elDef = node.element;
|
31579 | elDef.publicProviders =
|
31580 | currentParent ? currentParent.element.publicProviders : Object.create(null);
|
31581 | elDef.allProviders = elDef.publicProviders;
|
31582 |
|
31583 | currentElementHasPublicProviders = false;
|
31584 | currentElementHasPrivateProviders = false;
|
31585 | if (node.element.template) {
|
31586 | viewMatchedQueries |= node.element.template.nodeMatchedQueries;
|
31587 | }
|
31588 | }
|
31589 | validateNode(currentParent, node, nodes.length);
|
31590 | viewBindingCount += node.bindings.length;
|
31591 | viewDisposableCount += node.outputs.length;
|
31592 | if (!currentRenderParent && (node.flags & 3 )) {
|
31593 | lastRenderRootNode = node;
|
31594 | }
|
31595 | if (node.flags & 20224 ) {
|
31596 | if (!currentElementHasPublicProviders) {
|
31597 | currentElementHasPublicProviders = true;
|
31598 |
|
31599 | currentParent.element.publicProviders =
|
31600 | Object.create(currentParent.element.publicProviders);
|
31601 | currentParent.element.allProviders = currentParent.element.publicProviders;
|
31602 | }
|
31603 | const isPrivateService = (node.flags & 8192 ) !== 0;
|
31604 | const isComponent = (node.flags & 32768 ) !== 0;
|
31605 | if (!isPrivateService || isComponent) {
|
31606 | currentParent.element.publicProviders[tokenKey(node.provider.token)] = node;
|
31607 | }
|
31608 | else {
|
31609 | if (!currentElementHasPrivateProviders) {
|
31610 | currentElementHasPrivateProviders = true;
|
31611 |
|
31612 | currentParent.element.allProviders =
|
31613 | Object.create(currentParent.element.publicProviders);
|
31614 | }
|
31615 | currentParent.element.allProviders[tokenKey(node.provider.token)] = node;
|
31616 | }
|
31617 | if (isComponent) {
|
31618 | currentParent.element.componentProvider = node;
|
31619 | }
|
31620 | }
|
31621 | if (currentParent) {
|
31622 | currentParent.childFlags |= node.flags;
|
31623 | currentParent.directChildFlags |= node.flags;
|
31624 | currentParent.childMatchedQueries |= node.matchedQueryIds;
|
31625 | if (node.element && node.element.template) {
|
31626 | currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
|
31627 | }
|
31628 | }
|
31629 | else {
|
31630 | viewRootNodeFlags |= node.flags;
|
31631 | }
|
31632 | if (node.childCount > 0) {
|
31633 | currentParent = node;
|
31634 | if (!isNgContainer(node)) {
|
31635 | currentRenderParent = node;
|
31636 | }
|
31637 | }
|
31638 | else {
|
31639 |
|
31640 |
|
31641 |
|
31642 |
|
31643 |
|
31644 | while (currentParent && i === currentParent.nodeIndex + currentParent.childCount) {
|
31645 | const newParent = currentParent.parent;
|
31646 | if (newParent) {
|
31647 | newParent.childFlags |= currentParent.childFlags;
|
31648 | newParent.childMatchedQueries |= currentParent.childMatchedQueries;
|
31649 | }
|
31650 | currentParent = newParent;
|
31651 |
|
31652 | if (currentParent && isNgContainer(currentParent)) {
|
31653 | currentRenderParent = currentParent.renderParent;
|
31654 | }
|
31655 | else {
|
31656 | currentRenderParent = currentParent;
|
31657 | }
|
31658 | }
|
31659 | }
|
31660 | }
|
31661 | const handleEvent = (view, nodeIndex, eventName, event) => nodes[nodeIndex].element.handleEvent(view, eventName, event);
|
31662 | return {
|
31663 |
|
31664 | factory: null,
|
31665 | nodeFlags: viewNodeFlags,
|
31666 | rootNodeFlags: viewRootNodeFlags,
|
31667 | nodeMatchedQueries: viewMatchedQueries,
|
31668 | flags,
|
31669 | nodes: nodes,
|
31670 | updateDirectives: updateDirectives || NOOP,
|
31671 | updateRenderer: updateRenderer || NOOP,
|
31672 | handleEvent,
|
31673 | bindingCount: viewBindingCount,
|
31674 | outputCount: viewDisposableCount,
|
31675 | lastRenderRootNode
|
31676 | };
|
31677 | }
|
31678 | function isNgContainer(node) {
|
31679 | return (node.flags & 1 ) !== 0 && node.element.name === null;
|
31680 | }
|
31681 | function validateNode(parent, node, nodeCount) {
|
31682 | const template = node.element && node.element.template;
|
31683 | if (template) {
|
31684 | if (!template.lastRenderRootNode) {
|
31685 | throw new Error(`Illegal State: Embedded templates without nodes are not allowed!`);
|
31686 | }
|
31687 | if (template.lastRenderRootNode &&
|
31688 | template.lastRenderRootNode.flags & 16777216 ) {
|
31689 | throw new Error(`Illegal State: Last root node of a template can't have embedded views, at index ${node.nodeIndex}!`);
|
31690 | }
|
31691 | }
|
31692 | if (node.flags & 20224 ) {
|
31693 | const parentFlags = parent ? parent.flags : 0;
|
31694 | if ((parentFlags & 1 ) === 0) {
|
31695 | throw new Error(`Illegal State: StaticProvider/Directive nodes need to be children of elements or anchors, at index ${node.nodeIndex}!`);
|
31696 | }
|
31697 | }
|
31698 | if (node.query) {
|
31699 | if (node.flags & 67108864 &&
|
31700 | (!parent || (parent.flags & 16384 ) === 0)) {
|
31701 | throw new Error(`Illegal State: Content Query nodes need to be children of directives, at index ${node.nodeIndex}!`);
|
31702 | }
|
31703 | if (node.flags & 134217728 && parent) {
|
31704 | throw new Error(`Illegal State: View Query nodes have to be top level nodes, at index ${node.nodeIndex}!`);
|
31705 | }
|
31706 | }
|
31707 | if (node.childCount) {
|
31708 | const parentEnd = parent ? parent.nodeIndex + parent.childCount : nodeCount - 1;
|
31709 | if (node.nodeIndex <= parentEnd && node.nodeIndex + node.childCount > parentEnd) {
|
31710 | throw new Error(`Illegal State: childCount of node leads outside of parent, at index ${node.nodeIndex}!`);
|
31711 | }
|
31712 | }
|
31713 | }
|
31714 | function createEmbeddedView(parent, anchorDef, viewDef, context) {
|
31715 |
|
31716 |
|
31717 | const view = createView(parent.root, parent.renderer, parent, anchorDef, viewDef);
|
31718 | initView(view, parent.component, context);
|
31719 | createViewNodes(view);
|
31720 | return view;
|
31721 | }
|
31722 | function createRootView(root, def, context) {
|
31723 | const view = createView(root, root.renderer, null, null, def);
|
31724 | initView(view, context, context);
|
31725 | createViewNodes(view);
|
31726 | return view;
|
31727 | }
|
31728 | function createComponentView(parentView, nodeDef, viewDef, hostElement) {
|
31729 | const rendererType = nodeDef.element.componentRendererType;
|
31730 | let compRenderer;
|
31731 | if (!rendererType) {
|
31732 | compRenderer = parentView.root.renderer;
|
31733 | }
|
31734 | else {
|
31735 | compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType);
|
31736 | }
|
31737 | return createView(parentView.root, compRenderer, parentView, nodeDef.element.componentProvider, viewDef);
|
31738 | }
|
31739 | function createView(root, renderer, parent, parentNodeDef, def) {
|
31740 | const nodes = new Array(def.nodes.length);
|
31741 | const disposables = def.outputCount ? new Array(def.outputCount) : null;
|
31742 | const view = {
|
31743 | def,
|
31744 | parent,
|
31745 | viewContainerParent: null,
|
31746 | parentNodeDef,
|
31747 | context: null,
|
31748 | component: null,
|
31749 | nodes,
|
31750 | state: 13 ,
|
31751 | root,
|
31752 | renderer,
|
31753 | oldValues: new Array(def.bindingCount),
|
31754 | disposables,
|
31755 | initIndex: -1
|
31756 | };
|
31757 | return view;
|
31758 | }
|
31759 | function initView(view, component, context) {
|
31760 | view.component = component;
|
31761 | view.context = context;
|
31762 | }
|
31763 | function createViewNodes(view) {
|
31764 | let renderHost;
|
31765 | if (isComponentView(view)) {
|
31766 | const hostDef = view.parentNodeDef;
|
31767 | renderHost = asElementData(view.parent, hostDef.parent.nodeIndex).renderElement;
|
31768 | }
|
31769 | const def = view.def;
|
31770 | const nodes = view.nodes;
|
31771 | for (let i = 0; i < def.nodes.length; i++) {
|
31772 | const nodeDef = def.nodes[i];
|
31773 | Services.setCurrentNode(view, i);
|
31774 | let nodeData;
|
31775 | switch (nodeDef.flags & 201347067 ) {
|
31776 | case 1 :
|
31777 | const el = createElement(view, renderHost, nodeDef);
|
31778 | let componentView = undefined;
|
31779 | if (nodeDef.flags & 33554432 ) {
|
31780 | const compViewDef = resolveDefinition(nodeDef.element.componentView);
|
31781 | componentView = Services.createComponentView(view, nodeDef, compViewDef, el);
|
31782 | }
|
31783 | listenToElementOutputs(view, componentView, nodeDef, el);
|
31784 | nodeData = {
|
31785 | renderElement: el,
|
31786 | componentView,
|
31787 | viewContainer: null,
|
31788 | template: nodeDef.element.template ? createTemplateData(view, nodeDef) : undefined
|
31789 | };
|
31790 | if (nodeDef.flags & 16777216 ) {
|
31791 | nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
|
31792 | }
|
31793 | break;
|
31794 | case 2 :
|
31795 | nodeData = createText(view, renderHost, nodeDef);
|
31796 | break;
|
31797 | case 512 :
|
31798 | case 1024 :
|
31799 | case 2048 :
|
31800 | case 256 : {
|
31801 | nodeData = nodes[i];
|
31802 | if (!nodeData && !(nodeDef.flags & 4096 )) {
|
31803 | const instance = createProviderInstance(view, nodeDef);
|
31804 | nodeData = { instance };
|
31805 | }
|
31806 | break;
|
31807 | }
|
31808 | case 16 : {
|
31809 | const instance = createPipeInstance(view, nodeDef);
|
31810 | nodeData = { instance };
|
31811 | break;
|
31812 | }
|
31813 | case 16384 : {
|
31814 | nodeData = nodes[i];
|
31815 | if (!nodeData) {
|
31816 | const instance = createDirectiveInstance(view, nodeDef);
|
31817 | nodeData = { instance };
|
31818 | }
|
31819 | if (nodeDef.flags & 32768 ) {
|
31820 | const compView = asElementData(view, nodeDef.parent.nodeIndex).componentView;
|
31821 | initView(compView, nodeData.instance, nodeData.instance);
|
31822 | }
|
31823 | break;
|
31824 | }
|
31825 | case 32 :
|
31826 | case 64 :
|
31827 | case 128 :
|
31828 | nodeData = createPureExpression(view, nodeDef);
|
31829 | break;
|
31830 | case 67108864 :
|
31831 | case 134217728 :
|
31832 | nodeData = createQuery((nodeDef.flags & -2147483648 ) ===
|
31833 | -2147483648 );
|
31834 | break;
|
31835 | case 8 :
|
31836 | appendNgContent(view, renderHost, nodeDef);
|
31837 |
|
31838 | nodeData = undefined;
|
31839 | break;
|
31840 | }
|
31841 | nodes[i] = nodeData;
|
31842 | }
|
31843 |
|
31844 |
|
31845 | execComponentViewsAction(view, ViewAction.CreateViewNodes);
|
31846 |
|
31847 | execQueriesAction(view, 67108864 | 134217728 , 268435456 , 0 );
|
31848 | }
|
31849 | function checkNoChangesView(view) {
|
31850 | markProjectedViewsForCheck(view);
|
31851 | Services.updateDirectives(view, 1 );
|
31852 | execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
|
31853 | Services.updateRenderer(view, 1 );
|
31854 | execComponentViewsAction(view, ViewAction.CheckNoChanges);
|
31855 |
|
31856 |
|
31857 | view.state &= ~(64 | 32 );
|
31858 | }
|
31859 | function checkAndUpdateView(view) {
|
31860 | if (view.state & 1 ) {
|
31861 | view.state &= ~1 ;
|
31862 | view.state |= 2 ;
|
31863 | }
|
31864 | else {
|
31865 | view.state &= ~2 ;
|
31866 | }
|
31867 | shiftInitState(view, 0 , 256 );
|
31868 | markProjectedViewsForCheck(view);
|
31869 | Services.updateDirectives(view, 0 );
|
31870 | execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
|
31871 | execQueriesAction(view, 67108864 , 536870912 , 0 );
|
31872 | let callInit = shiftInitState(view, 256 , 512 );
|
31873 | callLifecycleHooksChildrenFirst(view, 2097152 | (callInit ? 1048576 : 0));
|
31874 | Services.updateRenderer(view, 0 );
|
31875 | execComponentViewsAction(view, ViewAction.CheckAndUpdate);
|
31876 | execQueriesAction(view, 134217728 , 536870912 , 0 );
|
31877 | callInit = shiftInitState(view, 512 , 768 );
|
31878 | callLifecycleHooksChildrenFirst(view, 8388608 | (callInit ? 4194304 : 0));
|
31879 | if (view.def.flags & 2 ) {
|
31880 | view.state &= ~8 ;
|
31881 | }
|
31882 | view.state &= ~(64 | 32 );
|
31883 | shiftInitState(view, 768 , 1024 );
|
31884 | }
|
31885 | function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
31886 | if (argStyle === 0 ) {
|
31887 | return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
31888 | }
|
31889 | else {
|
31890 | return checkAndUpdateNodeDynamic(view, nodeDef, v0);
|
31891 | }
|
31892 | }
|
31893 | function markProjectedViewsForCheck(view) {
|
31894 | const def = view.def;
|
31895 | if (!(def.nodeFlags & 4 )) {
|
31896 | return;
|
31897 | }
|
31898 | for (let i = 0; i < def.nodes.length; i++) {
|
31899 | const nodeDef = def.nodes[i];
|
31900 | if (nodeDef.flags & 4 ) {
|
31901 | const projectedViews = asElementData(view, i).template._projectedViews;
|
31902 | if (projectedViews) {
|
31903 | for (let i = 0; i < projectedViews.length; i++) {
|
31904 | const projectedView = projectedViews[i];
|
31905 | projectedView.state |= 32 ;
|
31906 | markParentViewsForCheckProjectedViews(projectedView, view);
|
31907 | }
|
31908 | }
|
31909 | }
|
31910 | else if ((nodeDef.childFlags & 4 ) === 0) {
|
31911 |
|
31912 |
|
31913 |
|
31914 | i += nodeDef.childCount;
|
31915 | }
|
31916 | }
|
31917 | }
|
31918 | function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
31919 | switch (nodeDef.flags & 201347067 ) {
|
31920 | case 1 :
|
31921 | return checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
31922 | case 2 :
|
31923 | return checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
31924 | case 16384 :
|
31925 | return checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
31926 | case 32 :
|
31927 | case 64 :
|
31928 | case 128 :
|
31929 | return checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
31930 | default:
|
31931 | throw 'unreachable';
|
31932 | }
|
31933 | }
|
31934 | function checkAndUpdateNodeDynamic(view, nodeDef, values) {
|
31935 | switch (nodeDef.flags & 201347067 ) {
|
31936 | case 1 :
|
31937 | return checkAndUpdateElementDynamic(view, nodeDef, values);
|
31938 | case 2 :
|
31939 | return checkAndUpdateTextDynamic(view, nodeDef, values);
|
31940 | case 16384 :
|
31941 | return checkAndUpdateDirectiveDynamic(view, nodeDef, values);
|
31942 | case 32 :
|
31943 | case 64 :
|
31944 | case 128 :
|
31945 | return checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
|
31946 | default:
|
31947 | throw 'unreachable';
|
31948 | }
|
31949 | }
|
31950 | function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
31951 | if (argStyle === 0 ) {
|
31952 | checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
31953 | }
|
31954 | else {
|
31955 | checkNoChangesNodeDynamic(view, nodeDef, v0);
|
31956 | }
|
31957 |
|
31958 | return false;
|
31959 | }
|
31960 | function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
31961 | const bindLen = nodeDef.bindings.length;
|
31962 | if (bindLen > 0)
|
31963 | checkBindingNoChanges(view, nodeDef, 0, v0);
|
31964 | if (bindLen > 1)
|
31965 | checkBindingNoChanges(view, nodeDef, 1, v1);
|
31966 | if (bindLen > 2)
|
31967 | checkBindingNoChanges(view, nodeDef, 2, v2);
|
31968 | if (bindLen > 3)
|
31969 | checkBindingNoChanges(view, nodeDef, 3, v3);
|
31970 | if (bindLen > 4)
|
31971 | checkBindingNoChanges(view, nodeDef, 4, v4);
|
31972 | if (bindLen > 5)
|
31973 | checkBindingNoChanges(view, nodeDef, 5, v5);
|
31974 | if (bindLen > 6)
|
31975 | checkBindingNoChanges(view, nodeDef, 6, v6);
|
31976 | if (bindLen > 7)
|
31977 | checkBindingNoChanges(view, nodeDef, 7, v7);
|
31978 | if (bindLen > 8)
|
31979 | checkBindingNoChanges(view, nodeDef, 8, v8);
|
31980 | if (bindLen > 9)
|
31981 | checkBindingNoChanges(view, nodeDef, 9, v9);
|
31982 | }
|
31983 | function checkNoChangesNodeDynamic(view, nodeDef, values) {
|
31984 | for (let i = 0; i < values.length; i++) {
|
31985 | checkBindingNoChanges(view, nodeDef, i, values[i]);
|
31986 | }
|
31987 | }
|
31988 |
|
31989 |
|
31990 |
|
31991 |
|
31992 | function checkNoChangesQuery(view, nodeDef) {
|
31993 | const queryList = asQueryList(view, nodeDef.nodeIndex);
|
31994 | if (queryList.dirty) {
|
31995 | throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.nodeIndex), `Query ${nodeDef.query.id} not dirty`, `Query ${nodeDef.query.id} dirty`, (view.state & 1 ) !== 0);
|
31996 | }
|
31997 | }
|
31998 | function destroyView(view) {
|
31999 | if (view.state & 128 ) {
|
32000 | return;
|
32001 | }
|
32002 | execEmbeddedViewsAction(view, ViewAction.Destroy);
|
32003 | execComponentViewsAction(view, ViewAction.Destroy);
|
32004 | callLifecycleHooksChildrenFirst(view, 131072 );
|
32005 | if (view.disposables) {
|
32006 | for (let i = 0; i < view.disposables.length; i++) {
|
32007 | view.disposables[i]();
|
32008 | }
|
32009 | }
|
32010 | detachProjectedView(view);
|
32011 | if (view.renderer.destroyNode) {
|
32012 | destroyViewNodes(view);
|
32013 | }
|
32014 | if (isComponentView(view)) {
|
32015 | view.renderer.destroy();
|
32016 | }
|
32017 | view.state |= 128 ;
|
32018 | }
|
32019 | function destroyViewNodes(view) {
|
32020 | const len = view.def.nodes.length;
|
32021 | for (let i = 0; i < len; i++) {
|
32022 | const def = view.def.nodes[i];
|
32023 | if (def.flags & 1 ) {
|
32024 | view.renderer.destroyNode(asElementData(view, i).renderElement);
|
32025 | }
|
32026 | else if (def.flags & 2 ) {
|
32027 | view.renderer.destroyNode(asTextData(view, i).renderText);
|
32028 | }
|
32029 | else if (def.flags & 67108864 || def.flags & 134217728 ) {
|
32030 | asQueryList(view, i).destroy();
|
32031 | }
|
32032 | }
|
32033 | }
|
32034 | var ViewAction;
|
32035 | (function (ViewAction) {
|
32036 | ViewAction[ViewAction["CreateViewNodes"] = 0] = "CreateViewNodes";
|
32037 | ViewAction[ViewAction["CheckNoChanges"] = 1] = "CheckNoChanges";
|
32038 | ViewAction[ViewAction["CheckNoChangesProjectedViews"] = 2] = "CheckNoChangesProjectedViews";
|
32039 | ViewAction[ViewAction["CheckAndUpdate"] = 3] = "CheckAndUpdate";
|
32040 | ViewAction[ViewAction["CheckAndUpdateProjectedViews"] = 4] = "CheckAndUpdateProjectedViews";
|
32041 | ViewAction[ViewAction["Destroy"] = 5] = "Destroy";
|
32042 | })(ViewAction || (ViewAction = {}));
|
32043 | function execComponentViewsAction(view, action) {
|
32044 | const def = view.def;
|
32045 | if (!(def.nodeFlags & 33554432 )) {
|
32046 | return;
|
32047 | }
|
32048 | for (let i = 0; i < def.nodes.length; i++) {
|
32049 | const nodeDef = def.nodes[i];
|
32050 | if (nodeDef.flags & 33554432 ) {
|
32051 |
|
32052 | callViewAction(asElementData(view, i).componentView, action);
|
32053 | }
|
32054 | else if ((nodeDef.childFlags & 33554432 ) === 0) {
|
32055 |
|
32056 |
|
32057 |
|
32058 | i += nodeDef.childCount;
|
32059 | }
|
32060 | }
|
32061 | }
|
32062 | function execEmbeddedViewsAction(view, action) {
|
32063 | const def = view.def;
|
32064 | if (!(def.nodeFlags & 16777216 )) {
|
32065 | return;
|
32066 | }
|
32067 | for (let i = 0; i < def.nodes.length; i++) {
|
32068 | const nodeDef = def.nodes[i];
|
32069 | if (nodeDef.flags & 16777216 ) {
|
32070 |
|
32071 | const embeddedViews = asElementData(view, i).viewContainer._embeddedViews;
|
32072 | for (let k = 0; k < embeddedViews.length; k++) {
|
32073 | callViewAction(embeddedViews[k], action);
|
32074 | }
|
32075 | }
|
32076 | else if ((nodeDef.childFlags & 16777216 ) === 0) {
|
32077 |
|
32078 |
|
32079 |
|
32080 | i += nodeDef.childCount;
|
32081 | }
|
32082 | }
|
32083 | }
|
32084 | function callViewAction(view, action) {
|
32085 | const viewState = view.state;
|
32086 | switch (action) {
|
32087 | case ViewAction.CheckNoChanges:
|
32088 | if ((viewState & 128 ) === 0) {
|
32089 | if ((viewState & 12 ) === 12 ) {
|
32090 | checkNoChangesView(view);
|
32091 | }
|
32092 | else if (viewState & 64 ) {
|
32093 | execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews);
|
32094 | }
|
32095 | }
|
32096 | break;
|
32097 | case ViewAction.CheckNoChangesProjectedViews:
|
32098 | if ((viewState & 128 ) === 0) {
|
32099 | if (viewState & 32 ) {
|
32100 | checkNoChangesView(view);
|
32101 | }
|
32102 | else if (viewState & 64 ) {
|
32103 | execProjectedViewsAction(view, action);
|
32104 | }
|
32105 | }
|
32106 | break;
|
32107 | case ViewAction.CheckAndUpdate:
|
32108 | if ((viewState & 128 ) === 0) {
|
32109 | if ((viewState & 12 ) === 12 ) {
|
32110 | checkAndUpdateView(view);
|
32111 | }
|
32112 | else if (viewState & 64 ) {
|
32113 | execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews);
|
32114 | }
|
32115 | }
|
32116 | break;
|
32117 | case ViewAction.CheckAndUpdateProjectedViews:
|
32118 | if ((viewState & 128 ) === 0) {
|
32119 | if (viewState & 32 ) {
|
32120 | checkAndUpdateView(view);
|
32121 | }
|
32122 | else if (viewState & 64 ) {
|
32123 | execProjectedViewsAction(view, action);
|
32124 | }
|
32125 | }
|
32126 | break;
|
32127 | case ViewAction.Destroy:
|
32128 |
|
32129 |
|
32130 | destroyView(view);
|
32131 | break;
|
32132 | case ViewAction.CreateViewNodes:
|
32133 | createViewNodes(view);
|
32134 | break;
|
32135 | }
|
32136 | }
|
32137 | function execProjectedViewsAction(view, action) {
|
32138 | execEmbeddedViewsAction(view, action);
|
32139 | execComponentViewsAction(view, action);
|
32140 | }
|
32141 | function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
|
32142 | if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
|
32143 | return;
|
32144 | }
|
32145 | const nodeCount = view.def.nodes.length;
|
32146 | for (let i = 0; i < nodeCount; i++) {
|
32147 | const nodeDef = view.def.nodes[i];
|
32148 | if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
|
32149 | Services.setCurrentNode(view, nodeDef.nodeIndex);
|
32150 | switch (checkType) {
|
32151 | case 0 :
|
32152 | checkAndUpdateQuery(view, nodeDef);
|
32153 | break;
|
32154 | case 1 :
|
32155 | checkNoChangesQuery(view, nodeDef);
|
32156 | break;
|
32157 | }
|
32158 | }
|
32159 | if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
|
32160 |
|
32161 |
|
32162 | i += nodeDef.childCount;
|
32163 | }
|
32164 | }
|
32165 | }
|
32166 |
|
32167 |
|
32168 |
|
32169 |
|
32170 |
|
32171 |
|
32172 |
|
32173 |
|
32174 | let initialized = false;
|
32175 | function initServicesIfNeeded() {
|
32176 | if (initialized) {
|
32177 | return;
|
32178 | }
|
32179 | initialized = true;
|
32180 | const services = isDevMode() ? createDebugServices() : createProdServices();
|
32181 | Services.setCurrentNode = services.setCurrentNode;
|
32182 | Services.createRootView = services.createRootView;
|
32183 | Services.createEmbeddedView = services.createEmbeddedView;
|
32184 | Services.createComponentView = services.createComponentView;
|
32185 | Services.createNgModuleRef = services.createNgModuleRef;
|
32186 | Services.overrideProvider = services.overrideProvider;
|
32187 | Services.overrideComponentView = services.overrideComponentView;
|
32188 | Services.clearOverrides = services.clearOverrides;
|
32189 | Services.checkAndUpdateView = services.checkAndUpdateView;
|
32190 | Services.checkNoChangesView = services.checkNoChangesView;
|
32191 | Services.destroyView = services.destroyView;
|
32192 | Services.resolveDep = resolveDep;
|
32193 | Services.createDebugContext = services.createDebugContext;
|
32194 | Services.handleEvent = services.handleEvent;
|
32195 | Services.updateDirectives = services.updateDirectives;
|
32196 | Services.updateRenderer = services.updateRenderer;
|
32197 | Services.dirtyParentQueries = dirtyParentQueries;
|
32198 | }
|
32199 | function createProdServices() {
|
32200 | return {
|
32201 | setCurrentNode: () => { },
|
32202 | createRootView: createProdRootView,
|
32203 | createEmbeddedView: createEmbeddedView,
|
32204 | createComponentView: createComponentView,
|
32205 | createNgModuleRef: createNgModuleRef,
|
32206 | overrideProvider: NOOP,
|
32207 | overrideComponentView: NOOP,
|
32208 | clearOverrides: NOOP,
|
32209 | checkAndUpdateView: checkAndUpdateView,
|
32210 | checkNoChangesView: checkNoChangesView,
|
32211 | destroyView: destroyView,
|
32212 | createDebugContext: (view, nodeIndex) => new DebugContext_(view, nodeIndex),
|
32213 | handleEvent: (view, nodeIndex, eventName, event) => view.def.handleEvent(view, nodeIndex, eventName, event),
|
32214 | updateDirectives: (view, checkType) => view.def.updateDirectives(checkType === 0 ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view),
|
32215 | updateRenderer: (view, checkType) => view.def.updateRenderer(checkType === 0 ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view),
|
32216 | };
|
32217 | }
|
32218 | function createDebugServices() {
|
32219 | return {
|
32220 | setCurrentNode: debugSetCurrentNode,
|
32221 | createRootView: debugCreateRootView,
|
32222 | createEmbeddedView: debugCreateEmbeddedView,
|
32223 | createComponentView: debugCreateComponentView,
|
32224 | createNgModuleRef: debugCreateNgModuleRef,
|
32225 | overrideProvider: debugOverrideProvider,
|
32226 | overrideComponentView: debugOverrideComponentView,
|
32227 | clearOverrides: debugClearOverrides,
|
32228 | checkAndUpdateView: debugCheckAndUpdateView,
|
32229 | checkNoChangesView: debugCheckNoChangesView,
|
32230 | destroyView: debugDestroyView,
|
32231 | createDebugContext: (view, nodeIndex) => new DebugContext_(view, nodeIndex),
|
32232 | handleEvent: debugHandleEvent,
|
32233 | updateDirectives: debugUpdateDirectives,
|
32234 | updateRenderer: debugUpdateRenderer,
|
32235 | };
|
32236 | }
|
32237 | function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
32238 | const rendererFactory = ngModule.injector.get(RendererFactory2);
|
32239 | return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
|
32240 | }
|
32241 | function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
32242 | const rendererFactory = ngModule.injector.get(RendererFactory2);
|
32243 | const root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
|
32244 | const defWithOverride = applyProviderOverridesToView(def);
|
32245 | return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]);
|
32246 | }
|
32247 | function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
|
32248 | const sanitizer = ngModule.injector.get(Sanitizer);
|
32249 | const errorHandler = ngModule.injector.get(ErrorHandler);
|
32250 | const renderer = rendererFactory.createRenderer(null, null);
|
32251 | return {
|
32252 | ngModule,
|
32253 | injector: elInjector,
|
32254 | projectableNodes,
|
32255 | selectorOrNode: rootSelectorOrNode,
|
32256 | sanitizer,
|
32257 | rendererFactory,
|
32258 | renderer,
|
32259 | errorHandler
|
32260 | };
|
32261 | }
|
32262 | function debugCreateEmbeddedView(parentView, anchorDef, viewDef, context) {
|
32263 | const defWithOverride = applyProviderOverridesToView(viewDef);
|
32264 | return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]);
|
32265 | }
|
32266 | function debugCreateComponentView(parentView, nodeDef, viewDef, hostElement) {
|
32267 | const overrideComponentView = viewDefOverrides.get(nodeDef.element.componentProvider.provider.token);
|
32268 | if (overrideComponentView) {
|
32269 | viewDef = overrideComponentView;
|
32270 | }
|
32271 | else {
|
32272 | viewDef = applyProviderOverridesToView(viewDef);
|
32273 | }
|
32274 | return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, viewDef, hostElement]);
|
32275 | }
|
32276 | function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) {
|
32277 | const defWithOverride = applyProviderOverridesToNgModule(def);
|
32278 | return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
|
32279 | }
|
32280 | const providerOverrides = new Map();
|
32281 | const providerOverridesWithScope = new Map();
|
32282 | const viewDefOverrides = new Map();
|
32283 | function debugOverrideProvider(override) {
|
32284 | providerOverrides.set(override.token, override);
|
32285 | let injectableDef;
|
32286 | if (typeof override.token === 'function' && (injectableDef = getInjectableDef(override.token)) &&
|
32287 | typeof injectableDef.providedIn === 'function') {
|
32288 | providerOverridesWithScope.set(override.token, override);
|
32289 | }
|
32290 | }
|
32291 | function debugOverrideComponentView(comp, compFactory) {
|
32292 | const hostViewDef = resolveDefinition(getComponentViewDefinitionFactory(compFactory));
|
32293 | const compViewDef = resolveDefinition(hostViewDef.nodes[0].element.componentView);
|
32294 | viewDefOverrides.set(comp, compViewDef);
|
32295 | }
|
32296 | function debugClearOverrides() {
|
32297 | providerOverrides.clear();
|
32298 | providerOverridesWithScope.clear();
|
32299 | viewDefOverrides.clear();
|
32300 | }
|
32301 |
|
32302 |
|
32303 |
|
32304 |
|
32305 |
|
32306 |
|
32307 | function applyProviderOverridesToView(def) {
|
32308 | if (providerOverrides.size === 0) {
|
32309 | return def;
|
32310 | }
|
32311 | const elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
|
32312 | if (elementIndicesWithOverwrittenProviders.length === 0) {
|
32313 | return def;
|
32314 | }
|
32315 |
|
32316 |
|
32317 | def = def.factory(() => NOOP);
|
32318 | for (let i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
|
32319 | applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
|
32320 | }
|
32321 | return def;
|
32322 | function findElementIndicesWithOverwrittenProviders(def) {
|
32323 | const elIndicesWithOverwrittenProviders = [];
|
32324 | let lastElementDef = null;
|
32325 | for (let i = 0; i < def.nodes.length; i++) {
|
32326 | const nodeDef = def.nodes[i];
|
32327 | if (nodeDef.flags & 1 ) {
|
32328 | lastElementDef = nodeDef;
|
32329 | }
|
32330 | if (lastElementDef && nodeDef.flags & 3840 &&
|
32331 | providerOverrides.has(nodeDef.provider.token)) {
|
32332 | elIndicesWithOverwrittenProviders.push(lastElementDef.nodeIndex);
|
32333 | lastElementDef = null;
|
32334 | }
|
32335 | }
|
32336 | return elIndicesWithOverwrittenProviders;
|
32337 | }
|
32338 | function applyProviderOverridesToElement(viewDef, elIndex) {
|
32339 | for (let i = elIndex + 1; i < viewDef.nodes.length; i++) {
|
32340 | const nodeDef = viewDef.nodes[i];
|
32341 | if (nodeDef.flags & 1 ) {
|
32342 |
|
32343 | return;
|
32344 | }
|
32345 | if (nodeDef.flags & 3840 ) {
|
32346 | const provider = nodeDef.provider;
|
32347 | const override = providerOverrides.get(provider.token);
|
32348 | if (override) {
|
32349 | nodeDef.flags = (nodeDef.flags & ~3840 ) | override.flags;
|
32350 | provider.deps = splitDepsDsl(override.deps);
|
32351 | provider.value = override.value;
|
32352 | }
|
32353 | }
|
32354 | }
|
32355 | }
|
32356 | }
|
32357 |
|
32358 |
|
32359 |
|
32360 | function applyProviderOverridesToNgModule(def) {
|
32361 | const { hasOverrides, hasDeprecatedOverrides } = calcHasOverrides(def);
|
32362 | if (!hasOverrides) {
|
32363 | return def;
|
32364 | }
|
32365 |
|
32366 |
|
32367 | def = def.factory(() => NOOP);
|
32368 | applyProviderOverrides(def);
|
32369 | return def;
|
32370 | function calcHasOverrides(def) {
|
32371 | let hasOverrides = false;
|
32372 | let hasDeprecatedOverrides = false;
|
32373 | if (providerOverrides.size === 0) {
|
32374 | return { hasOverrides, hasDeprecatedOverrides };
|
32375 | }
|
32376 | def.providers.forEach(node => {
|
32377 | const override = providerOverrides.get(node.token);
|
32378 | if ((node.flags & 3840 ) && override) {
|
32379 | hasOverrides = true;
|
32380 | hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
|
32381 | }
|
32382 | });
|
32383 | def.modules.forEach(module => {
|
32384 | providerOverridesWithScope.forEach((override, token) => {
|
32385 | if (resolveForwardRef(getInjectableDef(token).providedIn) === module) {
|
32386 | hasOverrides = true;
|
32387 | hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
|
32388 | }
|
32389 | });
|
32390 | });
|
32391 | return { hasOverrides, hasDeprecatedOverrides };
|
32392 | }
|
32393 | function applyProviderOverrides(def) {
|
32394 | for (let i = 0; i < def.providers.length; i++) {
|
32395 | const provider = def.providers[i];
|
32396 | if (hasDeprecatedOverrides) {
|
32397 |
|
32398 |
|
32399 |
|
32400 | provider.flags |= 4096 ;
|
32401 | }
|
32402 | const override = providerOverrides.get(provider.token);
|
32403 | if (override) {
|
32404 | provider.flags = (provider.flags & ~3840 ) | override.flags;
|
32405 | provider.deps = splitDepsDsl(override.deps);
|
32406 | provider.value = override.value;
|
32407 | }
|
32408 | }
|
32409 | if (providerOverridesWithScope.size > 0) {
|
32410 | let moduleSet = new Set(def.modules);
|
32411 | providerOverridesWithScope.forEach((override, token) => {
|
32412 | if (moduleSet.has(resolveForwardRef(getInjectableDef(token).providedIn))) {
|
32413 | let provider = {
|
32414 | token: token,
|
32415 | flags: override.flags | (hasDeprecatedOverrides ? 4096 : 0 ),
|
32416 | deps: splitDepsDsl(override.deps),
|
32417 | value: override.value,
|
32418 | index: def.providers.length,
|
32419 | };
|
32420 | def.providers.push(provider);
|
32421 | def.providersByKey[tokenKey(token)] = provider;
|
32422 | }
|
32423 | });
|
32424 | }
|
32425 | }
|
32426 | }
|
32427 | function prodCheckAndUpdateNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
32428 | const nodeDef = view.def.nodes[checkIndex];
|
32429 | checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
32430 | return (nodeDef.flags & 224 ) ?
|
32431 | asPureExpressionData(view, checkIndex).value :
|
32432 | undefined;
|
32433 | }
|
32434 | function prodCheckNoChangesNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
32435 | const nodeDef = view.def.nodes[checkIndex];
|
32436 | checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
32437 | return (nodeDef.flags & 224 ) ?
|
32438 | asPureExpressionData(view, checkIndex).value :
|
32439 | undefined;
|
32440 | }
|
32441 | function debugCheckAndUpdateView(view) {
|
32442 | return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
|
32443 | }
|
32444 | function debugCheckNoChangesView(view) {
|
32445 | return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
|
32446 | }
|
32447 | function debugDestroyView(view) {
|
32448 | return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
|
32449 | }
|
32450 | var DebugAction;
|
32451 | (function (DebugAction) {
|
32452 | DebugAction[DebugAction["create"] = 0] = "create";
|
32453 | DebugAction[DebugAction["detectChanges"] = 1] = "detectChanges";
|
32454 | DebugAction[DebugAction["checkNoChanges"] = 2] = "checkNoChanges";
|
32455 | DebugAction[DebugAction["destroy"] = 3] = "destroy";
|
32456 | DebugAction[DebugAction["handleEvent"] = 4] = "handleEvent";
|
32457 | })(DebugAction || (DebugAction = {}));
|
32458 | let _currentAction;
|
32459 | let _currentView;
|
32460 | let _currentNodeIndex;
|
32461 | function debugSetCurrentNode(view, nodeIndex) {
|
32462 | _currentView = view;
|
32463 | _currentNodeIndex = nodeIndex;
|
32464 | }
|
32465 | function debugHandleEvent(view, nodeIndex, eventName, event) {
|
32466 | debugSetCurrentNode(view, nodeIndex);
|
32467 | return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
|
32468 | }
|
32469 | function debugUpdateDirectives(view, checkType) {
|
32470 | if (view.state & 128 ) {
|
32471 | throw viewDestroyedError(DebugAction[_currentAction]);
|
32472 | }
|
32473 | debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
|
32474 | return view.def.updateDirectives(debugCheckDirectivesFn, view);
|
32475 | function debugCheckDirectivesFn(view, nodeIndex, argStyle, ...values) {
|
32476 | const nodeDef = view.def.nodes[nodeIndex];
|
32477 | if (checkType === 0 ) {
|
32478 | debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
32479 | }
|
32480 | else {
|
32481 | debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
32482 | }
|
32483 | if (nodeDef.flags & 16384 ) {
|
32484 | debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
|
32485 | }
|
32486 | return (nodeDef.flags & 224 ) ?
|
32487 | asPureExpressionData(view, nodeDef.nodeIndex).value :
|
32488 | undefined;
|
32489 | }
|
32490 | }
|
32491 | function debugUpdateRenderer(view, checkType) {
|
32492 | if (view.state & 128 ) {
|
32493 | throw viewDestroyedError(DebugAction[_currentAction]);
|
32494 | }
|
32495 | debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
|
32496 | return view.def.updateRenderer(debugCheckRenderNodeFn, view);
|
32497 | function debugCheckRenderNodeFn(view, nodeIndex, argStyle, ...values) {
|
32498 | const nodeDef = view.def.nodes[nodeIndex];
|
32499 | if (checkType === 0 ) {
|
32500 | debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
32501 | }
|
32502 | else {
|
32503 | debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
32504 | }
|
32505 | if (nodeDef.flags & 3 ) {
|
32506 | debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
|
32507 | }
|
32508 | return (nodeDef.flags & 224 ) ?
|
32509 | asPureExpressionData(view, nodeDef.nodeIndex).value :
|
32510 | undefined;
|
32511 | }
|
32512 | }
|
32513 | function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
|
32514 | const changed = checkAndUpdateNode(view, nodeDef, argStyle, ...givenValues);
|
32515 | if (changed) {
|
32516 | const values = argStyle === 1 ? givenValues[0] : givenValues;
|
32517 | if (nodeDef.flags & 16384 ) {
|
32518 | const bindingValues = {};
|
32519 | for (let i = 0; i < nodeDef.bindings.length; i++) {
|
32520 | const binding = nodeDef.bindings[i];
|
32521 | const value = values[i];
|
32522 | if (binding.flags & 8 ) {
|
32523 | bindingValues[normalizeDebugBindingName(binding.nonMinifiedName)] =
|
32524 | normalizeDebugBindingValue(value);
|
32525 | }
|
32526 | }
|
32527 | const elDef = nodeDef.parent;
|
32528 | const el = asElementData(view, elDef.nodeIndex).renderElement;
|
32529 | if (!elDef.element.name) {
|
32530 |
|
32531 | view.renderer.setValue(el, escapeCommentText(`bindings=${JSON.stringify(bindingValues, null, 2)}`));
|
32532 | }
|
32533 | else {
|
32534 |
|
32535 | for (let attr in bindingValues) {
|
32536 | const value = bindingValues[attr];
|
32537 | if (value != null) {
|
32538 | view.renderer.setAttribute(el, attr, value);
|
32539 | }
|
32540 | else {
|
32541 | view.renderer.removeAttribute(el, attr);
|
32542 | }
|
32543 | }
|
32544 | }
|
32545 | }
|
32546 | }
|
32547 | }
|
32548 | function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
|
32549 | checkNoChangesNode(view, nodeDef, argStyle, ...values);
|
32550 | }
|
32551 | function nextDirectiveWithBinding(view, nodeIndex) {
|
32552 | for (let i = nodeIndex; i < view.def.nodes.length; i++) {
|
32553 | const nodeDef = view.def.nodes[i];
|
32554 | if (nodeDef.flags & 16384 && nodeDef.bindings && nodeDef.bindings.length) {
|
32555 | return i;
|
32556 | }
|
32557 | }
|
32558 | return null;
|
32559 | }
|
32560 | function nextRenderNodeWithBinding(view, nodeIndex) {
|
32561 | for (let i = nodeIndex; i < view.def.nodes.length; i++) {
|
32562 | const nodeDef = view.def.nodes[i];
|
32563 | if ((nodeDef.flags & 3 ) && nodeDef.bindings && nodeDef.bindings.length) {
|
32564 | return i;
|
32565 | }
|
32566 | }
|
32567 | return null;
|
32568 | }
|
32569 | class DebugContext_ {
|
32570 | constructor(view, nodeIndex) {
|
32571 | this.view = view;
|
32572 | this.nodeIndex = nodeIndex;
|
32573 | if (nodeIndex == null) {
|
32574 | this.nodeIndex = nodeIndex = 0;
|
32575 | }
|
32576 | this.nodeDef = view.def.nodes[nodeIndex];
|
32577 | let elDef = this.nodeDef;
|
32578 | let elView = view;
|
32579 | while (elDef && (elDef.flags & 1 ) === 0) {
|
32580 | elDef = elDef.parent;
|
32581 | }
|
32582 | if (!elDef) {
|
32583 | while (!elDef && elView) {
|
32584 | elDef = viewParentEl(elView);
|
32585 | elView = elView.parent;
|
32586 | }
|
32587 | }
|
32588 | this.elDef = elDef;
|
32589 | this.elView = elView;
|
32590 | }
|
32591 | get elOrCompView() {
|
32592 |
|
32593 | return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view;
|
32594 | }
|
32595 | get injector() {
|
32596 | return createInjector(this.elView, this.elDef);
|
32597 | }
|
32598 | get component() {
|
32599 | return this.elOrCompView.component;
|
32600 | }
|
32601 | get context() {
|
32602 | return this.elOrCompView.context;
|
32603 | }
|
32604 | get providerTokens() {
|
32605 | const tokens = [];
|
32606 | if (this.elDef) {
|
32607 | for (let i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
|
32608 | const childDef = this.elView.def.nodes[i];
|
32609 | if (childDef.flags & 20224 ) {
|
32610 | tokens.push(childDef.provider.token);
|
32611 | }
|
32612 | i += childDef.childCount;
|
32613 | }
|
32614 | }
|
32615 | return tokens;
|
32616 | }
|
32617 | get references() {
|
32618 | const references = {};
|
32619 | if (this.elDef) {
|
32620 | collectReferences(this.elView, this.elDef, references);
|
32621 | for (let i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
|
32622 | const childDef = this.elView.def.nodes[i];
|
32623 | if (childDef.flags & 20224 ) {
|
32624 | collectReferences(this.elView, childDef, references);
|
32625 | }
|
32626 | i += childDef.childCount;
|
32627 | }
|
32628 | }
|
32629 | return references;
|
32630 | }
|
32631 | get componentRenderElement() {
|
32632 | const elData = findHostElement(this.elOrCompView);
|
32633 | return elData ? elData.renderElement : undefined;
|
32634 | }
|
32635 | get renderNode() {
|
32636 | return this.nodeDef.flags & 2 ? renderNode(this.view, this.nodeDef) :
|
32637 | renderNode(this.elView, this.elDef);
|
32638 | }
|
32639 | logError(console, ...values) {
|
32640 | let logViewDef;
|
32641 | let logNodeIndex;
|
32642 | if (this.nodeDef.flags & 2 ) {
|
32643 | logViewDef = this.view.def;
|
32644 | logNodeIndex = this.nodeDef.nodeIndex;
|
32645 | }
|
32646 | else {
|
32647 | logViewDef = this.elView.def;
|
32648 | logNodeIndex = this.elDef.nodeIndex;
|
32649 | }
|
32650 |
|
32651 |
|
32652 | const renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
|
32653 | let currRenderNodeIndex = -1;
|
32654 | let nodeLogger = () => {
|
32655 | currRenderNodeIndex++;
|
32656 | if (currRenderNodeIndex === renderNodeIndex) {
|
32657 | return console.error.bind(console, ...values);
|
32658 | }
|
32659 | else {
|
32660 | return NOOP;
|
32661 | }
|
32662 | };
|
32663 | logViewDef.factory(nodeLogger);
|
32664 | if (currRenderNodeIndex < renderNodeIndex) {
|
32665 | console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
|
32666 | console.error(...values);
|
32667 | }
|
32668 | }
|
32669 | }
|
32670 | function getRenderNodeIndex(viewDef, nodeIndex) {
|
32671 | let renderNodeIndex = -1;
|
32672 | for (let i = 0; i <= nodeIndex; i++) {
|
32673 | const nodeDef = viewDef.nodes[i];
|
32674 | if (nodeDef.flags & 3 ) {
|
32675 | renderNodeIndex++;
|
32676 | }
|
32677 | }
|
32678 | return renderNodeIndex;
|
32679 | }
|
32680 | function findHostElement(view) {
|
32681 | while (view && !isComponentView(view)) {
|
32682 | view = view.parent;
|
32683 | }
|
32684 | if (view.parent) {
|
32685 | return asElementData(view.parent, viewParentEl(view).nodeIndex);
|
32686 | }
|
32687 | return null;
|
32688 | }
|
32689 | function collectReferences(view, nodeDef, references) {
|
32690 | for (let refName in nodeDef.references) {
|
32691 | references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
|
32692 | }
|
32693 | }
|
32694 | function callWithDebugContext(action, fn, self, args) {
|
32695 | const oldAction = _currentAction;
|
32696 | const oldView = _currentView;
|
32697 | const oldNodeIndex = _currentNodeIndex;
|
32698 | try {
|
32699 | _currentAction = action;
|
32700 | const result = fn.apply(self, args);
|
32701 | _currentView = oldView;
|
32702 | _currentNodeIndex = oldNodeIndex;
|
32703 | _currentAction = oldAction;
|
32704 | return result;
|
32705 | }
|
32706 | catch (e) {
|
32707 | if (isViewDebugError(e) || !_currentView) {
|
32708 | throw e;
|
32709 | }
|
32710 | throw viewWrappedDebugError(e, getCurrentDebugContext());
|
32711 | }
|
32712 | }
|
32713 | function getCurrentDebugContext() {
|
32714 | return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
|
32715 | }
|
32716 | class DebugRendererFactory2 {
|
32717 | constructor(delegate) {
|
32718 | this.delegate = delegate;
|
32719 | }
|
32720 | createRenderer(element, renderData) {
|
32721 | return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
|
32722 | }
|
32723 | begin() {
|
32724 | if (this.delegate.begin) {
|
32725 | this.delegate.begin();
|
32726 | }
|
32727 | }
|
32728 | end() {
|
32729 | if (this.delegate.end) {
|
32730 | this.delegate.end();
|
32731 | }
|
32732 | }
|
32733 | whenRenderingDone() {
|
32734 | if (this.delegate.whenRenderingDone) {
|
32735 | return this.delegate.whenRenderingDone();
|
32736 | }
|
32737 | return Promise.resolve(null);
|
32738 | }
|
32739 | }
|
32740 | class DebugRenderer2 {
|
32741 | constructor(delegate) {
|
32742 | this.delegate = delegate;
|
32743 | |
32744 |
|
32745 |
|
32746 |
|
32747 |
|
32748 |
|
32749 |
|
32750 |
|
32751 | this.debugContextFactory = getCurrentDebugContext;
|
32752 | this.data = this.delegate.data;
|
32753 | }
|
32754 | createDebugContext(nativeElement) {
|
32755 | return this.debugContextFactory(nativeElement);
|
32756 | }
|
32757 | destroyNode(node) {
|
32758 | const debugNode = getDebugNode(node);
|
32759 | if (debugNode) {
|
32760 | removeDebugNodeFromIndex(debugNode);
|
32761 | if (debugNode instanceof DebugNode__PRE_R3__) {
|
32762 | debugNode.listeners.length = 0;
|
32763 | }
|
32764 | }
|
32765 | if (this.delegate.destroyNode) {
|
32766 | this.delegate.destroyNode(node);
|
32767 | }
|
32768 | }
|
32769 | destroy() {
|
32770 | this.delegate.destroy();
|
32771 | }
|
32772 | createElement(name, namespace) {
|
32773 | const el = this.delegate.createElement(name, namespace);
|
32774 | const debugCtx = this.createDebugContext(el);
|
32775 | if (debugCtx) {
|
32776 | const debugEl = new DebugElement__PRE_R3__(el, null, debugCtx);
|
32777 | debugEl.name = name;
|
32778 | indexDebugNode(debugEl);
|
32779 | }
|
32780 | return el;
|
32781 | }
|
32782 | createComment(value) {
|
32783 | const comment = this.delegate.createComment(escapeCommentText(value));
|
32784 | const debugCtx = this.createDebugContext(comment);
|
32785 | if (debugCtx) {
|
32786 | indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx));
|
32787 | }
|
32788 | return comment;
|
32789 | }
|
32790 | createText(value) {
|
32791 | const text = this.delegate.createText(value);
|
32792 | const debugCtx = this.createDebugContext(text);
|
32793 | if (debugCtx) {
|
32794 | indexDebugNode(new DebugNode__PRE_R3__(text, null, debugCtx));
|
32795 | }
|
32796 | return text;
|
32797 | }
|
32798 | appendChild(parent, newChild) {
|
32799 | const debugEl = getDebugNode(parent);
|
32800 | const debugChildEl = getDebugNode(newChild);
|
32801 | if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32802 | debugEl.addChild(debugChildEl);
|
32803 | }
|
32804 | this.delegate.appendChild(parent, newChild);
|
32805 | }
|
32806 | insertBefore(parent, newChild, refChild, isMove) {
|
32807 | const debugEl = getDebugNode(parent);
|
32808 | const debugChildEl = getDebugNode(newChild);
|
32809 | const debugRefEl = getDebugNode(refChild);
|
32810 | if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32811 | debugEl.insertBefore(debugRefEl, debugChildEl);
|
32812 | }
|
32813 | this.delegate.insertBefore(parent, newChild, refChild, isMove);
|
32814 | }
|
32815 | removeChild(parent, oldChild) {
|
32816 | const debugEl = getDebugNode(parent);
|
32817 | const debugChildEl = getDebugNode(oldChild);
|
32818 | if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32819 | debugEl.removeChild(debugChildEl);
|
32820 | }
|
32821 | this.delegate.removeChild(parent, oldChild);
|
32822 | }
|
32823 | selectRootElement(selectorOrNode, preserveContent) {
|
32824 | const el = this.delegate.selectRootElement(selectorOrNode, preserveContent);
|
32825 | const debugCtx = getCurrentDebugContext();
|
32826 | if (debugCtx) {
|
32827 | indexDebugNode(new DebugElement__PRE_R3__(el, null, debugCtx));
|
32828 | }
|
32829 | return el;
|
32830 | }
|
32831 | setAttribute(el, name, value, namespace) {
|
32832 | const debugEl = getDebugNode(el);
|
32833 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32834 | const fullName = namespace ? namespace + ':' + name : name;
|
32835 | debugEl.attributes[fullName] = value;
|
32836 | }
|
32837 | this.delegate.setAttribute(el, name, value, namespace);
|
32838 | }
|
32839 | removeAttribute(el, name, namespace) {
|
32840 | const debugEl = getDebugNode(el);
|
32841 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32842 | const fullName = namespace ? namespace + ':' + name : name;
|
32843 | debugEl.attributes[fullName] = null;
|
32844 | }
|
32845 | this.delegate.removeAttribute(el, name, namespace);
|
32846 | }
|
32847 | addClass(el, name) {
|
32848 | const debugEl = getDebugNode(el);
|
32849 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32850 | debugEl.classes[name] = true;
|
32851 | }
|
32852 | this.delegate.addClass(el, name);
|
32853 | }
|
32854 | removeClass(el, name) {
|
32855 | const debugEl = getDebugNode(el);
|
32856 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32857 | debugEl.classes[name] = false;
|
32858 | }
|
32859 | this.delegate.removeClass(el, name);
|
32860 | }
|
32861 | setStyle(el, style, value, flags) {
|
32862 | const debugEl = getDebugNode(el);
|
32863 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32864 | debugEl.styles[style] = value;
|
32865 | }
|
32866 | this.delegate.setStyle(el, style, value, flags);
|
32867 | }
|
32868 | removeStyle(el, style, flags) {
|
32869 | const debugEl = getDebugNode(el);
|
32870 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32871 | debugEl.styles[style] = null;
|
32872 | }
|
32873 | this.delegate.removeStyle(el, style, flags);
|
32874 | }
|
32875 | setProperty(el, name, value) {
|
32876 | const debugEl = getDebugNode(el);
|
32877 | if (debugEl && debugEl instanceof DebugElement__PRE_R3__) {
|
32878 | debugEl.properties[name] = value;
|
32879 | }
|
32880 | this.delegate.setProperty(el, name, value);
|
32881 | }
|
32882 | listen(target, eventName, callback) {
|
32883 | if (typeof target !== 'string') {
|
32884 | const debugEl = getDebugNode(target);
|
32885 | if (debugEl) {
|
32886 | debugEl.listeners.push(new DebugEventListener(eventName, callback));
|
32887 | }
|
32888 | }
|
32889 | return this.delegate.listen(target, eventName, callback);
|
32890 | }
|
32891 | parentNode(node) {
|
32892 | return this.delegate.parentNode(node);
|
32893 | }
|
32894 | nextSibling(node) {
|
32895 | return this.delegate.nextSibling(node);
|
32896 | }
|
32897 | setValue(node, value) {
|
32898 | return this.delegate.setValue(node, value);
|
32899 | }
|
32900 | }
|
32901 |
|
32902 |
|
32903 |
|
32904 |
|
32905 |
|
32906 |
|
32907 |
|
32908 |
|
32909 | function overrideProvider(override) {
|
32910 | initServicesIfNeeded();
|
32911 | return Services.overrideProvider(override);
|
32912 | }
|
32913 | function overrideComponentView(comp, componentFactory) {
|
32914 | initServicesIfNeeded();
|
32915 | return Services.overrideComponentView(comp, componentFactory);
|
32916 | }
|
32917 | function clearOverrides() {
|
32918 | initServicesIfNeeded();
|
32919 | return Services.clearOverrides();
|
32920 | }
|
32921 |
|
32922 |
|
32923 | function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
|
32924 | return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
|
32925 | }
|
32926 | function cloneNgModuleDefinition(def) {
|
32927 | const providers = Array.from(def.providers);
|
32928 | const modules = Array.from(def.modules);
|
32929 | const providersByKey = {};
|
32930 | for (const key in def.providersByKey) {
|
32931 | providersByKey[key] = def.providersByKey[key];
|
32932 | }
|
32933 | return {
|
32934 | factory: def.factory,
|
32935 | scope: def.scope,
|
32936 | providers,
|
32937 | modules,
|
32938 | providersByKey,
|
32939 | };
|
32940 | }
|
32941 | class NgModuleFactory_ extends NgModuleFactory$1 {
|
32942 | constructor(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
|
32943 |
|
32944 |
|
32945 | super();
|
32946 | this.moduleType = moduleType;
|
32947 | this._bootstrapComponents = _bootstrapComponents;
|
32948 | this._ngModuleDefFactory = _ngModuleDefFactory;
|
32949 | }
|
32950 | create(parentInjector) {
|
32951 | initServicesIfNeeded();
|
32952 |
|
32953 |
|
32954 |
|
32955 | const def = cloneNgModuleDefinition(resolveDefinition(this._ngModuleDefFactory));
|
32956 | return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def);
|
32957 | }
|
32958 | }
|
32959 |
|
32960 |
|
32961 |
|
32962 |
|
32963 |
|
32964 |
|
32965 |
|
32966 |
|
32967 |
|
32968 |
|
32969 |
|
32970 |
|
32971 |
|
32972 |
|
32973 |
|
32974 |
|
32975 |
|
32976 |
|
32977 |
|
32978 |
|
32979 |
|
32980 |
|
32981 |
|
32982 |
|
32983 |
|
32984 |
|
32985 |
|
32986 |
|
32987 |
|
32988 | function ɵɵngDeclareDirective(decl) {
|
32989 | const compiler = getCompilerFacade({ usage: 1 , kind: 'directive', type: decl.type });
|
32990 | return compiler.compileDirectiveDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵfac.js`, decl);
|
32991 | }
|
32992 |
|
32993 |
|
32994 |
|
32995 |
|
32996 |
|
32997 | function ɵɵngDeclareClassMetadata(decl) {
|
32998 | setClassMetadata(decl.type, decl.decorators, decl.ctorParameters ?? null, decl.propDecorators ?? null);
|
32999 | }
|
33000 |
|
33001 |
|
33002 |
|
33003 |
|
33004 |
|
33005 | function ɵɵngDeclareComponent(decl) {
|
33006 | const compiler = getCompilerFacade({ usage: 1 , kind: 'component', type: decl.type });
|
33007 | return compiler.compileComponentDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵcmp.js`, decl);
|
33008 | }
|
33009 |
|
33010 |
|
33011 |
|
33012 |
|
33013 |
|
33014 | function ɵɵngDeclareFactory(decl) {
|
33015 | const compiler = getCompilerFacade({
|
33016 | usage: 1 ,
|
33017 | kind: getFactoryKind(decl.target),
|
33018 | type: decl.type
|
33019 | });
|
33020 | return compiler.compileFactoryDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵfac.js`, decl);
|
33021 | }
|
33022 | function getFactoryKind(target) {
|
33023 | switch (target) {
|
33024 | case FactoryTarget.Directive:
|
33025 | return 'directive';
|
33026 | case FactoryTarget.Component:
|
33027 | return 'component';
|
33028 | case FactoryTarget.Injectable:
|
33029 | return 'injectable';
|
33030 | case FactoryTarget.Pipe:
|
33031 | return 'pipe';
|
33032 | case FactoryTarget.NgModule:
|
33033 | return 'NgModule';
|
33034 | }
|
33035 | }
|
33036 |
|
33037 |
|
33038 |
|
33039 |
|
33040 |
|
33041 | function ɵɵngDeclareInjectable(decl) {
|
33042 | const compiler = getCompilerFacade({ usage: 1 , kind: 'injectable', type: decl.type });
|
33043 | return compiler.compileInjectableDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵprov.js`, decl);
|
33044 | }
|
33045 |
|
33046 |
|
33047 |
|
33048 |
|
33049 |
|
33050 | function ɵɵngDeclareInjector(decl) {
|
33051 | const compiler = getCompilerFacade({ usage: 1 , kind: 'NgModule', type: decl.type });
|
33052 | return compiler.compileInjectorDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵinj.js`, decl);
|
33053 | }
|
33054 |
|
33055 |
|
33056 |
|
33057 |
|
33058 |
|
33059 | function ɵɵngDeclareNgModule(decl) {
|
33060 | const compiler = getCompilerFacade({ usage: 1 , kind: 'NgModule', type: decl.type });
|
33061 | return compiler.compileNgModuleDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵmod.js`, decl);
|
33062 | }
|
33063 |
|
33064 |
|
33065 |
|
33066 |
|
33067 |
|
33068 | function ɵɵngDeclarePipe(decl) {
|
33069 | const compiler = getCompilerFacade({ usage: 1 , kind: 'pipe', type: decl.type });
|
33070 | return compiler.compilePipeDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵpipe.js`, decl);
|
33071 | }
|
33072 |
|
33073 |
|
33074 |
|
33075 |
|
33076 |
|
33077 |
|
33078 |
|
33079 |
|
33080 |
|
33081 |
|
33082 |
|
33083 |
|
33084 |
|
33085 |
|
33086 |
|
33087 |
|
33088 |
|
33089 |
|
33090 |
|
33091 |
|
33092 |
|
33093 |
|
33094 |
|
33095 |
|
33096 |
|
33097 | if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
33098 |
|
33099 |
|
33100 |
|
33101 | _global.$localize = _global.$localize || function () {
|
33102 | throw new Error('It looks like your application or one of its dependencies is using i18n.\n' +
|
33103 | 'Angular 9 introduced a global `$localize()` function that needs to be loaded.\n' +
|
33104 | 'Please run `ng add @angular/localize` from the Angular CLI.\n' +
|
33105 | '(For non-CLI projects, add `import \'@angular/localize/init\';` to your `polyfills.ts` file.\n' +
|
33106 | 'For server-side rendering applications add the import to your `main.server.ts` file.)');
|
33107 | };
|
33108 | }
|
33109 |
|
33110 |
|
33111 |
|
33112 |
|
33113 |
|
33114 |
|
33115 |
|
33116 |
|
33117 |
|
33118 |
|
33119 |
|
33120 |
|
33121 |
|
33122 |
|
33123 |
|
33124 |
|
33125 |
|
33126 |
|
33127 |
|
33128 |
|
33129 |
|
33130 |
|
33131 | 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$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as 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, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as 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, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef, asNativeElements, assertPlatform, createNgModuleRef$1 as createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, inject, isDevMode, platformCore, resolveForwardRef, setTestabilityGetter, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, APP_ID_RANDOM_PROVIDER as ɵAPP_ID_RANDOM_PROVIDER, CREATE_ATTRIBUTE_DECORATOR__POST_R3__ as ɵCREATE_ATTRIBUTE_DECORATOR__POST_R3__, 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$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, EMPTY_ARRAY 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 as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, 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__, ViewRef$1 as ɵViewRef, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, anchorDef as ɵand, 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$1 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__, getNgModuleById__POST_R3__ as ɵgetNgModuleById__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, isSubscribable as ɵisSubscribable, 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$1 as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, queryDef as ɵqud, registerLocaleData as ɵregisterLocaleData, registerModuleFactory as ɵregisterModuleFactory, registerNgModuleType as ɵregisterNgModuleType, renderComponent 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, unwrapSafeValue as ɵunwrapSafeValue, viewDef as ɵvid, whenRendered as ɵwhenRendered, ɵɵCopyDefinitionFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵ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, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵ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, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵ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, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵviewQuery };
|
33132 |
|