1 | (function() {
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | var define, require, Ember;
|
13 |
|
14 |
|
15 | mainContext = this;
|
16 |
|
17 | (function () {
|
18 | var registry;
|
19 | var seen;
|
20 |
|
21 | function missingModule(name, referrerName) {
|
22 | if (referrerName) {
|
23 | throw new Error('Could not find module ' + name + ' required by: ' + referrerName);
|
24 | } else {
|
25 | throw new Error('Could not find module ' + name);
|
26 | }
|
27 | }
|
28 |
|
29 | function internalRequire(_name, referrerName) {
|
30 | var name = _name;
|
31 | var mod = registry[name];
|
32 |
|
33 | if (!mod) {
|
34 | name = name + '/index';
|
35 | mod = registry[name];
|
36 | }
|
37 |
|
38 | var exports = seen[name];
|
39 |
|
40 | if (exports !== undefined) {
|
41 | return exports;
|
42 | }
|
43 |
|
44 | exports = seen[name] = {};
|
45 |
|
46 | if (!mod) {
|
47 | missingModule(_name, referrerName);
|
48 | }
|
49 |
|
50 | var deps = mod.deps;
|
51 | var callback = mod.callback;
|
52 | var reified = new Array(deps.length);
|
53 |
|
54 | for (var i = 0; i < deps.length; i++) {
|
55 | if (deps[i] === 'exports') {
|
56 | reified[i] = exports;
|
57 | } else if (deps[i] === 'require') {
|
58 | reified[i] = require;
|
59 | } else {
|
60 | reified[i] = internalRequire(deps[i], name);
|
61 | }
|
62 | }
|
63 |
|
64 | callback.apply(this, reified);
|
65 | return exports;
|
66 | }
|
67 |
|
68 | var isNode = typeof window === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
|
69 |
|
70 | if (!isNode) {
|
71 | Ember = this.Ember = this.Ember || {};
|
72 | }
|
73 |
|
74 | if (typeof Ember === 'undefined') {
|
75 | Ember = {};
|
76 | }
|
77 |
|
78 | if (typeof Ember.__loader === 'undefined') {
|
79 | registry = Object.create(null);
|
80 | seen = Object.create(null);
|
81 |
|
82 | define = function (name, deps, callback) {
|
83 | var value = {};
|
84 |
|
85 | if (!callback) {
|
86 | value.deps = [];
|
87 | value.callback = deps;
|
88 | } else {
|
89 | value.deps = deps;
|
90 | value.callback = callback;
|
91 | }
|
92 |
|
93 | registry[name] = value;
|
94 | };
|
95 |
|
96 | require = function (name) {
|
97 | return internalRequire(name, null);
|
98 | };
|
99 |
|
100 |
|
101 | require['default'] = require;
|
102 |
|
103 | require.has = function registryHas(moduleName) {
|
104 | return Boolean(registry[moduleName]) || Boolean(registry[moduleName + '/index']);
|
105 | };
|
106 |
|
107 | require._eak_seen = registry;
|
108 | Ember.__loader = {
|
109 | define: define,
|
110 | require: require,
|
111 | registry: registry
|
112 | };
|
113 | } else {
|
114 | define = Ember.__loader.define;
|
115 | require = Ember.__loader.require;
|
116 | }
|
117 | })();
|
118 | define("@ember/-internals/browser-environment/index", ["exports"], function (_exports) {
|
119 | "use strict";
|
120 |
|
121 | Object.defineProperty(_exports, "__esModule", {
|
122 | value: true
|
123 | });
|
124 | _exports.hasDOM = _exports.isFirefox = _exports.isChrome = _exports.userAgent = _exports.history = _exports.location = _exports.window = void 0;
|
125 |
|
126 | var hasDom = typeof self === 'object' && self !== null && self.Object === Object && typeof Window !== 'undefined' && self.constructor === Window && typeof document === 'object' && document !== null && self.document === document && typeof location === 'object' && location !== null && self.location === location && typeof history === 'object' && history !== null && self.history === history && typeof navigator === 'object' && navigator !== null && self.navigator === navigator && typeof navigator.userAgent === 'string';
|
127 | _exports.hasDOM = hasDom;
|
128 | var window = hasDom ? self : null;
|
129 | _exports.window = window;
|
130 | var location$1 = hasDom ? self.location : null;
|
131 | _exports.location = location$1;
|
132 | var history$1 = hasDom ? self.history : null;
|
133 | _exports.history = history$1;
|
134 | var userAgent = hasDom ? self.navigator.userAgent : 'Lynx (textmode)';
|
135 | _exports.userAgent = userAgent;
|
136 | var isChrome = hasDom ? Boolean(window.chrome) && !window.opera : false;
|
137 | _exports.isChrome = isChrome;
|
138 | var isFirefox = hasDom ? typeof InstallTrigger !== 'undefined' : false;
|
139 | _exports.isFirefox = isFirefox;
|
140 | });
|
141 | define("@ember/-internals/console/index", ["exports", "@ember/debug", "@ember/deprecated-features"], function (_exports, _debug, _deprecatedFeatures) {
|
142 | "use strict";
|
143 |
|
144 | Object.defineProperty(_exports, "__esModule", {
|
145 | value: true
|
146 | });
|
147 | _exports.default = void 0;
|
148 |
|
149 | var DEPRECATION_MESSAGE = 'Use of Ember.Logger is deprecated. Please use `console` for logging.';
|
150 | var DEPRECATION_ID = 'ember-console.deprecate-logger';
|
151 | var DEPRECATION_URL = 'https://emberjs.com/deprecations/v3.x#toc_use-console-rather-than-ember-logger';
|
152 | |
153 |
|
154 |
|
155 |
|
156 | |
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 | var DEPRECATED_LOGGER;
|
168 |
|
169 | if (_deprecatedFeatures.LOGGER) {
|
170 | DEPRECATED_LOGGER = {
|
171 | |
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 | log() {
|
185 | (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {
|
186 | id: DEPRECATION_ID,
|
187 | until: '4.0.0',
|
188 | url: DEPRECATION_URL
|
189 | }));
|
190 | return console.log(...arguments);
|
191 | },
|
192 |
|
193 | |
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 | warn() {
|
206 | (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {
|
207 | id: DEPRECATION_ID,
|
208 | until: '4.0.0',
|
209 | url: DEPRECATION_URL
|
210 | }));
|
211 | return console.warn(...arguments);
|
212 | },
|
213 |
|
214 | |
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 | error() {
|
227 | (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {
|
228 | id: DEPRECATION_ID,
|
229 | until: '4.0.0',
|
230 | url: DEPRECATION_URL
|
231 | }));
|
232 | return console.error(...arguments);
|
233 | },
|
234 |
|
235 | |
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 | info() {
|
249 | (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {
|
250 | id: DEPRECATION_ID,
|
251 | until: '4.0.0',
|
252 | url: DEPRECATION_URL
|
253 | }));
|
254 | return console.info(...arguments);
|
255 | },
|
256 |
|
257 | |
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 | debug() {
|
271 | (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {
|
272 | id: DEPRECATION_ID,
|
273 | until: '4.0.0',
|
274 | url: DEPRECATION_URL
|
275 | }));
|
276 |
|
277 |
|
278 | if (console.debug) {
|
279 | return console.debug(...arguments);
|
280 | }
|
281 |
|
282 | return console.info(...arguments);
|
283 |
|
284 | },
|
285 |
|
286 | |
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 | assert() {
|
300 | (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {
|
301 | id: DEPRECATION_ID,
|
302 | until: '4.0.0',
|
303 | url: DEPRECATION_URL
|
304 | }));
|
305 | return console.assert(...arguments);
|
306 | }
|
307 |
|
308 | };
|
309 | }
|
310 |
|
311 | var _default = DEPRECATED_LOGGER;
|
312 | _exports.default = _default;
|
313 | });
|
314 | define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner", "@ember/-internals/utils", "@ember/debug", "@ember/polyfills"], function (_exports, _owner, _utils, _debug, _polyfills) {
|
315 | "use strict";
|
316 |
|
317 | Object.defineProperty(_exports, "__esModule", {
|
318 | value: true
|
319 | });
|
320 | _exports.privatize = privatize;
|
321 | _exports.getFactoryFor = getFactoryFor;
|
322 | _exports.setFactoryFor = setFactoryFor;
|
323 | _exports.INIT_FACTORY = _exports.Container = _exports.Registry = void 0;
|
324 | var leakTracking;
|
325 | var containers;
|
326 |
|
327 | if (true
|
328 |
|
329 | ) {
|
330 |
|
331 |
|
332 |
|
333 | try {
|
334 | if (typeof gc === 'function') {
|
335 | leakTracking = (() => {
|
336 |
|
337 | var GetWeakSetValues = new Function('weakSet', 'return %GetWeakSetValues(weakSet, 0)');
|
338 | containers = new WeakSet();
|
339 | return {
|
340 | hasContainers() {
|
341 | gc();
|
342 | return GetWeakSetValues(containers).length > 0;
|
343 | },
|
344 |
|
345 | reset() {
|
346 | var values = GetWeakSetValues(containers);
|
347 |
|
348 | for (var i = 0; i < values.length; i++) {
|
349 | containers.delete(values[i]);
|
350 | }
|
351 | }
|
352 |
|
353 | };
|
354 | })();
|
355 | }
|
356 | } catch (e) {
|
357 | }
|
358 | }
|
359 | |
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 | class Container {
|
375 | constructor(registry, options = {}) {
|
376 | this.registry = registry;
|
377 | this.owner = options.owner || null;
|
378 | this.cache = (0, _utils.dictionary)(options.cache || null);
|
379 | this.factoryManagerCache = (0, _utils.dictionary)(options.factoryManagerCache || null);
|
380 | this.isDestroyed = false;
|
381 | this.isDestroying = false;
|
382 |
|
383 | if (true
|
384 |
|
385 | ) {
|
386 | this.validationCache = (0, _utils.dictionary)(options.validationCache || null);
|
387 |
|
388 | if (containers !== undefined) {
|
389 | containers.add(this);
|
390 | }
|
391 | }
|
392 | }
|
393 | |
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 | |
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 | |
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 | |
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 | lookup(fullName, options) {
|
447 | if (this.isDestroyed) {
|
448 | throw new Error(`Can not call \`.lookup\` after the owner has been destroyed`);
|
449 | }
|
450 |
|
451 | (true && !(this.registry.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.registry.isValidFullName(fullName)));
|
452 | return lookup(this, this.registry.normalize(fullName), options);
|
453 | }
|
454 | |
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 | destroy() {
|
463 | this.isDestroying = true;
|
464 | destroyDestroyables(this);
|
465 | }
|
466 |
|
467 | finalizeDestroy() {
|
468 | resetCache(this);
|
469 | this.isDestroyed = true;
|
470 | }
|
471 | |
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 | reset(fullName) {
|
480 | if (this.isDestroyed) return;
|
481 |
|
482 | if (fullName === undefined) {
|
483 | destroyDestroyables(this);
|
484 | resetCache(this);
|
485 | } else {
|
486 | resetMember(this, this.registry.normalize(fullName));
|
487 | }
|
488 | }
|
489 | |
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 | ownerInjection() {
|
499 | var injection = {};
|
500 | (0, _owner.setOwner)(injection, this.owner);
|
501 | return injection;
|
502 | }
|
503 | |
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 | factoryFor(fullName, options = {}) {
|
518 | if (this.isDestroyed) {
|
519 | throw new Error(`Can not call \`.factoryFor\` after the owner has been destroyed`);
|
520 | }
|
521 |
|
522 | var normalizedName = this.registry.normalize(fullName);
|
523 | (true && !(this.registry.isValidFullName(normalizedName)) && (0, _debug.assert)('fullName must be a proper full name', this.registry.isValidFullName(normalizedName)));
|
524 | (true && !(false
|
525 |
|
526 | || !options.namespace) && (0, _debug.assert)('EMBER_MODULE_UNIFICATION must be enabled to pass a namespace option to factoryFor', false || !options.namespace));
|
527 |
|
528 | if (options.source || options.namespace) {
|
529 | normalizedName = this.registry.expandLocalLookup(fullName, options);
|
530 |
|
531 | if (!normalizedName) {
|
532 | return;
|
533 | }
|
534 | }
|
535 |
|
536 | return factoryFor(this, normalizedName, fullName);
|
537 | }
|
538 |
|
539 | }
|
540 |
|
541 | _exports.Container = Container;
|
542 |
|
543 | if (true
|
544 |
|
545 | ) {
|
546 | Container._leakTracking = leakTracking;
|
547 | }
|
548 | |
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 | function wrapManagerInDeprecationProxy(manager) {
|
555 | if (_utils.HAS_NATIVE_PROXY) {
|
556 | var validator = {
|
557 | set(_obj, prop) {
|
558 | throw new Error(`You attempted to set "${prop}" on a factory manager created by container#factoryFor. A factory manager is a read-only construct.`);
|
559 | }
|
560 |
|
561 | };
|
562 |
|
563 |
|
564 |
|
565 | var m = manager;
|
566 | var proxiedManager = {
|
567 | class: m.class,
|
568 |
|
569 | create(props) {
|
570 | return m.create(props);
|
571 | }
|
572 |
|
573 | };
|
574 | return new Proxy(proxiedManager, validator);
|
575 | }
|
576 |
|
577 | return manager;
|
578 | }
|
579 |
|
580 | function isSingleton(container, fullName) {
|
581 | return container.registry.getOption(fullName, 'singleton') !== false;
|
582 | }
|
583 |
|
584 | function isInstantiatable(container, fullName) {
|
585 | return container.registry.getOption(fullName, 'instantiate') !== false;
|
586 | }
|
587 |
|
588 | function lookup(container, fullName, options = {}) {
|
589 | (true && !(false
|
590 |
|
591 | || !options.namespace) && (0, _debug.assert)('EMBER_MODULE_UNIFICATION must be enabled to pass a namespace option to lookup', false || !options.namespace));
|
592 | var normalizedName = fullName;
|
593 |
|
594 | if (options.source || options.namespace) {
|
595 | normalizedName = container.registry.expandLocalLookup(fullName, options);
|
596 |
|
597 | if (!normalizedName) {
|
598 | return;
|
599 | }
|
600 | }
|
601 |
|
602 | if (options.singleton !== false) {
|
603 | var cached = container.cache[normalizedName];
|
604 |
|
605 | if (cached !== undefined) {
|
606 | return cached;
|
607 | }
|
608 | }
|
609 |
|
610 | return instantiateFactory(container, normalizedName, fullName, options);
|
611 | }
|
612 |
|
613 | function factoryFor(container, normalizedName, fullName) {
|
614 | var cached = container.factoryManagerCache[normalizedName];
|
615 |
|
616 | if (cached !== undefined) {
|
617 | return cached;
|
618 | }
|
619 |
|
620 | var factory = container.registry.resolve(normalizedName);
|
621 |
|
622 | if (factory === undefined) {
|
623 | return;
|
624 | }
|
625 |
|
626 | if (true
|
627 |
|
628 | && factory && typeof factory._onLookup === 'function') {
|
629 | factory._onLookup(fullName);
|
630 | }
|
631 |
|
632 | var manager = new FactoryManager(container, factory, fullName, normalizedName);
|
633 |
|
634 | if (true
|
635 |
|
636 | ) {
|
637 | manager = wrapManagerInDeprecationProxy(manager);
|
638 | }
|
639 |
|
640 | container.factoryManagerCache[normalizedName] = manager;
|
641 | return manager;
|
642 | }
|
643 |
|
644 | function isSingletonClass(container, fullName, {
|
645 | instantiate,
|
646 | singleton
|
647 | }) {
|
648 | return singleton !== false && !instantiate && isSingleton(container, fullName) && !isInstantiatable(container, fullName);
|
649 | }
|
650 |
|
651 | function isSingletonInstance(container, fullName, {
|
652 | instantiate,
|
653 | singleton
|
654 | }) {
|
655 | return singleton !== false && instantiate !== false && isSingleton(container, fullName) && isInstantiatable(container, fullName);
|
656 | }
|
657 |
|
658 | function isFactoryClass(container, fullname, {
|
659 | instantiate,
|
660 | singleton
|
661 | }) {
|
662 | return instantiate === false && (singleton === false || !isSingleton(container, fullname)) && !isInstantiatable(container, fullname);
|
663 | }
|
664 |
|
665 | function isFactoryInstance(container, fullName, {
|
666 | instantiate,
|
667 | singleton
|
668 | }) {
|
669 | return instantiate !== false && (singleton !== false || isSingleton(container, fullName)) && isInstantiatable(container, fullName);
|
670 | }
|
671 |
|
672 | function instantiateFactory(container, normalizedName, fullName, options) {
|
673 | var factoryManager = factoryFor(container, normalizedName, fullName);
|
674 |
|
675 | if (factoryManager === undefined) {
|
676 | return;
|
677 | }
|
678 |
|
679 |
|
680 |
|
681 | if (isSingletonInstance(container, fullName, options)) {
|
682 | var instance = container.cache[normalizedName] = factoryManager.create();
|
683 |
|
684 |
|
685 | if (container.isDestroying) {
|
686 | if (typeof instance.destroy === 'function') {
|
687 | instance.destroy();
|
688 | }
|
689 | }
|
690 |
|
691 | return instance;
|
692 | }
|
693 |
|
694 |
|
695 | if (isFactoryInstance(container, fullName, options)) {
|
696 | return factoryManager.create();
|
697 | }
|
698 |
|
699 |
|
700 | if (isSingletonClass(container, fullName, options) || isFactoryClass(container, fullName, options)) {
|
701 | return factoryManager.class;
|
702 | }
|
703 |
|
704 | throw new Error('Could not create factory');
|
705 | }
|
706 |
|
707 | function processInjections(container, injections, result) {
|
708 | if (true
|
709 |
|
710 | ) {
|
711 | container.registry.validateInjections(injections);
|
712 | }
|
713 |
|
714 | var hash = result.injections;
|
715 |
|
716 | for (var i = 0; i < injections.length; i++) {
|
717 | var {
|
718 | property,
|
719 | specifier,
|
720 | source
|
721 | } = injections[i];
|
722 |
|
723 | if (source) {
|
724 | hash[property] = lookup(container, specifier, {
|
725 | source
|
726 | });
|
727 | } else {
|
728 | hash[property] = lookup(container, specifier);
|
729 | }
|
730 |
|
731 | if (!result.isDynamic) {
|
732 | result.isDynamic = !isSingleton(container, specifier);
|
733 | }
|
734 | }
|
735 | }
|
736 |
|
737 | function buildInjections(container, typeInjections, injections) {
|
738 | var injectionsHash = {};
|
739 | (0, _owner.setOwner)(injectionsHash, container.owner);
|
740 | var result = {
|
741 | injections: injectionsHash,
|
742 | isDynamic: false
|
743 | };
|
744 |
|
745 | if (typeInjections !== undefined) {
|
746 | processInjections(container, typeInjections, result);
|
747 | }
|
748 |
|
749 | if (injections !== undefined) {
|
750 | processInjections(container, injections, result);
|
751 | }
|
752 |
|
753 | return result;
|
754 | }
|
755 |
|
756 | function injectionsFor(container, fullName) {
|
757 | var registry = container.registry;
|
758 | var [type] = fullName.split(':');
|
759 | var typeInjections = registry.getTypeInjections(type);
|
760 | var injections = registry.getInjections(fullName);
|
761 | return buildInjections(container, typeInjections, injections);
|
762 | }
|
763 |
|
764 | function destroyDestroyables(container) {
|
765 | var cache = container.cache;
|
766 | var keys = Object.keys(cache);
|
767 |
|
768 | for (var i = 0; i < keys.length; i++) {
|
769 | var key = keys[i];
|
770 | var value = cache[key];
|
771 |
|
772 | if (value.destroy) {
|
773 | value.destroy();
|
774 | }
|
775 | }
|
776 | }
|
777 |
|
778 | function resetCache(container) {
|
779 | container.cache = (0, _utils.dictionary)(null);
|
780 | container.factoryManagerCache = (0, _utils.dictionary)(null);
|
781 | }
|
782 |
|
783 | function resetMember(container, fullName) {
|
784 | var member = container.cache[fullName];
|
785 | delete container.factoryManagerCache[fullName];
|
786 |
|
787 | if (member) {
|
788 | delete container.cache[fullName];
|
789 |
|
790 | if (member.destroy) {
|
791 | member.destroy();
|
792 | }
|
793 | }
|
794 | }
|
795 |
|
796 | var INIT_FACTORY = (0, _utils.symbol)('INIT_FACTORY');
|
797 | _exports.INIT_FACTORY = INIT_FACTORY;
|
798 |
|
799 | function getFactoryFor(obj) {
|
800 | return obj[INIT_FACTORY];
|
801 | }
|
802 |
|
803 | function setFactoryFor(obj, factory) {
|
804 | obj[INIT_FACTORY] = factory;
|
805 | }
|
806 |
|
807 | class FactoryManager {
|
808 | constructor(container, factory, fullName, normalizedName) {
|
809 | this.container = container;
|
810 | this.owner = container.owner;
|
811 | this.class = factory;
|
812 | this.fullName = fullName;
|
813 | this.normalizedName = normalizedName;
|
814 | this.madeToString = undefined;
|
815 | this.injections = undefined;
|
816 | setFactoryFor(this, this);
|
817 | }
|
818 |
|
819 | toString() {
|
820 | if (this.madeToString === undefined) {
|
821 | this.madeToString = this.container.registry.makeToString(this.class, this.fullName);
|
822 | }
|
823 |
|
824 | return this.madeToString;
|
825 | }
|
826 |
|
827 | create(options) {
|
828 | var {
|
829 | container
|
830 | } = this;
|
831 |
|
832 | if (container.isDestroyed) {
|
833 | throw new Error(`Can not create new instances after the owner has been destroyed (you attempted to create ${this.fullName})`);
|
834 | }
|
835 |
|
836 | var props = this.injections;
|
837 |
|
838 | if (props === undefined) {
|
839 | var {
|
840 | injections,
|
841 | isDynamic
|
842 | } = injectionsFor(this.container, this.normalizedName);
|
843 | setFactoryFor(injections, this);
|
844 | props = injections;
|
845 |
|
846 | if (!isDynamic) {
|
847 | this.injections = injections;
|
848 | }
|
849 | }
|
850 |
|
851 | if (options !== undefined) {
|
852 | props = (0, _polyfills.assign)({}, props, options);
|
853 | }
|
854 |
|
855 | if (true
|
856 |
|
857 | ) {
|
858 | var lazyInjections;
|
859 | var validationCache = this.container.validationCache;
|
860 |
|
861 | if (!validationCache[this.fullName] && this.class && typeof this.class._lazyInjections === 'function') {
|
862 | lazyInjections = this.class._lazyInjections();
|
863 | lazyInjections = this.container.registry.normalizeInjectionsHash(lazyInjections);
|
864 | this.container.registry.validateInjections(lazyInjections);
|
865 | }
|
866 |
|
867 | validationCache[this.fullName] = true;
|
868 | (true && !(typeof this.class.create === 'function') && (0, _debug.assert)(`Failed to create an instance of '${this.normalizedName}'. Most likely an improperly defined class or an invalid module export.`, typeof this.class.create === 'function'));
|
869 | }
|
870 |
|
871 | return this.class.create(props);
|
872 | }
|
873 |
|
874 | }
|
875 |
|
876 | var VALID_FULL_NAME_REGEXP = /^[^:]+:[^:]+$/;
|
877 | |
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 | class Registry {
|
892 | constructor(options = {}) {
|
893 | this.fallback = options.fallback || null;
|
894 | this.resolver = options.resolver || null;
|
895 | this.registrations = (0, _utils.dictionary)(options.registrations || null);
|
896 | this._typeInjections = (0, _utils.dictionary)(null);
|
897 | this._injections = (0, _utils.dictionary)(null);
|
898 | this._localLookupCache = Object.create(null);
|
899 | this._normalizeCache = (0, _utils.dictionary)(null);
|
900 | this._resolveCache = (0, _utils.dictionary)(null);
|
901 | this._failSet = new Set();
|
902 | this._options = (0, _utils.dictionary)(null);
|
903 | this._typeOptions = (0, _utils.dictionary)(null);
|
904 | }
|
905 | |
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 | |
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 | |
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 | |
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 | |
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 | |
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 | |
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 | |
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 | |
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 | |
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 | container(options) {
|
971 | return new Container(this, options);
|
972 | }
|
973 | |
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 | register(fullName, factory, options = {}) {
|
991 | (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));
|
992 | (true && !(factory !== undefined) && (0, _debug.assert)(`Attempting to register an unknown factory: '${fullName}'`, factory !== undefined));
|
993 | var normalizedName = this.normalize(fullName);
|
994 | (true && !(!this._resolveCache[normalizedName]) && (0, _debug.assert)(`Cannot re-register: '${fullName}', as it has already been resolved.`, !this._resolveCache[normalizedName]));
|
995 |
|
996 | this._failSet.delete(normalizedName);
|
997 |
|
998 | this.registrations[normalizedName] = factory;
|
999 | this._options[normalizedName] = options;
|
1000 | }
|
1001 | |
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 | unregister(fullName) {
|
1017 | (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));
|
1018 | var normalizedName = this.normalize(fullName);
|
1019 | this._localLookupCache = Object.create(null);
|
1020 | delete this.registrations[normalizedName];
|
1021 | delete this._resolveCache[normalizedName];
|
1022 | delete this._options[normalizedName];
|
1023 |
|
1024 | this._failSet.delete(normalizedName);
|
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 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 | resolve(fullName, options) {
|
1057 | var factory = resolve(this, this.normalize(fullName), options);
|
1058 |
|
1059 | if (factory === undefined && this.fallback !== null) {
|
1060 | factory = this.fallback.resolve(...arguments);
|
1061 | }
|
1062 |
|
1063 | return factory;
|
1064 | }
|
1065 | |
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 | describe(fullName) {
|
1079 | if (this.resolver !== null && this.resolver.lookupDescription) {
|
1080 | return this.resolver.lookupDescription(fullName);
|
1081 | } else if (this.fallback !== null) {
|
1082 | return this.fallback.describe(fullName);
|
1083 | } else {
|
1084 | return fullName;
|
1085 | }
|
1086 | }
|
1087 | |
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 | normalizeFullName(fullName) {
|
1097 | if (this.resolver !== null && this.resolver.normalize) {
|
1098 | return this.resolver.normalize(fullName);
|
1099 | } else if (this.fallback !== null) {
|
1100 | return this.fallback.normalizeFullName(fullName);
|
1101 | } else {
|
1102 | return fullName;
|
1103 | }
|
1104 | }
|
1105 | |
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 | normalize(fullName) {
|
1115 | return this._normalizeCache[fullName] || (this._normalizeCache[fullName] = this.normalizeFullName(fullName));
|
1116 | }
|
1117 | |
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 | makeToString(factory, fullName) {
|
1127 | if (this.resolver !== null && this.resolver.makeToString) {
|
1128 | return this.resolver.makeToString(factory, fullName);
|
1129 | } else if (this.fallback !== null) {
|
1130 | return this.fallback.makeToString(factory, fullName);
|
1131 | } else {
|
1132 | return factory.toString();
|
1133 | }
|
1134 | }
|
1135 | |
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 | has(fullName, options) {
|
1148 | if (!this.isValidFullName(fullName)) {
|
1149 | return false;
|
1150 | }
|
1151 |
|
1152 | var source = options && options.source && this.normalize(options.source);
|
1153 | var namespace = options && options.namespace || undefined;
|
1154 | return has(this, this.normalize(fullName), source, namespace);
|
1155 | }
|
1156 | |
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 | optionsForType(type, options) {
|
1180 | this._typeOptions[type] = options;
|
1181 | }
|
1182 |
|
1183 | getOptionsForType(type) {
|
1184 | var optionsForType = this._typeOptions[type];
|
1185 |
|
1186 | if (optionsForType === undefined && this.fallback !== null) {
|
1187 | optionsForType = this.fallback.getOptionsForType(type);
|
1188 | }
|
1189 |
|
1190 | return optionsForType;
|
1191 | }
|
1192 | |
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 |
|
1200 | options(fullName, options) {
|
1201 | var normalizedName = this.normalize(fullName);
|
1202 | this._options[normalizedName] = options;
|
1203 | }
|
1204 |
|
1205 | getOptions(fullName) {
|
1206 | var normalizedName = this.normalize(fullName);
|
1207 | var options = this._options[normalizedName];
|
1208 |
|
1209 | if (options === undefined && this.fallback !== null) {
|
1210 | options = this.fallback.getOptions(fullName);
|
1211 | }
|
1212 |
|
1213 | return options;
|
1214 | }
|
1215 |
|
1216 | getOption(fullName, optionName) {
|
1217 | var options = this._options[fullName];
|
1218 |
|
1219 | if (options !== undefined && options[optionName] !== undefined) {
|
1220 | return options[optionName];
|
1221 | }
|
1222 |
|
1223 | var type = fullName.split(':')[0];
|
1224 | options = this._typeOptions[type];
|
1225 |
|
1226 | if (options && options[optionName] !== undefined) {
|
1227 | return options[optionName];
|
1228 | } else if (this.fallback !== null) {
|
1229 | return this.fallback.getOption(fullName, optionName);
|
1230 | }
|
1231 |
|
1232 | return undefined;
|
1233 | }
|
1234 | |
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 | typeInjection(type, property, fullName) {
|
1264 | (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));
|
1265 | var fullNameType = fullName.split(':')[0];
|
1266 | (true && !(fullNameType !== type) && (0, _debug.assert)(`Cannot inject a '${fullName}' on other ${type}(s).`, fullNameType !== type));
|
1267 | var injections = this._typeInjections[type] || (this._typeInjections[type] = []);
|
1268 | injections.push({
|
1269 | property,
|
1270 | specifier: fullName
|
1271 | });
|
1272 | }
|
1273 | |
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 | injection(fullName, property, injectionName) {
|
1309 | (true && !(this.isValidFullName(injectionName)) && (0, _debug.assert)(`Invalid injectionName, expected: 'type:name' got: ${injectionName}`, this.isValidFullName(injectionName)));
|
1310 | var normalizedInjectionName = this.normalize(injectionName);
|
1311 |
|
1312 | if (fullName.indexOf(':') === -1) {
|
1313 | return this.typeInjection(fullName, property, normalizedInjectionName);
|
1314 | }
|
1315 |
|
1316 | (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));
|
1317 | var normalizedName = this.normalize(fullName);
|
1318 | var injections = this._injections[normalizedName] || (this._injections[normalizedName] = []);
|
1319 | injections.push({
|
1320 | property,
|
1321 | specifier: normalizedInjectionName
|
1322 | });
|
1323 | }
|
1324 | |
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 | knownForType(type) {
|
1332 | var localKnown = (0, _utils.dictionary)(null);
|
1333 | var registeredNames = Object.keys(this.registrations);
|
1334 |
|
1335 | for (var index = 0; index < registeredNames.length; index++) {
|
1336 | var fullName = registeredNames[index];
|
1337 | var itemType = fullName.split(':')[0];
|
1338 |
|
1339 | if (itemType === type) {
|
1340 | localKnown[fullName] = true;
|
1341 | }
|
1342 | }
|
1343 |
|
1344 | var fallbackKnown, resolverKnown;
|
1345 |
|
1346 | if (this.fallback !== null) {
|
1347 | fallbackKnown = this.fallback.knownForType(type);
|
1348 | }
|
1349 |
|
1350 | if (this.resolver !== null && this.resolver.knownForType) {
|
1351 | resolverKnown = this.resolver.knownForType(type);
|
1352 | }
|
1353 |
|
1354 | return (0, _polyfills.assign)({}, fallbackKnown, localKnown, resolverKnown);
|
1355 | }
|
1356 |
|
1357 | isValidFullName(fullName) {
|
1358 | return VALID_FULL_NAME_REGEXP.test(fullName);
|
1359 | }
|
1360 |
|
1361 | getInjections(fullName) {
|
1362 | var injections = this._injections[fullName];
|
1363 |
|
1364 | if (this.fallback !== null) {
|
1365 | var fallbackInjections = this.fallback.getInjections(fullName);
|
1366 |
|
1367 | if (fallbackInjections !== undefined) {
|
1368 | injections = injections === undefined ? fallbackInjections : injections.concat(fallbackInjections);
|
1369 | }
|
1370 | }
|
1371 |
|
1372 | return injections;
|
1373 | }
|
1374 |
|
1375 | getTypeInjections(type) {
|
1376 | var injections = this._typeInjections[type];
|
1377 |
|
1378 | if (this.fallback !== null) {
|
1379 | var fallbackInjections = this.fallback.getTypeInjections(type);
|
1380 |
|
1381 | if (fallbackInjections !== undefined) {
|
1382 | injections = injections === undefined ? fallbackInjections : injections.concat(fallbackInjections);
|
1383 | }
|
1384 | }
|
1385 |
|
1386 | return injections;
|
1387 | }
|
1388 | |
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 | expandLocalLookup(fullName, options) {
|
1406 | if (this.resolver !== null && this.resolver.expandLocalLookup) {
|
1407 | (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));
|
1408 | (true && !(!options.source || this.isValidFullName(options.source)) && (0, _debug.assert)('options.source must be a proper full name', !options.source || this.isValidFullName(options.source)));
|
1409 | var normalizedFullName = this.normalize(fullName);
|
1410 | var normalizedSource = this.normalize(options.source);
|
1411 | return expandLocalLookup(this, normalizedFullName, normalizedSource, options.namespace);
|
1412 | } else if (this.fallback !== null) {
|
1413 | return this.fallback.expandLocalLookup(fullName, options);
|
1414 | } else {
|
1415 | return null;
|
1416 | }
|
1417 | }
|
1418 |
|
1419 | }
|
1420 |
|
1421 | _exports.Registry = Registry;
|
1422 |
|
1423 | if (true
|
1424 |
|
1425 | ) {
|
1426 | var proto = Registry.prototype;
|
1427 |
|
1428 | proto.normalizeInjectionsHash = function (hash) {
|
1429 | var injections = [];
|
1430 |
|
1431 | for (var key in hash) {
|
1432 | if (Object.prototype.hasOwnProperty.call(hash, key)) {
|
1433 | var {
|
1434 | specifier,
|
1435 | source,
|
1436 | namespace
|
1437 | } = hash[key];
|
1438 | (true && !(this.isValidFullName(specifier)) && (0, _debug.assert)(`Expected a proper full name, given '${specifier}'`, this.isValidFullName(specifier)));
|
1439 | injections.push({
|
1440 | property: key,
|
1441 | specifier,
|
1442 | source,
|
1443 | namespace
|
1444 | });
|
1445 | }
|
1446 | }
|
1447 |
|
1448 | return injections;
|
1449 | };
|
1450 |
|
1451 | proto.validateInjections = function (injections) {
|
1452 | if (!injections) {
|
1453 | return;
|
1454 | }
|
1455 |
|
1456 | for (var i = 0; i < injections.length; i++) {
|
1457 | var {
|
1458 | specifier,
|
1459 | source,
|
1460 | namespace
|
1461 | } = injections[i];
|
1462 | (true && !(this.has(specifier, {
|
1463 | source,
|
1464 | namespace
|
1465 | })) && (0, _debug.assert)(`Attempting to inject an unknown injection: '${specifier}'`, this.has(specifier, {
|
1466 | source,
|
1467 | namespace
|
1468 | })));
|
1469 | }
|
1470 | };
|
1471 | }
|
1472 |
|
1473 | function expandLocalLookup(registry, normalizedName, normalizedSource, namespace) {
|
1474 | var cache = registry._localLookupCache;
|
1475 | var normalizedNameCache = cache[normalizedName];
|
1476 |
|
1477 | if (!normalizedNameCache) {
|
1478 | normalizedNameCache = cache[normalizedName] = Object.create(null);
|
1479 | }
|
1480 |
|
1481 | var cacheKey = namespace || normalizedSource;
|
1482 | var cached = normalizedNameCache[cacheKey];
|
1483 |
|
1484 | if (cached !== undefined) {
|
1485 | return cached;
|
1486 | }
|
1487 |
|
1488 | var expanded = registry.resolver.expandLocalLookup(normalizedName, normalizedSource, namespace);
|
1489 | return normalizedNameCache[cacheKey] = expanded;
|
1490 | }
|
1491 |
|
1492 | function resolve(registry, _normalizedName, options) {
|
1493 | var normalizedName = _normalizedName;
|
1494 |
|
1495 |
|
1496 | if (options !== undefined && (options.source || options.namespace)) {
|
1497 | normalizedName = registry.expandLocalLookup(_normalizedName, options);
|
1498 |
|
1499 | if (!normalizedName) {
|
1500 | return;
|
1501 | }
|
1502 | }
|
1503 |
|
1504 | var cached = registry._resolveCache[normalizedName];
|
1505 |
|
1506 | if (cached !== undefined) {
|
1507 | return cached;
|
1508 | }
|
1509 |
|
1510 | if (registry._failSet.has(normalizedName)) {
|
1511 | return;
|
1512 | }
|
1513 |
|
1514 | var resolved;
|
1515 |
|
1516 | if (registry.resolver) {
|
1517 | resolved = registry.resolver.resolve(normalizedName);
|
1518 | }
|
1519 |
|
1520 | if (resolved === undefined) {
|
1521 | resolved = registry.registrations[normalizedName];
|
1522 | }
|
1523 |
|
1524 | if (resolved === undefined) {
|
1525 | registry._failSet.add(normalizedName);
|
1526 | } else {
|
1527 | registry._resolveCache[normalizedName] = resolved;
|
1528 | }
|
1529 |
|
1530 | return resolved;
|
1531 | }
|
1532 |
|
1533 | function has(registry, fullName, source, namespace) {
|
1534 | return registry.resolve(fullName, {
|
1535 | source,
|
1536 | namespace
|
1537 | }) !== undefined;
|
1538 | }
|
1539 |
|
1540 | var privateNames = (0, _utils.dictionary)(null);
|
1541 | var privateSuffix = `${Math.random()}${Date.now()}`.replace('.', '');
|
1542 |
|
1543 | function privatize([fullName]) {
|
1544 | var name = privateNames[fullName];
|
1545 |
|
1546 | if (name) {
|
1547 | return name;
|
1548 | }
|
1549 |
|
1550 | var [type, rawName] = fullName.split(':');
|
1551 | return privateNames[fullName] = (0, _utils.intern)(`${type}:${rawName}-${privateSuffix}`);
|
1552 | }
|
1553 | |
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 | });
|
1561 | define("@ember/-internals/environment/index", ["exports", "@ember/deprecated-features"], function (_exports, _deprecatedFeatures) {
|
1562 | "use strict";
|
1563 |
|
1564 | Object.defineProperty(_exports, "__esModule", {
|
1565 | value: true
|
1566 | });
|
1567 | _exports.getLookup = getLookup;
|
1568 | _exports.setLookup = setLookup;
|
1569 | _exports.getENV = getENV;
|
1570 | _exports.ENV = _exports.context = _exports.global = void 0;
|
1571 |
|
1572 |
|
1573 | function checkGlobal(value) {
|
1574 | return value && value.Object === Object ? value : undefined;
|
1575 | }
|
1576 |
|
1577 |
|
1578 | function checkElementIdShadowing(value) {
|
1579 | return value && value.nodeType === undefined ? value : undefined;
|
1580 | }
|
1581 |
|
1582 |
|
1583 | var global$1 = checkGlobal(checkElementIdShadowing(typeof global === 'object' && global)) || checkGlobal(typeof self === 'object' && self) || checkGlobal(typeof window === 'object' && window) || typeof mainContext !== 'undefined' && mainContext ||
|
1584 | new Function('return this')();
|
1585 |
|
1586 | _exports.global = global$1;
|
1587 |
|
1588 | var context = function (global, Ember) {
|
1589 | return Ember === undefined ? {
|
1590 | imports: global,
|
1591 | exports: global,
|
1592 | lookup: global
|
1593 | } : {
|
1594 |
|
1595 | imports: Ember.imports || global,
|
1596 |
|
1597 | exports: Ember.exports || global,
|
1598 |
|
1599 | lookup: Ember.lookup || global
|
1600 | };
|
1601 | }(global$1, global$1.Ember);
|
1602 |
|
1603 | _exports.context = context;
|
1604 |
|
1605 | function getLookup() {
|
1606 | return context.lookup;
|
1607 | }
|
1608 |
|
1609 | function setLookup(value) {
|
1610 | context.lookup = value;
|
1611 | }
|
1612 | |
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 |
|
1623 |
|
1624 |
|
1625 | var ENV = {
|
1626 | ENABLE_OPTIONAL_FEATURES: false,
|
1627 |
|
1628 | |
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 | EXTEND_PROTOTYPES: {
|
1645 | Array: true,
|
1646 | Function: true,
|
1647 | String: true
|
1648 | },
|
1649 |
|
1650 | |
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 | LOG_STACKTRACE_ON_DEPRECATION: true,
|
1660 |
|
1661 | |
1662 |
|
1663 |
|
1664 |
|
1665 |
|
1666 |
|
1667 |
|
1668 |
|
1669 |
|
1670 | LOG_VERSION: true,
|
1671 | RAISE_ON_DEPRECATION: false,
|
1672 | STRUCTURED_PROFILE: false,
|
1673 |
|
1674 | |
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 | _APPLICATION_TEMPLATE_WRAPPER: true,
|
1686 |
|
1687 | |
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 | _TEMPLATE_ONLY_GLIMMER_COMPONENTS: false,
|
1699 |
|
1700 | |
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 | _DEBUG_RENDER_TREE: true
|
1724 |
|
1725 | ,
|
1726 |
|
1727 | |
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 | _JQUERY_INTEGRATION: true,
|
1738 |
|
1739 | |
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 | _DEFAULT_ASYNC_OBSERVERS: false,
|
1750 |
|
1751 | |
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 | _RERENDER_LOOP_LIMIT: 1000,
|
1762 | EMBER_LOAD_HOOKS: {},
|
1763 | FEATURES: {}
|
1764 | };
|
1765 | _exports.ENV = ENV;
|
1766 |
|
1767 | (EmberENV => {
|
1768 | if (typeof EmberENV !== 'object' || EmberENV === null) return;
|
1769 |
|
1770 | for (var flag in EmberENV) {
|
1771 | if (!Object.prototype.hasOwnProperty.call(EmberENV, flag) || flag === 'EXTEND_PROTOTYPES' || flag === 'EMBER_LOAD_HOOKS') continue;
|
1772 | var defaultValue = ENV[flag];
|
1773 |
|
1774 | if (defaultValue === true) {
|
1775 | ENV[flag] = EmberENV[flag] !== false;
|
1776 | } else if (defaultValue === false) {
|
1777 | ENV[flag] = EmberENV[flag] === true;
|
1778 | }
|
1779 | }
|
1780 |
|
1781 | var {
|
1782 | EXTEND_PROTOTYPES
|
1783 | } = EmberENV;
|
1784 |
|
1785 | if (EXTEND_PROTOTYPES !== undefined) {
|
1786 | if (typeof EXTEND_PROTOTYPES === 'object' && EXTEND_PROTOTYPES !== null) {
|
1787 | ENV.EXTEND_PROTOTYPES.String = EXTEND_PROTOTYPES.String !== false;
|
1788 |
|
1789 | if (_deprecatedFeatures.FUNCTION_PROTOTYPE_EXTENSIONS) {
|
1790 | ENV.EXTEND_PROTOTYPES.Function = EXTEND_PROTOTYPES.Function !== false;
|
1791 | }
|
1792 |
|
1793 | ENV.EXTEND_PROTOTYPES.Array = EXTEND_PROTOTYPES.Array !== false;
|
1794 | } else {
|
1795 | var isEnabled = EXTEND_PROTOTYPES !== false;
|
1796 | ENV.EXTEND_PROTOTYPES.String = isEnabled;
|
1797 |
|
1798 | if (_deprecatedFeatures.FUNCTION_PROTOTYPE_EXTENSIONS) {
|
1799 | ENV.EXTEND_PROTOTYPES.Function = isEnabled;
|
1800 | }
|
1801 |
|
1802 | ENV.EXTEND_PROTOTYPES.Array = isEnabled;
|
1803 | }
|
1804 | }
|
1805 |
|
1806 |
|
1807 |
|
1808 | var {
|
1809 | EMBER_LOAD_HOOKS
|
1810 | } = EmberENV;
|
1811 |
|
1812 | if (typeof EMBER_LOAD_HOOKS === 'object' && EMBER_LOAD_HOOKS !== null) {
|
1813 | for (var hookName in EMBER_LOAD_HOOKS) {
|
1814 | if (!Object.prototype.hasOwnProperty.call(EMBER_LOAD_HOOKS, hookName)) continue;
|
1815 | var hooks = EMBER_LOAD_HOOKS[hookName];
|
1816 |
|
1817 | if (Array.isArray(hooks)) {
|
1818 | ENV.EMBER_LOAD_HOOKS[hookName] = hooks.filter(hook => typeof hook === 'function');
|
1819 | }
|
1820 | }
|
1821 | }
|
1822 |
|
1823 | var {
|
1824 | FEATURES
|
1825 | } = EmberENV;
|
1826 |
|
1827 | if (typeof FEATURES === 'object' && FEATURES !== null) {
|
1828 | for (var feature in FEATURES) {
|
1829 | if (!Object.prototype.hasOwnProperty.call(FEATURES, feature)) continue;
|
1830 | ENV.FEATURES[feature] = FEATURES[feature] === true;
|
1831 | }
|
1832 | }
|
1833 |
|
1834 | if (true
|
1835 |
|
1836 | ) {
|
1837 | ENV._DEBUG_RENDER_TREE = true;
|
1838 | }
|
1839 | })(global$1.EmberENV);
|
1840 |
|
1841 | function getENV() {
|
1842 | return ENV;
|
1843 | }
|
1844 | });
|
1845 | define("@ember/-internals/error-handling/index", ["exports"], function (_exports) {
|
1846 | "use strict";
|
1847 |
|
1848 | Object.defineProperty(_exports, "__esModule", {
|
1849 | value: true
|
1850 | });
|
1851 | _exports.getOnerror = getOnerror;
|
1852 | _exports.setOnerror = setOnerror;
|
1853 | _exports.getDispatchOverride = getDispatchOverride;
|
1854 | _exports.setDispatchOverride = setDispatchOverride;
|
1855 | _exports.onErrorTarget = void 0;
|
1856 | var onerror;
|
1857 | var onErrorTarget = {
|
1858 | get onerror() {
|
1859 | return onerror;
|
1860 | }
|
1861 |
|
1862 | };
|
1863 |
|
1864 | _exports.onErrorTarget = onErrorTarget;
|
1865 |
|
1866 | function getOnerror() {
|
1867 | return onerror;
|
1868 | }
|
1869 |
|
1870 |
|
1871 | function setOnerror(handler) {
|
1872 | onerror = handler;
|
1873 | }
|
1874 |
|
1875 | var dispatchOverride;
|
1876 |
|
1877 | function getDispatchOverride() {
|
1878 | return dispatchOverride;
|
1879 | }
|
1880 |
|
1881 | function setDispatchOverride(handler) {
|
1882 | dispatchOverride = handler;
|
1883 | }
|
1884 | });
|
1885 | define("@ember/-internals/extension-support/index", ["exports", "@ember/-internals/extension-support/lib/data_adapter", "@ember/-internals/extension-support/lib/container_debug_adapter"], function (_exports, _data_adapter, _container_debug_adapter) {
|
1886 | "use strict";
|
1887 |
|
1888 | Object.defineProperty(_exports, "__esModule", {
|
1889 | value: true
|
1890 | });
|
1891 | Object.defineProperty(_exports, "DataAdapter", {
|
1892 | enumerable: true,
|
1893 | get: function () {
|
1894 | return _data_adapter.default;
|
1895 | }
|
1896 | });
|
1897 | Object.defineProperty(_exports, "ContainerDebugAdapter", {
|
1898 | enumerable: true,
|
1899 | get: function () {
|
1900 | return _container_debug_adapter.default;
|
1901 | }
|
1902 | });
|
1903 | });
|
1904 | define("@ember/-internals/extension-support/lib/container_debug_adapter", ["exports", "@ember/string", "@ember/-internals/runtime"], function (_exports, _string, _runtime) {
|
1905 | "use strict";
|
1906 |
|
1907 | Object.defineProperty(_exports, "__esModule", {
|
1908 | value: true
|
1909 | });
|
1910 | _exports.default = void 0;
|
1911 |
|
1912 | |
1913 |
|
1914 |
|
1915 |
|
1916 | |
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 | var _default = _runtime.Object.extend({
|
1951 | |
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 | resolver: null,
|
1960 |
|
1961 | |
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 | canCatalogEntriesByType(type) {
|
1970 | if (type === 'model' || type === 'template') {
|
1971 | return false;
|
1972 | }
|
1973 |
|
1974 | return true;
|
1975 | },
|
1976 |
|
1977 | |
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 | catalogEntriesByType(type) {
|
1985 | var namespaces = (0, _runtime.A)(_runtime.Namespace.NAMESPACES);
|
1986 | var types = (0, _runtime.A)();
|
1987 | var typeSuffixRegex = new RegExp(`${(0, _string.classify)(type)}$`);
|
1988 | namespaces.forEach(namespace => {
|
1989 | for (var key in namespace) {
|
1990 | if (!Object.prototype.hasOwnProperty.call(namespace, key)) {
|
1991 | continue;
|
1992 | }
|
1993 |
|
1994 | if (typeSuffixRegex.test(key)) {
|
1995 | var klass = namespace[key];
|
1996 |
|
1997 | if ((0, _runtime.typeOf)(klass) === 'class') {
|
1998 | types.push((0, _string.dasherize)(key.replace(typeSuffixRegex, '')));
|
1999 | }
|
2000 | }
|
2001 | }
|
2002 | });
|
2003 | return types;
|
2004 | }
|
2005 |
|
2006 | });
|
2007 |
|
2008 | _exports.default = _default;
|
2009 | });
|
2010 | define("@ember/-internals/extension-support/lib/data_adapter", ["exports", "@ember/-internals/owner", "@ember/runloop", "@ember/-internals/metal", "@ember/string", "@ember/-internals/runtime"], function (_exports, _owner, _runloop, _metal, _string, _runtime) {
|
2011 | "use strict";
|
2012 |
|
2013 | Object.defineProperty(_exports, "__esModule", {
|
2014 | value: true
|
2015 | });
|
2016 | _exports.default = void 0;
|
2017 |
|
2018 | |
2019 |
|
2020 |
|
2021 |
|
2022 | |
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 |
|
2031 |
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 | var _default = _runtime.Object.extend({
|
2064 | init() {
|
2065 | this._super(...arguments);
|
2066 |
|
2067 | this.releaseMethods = (0, _runtime.A)();
|
2068 | },
|
2069 |
|
2070 | |
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 | containerDebugAdapter: undefined,
|
2079 |
|
2080 | |
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 | attributeLimit: 3,
|
2090 |
|
2091 | |
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 | acceptsModelName: true,
|
2102 |
|
2103 | |
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 | releaseMethods: (0, _runtime.A)(),
|
2111 |
|
2112 | |
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 | getFilters() {
|
2122 | return (0, _runtime.A)();
|
2123 | },
|
2124 |
|
2125 | |
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 |
|
2133 |
|
2134 |
|
2135 | watchModelTypes(typesAdded, typesUpdated) {
|
2136 | var modelTypes = this.getModelTypes();
|
2137 | var releaseMethods = (0, _runtime.A)();
|
2138 | var typesToSend;
|
2139 | typesToSend = modelTypes.map(type => {
|
2140 | var klass = type.klass;
|
2141 | var wrapped = this.wrapModelType(klass, type.name);
|
2142 | releaseMethods.push(this.observeModelType(type.name, typesUpdated));
|
2143 | return wrapped;
|
2144 | });
|
2145 | typesAdded(typesToSend);
|
2146 |
|
2147 | var release = () => {
|
2148 | releaseMethods.forEach(fn => fn());
|
2149 | this.releaseMethods.removeObject(release);
|
2150 | };
|
2151 |
|
2152 | this.releaseMethods.pushObject(release);
|
2153 | return release;
|
2154 | },
|
2155 |
|
2156 | _nameToClass(type) {
|
2157 | if (typeof type === 'string') {
|
2158 | var owner = (0, _owner.getOwner)(this);
|
2159 | var Factory = owner.factoryFor(`model:${type}`);
|
2160 | type = Factory && Factory.class;
|
2161 | }
|
2162 |
|
2163 | return type;
|
2164 | },
|
2165 |
|
2166 | |
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 |
|
2184 | watchRecords(modelName, recordsAdded, recordsUpdated, recordsRemoved) {
|
2185 | var releaseMethods = (0, _runtime.A)();
|
2186 |
|
2187 | var klass = this._nameToClass(modelName);
|
2188 |
|
2189 | var records = this.getRecords(klass, modelName);
|
2190 | var release;
|
2191 |
|
2192 | function recordUpdated(updatedRecord) {
|
2193 | recordsUpdated([updatedRecord]);
|
2194 | }
|
2195 |
|
2196 | var recordsToSend = records.map(record => {
|
2197 | releaseMethods.push(this.observeRecord(record, recordUpdated));
|
2198 | return this.wrapRecord(record);
|
2199 | });
|
2200 |
|
2201 | var contentDidChange = (array, idx, removedCount, addedCount) => {
|
2202 | for (var i = idx; i < idx + addedCount; i++) {
|
2203 | var record = (0, _metal.objectAt)(array, i);
|
2204 | var wrapped = this.wrapRecord(record);
|
2205 | releaseMethods.push(this.observeRecord(record, recordUpdated));
|
2206 | recordsAdded([wrapped]);
|
2207 | }
|
2208 |
|
2209 | if (removedCount) {
|
2210 | recordsRemoved(idx, removedCount);
|
2211 | }
|
2212 | };
|
2213 |
|
2214 | var observer = {
|
2215 | didChange: contentDidChange,
|
2216 |
|
2217 | willChange() {
|
2218 | return this;
|
2219 | }
|
2220 |
|
2221 | };
|
2222 | (0, _metal.addArrayObserver)(records, this, observer);
|
2223 |
|
2224 | release = () => {
|
2225 | releaseMethods.forEach(fn => fn());
|
2226 | (0, _metal.removeArrayObserver)(records, this, observer);
|
2227 | this.releaseMethods.removeObject(release);
|
2228 | };
|
2229 |
|
2230 | recordsAdded(recordsToSend);
|
2231 | this.releaseMethods.pushObject(release);
|
2232 | return release;
|
2233 | },
|
2234 |
|
2235 | |
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 | willDestroy() {
|
2241 | this._super(...arguments);
|
2242 |
|
2243 | this.releaseMethods.forEach(fn => fn());
|
2244 | },
|
2245 |
|
2246 | |
2247 |
|
2248 |
|
2249 |
|
2250 |
|
2251 |
|
2252 |
|
2253 |
|
2254 | detect() {
|
2255 | return false;
|
2256 | },
|
2257 |
|
2258 | |
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 | columnsForType() {
|
2267 | return (0, _runtime.A)();
|
2268 | },
|
2269 |
|
2270 | |
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 | observeModelType(modelName, typesUpdated) {
|
2279 | var klass = this._nameToClass(modelName);
|
2280 |
|
2281 | var records = this.getRecords(klass, modelName);
|
2282 |
|
2283 | function onChange() {
|
2284 | typesUpdated([this.wrapModelType(klass, modelName)]);
|
2285 | }
|
2286 |
|
2287 | var observer = {
|
2288 | didChange(array, idx, removedCount, addedCount) {
|
2289 |
|
2290 |
|
2291 | if (removedCount > 0 || addedCount > 0) {
|
2292 | (0, _runloop.scheduleOnce)('actions', this, onChange);
|
2293 | }
|
2294 | },
|
2295 |
|
2296 | willChange() {
|
2297 | return this;
|
2298 | }
|
2299 |
|
2300 | };
|
2301 | (0, _metal.addArrayObserver)(records, this, observer);
|
2302 |
|
2303 | var release = () => (0, _metal.removeArrayObserver)(records, this, observer);
|
2304 |
|
2305 | return release;
|
2306 | },
|
2307 |
|
2308 | |
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 | wrapModelType(klass, name) {
|
2325 | var records = this.getRecords(klass, name);
|
2326 | var typeToSend;
|
2327 | typeToSend = {
|
2328 | name,
|
2329 | count: (0, _metal.get)(records, 'length'),
|
2330 | columns: this.columnsForType(klass),
|
2331 | object: klass
|
2332 | };
|
2333 | return typeToSend;
|
2334 | },
|
2335 |
|
2336 | |
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 | getModelTypes() {
|
2343 | var containerDebugAdapter = this.get('containerDebugAdapter');
|
2344 | var types;
|
2345 |
|
2346 | if (containerDebugAdapter.canCatalogEntriesByType('model')) {
|
2347 | types = containerDebugAdapter.catalogEntriesByType('model');
|
2348 | } else {
|
2349 | types = this._getObjectsOnNamespaces();
|
2350 | }
|
2351 |
|
2352 |
|
2353 | types = (0, _runtime.A)(types).map(name => {
|
2354 | return {
|
2355 | klass: this._nameToClass(name),
|
2356 | name
|
2357 | };
|
2358 | });
|
2359 | types = (0, _runtime.A)(types).filter(type => this.detect(type.klass));
|
2360 | return (0, _runtime.A)(types);
|
2361 | },
|
2362 |
|
2363 | |
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 | _getObjectsOnNamespaces() {
|
2371 | var namespaces = (0, _runtime.A)(_runtime.Namespace.NAMESPACES);
|
2372 | var types = (0, _runtime.A)();
|
2373 | namespaces.forEach(namespace => {
|
2374 | for (var key in namespace) {
|
2375 | if (!Object.prototype.hasOwnProperty.call(namespace, key)) {
|
2376 | continue;
|
2377 | }
|
2378 |
|
2379 |
|
2380 |
|
2381 | if (!this.detect(namespace[key])) {
|
2382 | continue;
|
2383 | }
|
2384 |
|
2385 | var name = (0, _string.dasherize)(key);
|
2386 | types.push(name);
|
2387 | }
|
2388 | });
|
2389 | return types;
|
2390 | },
|
2391 |
|
2392 | |
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 | getRecords() {
|
2401 | return (0, _runtime.A)();
|
2402 | },
|
2403 |
|
2404 | |
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 | wrapRecord(record) {
|
2414 | var recordToSend = {
|
2415 | object: record
|
2416 | };
|
2417 | recordToSend.columnValues = this.getRecordColumnValues(record);
|
2418 | recordToSend.searchKeywords = this.getRecordKeywords(record);
|
2419 | recordToSend.filterValues = this.getRecordFilterValues(record);
|
2420 | recordToSend.color = this.getRecordColor(record);
|
2421 | return recordToSend;
|
2422 | },
|
2423 |
|
2424 | |
2425 |
|
2426 |
|
2427 |
|
2428 |
|
2429 |
|
2430 |
|
2431 | getRecordColumnValues() {
|
2432 | return {};
|
2433 | },
|
2434 |
|
2435 | |
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 | getRecordKeywords() {
|
2442 | return (0, _runtime.A)();
|
2443 | },
|
2444 |
|
2445 | |
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 | getRecordFilterValues() {
|
2453 | return {};
|
2454 | },
|
2455 |
|
2456 | |
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 | getRecordColor() {
|
2465 | return null;
|
2466 | },
|
2467 |
|
2468 | |
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 | observeRecord() {
|
2476 | return function () {};
|
2477 | }
|
2478 |
|
2479 | });
|
2480 |
|
2481 | _exports.default = _default;
|
2482 | });
|
2483 | define("@ember/-internals/glimmer/index", ["exports", "@ember/polyfills", "@glimmer/opcode-compiler", "@ember/-internals/metal", "@ember/-internals/owner", "@ember/-internals/runtime", "@ember/-internals/utils", "@ember/-internals/views", "@ember/debug", "@glimmer/reference", "@glimmer/runtime", "@glimmer/validator", "@ember/-internals/browser-environment", "@ember/instrumentation", "@ember/service", "@ember/runloop", "@ember/-internals/environment", "@glimmer/util", "@ember/deprecated-features", "@ember/string", "@ember/-internals/container", "@glimmer/node", "@ember/-internals/routing", "@ember/component/template-only", "@ember/error", "rsvp"], function (_exports, _polyfills, _opcodeCompiler, _metal, _owner, _runtime, _utils, _views, _debug, _reference, _runtime2, _validator, _browserEnvironment, _instrumentation, _service, _runloop, _environment2, _util, _deprecatedFeatures, _string, _container, _node, _routing, _templateOnly, _error, _rsvp) {
|
2484 | "use strict";
|
2485 |
|
2486 | Object.defineProperty(_exports, "__esModule", {
|
2487 | value: true
|
2488 | });
|
2489 | _exports.template = template;
|
2490 | _exports.helper = helper;
|
2491 | _exports.escapeExpression = escapeExpression;
|
2492 | _exports.htmlSafe = htmlSafe;
|
2493 | _exports.isHTMLSafe = isHTMLSafe;
|
2494 | _exports._resetRenderers = _resetRenderers;
|
2495 | _exports.renderSettled = renderSettled;
|
2496 | _exports.getTemplate = getTemplate;
|
2497 | _exports.setTemplate = setTemplate;
|
2498 | _exports.hasTemplate = hasTemplate;
|
2499 | _exports.getTemplates = getTemplates;
|
2500 | _exports.setTemplates = setTemplates;
|
2501 | _exports.setupEngineRegistry = setupEngineRegistry;
|
2502 | _exports.setupApplicationRegistry = setupApplicationRegistry;
|
2503 | _exports._registerMacros = registerMacros;
|
2504 | _exports.capabilities = capabilities;
|
2505 | _exports.setComponentManager = setComponentManager;
|
2506 | _exports.getComponentManager = getComponentManager;
|
2507 | _exports.setModifierManager = setModifierManager;
|
2508 | _exports.getModifierManager = getModifierManager;
|
2509 | _exports.modifierCapabilities = capabilities$1;
|
2510 | _exports.setComponentTemplate = setComponentTemplate;
|
2511 | _exports.getComponentTemplate = getComponentTemplate;
|
2512 | Object.defineProperty(_exports, "DOMChanges", {
|
2513 | enumerable: true,
|
2514 | get: function () {
|
2515 | return _runtime2.DOMChanges;
|
2516 | }
|
2517 | });
|
2518 | Object.defineProperty(_exports, "DOMTreeConstruction", {
|
2519 | enumerable: true,
|
2520 | get: function () {
|
2521 | return _runtime2.DOMTreeConstruction;
|
2522 | }
|
2523 | });
|
2524 | Object.defineProperty(_exports, "isSerializationFirstNode", {
|
2525 | enumerable: true,
|
2526 | get: function () {
|
2527 | return _runtime2.isSerializationFirstNode;
|
2528 | }
|
2529 | });
|
2530 | Object.defineProperty(_exports, "NodeDOMTreeConstruction", {
|
2531 | enumerable: true,
|
2532 | get: function () {
|
2533 | return _node.NodeDOMTreeConstruction;
|
2534 | }
|
2535 | });
|
2536 | _exports.OutletView = _exports.INVOKE = _exports.AbstractComponentManager = _exports._experimentalMacros = _exports.InteractiveRenderer = _exports.InertRenderer = _exports.Renderer = _exports.SafeString = _exports.Helper = _exports.Component = _exports.LinkComponent = _exports.TextArea = _exports.TextField = _exports.Checkbox = _exports.templateCacheCounters = _exports.RootTemplate = void 0;
|
2537 |
|
2538 | function isTemplateFactory(template) {
|
2539 | return typeof template === 'function';
|
2540 | }
|
2541 |
|
2542 | var counters = {
|
2543 | cacheHit: 0,
|
2544 | cacheMiss: 0
|
2545 | };
|
2546 | _exports.templateCacheCounters = counters;
|
2547 |
|
2548 | function template(json) {
|
2549 | var glimmerFactory = (0, _opcodeCompiler.templateFactory)(json);
|
2550 | var cache = new WeakMap();
|
2551 | var meta = glimmerFactory.meta;
|
2552 |
|
2553 | var factory = owner => {
|
2554 | var result = cache.get(owner);
|
2555 |
|
2556 | if (result === undefined) {
|
2557 | counters.cacheMiss++;
|
2558 | result = glimmerFactory.create((0, _polyfills.assign)({
|
2559 | owner
|
2560 | }, meta));
|
2561 | cache.set(owner, result);
|
2562 | } else {
|
2563 | counters.cacheHit++;
|
2564 | }
|
2565 |
|
2566 | return result;
|
2567 | };
|
2568 |
|
2569 | factory.__id = glimmerFactory.id;
|
2570 | factory.__meta = meta;
|
2571 | return factory;
|
2572 | }
|
2573 |
|
2574 | var RootTemplate = template({
|
2575 | "id": "s5o9bxSn",
|
2576 | "block": "{\"symbols\":[],\"statements\":[[1,[30,[36,0],[[32,0]],null]]],\"hasEval\":false,\"upvars\":[\"component\"]}",
|
2577 | "meta": {
|
2578 | "moduleName": "packages/@ember/-internals/glimmer/lib/templates/root.hbs"
|
2579 | }
|
2580 | });
|
2581 | _exports.RootTemplate = RootTemplate;
|
2582 | var ARGS = (0, _utils.enumerableSymbol)('ARGS');
|
2583 | var HAS_BLOCK = (0, _utils.enumerableSymbol)('HAS_BLOCK');
|
2584 | var DIRTY_TAG = (0, _utils.symbol)('DIRTY_TAG');
|
2585 | var IS_DISPATCHING_ATTRS = (0, _utils.symbol)('IS_DISPATCHING_ATTRS');
|
2586 | var BOUNDS = (0, _utils.symbol)('BOUNDS');
|
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 |
|
2654 |
|
2655 |
|
2656 |
|
2657 |
|
2658 |
|
2659 |
|
2660 |
|
2661 |
|
2662 |
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 |
|
2679 |
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 |
|
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 |
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 |
|
2731 |
|
2732 |
|
2733 |
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 |
|
2748 |
|
2749 |
|
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 |
|
2759 |
|
2760 |
|
2761 |
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
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 |
|
2803 |
|
2804 |
|
2805 |
|
2806 |
|
2807 |
|
2808 |
|
2809 |
|
2810 |
|
2811 |
|
2812 |
|
2813 |
|
2814 |
|
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 |
|
2885 |
|
2886 |
|
2887 |
|
2888 |
|
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 |
|
2899 |
|
2900 |
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 |
|
2928 |
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 |
|
2942 |
|
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 |
|
2955 |
|
2956 |
|
2957 |
|
2958 |
|
2959 |
|
2960 |
|
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 |
|
2969 |
|
2970 |
|
2971 |
|
2972 |
|
2973 |
|
2974 |
|
2975 |
|
2976 |
|
2977 |
|
2978 |
|
2979 |
|
2980 |
|
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 |
|
2988 |
|
2989 |
|
2990 |
|
2991 |
|
2992 |
|
2993 |
|
2994 |
|
2995 |
|
2996 |
|
2997 |
|
2998 |
|
2999 |
|
3000 |
|
3001 |
|
3002 |
|
3003 |
|
3004 |
|
3005 |
|
3006 |
|
3007 |
|
3008 |
|
3009 |
|
3010 |
|
3011 |
|
3012 |
|
3013 |
|
3014 |
|
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 |
|
3021 |
|
3022 |
|
3023 |
|
3024 |
|
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 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 |
|
3078 |
|
3079 |
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 |
|
3168 |
|
3169 |
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 |
|
3179 |
|
3180 |
|
3181 |
|
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 |
|
3191 |
|
3192 |
|
3193 |
|
3194 |
|
3195 |
|
3196 |
|
3197 |
|
3198 |
|
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 |
|
3207 |
|
3208 |
|
3209 |
|
3210 |
|
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
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 | var Component = _views.CoreView.extend(_views.ChildViewsSupport, _views.ViewStateSupport, _views.ClassNamesSupport, _runtime.TargetActionSupport, _views.ActionSupport, _views.ViewMixin, {
|
3272 | isComponent: true,
|
3273 |
|
3274 | init() {
|
3275 | this._super(...arguments);
|
3276 |
|
3277 | this[IS_DISPATCHING_ATTRS] = false;
|
3278 | this[DIRTY_TAG] = (0, _validator.createTag)();
|
3279 | this[BOUNDS] = null;
|
3280 |
|
3281 | if (true
|
3282 |
|
3283 | && this.renderer._destinedForDOM && this.tagName === '') {
|
3284 | var eventNames = [];
|
3285 | var eventDispatcher = (0, _owner.getOwner)(this).lookup('event_dispatcher:main');
|
3286 | var events = eventDispatcher && eventDispatcher._finalEvents || {};
|
3287 |
|
3288 | for (var key in events) {
|
3289 | var methodName = events[key];
|
3290 |
|
3291 | if (typeof this[methodName] === 'function') {
|
3292 | eventNames.push(methodName);
|
3293 | }
|
3294 | }
|
3295 |
|
3296 |
|
3297 | (true && !(!eventNames.length) && (0, _debug.assert)(
|
3298 | `You can not define \`${eventNames}\` function(s) to handle DOM event in the \`${this}\` tagless component since it doesn't have any DOM element.`, !eventNames.length));
|
3299 | }
|
3300 |
|
3301 | (true && !(this.mouseEnter === undefined) && (0, _debug.deprecate)(`${this}: Using \`mouseEnter\` event handler methods in components has been deprecated.`, this.mouseEnter === undefined, {
|
3302 | id: 'ember-views.event-dispatcher.mouseenter-leave-move',
|
3303 | until: '4.0.0',
|
3304 | url: 'https://emberjs.com/deprecations/v3.x#toc_component-mouseenter-leave-move'
|
3305 | }));
|
3306 | (true && !(this.mouseLeave === undefined) && (0, _debug.deprecate)(`${this}: Using \`mouseLeave\` event handler methods in components has been deprecated.`, this.mouseLeave === undefined, {
|
3307 | id: 'ember-views.event-dispatcher.mouseenter-leave-move',
|
3308 | until: '4.0.0',
|
3309 | url: 'https://emberjs.com/deprecations/v3.x#toc_component-mouseenter-leave-move'
|
3310 | }));
|
3311 | (true && !(this.mouseMove === undefined) && (0, _debug.deprecate)(`${this}: Using \`mouseMove\` event handler methods in components has been deprecated.`, this.mouseMove === undefined, {
|
3312 | id: 'ember-views.event-dispatcher.mouseenter-leave-move',
|
3313 | until: '4.0.0',
|
3314 | url: 'https://emberjs.com/deprecations/v3.x#toc_component-mouseenter-leave-move'
|
3315 | }));
|
3316 | },
|
3317 |
|
3318 | rerender() {
|
3319 | (0, _validator.dirtyTag)(this[DIRTY_TAG]);
|
3320 |
|
3321 | this._super();
|
3322 | },
|
3323 |
|
3324 | [_metal.PROPERTY_DID_CHANGE](key, value) {
|
3325 | if (this[IS_DISPATCHING_ATTRS]) {
|
3326 | return;
|
3327 | }
|
3328 |
|
3329 | var args = this[ARGS];
|
3330 | var reference = args !== undefined ? args[key] : undefined;
|
3331 |
|
3332 | if (reference !== undefined && reference[_reference.UPDATE_REFERENCED_VALUE] !== undefined) {
|
3333 | reference[_reference.UPDATE_REFERENCED_VALUE](arguments.length === 2 ? value : (0, _metal.get)(this, key));
|
3334 | }
|
3335 | },
|
3336 |
|
3337 | getAttr(key) {
|
3338 |
|
3339 | return this.get(key);
|
3340 | },
|
3341 |
|
3342 | |
3343 |
|
3344 |
|
3345 |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 |
|
3354 |
|
3355 |
|
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 | readDOMAttr(name) {
|
3369 |
|
3370 | var _element = (0, _views.getViewElement)(this);
|
3371 |
|
3372 | (true && !(_element !== null) && (0, _debug.assert)(`Cannot call \`readDOMAttr\` on ${this} which does not have an element`, _element !== null));
|
3373 | var element = _element;
|
3374 | var isSVG = element.namespaceURI === "http://www.w3.org/2000/svg"
|
3375 |
|
3376 | ;
|
3377 | var {
|
3378 | type,
|
3379 | normalized
|
3380 | } = (0, _runtime2.normalizeProperty)(element, name);
|
3381 |
|
3382 | if (isSVG || type === 'attr') {
|
3383 | return element.getAttribute(normalized);
|
3384 | }
|
3385 |
|
3386 | return element[normalized];
|
3387 | },
|
3388 |
|
3389 | |
3390 |
|
3391 |
|
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 | |
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 |
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 | |
3447 |
|
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 |
|
3453 |
|
3454 |
|
3455 | didReceiveAttrs() {},
|
3456 |
|
3457 | |
3458 |
|
3459 |
|
3460 |
|
3461 |
|
3462 |
|
3463 |
|
3464 |
|
3465 |
|
3466 |
|
3467 | |
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 | didRender() {},
|
3475 |
|
3476 | |
3477 |
|
3478 |
|
3479 |
|
3480 |
|
3481 |
|
3482 |
|
3483 |
|
3484 | |
3485 |
|
3486 |
|
3487 |
|
3488 |
|
3489 |
|
3490 |
|
3491 | willRender() {},
|
3492 |
|
3493 | |
3494 |
|
3495 |
|
3496 |
|
3497 |
|
3498 |
|
3499 |
|
3500 |
|
3501 | |
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 |
|
3508 | didUpdateAttrs() {},
|
3509 |
|
3510 | |
3511 |
|
3512 |
|
3513 |
|
3514 |
|
3515 |
|
3516 |
|
3517 |
|
3518 | |
3519 |
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 | willUpdate() {},
|
3526 |
|
3527 | |
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 | |
3536 |
|
3537 |
|
3538 |
|
3539 |
|
3540 |
|
3541 |
|
3542 | didUpdate() {}
|
3543 |
|
3544 | });
|
3545 |
|
3546 | _exports.Component = Component;
|
3547 |
|
3548 | Component.toString = () => '@ember/component';
|
3549 |
|
3550 | Component.reopenClass({
|
3551 | isComponentFactory: true,
|
3552 | positionalParams: []
|
3553 | });
|
3554 | var layout = template({
|
3555 | "id": "SWbqsLhV",
|
3556 | "block": "{\"symbols\":[],\"statements\":[],\"hasEval\":false,\"upvars\":[]}",
|
3557 | "meta": {
|
3558 | "moduleName": "packages/@ember/-internals/glimmer/lib/templates/empty.hbs"
|
3559 | }
|
3560 | });
|
3561 | |
3562 |
|
3563 |
|
3564 |
|
3565 | |
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 |
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 | var Checkbox = Component.extend({
|
3590 | layout,
|
3591 |
|
3592 | |
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 | classNames: ['ember-checkbox'],
|
3600 | tagName: 'input',
|
3601 |
|
3602 | |
3603 |
|
3604 |
|
3605 |
|
3606 |
|
3607 |
|
3608 |
|
3609 |
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 |
|
3615 |
|
3616 |
|
3617 |
|
3618 |
|
3619 |
|
3620 |
|
3621 |
|
3622 |
|
3623 | attributeBindings: ['type', 'checked', 'indeterminate', 'disabled', 'tabindex', 'name', 'autofocus', 'required', 'form'],
|
3624 |
|
3625 | |
3626 |
|
3627 |
|
3628 |
|
3629 |
|
3630 |
|
3631 | type: 'checkbox',
|
3632 |
|
3633 | |
3634 |
|
3635 |
|
3636 |
|
3637 |
|
3638 |
|
3639 | disabled: false,
|
3640 |
|
3641 | |
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 |
|
3647 | indeterminate: false,
|
3648 |
|
3649 | |
3650 |
|
3651 |
|
3652 |
|
3653 |
|
3654 |
|
3655 |
|
3656 | didInsertElement() {
|
3657 | this._super(...arguments);
|
3658 |
|
3659 | this.element.indeterminate = Boolean(this.indeterminate);
|
3660 | },
|
3661 |
|
3662 | |
3663 |
|
3664 |
|
3665 |
|
3666 |
|
3667 |
|
3668 |
|
3669 | change() {
|
3670 | (0, _metal.set)(this, 'checked', this.element.checked);
|
3671 | }
|
3672 |
|
3673 | });
|
3674 | _exports.Checkbox = Checkbox;
|
3675 |
|
3676 | if (true
|
3677 |
|
3678 | ) {
|
3679 | var UNSET = {};
|
3680 | Checkbox.reopen({
|
3681 | value: UNSET,
|
3682 |
|
3683 | didReceiveAttrs() {
|
3684 | this._super();
|
3685 |
|
3686 | (true && !(!(this.type === 'checkbox' && this.value !== UNSET)) && (0, _debug.assert)("`<Input @type='checkbox' @value={{...}} />` is not supported; " + "please use `<Input @type='checkbox' @checked={{...}} />` instead.", !(this.type === 'checkbox' && this.value !== UNSET)));
|
3687 | }
|
3688 |
|
3689 | });
|
3690 | }
|
3691 |
|
3692 | Checkbox.toString = () => '@ember/component/checkbox';
|
3693 | |
3694 |
|
3695 |
|
3696 |
|
3697 |
|
3698 | var inputTypes = _browserEnvironment.hasDOM ? Object.create(null) : null;
|
3699 |
|
3700 | function canSetTypeOfInput(type) {
|
3701 |
|
3702 |
|
3703 | if (!_browserEnvironment.hasDOM) {
|
3704 | return Boolean(type);
|
3705 | }
|
3706 |
|
3707 | if (type in inputTypes) {
|
3708 | return inputTypes[type];
|
3709 | }
|
3710 |
|
3711 | var inputTypeTestElement = document.createElement('input');
|
3712 |
|
3713 | try {
|
3714 | inputTypeTestElement.type = type;
|
3715 | } catch (e) {
|
3716 | }
|
3717 |
|
3718 | return inputTypes[type] = inputTypeTestElement.type === type;
|
3719 | }
|
3720 | |
3721 |
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 |
|
3727 |
|
3728 |
|
3729 |
|
3730 |
|
3731 |
|
3732 |
|
3733 |
|
3734 |
|
3735 |
|
3736 |
|
3737 | var TextField = Component.extend(_views.TextSupport, {
|
3738 | layout,
|
3739 |
|
3740 | |
3741 |
|
3742 |
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 | classNames: ['ember-text-field'],
|
3748 | tagName: 'input',
|
3749 |
|
3750 | |
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 |
|
3766 |
|
3767 |
|
3768 |
|
3769 |
|
3770 |
|
3771 |
|
3772 |
|
3773 |
|
3774 |
|
3775 |
|
3776 |
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 |
|
3782 |
|
3783 | attributeBindings: ['accept', 'autocomplete', 'autosave', 'dir', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'inputmode', 'lang', 'list', 'type', 'max', 'min', 'multiple', 'name', 'pattern', 'size', 'step', 'value', 'width'],
|
3784 |
|
3785 | |
3786 |
|
3787 |
|
3788 |
|
3789 |
|
3790 |
|
3791 |
|
3792 |
|
3793 | value: '',
|
3794 |
|
3795 | |
3796 |
|
3797 |
|
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 | type: (0, _metal.computed)({
|
3803 | get() {
|
3804 | return 'text';
|
3805 | },
|
3806 |
|
3807 | set(_key, value) {
|
3808 | var type = 'text';
|
3809 |
|
3810 | if (canSetTypeOfInput(value)) {
|
3811 | type = value;
|
3812 | }
|
3813 |
|
3814 | return type;
|
3815 | }
|
3816 |
|
3817 | }),
|
3818 |
|
3819 | |
3820 |
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 | size: null,
|
3827 |
|
3828 | |
3829 |
|
3830 |
|
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 | pattern: null,
|
3836 |
|
3837 | |
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 | min: null,
|
3846 |
|
3847 | |
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 | max: null
|
3856 | });
|
3857 | _exports.TextField = TextField;
|
3858 |
|
3859 | TextField.toString = () => '@ember/component/text-field';
|
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 |
|
3885 |
|
3886 |
|
3887 |
|
3888 |
|
3889 |
|
3890 |
|
3891 |
|
3892 |
|
3893 |
|
3894 |
|
3895 |
|
3896 |
|
3897 |
|
3898 |
|
3899 |
|
3900 |
|
3901 |
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 |
|
3912 |
|
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 |
|
3961 |
|
3962 |
|
3963 |
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 |
|
3976 |
|
3977 |
|
3978 | |
3979 |
|
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 |
|
3985 |
|
3986 |
|
3987 | |
3988 |
|
3989 |
|
3990 |
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 | var TextArea = Component.extend(_views.TextSupport, {
|
3999 | classNames: ['ember-text-area'],
|
4000 | layout,
|
4001 | tagName: 'textarea',
|
4002 | attributeBindings: ['rows', 'cols', 'name', 'selectionEnd', 'selectionStart', 'autocomplete', 'wrap', 'lang', 'dir', 'value'],
|
4003 | rows: null,
|
4004 | cols: null
|
4005 | });
|
4006 | _exports.TextArea = TextArea;
|
4007 |
|
4008 | TextArea.toString = () => '@ember/component/text-area';
|
4009 |
|
4010 | var layout$1 = template({
|
4011 | "id": "uDKxl8ne",
|
4012 | "block": "{\"symbols\":[\"&default\"],\"statements\":[[6,[37,0],[[27,[32,1]]],null,[[\"default\",\"else\"],[{\"statements\":[[18,1,null]],\"parameters\":[]},{\"statements\":[[1,[32,0,[\"linkTitle\"]]]],\"parameters\":[]}]]]],\"hasEval\":false,\"upvars\":[\"if\"]}",
|
4013 | "meta": {
|
4014 | "moduleName": "packages/@ember/-internals/glimmer/lib/templates/link-to.hbs"
|
4015 | }
|
4016 | });
|
4017 | |
4018 |
|
4019 |
|
4020 |
|
4021 | |
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 |
|
4041 |
|
4042 |
|
4043 |
|
4044 |
|
4045 |
|
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 |
|
4052 |
|
4053 |
|
4054 |
|
4055 |
|
4056 |
|
4057 |
|
4058 |
|
4059 |
|
4060 |
|
4061 |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 |
|
4067 |
|
4068 |
|
4069 |
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 |
|
4092 |
|
4093 |
|
4094 |
|
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 |
|
4100 |
|
4101 |
|
4102 |
|
4103 |
|
4104 |
|
4105 |
|
4106 |
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 |
|
4132 |
|
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 |
|
4141 |
|
4142 |
|
4143 |
|
4144 |
|
4145 |
|
4146 |
|
4147 |
|
4148 |
|
4149 |
|
4150 |
|
4151 |
|
4152 |
|
4153 |
|
4154 |
|
4155 |
|
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 |
|
4174 |
|
4175 |
|
4176 |
|
4177 |
|
4178 |
|
4179 |
|
4180 |
|
4181 |
|
4182 |
|
4183 |
|
4184 |
|
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 |
|
4194 |
|
4195 |
|
4196 |
|
4197 |
|
4198 |
|
4199 |
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 |
|
4215 |
|
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 |
|
4258 |
|
4259 |
|
4260 |
|
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 | |
4266 |
|
4267 |
|
4268 |
|
4269 | |
4270 |
|
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 |
|
4276 |
|
4277 |
|
4278 | |
4279 |
|
4280 |
|
4281 |
|
4282 |
|
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 | var UNDEFINED = Object.freeze({
|
4288 | toString() {
|
4289 | return 'UNDEFINED';
|
4290 | }
|
4291 |
|
4292 | });
|
4293 | var EMPTY_QUERY_PARAMS = Object.freeze({});
|
4294 | var LinkComponent = Component.extend({
|
4295 | layout: layout$1,
|
4296 | tagName: 'a',
|
4297 |
|
4298 | |
4299 |
|
4300 |
|
4301 |
|
4302 | route: UNDEFINED,
|
4303 |
|
4304 | |
4305 |
|
4306 |
|
4307 |
|
4308 | model: UNDEFINED,
|
4309 |
|
4310 | |
4311 |
|
4312 |
|
4313 |
|
4314 | models: UNDEFINED,
|
4315 |
|
4316 | |
4317 |
|
4318 |
|
4319 |
|
4320 | query: UNDEFINED,
|
4321 |
|
4322 | |
4323 |
|
4324 |
|
4325 |
|
4326 |
|
4327 | 'current-when': null,
|
4328 |
|
4329 | |
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 | title: null,
|
4336 |
|
4337 | |
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 | rel: null,
|
4344 |
|
4345 | |
4346 |
|
4347 |
|
4348 |
|
4349 |
|
4350 |
|
4351 | tabindex: null,
|
4352 |
|
4353 | |
4354 |
|
4355 |
|
4356 |
|
4357 |
|
4358 |
|
4359 |
|
4360 | target: null,
|
4361 |
|
4362 | |
4363 |
|
4364 |
|
4365 |
|
4366 |
|
4367 |
|
4368 |
|
4369 |
|
4370 | activeClass: 'active',
|
4371 |
|
4372 | |
4373 |
|
4374 |
|
4375 |
|
4376 |
|
4377 |
|
4378 |
|
4379 |
|
4380 | loadingClass: 'loading',
|
4381 |
|
4382 | |
4383 |
|
4384 |
|
4385 |
|
4386 |
|
4387 |
|
4388 |
|
4389 |
|
4390 | disabledClass: 'disabled',
|
4391 |
|
4392 | |
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 |
|
4400 | replace: false,
|
4401 |
|
4402 | |
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 |
|
4410 |
|
4411 |
|
4412 | attributeBindings: ['href', 'title', 'rel', 'tabindex', 'target'],
|
4413 |
|
4414 | |
4415 |
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 |
|
4421 |
|
4422 |
|
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 | classNameBindings: ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut'],
|
4428 |
|
4429 | |
4430 |
|
4431 |
|
4432 |
|
4433 |
|
4434 |
|
4435 |
|
4436 |
|
4437 |
|
4438 | eventName: 'click',
|
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 | init() {
|
4474 | this._super(...arguments);
|
4475 |
|
4476 |
|
4477 | var {
|
4478 | eventName
|
4479 | } = this;
|
4480 | this.on(eventName, this, this._invoke);
|
4481 | },
|
4482 |
|
4483 | _routing: (0, _service.inject)('-routing'),
|
4484 | _currentRoute: (0, _metal.alias)('_routing.currentRouteName'),
|
4485 | _currentRouterState: (0, _metal.alias)('_routing.currentState'),
|
4486 | _targetRouterState: (0, _metal.alias)('_routing.targetState'),
|
4487 | _route: (0, _metal.computed)('route', '_currentRouterState', function computeLinkToComponentRoute() {
|
4488 | var {
|
4489 | route
|
4490 | } = this;
|
4491 | return route === UNDEFINED ? this._currentRoute : route;
|
4492 | }),
|
4493 | _models: (0, _metal.computed)('model', 'models', function computeLinkToComponentModels() {
|
4494 | var {
|
4495 | model,
|
4496 | models
|
4497 | } = this;
|
4498 | (true && !(model === UNDEFINED || models === UNDEFINED) && (0, _debug.assert)('You cannot provide both the `@model` and `@models` arguments to the <LinkTo> component.', model === UNDEFINED || models === UNDEFINED));
|
4499 |
|
4500 | if (model !== UNDEFINED) {
|
4501 | return [model];
|
4502 | } else if (models !== UNDEFINED) {
|
4503 | (true && !(Array.isArray(models)) && (0, _debug.assert)('The `@models` argument must be an array.', Array.isArray(models)));
|
4504 | return models;
|
4505 | } else {
|
4506 | return [];
|
4507 | }
|
4508 | }),
|
4509 | _query: (0, _metal.computed)('query', function computeLinkToComponentQuery() {
|
4510 | var {
|
4511 | query
|
4512 | } = this;
|
4513 |
|
4514 | if (query === UNDEFINED) {
|
4515 | return EMPTY_QUERY_PARAMS;
|
4516 | } else {
|
4517 | return (0, _polyfills.assign)({}, query);
|
4518 | }
|
4519 | }),
|
4520 |
|
4521 | |
4522 |
|
4523 |
|
4524 |
|
4525 |
|
4526 |
|
4527 |
|
4528 | disabled: (0, _metal.computed)({
|
4529 | get(_key) {
|
4530 |
|
4531 |
|
4532 |
|
4533 | return false;
|
4534 | },
|
4535 |
|
4536 | set(_key, value) {
|
4537 | this._isDisabled = value;
|
4538 | return value ? this.disabledClass : false;
|
4539 | }
|
4540 |
|
4541 | }),
|
4542 |
|
4543 | |
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 |
|
4554 | active: (0, _metal.computed)('activeClass', '_active', function computeLinkToComponentActiveClass() {
|
4555 | return this._active ? this.activeClass : false;
|
4556 | }),
|
4557 | _active: (0, _metal.computed)('_currentRouterState', '_route', '_models', '_query', 'loading', 'current-when', function computeLinkToComponentActive() {
|
4558 | var {
|
4559 | _currentRouterState: state
|
4560 | } = this;
|
4561 |
|
4562 | if (state) {
|
4563 | return this._isActive(state);
|
4564 | } else {
|
4565 | return false;
|
4566 | }
|
4567 | }),
|
4568 | willBeActive: (0, _metal.computed)('_currentRouterState', '_targetRouterState', '_route', '_models', '_query', 'loading', 'current-when', function computeLinkToComponentWillBeActive() {
|
4569 | var {
|
4570 | _currentRouterState: current,
|
4571 | _targetRouterState: target
|
4572 | } = this;
|
4573 |
|
4574 | if (current === target) {
|
4575 | return;
|
4576 | }
|
4577 |
|
4578 | return this._isActive(target);
|
4579 | }),
|
4580 |
|
4581 | _isActive(routerState) {
|
4582 | if (this.loading) {
|
4583 | return false;
|
4584 | }
|
4585 |
|
4586 | var currentWhen = this['current-when'];
|
4587 |
|
4588 | if (typeof currentWhen === 'boolean') {
|
4589 | return currentWhen;
|
4590 | }
|
4591 |
|
4592 | var isCurrentWhenSpecified = Boolean(currentWhen);
|
4593 |
|
4594 | if (isCurrentWhenSpecified) {
|
4595 | currentWhen = currentWhen.split(' ');
|
4596 | } else {
|
4597 | currentWhen = [this._route];
|
4598 | }
|
4599 |
|
4600 | var {
|
4601 | _models: models,
|
4602 | _query: query,
|
4603 | _routing: routing
|
4604 | } = this;
|
4605 |
|
4606 | for (var i = 0; i < currentWhen.length; i++) {
|
4607 | if (routing.isActiveForRoute(models, query, currentWhen[i], routerState, isCurrentWhenSpecified)) {
|
4608 | return true;
|
4609 | }
|
4610 | }
|
4611 |
|
4612 | return false;
|
4613 | },
|
4614 |
|
4615 | transitioningIn: (0, _metal.computed)('_active', 'willBeActive', function computeLinkToComponentTransitioningIn() {
|
4616 | if (this.willBeActive === true && !this._active) {
|
4617 | return 'ember-transitioning-in';
|
4618 | } else {
|
4619 | return false;
|
4620 | }
|
4621 | }),
|
4622 | transitioningOut: (0, _metal.computed)('_active', 'willBeActive', function computeLinkToComponentTransitioningOut() {
|
4623 | if (this.willBeActive === false && this._active) {
|
4624 | return 'ember-transitioning-out';
|
4625 | } else {
|
4626 | return false;
|
4627 | }
|
4628 | }),
|
4629 |
|
4630 | |
4631 |
|
4632 |
|
4633 |
|
4634 |
|
4635 |
|
4636 | _invoke(event) {
|
4637 | if (!(0, _views.isSimpleClick)(event)) {
|
4638 | return true;
|
4639 | }
|
4640 |
|
4641 | var {
|
4642 | bubbles,
|
4643 | preventDefault
|
4644 | } = this;
|
4645 | var target = this.element.target;
|
4646 | var isSelf = !target || target === '_self';
|
4647 |
|
4648 | if (preventDefault !== false && isSelf) {
|
4649 | event.preventDefault();
|
4650 | }
|
4651 |
|
4652 | if (bubbles === false) {
|
4653 | event.stopPropagation();
|
4654 | }
|
4655 |
|
4656 | if (this._isDisabled) {
|
4657 | return false;
|
4658 | }
|
4659 |
|
4660 | if (this.loading) {
|
4661 |
|
4662 | (true && (0, _debug.warn)('This link is in an inactive loading state because at least one of its models ' + 'currently has a null/undefined value, or the provided route name is invalid.', false, {
|
4663 | id: 'ember-glimmer.link-to.inactive-loading-state'
|
4664 | }));
|
4665 | return false;
|
4666 | }
|
4667 |
|
4668 | if (!isSelf) {
|
4669 | return false;
|
4670 | }
|
4671 |
|
4672 | var {
|
4673 | _route: routeName,
|
4674 | _models: models,
|
4675 | _query: queryParams,
|
4676 | replace: shouldReplace
|
4677 | } = this;
|
4678 | var payload = {
|
4679 | queryParams,
|
4680 | routeName
|
4681 | };
|
4682 | (0, _instrumentation.flaggedInstrument)('interaction.link-to', payload, this._generateTransition(payload, routeName, models, queryParams, shouldReplace));
|
4683 | return false;
|
4684 | },
|
4685 |
|
4686 | _generateTransition(payload, qualifiedRouteName, models, queryParams, shouldReplace) {
|
4687 | var {
|
4688 | _routing: routing
|
4689 | } = this;
|
4690 | return () => {
|
4691 | payload.transition = routing.transitionTo(qualifiedRouteName, models, queryParams, shouldReplace);
|
4692 | };
|
4693 | },
|
4694 |
|
4695 | |
4696 |
|
4697 |
|
4698 |
|
4699 |
|
4700 |
|
4701 |
|
4702 |
|
4703 | href: (0, _metal.computed)('_currentRouterState', '_route', '_models', '_query', 'tagName', 'loading', 'loadingHref', function computeLinkToComponentHref() {
|
4704 | if (this.tagName !== 'a') {
|
4705 | return;
|
4706 | }
|
4707 |
|
4708 | if (this.loading) {
|
4709 | return this.loadingHref;
|
4710 | }
|
4711 |
|
4712 | var {
|
4713 | _route: route,
|
4714 | _models: models,
|
4715 | _query: query,
|
4716 | _routing: routing
|
4717 | } = this;
|
4718 |
|
4719 | if (true
|
4720 |
|
4721 | ) {
|
4722 | |
4723 |
|
4724 |
|
4725 |
|
4726 |
|
4727 |
|
4728 |
|
4729 |
|
4730 |
|
4731 |
|
4732 |
|
4733 | try {
|
4734 | return routing.generateURL(route, models, query);
|
4735 | } catch (e) {
|
4736 |
|
4737 | (true && !(false) && (0, _debug.assert)(`You attempted to generate a link for the "${this.route}" route, but did not ` + `pass the models required for generating its dynamic segments. ` + e.message));
|
4738 | }
|
4739 | } else {
|
4740 | return routing.generateURL(route, models, query);
|
4741 | }
|
4742 | }),
|
4743 | loading: (0, _metal.computed)('_route', '_modelsAreLoaded', 'loadingClass', function computeLinkToComponentLoading() {
|
4744 | var {
|
4745 | _route: route,
|
4746 | _modelsAreLoaded: loaded
|
4747 | } = this;
|
4748 |
|
4749 | if (!loaded || route === null || route === undefined) {
|
4750 | return this.loadingClass;
|
4751 | }
|
4752 | }),
|
4753 | _modelsAreLoaded: (0, _metal.computed)('_models', function computeLinkToComponentModelsAreLoaded() {
|
4754 | var {
|
4755 | _models: models
|
4756 | } = this;
|
4757 |
|
4758 | for (var i = 0; i < models.length; i++) {
|
4759 | var model = models[i];
|
4760 |
|
4761 | if (model === null || model === undefined) {
|
4762 | return false;
|
4763 | }
|
4764 | }
|
4765 |
|
4766 | return true;
|
4767 | }),
|
4768 |
|
4769 | |
4770 |
|
4771 |
|
4772 |
|
4773 |
|
4774 |
|
4775 |
|
4776 |
|
4777 | loadingHref: '#',
|
4778 |
|
4779 | didReceiveAttrs() {
|
4780 | var {
|
4781 | disabledWhen
|
4782 | } = this;
|
4783 |
|
4784 | if (disabledWhen !== undefined) {
|
4785 | this.set('disabled', disabledWhen);
|
4786 | }
|
4787 |
|
4788 | var {
|
4789 | params
|
4790 | } = this;
|
4791 |
|
4792 | if (!params || params.length === 0) {
|
4793 | (true && !(!(this.route === UNDEFINED && this.model === UNDEFINED && this.models === UNDEFINED && this.query === UNDEFINED)) && (0, _debug.assert)('You must provide at least one of the `@route`, `@model`, `@models` or `@query` argument to `<LinkTo>`.', !(this.route === UNDEFINED && this.model === UNDEFINED && this.models === UNDEFINED && this.query === UNDEFINED)));
|
4794 | var {
|
4795 | _models: models
|
4796 | } = this;
|
4797 |
|
4798 | if (models.length > 0) {
|
4799 | var lastModel = models[models.length - 1];
|
4800 |
|
4801 | if (typeof lastModel === 'object' && lastModel !== null && lastModel.isQueryParams) {
|
4802 | this.query = lastModel.values;
|
4803 | models.pop();
|
4804 | }
|
4805 | }
|
4806 |
|
4807 | return;
|
4808 | }
|
4809 |
|
4810 | params = params.slice();
|
4811 |
|
4812 |
|
4813 | if (!this[HAS_BLOCK]) {
|
4814 | this.set('linkTitle', params.shift());
|
4815 | }
|
4816 |
|
4817 |
|
4818 | var queryParams = params[params.length - 1];
|
4819 |
|
4820 | if (queryParams && queryParams.isQueryParams) {
|
4821 | this.set('query', params.pop().values);
|
4822 | } else {
|
4823 | this.set('query', UNDEFINED);
|
4824 | }
|
4825 |
|
4826 |
|
4827 | if (params.length === 0) {
|
4828 | this.set('route', UNDEFINED);
|
4829 | } else {
|
4830 | this.set('route', params.shift());
|
4831 | }
|
4832 |
|
4833 |
|
4834 | this.set('model', UNDEFINED);
|
4835 | this.set('models', params);
|
4836 | }
|
4837 |
|
4838 | });
|
4839 | _exports.LinkComponent = LinkComponent;
|
4840 |
|
4841 | LinkComponent.toString = () => '@ember/routing/link-component';
|
4842 |
|
4843 | LinkComponent.reopenClass({
|
4844 | positionalParams: 'params'
|
4845 | });
|
4846 | |
4847 |
|
4848 |
|
4849 |
|
4850 | var RECOMPUTE_TAG = (0, _utils.symbol)('RECOMPUTE_TAG');
|
4851 |
|
4852 | function isHelperFactory(helper) {
|
4853 | return typeof helper === 'object' && helper !== null && helper.class && helper.class.isHelperFactory;
|
4854 | }
|
4855 |
|
4856 | function isClassHelper(helper) {
|
4857 | return helper.destroy !== undefined;
|
4858 | }
|
4859 | |
4860 |
|
4861 |
|
4862 |
|
4863 |
|
4864 |
|
4865 |
|
4866 |
|
4867 |
|
4868 |
|
4869 |
|
4870 |
|
4871 |
|
4872 |
|
4873 |
|
4874 |
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 |
|
4903 |
|
4904 |
|
4905 | var Helper = _runtime.FrameworkObject.extend({
|
4906 | init() {
|
4907 | this._super(...arguments);
|
4908 |
|
4909 | this[RECOMPUTE_TAG] = (0, _validator.createTag)();
|
4910 | },
|
4911 |
|
4912 | |
4913 |
|
4914 |
|
4915 |
|
4916 |
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 |
|
4926 |
|
4927 |
|
4928 |
|
4929 |
|
4930 |
|
4931 |
|
4932 |
|
4933 |
|
4934 |
|
4935 | recompute() {
|
4936 | (0, _runloop.join)(() => (0, _validator.dirtyTag)(this[RECOMPUTE_TAG]));
|
4937 | }
|
4938 |
|
4939 | });
|
4940 |
|
4941 | _exports.Helper = Helper;
|
4942 | Helper.isHelperFactory = true;
|
4943 |
|
4944 | class Wrapper {
|
4945 | constructor(compute) {
|
4946 | this.compute = compute;
|
4947 | this.isHelperFactory = true;
|
4948 | }
|
4949 |
|
4950 | create() {
|
4951 |
|
4952 | return {
|
4953 | compute: this.compute
|
4954 | };
|
4955 | }
|
4956 |
|
4957 | }
|
4958 | |
4959 |
|
4960 |
|
4961 |
|
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 |
|
4967 |
|
4968 |
|
4969 |
|
4970 |
|
4971 |
|
4972 |
|
4973 |
|
4974 |
|
4975 |
|
4976 |
|
4977 |
|
4978 |
|
4979 |
|
4980 | function helper(helperFn) {
|
4981 | return new Wrapper(helperFn);
|
4982 | }
|
4983 | |
4984 |
|
4985 |
|
4986 |
|
4987 |
|
4988 | class SafeString {
|
4989 | constructor(string) {
|
4990 | this.string = string;
|
4991 | }
|
4992 |
|
4993 | toString() {
|
4994 | return `${this.string}`;
|
4995 | }
|
4996 |
|
4997 | toHTML() {
|
4998 | return this.toString();
|
4999 | }
|
5000 |
|
5001 | }
|
5002 |
|
5003 | _exports.SafeString = SafeString;
|
5004 | var escape = {
|
5005 | '&': '&',
|
5006 | '<': '<',
|
5007 | '>': '>',
|
5008 | '"': '"',
|
5009 | "'": ''',
|
5010 | '`': '`',
|
5011 | '=': '='
|
5012 | };
|
5013 | var possible = /[&<>"'`=]/;
|
5014 | var badChars = /[&<>"'`=]/g;
|
5015 |
|
5016 | function escapeChar(chr) {
|
5017 | return escape[chr];
|
5018 | }
|
5019 |
|
5020 | function escapeExpression(string) {
|
5021 | if (typeof string !== 'string') {
|
5022 |
|
5023 | if (string && string.toHTML) {
|
5024 | return string.toHTML();
|
5025 | } else if (string === null || string === undefined) {
|
5026 | return '';
|
5027 | } else if (!string) {
|
5028 | return String(string);
|
5029 | }
|
5030 |
|
5031 |
|
5032 |
|
5033 |
|
5034 | string = String(string);
|
5035 | }
|
5036 |
|
5037 | if (!possible.test(string)) {
|
5038 | return string;
|
5039 | }
|
5040 |
|
5041 | return string.replace(badChars, escapeChar);
|
5042 | }
|
5043 | |
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 |
|
5055 |
|
5056 |
|
5057 |
|
5058 |
|
5059 |
|
5060 |
|
5061 |
|
5062 | function htmlSafe(str) {
|
5063 | if (str === null || str === undefined) {
|
5064 | str = '';
|
5065 | } else if (typeof str !== 'string') {
|
5066 | str = String(str);
|
5067 | }
|
5068 |
|
5069 | return new SafeString(str);
|
5070 | }
|
5071 | |
5072 |
|
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 |
|
5079 |
|
5080 |
|
5081 |
|
5082 |
|
5083 |
|
5084 |
|
5085 |
|
5086 |
|
5087 |
|
5088 |
|
5089 |
|
5090 |
|
5091 |
|
5092 | function isHTMLSafe(str) {
|
5093 | return str !== null && typeof str === 'object' && typeof str.toHTML === 'function';
|
5094 | }
|
5095 |
|
5096 | function isStaticComponentManager(_manager, capabilities) {
|
5097 | return !capabilities.dynamicLayout;
|
5098 | }
|
5099 |
|
5100 | class CompileTimeResolver {
|
5101 | constructor(resolver) {
|
5102 | this.resolver = resolver;
|
5103 | }
|
5104 |
|
5105 | lookupHelper(name, referrer) {
|
5106 | return this.resolver.lookupHelper(name, referrer);
|
5107 | }
|
5108 |
|
5109 | lookupModifier(name, referrer) {
|
5110 | return this.resolver.lookupModifier(name, referrer);
|
5111 | }
|
5112 |
|
5113 | lookupComponent(name, referrer) {
|
5114 | var definitionHandle = this.resolver.lookupComponentHandle(name, referrer);
|
5115 |
|
5116 | if (definitionHandle === null) {
|
5117 | return null;
|
5118 | }
|
5119 |
|
5120 | var {
|
5121 | manager,
|
5122 | state
|
5123 | } = this.resolver.resolve(definitionHandle);
|
5124 | var capabilities = manager.getCapabilities(state);
|
5125 |
|
5126 | if (!isStaticComponentManager(manager, capabilities)) {
|
5127 | return {
|
5128 | handle: definitionHandle,
|
5129 | capabilities,
|
5130 | compilable: null
|
5131 | };
|
5132 | }
|
5133 |
|
5134 | return {
|
5135 | handle: definitionHandle,
|
5136 | capabilities,
|
5137 | compilable: manager.getJitStaticLayout(state, this.resolver)
|
5138 | };
|
5139 | }
|
5140 |
|
5141 | lookupPartial(name, referrer) {
|
5142 | return this.resolver.lookupPartial(name, referrer);
|
5143 | }
|
5144 |
|
5145 | resolve(handle) {
|
5146 | return this.resolver.resolve(handle);
|
5147 | }
|
5148 |
|
5149 | }
|
5150 |
|
5151 |
|
5152 |
|
5153 |
|
5154 | class AbstractManager {
|
5155 | prepareArgs(_state, _args) {
|
5156 | return null;
|
5157 | }
|
5158 |
|
5159 | didCreateElement(_component, _element, _operations) {
|
5160 | }
|
5161 |
|
5162 | didRenderLayout(_component, _bounds) {
|
5163 | }
|
5164 |
|
5165 | didCreate(_bucket) {
|
5166 | }
|
5167 |
|
5168 | update(_bucket, _dynamicScope) {
|
5169 | }
|
5170 |
|
5171 | didUpdateLayout(_bucket, _bounds) {
|
5172 | }
|
5173 |
|
5174 | didUpdate(_bucket) {
|
5175 | }
|
5176 |
|
5177 | }
|
5178 |
|
5179 | _exports.AbstractComponentManager = AbstractManager;
|
5180 |
|
5181 | function instrumentationPayload(def) {
|
5182 | return {
|
5183 | object: `${def.name}:${def.outlet}`
|
5184 | };
|
5185 | }
|
5186 |
|
5187 | var CAPABILITIES = {
|
5188 | dynamicLayout: false,
|
5189 | dynamicTag: false,
|
5190 | prepareArgs: false,
|
5191 | createArgs: _environment2.ENV._DEBUG_RENDER_TREE,
|
5192 | attributeHook: false,
|
5193 | elementHook: false,
|
5194 | createCaller: false,
|
5195 | dynamicScope: true,
|
5196 | updateHook: _environment2.ENV._DEBUG_RENDER_TREE,
|
5197 | createInstance: true,
|
5198 | wrapped: false,
|
5199 | willDestroy: false
|
5200 | };
|
5201 |
|
5202 | class OutletComponentManager extends AbstractManager {
|
5203 | create(environment, definition, args, dynamicScope) {
|
5204 | var parentStateRef = dynamicScope.outletState;
|
5205 | var currentStateRef = definition.ref;
|
5206 | dynamicScope.outletState = currentStateRef;
|
5207 | var state = {
|
5208 | self: new _reference.ComponentRootReference(definition.controller, environment),
|
5209 | environment,
|
5210 | finalize: (0, _instrumentation._instrumentStart)('render.outlet', instrumentationPayload, definition)
|
5211 | };
|
5212 |
|
5213 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
5214 | state.outlet = {
|
5215 | name: definition.outlet
|
5216 | };
|
5217 | environment.extra.debugRenderTree.create(state.outlet, {
|
5218 | type: 'outlet',
|
5219 | name: state.outlet.name,
|
5220 | args: _runtime2.EMPTY_ARGS,
|
5221 | instance: undefined,
|
5222 | template: undefined
|
5223 | });
|
5224 | var parentState = parentStateRef.value();
|
5225 | var parentOwner = parentState && parentState.render && parentState.render.owner;
|
5226 | var currentOwner = currentStateRef.value().render.owner;
|
5227 |
|
5228 | if (parentOwner && parentOwner !== currentOwner) {
|
5229 | var engine = currentOwner;
|
5230 | (true && !(typeof currentOwner.mountPoint === 'string') && (0, _debug.assert)('invalid engine: missing mountPoint', typeof currentOwner.mountPoint === 'string'));
|
5231 | (true && !(currentOwner.routable === true) && (0, _debug.assert)('invalid engine: missing routable', currentOwner.routable === true));
|
5232 | var mountPoint = engine.mountPoint;
|
5233 | state.engine = {
|
5234 | mountPoint
|
5235 | };
|
5236 | environment.extra.debugRenderTree.create(state.engine, {
|
5237 | type: 'engine',
|
5238 | name: mountPoint,
|
5239 | args: _runtime2.EMPTY_ARGS,
|
5240 | instance: engine,
|
5241 | template: undefined
|
5242 | });
|
5243 | }
|
5244 |
|
5245 | environment.extra.debugRenderTree.create(state, {
|
5246 | type: 'route-template',
|
5247 | name: definition.name,
|
5248 | args: args.capture(),
|
5249 | instance: definition.controller,
|
5250 | template: definition.template
|
5251 | });
|
5252 | (0, _runtime2.registerDestructor)(state, () => {
|
5253 | state.environment.extra.debugRenderTree.willDestroy(state);
|
5254 |
|
5255 | if (state.engine) {
|
5256 | state.environment.extra.debugRenderTree.willDestroy(state.engine);
|
5257 | }
|
5258 |
|
5259 | state.environment.extra.debugRenderTree.willDestroy(state.outlet);
|
5260 | });
|
5261 | }
|
5262 |
|
5263 | return state;
|
5264 | }
|
5265 |
|
5266 | getJitStaticLayout({
|
5267 | template
|
5268 | }, _resolver) {
|
5269 |
|
5270 | return (0, _util.unwrapTemplate)(template).asLayout();
|
5271 | }
|
5272 |
|
5273 | getCapabilities() {
|
5274 | return CAPABILITIES;
|
5275 | }
|
5276 |
|
5277 | getSelf({
|
5278 | self
|
5279 | }) {
|
5280 | return self;
|
5281 | }
|
5282 |
|
5283 | getTag() {
|
5284 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
5285 |
|
5286 | return (0, _validator.createTag)();
|
5287 | } else {
|
5288 |
|
5289 | return _validator.CONSTANT_TAG;
|
5290 | }
|
5291 | }
|
5292 |
|
5293 | didRenderLayout(state, bounds) {
|
5294 | state.finalize();
|
5295 |
|
5296 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
5297 | state.environment.extra.debugRenderTree.didRender(state, bounds);
|
5298 |
|
5299 | if (state.engine) {
|
5300 | state.environment.extra.debugRenderTree.didRender(state.engine, bounds);
|
5301 | }
|
5302 |
|
5303 | state.environment.extra.debugRenderTree.didRender(state.outlet, bounds);
|
5304 | }
|
5305 | }
|
5306 |
|
5307 | update(state) {
|
5308 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
5309 | state.environment.extra.debugRenderTree.update(state.outlet);
|
5310 |
|
5311 | if (state.engine) {
|
5312 | state.environment.extra.debugRenderTree.update(state.engine);
|
5313 | }
|
5314 |
|
5315 | state.environment.extra.debugRenderTree.update(state);
|
5316 | }
|
5317 | }
|
5318 |
|
5319 | didUpdateLayout(state, bounds) {
|
5320 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
5321 | state.environment.extra.debugRenderTree.didRender(state, bounds);
|
5322 |
|
5323 | if (state.engine) {
|
5324 | state.environment.extra.debugRenderTree.didRender(state.engine, bounds);
|
5325 | }
|
5326 |
|
5327 | state.environment.extra.debugRenderTree.didRender(state.outlet, bounds);
|
5328 | }
|
5329 | }
|
5330 |
|
5331 | getDestroyable(state) {
|
5332 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
5333 | return state;
|
5334 | } else {
|
5335 | return null;
|
5336 | }
|
5337 | }
|
5338 |
|
5339 | }
|
5340 |
|
5341 | var OUTLET_MANAGER = new OutletComponentManager();
|
5342 |
|
5343 | class OutletComponentDefinition {
|
5344 | constructor(state, manager = OUTLET_MANAGER) {
|
5345 | this.state = state;
|
5346 | this.manager = manager;
|
5347 | }
|
5348 |
|
5349 | }
|
5350 |
|
5351 | function createRootOutlet(outletView) {
|
5352 | if (_environment2.ENV._APPLICATION_TEMPLATE_WRAPPER) {
|
5353 | var WRAPPED_CAPABILITIES = (0, _polyfills.assign)({}, CAPABILITIES, {
|
5354 | dynamicTag: true,
|
5355 | elementHook: true,
|
5356 | wrapped: true
|
5357 | });
|
5358 | var WrappedOutletComponentManager = class extends OutletComponentManager {
|
5359 | getTagName(_component) {
|
5360 | return 'div';
|
5361 | }
|
5362 |
|
5363 | getJitStaticLayout({
|
5364 | template
|
5365 | }) {
|
5366 |
|
5367 | return (0, _util.unwrapTemplate)(template).asWrappedLayout();
|
5368 | }
|
5369 |
|
5370 | getCapabilities() {
|
5371 | return WRAPPED_CAPABILITIES;
|
5372 | }
|
5373 |
|
5374 | didCreateElement(component, element, _operations) {
|
5375 |
|
5376 | element.setAttribute('class', 'ember-view');
|
5377 | element.setAttribute('id', (0, _utils.guidFor)(component));
|
5378 | }
|
5379 |
|
5380 | };
|
5381 | var WRAPPED_OUTLET_MANAGER = new WrappedOutletComponentManager();
|
5382 | return new OutletComponentDefinition(outletView.state, WRAPPED_OUTLET_MANAGER);
|
5383 | } else {
|
5384 | return new OutletComponentDefinition(outletView.state);
|
5385 | }
|
5386 | }
|
5387 |
|
5388 | function NOOP() {}
|
5389 | |
5390 |
|
5391 |
|
5392 |
|
5393 | |
5394 |
|
5395 |
|
5396 |
|
5397 |
|
5398 |
|
5399 |
|
5400 |
|
5401 | class ComponentStateBucket {
|
5402 | constructor(environment, component, args, finalizer, hasWrappedElement) {
|
5403 | this.environment = environment;
|
5404 | this.component = component;
|
5405 | this.args = args;
|
5406 | this.finalizer = finalizer;
|
5407 | this.hasWrappedElement = hasWrappedElement;
|
5408 | this.classRef = null;
|
5409 | this.classRef = null;
|
5410 | this.argsRevision = args === null ? 0 : (0, _validator.valueForTag)(args.tag);
|
5411 | this.rootRef = new _reference.ComponentRootReference(component, environment);
|
5412 | (0, _runtime2.registerDestructor)(this, () => this.willDestroy(), true);
|
5413 | (0, _runtime2.registerDestructor)(this, () => this.component.destroy());
|
5414 | }
|
5415 |
|
5416 | willDestroy() {
|
5417 | var {
|
5418 | component,
|
5419 | environment
|
5420 | } = this;
|
5421 |
|
5422 | if (environment.isInteractive) {
|
5423 | component.trigger('willDestroyElement');
|
5424 | component.trigger('willClearRender');
|
5425 | var element = (0, _views.getViewElement)(component);
|
5426 |
|
5427 | if (element) {
|
5428 | (0, _views.clearElementView)(element);
|
5429 | (0, _views.clearViewElement)(component);
|
5430 | }
|
5431 | }
|
5432 |
|
5433 | component.renderer.unregister(component);
|
5434 | }
|
5435 |
|
5436 | finalize() {
|
5437 | var {
|
5438 | finalizer
|
5439 | } = this;
|
5440 | finalizer();
|
5441 | this.finalizer = NOOP;
|
5442 | }
|
5443 |
|
5444 | }
|
5445 |
|
5446 | class EmberHelperRootReference extends _reference.HelperRootReference {
|
5447 | constructor(helper$$1, args, env) {
|
5448 | var fnWrapper = args => {
|
5449 | var {
|
5450 | positional,
|
5451 | named
|
5452 | } = args;
|
5453 | var positionalValue = positional.value();
|
5454 | var namedValue = named.value();
|
5455 | var ret;
|
5456 |
|
5457 | if (true
|
5458 |
|
5459 | ) {
|
5460 | (0, _debug.debugFreeze)(positionalValue);
|
5461 | (0, _debug.debugFreeze)(namedValue);
|
5462 | (0, _validator.deprecateMutationsInAutotrackingTransaction)(() => {
|
5463 | ret = helper$$1.compute(positionalValue, namedValue);
|
5464 | });
|
5465 | } else {
|
5466 | ret = helper$$1.compute(positionalValue, namedValue);
|
5467 | }
|
5468 |
|
5469 | if (helper$$1[RECOMPUTE_TAG]) {
|
5470 | (0, _validator.consumeTag)(helper$$1[RECOMPUTE_TAG]);
|
5471 | }
|
5472 |
|
5473 | return ret;
|
5474 | };
|
5475 |
|
5476 | if (true
|
5477 |
|
5478 | ) {
|
5479 | var debugName = isClassHelper(helper$$1) ? (0, _utils.getDebugName)(helper$$1) : (0, _utils.getDebugName)(helper$$1.compute);
|
5480 | super(fnWrapper, args, env, debugName);
|
5481 | } else {
|
5482 | super(fnWrapper, args, env);
|
5483 | }
|
5484 | }
|
5485 |
|
5486 | }
|
5487 |
|
5488 | class UnboundRootReference extends _reference.RootReference {
|
5489 | constructor(inner, env, parent, key) {
|
5490 | super(env);
|
5491 | this.inner = inner;
|
5492 | this.env = env;
|
5493 |
|
5494 | if (true
|
5495 |
|
5496 | ) {
|
5497 | env.setTemplatePathDebugContext(this, key || 'this', parent || null);
|
5498 | }
|
5499 | }
|
5500 |
|
5501 | value() {
|
5502 | return this.inner;
|
5503 | }
|
5504 |
|
5505 | get(key) {
|
5506 | var value = this.value();
|
5507 |
|
5508 | if ((0, _utils.isObject)(value)) {
|
5509 |
|
5510 | return new UnboundPropertyReference(value[key], this.env, this, key);
|
5511 | } else {
|
5512 | return _runtime2.PrimitiveReference.create(value);
|
5513 | }
|
5514 | }
|
5515 |
|
5516 | }
|
5517 |
|
5518 | class UnboundPropertyReference extends UnboundRootReference {}
|
5519 |
|
5520 | function referenceFromParts(root, parts) {
|
5521 | var reference = root;
|
5522 |
|
5523 | for (var i = 0; i < parts.length; i++) {
|
5524 | reference = reference.get(parts[i]);
|
5525 | }
|
5526 |
|
5527 | return reference;
|
5528 | }
|
5529 |
|
5530 | function referenceForKey(rootRef, key) {
|
5531 | return rootRef.get(key);
|
5532 | }
|
5533 |
|
5534 | function referenceForParts(rootRef, parts) {
|
5535 | var isAttrs = parts[0] === 'attrs';
|
5536 |
|
5537 | if (isAttrs) {
|
5538 | parts.shift();
|
5539 |
|
5540 | if (parts.length === 1) {
|
5541 | return referenceForKey(rootRef, parts[0]);
|
5542 | }
|
5543 | }
|
5544 |
|
5545 | return referenceFromParts(rootRef, parts);
|
5546 | }
|
5547 |
|
5548 | var AttributeBinding = {
|
5549 | parse(microsyntax) {
|
5550 | var colonIndex = microsyntax.indexOf(':');
|
5551 |
|
5552 | if (colonIndex === -1) {
|
5553 | (true && !(microsyntax !== 'class') && (0, _debug.assert)('You cannot use class as an attributeBinding, use classNameBindings instead.', microsyntax !== 'class'));
|
5554 | return [microsyntax, microsyntax, true];
|
5555 | } else {
|
5556 | var prop = microsyntax.substring(0, colonIndex);
|
5557 | var attribute = microsyntax.substring(colonIndex + 1);
|
5558 | (true && !(attribute !== 'class') && (0, _debug.assert)('You cannot use class as an attributeBinding, use classNameBindings instead.', attribute !== 'class'));
|
5559 | return [prop, attribute, false];
|
5560 | }
|
5561 | },
|
5562 |
|
5563 | install(component, rootRef, parsed, operations, env) {
|
5564 | var [prop, attribute, isSimple] = parsed;
|
5565 |
|
5566 | if (attribute === 'id') {
|
5567 | var elementId = (0, _metal.get)(component, prop);
|
5568 |
|
5569 | if (elementId === undefined || elementId === null) {
|
5570 | elementId = component.elementId;
|
5571 | }
|
5572 |
|
5573 | elementId = _runtime2.PrimitiveReference.create(elementId);
|
5574 | operations.setAttribute('id', elementId, true, null);
|
5575 |
|
5576 | return;
|
5577 | }
|
5578 |
|
5579 | var isPath = prop.indexOf('.') > -1;
|
5580 | var reference = isPath ? referenceForParts(rootRef, prop.split('.')) : referenceForKey(rootRef, prop);
|
5581 | (true && !(!(isSimple && isPath)) && (0, _debug.assert)(`Illegal attributeBinding: '${prop}' is not a valid attribute name.`, !(isSimple && isPath)));
|
5582 |
|
5583 | if (_deprecatedFeatures.EMBER_COMPONENT_IS_VISIBLE && attribute === 'style' && StyleBindingReference !== undefined) {
|
5584 | reference = new StyleBindingReference(rootRef, reference, referenceForKey(rootRef, 'isVisible'), env);
|
5585 | }
|
5586 |
|
5587 | operations.setAttribute(attribute, reference, false, null);
|
5588 | }
|
5589 |
|
5590 | };
|
5591 | var DISPLAY_NONE = 'display: none;';
|
5592 | var SAFE_DISPLAY_NONE = htmlSafe(DISPLAY_NONE);
|
5593 | var StyleBindingReference;
|
5594 | var installIsVisibleBinding;
|
5595 |
|
5596 | if (_deprecatedFeatures.EMBER_COMPONENT_IS_VISIBLE) {
|
5597 | StyleBindingReference = class {
|
5598 | constructor(parent, inner, isVisible, env) {
|
5599 | this.inner = inner;
|
5600 | this.isVisible = isVisible;
|
5601 | this.env = env;
|
5602 | this.tag = (0, _validator.combine)([inner.tag, isVisible.tag]);
|
5603 |
|
5604 | if (true
|
5605 |
|
5606 | ) {
|
5607 | env.setTemplatePathDebugContext(this, 'style', parent);
|
5608 | }
|
5609 | }
|
5610 |
|
5611 | value() {
|
5612 | var value = this.inner.value();
|
5613 | var isVisible = this.isVisible.value();
|
5614 |
|
5615 | if (isVisible !== undefined) {
|
5616 | (true && !(false) && (0, _debug.deprecate)(`The \`isVisible\` property on classic component classes is deprecated. Was accessed ${this.env.getTemplatePathDebugContext(this).replace(/^W/, 'w')}`, false, {
|
5617 | id: 'ember-component.is-visible',
|
5618 | until: '4.0.0',
|
5619 | url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-is-visible'
|
5620 | }));
|
5621 | }
|
5622 |
|
5623 | if (isVisible !== false) {
|
5624 | return value;
|
5625 | } else if (!value) {
|
5626 | return SAFE_DISPLAY_NONE;
|
5627 | } else {
|
5628 | var style = value + ' ' + DISPLAY_NONE;
|
5629 | return isHTMLSafe(value) ? htmlSafe(style) : style;
|
5630 | }
|
5631 | }
|
5632 |
|
5633 | get() {
|
5634 | return _runtime2.UNDEFINED_REFERENCE;
|
5635 | }
|
5636 |
|
5637 | };
|
5638 |
|
5639 | installIsVisibleBinding = (rootRef, operations, environment) => {
|
5640 | operations.setAttribute('style', new StyleBindingReference(rootRef, _runtime2.UNDEFINED_REFERENCE, rootRef.get('isVisible'), environment), false, null);
|
5641 | };
|
5642 | }
|
5643 |
|
5644 | var ClassNameBinding = {
|
5645 | install(_element, rootRef, microsyntax, operations) {
|
5646 | var [prop, truthy, falsy] = microsyntax.split(':');
|
5647 | var isStatic = prop === '';
|
5648 |
|
5649 | if (isStatic) {
|
5650 | operations.setAttribute('class', _runtime2.PrimitiveReference.create(truthy), true, null);
|
5651 | } else {
|
5652 | var isPath = prop.indexOf('.') > -1;
|
5653 | var parts = isPath ? prop.split('.') : [];
|
5654 | var value = isPath ? referenceForParts(rootRef, parts) : referenceForKey(rootRef, prop);
|
5655 | var ref;
|
5656 |
|
5657 | if (truthy === undefined) {
|
5658 | ref = new SimpleClassNameBindingReference(value, isPath ? parts[parts.length - 1] : prop);
|
5659 | } else {
|
5660 | ref = new ColonClassNameBindingReference(value, truthy, falsy);
|
5661 | }
|
5662 |
|
5663 | operations.setAttribute('class', ref, false, null);
|
5664 | }
|
5665 | }
|
5666 |
|
5667 | };
|
5668 |
|
5669 | class SimpleClassNameBindingReference {
|
5670 | constructor(inner, path) {
|
5671 | this.inner = inner;
|
5672 | this.path = path;
|
5673 | this.tag = inner.tag;
|
5674 | this.dasherizedPath = null;
|
5675 | }
|
5676 |
|
5677 | value() {
|
5678 | var value = this.inner.value();
|
5679 |
|
5680 | if (value === true) {
|
5681 | var {
|
5682 | path,
|
5683 | dasherizedPath
|
5684 | } = this;
|
5685 | return dasherizedPath || (this.dasherizedPath = (0, _string.dasherize)(path));
|
5686 | } else if (value || value === 0) {
|
5687 | return String(value);
|
5688 | } else {
|
5689 | return null;
|
5690 | }
|
5691 | }
|
5692 |
|
5693 | }
|
5694 |
|
5695 | class ColonClassNameBindingReference {
|
5696 | constructor(inner, truthy = null, falsy = null) {
|
5697 | this.inner = inner;
|
5698 | this.truthy = truthy;
|
5699 | this.falsy = falsy;
|
5700 | this.tag = inner.tag;
|
5701 | }
|
5702 |
|
5703 | value() {
|
5704 | var {
|
5705 | inner,
|
5706 | truthy,
|
5707 | falsy
|
5708 | } = this;
|
5709 | return inner.value() ? truthy : falsy;
|
5710 | }
|
5711 |
|
5712 | }
|
5713 | |
5714 |
|
5715 |
|
5716 |
|
5717 | |
5718 |
|
5719 |
|
5720 |
|
5721 |
|
5722 |
|
5723 |
|
5724 |
|
5725 |
|
5726 |
|
5727 |
|
5728 |
|
5729 |
|
5730 |
|
5731 |
|
5732 |
|
5733 |
|
5734 |
|
5735 |
|
5736 |
|
5737 |
|
5738 |
|
5739 |
|
5740 |
|
5741 |
|
5742 |
|
5743 |
|
5744 |
|
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 |
|
5750 |
|
5751 |
|
5752 |
|
5753 |
|
5754 |
|
5755 |
|
5756 |
|
5757 |
|
5758 |
|
5759 |
|
5760 |
|
5761 |
|
5762 |
|
5763 |
|
5764 |
|
5765 |
|
5766 |
|
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 |
|
5772 |
|
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 |
|
5781 |
|
5782 |
|
5783 |
|
5784 |
|
5785 |
|
5786 |
|
5787 |
|
5788 |
|
5789 |
|
5790 |
|
5791 |
|
5792 | var INVOKE = (0, _utils.symbol)('INVOKE');
|
5793 | _exports.INVOKE = INVOKE;
|
5794 | var SOURCE = (0, _utils.symbol)('SOURCE');
|
5795 |
|
5796 | class MutReference extends _reference.RootReference {
|
5797 | constructor(inner, env) {
|
5798 | super(env);
|
5799 | this.inner = inner;
|
5800 | this.tag = inner.tag;
|
5801 | this[SOURCE] = inner;
|
5802 | }
|
5803 |
|
5804 | value() {
|
5805 | return this.inner.value();
|
5806 | }
|
5807 |
|
5808 | get(key) {
|
5809 | return this.inner.get(key);
|
5810 | }
|
5811 |
|
5812 | [_reference.UPDATE_REFERENCED_VALUE](value) {
|
5813 | return this.inner[_reference.UPDATE_REFERENCED_VALUE](value);
|
5814 | }
|
5815 |
|
5816 | [INVOKE](value) {
|
5817 | return this.inner[_reference.UPDATE_REFERENCED_VALUE](value);
|
5818 | }
|
5819 |
|
5820 | }
|
5821 |
|
5822 | function unMut(ref) {
|
5823 | return ref[SOURCE] || ref;
|
5824 | }
|
5825 |
|
5826 | function mut(args, vm) {
|
5827 | var rawRef = args.positional.at(0);
|
5828 |
|
5829 | if (typeof rawRef[INVOKE] === 'function') {
|
5830 | return rawRef;
|
5831 | }
|
5832 |
|
5833 |
|
5834 |
|
5835 |
|
5836 |
|
5837 |
|
5838 |
|
5839 |
|
5840 |
|
5841 |
|
5842 |
|
5843 |
|
5844 |
|
5845 | (true && !(rawRef[_reference.UPDATE_REFERENCED_VALUE] !== undefined) && (0, _debug.assert)('You can only pass a path to mut', rawRef[_reference.UPDATE_REFERENCED_VALUE] !== undefined));
|
5846 | return new MutReference(rawRef, vm.env);
|
5847 | }
|
5848 | |
5849 |
|
5850 |
|
5851 |
|
5852 |
|
5853 | var ACTION = (0, _utils.symbol)('ACTION');
|
5854 | |
5855 |
|
5856 |
|
5857 |
|
5858 |
|
5859 |
|
5860 |
|
5861 |
|
5862 |
|
5863 |
|
5864 |
|
5865 |
|
5866 |
|
5867 |
|
5868 |
|
5869 |
|
5870 |
|
5871 |
|
5872 |
|
5873 |
|
5874 |
|
5875 |
|
5876 |
|
5877 |
|
5878 |
|
5879 |
|
5880 |
|
5881 |
|
5882 |
|
5883 |
|
5884 |
|
5885 |
|
5886 |
|
5887 |
|
5888 |
|
5889 |
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 |
|
5895 |
|
5896 |
|
5897 |
|
5898 |
|
5899 |
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 |
|
5905 |
|
5906 |
|
5907 |
|
5908 |
|
5909 |
|
5910 |
|
5911 |
|
5912 |
|
5913 |
|
5914 |
|
5915 |
|
5916 |
|
5917 |
|
5918 |
|
5919 |
|
5920 |
|
5921 |
|
5922 |
|
5923 |
|
5924 |
|
5925 |
|
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 |
|
5931 |
|
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 |
|
5938 |
|
5939 |
|
5940 |
|
5941 |
|
5942 |
|
5943 |
|
5944 |
|
5945 |
|
5946 |
|
5947 |
|
5948 |
|
5949 |
|
5950 |
|
5951 |
|
5952 |
|
5953 |
|
5954 |
|
5955 |
|
5956 |
|
5957 |
|
5958 |
|
5959 |
|
5960 |
|
5961 |
|
5962 |
|
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 |
|
5968 |
|
5969 |
|
5970 |
|
5971 |
|
5972 |
|
5973 |
|
5974 |
|
5975 |
|
5976 |
|
5977 |
|
5978 |
|
5979 |
|
5980 |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 |
|
5986 |
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 |
|
5998 |
|
5999 |
|
6000 |
|
6001 |
|
6002 |
|
6003 |
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 |
|
6015 |
|
6016 |
|
6017 |
|
6018 |
|
6019 |
|
6020 |
|
6021 |
|
6022 |
|
6023 |
|
6024 |
|
6025 |
|
6026 |
|
6027 |
|
6028 |
|
6029 |
|
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 |
|
6038 |
|
6039 |
|
6040 |
|
6041 |
|
6042 |
|
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 |
|
6052 |
|
6053 |
|
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 |
|
6059 |
|
6060 |
|
6061 |
|
6062 |
|
6063 |
|
6064 |
|
6065 |
|
6066 |
|
6067 |
|
6068 |
|
6069 |
|
6070 |
|
6071 |
|
6072 |
|
6073 |
|
6074 |
|
6075 |
|
6076 |
|
6077 |
|
6078 |
|
6079 |
|
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 |
|
6085 |
|
6086 |
|
6087 |
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 |
|
6095 |
|
6096 |
|
6097 |
|
6098 |
|
6099 |
|
6100 |
|
6101 |
|
6102 |
|
6103 |
|
6104 |
|
6105 |
|
6106 |
|
6107 |
|
6108 |
|
6109 |
|
6110 |
|
6111 |
|
6112 |
|
6113 |
|
6114 |
|
6115 |
|
6116 |
|
6117 |
|
6118 | function action(args, vm) {
|
6119 | var {
|
6120 | named,
|
6121 | positional
|
6122 | } = args;
|
6123 | var capturedArgs = positional.capture();
|
6124 |
|
6125 |
|
6126 |
|
6127 |
|
6128 | var [context, action, ...restArgs] = capturedArgs.references;
|
6129 |
|
6130 | var debugKey = action.propertyKey;
|
6131 | var target = named.has('target') ? named.get('target') : context;
|
6132 | var processArgs = makeArgsProcessor(named.has('value') && named.get('value'), restArgs);
|
6133 | var fn;
|
6134 |
|
6135 | if (typeof action[INVOKE] === 'function') {
|
6136 | fn = makeClosureAction(action, action, action[INVOKE], processArgs, debugKey);
|
6137 | } else if ((0, _validator.isConstTagged)(target) && (0, _validator.isConstTagged)(action)) {
|
6138 | fn = makeClosureAction(context.value(), target.value(), action.value(), processArgs, debugKey);
|
6139 | } else {
|
6140 | fn = makeDynamicClosureAction(context.value(), target, action, processArgs, debugKey);
|
6141 | }
|
6142 |
|
6143 | fn[ACTION] = true;
|
6144 | return new UnboundRootReference(fn, vm.env);
|
6145 | }
|
6146 |
|
6147 | function NOOP$1(args) {
|
6148 | return args;
|
6149 | }
|
6150 |
|
6151 | function makeArgsProcessor(valuePathRef, actionArgsRef) {
|
6152 | var mergeArgs;
|
6153 |
|
6154 | if (actionArgsRef.length > 0) {
|
6155 | mergeArgs = args => {
|
6156 | return actionArgsRef.map(ref => ref.value()).concat(args);
|
6157 | };
|
6158 | }
|
6159 |
|
6160 | var readValue;
|
6161 |
|
6162 | if (valuePathRef) {
|
6163 | readValue = args => {
|
6164 | var valuePath = valuePathRef.value();
|
6165 |
|
6166 | if (valuePath && args.length > 0) {
|
6167 | args[0] = (0, _metal.get)(args[0], valuePath);
|
6168 | }
|
6169 |
|
6170 | return args;
|
6171 | };
|
6172 | }
|
6173 |
|
6174 | if (mergeArgs && readValue) {
|
6175 | return args => {
|
6176 | return readValue(mergeArgs(args));
|
6177 | };
|
6178 | } else {
|
6179 | return mergeArgs || readValue || NOOP$1;
|
6180 | }
|
6181 | }
|
6182 |
|
6183 | function makeDynamicClosureAction(context, targetRef, actionRef, processArgs, debugKey) {
|
6184 |
|
6185 | if (true
|
6186 |
|
6187 | ) {
|
6188 | makeClosureAction(context, targetRef.value(), actionRef.value(), processArgs, debugKey);
|
6189 | }
|
6190 |
|
6191 | return (...args) => {
|
6192 | return makeClosureAction(context, targetRef.value(), actionRef.value(), processArgs, debugKey)(...args);
|
6193 | };
|
6194 | }
|
6195 |
|
6196 | function makeClosureAction(context, target, action, processArgs, debugKey) {
|
6197 | var self;
|
6198 | var fn;
|
6199 | (true && !(action !== undefined && action !== null) && (0, _debug.assert)(`Action passed is null or undefined in (action) from ${target}.`, action !== undefined && action !== null));
|
6200 |
|
6201 | if (typeof action[INVOKE] === 'function') {
|
6202 | self = action;
|
6203 | fn = action[INVOKE];
|
6204 | } else {
|
6205 | var typeofAction = typeof action;
|
6206 |
|
6207 | if (typeofAction === 'string') {
|
6208 | self = target;
|
6209 | fn = target.actions && target.actions[action];
|
6210 | (true && !(fn) && (0, _debug.assert)(`An action named '${action}' was not found in ${target}`, fn));
|
6211 | } else if (typeofAction === 'function') {
|
6212 | self = context;
|
6213 | fn = action;
|
6214 | } else {
|
6215 |
|
6216 | (true && !(false) && (0, _debug.assert)(`An action could not be made for \`${debugKey || action}\` in ${target}. Please confirm that you are using either a quoted action name (i.e. \`(action '${debugKey || 'myAction'}')\`) or a function available in ${target}.`, false));
|
6217 | }
|
6218 | }
|
6219 |
|
6220 | return (...args) => {
|
6221 | var payload = {
|
6222 | target: self,
|
6223 | args,
|
6224 | label: '@glimmer/closure-action'
|
6225 | };
|
6226 | return (0, _instrumentation.flaggedInstrument)('interaction.ember-action', payload, () => {
|
6227 | return (0, _runloop.join)(self, fn, ...processArgs(args));
|
6228 | });
|
6229 | };
|
6230 | }
|
6231 |
|
6232 |
|
6233 |
|
6234 | function processComponentArgs(namedArgs) {
|
6235 | var keys = namedArgs.names;
|
6236 | var attrs = namedArgs.value();
|
6237 | var props = Object.create(null);
|
6238 | var args = Object.create(null);
|
6239 | props[ARGS] = args;
|
6240 |
|
6241 | for (var i = 0; i < keys.length; i++) {
|
6242 | var name = keys[i];
|
6243 | var ref = namedArgs.get(name);
|
6244 | var value = attrs[name];
|
6245 |
|
6246 | if (typeof value === 'function' && value[ACTION]) {
|
6247 | attrs[name] = value;
|
6248 | } else if (ref[_reference.UPDATE_REFERENCED_VALUE]) {
|
6249 | attrs[name] = new MutableCell(ref, value);
|
6250 | }
|
6251 |
|
6252 | args[name] = ref;
|
6253 | props[name] = value;
|
6254 | }
|
6255 |
|
6256 | props.attrs = attrs;
|
6257 | return props;
|
6258 | }
|
6259 |
|
6260 | var REF = (0, _utils.symbol)('REF');
|
6261 |
|
6262 | class MutableCell {
|
6263 | constructor(ref, value) {
|
6264 | this[_views.MUTABLE_CELL] = true;
|
6265 | this[REF] = ref;
|
6266 | this.value = value;
|
6267 | }
|
6268 |
|
6269 | update(val) {
|
6270 | this[REF][_reference.UPDATE_REFERENCED_VALUE](val);
|
6271 | }
|
6272 |
|
6273 | }
|
6274 |
|
6275 | var __rest = undefined && undefined.__rest || function (s, e) {
|
6276 | var t = {};
|
6277 |
|
6278 | for (var p in s) {
|
6279 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
6280 | }
|
6281 |
|
6282 | if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
6283 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
6284 | }
|
6285 | return t;
|
6286 | };
|
6287 |
|
6288 | function aliasIdToElementId(args, props) {
|
6289 | if (args.named.has('id')) {
|
6290 |
|
6291 | (true && !(!args.named.has('elementId')) && (0, _debug.assert)(`You cannot invoke a component with both 'id' and 'elementId' at the same time.`, !args.named.has('elementId')));
|
6292 | props.elementId = props.id;
|
6293 | }
|
6294 | }
|
6295 |
|
6296 |
|
6297 |
|
6298 |
|
6299 | function applyAttributeBindings(attributeBindings, component, rootRef, operations, environment) {
|
6300 | var seen = [];
|
6301 | var i = attributeBindings.length - 1;
|
6302 |
|
6303 | while (i !== -1) {
|
6304 | var binding = attributeBindings[i];
|
6305 | var parsed = AttributeBinding.parse(binding);
|
6306 | var attribute = parsed[1];
|
6307 |
|
6308 | if (seen.indexOf(attribute) === -1) {
|
6309 | seen.push(attribute);
|
6310 | AttributeBinding.install(component, rootRef, parsed, operations, environment);
|
6311 | }
|
6312 |
|
6313 | i--;
|
6314 | }
|
6315 |
|
6316 | if (seen.indexOf('id') === -1) {
|
6317 | var id$$1 = component.elementId ? component.elementId : (0, _utils.guidFor)(component);
|
6318 | operations.setAttribute('id', _runtime2.PrimitiveReference.create(id$$1), false, null);
|
6319 | }
|
6320 |
|
6321 | if (_deprecatedFeatures.EMBER_COMPONENT_IS_VISIBLE && installIsVisibleBinding !== undefined && seen.indexOf('style') === -1) {
|
6322 | installIsVisibleBinding(rootRef, operations, environment);
|
6323 | }
|
6324 | }
|
6325 |
|
6326 | var DEFAULT_LAYOUT = (0, _container.privatize)`template:components/-default`;
|
6327 | var EMPTY_POSITIONAL_ARGS = [];
|
6328 | (0, _debug.debugFreeze)(EMPTY_POSITIONAL_ARGS);
|
6329 |
|
6330 | class CurlyComponentManager extends AbstractManager {
|
6331 | templateFor(component) {
|
6332 | var {
|
6333 | layout,
|
6334 | layoutName
|
6335 | } = component;
|
6336 | var owner = (0, _owner.getOwner)(component);
|
6337 | var factory;
|
6338 |
|
6339 | if (layout === undefined) {
|
6340 | if (layoutName !== undefined) {
|
6341 | var _factory = owner.lookup(`template:${layoutName}`);
|
6342 |
|
6343 | (true && !(_factory !== undefined) && (0, _debug.assert)(`Layout \`${layoutName}\` not found!`, _factory !== undefined));
|
6344 | factory = _factory;
|
6345 | } else {
|
6346 | factory = owner.lookup(DEFAULT_LAYOUT);
|
6347 | }
|
6348 | } else if (isTemplateFactory(layout)) {
|
6349 | factory = layout;
|
6350 | } else {
|
6351 |
|
6352 | return layout;
|
6353 | }
|
6354 |
|
6355 | return factory(owner);
|
6356 | }
|
6357 |
|
6358 | getJitStaticLayout(state, _resolver) {
|
6359 | return (0, _util.unwrapTemplate)(state.template).asLayout();
|
6360 | }
|
6361 |
|
6362 | getJitDynamicLayout(bucket) {
|
6363 | var component = bucket.component;
|
6364 | var template$$1 = this.templateFor(component);
|
6365 |
|
6366 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
6367 | bucket.environment.extra.debugRenderTree.setTemplate(bucket, template$$1);
|
6368 | }
|
6369 |
|
6370 | return template$$1;
|
6371 | }
|
6372 |
|
6373 | getTagName(state) {
|
6374 | var {
|
6375 | component,
|
6376 | hasWrappedElement
|
6377 | } = state;
|
6378 |
|
6379 | if (!hasWrappedElement) {
|
6380 | return null;
|
6381 | }
|
6382 |
|
6383 | return component && component.tagName || 'div';
|
6384 | }
|
6385 |
|
6386 | getCapabilities(state) {
|
6387 | return state.capabilities;
|
6388 | }
|
6389 |
|
6390 | prepareArgs(state, args) {
|
6391 | if (args.named.has('__ARGS__')) {
|
6392 | var _a = args.named.capture().map,
|
6393 | {
|
6394 | __ARGS__
|
6395 | } = _a,
|
6396 | rest = __rest(_a, ["__ARGS__"]);
|
6397 |
|
6398 | var prepared = {
|
6399 | positional: EMPTY_POSITIONAL_ARGS,
|
6400 | named: (0, _polyfills.assign)({}, rest, __ARGS__.value())
|
6401 | };
|
6402 | return prepared;
|
6403 | }
|
6404 |
|
6405 | var {
|
6406 | positionalParams
|
6407 | } = state.ComponentClass.class;
|
6408 |
|
6409 | if (positionalParams === undefined || positionalParams === null || args.positional.length === 0) {
|
6410 | return null;
|
6411 | }
|
6412 |
|
6413 | var named;
|
6414 |
|
6415 | if (typeof positionalParams === 'string') {
|
6416 | (true && !(!args.named.has(positionalParams)) && (0, _debug.assert)(`You cannot specify positional parameters and the hash argument \`${positionalParams}\`.`, !args.named.has(positionalParams)));
|
6417 | named = {
|
6418 | [positionalParams]: args.positional.capture()
|
6419 | };
|
6420 | (0, _polyfills.assign)(named, args.named.capture().map);
|
6421 | } else if (Array.isArray(positionalParams) && positionalParams.length > 0) {
|
6422 | var count = Math.min(positionalParams.length, args.positional.length);
|
6423 | named = {};
|
6424 | (0, _polyfills.assign)(named, args.named.capture().map);
|
6425 |
|
6426 | for (var i = 0; i < count; i++) {
|
6427 | var name = positionalParams[i];
|
6428 | (true && !(!args.named.has(name)) && (0, _debug.assert)(`You cannot specify both a positional param (at position ${i}) and the hash argument \`${name}\`.`, !args.named.has(name)));
|
6429 | named[name] = args.positional.at(i);
|
6430 | }
|
6431 | } else {
|
6432 | return null;
|
6433 | }
|
6434 |
|
6435 | return {
|
6436 | positional: _util.EMPTY_ARRAY,
|
6437 | named
|
6438 | };
|
6439 | }
|
6440 | |
6441 |
|
6442 |
|
6443 |
|
6444 |
|
6445 |
|
6446 |
|
6447 |
|
6448 | create(environment, state, args, dynamicScope, callerSelfRef, hasBlock) {
|
6449 |
|
6450 |
|
6451 | var parentView = dynamicScope.view;
|
6452 |
|
6453 | var factory = state.ComponentClass;
|
6454 |
|
6455 |
|
6456 | var capturedArgs = args.named.capture();
|
6457 | var props = processComponentArgs(capturedArgs);
|
6458 |
|
6459 | aliasIdToElementId(args, props);
|
6460 |
|
6461 |
|
6462 | props.parentView = parentView;
|
6463 |
|
6464 |
|
6465 |
|
6466 | props[HAS_BLOCK] = hasBlock;
|
6467 |
|
6468 |
|
6469 | props._target = callerSelfRef.value();
|
6470 |
|
6471 | if (state.template) {
|
6472 | props.layout = state.template;
|
6473 | }
|
6474 |
|
6475 |
|
6476 |
|
6477 |
|
6478 |
|
6479 |
|
6480 |
|
6481 |
|
6482 | var component = factory.create(props);
|
6483 | var finalizer = (0, _instrumentation._instrumentStart)('render.component', initialRenderInstrumentDetails, component);
|
6484 |
|
6485 |
|
6486 | dynamicScope.view = component;
|
6487 |
|
6488 |
|
6489 | if (parentView !== null && parentView !== undefined) {
|
6490 | (0, _views.addChildView)(parentView, component);
|
6491 | }
|
6492 |
|
6493 | component.trigger('didReceiveAttrs');
|
6494 | var hasWrappedElement = component.tagName !== '';
|
6495 |
|
6496 | if (!hasWrappedElement) {
|
6497 | if (environment.isInteractive) {
|
6498 | component.trigger('willRender');
|
6499 | }
|
6500 |
|
6501 | component._transitionTo('hasElement');
|
6502 |
|
6503 | if (environment.isInteractive) {
|
6504 | component.trigger('willInsertElement');
|
6505 | }
|
6506 | }
|
6507 |
|
6508 |
|
6509 |
|
6510 | var bucket = new ComponentStateBucket(environment, component, capturedArgs, finalizer, hasWrappedElement);
|
6511 |
|
6512 | if (args.named.has('class')) {
|
6513 | bucket.classRef = args.named.get('class');
|
6514 | }
|
6515 |
|
6516 | if (true
|
6517 |
|
6518 | ) {
|
6519 | processComponentInitializationAssertions(component, props);
|
6520 | }
|
6521 |
|
6522 | if (environment.isInteractive && hasWrappedElement) {
|
6523 | component.trigger('willRender');
|
6524 | }
|
6525 |
|
6526 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
6527 | environment.extra.debugRenderTree.create(bucket, {
|
6528 | type: 'component',
|
6529 | name: state.name,
|
6530 | args: args.capture(),
|
6531 | instance: component,
|
6532 | template: state.template
|
6533 | });
|
6534 | (0, _runtime2.registerDestructor)(bucket, () => {
|
6535 | environment.extra.debugRenderTree.willDestroy(bucket);
|
6536 | });
|
6537 | }
|
6538 |
|
6539 | return bucket;
|
6540 | }
|
6541 |
|
6542 | getSelf({
|
6543 | rootRef
|
6544 | }) {
|
6545 | return rootRef;
|
6546 | }
|
6547 |
|
6548 | didCreateElement({
|
6549 | component,
|
6550 | classRef,
|
6551 | environment,
|
6552 | rootRef
|
6553 | }, element, operations) {
|
6554 | (0, _views.setViewElement)(component, element);
|
6555 | (0, _views.setElementView)(element, component);
|
6556 | var {
|
6557 | attributeBindings,
|
6558 | classNames,
|
6559 | classNameBindings
|
6560 | } = component;
|
6561 |
|
6562 | if (attributeBindings && attributeBindings.length) {
|
6563 | applyAttributeBindings(attributeBindings, component, rootRef, operations, environment);
|
6564 | } else {
|
6565 | var id$$1 = component.elementId ? component.elementId : (0, _utils.guidFor)(component);
|
6566 | operations.setAttribute('id', _runtime2.PrimitiveReference.create(id$$1), false, null);
|
6567 |
|
6568 | if (_deprecatedFeatures.EMBER_COMPONENT_IS_VISIBLE) {
|
6569 | installIsVisibleBinding(rootRef, operations, environment);
|
6570 | }
|
6571 | }
|
6572 |
|
6573 | if (classRef) {
|
6574 | var ref = new SimpleClassNameBindingReference(classRef, classRef['propertyKey']);
|
6575 | operations.setAttribute('class', ref, false, null);
|
6576 | }
|
6577 |
|
6578 | if (classNames && classNames.length) {
|
6579 | classNames.forEach(name => {
|
6580 | operations.setAttribute('class', _runtime2.PrimitiveReference.create(name), false, null);
|
6581 | });
|
6582 | }
|
6583 |
|
6584 | if (classNameBindings && classNameBindings.length) {
|
6585 | classNameBindings.forEach(binding => {
|
6586 | ClassNameBinding.install(element, rootRef, binding, operations);
|
6587 | });
|
6588 | }
|
6589 |
|
6590 | operations.setAttribute('class', _runtime2.PrimitiveReference.create('ember-view'), false, null);
|
6591 |
|
6592 | if ('ariaRole' in component) {
|
6593 | operations.setAttribute('role', referenceForKey(rootRef, 'ariaRole'), false, null);
|
6594 | }
|
6595 |
|
6596 | component._transitionTo('hasElement');
|
6597 |
|
6598 | if (environment.isInteractive) {
|
6599 | component.trigger('willInsertElement');
|
6600 | }
|
6601 | }
|
6602 |
|
6603 | didRenderLayout(bucket, bounds) {
|
6604 | bucket.component[BOUNDS] = bounds;
|
6605 | bucket.finalize();
|
6606 |
|
6607 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
6608 | bucket.environment.extra.debugRenderTree.didRender(bucket, bounds);
|
6609 | }
|
6610 | }
|
6611 |
|
6612 | getTag({
|
6613 | args,
|
6614 | component
|
6615 | }) {
|
6616 | return args ? (0, _validator.combine)([args.tag, component[DIRTY_TAG]]) : component[DIRTY_TAG];
|
6617 | }
|
6618 |
|
6619 | didCreate({
|
6620 | component,
|
6621 | environment
|
6622 | }) {
|
6623 | if (environment.isInteractive) {
|
6624 | component._transitionTo('inDOM');
|
6625 |
|
6626 | component.trigger('didInsertElement');
|
6627 | component.trigger('didRender');
|
6628 | }
|
6629 | }
|
6630 |
|
6631 | update(bucket) {
|
6632 | var {
|
6633 | component,
|
6634 | args,
|
6635 | argsRevision,
|
6636 | environment
|
6637 | } = bucket;
|
6638 |
|
6639 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
6640 | environment.extra.debugRenderTree.update(bucket);
|
6641 | }
|
6642 |
|
6643 | bucket.finalizer = (0, _instrumentation._instrumentStart)('render.component', rerenderInstrumentDetails, component);
|
6644 |
|
6645 | if (args && !(0, _validator.validateTag)(args.tag, argsRevision)) {
|
6646 | var props = processComponentArgs(args);
|
6647 | bucket.argsRevision = (0, _validator.valueForTag)(args.tag);
|
6648 | component[IS_DISPATCHING_ATTRS] = true;
|
6649 | component.setProperties(props);
|
6650 | component[IS_DISPATCHING_ATTRS] = false;
|
6651 | component.trigger('didUpdateAttrs');
|
6652 | component.trigger('didReceiveAttrs');
|
6653 | }
|
6654 |
|
6655 | if (environment.isInteractive) {
|
6656 | component.trigger('willUpdate');
|
6657 | component.trigger('willRender');
|
6658 | }
|
6659 | }
|
6660 |
|
6661 | didUpdateLayout(bucket, bounds) {
|
6662 | bucket.finalize();
|
6663 |
|
6664 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
6665 | bucket.environment.extra.debugRenderTree.didRender(bucket, bounds);
|
6666 | }
|
6667 | }
|
6668 |
|
6669 | didUpdate({
|
6670 | component,
|
6671 | environment
|
6672 | }) {
|
6673 | if (environment.isInteractive) {
|
6674 | component.trigger('didUpdate');
|
6675 | component.trigger('didRender');
|
6676 | }
|
6677 | }
|
6678 |
|
6679 | getDestroyable(bucket) {
|
6680 | return bucket;
|
6681 | }
|
6682 |
|
6683 | }
|
6684 |
|
6685 | function processComponentInitializationAssertions(component, props) {
|
6686 | (true && !((() => {
|
6687 | var {
|
6688 | classNameBindings
|
6689 | } = component;
|
6690 |
|
6691 | for (var i = 0; i < classNameBindings.length; i++) {
|
6692 | var binding = classNameBindings[i];
|
6693 |
|
6694 | if (typeof binding !== 'string' || binding.length === 0) {
|
6695 | return false;
|
6696 | }
|
6697 | }
|
6698 |
|
6699 | return true;
|
6700 | })()) && (0, _debug.assert)(`classNameBindings must be non-empty strings: ${component}`, (() => {
|
6701 | var {
|
6702 | classNameBindings
|
6703 | } = component;
|
6704 |
|
6705 | for (var i = 0; i < classNameBindings.length; i++) {
|
6706 | var binding = classNameBindings[i];
|
6707 |
|
6708 | if (typeof binding !== 'string' || binding.length === 0) {
|
6709 | return false;
|
6710 | }
|
6711 | }
|
6712 |
|
6713 | return true;
|
6714 | })()));
|
6715 | (true && !((() => {
|
6716 | var {
|
6717 | classNameBindings
|
6718 | } = component;
|
6719 |
|
6720 | for (var i = 0; i < classNameBindings.length; i++) {
|
6721 | var binding = classNameBindings[i];
|
6722 |
|
6723 | if (binding.split(' ').length > 1) {
|
6724 | return false;
|
6725 | }
|
6726 | }
|
6727 |
|
6728 | return true;
|
6729 | })()) && (0, _debug.assert)(`classNameBindings must not have spaces in them: ${component}`, (() => {
|
6730 | var {
|
6731 | classNameBindings
|
6732 | } = component;
|
6733 |
|
6734 | for (var i = 0; i < classNameBindings.length; i++) {
|
6735 | var binding = classNameBindings[i];
|
6736 |
|
6737 | if (binding.split(' ').length > 1) {
|
6738 | return false;
|
6739 | }
|
6740 | }
|
6741 |
|
6742 | return true;
|
6743 | })()));
|
6744 | (true && !(component.tagName !== '' || !component.classNameBindings || component.classNameBindings.length === 0) && (0, _debug.assert)(`You cannot use \`classNameBindings\` on a tag-less component: ${component}`, component.tagName !== '' || !component.classNameBindings || component.classNameBindings.length === 0));
|
6745 | (true && !(component.tagName !== '' || props.id === component.elementId || !component.elementId && component.elementId !== '') && (0, _debug.assert)(`You cannot use \`elementId\` on a tag-less component: ${component}`, component.tagName !== '' || props.id === component.elementId || !component.elementId && component.elementId !== ''));
|
6746 | (true && !(component.tagName !== '' || !component.attributeBindings || component.attributeBindings.length === 0) && (0, _debug.assert)(`You cannot use \`attributeBindings\` on a tag-less component: ${component}`, component.tagName !== '' || !component.attributeBindings || component.attributeBindings.length === 0));
|
6747 | }
|
6748 |
|
6749 | function initialRenderInstrumentDetails(component) {
|
6750 | return component.instrumentDetails({
|
6751 | initialRender: true
|
6752 | });
|
6753 | }
|
6754 |
|
6755 | function rerenderInstrumentDetails(component) {
|
6756 | return component.instrumentDetails({
|
6757 | initialRender: false
|
6758 | });
|
6759 | }
|
6760 |
|
6761 | var CURLY_CAPABILITIES = {
|
6762 | dynamicLayout: true,
|
6763 | dynamicTag: true,
|
6764 | prepareArgs: true,
|
6765 | createArgs: true,
|
6766 | attributeHook: true,
|
6767 | elementHook: true,
|
6768 | createCaller: true,
|
6769 | dynamicScope: true,
|
6770 | updateHook: true,
|
6771 | createInstance: true,
|
6772 | wrapped: true,
|
6773 | willDestroy: true
|
6774 | };
|
6775 | var CURLY_COMPONENT_MANAGER = new CurlyComponentManager();
|
6776 |
|
6777 | class CurlyComponentDefinition {
|
6778 | constructor(name, ComponentClass, template$$1, args) {
|
6779 | this.name = name;
|
6780 | this.ComponentClass = ComponentClass;
|
6781 | this.template = template$$1;
|
6782 | this.args = args;
|
6783 | this.manager = CURLY_COMPONENT_MANAGER;
|
6784 | this.state = {
|
6785 | name,
|
6786 | ComponentClass,
|
6787 | template: template$$1,
|
6788 | capabilities: CURLY_CAPABILITIES
|
6789 | };
|
6790 | }
|
6791 |
|
6792 | }
|
6793 |
|
6794 | class RootComponentManager extends CurlyComponentManager {
|
6795 | constructor(component) {
|
6796 | super();
|
6797 | this.component = component;
|
6798 | }
|
6799 |
|
6800 | getJitStaticLayout(_state) {
|
6801 | var template = this.templateFor(this.component);
|
6802 | return (0, _util.unwrapTemplate)(template).asWrappedLayout();
|
6803 | }
|
6804 |
|
6805 | create(environment, state, _args, dynamicScope) {
|
6806 | var component = this.component;
|
6807 | var finalizer = (0, _instrumentation._instrumentStart)('render.component', initialRenderInstrumentDetails, component);
|
6808 | dynamicScope.view = component;
|
6809 | var hasWrappedElement = component.tagName !== '';
|
6810 |
|
6811 | if (!hasWrappedElement) {
|
6812 | if (environment.isInteractive) {
|
6813 | component.trigger('willRender');
|
6814 | }
|
6815 |
|
6816 | component._transitionTo('hasElement');
|
6817 |
|
6818 | if (environment.isInteractive) {
|
6819 | component.trigger('willInsertElement');
|
6820 | }
|
6821 | }
|
6822 |
|
6823 | if (true
|
6824 |
|
6825 | ) {
|
6826 | processComponentInitializationAssertions(component, {});
|
6827 | }
|
6828 |
|
6829 | var bucket = new ComponentStateBucket(environment, component, null, finalizer, hasWrappedElement);
|
6830 |
|
6831 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
6832 | environment.extra.debugRenderTree.create(bucket, {
|
6833 | type: 'component',
|
6834 | name: state.name,
|
6835 | args: _runtime2.EMPTY_ARGS,
|
6836 | instance: component,
|
6837 | template: state.template
|
6838 | });
|
6839 | }
|
6840 |
|
6841 | return bucket;
|
6842 | }
|
6843 |
|
6844 | }
|
6845 |
|
6846 |
|
6847 |
|
6848 | var ROOT_CAPABILITIES = {
|
6849 | dynamicLayout: false,
|
6850 | dynamicTag: true,
|
6851 | prepareArgs: false,
|
6852 | createArgs: false,
|
6853 | attributeHook: true,
|
6854 | elementHook: true,
|
6855 | createCaller: true,
|
6856 | dynamicScope: true,
|
6857 | updateHook: true,
|
6858 | createInstance: true,
|
6859 | wrapped: true,
|
6860 | willDestroy: false
|
6861 | };
|
6862 |
|
6863 | class RootComponentDefinition {
|
6864 | constructor(component) {
|
6865 | this.component = component;
|
6866 | var manager = new RootComponentManager(component);
|
6867 | this.manager = manager;
|
6868 | var factory = (0, _container.getFactoryFor)(component);
|
6869 | this.state = {
|
6870 | name: factory.fullName.slice(10),
|
6871 | capabilities: ROOT_CAPABILITIES,
|
6872 | ComponentClass: factory
|
6873 | };
|
6874 | }
|
6875 |
|
6876 | getTag({
|
6877 | component
|
6878 | }) {
|
6879 | return component[DIRTY_TAG];
|
6880 | }
|
6881 |
|
6882 | }
|
6883 |
|
6884 |
|
6885 |
|
6886 | var nodeURL;
|
6887 | var parsingNode;
|
6888 |
|
6889 | function installProtocolForURL(environment) {
|
6890 | var protocol;
|
6891 |
|
6892 | if (_browserEnvironment.hasDOM) {
|
6893 | protocol = browserProtocolForURL.call(environment, 'foobar:baz');
|
6894 | }
|
6895 |
|
6896 |
|
6897 |
|
6898 | if (protocol === 'foobar:') {
|
6899 |
|
6900 |
|
6901 | environment.protocolForURL = browserProtocolForURL;
|
6902 | } else if (typeof URL === 'object') {
|
6903 |
|
6904 | nodeURL = URL;
|
6905 | environment.protocolForURL = nodeProtocolForURL;
|
6906 | } else if (typeof module !== 'undefined' && typeof module.require === 'function') {
|
6907 |
|
6908 |
|
6909 |
|
6910 |
|
6911 | nodeURL = module.require('url');
|
6912 | environment.protocolForURL = nodeProtocolForURL;
|
6913 | } else {
|
6914 | throw new Error('Could not find valid URL parsing mechanism for URL Sanitization');
|
6915 | }
|
6916 | }
|
6917 |
|
6918 | function browserProtocolForURL(url) {
|
6919 | if (!parsingNode) {
|
6920 | parsingNode = document.createElement('a');
|
6921 | }
|
6922 |
|
6923 | parsingNode.href = url;
|
6924 | return parsingNode.protocol;
|
6925 | }
|
6926 |
|
6927 | function nodeProtocolForURL(url) {
|
6928 | var protocol = null;
|
6929 |
|
6930 | if (typeof url === 'string') {
|
6931 | protocol = nodeURL.parse(url).protocol;
|
6932 | }
|
6933 |
|
6934 | return protocol === null ? ':' : protocol;
|
6935 | }
|
6936 |
|
6937 | var GUID = 0;
|
6938 |
|
6939 | function isPathNode(node) {
|
6940 | return node.type === 'root' || node.type === 'argument' || node.type === 'property' || node.type === 'iterator';
|
6941 | }
|
6942 |
|
6943 | class Ref {
|
6944 | constructor(value) {
|
6945 | this.id = GUID++;
|
6946 | this.value = value;
|
6947 | }
|
6948 |
|
6949 | get() {
|
6950 | return this.value;
|
6951 | }
|
6952 |
|
6953 | release() {
|
6954 | (true && !(this.value !== null) && (0, _debug.assert)('BUG: double release?', this.value !== null));
|
6955 | this.value = null;
|
6956 | }
|
6957 |
|
6958 | toString() {
|
6959 | var label = `Ref ${this.id}`;
|
6960 |
|
6961 | if (this.value === null) {
|
6962 | return `${label} (released)`;
|
6963 | } else {
|
6964 | try {
|
6965 | return `${label}: ${this.value}`;
|
6966 | } catch (_a) {
|
6967 | return label;
|
6968 | }
|
6969 | }
|
6970 | }
|
6971 |
|
6972 | }
|
6973 |
|
6974 | var _repeat = String.prototype.repeat || function (count) {
|
6975 | return new Array(count + 1).join(this);
|
6976 | };
|
6977 |
|
6978 | function repeatString(str, count) {
|
6979 | return _repeat.call(str, count);
|
6980 | }
|
6981 |
|
6982 | class DebugRenderTree {
|
6983 | constructor() {
|
6984 | this.stack = new _util.Stack();
|
6985 | this.refs = new WeakMap();
|
6986 | this.roots = new Set();
|
6987 | this.nodes = new WeakMap();
|
6988 | this.pathNodes = new WeakMap();
|
6989 | }
|
6990 |
|
6991 | begin() {
|
6992 | this.reset();
|
6993 | }
|
6994 |
|
6995 | create(state, node) {
|
6996 | var internalNode = (0, _polyfills.assign)({}, node, {
|
6997 | bounds: null,
|
6998 | refs: new Set(),
|
6999 | paths: new Set()
|
7000 | });
|
7001 | this.nodes.set(state, internalNode);
|
7002 | this.appendChild(internalNode, state);
|
7003 | this.enter(state);
|
7004 | }
|
7005 |
|
7006 | update(state) {
|
7007 | this.enter(state);
|
7008 | }
|
7009 |
|
7010 |
|
7011 | setTemplate(state, template) {
|
7012 | this.nodeFor(state).template = template;
|
7013 | }
|
7014 |
|
7015 | didRender(state, bounds) {
|
7016 | (true && !(this.stack.current === state) && (0, _debug.assert)(`BUG: expecting ${this.stack.current}, got ${state}`, this.stack.current === state));
|
7017 | this.nodeFor(state).bounds = bounds;
|
7018 | this.exit();
|
7019 | }
|
7020 |
|
7021 | willDestroy(state) {
|
7022 | (0, _util.expect)(this.refs.get(state), 'BUG: missing ref').release();
|
7023 | }
|
7024 |
|
7025 | commit() {
|
7026 | this.reset();
|
7027 | }
|
7028 |
|
7029 | capture() {
|
7030 | return this.captureRefs(this.roots);
|
7031 | }
|
7032 |
|
7033 | createPath(pathRef, name, type, parentRef) {
|
7034 | (true && !(!this.pathNodes.has(pathRef)) && (0, _debug.assert)('BUG: Attempted to register a path that had already been registered', !this.pathNodes.has(pathRef)));
|
7035 | var {
|
7036 | current
|
7037 | } = this.stack;
|
7038 |
|
7039 | if (current === null) {
|
7040 |
|
7041 | return;
|
7042 | }
|
7043 |
|
7044 | var currentNode = (0, _util.expect)(this.nodes.get(current), 'BUG: Attempted to create a path, but there is no current render node');
|
7045 | var parent;
|
7046 |
|
7047 | if (parentRef === null) {
|
7048 | parent = currentNode;
|
7049 | } else {
|
7050 | var {
|
7051 | named
|
7052 | } = currentNode.args;
|
7053 | var refIndex = named.references.indexOf(parentRef);
|
7054 |
|
7055 | if (refIndex !== -1) {
|
7056 | parent = {
|
7057 | parent: currentNode,
|
7058 | type: 'argument',
|
7059 | name: `@${named.names[refIndex]}`,
|
7060 | paths: new Set()
|
7061 | };
|
7062 | } else if (this.pathNodes.has(parentRef)) {
|
7063 | parent = this.pathNodes.get(parentRef);
|
7064 | } else {
|
7065 |
|
7066 |
|
7067 |
|
7068 |
|
7069 |
|
7070 | this.createPath(parentRef, 'this', 'root', null);
|
7071 | parent = this.pathNodes.get(parentRef);
|
7072 | }
|
7073 | }
|
7074 |
|
7075 | var pathNode = {
|
7076 | name,
|
7077 | type,
|
7078 | parent,
|
7079 | paths: new Set()
|
7080 | };
|
7081 | parent.paths.add(pathNode);
|
7082 | this.pathNodes.set(pathRef, pathNode);
|
7083 | }
|
7084 |
|
7085 | logRenderStackForPath(pathRef) {
|
7086 | var node = (0, _util.expect)(this.pathNodes.get(pathRef), 'BUG: Attempted to create a log for a path reference, but no node exist for that reference');
|
7087 | var pathParts = [];
|
7088 |
|
7089 | while (node !== undefined && isPathNode(node)) {
|
7090 | if (node.type === 'iterator') {
|
7091 |
|
7092 |
|
7093 | var part = `${node.parent.name}[${node.name}]`;
|
7094 | pathParts.push(part);
|
7095 | node = node.parent;
|
7096 | } else {
|
7097 | pathParts.unshift(node.name);
|
7098 | }
|
7099 |
|
7100 | node = node.parent;
|
7101 | }
|
7102 |
|
7103 | var messageParts = [pathParts.join('.')];
|
7104 |
|
7105 | while (node !== undefined) {
|
7106 | if (node.type === 'outlet' || node.name === '-top-level') {
|
7107 | node = node.parent;
|
7108 | continue;
|
7109 | }
|
7110 |
|
7111 | messageParts.unshift(node.name);
|
7112 | node = node.parent;
|
7113 | }
|
7114 |
|
7115 | return messageParts.map((part, index) => `${repeatString(' ', index * 2)}${part}`).join('\n');
|
7116 | }
|
7117 |
|
7118 | reset() {
|
7119 | if (this.stack.size !== 0) {
|
7120 |
|
7121 |
|
7122 |
|
7123 |
|
7124 |
|
7125 | while (!this.stack.isEmpty()) {
|
7126 | this.stack.pop();
|
7127 | }
|
7128 | }
|
7129 | }
|
7130 |
|
7131 | enter(state) {
|
7132 | this.stack.push(state);
|
7133 | }
|
7134 |
|
7135 | exit() {
|
7136 | (true && !(this.stack.size !== 0) && (0, _debug.assert)('BUG: unbalanced pop', this.stack.size !== 0));
|
7137 | this.stack.pop();
|
7138 | }
|
7139 |
|
7140 | nodeFor(state) {
|
7141 | return (0, _util.expect)(this.nodes.get(state), 'BUG: missing node');
|
7142 | }
|
7143 |
|
7144 | appendChild(node, state) {
|
7145 | (true && !(!this.refs.has(state)) && (0, _debug.assert)('BUG: child already appended', !this.refs.has(state)));
|
7146 | var parent = this.stack.current;
|
7147 | var ref = new Ref(state);
|
7148 | this.refs.set(state, ref);
|
7149 |
|
7150 | if (parent) {
|
7151 | var parentNode = this.nodeFor(parent);
|
7152 | parentNode.refs.add(ref);
|
7153 | node.parent = parentNode;
|
7154 | } else {
|
7155 | this.roots.add(ref);
|
7156 | }
|
7157 | }
|
7158 |
|
7159 | captureRefs(refs) {
|
7160 | var captured = [];
|
7161 | refs.forEach(ref => {
|
7162 | var state = ref.get();
|
7163 |
|
7164 | if (state) {
|
7165 | captured.push(this.captureNode(`render-node:${ref.id}`, state));
|
7166 | } else {
|
7167 | refs.delete(ref);
|
7168 | }
|
7169 | });
|
7170 | return captured;
|
7171 | }
|
7172 |
|
7173 | captureNode(id, state) {
|
7174 | var node = this.nodeFor(state);
|
7175 | var {
|
7176 | type,
|
7177 | name,
|
7178 | args,
|
7179 | instance,
|
7180 | refs
|
7181 | } = node;
|
7182 | var template = this.captureTemplate(node);
|
7183 | var bounds = this.captureBounds(node);
|
7184 | var children = this.captureRefs(refs);
|
7185 | return {
|
7186 | id,
|
7187 | type,
|
7188 | name,
|
7189 | args: args.value(),
|
7190 | instance,
|
7191 | template,
|
7192 | bounds,
|
7193 | children
|
7194 | };
|
7195 | }
|
7196 |
|
7197 | captureTemplate({
|
7198 | template
|
7199 | }) {
|
7200 | return template && (0, _util.unwrapTemplate)(template).referrer.moduleName || null;
|
7201 | }
|
7202 |
|
7203 | captureBounds(node) {
|
7204 | var bounds = (0, _util.expect)(node.bounds, 'BUG: missing bounds');
|
7205 | var parentElement = bounds.parentElement();
|
7206 | var firstNode = bounds.firstNode();
|
7207 | var lastNode = bounds.lastNode();
|
7208 | return {
|
7209 | parentElement,
|
7210 | firstNode,
|
7211 | lastNode
|
7212 | };
|
7213 | }
|
7214 |
|
7215 | }
|
7216 | |
7217 |
|
7218 |
|
7219 |
|
7220 | |
7221 |
|
7222 |
|
7223 |
|
7224 |
|
7225 |
|
7226 |
|
7227 |
|
7228 |
|
7229 |
|
7230 |
|
7231 |
|
7232 |
|
7233 |
|
7234 |
|
7235 |
|
7236 |
|
7237 |
|
7238 |
|
7239 |
|
7240 |
|
7241 |
|
7242 |
|
7243 |
|
7244 |
|
7245 |
|
7246 |
|
7247 |
|
7248 |
|
7249 |
|
7250 |
|
7251 |
|
7252 |
|
7253 |
|
7254 |
|
7255 |
|
7256 |
|
7257 |
|
7258 |
|
7259 |
|
7260 |
|
7261 |
|
7262 |
|
7263 |
|
7264 |
|
7265 |
|
7266 |
|
7267 |
|
7268 |
|
7269 |
|
7270 |
|
7271 |
|
7272 |
|
7273 |
|
7274 |
|
7275 |
|
7276 |
|
7277 |
|
7278 |
|
7279 |
|
7280 |
|
7281 |
|
7282 |
|
7283 |
|
7284 |
|
7285 |
|
7286 |
|
7287 |
|
7288 |
|
7289 |
|
7290 |
|
7291 |
|
7292 |
|
7293 |
|
7294 |
|
7295 |
|
7296 |
|
7297 |
|
7298 |
|
7299 |
|
7300 |
|
7301 |
|
7302 |
|
7303 |
|
7304 |
|
7305 |
|
7306 |
|
7307 |
|
7308 |
|
7309 |
|
7310 |
|
7311 |
|
7312 |
|
7313 |
|
7314 |
|
7315 |
|
7316 |
|
7317 |
|
7318 |
|
7319 |
|
7320 |
|
7321 |
|
7322 |
|
7323 |
|
7324 |
|
7325 |
|
7326 |
|
7327 |
|
7328 |
|
7329 |
|
7330 |
|
7331 | |
7332 |
|
7333 |
|
7334 |
|
7335 |
|
7336 |
|
7337 |
|
7338 |
|
7339 |
|
7340 |
|
7341 |
|
7342 |
|
7343 |
|
7344 |
|
7345 |
|
7346 |
|
7347 |
|
7348 |
|
7349 |
|
7350 |
|
7351 |
|
7352 |
|
7353 |
|
7354 |
|
7355 |
|
7356 |
|
7357 |
|
7358 |
|
7359 |
|
7360 |
|
7361 |
|
7362 |
|
7363 |
|
7364 |
|
7365 |
|
7366 |
|
7367 |
|
7368 | class EachInReference {
|
7369 | constructor(inner) {
|
7370 | this.inner = inner;
|
7371 | this.valueTag = (0, _validator.createUpdatableTag)();
|
7372 | this.tag = (0, _validator.combine)([inner.tag, this.valueTag]);
|
7373 | }
|
7374 |
|
7375 | value() {
|
7376 | var iterable = this.inner.value();
|
7377 | var tag = (0, _metal.tagForObject)(iterable);
|
7378 |
|
7379 | if ((0, _utils.isProxy)(iterable)) {
|
7380 |
|
7381 |
|
7382 | iterable = (0, _runtime._contentFor)(iterable);
|
7383 | }
|
7384 |
|
7385 | (0, _validator.updateTag)(this.valueTag, tag);
|
7386 | return new EachInWrapper(iterable);
|
7387 | }
|
7388 |
|
7389 | get(key) {
|
7390 | return this.inner.get(key);
|
7391 | }
|
7392 |
|
7393 | }
|
7394 |
|
7395 | class EachInWrapper {
|
7396 | constructor(inner) {
|
7397 | this.inner = inner;
|
7398 | }
|
7399 |
|
7400 | }
|
7401 |
|
7402 | function eachIn(args) {
|
7403 | return new EachInReference(args.positional.at(0));
|
7404 | }
|
7405 |
|
7406 | function toIterator(iterable) {
|
7407 | if (iterable instanceof EachInWrapper) {
|
7408 | return toEachInIterator(iterable.inner);
|
7409 | } else {
|
7410 | return toEachIterator(iterable);
|
7411 | }
|
7412 | }
|
7413 |
|
7414 | function toEachInIterator(iterable) {
|
7415 | if (!isIndexable(iterable)) {
|
7416 | return null;
|
7417 | }
|
7418 |
|
7419 | if (Array.isArray(iterable) || (0, _utils.isEmberArray)(iterable)) {
|
7420 | return ObjectIterator.fromIndexable(iterable);
|
7421 | } else if (_utils.HAS_NATIVE_SYMBOL && isNativeIterable(iterable)) {
|
7422 | return MapLikeNativeIterator.from(iterable);
|
7423 | } else if (hasForEach(iterable)) {
|
7424 | return ObjectIterator.fromForEachable(iterable);
|
7425 | } else {
|
7426 | return ObjectIterator.fromIndexable(iterable);
|
7427 | }
|
7428 | }
|
7429 |
|
7430 | function toEachIterator(iterable) {
|
7431 | if (!(0, _utils.isObject)(iterable)) {
|
7432 | return null;
|
7433 | }
|
7434 |
|
7435 | if (Array.isArray(iterable)) {
|
7436 | return ArrayIterator.from(iterable);
|
7437 | } else if ((0, _utils.isEmberArray)(iterable)) {
|
7438 | return EmberArrayIterator.from(iterable);
|
7439 | } else if (_utils.HAS_NATIVE_SYMBOL && isNativeIterable(iterable)) {
|
7440 | return ArrayLikeNativeIterator.from(iterable);
|
7441 | } else if (hasForEach(iterable)) {
|
7442 | return ArrayIterator.fromForEachable(iterable);
|
7443 | } else {
|
7444 | return null;
|
7445 | }
|
7446 | }
|
7447 |
|
7448 | class BoundedIterator {
|
7449 | constructor(length) {
|
7450 | this.length = length;
|
7451 | this.position = 0;
|
7452 | }
|
7453 |
|
7454 | isEmpty() {
|
7455 | return false;
|
7456 | }
|
7457 |
|
7458 | memoFor(position) {
|
7459 | return position;
|
7460 | }
|
7461 |
|
7462 | next() {
|
7463 | var {
|
7464 | length,
|
7465 | position
|
7466 | } = this;
|
7467 |
|
7468 | if (position >= length) {
|
7469 | return null;
|
7470 | }
|
7471 |
|
7472 | var value = this.valueFor(position);
|
7473 | var memo = this.memoFor(position);
|
7474 | this.position++;
|
7475 | return {
|
7476 | value,
|
7477 | memo
|
7478 | };
|
7479 | }
|
7480 |
|
7481 | }
|
7482 |
|
7483 | class ArrayIterator extends BoundedIterator {
|
7484 | constructor(array) {
|
7485 | super(array.length);
|
7486 | this.array = array;
|
7487 | }
|
7488 |
|
7489 | static from(iterable) {
|
7490 | return iterable.length > 0 ? new this(iterable) : null;
|
7491 | }
|
7492 |
|
7493 | static fromForEachable(object) {
|
7494 | var array = [];
|
7495 | object.forEach(item => array.push(item));
|
7496 | return this.from(array);
|
7497 | }
|
7498 |
|
7499 | valueFor(position) {
|
7500 | return this.array[position];
|
7501 | }
|
7502 |
|
7503 | }
|
7504 |
|
7505 | class EmberArrayIterator extends BoundedIterator {
|
7506 | constructor(array) {
|
7507 | super(array.length);
|
7508 | this.array = array;
|
7509 | }
|
7510 |
|
7511 | static from(iterable) {
|
7512 | return iterable.length > 0 ? new this(iterable) : null;
|
7513 | }
|
7514 |
|
7515 | valueFor(position) {
|
7516 | return (0, _metal.objectAt)(this.array, position);
|
7517 | }
|
7518 |
|
7519 | }
|
7520 |
|
7521 | class ObjectIterator extends BoundedIterator {
|
7522 | constructor(keys, values) {
|
7523 | super(values.length);
|
7524 | this.keys = keys;
|
7525 | this.values = values;
|
7526 | }
|
7527 |
|
7528 | static fromIndexable(obj) {
|
7529 | var keys = Object.keys(obj);
|
7530 | var {
|
7531 | length
|
7532 | } = keys;
|
7533 |
|
7534 | if (length === 0) {
|
7535 | return null;
|
7536 | } else {
|
7537 | var values = [];
|
7538 |
|
7539 | for (var i = 0; i < length; i++) {
|
7540 | var value = void 0;
|
7541 | var key = keys[i];
|
7542 | value = obj[key];
|
7543 |
|
7544 |
|
7545 | if ((0, _validator.isTracking)()) {
|
7546 | (0, _validator.consumeTag)((0, _validator.tagFor)(obj, key));
|
7547 |
|
7548 | if (Array.isArray(value)) {
|
7549 | (0, _validator.consumeTag)((0, _validator.tagFor)(value, '[]'));
|
7550 | }
|
7551 | }
|
7552 |
|
7553 | values.push(value);
|
7554 | }
|
7555 |
|
7556 | return new this(keys, values);
|
7557 | }
|
7558 | }
|
7559 |
|
7560 | static fromForEachable(obj) {
|
7561 | var keys = [];
|
7562 | var values = [];
|
7563 | var length = 0;
|
7564 | var isMapLike = false;
|
7565 |
|
7566 | obj.forEach(function (value, key) {
|
7567 | isMapLike = isMapLike || arguments.length >= 2;
|
7568 |
|
7569 | if (isMapLike) {
|
7570 | keys.push(key);
|
7571 | }
|
7572 |
|
7573 | values.push(value);
|
7574 | length++;
|
7575 | });
|
7576 |
|
7577 | if (length === 0) {
|
7578 | return null;
|
7579 | } else if (isMapLike) {
|
7580 | return new this(keys, values);
|
7581 | } else {
|
7582 | return new ArrayIterator(values);
|
7583 | }
|
7584 | }
|
7585 |
|
7586 | valueFor(position) {
|
7587 | return this.values[position];
|
7588 | }
|
7589 |
|
7590 | memoFor(position) {
|
7591 | return this.keys[position];
|
7592 | }
|
7593 |
|
7594 | }
|
7595 |
|
7596 | class NativeIterator {
|
7597 | constructor(iterable, result) {
|
7598 | this.iterable = iterable;
|
7599 | this.result = result;
|
7600 | this.position = 0;
|
7601 | }
|
7602 |
|
7603 | static from(iterable) {
|
7604 | var iterator = iterable[Symbol.iterator]();
|
7605 | var result = iterator.next();
|
7606 | var {
|
7607 | done
|
7608 | } = result;
|
7609 |
|
7610 | if (done) {
|
7611 | return null;
|
7612 | } else {
|
7613 | return new this(iterator, result);
|
7614 | }
|
7615 | }
|
7616 |
|
7617 | isEmpty() {
|
7618 | return false;
|
7619 | }
|
7620 |
|
7621 | next() {
|
7622 | var {
|
7623 | iterable,
|
7624 | result,
|
7625 | position
|
7626 | } = this;
|
7627 |
|
7628 | if (result.done) {
|
7629 | return null;
|
7630 | }
|
7631 |
|
7632 | var value = this.valueFor(result, position);
|
7633 | var memo = this.memoFor(result, position);
|
7634 | this.position++;
|
7635 | this.result = iterable.next();
|
7636 | return {
|
7637 | value,
|
7638 | memo
|
7639 | };
|
7640 | }
|
7641 |
|
7642 | }
|
7643 |
|
7644 | class ArrayLikeNativeIterator extends NativeIterator {
|
7645 | valueFor(result) {
|
7646 | return result.value;
|
7647 | }
|
7648 |
|
7649 | memoFor(_result, position) {
|
7650 | return position;
|
7651 | }
|
7652 |
|
7653 | }
|
7654 |
|
7655 | class MapLikeNativeIterator extends NativeIterator {
|
7656 | valueFor(result) {
|
7657 | return result.value[1];
|
7658 | }
|
7659 |
|
7660 | memoFor(result) {
|
7661 | return result.value[0];
|
7662 | }
|
7663 |
|
7664 | }
|
7665 |
|
7666 | function hasForEach(value) {
|
7667 | return typeof value['forEach'] === 'function';
|
7668 | }
|
7669 |
|
7670 | function isNativeIterable(value) {
|
7671 | return typeof value[Symbol.iterator] === 'function';
|
7672 | }
|
7673 |
|
7674 | function isIndexable(value) {
|
7675 | return value !== null && (typeof value === 'object' || typeof value === 'function');
|
7676 | }
|
7677 |
|
7678 | function toBool(predicate) {
|
7679 | if ((0, _utils.isProxy)(predicate)) {
|
7680 | (0, _validator.consumeTag)((0, _metal.tagForProperty)(predicate, 'content'));
|
7681 | return Boolean((0, _metal.get)(predicate, 'isTruthy'));
|
7682 | } else if ((0, _runtime.isArray)(predicate)) {
|
7683 | (0, _validator.consumeTag)((0, _metal.tagForProperty)(predicate, '[]'));
|
7684 | return predicate.length !== 0;
|
7685 | } else {
|
7686 | return Boolean(predicate);
|
7687 | }
|
7688 | }
|
7689 |
|
7690 |
|
7691 |
|
7692 | (0, _validator.setPropertyDidChange)(() => _runloop.backburner.ensureInstance());
|
7693 |
|
7694 | if (true
|
7695 |
|
7696 | ) {
|
7697 | (0, _validator.setAutotrackingTransactionEnv)({
|
7698 | assert(message) {
|
7699 | (true && !(false) && (0, _debug.assert)(message, false));
|
7700 | },
|
7701 |
|
7702 | deprecate(message) {
|
7703 | (true && !(false) && (0, _debug.deprecate)(message, false, {
|
7704 | id: 'autotracking.mutation-after-consumption',
|
7705 | until: '4.0.0'
|
7706 | }));
|
7707 | },
|
7708 |
|
7709 | debugMessage(obj, keyName) {
|
7710 | var dirtyString = keyName ? `\`${keyName}\` on \`${(0, _utils.getDebugName)(obj)}\`` : `\`${(0, _utils.getDebugName)(obj)}\``;
|
7711 | return `You attempted to update ${dirtyString}, but it had already been used previously in the same computation. Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.`;
|
7712 | }
|
7713 |
|
7714 | });
|
7715 | }
|
7716 |
|
7717 |
|
7718 | (0, _runtime2.setScheduleDestroy)((destroyable, destructor) => {
|
7719 | (0, _runloop.schedule)('actions', null, destructor, destroyable);
|
7720 | });
|
7721 | (0, _runtime2.setScheduleDestroyed)(finalizeDestructor => {
|
7722 | (0, _runloop.schedule)('destroy', null, finalizeDestructor);
|
7723 | });
|
7724 |
|
7725 | class EmberEnvironmentExtra {
|
7726 | constructor(owner) {
|
7727 | this.owner = owner;
|
7728 |
|
7729 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
7730 | this._debugRenderTree = new DebugRenderTree();
|
7731 | }
|
7732 | }
|
7733 |
|
7734 | get debugRenderTree() {
|
7735 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
7736 | return this._debugRenderTree;
|
7737 | } else {
|
7738 | throw new Error("Can't access debug render tree outside of the inspector (_DEBUG_RENDER_TREE flag is disabled)");
|
7739 | }
|
7740 | }
|
7741 |
|
7742 | begin() {
|
7743 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
7744 | this.debugRenderTree.begin();
|
7745 | }
|
7746 | }
|
7747 |
|
7748 | commit() {
|
7749 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
7750 | this.debugRenderTree.commit();
|
7751 | }
|
7752 | }
|
7753 |
|
7754 | }
|
7755 |
|
7756 | class EmberEnvironmentDelegate {
|
7757 | constructor(owner, isInteractive) {
|
7758 | this.toBool = toBool;
|
7759 | this.toIterator = toIterator;
|
7760 | this.getProp = _metal._getProp;
|
7761 | this.getPath = _metal.get;
|
7762 | this.setPath = _metal.set;
|
7763 | this.extra = new EmberEnvironmentExtra(owner);
|
7764 | this.isInteractive = isInteractive;
|
7765 | installProtocolForURL(this);
|
7766 | }
|
7767 |
|
7768 |
|
7769 |
|
7770 | protocolForURL(s) {
|
7771 | return s;
|
7772 | }
|
7773 |
|
7774 | getTemplatePathDebugContext(pathRef) {
|
7775 | var stack = this.extra.debugRenderTree.logRenderStackForPath(pathRef);
|
7776 | return `While rendering:\n\n${stack}`;
|
7777 | }
|
7778 |
|
7779 | setTemplatePathDebugContext(pathRef, desc, parentRef) {
|
7780 | var type = 'root';
|
7781 |
|
7782 | if (pathRef instanceof _reference.IterationItemReference) {
|
7783 | type = 'iterator';
|
7784 | } else if (pathRef instanceof _reference.PropertyReference) {
|
7785 | type = 'property';
|
7786 | }
|
7787 |
|
7788 | this.extra.debugRenderTree.createPath(pathRef, desc, type, parentRef);
|
7789 | }
|
7790 |
|
7791 | onTransactionBegin() {
|
7792 | this.extra.begin();
|
7793 | }
|
7794 |
|
7795 | onTransactionCommit() {
|
7796 | this.extra.commit();
|
7797 | }
|
7798 |
|
7799 | }
|
7800 |
|
7801 | if (true
|
7802 |
|
7803 | ) {
|
7804 | class StyleAttributeManager extends _runtime2.SimpleDynamicAttribute {
|
7805 | set(dom, value, env) {
|
7806 | (true && (0, _debug.warn)((0, _views.constructStyleDeprecationMessage)(value), (() => {
|
7807 | if (value === null || value === undefined || isHTMLSafe(value)) {
|
7808 | return true;
|
7809 | }
|
7810 |
|
7811 | return false;
|
7812 | })(), {
|
7813 | id: 'ember-htmlbars.style-xss-warning'
|
7814 | }));
|
7815 | super.set(dom, value, env);
|
7816 | }
|
7817 |
|
7818 | update(value, env) {
|
7819 | (true && (0, _debug.warn)((0, _views.constructStyleDeprecationMessage)(value), (() => {
|
7820 | if (value === null || value === undefined || isHTMLSafe(value)) {
|
7821 | return true;
|
7822 | }
|
7823 |
|
7824 | return false;
|
7825 | })(), {
|
7826 | id: 'ember-htmlbars.style-xss-warning'
|
7827 | }));
|
7828 | super.update(value, env);
|
7829 | }
|
7830 |
|
7831 | }
|
7832 |
|
7833 | EmberEnvironmentDelegate.prototype.attributeFor = function (element, attribute, isTrusting, namespace) {
|
7834 | if (attribute === 'style' && !isTrusting) {
|
7835 | return new StyleAttributeManager({
|
7836 | element,
|
7837 | name: attribute,
|
7838 | namespace
|
7839 | });
|
7840 | }
|
7841 |
|
7842 | return (0, _runtime2.dynamicAttribute)(element, attribute, namespace);
|
7843 | };
|
7844 | }
|
7845 |
|
7846 | var CAPABILITIES$1 = {
|
7847 | dynamicLayout: false,
|
7848 | dynamicTag: false,
|
7849 | prepareArgs: false,
|
7850 | createArgs: true,
|
7851 | attributeHook: false,
|
7852 | elementHook: false,
|
7853 | createCaller: false,
|
7854 | dynamicScope: true,
|
7855 | updateHook: true,
|
7856 | createInstance: true,
|
7857 | wrapped: false,
|
7858 | willDestroy: false
|
7859 | };
|
7860 |
|
7861 | function capabilities(managerAPI, options = {}) {
|
7862 | (true && !(managerAPI === '3.4' || managerAPI === '3.13') && (0, _debug.assert)('Invalid component manager compatibility specified', managerAPI === '3.4' || managerAPI === '3.13'));
|
7863 | var updateHook = true;
|
7864 | {
|
7865 | updateHook = managerAPI === '3.13' ? Boolean(options.updateHook) : true;
|
7866 | }
|
7867 | return {
|
7868 | asyncLifeCycleCallbacks: Boolean(options.asyncLifecycleCallbacks),
|
7869 | destructor: Boolean(options.destructor),
|
7870 | updateHook
|
7871 | };
|
7872 | }
|
7873 |
|
7874 | function hasAsyncLifeCycleCallbacks(delegate) {
|
7875 | return delegate.capabilities.asyncLifeCycleCallbacks;
|
7876 | }
|
7877 |
|
7878 | function hasUpdateHook(delegate) {
|
7879 | return delegate.capabilities.updateHook;
|
7880 | }
|
7881 |
|
7882 | function hasAsyncUpdateHook(delegate) {
|
7883 | return hasAsyncLifeCycleCallbacks(delegate) && hasUpdateHook(delegate);
|
7884 | }
|
7885 |
|
7886 | function hasDestructors(delegate) {
|
7887 | return delegate.capabilities.destructor;
|
7888 | }
|
7889 | |
7890 |
|
7891 |
|
7892 |
|
7893 |
|
7894 |
|
7895 |
|
7896 |
|
7897 |
|
7898 |
|
7899 |
|
7900 |
|
7901 |
|
7902 |
|
7903 |
|
7904 |
|
7905 |
|
7906 |
|
7907 |
|
7908 |
|
7909 |
|
7910 |
|
7911 |
|
7912 |
|
7913 |
|
7914 |
|
7915 |
|
7916 | class CustomComponentManager extends AbstractManager {
|
7917 | create(env, definition, args) {
|
7918 | var {
|
7919 | delegate
|
7920 | } = definition;
|
7921 | var capturedArgs = args.capture();
|
7922 | var namedArgs = capturedArgs.named;
|
7923 | var value;
|
7924 | var namedArgsProxy = {};
|
7925 | {
|
7926 | var getTag = key => {
|
7927 | return namedArgs.get(key).tag;
|
7928 | };
|
7929 |
|
7930 | if (_utils.HAS_NATIVE_PROXY) {
|
7931 | var handler = {
|
7932 | get(_target, prop) {
|
7933 | if (namedArgs.has(prop)) {
|
7934 | var ref = namedArgs.get(prop);
|
7935 | (0, _validator.consumeTag)(ref.tag);
|
7936 | return ref.value();
|
7937 | } else if (prop === _metal.CUSTOM_TAG_FOR) {
|
7938 | return getTag;
|
7939 | }
|
7940 | },
|
7941 |
|
7942 | has(_target, prop) {
|
7943 | return namedArgs.has(prop);
|
7944 | },
|
7945 |
|
7946 | ownKeys(_target) {
|
7947 | return namedArgs.names;
|
7948 | },
|
7949 |
|
7950 | getOwnPropertyDescriptor(_target, prop) {
|
7951 | (true && !(namedArgs.has(prop)) && (0, _debug.assert)('args proxies do not have real property descriptors, so you should never need to call getOwnPropertyDescriptor yourself. This code exists for enumerability, such as in for-in loops and Object.keys()', namedArgs.has(prop)));
|
7952 | return {
|
7953 | enumerable: true,
|
7954 | configurable: true
|
7955 | };
|
7956 | }
|
7957 |
|
7958 | };
|
7959 |
|
7960 | if (true
|
7961 |
|
7962 | ) {
|
7963 | handler.set = function (_target, prop) {
|
7964 | (true && !(false) && (0, _debug.assert)(`You attempted to set ${definition.ComponentClass.class}#${String(prop)} on a components arguments. Component arguments are immutable and cannot be updated directly, they always represent the values that are passed to your component. If you want to set default values, you should use a getter instead`));
|
7965 | return false;
|
7966 | };
|
7967 | }
|
7968 |
|
7969 | namedArgsProxy = new Proxy(namedArgsProxy, handler);
|
7970 | } else {
|
7971 | Object.defineProperty(namedArgsProxy, _metal.CUSTOM_TAG_FOR, {
|
7972 | configurable: false,
|
7973 | enumerable: false,
|
7974 | value: getTag
|
7975 | });
|
7976 | namedArgs.names.forEach(name => {
|
7977 | Object.defineProperty(namedArgsProxy, name, {
|
7978 | enumerable: true,
|
7979 | configurable: true,
|
7980 |
|
7981 | get() {
|
7982 | var ref = namedArgs.get(name);
|
7983 | (0, _validator.consumeTag)(ref.tag);
|
7984 | return ref.value();
|
7985 | }
|
7986 |
|
7987 | });
|
7988 | });
|
7989 | }
|
7990 |
|
7991 | value = {
|
7992 | named: namedArgsProxy,
|
7993 | positional: capturedArgs.positional.value()
|
7994 | };
|
7995 | }
|
7996 | var component = delegate.createComponent(definition.ComponentClass.class, value);
|
7997 | var bucket = new CustomComponentState(delegate, component, capturedArgs, env, namedArgsProxy);
|
7998 |
|
7999 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8000 | env.extra.debugRenderTree.create(bucket, {
|
8001 | type: 'component',
|
8002 | name: definition.name,
|
8003 | args: args.capture(),
|
8004 | instance: component,
|
8005 | template: definition.template
|
8006 | });
|
8007 | (0, _runtime2.registerDestructor)(bucket, () => {
|
8008 | env.extra.debugRenderTree.willDestroy(bucket);
|
8009 | });
|
8010 | }
|
8011 |
|
8012 | return bucket;
|
8013 | }
|
8014 |
|
8015 | update(bucket) {
|
8016 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8017 | bucket.env.extra.debugRenderTree.update(bucket);
|
8018 | }
|
8019 |
|
8020 | var {
|
8021 | delegate,
|
8022 | component,
|
8023 | args,
|
8024 | namedArgsProxy
|
8025 | } = bucket;
|
8026 | var value;
|
8027 | {
|
8028 | value = {
|
8029 | named: namedArgsProxy,
|
8030 | positional: args.positional.value()
|
8031 | };
|
8032 | }
|
8033 |
|
8034 | if (hasUpdateHook(delegate)) {
|
8035 | delegate.updateComponent(component, value);
|
8036 | }
|
8037 | }
|
8038 |
|
8039 | didCreate({
|
8040 | delegate,
|
8041 | component
|
8042 | }) {
|
8043 | if (hasAsyncLifeCycleCallbacks(delegate)) {
|
8044 | delegate.didCreateComponent(component);
|
8045 | }
|
8046 | }
|
8047 |
|
8048 | didUpdate({
|
8049 | delegate,
|
8050 | component
|
8051 | }) {
|
8052 | if (hasAsyncUpdateHook(delegate)) {
|
8053 | delegate.didUpdateComponent(component);
|
8054 | }
|
8055 | }
|
8056 |
|
8057 | getContext({
|
8058 | delegate,
|
8059 | component
|
8060 | }) {
|
8061 | delegate.getContext(component);
|
8062 | }
|
8063 |
|
8064 | getSelf({
|
8065 | env,
|
8066 | delegate,
|
8067 | component
|
8068 | }) {
|
8069 | return new _reference.ComponentRootReference(delegate.getContext(component), env);
|
8070 | }
|
8071 |
|
8072 | getDestroyable(bucket) {
|
8073 | return bucket;
|
8074 | }
|
8075 |
|
8076 | getCapabilities({
|
8077 | delegate
|
8078 | }) {
|
8079 | return (0, _polyfills.assign)({}, CAPABILITIES$1, {
|
8080 | updateHook: _environment2.ENV._DEBUG_RENDER_TREE || delegate.capabilities.updateHook
|
8081 | });
|
8082 | }
|
8083 |
|
8084 | getTag({
|
8085 | args
|
8086 | }) {
|
8087 | if ((0, _validator.isConstTagged)(args)) {
|
8088 |
|
8089 | return (0, _validator.createTag)();
|
8090 | } else {
|
8091 | return args.tag;
|
8092 | }
|
8093 | }
|
8094 |
|
8095 | didRenderLayout(bucket, bounds) {
|
8096 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8097 | bucket.env.extra.debugRenderTree.didRender(bucket, bounds);
|
8098 | }
|
8099 | }
|
8100 |
|
8101 | didUpdateLayout(bucket, bounds) {
|
8102 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8103 | bucket.env.extra.debugRenderTree.didRender(bucket, bounds);
|
8104 | }
|
8105 | }
|
8106 |
|
8107 | getJitStaticLayout(state) {
|
8108 | return (0, _util.unwrapTemplate)(state.template).asLayout();
|
8109 | }
|
8110 |
|
8111 | }
|
8112 |
|
8113 | var CUSTOM_COMPONENT_MANAGER = new CustomComponentManager();
|
8114 | |
8115 |
|
8116 |
|
8117 |
|
8118 | class CustomComponentState {
|
8119 | constructor(delegate, component, args, env, namedArgsProxy) {
|
8120 | this.delegate = delegate;
|
8121 | this.component = component;
|
8122 | this.args = args;
|
8123 | this.env = env;
|
8124 | this.namedArgsProxy = namedArgsProxy;
|
8125 |
|
8126 | if (hasDestructors(delegate)) {
|
8127 | (0, _runtime2.registerDestructor)(this, () => delegate.destroyComponent(component));
|
8128 | }
|
8129 | }
|
8130 |
|
8131 | }
|
8132 |
|
8133 | class CustomManagerDefinition {
|
8134 | constructor(name, ComponentClass, delegate, template) {
|
8135 | this.name = name;
|
8136 | this.ComponentClass = ComponentClass;
|
8137 | this.delegate = delegate;
|
8138 | this.template = template;
|
8139 | this.manager = CUSTOM_COMPONENT_MANAGER;
|
8140 | this.state = {
|
8141 | name,
|
8142 | ComponentClass,
|
8143 | template,
|
8144 | delegate
|
8145 | };
|
8146 | }
|
8147 |
|
8148 | }
|
8149 |
|
8150 | class InternalComponentDefinition {
|
8151 | constructor(manager, ComponentClass, layout) {
|
8152 | this.manager = manager;
|
8153 | this.state = {
|
8154 | ComponentClass,
|
8155 | layout
|
8156 | };
|
8157 | }
|
8158 |
|
8159 | }
|
8160 |
|
8161 | class InternalManager extends AbstractManager {
|
8162 | constructor(owner) {
|
8163 | super();
|
8164 | this.owner = owner;
|
8165 | }
|
8166 |
|
8167 | getJitStaticLayout({
|
8168 | layout: template
|
8169 | }) {
|
8170 | return (0, _util.unwrapTemplate)(template).asLayout();
|
8171 | }
|
8172 |
|
8173 | }
|
8174 |
|
8175 | var CAPABILITIES$2 = {
|
8176 | dynamicLayout: false,
|
8177 | dynamicTag: false,
|
8178 | prepareArgs: false,
|
8179 | createArgs: _environment2.ENV._DEBUG_RENDER_TREE,
|
8180 | attributeHook: false,
|
8181 | elementHook: false,
|
8182 | createCaller: false,
|
8183 | dynamicScope: false,
|
8184 | updateHook: _environment2.ENV._DEBUG_RENDER_TREE,
|
8185 | createInstance: true,
|
8186 | wrapped: false,
|
8187 | willDestroy: false
|
8188 | };
|
8189 |
|
8190 | class TemplateOnlyComponentManager extends AbstractManager {
|
8191 | getJitStaticLayout({
|
8192 | template
|
8193 | }) {
|
8194 | return (0, _util.unwrapTemplate)(template).asLayout();
|
8195 | }
|
8196 |
|
8197 | getCapabilities() {
|
8198 | return CAPABILITIES$2;
|
8199 | }
|
8200 |
|
8201 | create(environment, {
|
8202 | name,
|
8203 | template
|
8204 | }, args) {
|
8205 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8206 | var bucket = {
|
8207 | environment
|
8208 | };
|
8209 | environment.extra.debugRenderTree.create(bucket, {
|
8210 | type: 'component',
|
8211 | name: name,
|
8212 | args: args.capture(),
|
8213 | instance: null,
|
8214 | template
|
8215 | });
|
8216 | (0, _runtime2.registerDestructor)(bucket, () => {
|
8217 | bucket.environment.extra.debugRenderTree.willDestroy(bucket);
|
8218 | });
|
8219 | return bucket;
|
8220 | } else {
|
8221 | return null;
|
8222 | }
|
8223 | }
|
8224 |
|
8225 | getSelf() {
|
8226 | return _runtime2.NULL_REFERENCE;
|
8227 | }
|
8228 |
|
8229 | getTag() {
|
8230 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8231 |
|
8232 | return (0, _validator.createTag)();
|
8233 | } else {
|
8234 |
|
8235 | return _validator.CONSTANT_TAG;
|
8236 | }
|
8237 | }
|
8238 |
|
8239 | getDestroyable(bucket) {
|
8240 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8241 | return bucket;
|
8242 | } else {
|
8243 | return null;
|
8244 | }
|
8245 | }
|
8246 |
|
8247 | didRenderLayout(bucket, bounds) {
|
8248 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8249 | bucket.environment.extra.debugRenderTree.didRender(bucket, bounds);
|
8250 | }
|
8251 | }
|
8252 |
|
8253 | update(bucket) {
|
8254 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8255 | bucket.environment.extra.debugRenderTree.update(bucket);
|
8256 | }
|
8257 | }
|
8258 |
|
8259 | didUpdateLayout(bucket, bounds) {
|
8260 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
8261 | bucket.environment.extra.debugRenderTree.didRender(bucket, bounds);
|
8262 | }
|
8263 | }
|
8264 |
|
8265 | }
|
8266 |
|
8267 | var MANAGER = new TemplateOnlyComponentManager();
|
8268 |
|
8269 | class TemplateOnlyComponentDefinition {
|
8270 | constructor(name, template) {
|
8271 | this.name = name;
|
8272 | this.template = template;
|
8273 | this.manager = MANAGER;
|
8274 | }
|
8275 |
|
8276 | get state() {
|
8277 | return this;
|
8278 | }
|
8279 |
|
8280 | }
|
8281 |
|
8282 | var helper$1;
|
8283 |
|
8284 | if (true
|
8285 |
|
8286 | ) {
|
8287 | class ComponentAssertionReference {
|
8288 | constructor(component, message) {
|
8289 | this.component = component;
|
8290 | this.message = message;
|
8291 | this.tag = component.tag;
|
8292 | }
|
8293 |
|
8294 | value() {
|
8295 | var value = this.component.value();
|
8296 | (true && !(typeof value !== 'string') && (0, _debug.assert)(this.message, typeof value !== 'string'));
|
8297 | return value;
|
8298 | }
|
8299 |
|
8300 | get(property) {
|
8301 | return this.component.get(property);
|
8302 | }
|
8303 |
|
8304 | }
|
8305 |
|
8306 | helper$1 = args => new ComponentAssertionReference(args.positional.at(0), args.positional.at(1).value());
|
8307 | } else {
|
8308 | helper$1 = args => args.positional.at(0);
|
8309 | }
|
8310 |
|
8311 | var componentAssertionHelper = helper$1;
|
8312 | var helper$2;
|
8313 |
|
8314 | if (true
|
8315 |
|
8316 | ) {
|
8317 | class InElementNullCheckReference {
|
8318 | constructor(inner) {
|
8319 | this.inner = inner;
|
8320 | this.tag = inner.tag;
|
8321 | }
|
8322 |
|
8323 | value() {
|
8324 | var value = this.inner.value();
|
8325 | (true && !(value !== null && value !== undefined) && (0, _debug.assert)('You cannot pass a null or undefined destination element to in-element', value !== null && value !== undefined));
|
8326 | return value;
|
8327 | }
|
8328 |
|
8329 | get(key) {
|
8330 | return this.inner.get(key);
|
8331 | }
|
8332 |
|
8333 | }
|
8334 |
|
8335 | helper$2 = args => new InElementNullCheckReference(args.positional.at(0));
|
8336 | } else {
|
8337 | helper$2 = args => args.positional.at(0);
|
8338 | }
|
8339 |
|
8340 | var inElementNullCheckHelper = helper$2;
|
8341 |
|
8342 | function normalizeClass({
|
8343 | positional
|
8344 | }) {
|
8345 | var classNameParts = positional.at(0).value().split('.');
|
8346 | var className = classNameParts[classNameParts.length - 1];
|
8347 | var value = positional.at(1).value();
|
8348 |
|
8349 | if (value === true) {
|
8350 | return (0, _string.dasherize)(className);
|
8351 | } else if (!value && value !== 0) {
|
8352 | return '';
|
8353 | } else {
|
8354 | return String(value);
|
8355 | }
|
8356 | }
|
8357 |
|
8358 | function normalizeClassHelper(args, vm) {
|
8359 | return new _reference.HelperRootReference(normalizeClass, args.capture(), vm.env);
|
8360 | }
|
8361 | |
8362 |
|
8363 |
|
8364 |
|
8365 | |
8366 |
|
8367 |
|
8368 |
|
8369 |
|
8370 |
|
8371 |
|
8372 | class TrackArrayReference {
|
8373 | constructor(inner) {
|
8374 | this.inner = inner;
|
8375 | this.valueTag = (0, _validator.createUpdatableTag)();
|
8376 | this.tag = (0, _validator.combine)([inner.tag, this.valueTag]);
|
8377 | }
|
8378 |
|
8379 | value() {
|
8380 | var iterable = this.inner.value();
|
8381 | var tag = (0, _utils.isObject)(iterable) ? (0, _metal.tagForProperty)(iterable, '[]') : _validator.CONSTANT_TAG;
|
8382 | (0, _validator.updateTag)(this.valueTag, tag);
|
8383 | return iterable;
|
8384 | }
|
8385 |
|
8386 | get(key) {
|
8387 | return this.inner.get(key);
|
8388 | }
|
8389 |
|
8390 | }
|
8391 |
|
8392 | function trackArray(args) {
|
8393 | return new TrackArrayReference(args.positional.at(0));
|
8394 | }
|
8395 | |
8396 |
|
8397 |
|
8398 |
|
8399 | |
8400 |
|
8401 |
|
8402 |
|
8403 |
|
8404 |
|
8405 |
|
8406 |
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 |
|
8414 |
|
8415 |
|
8416 |
|
8417 |
|
8418 |
|
8419 |
|
8420 |
|
8421 |
|
8422 |
|
8423 |
|
8424 |
|
8425 |
|
8426 |
|
8427 |
|
8428 |
|
8429 |
|
8430 |
|
8431 |
|
8432 |
|
8433 |
|
8434 |
|
8435 |
|
8436 | function array(args) {
|
8437 | return args.positional.capture();
|
8438 | }
|
8439 |
|
8440 | var isEmpty = value => {
|
8441 | return value === null || value === undefined || typeof value.toString !== 'function';
|
8442 | };
|
8443 |
|
8444 | var normalizeTextValue = value => {
|
8445 | if (isEmpty(value)) {
|
8446 | return '';
|
8447 | }
|
8448 |
|
8449 | return String(value);
|
8450 | };
|
8451 | |
8452 |
|
8453 |
|
8454 |
|
8455 | |
8456 |
|
8457 |
|
8458 |
|
8459 |
|
8460 |
|
8461 |
|
8462 |
|
8463 |
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 |
|
8469 |
|
8470 |
|
8471 |
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 |
|
8479 | function concat({
|
8480 | positional
|
8481 | }) {
|
8482 | return positional.value().map(normalizeTextValue).join('');
|
8483 | }
|
8484 |
|
8485 | function concat$1(args, vm) {
|
8486 | return new _reference.HelperRootReference(concat, args.capture(), vm.env);
|
8487 | }
|
8488 |
|
8489 | function buildUntouchableThis(source) {
|
8490 | var context = null;
|
8491 |
|
8492 | if (true
|
8493 |
|
8494 | && _utils.HAS_NATIVE_PROXY) {
|
8495 | var assertOnProperty = property => {
|
8496 | (true && !(false) && (0, _debug.assert)(`You accessed \`this.${String(property)}\` from a function passed to the ${source}, but the function itself was not bound to a valid \`this\` context. Consider updating to usage of \`@action\`.`));
|
8497 | };
|
8498 |
|
8499 | context = new Proxy({}, {
|
8500 | get(_target, property) {
|
8501 | assertOnProperty(property);
|
8502 | },
|
8503 |
|
8504 | set(_target, property) {
|
8505 | assertOnProperty(property);
|
8506 | return false;
|
8507 | },
|
8508 |
|
8509 | has(_target, property) {
|
8510 | assertOnProperty(property);
|
8511 | return false;
|
8512 | }
|
8513 |
|
8514 | });
|
8515 | }
|
8516 |
|
8517 | return context;
|
8518 | }
|
8519 |
|
8520 | var context = buildUntouchableThis('`fn` helper');
|
8521 | |
8522 |
|
8523 |
|
8524 |
|
8525 | |
8526 |
|
8527 |
|
8528 |
|
8529 |
|
8530 |
|
8531 |
|
8532 |
|
8533 |
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 |
|
8540 |
|
8541 |
|
8542 |
|
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 |
|
8548 |
|
8549 |
|
8550 |
|
8551 |
|
8552 |
|
8553 |
|
8554 |
|
8555 |
|
8556 |
|
8557 |
|
8558 |
|
8559 |
|
8560 |
|
8561 |
|
8562 |
|
8563 |
|
8564 |
|
8565 |
|
8566 |
|
8567 |
|
8568 |
|
8569 |
|
8570 |
|
8571 |
|
8572 |
|
8573 |
|
8574 |
|
8575 |
|
8576 |
|
8577 |
|
8578 |
|
8579 |
|
8580 |
|
8581 |
|
8582 |
|
8583 |
|
8584 |
|
8585 |
|
8586 |
|
8587 |
|
8588 |
|
8589 |
|
8590 |
|
8591 |
|
8592 |
|
8593 | function fn({
|
8594 | positional
|
8595 | }, env) {
|
8596 | var callbackRef = positional.at(0);
|
8597 | (true && !(callbackRef !== undefined) && (0, _debug.assert)(`You must pass a function as the \`fn\` helpers first argument.`, callbackRef !== undefined));
|
8598 |
|
8599 | if (true
|
8600 |
|
8601 | && typeof callbackRef[INVOKE] !== 'function') {
|
8602 | var callback = callbackRef.value();
|
8603 | (true && !(typeof callback === 'function') && (0, _debug.assert)(`You must pass a function as the \`fn\` helpers first argument, you passed ${callback === null ? 'null' : typeof callback}. ${env.getTemplatePathDebugContext(callbackRef)}`, typeof callback === 'function'));
|
8604 | }
|
8605 |
|
8606 | return (...invocationArgs) => {
|
8607 | var [fn, ...args] = positional.value();
|
8608 |
|
8609 | if (typeof callbackRef[INVOKE] === 'function') {
|
8610 |
|
8611 |
|
8612 | return callbackRef[INVOKE](...args, ...invocationArgs);
|
8613 | } else {
|
8614 | return fn.call(context, ...args, ...invocationArgs);
|
8615 | }
|
8616 | };
|
8617 | }
|
8618 |
|
8619 | function fn$1(args, vm) {
|
8620 | var callback = fn;
|
8621 |
|
8622 | if (true
|
8623 |
|
8624 | ) {
|
8625 | callback = args => {
|
8626 | return fn(args, vm.env);
|
8627 | };
|
8628 | }
|
8629 |
|
8630 | return new _reference.HelperRootReference(callback, args.capture(), vm.env);
|
8631 | }
|
8632 | |
8633 |
|
8634 |
|
8635 |
|
8636 | |
8637 |
|
8638 |
|
8639 |
|
8640 |
|
8641 |
|
8642 |
|
8643 |
|
8644 |
|
8645 |
|
8646 |
|
8647 |
|
8648 |
|
8649 |
|
8650 |
|
8651 |
|
8652 |
|
8653 |
|
8654 |
|
8655 |
|
8656 |
|
8657 |
|
8658 |
|
8659 |
|
8660 |
|
8661 |
|
8662 |
|
8663 |
|
8664 |
|
8665 |
|
8666 |
|
8667 |
|
8668 |
|
8669 |
|
8670 |
|
8671 |
|
8672 |
|
8673 |
|
8674 |
|
8675 |
|
8676 |
|
8677 |
|
8678 |
|
8679 |
|
8680 |
|
8681 |
|
8682 |
|
8683 |
|
8684 |
|
8685 |
|
8686 |
|
8687 |
|
8688 |
|
8689 |
|
8690 |
|
8691 |
|
8692 |
|
8693 |
|
8694 |
|
8695 |
|
8696 |
|
8697 |
|
8698 |
|
8699 |
|
8700 |
|
8701 |
|
8702 |
|
8703 |
|
8704 |
|
8705 |
|
8706 |
|
8707 |
|
8708 |
|
8709 |
|
8710 |
|
8711 |
|
8712 |
|
8713 |
|
8714 |
|
8715 |
|
8716 |
|
8717 |
|
8718 | function get$1(args, vm) {
|
8719 | var sourceReference = args.positional.at(0);
|
8720 | var pathReference = args.positional.at(1);
|
8721 |
|
8722 | if ((0, _validator.isConstTagged)(pathReference)) {
|
8723 |
|
8724 |
|
8725 |
|
8726 | var path = pathReference.value();
|
8727 |
|
8728 | if (path === undefined || path === null || path === '') {
|
8729 | return _runtime2.NULL_REFERENCE;
|
8730 | } else if (typeof path === 'string' && path.indexOf('.') > -1) {
|
8731 | return referenceFromParts(sourceReference, path.split('.'));
|
8732 | } else {
|
8733 | return sourceReference.get(String(path));
|
8734 | }
|
8735 | } else {
|
8736 | return new GetHelperRootReference(args.capture(), vm.env);
|
8737 | }
|
8738 | }
|
8739 |
|
8740 | function get$2({
|
8741 | positional
|
8742 | }) {
|
8743 | var source = positional.at(0).value();
|
8744 |
|
8745 | if ((0, _utils.isObject)(source)) {
|
8746 | var path = positional.at(1).value();
|
8747 | return (0, _metal.get)(source, String(path));
|
8748 | }
|
8749 | }
|
8750 |
|
8751 | class GetHelperRootReference extends _reference.HelperRootReference {
|
8752 | constructor(args, env) {
|
8753 | super(get$2, args, env);
|
8754 | this.sourceReference = args.positional.at(0);
|
8755 | this.pathReference = args.positional.at(1);
|
8756 | }
|
8757 |
|
8758 | [_reference.UPDATE_REFERENCED_VALUE](value) {
|
8759 | var source = this.sourceReference.value();
|
8760 |
|
8761 | if ((0, _utils.isObject)(source)) {
|
8762 | var path = String(this.pathReference.value());
|
8763 | (0, _metal.set)(source, path, value);
|
8764 | }
|
8765 | }
|
8766 |
|
8767 | }
|
8768 | |
8769 |
|
8770 |
|
8771 |
|
8772 | |
8773 |
|
8774 |
|
8775 |
|
8776 |
|
8777 |
|
8778 |
|
8779 |
|
8780 |
|
8781 |
|
8782 |
|
8783 |
|
8784 |
|
8785 |
|
8786 |
|
8787 |
|
8788 |
|
8789 |
|
8790 |
|
8791 |
|
8792 |
|
8793 |
|
8794 |
|
8795 |
|
8796 |
|
8797 |
|
8798 |
|
8799 |
|
8800 |
|
8801 |
|
8802 |
|
8803 |
|
8804 |
|
8805 |
|
8806 |
|
8807 |
|
8808 |
|
8809 |
|
8810 |
|
8811 |
|
8812 | function hash(args) {
|
8813 | return args.named.capture();
|
8814 | }
|
8815 | |
8816 |
|
8817 |
|
8818 |
|
8819 |
|
8820 | function ifHelper({
|
8821 | positional
|
8822 | }) {
|
8823 | (true && !(positional.length === 3 || positional.length === 2) && (0, _debug.assert)('The inline form of the `if` helper expects two or three arguments, e.g. `{{if trialExpired "Expired" expiryDate}}`.', positional.length === 3 || positional.length === 2));
|
8824 | var condition = positional.at(0);
|
8825 | var truthyValue = positional.at(1);
|
8826 | var falsyValue = positional.at(2);
|
8827 |
|
8828 | if (toBool(condition.value()) === true) {
|
8829 | return truthyValue.value();
|
8830 | } else {
|
8831 | return falsyValue !== undefined ? falsyValue.value() : undefined;
|
8832 | }
|
8833 | }
|
8834 |
|
8835 | function unless({
|
8836 | positional
|
8837 | }) {
|
8838 | (true && !(positional.length === 3 || positional.length === 2) && (0, _debug.assert)('The inline form of the `unless` helper expects two or three arguments, e.g. `{{unless isFirstLogin "Welcome back!"}}`.', positional.length === 3 || positional.length === 2));
|
8839 | var condition = positional.at(0);
|
8840 | var truthyValue = positional.at(2);
|
8841 | var falsyValue = positional.at(1);
|
8842 |
|
8843 | if (toBool(condition.value()) === true) {
|
8844 | return truthyValue !== undefined ? truthyValue.value() : undefined;
|
8845 | } else {
|
8846 | return falsyValue.value();
|
8847 | }
|
8848 | }
|
8849 | |
8850 |
|
8851 |
|
8852 |
|
8853 |
|
8854 |
|
8855 |
|
8856 |
|
8857 |
|
8858 |
|
8859 |
|
8860 |
|
8861 |
|
8862 |
|
8863 |
|
8864 |
|
8865 |
|
8866 |
|
8867 |
|
8868 |
|
8869 |
|
8870 |
|
8871 |
|
8872 |
|
8873 |
|
8874 |
|
8875 |
|
8876 |
|
8877 |
|
8878 |
|
8879 |
|
8880 |
|
8881 |
|
8882 |
|
8883 |
|
8884 |
|
8885 |
|
8886 |
|
8887 |
|
8888 |
|
8889 |
|
8890 |
|
8891 |
|
8892 |
|
8893 |
|
8894 |
|
8895 |
|
8896 |
|
8897 |
|
8898 |
|
8899 |
|
8900 |
|
8901 |
|
8902 |
|
8903 |
|
8904 |
|
8905 |
|
8906 |
|
8907 |
|
8908 |
|
8909 |
|
8910 |
|
8911 |
|
8912 |
|
8913 |
|
8914 |
|
8915 |
|
8916 |
|
8917 |
|
8918 |
|
8919 |
|
8920 |
|
8921 |
|
8922 |
|
8923 |
|
8924 |
|
8925 |
|
8926 |
|
8927 |
|
8928 |
|
8929 |
|
8930 |
|
8931 |
|
8932 |
|
8933 |
|
8934 |
|
8935 |
|
8936 |
|
8937 |
|
8938 |
|
8939 |
|
8940 |
|
8941 |
|
8942 | function inlineIf(args, vm) {
|
8943 | return new _reference.HelperRootReference(ifHelper, args.capture(), vm.env);
|
8944 | }
|
8945 | |
8946 |
|
8947 |
|
8948 |
|
8949 |
|
8950 |
|
8951 |
|
8952 |
|
8953 |
|
8954 |
|
8955 |
|
8956 |
|
8957 |
|
8958 |
|
8959 |
|
8960 |
|
8961 |
|
8962 |
|
8963 |
|
8964 |
|
8965 |
|
8966 |
|
8967 |
|
8968 |
|
8969 |
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 |
|
8976 |
|
8977 |
|
8978 |
|
8979 |
|
8980 |
|
8981 |
|
8982 |
|
8983 |
|
8984 |
|
8985 |
|
8986 |
|
8987 |
|
8988 |
|
8989 |
|
8990 |
|
8991 |
|
8992 |
|
8993 |
|
8994 |
|
8995 |
|
8996 |
|
8997 |
|
8998 |
|
8999 |
|
9000 |
|
9001 |
|
9002 |
|
9003 |
|
9004 |
|
9005 |
|
9006 |
|
9007 |
|
9008 |
|
9009 |
|
9010 |
|
9011 |
|
9012 |
|
9013 |
|
9014 |
|
9015 |
|
9016 |
|
9017 |
|
9018 |
|
9019 |
|
9020 |
|
9021 |
|
9022 |
|
9023 |
|
9024 |
|
9025 |
|
9026 |
|
9027 |
|
9028 |
|
9029 |
|
9030 |
|
9031 |
|
9032 | function inlineUnless(args, vm) {
|
9033 | return new _reference.HelperRootReference(unless, args.capture(), vm.env);
|
9034 | }
|
9035 | |
9036 |
|
9037 |
|
9038 |
|
9039 | |
9040 |
|
9041 |
|
9042 |
|
9043 |
|
9044 |
|
9045 |
|
9046 |
|
9047 |
|
9048 |
|
9049 |
|
9050 |
|
9051 |
|
9052 |
|
9053 |
|
9054 | function log({
|
9055 | positional
|
9056 | }) {
|
9057 |
|
9058 | console.log(...positional.value());
|
9059 |
|
9060 | }
|
9061 |
|
9062 | function log$1(args, vm) {
|
9063 | return new _reference.HelperRootReference(log, args.capture(), vm.env);
|
9064 | }
|
9065 | |
9066 |
|
9067 |
|
9068 |
|
9069 | |
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 |
|
9075 |
|
9076 |
|
9077 |
|
9078 |
|
9079 |
|
9080 |
|
9081 |
|
9082 |
|
9083 |
|
9084 |
|
9085 |
|
9086 |
|
9087 |
|
9088 |
|
9089 |
|
9090 |
|
9091 |
|
9092 | function queryParams({
|
9093 | positional,
|
9094 | named
|
9095 | }) {
|
9096 |
|
9097 | (true && !(positional.value().length === 0) && (0, _debug.assert)("The `query-params` helper only accepts hash parameters, e.g. (query-params queryParamPropertyName='foo') as opposed to just (query-params 'foo')", positional.value().length === 0));
|
9098 | return new _routing.QueryParams((0, _polyfills.assign)({}, named.value()));
|
9099 | }
|
9100 |
|
9101 | function queryParams$1(args, vm) {
|
9102 | return new _reference.HelperRootReference(queryParams, args.capture(), vm.env);
|
9103 | }
|
9104 | |
9105 |
|
9106 |
|
9107 |
|
9108 |
|
9109 |
|
9110 |
|
9111 |
|
9112 |
|
9113 |
|
9114 |
|
9115 |
|
9116 |
|
9117 |
|
9118 |
|
9119 |
|
9120 |
|
9121 |
|
9122 |
|
9123 |
|
9124 |
|
9125 |
|
9126 |
|
9127 |
|
9128 |
|
9129 |
|
9130 |
|
9131 |
|
9132 |
|
9133 |
|
9134 |
|
9135 |
|
9136 |
|
9137 |
|
9138 |
|
9139 |
|
9140 |
|
9141 |
|
9142 |
|
9143 |
|
9144 |
|
9145 |
|
9146 |
|
9147 |
|
9148 |
|
9149 |
|
9150 |
|
9151 |
|
9152 |
|
9153 |
|
9154 |
|
9155 |
|
9156 |
|
9157 |
|
9158 |
|
9159 |
|
9160 |
|
9161 |
|
9162 |
|
9163 |
|
9164 |
|
9165 |
|
9166 |
|
9167 |
|
9168 |
|
9169 |
|
9170 |
|
9171 |
|
9172 |
|
9173 |
|
9174 |
|
9175 |
|
9176 |
|
9177 |
|
9178 |
|
9179 |
|
9180 |
|
9181 |
|
9182 |
|
9183 |
|
9184 |
|
9185 |
|
9186 |
|
9187 |
|
9188 |
|
9189 |
|
9190 |
|
9191 |
|
9192 |
|
9193 |
|
9194 |
|
9195 |
|
9196 |
|
9197 |
|
9198 |
|
9199 |
|
9200 |
|
9201 |
|
9202 |
|
9203 |
|
9204 |
|
9205 |
|
9206 |
|
9207 |
|
9208 |
|
9209 |
|
9210 |
|
9211 |
|
9212 |
|
9213 |
|
9214 |
|
9215 |
|
9216 |
|
9217 |
|
9218 |
|
9219 |
|
9220 |
|
9221 | class ReadonlyReference extends _reference.RootReference {
|
9222 | constructor(inner, env) {
|
9223 | super(env);
|
9224 | this.inner = inner;
|
9225 | this.tag = inner.tag;
|
9226 | }
|
9227 |
|
9228 | get [INVOKE]() {
|
9229 | return this.inner[INVOKE];
|
9230 | }
|
9231 |
|
9232 | value() {
|
9233 | return this.inner.value();
|
9234 | }
|
9235 |
|
9236 | get(key) {
|
9237 | return this.inner.get(key);
|
9238 | }
|
9239 |
|
9240 | }
|
9241 |
|
9242 | function readonly(args, vm) {
|
9243 | var ref = unMut(args.positional.at(0));
|
9244 | return new ReadonlyReference(ref, vm.env);
|
9245 | }
|
9246 | |
9247 |
|
9248 |
|
9249 |
|
9250 | |
9251 |
|
9252 |
|
9253 |
|
9254 |
|
9255 |
|
9256 |
|
9257 |
|
9258 |
|
9259 |
|
9260 |
|
9261 |
|
9262 |
|
9263 |
|
9264 |
|
9265 |
|
9266 |
|
9267 |
|
9268 |
|
9269 |
|
9270 |
|
9271 |
|
9272 |
|
9273 |
|
9274 |
|
9275 |
|
9276 |
|
9277 |
|
9278 |
|
9279 | function unbound(args, vm) {
|
9280 | (true && !(args.positional.length === 1 && args.named.length === 0) && (0, _debug.assert)('unbound helper cannot be called with multiple params or hash params', args.positional.length === 1 && args.named.length === 0));
|
9281 | return new UnboundRootReference(args.positional.at(0).value(), vm.env);
|
9282 | }
|
9283 |
|
9284 | var MODIFIERS = ['alt', 'shift', 'meta', 'ctrl'];
|
9285 | var POINTER_EVENT_TYPE_REGEX = /^click|mouse|touch/;
|
9286 |
|
9287 | function isAllowedEvent(event, allowedKeys) {
|
9288 | if (allowedKeys === null || allowedKeys === undefined) {
|
9289 | if (POINTER_EVENT_TYPE_REGEX.test(event.type)) {
|
9290 | return (0, _views.isSimpleClick)(event);
|
9291 | } else {
|
9292 | allowedKeys = '';
|
9293 | }
|
9294 | }
|
9295 |
|
9296 | if (allowedKeys.indexOf('any') >= 0) {
|
9297 | return true;
|
9298 | }
|
9299 |
|
9300 | for (var i = 0; i < MODIFIERS.length; i++) {
|
9301 | if (event[MODIFIERS[i] + 'Key'] && allowedKeys.indexOf(MODIFIERS[i]) === -1) {
|
9302 | return false;
|
9303 | }
|
9304 | }
|
9305 |
|
9306 | return true;
|
9307 | }
|
9308 |
|
9309 | var ActionHelper = {
|
9310 |
|
9311 |
|
9312 | registeredActions: _views.ActionManager.registeredActions,
|
9313 |
|
9314 | registerAction(actionState) {
|
9315 | var {
|
9316 | actionId
|
9317 | } = actionState;
|
9318 | _views.ActionManager.registeredActions[actionId] = actionState;
|
9319 | return actionId;
|
9320 | },
|
9321 |
|
9322 | unregisterAction(actionState) {
|
9323 | var {
|
9324 | actionId
|
9325 | } = actionState;
|
9326 | delete _views.ActionManager.registeredActions[actionId];
|
9327 | }
|
9328 |
|
9329 | };
|
9330 |
|
9331 | class ActionState {
|
9332 | constructor(element, actionId, actionName, actionArgs, namedArgs, positionalArgs, implicitTarget, dom, tag) {
|
9333 | this.element = element;
|
9334 | this.actionId = actionId;
|
9335 | this.actionName = actionName;
|
9336 | this.actionArgs = actionArgs;
|
9337 | this.namedArgs = namedArgs;
|
9338 | this.positional = positionalArgs;
|
9339 | this.implicitTarget = implicitTarget;
|
9340 | this.dom = dom;
|
9341 | this.eventName = this.getEventName();
|
9342 | this.tag = tag;
|
9343 | (0, _runtime2.registerDestructor)(this, () => ActionHelper.unregisterAction(this));
|
9344 | }
|
9345 |
|
9346 | getEventName() {
|
9347 | return this.namedArgs.get('on').value() || 'click';
|
9348 | }
|
9349 |
|
9350 | getActionArgs() {
|
9351 | var result = new Array(this.actionArgs.length);
|
9352 |
|
9353 | for (var i = 0; i < this.actionArgs.length; i++) {
|
9354 | result[i] = this.actionArgs[i].value();
|
9355 | }
|
9356 |
|
9357 | return result;
|
9358 | }
|
9359 |
|
9360 | getTarget() {
|
9361 | var {
|
9362 | implicitTarget,
|
9363 | namedArgs
|
9364 | } = this;
|
9365 | var target;
|
9366 |
|
9367 | if (namedArgs.has('target')) {
|
9368 | target = namedArgs.get('target').value();
|
9369 | } else {
|
9370 | target = implicitTarget.value();
|
9371 | }
|
9372 |
|
9373 | return target;
|
9374 | }
|
9375 |
|
9376 | handler(event) {
|
9377 | var {
|
9378 | actionName,
|
9379 | namedArgs
|
9380 | } = this;
|
9381 | var bubbles = namedArgs.get('bubbles');
|
9382 | var preventDefault = namedArgs.get('preventDefault');
|
9383 | var allowedKeys = namedArgs.get('allowedKeys');
|
9384 | var target = this.getTarget();
|
9385 | var shouldBubble = bubbles.value() !== false;
|
9386 |
|
9387 | if (!isAllowedEvent(event, allowedKeys.value())) {
|
9388 | return true;
|
9389 | }
|
9390 |
|
9391 | if (preventDefault.value() !== false) {
|
9392 | event.preventDefault();
|
9393 | }
|
9394 |
|
9395 | if (!shouldBubble) {
|
9396 | event.stopPropagation();
|
9397 | }
|
9398 |
|
9399 | (0, _runloop.join)(() => {
|
9400 | var args = this.getActionArgs();
|
9401 | var payload = {
|
9402 | args,
|
9403 | target,
|
9404 | name: null
|
9405 | };
|
9406 |
|
9407 | if (typeof actionName[INVOKE] === 'function') {
|
9408 | (0, _instrumentation.flaggedInstrument)('interaction.ember-action', payload, () => {
|
9409 | actionName[INVOKE].apply(actionName, args);
|
9410 | });
|
9411 | return;
|
9412 | }
|
9413 |
|
9414 | if (typeof actionName === 'function') {
|
9415 | (0, _instrumentation.flaggedInstrument)('interaction.ember-action', payload, () => {
|
9416 | actionName.apply(target, args);
|
9417 | });
|
9418 | return;
|
9419 | }
|
9420 |
|
9421 | payload.name = actionName;
|
9422 |
|
9423 | if (target.send) {
|
9424 | (0, _instrumentation.flaggedInstrument)('interaction.ember-action', payload, () => {
|
9425 | target.send.apply(target, [actionName, ...args]);
|
9426 | });
|
9427 | } else {
|
9428 | (true && !(typeof target[actionName] === 'function') && (0, _debug.assert)(`The action '${actionName}' did not exist on ${target}`, typeof target[actionName] === 'function'));
|
9429 | (0, _instrumentation.flaggedInstrument)('interaction.ember-action', payload, () => {
|
9430 | target[actionName].apply(target, args);
|
9431 | });
|
9432 | }
|
9433 | });
|
9434 | return shouldBubble;
|
9435 | }
|
9436 |
|
9437 | }
|
9438 |
|
9439 |
|
9440 | class ActionModifierManager {
|
9441 | create(element, _state, args, _dynamicScope, dom) {
|
9442 | var {
|
9443 | named,
|
9444 | positional,
|
9445 | tag
|
9446 | } = args.capture();
|
9447 | var implicitTarget;
|
9448 | var actionName;
|
9449 | var actionNameRef;
|
9450 |
|
9451 | if (positional.length > 1) {
|
9452 | implicitTarget = positional.at(0);
|
9453 | actionNameRef = positional.at(1);
|
9454 |
|
9455 | if (actionNameRef[INVOKE]) {
|
9456 | actionName = actionNameRef;
|
9457 | } else {
|
9458 | var actionLabel = actionNameRef.propertyKey;
|
9459 | actionName = actionNameRef.value();
|
9460 | (true && !(typeof actionName === 'string' || typeof actionName === 'function') && (0, _debug.assert)('You specified a quoteless path, `' + actionLabel + '`, to the ' + '{{action}} helper which did not resolve to an action name (a ' + 'string). Perhaps you meant to use a quoted actionName? (e.g. ' + '{{action "' + actionLabel + '"}}).', typeof actionName === 'string' || typeof actionName === 'function'));
|
9461 | }
|
9462 | }
|
9463 |
|
9464 | var actionArgs = [];
|
9465 |
|
9466 |
|
9467 | for (var i = 2; i < positional.length; i++) {
|
9468 | actionArgs.push(positional.at(i));
|
9469 | }
|
9470 |
|
9471 | var actionId = (0, _utils.uuid)();
|
9472 | var actionState = new ActionState(element, actionId, actionName, actionArgs, named, positional, implicitTarget, dom, tag);
|
9473 | (true && !(actionState.eventName !== 'mouseEnter' && actionState.eventName !== 'mouseLeave' && actionState.eventName !== 'mouseMove') && (0, _debug.deprecate)(`Using the \`{{action}}\` modifier with \`${actionState.eventName}\` events has been deprecated.`, actionState.eventName !== 'mouseEnter' && actionState.eventName !== 'mouseLeave' && actionState.eventName !== 'mouseMove', {
|
9474 | id: 'ember-views.event-dispatcher.mouseenter-leave-move',
|
9475 | until: '4.0.0',
|
9476 | url: 'https://emberjs.com/deprecations/v3.x#toc_action-mouseenter-leave-move'
|
9477 | }));
|
9478 | return actionState;
|
9479 | }
|
9480 |
|
9481 | install(actionState) {
|
9482 | var {
|
9483 | dom,
|
9484 | element,
|
9485 | actionId
|
9486 | } = actionState;
|
9487 | ActionHelper.registerAction(actionState);
|
9488 | dom.setAttribute(element, 'data-ember-action', '');
|
9489 | dom.setAttribute(element, `data-ember-action-${actionId}`, actionId);
|
9490 | }
|
9491 |
|
9492 | update(actionState) {
|
9493 | var {
|
9494 | positional
|
9495 | } = actionState;
|
9496 | var actionNameRef = positional.at(1);
|
9497 |
|
9498 | if (!actionNameRef[INVOKE]) {
|
9499 | actionState.actionName = actionNameRef.value();
|
9500 | }
|
9501 |
|
9502 | actionState.eventName = actionState.getEventName();
|
9503 | }
|
9504 |
|
9505 | getTag(actionState) {
|
9506 | return actionState.tag;
|
9507 | }
|
9508 |
|
9509 | getDestroyable(actionState) {
|
9510 | return actionState;
|
9511 | }
|
9512 |
|
9513 | }
|
9514 |
|
9515 | var debugRenderMessage;
|
9516 |
|
9517 | if (true
|
9518 |
|
9519 | ) {
|
9520 | debugRenderMessage = renderingStack => {
|
9521 | return `While rendering:\n----------------\n${renderingStack.replace(/^/gm, ' ')}`;
|
9522 | };
|
9523 | }
|
9524 |
|
9525 | var debugRenderMessage$1 = debugRenderMessage;
|
9526 |
|
9527 | function capabilities$1(managerAPI, optionalFeatures = {}) {
|
9528 | (true && !(managerAPI === '3.13') && (0, _debug.assert)('Invalid modifier manager compatibility specified', managerAPI === '3.13'));
|
9529 | return {
|
9530 | disableAutoTracking: Boolean(optionalFeatures.disableAutoTracking)
|
9531 | };
|
9532 | }
|
9533 |
|
9534 | class CustomModifierDefinition {
|
9535 | constructor(name, ModifierClass, delegate, isInteractive) {
|
9536 | this.name = name;
|
9537 | this.ModifierClass = ModifierClass;
|
9538 | this.delegate = delegate;
|
9539 | this.state = {
|
9540 | ModifierClass,
|
9541 | name,
|
9542 | delegate
|
9543 | };
|
9544 | this.manager = isInteractive ? CUSTOM_INTERACTIVE_MODIFIER_MANAGER : CUSTOM_NON_INTERACTIVE_MODIFIER_MANAGER;
|
9545 | }
|
9546 |
|
9547 | }
|
9548 |
|
9549 | class CustomModifierState {
|
9550 | constructor(element, delegate, modifier, args) {
|
9551 | this.element = element;
|
9552 | this.delegate = delegate;
|
9553 | this.modifier = modifier;
|
9554 | this.args = args;
|
9555 | this.tag = (0, _validator.createUpdatableTag)();
|
9556 | (0, _runtime2.registerDestructor)(this, () => delegate.destroyModifier(modifier, args.value()));
|
9557 | }
|
9558 |
|
9559 | }
|
9560 | |
9561 |
|
9562 |
|
9563 |
|
9564 |
|
9565 |
|
9566 |
|
9567 |
|
9568 |
|
9569 |
|
9570 |
|
9571 |
|
9572 |
|
9573 |
|
9574 |
|
9575 |
|
9576 |
|
9577 |
|
9578 |
|
9579 |
|
9580 |
|
9581 |
|
9582 |
|
9583 |
|
9584 |
|
9585 |
|
9586 | class InteractiveCustomModifierManager {
|
9587 | create(element, definition, args) {
|
9588 | var {
|
9589 | delegate,
|
9590 | ModifierClass
|
9591 | } = definition;
|
9592 | var capturedArgs = args.capture();
|
9593 | var instance = definition.delegate.createModifier(ModifierClass, capturedArgs.value());
|
9594 | return new CustomModifierState(element, delegate, instance, capturedArgs);
|
9595 | }
|
9596 |
|
9597 | getTag({
|
9598 | args,
|
9599 | tag
|
9600 | }) {
|
9601 | return (0, _validator.combine)([tag, args.tag]);
|
9602 | }
|
9603 |
|
9604 | install(state) {
|
9605 | var {
|
9606 | element,
|
9607 | args,
|
9608 | delegate,
|
9609 | modifier,
|
9610 | tag
|
9611 | } = state;
|
9612 | (true && !(typeof delegate.capabilities === 'object' && delegate.capabilities !== null) && (0, _debug.assert)('Custom modifier managers must define their capabilities using the capabilities() helper function', typeof delegate.capabilities === 'object' && delegate.capabilities !== null));
|
9613 | var {
|
9614 | capabilities
|
9615 | } = delegate;
|
9616 |
|
9617 | if (capabilities.disableAutoTracking === true) {
|
9618 | (0, _validator.untrack)(() => delegate.installModifier(modifier, element, args.value()));
|
9619 | } else {
|
9620 | var combinedTrackingTag = (0, _validator.track)(() => delegate.installModifier(modifier, element, args.value()), true
|
9621 |
|
9622 | && debugRenderMessage$1(`(instance of a \`${(0, _utils.getDebugName)(modifier)}\` modifier)`));
|
9623 | (0, _validator.updateTag)(tag, combinedTrackingTag);
|
9624 | }
|
9625 | }
|
9626 |
|
9627 | update(state) {
|
9628 | var {
|
9629 | args,
|
9630 | delegate,
|
9631 | modifier,
|
9632 | tag
|
9633 | } = state;
|
9634 | var {
|
9635 | capabilities
|
9636 | } = delegate;
|
9637 |
|
9638 | if (capabilities.disableAutoTracking === true) {
|
9639 | (0, _validator.untrack)(() => delegate.updateModifier(modifier, args.value()));
|
9640 | } else {
|
9641 | var combinedTrackingTag = (0, _validator.track)(() => delegate.updateModifier(modifier, args.value()), true
|
9642 |
|
9643 | && debugRenderMessage$1(`(instance of a \`${(0, _utils.getDebugName)(modifier)}\` modifier)`));
|
9644 | (0, _validator.updateTag)(tag, combinedTrackingTag);
|
9645 | }
|
9646 | }
|
9647 |
|
9648 | getDestroyable(state) {
|
9649 | return state;
|
9650 | }
|
9651 |
|
9652 | }
|
9653 |
|
9654 | class NonInteractiveCustomModifierManager {
|
9655 | create() {
|
9656 | return null;
|
9657 | }
|
9658 |
|
9659 | getTag() {
|
9660 | return _validator.CONSTANT_TAG;
|
9661 | }
|
9662 |
|
9663 | install() {}
|
9664 |
|
9665 | update() {}
|
9666 |
|
9667 | getDestroyable() {
|
9668 | return null;
|
9669 | }
|
9670 |
|
9671 | }
|
9672 |
|
9673 | var CUSTOM_INTERACTIVE_MODIFIER_MANAGER = new InteractiveCustomModifierManager();
|
9674 | var CUSTOM_NON_INTERACTIVE_MODIFIER_MANAGER = new NonInteractiveCustomModifierManager();
|
9675 | var untouchableContext = buildUntouchableThis('`on` modifier');
|
9676 | |
9677 |
|
9678 |
|
9679 |
|
9680 | |
9681 |
|
9682 |
|
9683 |
|
9684 |
|
9685 |
|
9686 |
|
9687 |
|
9688 |
|
9689 |
|
9690 |
|
9691 |
|
9692 |
|
9693 | var SUPPORTS_EVENT_OPTIONS = (() => {
|
9694 | try {
|
9695 | var div = document.createElement('div');
|
9696 | var counter = 0;
|
9697 | div.addEventListener('click', () => counter++, {
|
9698 | once: true
|
9699 | });
|
9700 | var event;
|
9701 |
|
9702 | if (typeof Event === 'function') {
|
9703 | event = new Event('click');
|
9704 | } else {
|
9705 | event = document.createEvent('Event');
|
9706 | event.initEvent('click', true, true);
|
9707 | }
|
9708 |
|
9709 | div.dispatchEvent(event);
|
9710 | div.dispatchEvent(event);
|
9711 | return counter === 1;
|
9712 | } catch (error) {
|
9713 | return false;
|
9714 | }
|
9715 | })();
|
9716 |
|
9717 | class OnModifierState {
|
9718 | constructor(owner, element, args) {
|
9719 | this.shouldUpdate = true;
|
9720 | this.owner = owner;
|
9721 | this.element = element;
|
9722 | this.args = args;
|
9723 | this.tag = args.tag;
|
9724 | }
|
9725 |
|
9726 | updateFromArgs() {
|
9727 | var {
|
9728 | args
|
9729 | } = this;
|
9730 | var {
|
9731 | once,
|
9732 | passive,
|
9733 | capture
|
9734 | } = args.named.value();
|
9735 |
|
9736 | if (once !== this.once) {
|
9737 | this.once = once;
|
9738 | this.shouldUpdate = true;
|
9739 | }
|
9740 |
|
9741 | if (passive !== this.passive) {
|
9742 | this.passive = passive;
|
9743 | this.shouldUpdate = true;
|
9744 | }
|
9745 |
|
9746 | if (capture !== this.capture) {
|
9747 | this.capture = capture;
|
9748 | this.shouldUpdate = true;
|
9749 | }
|
9750 |
|
9751 | var options;
|
9752 |
|
9753 | if (once || passive || capture) {
|
9754 | options = this.options = {
|
9755 | once,
|
9756 | passive,
|
9757 | capture
|
9758 | };
|
9759 | } else {
|
9760 | this.options = undefined;
|
9761 | }
|
9762 |
|
9763 | (true && !(args.positional.at(0) !== undefined && typeof args.positional.at(0).value() === 'string') && (0, _debug.assert)('You must pass a valid DOM event name as the first argument to the `on` modifier', args.positional.at(0) !== undefined && typeof args.positional.at(0).value() === 'string'));
|
9764 | var eventName = args.positional.at(0).value();
|
9765 |
|
9766 | if (eventName !== this.eventName) {
|
9767 | this.eventName = eventName;
|
9768 | this.shouldUpdate = true;
|
9769 | }
|
9770 |
|
9771 | var userProvidedCallbackReference = args.positional.at(1);
|
9772 |
|
9773 | if (true
|
9774 |
|
9775 | ) {
|
9776 | (true && !(args.positional.at(1) !== undefined) && (0, _debug.assert)(`You must pass a function as the second argument to the \`on\` modifier.`, args.positional.at(1) !== undefined));
|
9777 |
|
9778 | var renderer = (0, _util.expect)(this.owner.lookup('renderer:-dom'), `BUG: owner is missing renderer:-dom`);
|
9779 | var stack = renderer.debugRenderTree.logRenderStackForPath(userProvidedCallbackReference);
|
9780 | var value = userProvidedCallbackReference.value();
|
9781 | (true && !(typeof value === 'function') && (0, _debug.assert)(`You must pass a function as the second argument to the \`on\` modifier, you passed ${value === null ? 'null' : typeof value}. While rendering:\n\n${stack}`, typeof value === 'function'));
|
9782 | }
|
9783 |
|
9784 | var userProvidedCallback = userProvidedCallbackReference.value();
|
9785 |
|
9786 | if (userProvidedCallback !== this.userProvidedCallback) {
|
9787 | this.userProvidedCallback = userProvidedCallback;
|
9788 | this.shouldUpdate = true;
|
9789 | }
|
9790 |
|
9791 | (true && !(args.positional.length === 2) && (0, _debug.assert)(`You can only pass two positional arguments (event name and callback) to the \`on\` modifier, but you provided ${args.positional.length}. Consider using the \`fn\` helper to provide additional arguments to the \`on\` callback.`, args.positional.length === 2));
|
9792 | var needsCustomCallback = SUPPORTS_EVENT_OPTIONS === false && once ||
|
9793 |
|
9794 | true
|
9795 |
|
9796 | && passive
|
9797 |
|
9798 | ;
|
9799 |
|
9800 | if (this.shouldUpdate) {
|
9801 | if (needsCustomCallback) {
|
9802 | var callback = this.callback = function (event) {
|
9803 | if (true
|
9804 |
|
9805 | && passive) {
|
9806 | event.preventDefault = () => {
|
9807 | (true && !(false) && (0, _debug.assert)(`You marked this listener as 'passive', meaning that you must not call 'event.preventDefault()': \n\n${userProvidedCallback}`));
|
9808 | };
|
9809 | }
|
9810 |
|
9811 | if (!SUPPORTS_EVENT_OPTIONS && once) {
|
9812 | removeEventListener(this, eventName, callback, options);
|
9813 | }
|
9814 |
|
9815 | return userProvidedCallback.call(untouchableContext, event);
|
9816 | };
|
9817 | } else if (true
|
9818 |
|
9819 | ) {
|
9820 |
|
9821 | this.callback = userProvidedCallback.bind(untouchableContext);
|
9822 | } else {
|
9823 | this.callback = userProvidedCallback;
|
9824 | }
|
9825 | }
|
9826 | }
|
9827 |
|
9828 | }
|
9829 |
|
9830 | var adds = 0;
|
9831 | var removes = 0;
|
9832 |
|
9833 | function removeEventListener(element, eventName, callback, options) {
|
9834 | removes++;
|
9835 |
|
9836 | if (SUPPORTS_EVENT_OPTIONS) {
|
9837 |
|
9838 | element.removeEventListener(eventName, callback, options);
|
9839 | } else if (options !== undefined && options.capture) {
|
9840 |
|
9841 |
|
9842 |
|
9843 |
|
9844 |
|
9845 |
|
9846 | element.removeEventListener(eventName, callback, true);
|
9847 | } else {
|
9848 |
|
9849 |
|
9850 |
|
9851 |
|
9852 | element.removeEventListener(eventName, callback);
|
9853 | }
|
9854 | }
|
9855 |
|
9856 | function addEventListener(element, eventName, callback, options) {
|
9857 | adds++;
|
9858 |
|
9859 | if (SUPPORTS_EVENT_OPTIONS) {
|
9860 |
|
9861 | element.addEventListener(eventName, callback, options);
|
9862 | } else if (options !== undefined && options.capture) {
|
9863 |
|
9864 |
|
9865 |
|
9866 |
|
9867 |
|
9868 |
|
9869 | element.addEventListener(eventName, callback, true);
|
9870 | } else {
|
9871 |
|
9872 |
|
9873 |
|
9874 |
|
9875 | element.addEventListener(eventName, callback);
|
9876 | }
|
9877 | }
|
9878 | |
9879 |
|
9880 |
|
9881 |
|
9882 |
|
9883 |
|
9884 |
|
9885 |
|
9886 |
|
9887 |
|
9888 |
|
9889 |
|
9890 |
|
9891 |
|
9892 |
|
9893 |
|
9894 |
|
9895 |
|
9896 |
|
9897 |
|
9898 |
|
9899 |
|
9900 |
|
9901 |
|
9902 |
|
9903 |
|
9904 |
|
9905 |
|
9906 |
|
9907 |
|
9908 |
|
9909 |
|
9910 |
|
9911 |
|
9912 |
|
9913 |
|
9914 |
|
9915 |
|
9916 |
|
9917 |
|
9918 |
|
9919 |
|
9920 |
|
9921 |
|
9922 |
|
9923 |
|
9924 |
|
9925 |
|
9926 |
|
9927 |
|
9928 |
|
9929 |
|
9930 |
|
9931 |
|
9932 |
|
9933 |
|
9934 |
|
9935 |
|
9936 |
|
9937 |
|
9938 |
|
9939 |
|
9940 |
|
9941 |
|
9942 |
|
9943 |
|
9944 |
|
9945 |
|
9946 |
|
9947 |
|
9948 |
|
9949 |
|
9950 |
|
9951 |
|
9952 |
|
9953 |
|
9954 |
|
9955 |
|
9956 |
|
9957 |
|
9958 |
|
9959 |
|
9960 |
|
9961 |
|
9962 |
|
9963 |
|
9964 |
|
9965 |
|
9966 |
|
9967 |
|
9968 |
|
9969 |
|
9970 |
|
9971 | class OnModifierManager {
|
9972 | constructor(owner, isInteractive) {
|
9973 | this.SUPPORTS_EVENT_OPTIONS = SUPPORTS_EVENT_OPTIONS;
|
9974 | this.isInteractive = isInteractive;
|
9975 | this.owner = owner;
|
9976 | }
|
9977 |
|
9978 | get counters() {
|
9979 | return {
|
9980 | adds,
|
9981 | removes
|
9982 | };
|
9983 | }
|
9984 |
|
9985 | create(element, _state, args) {
|
9986 | if (!this.isInteractive) {
|
9987 | return null;
|
9988 | }
|
9989 |
|
9990 | var capturedArgs = args.capture();
|
9991 | return new OnModifierState(this.owner, element, capturedArgs);
|
9992 | }
|
9993 |
|
9994 | getTag(state) {
|
9995 | if (state === null) {
|
9996 | return _validator.CONSTANT_TAG;
|
9997 | }
|
9998 |
|
9999 | return state.tag;
|
10000 | }
|
10001 |
|
10002 | install(state) {
|
10003 | if (state === null) {
|
10004 | return;
|
10005 | }
|
10006 |
|
10007 | state.updateFromArgs();
|
10008 | var {
|
10009 | element,
|
10010 | eventName,
|
10011 | callback,
|
10012 | options
|
10013 | } = state;
|
10014 | addEventListener(element, eventName, callback, options);
|
10015 | (0, _runtime2.registerDestructor)(state, () => removeEventListener(element, eventName, callback, options));
|
10016 | state.shouldUpdate = false;
|
10017 | }
|
10018 |
|
10019 | update(state) {
|
10020 | if (state === null) {
|
10021 | return;
|
10022 | }
|
10023 |
|
10024 |
|
10025 | var {
|
10026 | element,
|
10027 | eventName,
|
10028 | callback,
|
10029 | options
|
10030 | } = state;
|
10031 | state.updateFromArgs();
|
10032 |
|
10033 | if (!state.shouldUpdate) {
|
10034 | return;
|
10035 | }
|
10036 |
|
10037 |
|
10038 | removeEventListener(element, eventName, callback, options);
|
10039 |
|
10040 | addEventListener(state.element, state.eventName, state.callback, state.options);
|
10041 | state.shouldUpdate = false;
|
10042 | }
|
10043 |
|
10044 | getDestroyable(state) {
|
10045 | return state;
|
10046 | }
|
10047 |
|
10048 | }
|
10049 |
|
10050 | var CAPABILITIES$3 = {
|
10051 | dynamicLayout: true,
|
10052 | dynamicTag: false,
|
10053 | prepareArgs: false,
|
10054 | createArgs: true,
|
10055 | attributeHook: false,
|
10056 | elementHook: false,
|
10057 | createCaller: true,
|
10058 | dynamicScope: true,
|
10059 | updateHook: true,
|
10060 | createInstance: true,
|
10061 | wrapped: false,
|
10062 | willDestroy: false
|
10063 | };
|
10064 |
|
10065 |
|
10066 |
|
10067 | var MODEL_ARG_NAME = 'model';
|
10068 |
|
10069 | class MountManager extends AbstractManager {
|
10070 | getJitDynamicLayout(state, _) {
|
10071 | var templateFactory$$1 = state.engine.lookup('template:application');
|
10072 | var template = templateFactory$$1(state.engine);
|
10073 |
|
10074 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
10075 | state.environment.extra.debugRenderTree.setTemplate(state.controller, template);
|
10076 | }
|
10077 |
|
10078 | return template;
|
10079 | }
|
10080 |
|
10081 | getCapabilities() {
|
10082 | return CAPABILITIES$3;
|
10083 | }
|
10084 |
|
10085 | create(environment, {
|
10086 | name
|
10087 | }, args) {
|
10088 |
|
10089 |
|
10090 |
|
10091 |
|
10092 | var engine = environment.extra.owner.buildChildEngineInstance(name);
|
10093 | engine.boot();
|
10094 | var applicationFactory = engine.factoryFor(`controller:application`);
|
10095 | var controllerFactory = applicationFactory || (0, _routing.generateControllerFactory)(engine, 'application');
|
10096 | var controller;
|
10097 | var self;
|
10098 | var bucket;
|
10099 | var modelRef;
|
10100 |
|
10101 | if (args.named.has(MODEL_ARG_NAME)) {
|
10102 | modelRef = args.named.get(MODEL_ARG_NAME);
|
10103 | }
|
10104 |
|
10105 | if (modelRef === undefined) {
|
10106 | controller = controllerFactory.create();
|
10107 | self = new _reference.ComponentRootReference(controller, environment);
|
10108 | bucket = {
|
10109 | engine,
|
10110 | controller,
|
10111 | self,
|
10112 | environment
|
10113 | };
|
10114 | } else {
|
10115 | var model = modelRef.value();
|
10116 | controller = controllerFactory.create({
|
10117 | model
|
10118 | });
|
10119 | self = new _reference.ComponentRootReference(controller, environment);
|
10120 | bucket = {
|
10121 | engine,
|
10122 | controller,
|
10123 | self,
|
10124 | modelRef,
|
10125 | environment
|
10126 | };
|
10127 | }
|
10128 |
|
10129 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
10130 | environment.extra.debugRenderTree.create(bucket, {
|
10131 | type: 'engine',
|
10132 | name,
|
10133 | args: args.capture(),
|
10134 | instance: engine,
|
10135 | template: undefined
|
10136 | });
|
10137 | environment.extra.debugRenderTree.create(controller, {
|
10138 | type: 'route-template',
|
10139 | name: 'application',
|
10140 | args: args.capture(),
|
10141 | instance: controller,
|
10142 |
|
10143 | template: undefined
|
10144 | });
|
10145 | (0, _runtime2.registerDestructor)(engine, () => {
|
10146 | environment.extra.debugRenderTree.willDestroy(controller);
|
10147 | environment.extra.debugRenderTree.willDestroy(bucket);
|
10148 | });
|
10149 | }
|
10150 |
|
10151 | return bucket;
|
10152 | }
|
10153 |
|
10154 | getSelf({
|
10155 | self
|
10156 | }) {
|
10157 | return self;
|
10158 | }
|
10159 |
|
10160 | getTag(state) {
|
10161 | var tag = _validator.CONSTANT_TAG;
|
10162 |
|
10163 | if (state.modelRef) {
|
10164 | tag = state.modelRef.tag;
|
10165 | }
|
10166 |
|
10167 | if (_environment2.ENV._DEBUG_RENDER_TREE && (0, _validator.isConstTag)(tag)) {
|
10168 | tag = (0, _validator.createTag)();
|
10169 | }
|
10170 |
|
10171 | return tag;
|
10172 | }
|
10173 |
|
10174 | getDestroyable(bucket) {
|
10175 | return bucket.engine;
|
10176 | }
|
10177 |
|
10178 | didRenderLayout(bucket, bounds) {
|
10179 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
10180 | bucket.environment.extra.debugRenderTree.didRender(bucket.controller, bounds);
|
10181 | bucket.environment.extra.debugRenderTree.didRender(bucket, bounds);
|
10182 | }
|
10183 | }
|
10184 |
|
10185 | update(bucket) {
|
10186 | var {
|
10187 | controller,
|
10188 | environment,
|
10189 | modelRef
|
10190 | } = bucket;
|
10191 |
|
10192 | if (modelRef !== undefined) {
|
10193 | controller.set('model', modelRef.value());
|
10194 | }
|
10195 |
|
10196 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
10197 | environment.extra.debugRenderTree.update(bucket);
|
10198 | environment.extra.debugRenderTree.update(bucket.controller);
|
10199 | }
|
10200 | }
|
10201 |
|
10202 | didUpdateLayout(bucket, bounds) {
|
10203 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
10204 | bucket.environment.extra.debugRenderTree.didRender(bucket.controller, bounds);
|
10205 | bucket.environment.extra.debugRenderTree.didRender(bucket, bounds);
|
10206 | }
|
10207 | }
|
10208 |
|
10209 | }
|
10210 |
|
10211 | var MOUNT_MANAGER = new MountManager();
|
10212 |
|
10213 | class MountDefinition {
|
10214 | constructor(name) {
|
10215 | this.manager = MOUNT_MANAGER;
|
10216 | this.state = {
|
10217 | name
|
10218 | };
|
10219 | }
|
10220 |
|
10221 | }
|
10222 | |
10223 |
|
10224 |
|
10225 |
|
10226 |
|
10227 | function mountHelper(args, vm) {
|
10228 | var env = vm.env;
|
10229 | var nameRef = args.positional.at(0);
|
10230 | var captured = null;
|
10231 | (true && !(args.positional.length === 1) && (0, _debug.assert)('You can only pass a single positional argument to the {{mount}} helper, e.g. {{mount "chat-engine"}}.', args.positional.length === 1));
|
10232 |
|
10233 | if (true
|
10234 |
|
10235 | && args.named) {
|
10236 | var keys = args.named.names;
|
10237 | var extra = keys.filter(k => k !== 'model');
|
10238 | (true && !(extra.length === 0) && (0, _debug.assert)('You can only pass a `model` argument to the {{mount}} helper, ' + 'e.g. {{mount "profile-engine" model=this.profile}}. ' + `You passed ${extra.join(',')}.`, extra.length === 0));
|
10239 | }
|
10240 |
|
10241 |
|
10242 |
|
10243 |
|
10244 | if (args.named.has('model')) {
|
10245 | (true && !(args.named.length === 1) && (0, _debug.assert)('[BUG] this should already be checked by the macro', args.named.length === 1));
|
10246 | var named = args.named.capture();
|
10247 | var {
|
10248 | tag
|
10249 | } = named;
|
10250 |
|
10251 | if (true
|
10252 |
|
10253 | && MODEL_ARG_NAME !== 'model') {
|
10254 | (true && !(named['_map'] === null) && (0, _debug.assert)('[BUG] named._map is not null', named['_map'] === null));
|
10255 | named.names = [MODEL_ARG_NAME];
|
10256 | }
|
10257 |
|
10258 | captured = {
|
10259 | tag,
|
10260 | positional: _runtime2.EMPTY_ARGS.positional,
|
10261 | named,
|
10262 | length: 1,
|
10263 |
|
10264 | value() {
|
10265 | return {
|
10266 | named: this.named.value(),
|
10267 | positional: this.positional.value()
|
10268 | };
|
10269 | }
|
10270 |
|
10271 | };
|
10272 | }
|
10273 |
|
10274 | return new DynamicEngineReference(nameRef, env, captured);
|
10275 | }
|
10276 | |
10277 |
|
10278 |
|
10279 |
|
10280 |
|
10281 |
|
10282 |
|
10283 |
|
10284 |
|
10285 |
|
10286 |
|
10287 |
|
10288 |
|
10289 |
|
10290 |
|
10291 |
|
10292 |
|
10293 |
|
10294 |
|
10295 |
|
10296 |
|
10297 |
|
10298 |
|
10299 |
|
10300 |
|
10301 |
|
10302 |
|
10303 |
|
10304 |
|
10305 |
|
10306 |
|
10307 |
|
10308 |
|
10309 |
|
10310 |
|
10311 |
|
10312 |
|
10313 |
|
10314 |
|
10315 |
|
10316 |
|
10317 |
|
10318 | class DynamicEngineReference {
|
10319 | constructor(nameRef, env, args) {
|
10320 | this.nameRef = nameRef;
|
10321 | this.env = env;
|
10322 | this.args = args;
|
10323 | this._lastName = null;
|
10324 | this._lastDef = null;
|
10325 | this.tag = nameRef.tag;
|
10326 | }
|
10327 |
|
10328 | value() {
|
10329 | var {
|
10330 | env,
|
10331 | nameRef,
|
10332 | args
|
10333 | } = this;
|
10334 | var name = nameRef.value();
|
10335 |
|
10336 | if (typeof name === 'string') {
|
10337 | if (this._lastName === name) {
|
10338 | return this._lastDef;
|
10339 | }
|
10340 |
|
10341 | (true && !(env.extra.owner.hasRegistration(`engine:${name}`)) && (0, _debug.assert)(`You used \`{{mount '${name}'}}\`, but the engine '${name}' can not be found.`, env.extra.owner.hasRegistration(`engine:${name}`)));
|
10342 |
|
10343 | if (!env.extra.owner.hasRegistration(`engine:${name}`)) {
|
10344 | return null;
|
10345 | }
|
10346 |
|
10347 | this._lastName = name;
|
10348 | this._lastDef = (0, _runtime2.curry)(new MountDefinition(name), args);
|
10349 | return this._lastDef;
|
10350 | } else {
|
10351 | (true && !(name === null || name === undefined) && (0, _debug.assert)(`Invalid engine name '${name}' specified, engine name must be either a string, null or undefined.`, name === null || name === undefined));
|
10352 | this._lastDef = null;
|
10353 | this._lastName = null;
|
10354 | return null;
|
10355 | }
|
10356 | }
|
10357 |
|
10358 | get() {
|
10359 | return _runtime2.UNDEFINED_REFERENCE;
|
10360 | }
|
10361 |
|
10362 | }
|
10363 | |
10364 |
|
10365 |
|
10366 |
|
10367 |
|
10368 | class RootOutletReference {
|
10369 | constructor(outletState) {
|
10370 | this.outletState = outletState;
|
10371 | this.tag = (0, _validator.createTag)();
|
10372 | }
|
10373 |
|
10374 | get(key) {
|
10375 | return new PathReference(this, key);
|
10376 | }
|
10377 |
|
10378 | value() {
|
10379 | return this.outletState;
|
10380 | }
|
10381 |
|
10382 | update(state) {
|
10383 | this.outletState.outlets.main = state;
|
10384 | (0, _validator.dirtyTag)(this.tag);
|
10385 | }
|
10386 |
|
10387 | }
|
10388 | |
10389 |
|
10390 |
|
10391 |
|
10392 |
|
10393 | class OutletReference {
|
10394 | constructor(parentStateRef, outletNameRef) {
|
10395 | this.parentStateRef = parentStateRef;
|
10396 | this.outletNameRef = outletNameRef;
|
10397 | this.tag = (0, _validator.combine)([parentStateRef.tag, outletNameRef.tag]);
|
10398 | }
|
10399 |
|
10400 | value() {
|
10401 | var outletState = this.parentStateRef.value();
|
10402 | var outlets = outletState === undefined ? undefined : outletState.outlets;
|
10403 | return outlets === undefined ? undefined : outlets[this.outletNameRef.value()];
|
10404 | }
|
10405 |
|
10406 | get(key) {
|
10407 | return new PathReference(this, key);
|
10408 | }
|
10409 |
|
10410 | }
|
10411 | |
10412 |
|
10413 |
|
10414 |
|
10415 |
|
10416 |
|
10417 | class PathReference {
|
10418 | constructor(parent, key) {
|
10419 | this.parent = parent;
|
10420 | this.key = key;
|
10421 | this.tag = parent.tag;
|
10422 | }
|
10423 |
|
10424 | get(key) {
|
10425 | return new PathReference(this, key);
|
10426 | }
|
10427 |
|
10428 | value() {
|
10429 | var parent = this.parent.value();
|
10430 | return parent && parent[this.key];
|
10431 | }
|
10432 |
|
10433 | }
|
10434 | |
10435 |
|
10436 |
|
10437 |
|
10438 |
|
10439 |
|
10440 |
|
10441 |
|
10442 |
|
10443 |
|
10444 |
|
10445 |
|
10446 |
|
10447 |
|
10448 |
|
10449 |
|
10450 |
|
10451 |
|
10452 |
|
10453 |
|
10454 |
|
10455 |
|
10456 |
|
10457 |
|
10458 |
|
10459 |
|
10460 |
|
10461 |
|
10462 |
|
10463 |
|
10464 |
|
10465 |
|
10466 |
|
10467 |
|
10468 |
|
10469 |
|
10470 |
|
10471 |
|
10472 |
|
10473 |
|
10474 |
|
10475 |
|
10476 |
|
10477 |
|
10478 |
|
10479 |
|
10480 |
|
10481 |
|
10482 |
|
10483 | function outletHelper(args, vm) {
|
10484 | var scope = vm.dynamicScope();
|
10485 | var nameRef;
|
10486 |
|
10487 | if (args.positional.length === 0) {
|
10488 | nameRef = new _reference.ConstReference('main');
|
10489 | } else {
|
10490 | nameRef = args.positional.at(0);
|
10491 | }
|
10492 |
|
10493 | return new OutletComponentReference(new OutletReference(scope.outletState, nameRef), vm.env);
|
10494 | }
|
10495 |
|
10496 | class OutletModelReference extends _reference.RootReference {
|
10497 | constructor(parent, env) {
|
10498 | super(env);
|
10499 | this.parent = parent;
|
10500 | this.tag = parent.tag;
|
10501 | }
|
10502 |
|
10503 | value() {
|
10504 | var state = this.parent.value();
|
10505 |
|
10506 | if (state === undefined) {
|
10507 | return undefined;
|
10508 | }
|
10509 |
|
10510 | var {
|
10511 | render
|
10512 | } = state;
|
10513 |
|
10514 | if (render === undefined) {
|
10515 | return undefined;
|
10516 | }
|
10517 |
|
10518 | return render.model;
|
10519 | }
|
10520 |
|
10521 | }
|
10522 |
|
10523 | if (true
|
10524 |
|
10525 | ) {
|
10526 | OutletModelReference.prototype['debugLogName'] = '@model';
|
10527 | }
|
10528 |
|
10529 | class OutletComponentReference {
|
10530 | constructor(outletRef, env) {
|
10531 | this.outletRef = outletRef;
|
10532 | this.env = env;
|
10533 | this.definition = null;
|
10534 | this.lastState = null;
|
10535 |
|
10536 | this.tag = outletRef.tag;
|
10537 | }
|
10538 |
|
10539 | value() {
|
10540 | var state = stateFor(this.outletRef);
|
10541 |
|
10542 | if (validate(state, this.lastState)) {
|
10543 | return this.definition;
|
10544 | }
|
10545 |
|
10546 | this.lastState = state;
|
10547 | var definition = null;
|
10548 |
|
10549 | if (state !== null) {
|
10550 | var args = makeArgs(this.outletRef, this.env);
|
10551 | definition = (0, _runtime2.curry)(new OutletComponentDefinition(state), args);
|
10552 | }
|
10553 |
|
10554 | return this.definition = definition;
|
10555 | }
|
10556 |
|
10557 | get(_key) {
|
10558 | return _runtime2.UNDEFINED_REFERENCE;
|
10559 | }
|
10560 |
|
10561 | }
|
10562 |
|
10563 | function makeArgs(outletRef, env) {
|
10564 | var tag = outletRef.tag;
|
10565 | var modelRef = new OutletModelReference(outletRef, env);
|
10566 | var map = (0, _util.dict)();
|
10567 | map.model = modelRef;
|
10568 |
|
10569 |
|
10570 |
|
10571 | return {
|
10572 | tag,
|
10573 | positional: _runtime2.EMPTY_ARGS.positional,
|
10574 | named: {
|
10575 | tag,
|
10576 | map,
|
10577 | names: ['model'],
|
10578 | references: [modelRef],
|
10579 | length: 1,
|
10580 |
|
10581 | has(key) {
|
10582 | return key === 'model';
|
10583 | },
|
10584 |
|
10585 | get(key) {
|
10586 | return key === 'model' ? modelRef : _runtime2.UNDEFINED_REFERENCE;
|
10587 | },
|
10588 |
|
10589 | value() {
|
10590 | var model = modelRef.value();
|
10591 | return {
|
10592 | model
|
10593 | };
|
10594 | }
|
10595 |
|
10596 | },
|
10597 | length: 1,
|
10598 |
|
10599 | value() {
|
10600 | return {
|
10601 | named: this.named.value(),
|
10602 | positional: this.positional.value()
|
10603 | };
|
10604 | }
|
10605 |
|
10606 | };
|
10607 | }
|
10608 |
|
10609 | function stateFor(ref) {
|
10610 | var outlet = ref.value();
|
10611 | if (outlet === undefined) return null;
|
10612 | var render = outlet.render;
|
10613 | if (render === undefined) return null;
|
10614 | var template$$1 = render.template;
|
10615 | if (template$$1 === undefined) return null;
|
10616 |
|
10617 |
|
10618 | if (isTemplateFactory(template$$1)) {
|
10619 | template$$1 = template$$1(render.owner);
|
10620 | }
|
10621 |
|
10622 | return {
|
10623 | ref,
|
10624 | name: render.name,
|
10625 | outlet: render.outlet,
|
10626 | template: template$$1,
|
10627 | controller: render.controller,
|
10628 | model: render.model
|
10629 | };
|
10630 | }
|
10631 |
|
10632 | function validate(state, lastState) {
|
10633 | if (state === null) {
|
10634 | return lastState === null;
|
10635 | }
|
10636 |
|
10637 | if (lastState === null) {
|
10638 | return false;
|
10639 | }
|
10640 |
|
10641 | return state.template === lastState.template && state.controller === lastState.controller;
|
10642 | }
|
10643 |
|
10644 | var TEMPLATES = new WeakMap();
|
10645 | var getPrototypeOf = Object.getPrototypeOf;
|
10646 |
|
10647 | function setComponentTemplate(factory, obj) {
|
10648 | (true && !(obj !== null && (typeof obj === 'object' || typeof obj === 'function')) && (0, _debug.assert)(`Cannot call \`setComponentTemplate\` on \`${(0, _utils.toString)(obj)}\``, obj !== null && (typeof obj === 'object' || typeof obj === 'function')));
|
10649 | (true && !(!TEMPLATES.has(obj)) && (0, _debug.assert)(`Cannot call \`setComponentTemplate\` multiple times on the same class (\`${obj}\`)`, !TEMPLATES.has(obj)));
|
10650 | TEMPLATES.set(obj, factory);
|
10651 | return obj;
|
10652 | }
|
10653 |
|
10654 | function getComponentTemplate(obj) {
|
10655 | var pointer = obj;
|
10656 |
|
10657 | while (pointer !== undefined && pointer !== null) {
|
10658 | var _template = TEMPLATES.get(pointer);
|
10659 |
|
10660 | if (_template !== undefined) {
|
10661 | return _template;
|
10662 | }
|
10663 |
|
10664 | pointer = getPrototypeOf(pointer);
|
10665 | }
|
10666 |
|
10667 | return null;
|
10668 | }
|
10669 |
|
10670 | var MANAGERS = new WeakMap();
|
10671 | var getPrototypeOf$1 = Object.getPrototypeOf;
|
10672 |
|
10673 | function setManager(wrapper, obj) {
|
10674 | MANAGERS.set(obj, wrapper);
|
10675 | return obj;
|
10676 | }
|
10677 |
|
10678 | function getManager(obj) {
|
10679 | var pointer = obj;
|
10680 |
|
10681 | while (pointer !== undefined && pointer !== null) {
|
10682 | var manager = MANAGERS.get(pointer);
|
10683 |
|
10684 | if (manager !== undefined) {
|
10685 | return manager;
|
10686 | }
|
10687 |
|
10688 | pointer = getPrototypeOf$1(pointer);
|
10689 | }
|
10690 |
|
10691 | return null;
|
10692 | }
|
10693 |
|
10694 | function setModifierManager(factory, obj) {
|
10695 | return setManager({
|
10696 | factory,
|
10697 | internal: false,
|
10698 | type: 'modifier'
|
10699 | }, obj);
|
10700 | }
|
10701 |
|
10702 | function getModifierManager(obj) {
|
10703 | var wrapper = getManager(obj);
|
10704 |
|
10705 | if (wrapper && !wrapper.internal && wrapper.type === 'modifier') {
|
10706 | return wrapper.factory;
|
10707 | } else {
|
10708 | return undefined;
|
10709 | }
|
10710 | }
|
10711 |
|
10712 | function instrumentationPayload$1(name) {
|
10713 | return {
|
10714 | object: `component:${name}`
|
10715 | };
|
10716 | }
|
10717 |
|
10718 | function makeOptions(moduleName, namespace) {
|
10719 | return {
|
10720 | source: moduleName !== undefined ? `template:${moduleName}` : undefined,
|
10721 | namespace
|
10722 | };
|
10723 | }
|
10724 |
|
10725 | function componentFor(name, owner, options) {
|
10726 | var fullName = `component:${name}`;
|
10727 | return owner.factoryFor(fullName, options) || null;
|
10728 | }
|
10729 |
|
10730 | function layoutFor(name, owner, options) {
|
10731 | var templateFullName = `template:components/${name}`;
|
10732 | return owner.lookup(templateFullName, options) || null;
|
10733 | }
|
10734 |
|
10735 | function lookupComponentPair(owner, name, options) {
|
10736 | var component = componentFor(name, owner, options);
|
10737 | {
|
10738 | if (component !== null && component.class !== undefined) {
|
10739 | var _layout = getComponentTemplate(component.class);
|
10740 |
|
10741 | if (_layout !== null) {
|
10742 | return {
|
10743 | component,
|
10744 | layout: _layout
|
10745 | };
|
10746 | }
|
10747 | }
|
10748 | }
|
10749 | var layout = layoutFor(name, owner, options);
|
10750 |
|
10751 | if (component === null && layout === null) {
|
10752 | return null;
|
10753 | } else {
|
10754 | return {
|
10755 | component,
|
10756 | layout
|
10757 | };
|
10758 | }
|
10759 | }
|
10760 |
|
10761 | function lookupComponent(owner, name, options) {
|
10762 | if (options.source || options.namespace) {
|
10763 | var pair = lookupComponentPair(owner, name, options);
|
10764 |
|
10765 | if (pair !== null) {
|
10766 | return pair;
|
10767 | }
|
10768 | }
|
10769 |
|
10770 | return lookupComponentPair(owner, name);
|
10771 | }
|
10772 |
|
10773 | var lookupPartial;
|
10774 | var templateFor;
|
10775 | var parseUnderscoredName;
|
10776 |
|
10777 | if (_deprecatedFeatures.PARTIALS) {
|
10778 | lookupPartial = function (templateName, owner) {
|
10779 | (true && !(false) && (0, _debug.deprecate)(`The use of \`{{partial}}\` is deprecated, please refactor the "${templateName}" partial to a component`, false, {
|
10780 | id: 'ember-views.partial',
|
10781 | until: '4.0.0',
|
10782 | url: 'https://deprecations.emberjs.com/v3.x#toc_ember-views-partial'
|
10783 | }));
|
10784 |
|
10785 | if (templateName === null) {
|
10786 | return;
|
10787 | }
|
10788 |
|
10789 | var template = templateFor(owner, parseUnderscoredName(templateName), templateName);
|
10790 | (true && !(Boolean(template)) && (0, _debug.assert)(`Unable to find partial with name "${templateName}"`, Boolean(template)));
|
10791 | return template;
|
10792 | };
|
10793 |
|
10794 | templateFor = function (owner, underscored, name) {
|
10795 | if (_deprecatedFeatures.PARTIALS) {
|
10796 | if (!name) {
|
10797 | return;
|
10798 | }
|
10799 |
|
10800 | (true && !(name.indexOf('.') === -1) && (0, _debug.assert)(`templateNames are not allowed to contain periods: ${name}`, name.indexOf('.') === -1));
|
10801 |
|
10802 | if (!owner) {
|
10803 | throw new _error.default('Container was not found when looking up a views template. ' + 'This is most likely due to manually instantiating an Ember.View. ' + 'See: http://git.io/EKPpnA');
|
10804 | }
|
10805 |
|
10806 | return owner.lookup(`template:${underscored}`) || owner.lookup(`template:${name}`);
|
10807 | }
|
10808 | };
|
10809 |
|
10810 | parseUnderscoredName = function (templateName) {
|
10811 | var nameParts = templateName.split('/');
|
10812 | var lastPart = nameParts[nameParts.length - 1];
|
10813 | nameParts[nameParts.length - 1] = `_${lastPart}`;
|
10814 | return nameParts.join('/');
|
10815 | };
|
10816 | }
|
10817 |
|
10818 | var BUILTINS_HELPERS = {
|
10819 | if: inlineIf,
|
10820 | action,
|
10821 | array,
|
10822 | concat: concat$1,
|
10823 | fn: fn$1,
|
10824 | get: get$1,
|
10825 | hash,
|
10826 | log: log$1,
|
10827 | mut,
|
10828 | 'query-params': queryParams$1,
|
10829 | readonly,
|
10830 | unbound,
|
10831 | unless: inlineUnless,
|
10832 | '-hash': hash,
|
10833 | '-each-in': eachIn,
|
10834 | '-normalize-class': normalizeClassHelper,
|
10835 | '-track-array': trackArray,
|
10836 | '-get-dynamic-var': _runtime2.getDynamicVar,
|
10837 | '-mount': mountHelper,
|
10838 | '-outlet': outletHelper,
|
10839 | '-assert-implicit-component-helper-argument': componentAssertionHelper,
|
10840 | '-in-el-null': inElementNullCheckHelper
|
10841 | };
|
10842 |
|
10843 | class RuntimeResolver {
|
10844 | constructor(owner, isInteractive) {
|
10845 | this.handles = [undefined];
|
10846 | this.objToHandle = new WeakMap();
|
10847 | this.builtInHelpers = BUILTINS_HELPERS;
|
10848 | this.componentDefinitionCache = new Map();
|
10849 | this.componentDefinitionCount = 0;
|
10850 | this.helperDefinitionCount = 0;
|
10851 | this.isInteractive = isInteractive;
|
10852 | this.builtInModifiers = {
|
10853 | action: {
|
10854 | manager: new ActionModifierManager(),
|
10855 | state: null
|
10856 | },
|
10857 | on: {
|
10858 | manager: new OnModifierManager(owner, isInteractive),
|
10859 | state: null
|
10860 | }
|
10861 | };
|
10862 | }
|
10863 |
|
10864 |
|
10865 | |
10866 |
|
10867 |
|
10868 |
|
10869 |
|
10870 |
|
10871 | lookupComponent(name, meta) {
|
10872 | var handle = this.lookupComponentHandle(name, meta);
|
10873 |
|
10874 | if (handle === null) {
|
10875 | (true && !(false) && (0, _debug.assert)(`Could not find component named "${name}" (no component or template with that name was found)`));
|
10876 | return null;
|
10877 | }
|
10878 |
|
10879 | return this.resolve(handle);
|
10880 | }
|
10881 |
|
10882 | lookupComponentHandle(name, meta) {
|
10883 | var nextHandle = this.handles.length;
|
10884 | var handle = this.handle(this._lookupComponentDefinition(name, meta));
|
10885 | (true && !(!(name === 'text-area' && handle === null)) && (0, _debug.assert)('Could not find component `<TextArea />` (did you mean `<Textarea />`?)', !(name === 'text-area' && handle === null)));
|
10886 |
|
10887 | if (nextHandle === handle) {
|
10888 | this.componentDefinitionCount++;
|
10889 | }
|
10890 |
|
10891 | return handle;
|
10892 | }
|
10893 | |
10894 |
|
10895 |
|
10896 |
|
10897 |
|
10898 | resolve(handle) {
|
10899 | return this.handles[handle];
|
10900 | }
|
10901 |
|
10902 | |
10903 |
|
10904 |
|
10905 |
|
10906 |
|
10907 | lookupHelper(name, meta) {
|
10908 | var nextHandle = this.handles.length;
|
10909 |
|
10910 | var helper$$1 = this._lookupHelper(name, meta);
|
10911 |
|
10912 | if (helper$$1 !== null) {
|
10913 | var handle = this.handle(helper$$1);
|
10914 |
|
10915 | if (nextHandle === handle) {
|
10916 | this.helperDefinitionCount++;
|
10917 | }
|
10918 |
|
10919 | return handle;
|
10920 | }
|
10921 |
|
10922 | return null;
|
10923 | }
|
10924 | |
10925 |
|
10926 |
|
10927 |
|
10928 |
|
10929 | lookupModifier(name, meta) {
|
10930 | return this.handle(this._lookupModifier(name, meta));
|
10931 | }
|
10932 | |
10933 |
|
10934 |
|
10935 |
|
10936 |
|
10937 | lookupPartial(name, meta) {
|
10938 | if (_deprecatedFeatures.PARTIALS) {
|
10939 | var partial = this._lookupPartial(name, meta);
|
10940 |
|
10941 | return this.handle(partial);
|
10942 | } else {
|
10943 | return null;
|
10944 | }
|
10945 | }
|
10946 |
|
10947 |
|
10948 |
|
10949 | compilable() {}
|
10950 |
|
10951 |
|
10952 |
|
10953 | handle(obj) {
|
10954 | if (obj === undefined || obj === null) {
|
10955 | return null;
|
10956 | }
|
10957 |
|
10958 | var handle = this.objToHandle.get(obj);
|
10959 |
|
10960 | if (handle === undefined) {
|
10961 | handle = this.handles.push(obj) - 1;
|
10962 | this.objToHandle.set(obj, handle);
|
10963 | }
|
10964 |
|
10965 | return handle;
|
10966 | }
|
10967 |
|
10968 | _lookupHelper(_name, meta) {
|
10969 | (true && !(!(this.builtInHelpers[_name] && meta.owner.hasRegistration(`helper:${_name}`))) && (0, _debug.assert)(`You attempted to overwrite the built-in helper "${_name}" which is not allowed. Please rename the helper.`, !(this.builtInHelpers[_name] && meta.owner.hasRegistration(`helper:${_name}`))));
|
10970 | var helper$$1 = this.builtInHelpers[_name];
|
10971 |
|
10972 | if (helper$$1 !== undefined) {
|
10973 | return helper$$1;
|
10974 | }
|
10975 |
|
10976 | var {
|
10977 | moduleName
|
10978 | } = meta;
|
10979 | var owner = meta.owner;
|
10980 | var name = _name;
|
10981 | var namespace = undefined;
|
10982 | var options = makeOptions(moduleName, namespace);
|
10983 | var factory = owner.factoryFor(`helper:${name}`, options) || owner.factoryFor(`helper:${name}`);
|
10984 |
|
10985 | if (!isHelperFactory(factory)) {
|
10986 | return null;
|
10987 | }
|
10988 |
|
10989 | return (args, vm) => {
|
10990 | var helper$$1 = factory.create();
|
10991 |
|
10992 | if (isClassHelper(helper$$1)) {
|
10993 | var helperDestroyable = {};
|
10994 |
|
10995 | (0, _runtime2.registerDestructor)(helperDestroyable, () => helper$$1.destroy(), true);
|
10996 | vm.associateDestroyable(helperDestroyable);
|
10997 | } else if (true
|
10998 |
|
10999 | ) {
|
11000 |
|
11001 |
|
11002 |
|
11003 |
|
11004 |
|
11005 | helper$$1.compute = helper$$1.compute.bind(null);
|
11006 | }
|
11007 |
|
11008 | return new EmberHelperRootReference(helper$$1, args.capture(), vm.env);
|
11009 | };
|
11010 | }
|
11011 |
|
11012 | _lookupPartial(name, meta) {
|
11013 | var owner = meta.owner;
|
11014 | var templateFactory$$1 = lookupPartial(name, owner);
|
11015 | var template = templateFactory$$1(owner);
|
11016 | return new _opcodeCompiler.PartialDefinitionImpl(name, template);
|
11017 | }
|
11018 |
|
11019 | _lookupModifier(name, meta) {
|
11020 | var builtin = this.builtInModifiers[name];
|
11021 |
|
11022 | if (builtin === undefined) {
|
11023 | var owner = meta.owner;
|
11024 | var modifier = owner.factoryFor(`modifier:${name}`);
|
11025 |
|
11026 | if (modifier !== undefined) {
|
11027 | var managerFactory = getModifierManager(modifier.class);
|
11028 | var manager = managerFactory(owner);
|
11029 | return new CustomModifierDefinition(name, modifier, manager, this.isInteractive);
|
11030 | }
|
11031 | }
|
11032 |
|
11033 | return builtin;
|
11034 | }
|
11035 |
|
11036 | _parseNameForNamespace(_name) {
|
11037 | var name = _name;
|
11038 | var namespace = undefined;
|
11039 |
|
11040 | var namespaceDelimiterOffset = _name.indexOf('::');
|
11041 |
|
11042 | if (namespaceDelimiterOffset !== -1) {
|
11043 | name = _name.slice(namespaceDelimiterOffset + 2);
|
11044 | namespace = _name.slice(0, namespaceDelimiterOffset);
|
11045 | }
|
11046 |
|
11047 | return {
|
11048 | name,
|
11049 | namespace
|
11050 | };
|
11051 | }
|
11052 |
|
11053 | _lookupComponentDefinition(_name, meta) {
|
11054 | var name = _name;
|
11055 | var namespace = undefined;
|
11056 | var owner = meta.owner;
|
11057 | var {
|
11058 | moduleName
|
11059 | } = meta;
|
11060 | var pair = lookupComponent(owner, name, makeOptions(moduleName, namespace));
|
11061 |
|
11062 | if (pair === null) {
|
11063 | return null;
|
11064 | }
|
11065 |
|
11066 | var layout;
|
11067 | var key;
|
11068 |
|
11069 | if (pair.component === null) {
|
11070 | key = layout = pair.layout(owner);
|
11071 | } else {
|
11072 | key = pair.component;
|
11073 | }
|
11074 |
|
11075 | var cachedComponentDefinition = this.componentDefinitionCache.get(key);
|
11076 |
|
11077 | if (cachedComponentDefinition !== undefined) {
|
11078 | return cachedComponentDefinition;
|
11079 | }
|
11080 |
|
11081 | if (layout === undefined && pair.layout !== null) {
|
11082 | layout = pair.layout(owner);
|
11083 | }
|
11084 |
|
11085 | var finalizer = (0, _instrumentation._instrumentStart)('render.getComponentDefinition', instrumentationPayload$1, name);
|
11086 | var definition = null;
|
11087 |
|
11088 | if (pair.component === null) {
|
11089 | if (_environment2.ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS) {
|
11090 | definition = new TemplateOnlyComponentDefinition(name, layout);
|
11091 | }
|
11092 | } else if (true
|
11093 |
|
11094 | && (0, _templateOnly.isTemplateOnlyComponent)(pair.component.class)) {
|
11095 | definition = new TemplateOnlyComponentDefinition(name, layout);
|
11096 | }
|
11097 |
|
11098 | if (pair.component !== null) {
|
11099 | (true && !(pair.component.class !== undefined) && (0, _debug.assert)(`missing component class ${name}`, pair.component.class !== undefined));
|
11100 | var ComponentClass = pair.component.class;
|
11101 | var wrapper = getManager(ComponentClass);
|
11102 |
|
11103 | if (wrapper !== null && wrapper.type === 'component') {
|
11104 | var {
|
11105 | factory
|
11106 | } = wrapper;
|
11107 |
|
11108 | if (wrapper.internal) {
|
11109 | (true && !(pair.layout !== null) && (0, _debug.assert)(`missing layout for internal component ${name}`, pair.layout !== null));
|
11110 | definition = new InternalComponentDefinition(factory(owner), ComponentClass, layout);
|
11111 | } else {
|
11112 | definition = new CustomManagerDefinition(name, pair.component, factory(owner), layout !== undefined ? layout : owner.lookup((0, _container.privatize)`template:components/-default`)(owner));
|
11113 | }
|
11114 | }
|
11115 | }
|
11116 |
|
11117 | if (definition === null) {
|
11118 | definition = new CurlyComponentDefinition(name, pair.component || owner.factoryFor((0, _container.privatize)`component:-default`), layout);
|
11119 | }
|
11120 |
|
11121 | finalizer();
|
11122 | this.componentDefinitionCache.set(key, definition);
|
11123 | return definition;
|
11124 | }
|
11125 |
|
11126 | }
|
11127 |
|
11128 | function hashToArgs(hash) {
|
11129 | if (hash === null) return null;
|
11130 | var names = hash[0].map(key => `@${key}`);
|
11131 | return [names, hash[1]];
|
11132 | }
|
11133 |
|
11134 | var experimentalMacros = [];
|
11135 |
|
11136 |
|
11137 |
|
11138 | _exports._experimentalMacros = experimentalMacros;
|
11139 |
|
11140 | function registerMacros(macro) {
|
11141 | experimentalMacros.push(macro);
|
11142 | }
|
11143 |
|
11144 | function refineInlineSyntax(name, params, hash, context) {
|
11145 | var component = context.resolver.lookupComponent(name, context.meta.referrer);
|
11146 |
|
11147 | if (component !== null) {
|
11148 | return (0, _opcodeCompiler.staticComponent)(component, [params === null ? [] : params, hashToArgs(hash), _opcodeCompiler.EMPTY_BLOCKS]);
|
11149 | }
|
11150 |
|
11151 | return _opcodeCompiler.UNHANDLED;
|
11152 | }
|
11153 |
|
11154 | function refineBlockSyntax(name, params, hash, blocks, context) {
|
11155 | var handle = context.resolver.lookupComponent(name, context.meta.referrer);
|
11156 |
|
11157 | if (handle !== null) {
|
11158 | return (0, _opcodeCompiler.staticComponent)(handle, [params, hashToArgs(hash), blocks]);
|
11159 | }
|
11160 |
|
11161 | (true && !(context.meta.referrer.owner.hasRegistration(`helper:${name}`)) && (0, _debug.assert)(`A component or helper named "${name}" could not be found`, context.meta.referrer.owner.hasRegistration(`helper:${name}`)));
|
11162 | (true && !(!(() => {
|
11163 | var resolver = context.resolver['inner']['resolver'];
|
11164 | var {
|
11165 | moduleName,
|
11166 | owner
|
11167 | } = context.meta.referrer;
|
11168 |
|
11169 | if (name === 'component' || resolver['builtInHelpers'][name]) {
|
11170 | return true;
|
11171 | }
|
11172 |
|
11173 | var options = {
|
11174 | source: `template:${moduleName}`
|
11175 | };
|
11176 | return owner.hasRegistration(`helper:${name}`, options) || owner.hasRegistration(`helper:${name}`);
|
11177 | })()) && (0, _debug.assert)(`Helpers may not be used in the block form, for example {{#${name}}}{{/${name}}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (${name})}}{{/if}}.`, !(() => {
|
11178 | var resolver = context.resolver['inner']['resolver'];
|
11179 | var {
|
11180 | moduleName,
|
11181 | owner
|
11182 | } = context.meta.referrer;
|
11183 |
|
11184 | if (name === 'component' || resolver['builtInHelpers'][name]) {
|
11185 | return true;
|
11186 | }
|
11187 |
|
11188 | var options = {
|
11189 | source: `template:${moduleName}`
|
11190 | };
|
11191 | return owner.hasRegistration(`helper:${name}`, options) || owner.hasRegistration(`helper:${name}`);
|
11192 | })()));
|
11193 | return _opcodeCompiler.NONE;
|
11194 | }
|
11195 |
|
11196 | function populateMacros(macros) {
|
11197 | var {
|
11198 | inlines,
|
11199 | blocks
|
11200 | } = macros;
|
11201 | inlines.addMissing(refineInlineSyntax);
|
11202 | blocks.addMissing(refineBlockSyntax);
|
11203 |
|
11204 | for (var i = 0; i < experimentalMacros.length; i++) {
|
11205 | var macro = experimentalMacros[i];
|
11206 | macro(blocks, inlines);
|
11207 | }
|
11208 |
|
11209 | return {
|
11210 | blocks,
|
11211 | inlines
|
11212 | };
|
11213 | }
|
11214 |
|
11215 | class DynamicScope {
|
11216 | constructor(view, outletState) {
|
11217 | this.view = view;
|
11218 | this.outletState = outletState;
|
11219 | }
|
11220 |
|
11221 | child() {
|
11222 | return new DynamicScope(this.view, this.outletState);
|
11223 | }
|
11224 |
|
11225 | get(key) {
|
11226 |
|
11227 | (true && !(key === 'outletState') && (0, _debug.assert)(`Using \`-get-dynamic-scope\` is only supported for \`outletState\` (you used \`${key}\`).`, key === 'outletState'));
|
11228 | return this.outletState;
|
11229 | }
|
11230 |
|
11231 | set(key, value) {
|
11232 |
|
11233 | (true && !(key === 'outletState') && (0, _debug.assert)(`Using \`-with-dynamic-scope\` is only supported for \`outletState\` (you used \`${key}\`).`, key === 'outletState'));
|
11234 | this.outletState = value;
|
11235 | return value;
|
11236 | }
|
11237 |
|
11238 | }
|
11239 |
|
11240 | class RootState {
|
11241 | constructor(root, runtime, context, template, self, parentElement, dynamicScope, builder) {
|
11242 | this.root = root;
|
11243 | this.runtime = runtime;
|
11244 | (true && !(template !== undefined) && (0, _debug.assert)(`You cannot render \`${self.value()}\` without a template.`, template !== undefined));
|
11245 | this.id = (0, _views.getViewId)(root);
|
11246 | this.result = undefined;
|
11247 | this.destroyed = false;
|
11248 |
|
11249 | this.render = () => {
|
11250 | var layout = (0, _util.unwrapTemplate)(template).asLayout();
|
11251 | var handle = layout.compile(context);
|
11252 | var iterator = (0, _runtime2.renderJitMain)(runtime, context, self, builder(runtime.env, {
|
11253 | element: parentElement,
|
11254 | nextSibling: null
|
11255 | }), (0, _util.unwrapHandle)(handle), dynamicScope);
|
11256 | var iteratorResult;
|
11257 |
|
11258 | do {
|
11259 | iteratorResult = iterator.next();
|
11260 | } while (!iteratorResult.done);
|
11261 |
|
11262 | var result = this.result = iteratorResult.value;
|
11263 |
|
11264 | this.render = () => result.rerender({
|
11265 | alwaysRevalidate: false
|
11266 | });
|
11267 | };
|
11268 | }
|
11269 |
|
11270 | isFor(possibleRoot) {
|
11271 | return this.root === possibleRoot;
|
11272 | }
|
11273 |
|
11274 | destroy() {
|
11275 | var {
|
11276 | result,
|
11277 | runtime: {
|
11278 | env
|
11279 | }
|
11280 | } = this;
|
11281 | this.destroyed = true;
|
11282 | this.runtime = undefined;
|
11283 | this.root = null;
|
11284 | this.result = undefined;
|
11285 | this.render = undefined;
|
11286 |
|
11287 | if (result !== undefined) {
|
11288 | |
11289 |
|
11290 |
|
11291 |
|
11292 |
|
11293 |
|
11294 |
|
11295 |
|
11296 | (0, _runtime2.inTransaction)(env, () => (0, _runtime2.destroy)(result));
|
11297 | }
|
11298 | }
|
11299 |
|
11300 | }
|
11301 |
|
11302 | var renderers = [];
|
11303 |
|
11304 | function _resetRenderers() {
|
11305 | renderers.length = 0;
|
11306 | }
|
11307 |
|
11308 | function register(renderer) {
|
11309 | (true && !(renderers.indexOf(renderer) === -1) && (0, _debug.assert)('Cannot register the same renderer twice', renderers.indexOf(renderer) === -1));
|
11310 | renderers.push(renderer);
|
11311 | }
|
11312 |
|
11313 | function deregister(renderer) {
|
11314 | var index = renderers.indexOf(renderer);
|
11315 | (true && !(index !== -1) && (0, _debug.assert)('Cannot deregister unknown unregistered renderer', index !== -1));
|
11316 | renderers.splice(index, 1);
|
11317 | }
|
11318 |
|
11319 | function loopBegin() {
|
11320 | for (var i = 0; i < renderers.length; i++) {
|
11321 | renderers[i]._scheduleRevalidate();
|
11322 | }
|
11323 | }
|
11324 |
|
11325 | function K() {
|
11326 |
|
11327 | }
|
11328 |
|
11329 | var renderSettledDeferred = null;
|
11330 | |
11331 |
|
11332 |
|
11333 |
|
11334 |
|
11335 |
|
11336 |
|
11337 |
|
11338 |
|
11339 |
|
11340 | function renderSettled() {
|
11341 | if (renderSettledDeferred === null) {
|
11342 | renderSettledDeferred = _rsvp.default.defer();
|
11343 |
|
11344 |
|
11345 | if (!(0, _runloop.getCurrentRunLoop)()) {
|
11346 |
|
11347 | _runloop.backburner.schedule('actions', null, K);
|
11348 | }
|
11349 | }
|
11350 |
|
11351 | return renderSettledDeferred.promise;
|
11352 | }
|
11353 |
|
11354 | function resolveRenderPromise() {
|
11355 | if (renderSettledDeferred !== null) {
|
11356 | var resolve = renderSettledDeferred.resolve;
|
11357 | renderSettledDeferred = null;
|
11358 |
|
11359 | _runloop.backburner.join(null, resolve);
|
11360 | }
|
11361 | }
|
11362 |
|
11363 | var loops = 0;
|
11364 |
|
11365 | function loopEnd() {
|
11366 | for (var i = 0; i < renderers.length; i++) {
|
11367 | if (!renderers[i]._isValid()) {
|
11368 | if (loops > _environment2.ENV._RERENDER_LOOP_LIMIT) {
|
11369 | loops = 0;
|
11370 |
|
11371 | renderers[i].destroy();
|
11372 | throw new Error('infinite rendering invalidation detected');
|
11373 | }
|
11374 |
|
11375 | loops++;
|
11376 | return _runloop.backburner.join(null, K);
|
11377 | }
|
11378 | }
|
11379 |
|
11380 | loops = 0;
|
11381 | resolveRenderPromise();
|
11382 | }
|
11383 |
|
11384 | _runloop.backburner.on('begin', loopBegin);
|
11385 |
|
11386 | _runloop.backburner.on('end', loopEnd);
|
11387 |
|
11388 | class Renderer {
|
11389 | constructor(owner, document, env, rootTemplate, viewRegistry, destinedForDOM = false, builder = _runtime2.clientBuilder) {
|
11390 | this._inRenderTransaction = false;
|
11391 | this._lastRevision = -1;
|
11392 | this._destroyed = false;
|
11393 | this._rootTemplate = rootTemplate(owner);
|
11394 | this._viewRegistry = viewRegistry;
|
11395 | this._destinedForDOM = destinedForDOM;
|
11396 | this._roots = [];
|
11397 | this._removedRoots = [];
|
11398 | this._builder = builder;
|
11399 |
|
11400 | var runtimeResolver = this._runtimeResolver = new RuntimeResolver(owner, env.isInteractive);
|
11401 | var compileTimeResolver = new CompileTimeResolver(runtimeResolver);
|
11402 | var context = this._context = (0, _opcodeCompiler.JitContext)(compileTimeResolver);
|
11403 | populateMacros(context.macros);
|
11404 | var runtimeEnvironmentDelegate = new EmberEnvironmentDelegate(owner, env.isInteractive);
|
11405 | this._runtime = (0, _runtime2.JitRuntime)({
|
11406 | appendOperations: env.hasDOM ? new _runtime2.DOMTreeConstruction(document) : new _node.NodeDOMTreeConstruction(document),
|
11407 | updateOperations: new _runtime2.DOMChanges(document)
|
11408 | }, runtimeEnvironmentDelegate, context, runtimeResolver);
|
11409 | }
|
11410 |
|
11411 | get debugRenderTree() {
|
11412 | return this._runtime.env.extra.debugRenderTree;
|
11413 | }
|
11414 |
|
11415 |
|
11416 | appendOutletView(view, target) {
|
11417 | var definition = createRootOutlet(view);
|
11418 |
|
11419 | this._appendDefinition(view, (0, _runtime2.curry)(definition), target);
|
11420 | }
|
11421 |
|
11422 | appendTo(view, target) {
|
11423 | var definition = new RootComponentDefinition(view);
|
11424 |
|
11425 | this._appendDefinition(view, (0, _runtime2.curry)(definition), target);
|
11426 | }
|
11427 |
|
11428 | _appendDefinition(root, definition, target) {
|
11429 | var self = new UnboundRootReference(definition, this._runtime.env);
|
11430 | var dynamicScope = new DynamicScope(null, _runtime2.UNDEFINED_REFERENCE);
|
11431 | var rootState = new RootState(root, this._runtime, this._context, this._rootTemplate, self, target, dynamicScope, this._builder);
|
11432 |
|
11433 | this._renderRoot(rootState);
|
11434 | }
|
11435 |
|
11436 | rerender() {
|
11437 | this._scheduleRevalidate();
|
11438 | }
|
11439 |
|
11440 | register(view) {
|
11441 | var id = (0, _views.getViewId)(view);
|
11442 | (true && !(!this._viewRegistry[id]) && (0, _debug.assert)('Attempted to register a view with an id already in use: ' + id, !this._viewRegistry[id]));
|
11443 | this._viewRegistry[id] = view;
|
11444 | }
|
11445 |
|
11446 | unregister(view) {
|
11447 | delete this._viewRegistry[(0, _views.getViewId)(view)];
|
11448 | }
|
11449 |
|
11450 | remove(view) {
|
11451 | view._transitionTo('destroying');
|
11452 |
|
11453 | this.cleanupRootFor(view);
|
11454 |
|
11455 | if (this._destinedForDOM) {
|
11456 | view.trigger('didDestroyElement');
|
11457 | }
|
11458 | }
|
11459 |
|
11460 | cleanupRootFor(view) {
|
11461 |
|
11462 | if (this._destroyed) {
|
11463 | return;
|
11464 | }
|
11465 |
|
11466 | var roots = this._roots;
|
11467 |
|
11468 |
|
11469 | var i = this._roots.length;
|
11470 |
|
11471 | while (i--) {
|
11472 | var root = roots[i];
|
11473 |
|
11474 | if (root.isFor(view)) {
|
11475 | root.destroy();
|
11476 | roots.splice(i, 1);
|
11477 | }
|
11478 | }
|
11479 | }
|
11480 |
|
11481 | destroy() {
|
11482 | if (this._destroyed) {
|
11483 | return;
|
11484 | }
|
11485 |
|
11486 | this._destroyed = true;
|
11487 |
|
11488 | this._clearAllRoots();
|
11489 | }
|
11490 |
|
11491 | getBounds(view) {
|
11492 | var bounds = view[BOUNDS];
|
11493 | (true && !(Boolean(bounds)) && (0, _debug.assert)('object passed to getBounds must have the BOUNDS symbol as a property', Boolean(bounds)));
|
11494 | var parentElement = bounds.parentElement();
|
11495 | var firstNode = bounds.firstNode();
|
11496 | var lastNode = bounds.lastNode();
|
11497 | return {
|
11498 | parentElement,
|
11499 | firstNode,
|
11500 | lastNode
|
11501 | };
|
11502 | }
|
11503 |
|
11504 | createElement(tagName) {
|
11505 | return this._runtime.env.getAppendOperations().createElement(tagName);
|
11506 | }
|
11507 |
|
11508 | _renderRoot(root) {
|
11509 | var {
|
11510 | _roots: roots
|
11511 | } = this;
|
11512 | roots.push(root);
|
11513 |
|
11514 | if (roots.length === 1) {
|
11515 | register(this);
|
11516 | }
|
11517 |
|
11518 | this._renderRootsTransaction();
|
11519 | }
|
11520 |
|
11521 | _renderRoots() {
|
11522 | var {
|
11523 | _roots: roots,
|
11524 | _runtime: runtime,
|
11525 | _removedRoots: removedRoots
|
11526 | } = this;
|
11527 | var initialRootsLength;
|
11528 |
|
11529 | do {
|
11530 | initialRootsLength = roots.length;
|
11531 | (0, _runtime2.inTransaction)(runtime.env, () => {
|
11532 |
|
11533 |
|
11534 | for (var i = 0; i < roots.length; i++) {
|
11535 | var root = roots[i];
|
11536 |
|
11537 | if (root.destroyed) {
|
11538 |
|
11539 |
|
11540 | removedRoots.push(root);
|
11541 |
|
11542 | continue;
|
11543 | }
|
11544 |
|
11545 |
|
11546 |
|
11547 | if (i >= initialRootsLength) {
|
11548 | continue;
|
11549 | }
|
11550 |
|
11551 | if (true
|
11552 |
|
11553 | ) {
|
11554 |
|
11555 |
|
11556 |
|
11557 | (0, _validator.runInAutotrackingTransaction)(root.render.bind(root));
|
11558 | } else {
|
11559 | root.render();
|
11560 | }
|
11561 | }
|
11562 |
|
11563 | this._lastRevision = (0, _validator.valueForTag)(_validator.CURRENT_TAG);
|
11564 | });
|
11565 | } while (roots.length > initialRootsLength);
|
11566 |
|
11567 |
|
11568 | while (removedRoots.length) {
|
11569 | var root = removedRoots.pop();
|
11570 | var rootIndex = roots.indexOf(root);
|
11571 | roots.splice(rootIndex, 1);
|
11572 | }
|
11573 |
|
11574 | if (this._roots.length === 0) {
|
11575 | deregister(this);
|
11576 | }
|
11577 | }
|
11578 |
|
11579 | _renderRootsTransaction() {
|
11580 | if (this._inRenderTransaction) {
|
11581 |
|
11582 |
|
11583 | return;
|
11584 | }
|
11585 |
|
11586 |
|
11587 |
|
11588 | this._inRenderTransaction = true;
|
11589 | var completedWithoutError = false;
|
11590 |
|
11591 | try {
|
11592 | this._renderRoots();
|
11593 |
|
11594 | completedWithoutError = true;
|
11595 | } finally {
|
11596 | if (!completedWithoutError) {
|
11597 | this._lastRevision = (0, _validator.valueForTag)(_validator.CURRENT_TAG);
|
11598 | }
|
11599 |
|
11600 | this._inRenderTransaction = false;
|
11601 | }
|
11602 | }
|
11603 |
|
11604 | _clearAllRoots() {
|
11605 | var roots = this._roots;
|
11606 |
|
11607 | for (var i = 0; i < roots.length; i++) {
|
11608 | var root = roots[i];
|
11609 | root.destroy();
|
11610 | }
|
11611 |
|
11612 | this._removedRoots.length = 0;
|
11613 | this._roots = [];
|
11614 |
|
11615 |
|
11616 | if (roots.length) {
|
11617 | deregister(this);
|
11618 | }
|
11619 | }
|
11620 |
|
11621 | _scheduleRevalidate() {
|
11622 | _runloop.backburner.scheduleOnce('render', this, this._revalidate);
|
11623 | }
|
11624 |
|
11625 | _isValid() {
|
11626 | return this._destroyed || this._roots.length === 0 || (0, _validator.validateTag)(_validator.CURRENT_TAG, this._lastRevision);
|
11627 | }
|
11628 |
|
11629 | _revalidate() {
|
11630 | if (this._isValid()) {
|
11631 | return;
|
11632 | }
|
11633 |
|
11634 | this._renderRootsTransaction();
|
11635 | }
|
11636 |
|
11637 | }
|
11638 |
|
11639 | _exports.Renderer = Renderer;
|
11640 |
|
11641 | class InertRenderer extends Renderer {
|
11642 | static create(props) {
|
11643 | var {
|
11644 | document,
|
11645 | env,
|
11646 | rootTemplate,
|
11647 | _viewRegistry,
|
11648 | builder
|
11649 | } = props;
|
11650 | return new this((0, _owner.getOwner)(props), document, env, rootTemplate, _viewRegistry, false, builder);
|
11651 | }
|
11652 |
|
11653 | getElement(_view) {
|
11654 | throw new Error('Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).');
|
11655 | }
|
11656 |
|
11657 | }
|
11658 |
|
11659 | _exports.InertRenderer = InertRenderer;
|
11660 |
|
11661 | class InteractiveRenderer extends Renderer {
|
11662 | static create(props) {
|
11663 | var {
|
11664 | document,
|
11665 | env,
|
11666 | rootTemplate,
|
11667 | _viewRegistry,
|
11668 | builder
|
11669 | } = props;
|
11670 | return new this((0, _owner.getOwner)(props), document, env, rootTemplate, _viewRegistry, true, builder);
|
11671 | }
|
11672 |
|
11673 | getElement(view) {
|
11674 | return (0, _views.getViewElement)(view);
|
11675 | }
|
11676 |
|
11677 | }
|
11678 |
|
11679 | _exports.InteractiveRenderer = InteractiveRenderer;
|
11680 | var TEMPLATES$1 = {};
|
11681 |
|
11682 | function setTemplates(templates) {
|
11683 | TEMPLATES$1 = templates;
|
11684 | }
|
11685 |
|
11686 | function getTemplates() {
|
11687 | return TEMPLATES$1;
|
11688 | }
|
11689 |
|
11690 | function getTemplate(name) {
|
11691 | if (Object.prototype.hasOwnProperty.call(TEMPLATES$1, name)) {
|
11692 | return TEMPLATES$1[name];
|
11693 | }
|
11694 | }
|
11695 |
|
11696 | function hasTemplate(name) {
|
11697 | return Object.prototype.hasOwnProperty.call(TEMPLATES$1, name);
|
11698 | }
|
11699 |
|
11700 | function setTemplate(name, template) {
|
11701 | return TEMPLATES$1[name] = template;
|
11702 | }
|
11703 |
|
11704 | var CAPABILITIES$4 = {
|
11705 | dynamicLayout: false,
|
11706 | dynamicTag: false,
|
11707 | prepareArgs: true,
|
11708 | createArgs: true,
|
11709 | attributeHook: false,
|
11710 | elementHook: false,
|
11711 | createCaller: true,
|
11712 | dynamicScope: false,
|
11713 | updateHook: true,
|
11714 | createInstance: true,
|
11715 | wrapped: false,
|
11716 | willDestroy: false
|
11717 | };
|
11718 | var EMPTY_POSITIONAL_ARGS$1 = [];
|
11719 | (0, _debug.debugFreeze)(EMPTY_POSITIONAL_ARGS$1);
|
11720 |
|
11721 | class InputComponentManager extends InternalManager {
|
11722 | getCapabilities() {
|
11723 | return CAPABILITIES$4;
|
11724 | }
|
11725 |
|
11726 | prepareArgs(_state, args) {
|
11727 | (true && !(args.positional.length === 0) && (0, _debug.assert)('The `<Input />` component does not take any positional arguments', args.positional.length === 0));
|
11728 | var __ARGS__ = args.named.capture().map;
|
11729 | return {
|
11730 | positional: EMPTY_POSITIONAL_ARGS$1,
|
11731 | named: {
|
11732 | __ARGS__: new _reference.ConstReference(__ARGS__),
|
11733 | type: args.named.get('type')
|
11734 | }
|
11735 | };
|
11736 | }
|
11737 |
|
11738 | create(env, {
|
11739 | ComponentClass,
|
11740 | layout
|
11741 | }, args, _dynamicScope, caller) {
|
11742 | (true && !((0, _validator.isConstTagged)(caller)) && (0, _debug.assert)('caller must be const', (0, _validator.isConstTagged)(caller)));
|
11743 | var type = args.named.get('type');
|
11744 | var instance = ComponentClass.create({
|
11745 | caller: caller.value(),
|
11746 | type: type.value()
|
11747 | });
|
11748 | var state = {
|
11749 | env,
|
11750 | type,
|
11751 | instance
|
11752 | };
|
11753 |
|
11754 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
11755 | env.extra.debugRenderTree.create(state, {
|
11756 | type: 'component',
|
11757 | name: 'input',
|
11758 | args: args.capture(),
|
11759 | instance,
|
11760 | template: layout
|
11761 | });
|
11762 | (0, _runtime2.registerDestructor)(instance, () => env.extra.debugRenderTree.willDestroy(state));
|
11763 | }
|
11764 |
|
11765 | return state;
|
11766 | }
|
11767 |
|
11768 | getSelf({
|
11769 | env,
|
11770 | instance
|
11771 | }) {
|
11772 | return new _reference.ComponentRootReference(instance, env);
|
11773 | }
|
11774 |
|
11775 | getTag() {
|
11776 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
11777 |
|
11778 | return (0, _validator.createTag)();
|
11779 | } else {
|
11780 |
|
11781 | return _validator.CONSTANT_TAG;
|
11782 | }
|
11783 | }
|
11784 |
|
11785 | didRenderLayout(state, bounds) {
|
11786 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
11787 | state.env.extra.debugRenderTree.didRender(state, bounds);
|
11788 | }
|
11789 | }
|
11790 |
|
11791 | update(state) {
|
11792 | (0, _metal.set)(state.instance, 'type', state.type.value());
|
11793 |
|
11794 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
11795 | state.env.extra.debugRenderTree.update(state);
|
11796 | }
|
11797 | }
|
11798 |
|
11799 | didUpdateLayout(state, bounds) {
|
11800 | if (_environment2.ENV._DEBUG_RENDER_TREE) {
|
11801 | state.env.extra.debugRenderTree.didRender(state, bounds);
|
11802 | }
|
11803 | }
|
11804 |
|
11805 | getDestroyable(state) {
|
11806 | return state.instance;
|
11807 | }
|
11808 |
|
11809 | }
|
11810 |
|
11811 | var InputComponentManagerFactory = owner => {
|
11812 | return new InputComponentManager(owner);
|
11813 | };
|
11814 | |
11815 |
|
11816 |
|
11817 |
|
11818 | |
11819 |
|
11820 |
|
11821 |
|
11822 |
|
11823 |
|
11824 |
|
11825 |
|
11826 |
|
11827 | |
11828 |
|
11829 |
|
11830 |
|
11831 |
|
11832 |
|
11833 |
|
11834 |
|
11835 |
|
11836 |
|
11837 |
|
11838 |
|
11839 |
|
11840 |
|
11841 |
|
11842 |
|
11843 |
|
11844 |
|
11845 |
|
11846 |
|
11847 |
|
11848 |
|
11849 |
|
11850 |
|
11851 |
|
11852 |
|
11853 |
|
11854 |
|
11855 |
|
11856 |
|
11857 |
|
11858 |
|
11859 |
|
11860 |
|
11861 |
|
11862 |
|
11863 |
|
11864 |
|
11865 |
|
11866 |
|
11867 |
|
11868 |
|
11869 |
|
11870 |
|
11871 |
|
11872 |
|
11873 |
|
11874 |
|
11875 |
|
11876 |
|
11877 |
|
11878 |
|
11879 |
|
11880 |
|
11881 |
|
11882 |
|
11883 |
|
11884 |
|
11885 |
|
11886 |
|
11887 |
|
11888 |
|
11889 |
|
11890 |
|
11891 |
|
11892 |
|
11893 |
|
11894 |
|
11895 |
|
11896 |
|
11897 |
|
11898 |
|
11899 |
|
11900 |
|
11901 |
|
11902 |
|
11903 |
|
11904 |
|
11905 |
|
11906 |
|
11907 |
|
11908 |
|
11909 |
|
11910 |
|
11911 |
|
11912 |
|
11913 |
|
11914 |
|
11915 |
|
11916 |
|
11917 |
|
11918 |
|
11919 |
|
11920 |
|
11921 |
|
11922 |
|
11923 |
|
11924 |
|
11925 |
|
11926 | var Input = _runtime.Object.extend({
|
11927 | isCheckbox: (0, _metal.computed)('type', function () {
|
11928 | return this.type === 'checkbox';
|
11929 | })
|
11930 | });
|
11931 |
|
11932 | setManager({
|
11933 | factory: InputComponentManagerFactory,
|
11934 | internal: true,
|
11935 | type: 'component'
|
11936 | }, Input);
|
11937 |
|
11938 | Input.toString = () => '@ember/component/input';
|
11939 | |
11940 |
|
11941 |
|
11942 |
|
11943 | |
11944 |
|
11945 |
|
11946 |
|
11947 |
|
11948 |
|
11949 |
|
11950 |
|
11951 |
|
11952 |
|
11953 |
|
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 |
|
11959 |
|
11960 |
|
11961 |
|
11962 |
|
11963 |
|
11964 |
|
11965 |
|
11966 |
|
11967 |
|
11968 |
|
11969 |
|
11970 |
|
11971 |
|
11972 |
|
11973 |
|
11974 |
|
11975 |
|
11976 |
|
11977 | var loc$1 = helper(function (params) {
|
11978 | return _string.loc.apply(null, params
|
11979 |
|
11980 | );
|
11981 | });
|
11982 | var ComponentTemplate = template({
|
11983 | "id": "RLf1peEf",
|
11984 | "block": "{\"symbols\":[\"&default\"],\"statements\":[[18,1,null]],\"hasEval\":false,\"upvars\":[]}",
|
11985 | "meta": {
|
11986 | "moduleName": "packages/@ember/-internals/glimmer/lib/templates/component.hbs"
|
11987 | }
|
11988 | });
|
11989 | var InputTemplate = template({
|
11990 | "id": "ExnzE3OS",
|
11991 | "block": "{\"symbols\":[\"Checkbox\",\"TextField\",\"@__ARGS__\",\"&attrs\"],\"statements\":[[6,[37,2],[[30,[36,1],[\"-checkbox\"],null],[30,[36,1],[\"-text-field\"],null]],null,[[\"default\"],[{\"statements\":[[6,[37,0],[[32,0,[\"isCheckbox\"]]],null,[[\"default\",\"else\"],[{\"statements\":[[8,[32,1],[[17,4]],[[\"@target\",\"@__ARGS__\"],[[32,0,[\"caller\"]],[32,3]]],null]],\"parameters\":[]},{\"statements\":[[8,[32,2],[[17,4]],[[\"@target\",\"@__ARGS__\"],[[32,0,[\"caller\"]],[32,3]]],null]],\"parameters\":[]}]]]],\"parameters\":[1,2]}]]]],\"hasEval\":false,\"upvars\":[\"if\",\"component\",\"let\"]}",
|
11992 | "meta": {
|
11993 | "moduleName": "packages/@ember/-internals/glimmer/lib/templates/input.hbs"
|
11994 | }
|
11995 | });
|
11996 | var OutletTemplate = template({
|
11997 | "id": "vA+C0Wde",
|
11998 | "block": "{\"symbols\":[],\"statements\":[[1,[30,[36,1],[[30,[36,0],null,null]],null]]],\"hasEval\":false,\"upvars\":[\"-outlet\",\"component\"]}",
|
11999 | "meta": {
|
12000 | "moduleName": "packages/@ember/-internals/glimmer/lib/templates/outlet.hbs"
|
12001 | }
|
12002 | });
|
12003 | var TOP_LEVEL_NAME = '-top-level';
|
12004 | var TOP_LEVEL_OUTLET = 'main';
|
12005 |
|
12006 | class OutletView {
|
12007 | constructor(_environment, renderer, owner, template) {
|
12008 | this._environment = _environment;
|
12009 | this.renderer = renderer;
|
12010 | this.owner = owner;
|
12011 | this.template = template;
|
12012 | var ref = this.ref = new RootOutletReference({
|
12013 | outlets: {
|
12014 | main: undefined
|
12015 | },
|
12016 | render: {
|
12017 | owner: owner,
|
12018 | into: undefined,
|
12019 | outlet: TOP_LEVEL_OUTLET,
|
12020 | name: TOP_LEVEL_NAME,
|
12021 | controller: undefined,
|
12022 | model: undefined,
|
12023 | template
|
12024 | }
|
12025 | });
|
12026 | this.state = {
|
12027 | ref,
|
12028 | name: TOP_LEVEL_NAME,
|
12029 | outlet: TOP_LEVEL_OUTLET,
|
12030 | template,
|
12031 | controller: undefined,
|
12032 | model: undefined
|
12033 | };
|
12034 | }
|
12035 |
|
12036 | static extend(injections) {
|
12037 | return class extends OutletView {
|
12038 | static create(options) {
|
12039 | if (options) {
|
12040 | return super.create((0, _polyfills.assign)({}, injections, options));
|
12041 | } else {
|
12042 | return super.create(injections);
|
12043 | }
|
12044 | }
|
12045 |
|
12046 | };
|
12047 | }
|
12048 |
|
12049 | static reopenClass(injections) {
|
12050 | (0, _polyfills.assign)(this, injections);
|
12051 | }
|
12052 |
|
12053 | static create(options) {
|
12054 | var {
|
12055 | _environment,
|
12056 | renderer,
|
12057 | template: templateFactory$$1
|
12058 | } = options;
|
12059 | var owner = (0, _owner.getOwner)(options);
|
12060 | var template = templateFactory$$1(owner);
|
12061 | return new OutletView(_environment, renderer, owner, template);
|
12062 | }
|
12063 |
|
12064 | appendTo(selector) {
|
12065 | var target;
|
12066 |
|
12067 | if (this._environment.hasDOM) {
|
12068 | target = typeof selector === 'string' ? document.querySelector(selector) : selector;
|
12069 | } else {
|
12070 | target = selector;
|
12071 | }
|
12072 |
|
12073 | (0, _runloop.schedule)('render', this.renderer, 'appendOutletView', this, target);
|
12074 | }
|
12075 |
|
12076 | rerender() {
|
12077 |
|
12078 | }
|
12079 |
|
12080 | setOutletState(state) {
|
12081 | this.ref.update(state);
|
12082 | }
|
12083 |
|
12084 | destroy() {
|
12085 |
|
12086 | }
|
12087 |
|
12088 | }
|
12089 |
|
12090 | _exports.OutletView = OutletView;
|
12091 |
|
12092 | function setupApplicationRegistry(registry) {
|
12093 | registry.injection('renderer', 'env', '-environment:main');
|
12094 |
|
12095 |
|
12096 |
|
12097 | registry.register('service:-dom-builder', {
|
12098 | create({
|
12099 | bootOptions
|
12100 | }) {
|
12101 | var {
|
12102 | _renderMode
|
12103 | } = bootOptions;
|
12104 |
|
12105 | switch (_renderMode) {
|
12106 | case 'serialize':
|
12107 | return _node.serializeBuilder.bind(null);
|
12108 |
|
12109 | case 'rehydrate':
|
12110 | return _runtime2.rehydrationBuilder.bind(null);
|
12111 |
|
12112 | default:
|
12113 | return _runtime2.clientBuilder.bind(null);
|
12114 | }
|
12115 | }
|
12116 |
|
12117 | });
|
12118 | registry.injection('service:-dom-builder', 'bootOptions', '-environment:main');
|
12119 | registry.injection('renderer', 'builder', 'service:-dom-builder');
|
12120 | registry.register((0, _container.privatize)`template:-root`, RootTemplate);
|
12121 | registry.injection('renderer', 'rootTemplate', (0, _container.privatize)`template:-root`);
|
12122 | registry.register('renderer:-dom', InteractiveRenderer);
|
12123 | registry.register('renderer:-inert', InertRenderer);
|
12124 | registry.injection('renderer', 'document', 'service:-document');
|
12125 | }
|
12126 |
|
12127 | function setupEngineRegistry(registry) {
|
12128 | registry.optionsForType('template', {
|
12129 | instantiate: false
|
12130 | });
|
12131 | registry.register('view:-outlet', OutletView);
|
12132 | registry.register('template:-outlet', OutletTemplate);
|
12133 | registry.injection('view:-outlet', 'template', 'template:-outlet');
|
12134 | registry.register((0, _container.privatize)`template:components/-default`, ComponentTemplate);
|
12135 | registry.optionsForType('helper', {
|
12136 | instantiate: false
|
12137 | });
|
12138 | registry.register('helper:loc', loc$1);
|
12139 | registry.register('component:-text-field', TextField);
|
12140 | registry.register('component:-checkbox', Checkbox);
|
12141 | registry.register('component:link-to', LinkComponent);
|
12142 | registry.register('component:input', Input);
|
12143 | registry.register('template:components/input', InputTemplate);
|
12144 | registry.register('component:textarea', TextArea);
|
12145 |
|
12146 | if (!_environment2.ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS) {
|
12147 | registry.register((0, _container.privatize)`component:-default`, Component);
|
12148 | }
|
12149 | }
|
12150 |
|
12151 | function setComponentManager(stringOrFunction, obj) {
|
12152 | var factory;
|
12153 |
|
12154 | if (_deprecatedFeatures.COMPONENT_MANAGER_STRING_LOOKUP && typeof stringOrFunction === 'string') {
|
12155 | (true && !(false) && (0, _debug.deprecate)('Passing the name of the component manager to "setupComponentManager" is deprecated. Please pass a function that produces an instance of the manager.', false, {
|
12156 | id: 'deprecate-string-based-component-manager',
|
12157 | until: '4.0.0',
|
12158 | url: 'https://emberjs.com/deprecations/v3.x/#toc_component-manager-string-lookup'
|
12159 | }));
|
12160 |
|
12161 | factory = function (owner) {
|
12162 | return owner.lookup(`component-manager:${stringOrFunction}`);
|
12163 | };
|
12164 | } else {
|
12165 | factory = stringOrFunction;
|
12166 | }
|
12167 |
|
12168 | return setManager({
|
12169 | factory,
|
12170 | internal: false,
|
12171 | type: 'component'
|
12172 | }, obj);
|
12173 | }
|
12174 |
|
12175 | function getComponentManager(obj) {
|
12176 | var wrapper = getManager(obj);
|
12177 |
|
12178 | if (wrapper && !wrapper.internal && wrapper.type === 'component') {
|
12179 | return wrapper.factory;
|
12180 | } else {
|
12181 | return undefined;
|
12182 | }
|
12183 | }
|
12184 | |
12185 |
|
12186 |
|
12187 |
|
12188 |
|
12189 |
|
12190 |
|
12191 |
|
12192 |
|
12193 |
|
12194 |
|
12195 |
|
12196 |
|
12197 |
|
12198 |
|
12199 |
|
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 |
|
12233 |
|
12234 |
|
12235 |
|
12236 |
|
12237 |
|
12238 |
|
12239 |
|
12240 |
|
12241 |
|
12242 |
|
12243 |
|
12244 |
|
12245 |
|
12246 |
|
12247 |
|
12248 |
|
12249 |
|
12250 |
|
12251 |
|
12252 |
|
12253 |
|
12254 |
|
12255 |
|
12256 |
|
12257 |
|
12258 |
|
12259 |
|
12260 |
|
12261 |
|
12262 |
|
12263 |
|
12264 |
|
12265 | });
|
12266 | define("@ember/-internals/meta/index", ["exports", "@ember/-internals/meta/lib/meta"], function (_exports, _meta) {
|
12267 | "use strict";
|
12268 |
|
12269 | Object.defineProperty(_exports, "__esModule", {
|
12270 | value: true
|
12271 | });
|
12272 | Object.defineProperty(_exports, "counters", {
|
12273 | enumerable: true,
|
12274 | get: function () {
|
12275 | return _meta.counters;
|
12276 | }
|
12277 | });
|
12278 | Object.defineProperty(_exports, "Meta", {
|
12279 | enumerable: true,
|
12280 | get: function () {
|
12281 | return _meta.Meta;
|
12282 | }
|
12283 | });
|
12284 | Object.defineProperty(_exports, "meta", {
|
12285 | enumerable: true,
|
12286 | get: function () {
|
12287 | return _meta.meta;
|
12288 | }
|
12289 | });
|
12290 | Object.defineProperty(_exports, "peekMeta", {
|
12291 | enumerable: true,
|
12292 | get: function () {
|
12293 | return _meta.peekMeta;
|
12294 | }
|
12295 | });
|
12296 | Object.defineProperty(_exports, "setMeta", {
|
12297 | enumerable: true,
|
12298 | get: function () {
|
12299 | return _meta.setMeta;
|
12300 | }
|
12301 | });
|
12302 | Object.defineProperty(_exports, "UNDEFINED", {
|
12303 | enumerable: true,
|
12304 | get: function () {
|
12305 | return _meta.UNDEFINED;
|
12306 | }
|
12307 | });
|
12308 | });
|
12309 | define("@ember/-internals/meta/lib/meta", ["exports", "@ember/-internals/utils", "@ember/debug", "@glimmer/runtime"], function (_exports, _utils, _debug, _runtime) {
|
12310 | "use strict";
|
12311 |
|
12312 | Object.defineProperty(_exports, "__esModule", {
|
12313 | value: true
|
12314 | });
|
12315 | _exports.setMeta = setMeta;
|
12316 | _exports.peekMeta = peekMeta;
|
12317 | _exports.counters = _exports.meta = _exports.Meta = _exports.UNDEFINED = void 0;
|
12318 | var objectPrototype = Object.prototype;
|
12319 | var counters;
|
12320 | _exports.counters = counters;
|
12321 |
|
12322 | if (true
|
12323 |
|
12324 | ) {
|
12325 | _exports.counters = counters = {
|
12326 | peekCalls: 0,
|
12327 | peekPrototypeWalks: 0,
|
12328 | setCalls: 0,
|
12329 | deleteCalls: 0,
|
12330 | metaCalls: 0,
|
12331 | metaInstantiated: 0,
|
12332 | matchingListenersCalls: 0,
|
12333 | observerEventsCalls: 0,
|
12334 | addToListenersCalls: 0,
|
12335 | removeFromListenersCalls: 0,
|
12336 | removeAllListenersCalls: 0,
|
12337 | listenersInherited: 0,
|
12338 | listenersFlattened: 0,
|
12339 | parentListenersUsed: 0,
|
12340 | flattenedListenersCalls: 0,
|
12341 | reopensAfterFlatten: 0,
|
12342 | readableLazyChainsCalls: 0,
|
12343 | writableLazyChainsCalls: 0
|
12344 | };
|
12345 | }
|
12346 | |
12347 |
|
12348 |
|
12349 |
|
12350 |
|
12351 | var UNDEFINED = (0, _utils.symbol)('undefined');
|
12352 | _exports.UNDEFINED = UNDEFINED;
|
12353 | var currentListenerVersion = 1;
|
12354 |
|
12355 | class Meta {
|
12356 |
|
12357 | constructor(obj) {
|
12358 | this._listenersVersion = 1;
|
12359 | this._inheritedEnd = -1;
|
12360 | this._flattenedVersion = 0;
|
12361 |
|
12362 | if (true
|
12363 |
|
12364 | ) {
|
12365 | counters.metaInstantiated++;
|
12366 | }
|
12367 |
|
12368 | this._parent = undefined;
|
12369 | this._descriptors = undefined;
|
12370 | this._mixins = undefined;
|
12371 | this._lazyChains = undefined;
|
12372 | this._values = undefined;
|
12373 | this._tags = undefined;
|
12374 | this._revisions = undefined;
|
12375 |
|
12376 |
|
12377 | this._isInit = false;
|
12378 |
|
12379 | this.source = obj;
|
12380 | this.proto = obj.constructor === undefined ? undefined : obj.constructor.prototype;
|
12381 | this._listeners = undefined;
|
12382 | }
|
12383 |
|
12384 | get parent() {
|
12385 | var parent = this._parent;
|
12386 |
|
12387 | if (parent === undefined) {
|
12388 | var proto = getPrototypeOf(this.source);
|
12389 | this._parent = parent = proto === null || proto === objectPrototype ? null : meta(proto);
|
12390 | }
|
12391 |
|
12392 | return parent;
|
12393 | }
|
12394 |
|
12395 |
|
12396 |
|
12397 | setSourceDestroying() {
|
12398 | (true && !(false) && (0, _debug.deprecate)('setSourceDestroying is deprecated, use the destroy() API to destroy the object directly instead', false, {
|
12399 | id: 'meta-destruction-apis',
|
12400 | until: '3.25.0'
|
12401 | }));
|
12402 | }
|
12403 |
|
12404 | setSourceDestroyed() {
|
12405 | (true && !(false) && (0, _debug.deprecate)('setSourceDestroyed is deprecated, use the destroy() API to destroy the object directly instead', false, {
|
12406 | id: 'meta-destruction-apis',
|
12407 | until: '3.25.0'
|
12408 | }));
|
12409 | }
|
12410 |
|
12411 | isSourceDestroying() {
|
12412 | (true && !(false) && (0, _debug.deprecate)('isSourceDestroying is deprecated, use the isDestroying() API to check the object destruction state directly instead', false, {
|
12413 | id: 'meta-destruction-apis',
|
12414 | until: '3.25.0'
|
12415 | }));
|
12416 | return (0, _runtime.isDestroying)(this.source);
|
12417 | }
|
12418 |
|
12419 | isSourceDestroyed() {
|
12420 | (true && !(false) && (0, _debug.deprecate)('isSourceDestroyed is deprecated, use the isDestroyed() API to check the object destruction state directly instead', false, {
|
12421 | id: 'meta-destruction-apis',
|
12422 | until: '3.25.0'
|
12423 | }));
|
12424 | return (0, _runtime.isDestroyed)(this.source);
|
12425 | }
|
12426 |
|
12427 | setInitializing() {
|
12428 | this._isInit = true;
|
12429 | }
|
12430 |
|
12431 | unsetInitializing() {
|
12432 | this._isInit = false;
|
12433 | }
|
12434 |
|
12435 | isInitializing() {
|
12436 | return this._isInit;
|
12437 | }
|
12438 |
|
12439 | isPrototypeMeta(obj) {
|
12440 | return this.proto === this.source && this.source === obj;
|
12441 | }
|
12442 |
|
12443 | _getOrCreateOwnMap(key) {
|
12444 | return this[key] || (this[key] = Object.create(null));
|
12445 | }
|
12446 |
|
12447 | _getOrCreateOwnSet(key) {
|
12448 | return this[key] || (this[key] = new Set());
|
12449 | }
|
12450 |
|
12451 | _findInheritedMap(key, subkey) {
|
12452 | var pointer = this;
|
12453 |
|
12454 | while (pointer !== null) {
|
12455 | var map = pointer[key];
|
12456 |
|
12457 | if (map !== undefined) {
|
12458 | var value = map.get(subkey);
|
12459 |
|
12460 | if (value !== undefined) {
|
12461 | return value;
|
12462 | }
|
12463 | }
|
12464 |
|
12465 | pointer = pointer.parent;
|
12466 | }
|
12467 | }
|
12468 |
|
12469 | _hasInInheritedSet(key, value) {
|
12470 | var pointer = this;
|
12471 |
|
12472 | while (pointer !== null) {
|
12473 | var set = pointer[key];
|
12474 |
|
12475 | if (set !== undefined && set.has(value)) {
|
12476 | return true;
|
12477 | }
|
12478 |
|
12479 | pointer = pointer.parent;
|
12480 | }
|
12481 |
|
12482 | return false;
|
12483 | }
|
12484 |
|
12485 | valueFor(key) {
|
12486 | var values = this._values;
|
12487 | return values !== undefined ? values[key] : undefined;
|
12488 | }
|
12489 |
|
12490 | setValueFor(key, value) {
|
12491 | var values = this._getOrCreateOwnMap('_values');
|
12492 |
|
12493 | values[key] = value;
|
12494 | }
|
12495 |
|
12496 | revisionFor(key) {
|
12497 | var revisions = this._revisions;
|
12498 | return revisions !== undefined ? revisions[key] : undefined;
|
12499 | }
|
12500 |
|
12501 | setRevisionFor(key, revision) {
|
12502 | var revisions = this._getOrCreateOwnMap('_revisions');
|
12503 |
|
12504 | revisions[key] = revision;
|
12505 | }
|
12506 |
|
12507 | writableLazyChainsFor(key) {
|
12508 | if (true
|
12509 |
|
12510 | ) {
|
12511 | counters.writableLazyChainsCalls++;
|
12512 | }
|
12513 |
|
12514 | var lazyChains = this._getOrCreateOwnMap('_lazyChains');
|
12515 |
|
12516 | var chains = lazyChains[key];
|
12517 |
|
12518 | if (chains === undefined) {
|
12519 | chains = lazyChains[key] = [];
|
12520 | }
|
12521 |
|
12522 | return chains;
|
12523 | }
|
12524 |
|
12525 | readableLazyChainsFor(key) {
|
12526 | if (true
|
12527 |
|
12528 | ) {
|
12529 | counters.readableLazyChainsCalls++;
|
12530 | }
|
12531 |
|
12532 | var lazyChains = this._lazyChains;
|
12533 |
|
12534 | if (lazyChains !== undefined) {
|
12535 | return lazyChains[key];
|
12536 | }
|
12537 |
|
12538 | return undefined;
|
12539 | }
|
12540 |
|
12541 | addMixin(mixin) {
|
12542 | (true && !(!(0, _runtime.isDestroyed)(this.source)) && (0, _debug.assert)((0, _runtime.isDestroyed)(this.source) ? `Cannot add mixins of \`${(0, _utils.toString)(mixin)}\` on \`${(0, _utils.toString)(this.source)}\` call addMixin after it has been destroyed.` : '', !(0, _runtime.isDestroyed)(this.source)));
|
12543 |
|
12544 | var set = this._getOrCreateOwnSet('_mixins');
|
12545 |
|
12546 | set.add(mixin);
|
12547 | }
|
12548 |
|
12549 | hasMixin(mixin) {
|
12550 | return this._hasInInheritedSet('_mixins', mixin);
|
12551 | }
|
12552 |
|
12553 | forEachMixins(fn) {
|
12554 | var pointer = this;
|
12555 | var seen;
|
12556 |
|
12557 | while (pointer !== null) {
|
12558 | var set = pointer._mixins;
|
12559 |
|
12560 | if (set !== undefined) {
|
12561 | seen = seen === undefined ? new Set() : seen;
|
12562 |
|
12563 | set.forEach(mixin => {
|
12564 | if (!seen.has(mixin)) {
|
12565 | seen.add(mixin);
|
12566 | fn(mixin);
|
12567 | }
|
12568 | });
|
12569 | }
|
12570 |
|
12571 | pointer = pointer.parent;
|
12572 | }
|
12573 | }
|
12574 |
|
12575 | writeDescriptors(subkey, value) {
|
12576 | (true && !(!(0, _runtime.isDestroyed)(this.source)) && (0, _debug.assert)((0, _runtime.isDestroyed)(this.source) ? `Cannot update descriptors for \`${subkey}\` on \`${(0, _utils.toString)(this.source)}\` after it has been destroyed.` : '', !(0, _runtime.isDestroyed)(this.source)));
|
12577 | var map = this._descriptors || (this._descriptors = new Map());
|
12578 | map.set(subkey, value);
|
12579 | }
|
12580 |
|
12581 | peekDescriptors(subkey) {
|
12582 | var possibleDesc = this._findInheritedMap('_descriptors', subkey);
|
12583 |
|
12584 | return possibleDesc === UNDEFINED ? undefined : possibleDesc;
|
12585 | }
|
12586 |
|
12587 | removeDescriptors(subkey) {
|
12588 | this.writeDescriptors(subkey, UNDEFINED);
|
12589 | }
|
12590 |
|
12591 | forEachDescriptors(fn) {
|
12592 | var pointer = this;
|
12593 | var seen;
|
12594 |
|
12595 | while (pointer !== null) {
|
12596 | var map = pointer._descriptors;
|
12597 |
|
12598 | if (map !== undefined) {
|
12599 | seen = seen === undefined ? new Set() : seen;
|
12600 | map.forEach((value, key) => {
|
12601 | if (!seen.has(key)) {
|
12602 | seen.add(key);
|
12603 |
|
12604 | if (value !== UNDEFINED) {
|
12605 | fn(key, value);
|
12606 | }
|
12607 | }
|
12608 | });
|
12609 | }
|
12610 |
|
12611 | pointer = pointer.parent;
|
12612 | }
|
12613 | }
|
12614 |
|
12615 | addToListeners(eventName, target, method, once, sync) {
|
12616 | if (true
|
12617 |
|
12618 | ) {
|
12619 | counters.addToListenersCalls++;
|
12620 | }
|
12621 |
|
12622 | this.pushListener(eventName, target, method, once ? 1
|
12623 |
|
12624 | : 0
|
12625 |
|
12626 | , sync);
|
12627 | }
|
12628 |
|
12629 | removeFromListeners(eventName, target, method) {
|
12630 | if (true
|
12631 |
|
12632 | ) {
|
12633 | counters.removeFromListenersCalls++;
|
12634 | }
|
12635 |
|
12636 | this.pushListener(eventName, target, method, 2
|
12637 |
|
12638 | );
|
12639 | }
|
12640 |
|
12641 | pushListener(event, target, method, kind, sync = false) {
|
12642 | var listeners = this.writableListeners();
|
12643 | var i = indexOfListener(listeners, event, target, method);
|
12644 |
|
12645 | if (i !== -1 && i < this._inheritedEnd) {
|
12646 | listeners.splice(i, 1);
|
12647 | this._inheritedEnd--;
|
12648 | i = -1;
|
12649 | }
|
12650 |
|
12651 |
|
12652 |
|
12653 |
|
12654 | if (i === -1) {
|
12655 | (true && !(!(this.isPrototypeMeta(this.source) && typeof method === 'function')) && (0, _debug.assert)('You cannot add function listeners to prototypes. Convert the listener to a string listener, or add it to the instance instead.', !(this.isPrototypeMeta(this.source) && typeof method === 'function')));
|
12656 | (true && !(!(!this.isPrototypeMeta(this.source) && typeof method === 'function' && kind === 2
|
12657 |
|
12658 | )) && (0, _debug.assert)('You attempted to remove a function listener which did not exist on the instance, which means you may have attempted to remove it before it was added.', !(!this.isPrototypeMeta(this.source) && typeof method === 'function' && kind === 2)));
|
12659 | listeners.push({
|
12660 | event,
|
12661 | target,
|
12662 | method,
|
12663 | kind,
|
12664 | sync
|
12665 | });
|
12666 | } else {
|
12667 | var listener = listeners[i];
|
12668 |
|
12669 |
|
12670 | if (kind === 2
|
12671 |
|
12672 | && listener.kind !== 2
|
12673 |
|
12674 | ) {
|
12675 | listeners.splice(i, 1);
|
12676 | } else {
|
12677 | (true && !(!(listener.kind === 0
|
12678 |
|
12679 | && kind === 0
|
12680 |
|
12681 | && listener.sync !== sync)) && (0, _debug.assert)(`You attempted to add an observer for the same method on '${event.split(':')[0]}' twice to ${target} as both sync and async. Observers must be either sync or async, they cannot be both. This is likely a mistake, you should either remove the code that added the observer a second time, or update it to always be sync or async. The method was ${method}.`, !(listener.kind === 0 && kind === 0 && listener.sync !== sync)));
|
12682 |
|
12683 | listener.kind = kind;
|
12684 | listener.sync = sync;
|
12685 | }
|
12686 | }
|
12687 | }
|
12688 |
|
12689 | writableListeners() {
|
12690 |
|
12691 |
|
12692 |
|
12693 |
|
12694 | if (this._flattenedVersion === currentListenerVersion && (this.source === this.proto || this._inheritedEnd === -1)) {
|
12695 | if (true
|
12696 |
|
12697 | ) {
|
12698 | counters.reopensAfterFlatten++;
|
12699 | }
|
12700 |
|
12701 | currentListenerVersion++;
|
12702 | }
|
12703 |
|
12704 |
|
12705 |
|
12706 | if (this._inheritedEnd === -1) {
|
12707 | this._inheritedEnd = 0;
|
12708 | this._listeners = [];
|
12709 | }
|
12710 |
|
12711 | return this._listeners;
|
12712 | }
|
12713 | |
12714 |
|
12715 |
|
12716 |
|
12717 |
|
12718 |
|
12719 |
|
12720 |
|
12721 |
|
12722 |
|
12723 |
|
12724 |
|
12725 |
|
12726 | flattenedListeners() {
|
12727 | if (true
|
12728 |
|
12729 | ) {
|
12730 | counters.flattenedListenersCalls++;
|
12731 | }
|
12732 |
|
12733 | if (this._flattenedVersion < currentListenerVersion) {
|
12734 | if (true
|
12735 |
|
12736 | ) {
|
12737 | counters.listenersFlattened++;
|
12738 | }
|
12739 |
|
12740 | var parent = this.parent;
|
12741 |
|
12742 | if (parent !== null) {
|
12743 |
|
12744 | var parentListeners = parent.flattenedListeners();
|
12745 |
|
12746 | if (parentListeners !== undefined) {
|
12747 | if (this._listeners === undefined) {
|
12748 |
|
12749 |
|
12750 |
|
12751 | if (true
|
12752 |
|
12753 | ) {
|
12754 | counters.parentListenersUsed++;
|
12755 | }
|
12756 |
|
12757 | this._listeners = parentListeners;
|
12758 | } else {
|
12759 | var listeners = this._listeners;
|
12760 |
|
12761 | if (this._inheritedEnd > 0) {
|
12762 | listeners.splice(0, this._inheritedEnd);
|
12763 | this._inheritedEnd = 0;
|
12764 | }
|
12765 |
|
12766 | for (var i = 0; i < parentListeners.length; i++) {
|
12767 | var listener = parentListeners[i];
|
12768 | var index = indexOfListener(listeners, listener.event, listener.target, listener.method);
|
12769 |
|
12770 | if (index === -1) {
|
12771 | if (true
|
12772 |
|
12773 | ) {
|
12774 | counters.listenersInherited++;
|
12775 | }
|
12776 |
|
12777 | listeners.unshift(listener);
|
12778 | this._inheritedEnd++;
|
12779 | }
|
12780 | }
|
12781 | }
|
12782 | }
|
12783 | }
|
12784 |
|
12785 | this._flattenedVersion = currentListenerVersion;
|
12786 | }
|
12787 |
|
12788 | return this._listeners;
|
12789 | }
|
12790 |
|
12791 | matchingListeners(eventName) {
|
12792 | var listeners = this.flattenedListeners();
|
12793 | var result;
|
12794 |
|
12795 | if (true
|
12796 |
|
12797 | ) {
|
12798 | counters.matchingListenersCalls++;
|
12799 | }
|
12800 |
|
12801 | if (listeners !== undefined) {
|
12802 | for (var index = 0; index < listeners.length; index++) {
|
12803 | var listener = listeners[index];
|
12804 |
|
12805 |
|
12806 | if (listener.event === eventName && (listener.kind === 0
|
12807 |
|
12808 | || listener.kind === 1
|
12809 |
|
12810 | )) {
|
12811 | if (result === undefined) {
|
12812 |
|
12813 |
|
12814 | result = [];
|
12815 | }
|
12816 |
|
12817 | result.push(listener.target, listener.method, listener.kind === 1
|
12818 |
|
12819 | );
|
12820 | }
|
12821 | }
|
12822 | }
|
12823 |
|
12824 | return result;
|
12825 | }
|
12826 |
|
12827 | observerEvents() {
|
12828 | var listeners = this.flattenedListeners();
|
12829 | var result;
|
12830 |
|
12831 | if (true
|
12832 |
|
12833 | ) {
|
12834 | counters.observerEventsCalls++;
|
12835 | }
|
12836 |
|
12837 | if (listeners !== undefined) {
|
12838 | for (var index = 0; index < listeners.length; index++) {
|
12839 | var listener = listeners[index];
|
12840 |
|
12841 |
|
12842 | if ((listener.kind === 0
|
12843 |
|
12844 | || listener.kind === 1
|
12845 |
|
12846 | ) && listener.event.indexOf(':change') !== -1) {
|
12847 | if (result === undefined) {
|
12848 |
|
12849 |
|
12850 | result = [];
|
12851 | }
|
12852 |
|
12853 | result.push(listener);
|
12854 | }
|
12855 | }
|
12856 | }
|
12857 |
|
12858 | return result;
|
12859 | }
|
12860 |
|
12861 | }
|
12862 |
|
12863 | _exports.Meta = Meta;
|
12864 | var getPrototypeOf = Object.getPrototypeOf;
|
12865 | var metaStore = new WeakMap();
|
12866 |
|
12867 | function setMeta(obj, meta) {
|
12868 | (true && !(obj !== null) && (0, _debug.assert)('Cannot call `setMeta` on null', obj !== null));
|
12869 | (true && !(obj !== undefined) && (0, _debug.assert)('Cannot call `setMeta` on undefined', obj !== undefined));
|
12870 | (true && !(typeof obj === 'object' || typeof obj === 'function') && (0, _debug.assert)(`Cannot call \`setMeta\` on ${typeof obj}`, typeof obj === 'object' || typeof obj === 'function'));
|
12871 |
|
12872 | if (true
|
12873 |
|
12874 | ) {
|
12875 | counters.setCalls++;
|
12876 | }
|
12877 |
|
12878 | metaStore.set(obj, meta);
|
12879 | }
|
12880 |
|
12881 | function peekMeta(obj) {
|
12882 | (true && !(obj !== null) && (0, _debug.assert)('Cannot call `peekMeta` on null', obj !== null));
|
12883 | (true && !(obj !== undefined) && (0, _debug.assert)('Cannot call `peekMeta` on undefined', obj !== undefined));
|
12884 | (true && !(typeof obj === 'object' || typeof obj === 'function') && (0, _debug.assert)(`Cannot call \`peekMeta\` on ${typeof obj}`, typeof obj === 'object' || typeof obj === 'function'));
|
12885 |
|
12886 | if (true
|
12887 |
|
12888 | ) {
|
12889 | counters.peekCalls++;
|
12890 | }
|
12891 |
|
12892 | var meta = metaStore.get(obj);
|
12893 |
|
12894 | if (meta !== undefined) {
|
12895 | return meta;
|
12896 | }
|
12897 |
|
12898 | var pointer = getPrototypeOf(obj);
|
12899 |
|
12900 | while (pointer !== null) {
|
12901 | if (true
|
12902 |
|
12903 | ) {
|
12904 | counters.peekPrototypeWalks++;
|
12905 | }
|
12906 |
|
12907 | meta = metaStore.get(pointer);
|
12908 |
|
12909 | if (meta !== undefined) {
|
12910 | if (meta.proto !== pointer) {
|
12911 |
|
12912 |
|
12913 |
|
12914 | meta.proto = pointer;
|
12915 | }
|
12916 |
|
12917 | return meta;
|
12918 | }
|
12919 |
|
12920 | pointer = getPrototypeOf(pointer);
|
12921 | }
|
12922 |
|
12923 | return null;
|
12924 | }
|
12925 | |
12926 |
|
12927 |
|
12928 |
|
12929 |
|
12930 |
|
12931 |
|
12932 |
|
12933 |
|
12934 |
|
12935 |
|
12936 |
|
12937 |
|
12938 |
|
12939 |
|
12940 |
|
12941 |
|
12942 |
|
12943 |
|
12944 |
|
12945 | var meta = function meta(obj) {
|
12946 | (true && !(obj !== null) && (0, _debug.assert)('Cannot call `meta` on null', obj !== null));
|
12947 | (true && !(obj !== undefined) && (0, _debug.assert)('Cannot call `meta` on undefined', obj !== undefined));
|
12948 | (true && !(typeof obj === 'object' || typeof obj === 'function') && (0, _debug.assert)(`Cannot call \`meta\` on ${typeof obj}`, typeof obj === 'object' || typeof obj === 'function'));
|
12949 |
|
12950 | if (true
|
12951 |
|
12952 | ) {
|
12953 | counters.metaCalls++;
|
12954 | }
|
12955 |
|
12956 | var maybeMeta = peekMeta(obj);
|
12957 |
|
12958 | if (maybeMeta !== null && maybeMeta.source === obj) {
|
12959 | return maybeMeta;
|
12960 | }
|
12961 |
|
12962 | var newMeta = new Meta(obj);
|
12963 | setMeta(obj, newMeta);
|
12964 | return newMeta;
|
12965 | };
|
12966 |
|
12967 | _exports.meta = meta;
|
12968 |
|
12969 | if (true
|
12970 |
|
12971 | ) {
|
12972 | meta._counters = counters;
|
12973 | }
|
12974 |
|
12975 | function indexOfListener(listeners, event, target, method) {
|
12976 | for (var i = listeners.length - 1; i >= 0; i--) {
|
12977 | var listener = listeners[i];
|
12978 |
|
12979 | if (listener.event === event && listener.target === target && listener.method === method) {
|
12980 | return i;
|
12981 | }
|
12982 | }
|
12983 |
|
12984 | return -1;
|
12985 | }
|
12986 | });
|
12987 | define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@ember/-internals/utils", "@ember/debug", "@ember/-internals/environment", "@ember/runloop", "@glimmer/runtime", "@glimmer/validator", "@ember/polyfills", "@ember/error", "ember/version", "@ember/deprecated-features", "@ember/-internals/owner"], function (_exports, _meta2, _utils, _debug, _environment, _runloop, _runtime, _validator, _polyfills, _error, _version, _deprecatedFeatures, _owner) {
|
12988 | "use strict";
|
12989 |
|
12990 | Object.defineProperty(_exports, "__esModule", {
|
12991 | value: true
|
12992 | });
|
12993 | _exports.computed = computed;
|
12994 | _exports.autoComputed = autoComputed;
|
12995 | _exports.isComputed = isComputed;
|
12996 | _exports.getCachedValueFor = getCachedValueFor;
|
12997 | _exports.alias = alias;
|
12998 | _exports.deprecateProperty = deprecateProperty;
|
12999 | _exports._getPath = _getPath;
|
13000 | _exports.get = get;
|
13001 | _exports.getWithDefault = getWithDefault;
|
13002 | _exports._getProp = _getProp;
|
13003 | _exports.set = set;
|
13004 | _exports.trySet = trySet;
|
13005 | _exports.objectAt = objectAt;
|
13006 | _exports.replace = replace;
|
13007 | _exports.replaceInNativeArray = replaceInNativeArray;
|
13008 | _exports.addArrayObserver = addArrayObserver;
|
13009 | _exports.removeArrayObserver = removeArrayObserver;
|
13010 | _exports.arrayContentWillChange = arrayContentWillChange;
|
13011 | _exports.arrayContentDidChange = arrayContentDidChange;
|
13012 | _exports.eachProxyArrayWillChange = eachProxyArrayWillChange;
|
13013 | _exports.eachProxyArrayDidChange = eachProxyArrayDidChange;
|
13014 | _exports.addListener = addListener;
|
13015 | _exports.hasListeners = hasListeners;
|
13016 | _exports.on = on;
|
13017 | _exports.removeListener = removeListener;
|
13018 | _exports.sendEvent = sendEvent;
|
13019 | _exports.isNone = isNone;
|
13020 | _exports.isEmpty = isEmpty;
|
13021 | _exports.isBlank = isBlank;
|
13022 | _exports.isPresent = isPresent;
|
13023 | _exports.beginPropertyChanges = beginPropertyChanges;
|
13024 | _exports.changeProperties = changeProperties;
|
13025 | _exports.endPropertyChanges = endPropertyChanges;
|
13026 | _exports.notifyPropertyChange = notifyPropertyChange;
|
13027 | _exports.defineProperty = defineProperty;
|
13028 | _exports.isElementDescriptor = isElementDescriptor;
|
13029 | _exports.nativeDescDecorator = nativeDescDecorator;
|
13030 | _exports.descriptorForDecorator = descriptorForDecorator;
|
13031 | _exports.descriptorForProperty = descriptorForProperty;
|
13032 | _exports.isClassicDecorator = isClassicDecorator;
|
13033 | _exports.setClassicDecorator = setClassicDecorator;
|
13034 | _exports.getProperties = getProperties;
|
13035 | _exports.setProperties = setProperties;
|
13036 | _exports.expandProperties = expandProperties;
|
13037 | _exports.addObserver = addObserver;
|
13038 | _exports.activateObserver = activateObserver;
|
13039 | _exports.removeObserver = removeObserver;
|
13040 | _exports.flushAsyncObservers = flushAsyncObservers;
|
13041 | _exports.mixin = mixin;
|
13042 | _exports.observer = observer;
|
13043 | _exports.applyMixin = applyMixin;
|
13044 | _exports.inject = inject;
|
13045 | _exports.tagForProperty = tagForProperty;
|
13046 | _exports.tagForObject = tagForObject;
|
13047 | _exports.markObjectAsDirty = markObjectAsDirty;
|
13048 | _exports.tracked = tracked;
|
13049 | _exports.addNamespace = addNamespace;
|
13050 | _exports.classToString = classToString;
|
13051 | _exports.findNamespace = findNamespace;
|
13052 | _exports.findNamespaces = findNamespaces;
|
13053 | _exports.processNamespace = processNamespace;
|
13054 | _exports.processAllNamespaces = processAllNamespaces;
|
13055 | _exports.removeNamespace = removeNamespace;
|
13056 | _exports.isNamespaceSearchDisabled = isSearchDisabled;
|
13057 | _exports.setNamespaceSearchDisabled = setSearchDisabled;
|
13058 | Object.defineProperty(_exports, "createCache", {
|
13059 | enumerable: true,
|
13060 | get: function () {
|
13061 | return _validator.createCache;
|
13062 | }
|
13063 | });
|
13064 | Object.defineProperty(_exports, "getValue", {
|
13065 | enumerable: true,
|
13066 | get: function () {
|
13067 | return _validator.getValue;
|
13068 | }
|
13069 | });
|
13070 | Object.defineProperty(_exports, "isConst", {
|
13071 | enumerable: true,
|
13072 | get: function () {
|
13073 | return _validator.isConst;
|
13074 | }
|
13075 | });
|
13076 | _exports.NAMESPACES_BY_ID = _exports.NAMESPACES = _exports.CUSTOM_TAG_FOR = _exports.DEBUG_INJECTION_FUNCTIONS = _exports.aliasMethod = _exports.Mixin = _exports.SYNC_OBSERVERS = _exports.ASYNC_OBSERVERS = _exports.Libraries = _exports.libraries = _exports.PROPERTY_DID_CHANGE = _exports.PROXY_CONTENT = _exports.ComputedProperty = _exports._globalsComputed = void 0;
|
13077 |
|
13078 | |
13079 |
|
13080 |
|
13081 |
|
13082 | |
13083 |
|
13084 |
|
13085 |
|
13086 |
|
13087 |
|
13088 |
|
13089 |
|
13090 |
|
13091 |
|
13092 |
|
13093 |
|
13094 |
|
13095 |
|
13096 |
|
13097 |
|
13098 |
|
13099 |
|
13100 | |
13101 |
|
13102 |
|
13103 |
|
13104 |
|
13105 |
|
13106 |
|
13107 |
|
13108 |
|
13109 |
|
13110 |
|
13111 |
|
13112 |
|
13113 | function addListener(obj, eventName, target, method, once, sync = true) {
|
13114 | (true && !(Boolean(obj) && Boolean(eventName)) && (0, _debug.assert)('You must pass at least an object and event name to addListener', Boolean(obj) && Boolean(eventName)));
|
13115 |
|
13116 | if (!method && 'function' === typeof target) {
|
13117 | method = target;
|
13118 | target = null;
|
13119 | }
|
13120 |
|
13121 | (0, _meta2.meta)(obj).addToListeners(eventName, target, method, once === true, sync);
|
13122 | }
|
13123 | |
13124 |
|
13125 |
|
13126 |
|
13127 |
|
13128 |
|
13129 |
|
13130 |
|
13131 |
|
13132 |
|
13133 |
|
13134 |
|
13135 |
|
13136 |
|
13137 |
|
13138 |
|
13139 | function removeListener(obj, eventName, targetOrFunction, functionOrName) {
|
13140 | (true && !(Boolean(obj) && Boolean(eventName) && (typeof targetOrFunction === 'function' || typeof targetOrFunction === 'object' && Boolean(functionOrName))) && (0, _debug.assert)('You must pass at least an object, event name, and method or target and method/method name to removeListener', Boolean(obj) && Boolean(eventName) && (typeof targetOrFunction === 'function' || typeof targetOrFunction === 'object' && Boolean(functionOrName))));
|
13141 | var target, method;
|
13142 |
|
13143 | if (typeof targetOrFunction === 'object') {
|
13144 | target = targetOrFunction;
|
13145 | method = functionOrName;
|
13146 | } else {
|
13147 | target = null;
|
13148 | method = targetOrFunction;
|
13149 | }
|
13150 |
|
13151 | var m = (0, _meta2.meta)(obj);
|
13152 | m.removeFromListeners(eventName, target, method);
|
13153 | }
|
13154 | |
13155 |
|
13156 |
|
13157 |
|
13158 |
|
13159 |
|
13160 |
|
13161 |
|
13162 |
|
13163 |
|
13164 |
|
13165 |
|
13166 |
|
13167 |
|
13168 |
|
13169 |
|
13170 |
|
13171 | function sendEvent(obj, eventName, params, actions, _meta) {
|
13172 | if (actions === undefined) {
|
13173 | var meta$$1 = _meta === undefined ? (0, _meta2.peekMeta)(obj) : _meta;
|
13174 | actions = meta$$1 !== null ? meta$$1.matchingListeners(eventName) : undefined;
|
13175 | }
|
13176 |
|
13177 | if (actions === undefined || actions.length === 0) {
|
13178 | return false;
|
13179 | }
|
13180 |
|
13181 | for (var i = actions.length - 3; i >= 0; i -= 3) {
|
13182 |
|
13183 | var target = actions[i];
|
13184 | var method = actions[i + 1];
|
13185 | var once = actions[i + 2];
|
13186 |
|
13187 | if (!method) {
|
13188 | continue;
|
13189 | }
|
13190 |
|
13191 | if (once) {
|
13192 | removeListener(obj, eventName, target, method);
|
13193 | }
|
13194 |
|
13195 | if (!target) {
|
13196 | target = obj;
|
13197 | }
|
13198 |
|
13199 | var type = typeof method;
|
13200 |
|
13201 | if (type === 'string' || type === 'symbol') {
|
13202 | method = target[method];
|
13203 | }
|
13204 |
|
13205 | method.apply(target, params);
|
13206 | }
|
13207 |
|
13208 | return true;
|
13209 | }
|
13210 | |
13211 |
|
13212 |
|
13213 |
|
13214 |
|
13215 |
|
13216 |
|
13217 |
|
13218 |
|
13219 |
|
13220 |
|
13221 | function hasListeners(obj, eventName) {
|
13222 | var meta$$1 = (0, _meta2.peekMeta)(obj);
|
13223 |
|
13224 | if (meta$$1 === null) {
|
13225 | return false;
|
13226 | }
|
13227 |
|
13228 | var matched = meta$$1.matchingListeners(eventName);
|
13229 | return matched !== undefined && matched.length > 0;
|
13230 | }
|
13231 | |
13232 |
|
13233 |
|
13234 |
|
13235 |
|
13236 |
|
13237 |
|
13238 |
|
13239 |
|
13240 |
|
13241 |
|
13242 |
|
13243 |
|
13244 |
|
13245 |
|
13246 |
|
13247 |
|
13248 |
|
13249 |
|
13250 |
|
13251 |
|
13252 |
|
13253 |
|
13254 |
|
13255 |
|
13256 |
|
13257 |
|
13258 |
|
13259 |
|
13260 |
|
13261 | function on(...args) {
|
13262 | var func = args.pop();
|
13263 | var events = args;
|
13264 | (true && !(typeof func === 'function') && (0, _debug.assert)('on expects function as last argument', typeof func === 'function'));
|
13265 | (true && !(events.length > 0 && events.every(p => typeof p === 'string' && p.length > 0)) && (0, _debug.assert)('on called without valid event names', events.length > 0 && events.every(p => typeof p === 'string' && p.length > 0)));
|
13266 | (0, _utils.setListeners)(func, events);
|
13267 | return func;
|
13268 | }
|
13269 |
|
13270 | var AFTER_OBSERVERS = ':change';
|
13271 |
|
13272 | function changeEvent(keyName) {
|
13273 | return keyName + AFTER_OBSERVERS;
|
13274 | }
|
13275 |
|
13276 | var SYNC_DEFAULT = !_environment.ENV._DEFAULT_ASYNC_OBSERVERS;
|
13277 | var SYNC_OBSERVERS = new Map();
|
13278 | _exports.SYNC_OBSERVERS = SYNC_OBSERVERS;
|
13279 | var ASYNC_OBSERVERS = new Map();
|
13280 | |
13281 |
|
13282 |
|
13283 |
|
13284 | |
13285 |
|
13286 |
|
13287 |
|
13288 |
|
13289 |
|
13290 |
|
13291 |
|
13292 |
|
13293 |
|
13294 |
|
13295 | _exports.ASYNC_OBSERVERS = ASYNC_OBSERVERS;
|
13296 |
|
13297 | function addObserver(obj, path, target, method, sync = SYNC_DEFAULT) {
|
13298 | var eventName = changeEvent(path);
|
13299 | addListener(obj, eventName, target, method, false, sync);
|
13300 | var meta$$1 = (0, _meta2.peekMeta)(obj);
|
13301 |
|
13302 | if (meta$$1 === null || !(meta$$1.isPrototypeMeta(obj) || meta$$1.isInitializing())) {
|
13303 | activateObserver(obj, eventName, sync);
|
13304 | }
|
13305 | }
|
13306 | |
13307 |
|
13308 |
|
13309 |
|
13310 |
|
13311 |
|
13312 |
|
13313 |
|
13314 |
|
13315 |
|
13316 |
|
13317 |
|
13318 | function removeObserver(obj, path, target, method, sync = SYNC_DEFAULT) {
|
13319 | var eventName = changeEvent(path);
|
13320 | var meta$$1 = (0, _meta2.peekMeta)(obj);
|
13321 |
|
13322 | if (meta$$1 === null || !(meta$$1.isPrototypeMeta(obj) || meta$$1.isInitializing())) {
|
13323 | deactivateObserver(obj, eventName, sync);
|
13324 | }
|
13325 |
|
13326 | removeListener(obj, eventName, target, method);
|
13327 | }
|
13328 |
|
13329 | function getOrCreateActiveObserversFor(target, sync) {
|
13330 | var observerMap = sync === true ? SYNC_OBSERVERS : ASYNC_OBSERVERS;
|
13331 |
|
13332 | if (!observerMap.has(target)) {
|
13333 | observerMap.set(target, new Map());
|
13334 | (0, _runtime.registerDestructor)(target, () => destroyObservers(target), true);
|
13335 | }
|
13336 |
|
13337 | return observerMap.get(target);
|
13338 | }
|
13339 |
|
13340 | function activateObserver(target, eventName, sync = false) {
|
13341 | var activeObservers = getOrCreateActiveObserversFor(target, sync);
|
13342 |
|
13343 | if (activeObservers.has(eventName)) {
|
13344 | activeObservers.get(eventName).count++;
|
13345 | } else {
|
13346 | var [path] = eventName.split(':');
|
13347 | var tag = getChainTagsForKey(target, path, (0, _validator.tagMetaFor)(target), (0, _meta2.peekMeta)(target));
|
13348 | activeObservers.set(eventName, {
|
13349 | count: 1,
|
13350 | path,
|
13351 | tag,
|
13352 | lastRevision: (0, _validator.valueForTag)(tag),
|
13353 | suspended: false
|
13354 | });
|
13355 | }
|
13356 | }
|
13357 |
|
13358 | var DEACTIVATE_SUSPENDED = false;
|
13359 | var SCHEDULED_DEACTIVATE = [];
|
13360 |
|
13361 | function deactivateObserver(target, eventName, sync = false) {
|
13362 | if (DEACTIVATE_SUSPENDED === true) {
|
13363 | SCHEDULED_DEACTIVATE.push([target, eventName, sync]);
|
13364 | return;
|
13365 | }
|
13366 |
|
13367 | var observerMap = sync === true ? SYNC_OBSERVERS : ASYNC_OBSERVERS;
|
13368 | var activeObservers = observerMap.get(target);
|
13369 |
|
13370 | if (activeObservers !== undefined) {
|
13371 | var _observer = activeObservers.get(eventName);
|
13372 |
|
13373 | _observer.count--;
|
13374 |
|
13375 | if (_observer.count === 0) {
|
13376 | activeObservers.delete(eventName);
|
13377 |
|
13378 | if (activeObservers.size === 0) {
|
13379 | observerMap.delete(target);
|
13380 | }
|
13381 | }
|
13382 | }
|
13383 | }
|
13384 |
|
13385 | function suspendedObserverDeactivation() {
|
13386 | DEACTIVATE_SUSPENDED = true;
|
13387 | }
|
13388 |
|
13389 | function resumeObserverDeactivation() {
|
13390 | DEACTIVATE_SUSPENDED = false;
|
13391 |
|
13392 | for (var [target, eventName, sync] of SCHEDULED_DEACTIVATE) {
|
13393 | deactivateObserver(target, eventName, sync);
|
13394 | }
|
13395 |
|
13396 | SCHEDULED_DEACTIVATE = [];
|
13397 | }
|
13398 | |
13399 |
|
13400 |
|
13401 |
|
13402 |
|
13403 |
|
13404 |
|
13405 |
|
13406 |
|
13407 | function revalidateObservers(target) {
|
13408 | if (ASYNC_OBSERVERS.has(target)) {
|
13409 | ASYNC_OBSERVERS.get(target).forEach(observer => {
|
13410 | observer.tag = getChainTagsForKey(target, observer.path, (0, _validator.tagMetaFor)(target), (0, _meta2.peekMeta)(target));
|
13411 | observer.lastRevision = (0, _validator.valueForTag)(observer.tag);
|
13412 | });
|
13413 | }
|
13414 |
|
13415 | if (SYNC_OBSERVERS.has(target)) {
|
13416 | SYNC_OBSERVERS.get(target).forEach(observer => {
|
13417 | observer.tag = getChainTagsForKey(target, observer.path, (0, _validator.tagMetaFor)(target), (0, _meta2.peekMeta)(target));
|
13418 | observer.lastRevision = (0, _validator.valueForTag)(observer.tag);
|
13419 | });
|
13420 | }
|
13421 | }
|
13422 |
|
13423 | var lastKnownRevision = 0;
|
13424 |
|
13425 | function flushAsyncObservers(shouldSchedule = true) {
|
13426 | var currentRevision = (0, _validator.valueForTag)(_validator.CURRENT_TAG);
|
13427 |
|
13428 | if (lastKnownRevision === currentRevision) {
|
13429 | return;
|
13430 | }
|
13431 |
|
13432 | lastKnownRevision = currentRevision;
|
13433 | ASYNC_OBSERVERS.forEach((activeObservers, target) => {
|
13434 | var meta$$1 = (0, _meta2.peekMeta)(target);
|
13435 | activeObservers.forEach((observer, eventName) => {
|
13436 | if (!(0, _validator.validateTag)(observer.tag, observer.lastRevision)) {
|
13437 | var sendObserver = () => {
|
13438 | try {
|
13439 | sendEvent(target, eventName, [target, observer.path], undefined, meta$$1);
|
13440 | } finally {
|
13441 | observer.tag = getChainTagsForKey(target, observer.path, (0, _validator.tagMetaFor)(target), (0, _meta2.peekMeta)(target));
|
13442 | observer.lastRevision = (0, _validator.valueForTag)(observer.tag);
|
13443 | }
|
13444 | };
|
13445 |
|
13446 | if (shouldSchedule) {
|
13447 | (0, _runloop.schedule)('actions', sendObserver);
|
13448 | } else {
|
13449 | sendObserver();
|
13450 | }
|
13451 | }
|
13452 | });
|
13453 | });
|
13454 | }
|
13455 |
|
13456 | function flushSyncObservers() {
|
13457 |
|
13458 |
|
13459 |
|
13460 | SYNC_OBSERVERS.forEach((activeObservers, target) => {
|
13461 | var meta$$1 = (0, _meta2.peekMeta)(target);
|
13462 | activeObservers.forEach((observer, eventName) => {
|
13463 | if (!observer.suspended && !(0, _validator.validateTag)(observer.tag, observer.lastRevision)) {
|
13464 | try {
|
13465 | observer.suspended = true;
|
13466 | sendEvent(target, eventName, [target, observer.path], undefined, meta$$1);
|
13467 | } finally {
|
13468 | observer.tag = getChainTagsForKey(target, observer.path, (0, _validator.tagMetaFor)(target), (0, _meta2.peekMeta)(target));
|
13469 | observer.lastRevision = (0, _validator.valueForTag)(observer.tag);
|
13470 | observer.suspended = false;
|
13471 | }
|
13472 | }
|
13473 | });
|
13474 | });
|
13475 | }
|
13476 |
|
13477 | function setObserverSuspended(target, property, suspended) {
|
13478 | var activeObservers = SYNC_OBSERVERS.get(target);
|
13479 |
|
13480 | if (!activeObservers) {
|
13481 | return;
|
13482 | }
|
13483 |
|
13484 | var observer = activeObservers.get(changeEvent(property));
|
13485 |
|
13486 | if (observer) {
|
13487 | observer.suspended = suspended;
|
13488 | }
|
13489 | }
|
13490 |
|
13491 | function destroyObservers(target) {
|
13492 | if (SYNC_OBSERVERS.size > 0) SYNC_OBSERVERS.delete(target);
|
13493 | if (ASYNC_OBSERVERS.size > 0) ASYNC_OBSERVERS.delete(target);
|
13494 | }
|
13495 |
|
13496 | var CUSTOM_TAG_FOR = (0, _utils.enumerableSymbol)('CUSTOM_TAG_FOR');
|
13497 |
|
13498 | _exports.CUSTOM_TAG_FOR = CUSTOM_TAG_FOR;
|
13499 | var SELF_TAG = (0, _utils.symbol)('SELF_TAG');
|
13500 |
|
13501 | function tagForProperty(obj, propertyKey, addMandatorySetter = false, meta$$1) {
|
13502 | if (typeof obj[CUSTOM_TAG_FOR] === 'function') {
|
13503 | return obj[CUSTOM_TAG_FOR](propertyKey, addMandatorySetter);
|
13504 | }
|
13505 |
|
13506 | var tag = (0, _validator.tagFor)(obj, propertyKey, meta$$1);
|
13507 |
|
13508 | if (true
|
13509 |
|
13510 | && addMandatorySetter) {
|
13511 | (0, _utils.setupMandatorySetter)(tag, obj, propertyKey);
|
13512 | }
|
13513 |
|
13514 | return tag;
|
13515 | }
|
13516 |
|
13517 | function tagForObject(obj) {
|
13518 | if ((0, _utils.isObject)(obj)) {
|
13519 | if (true
|
13520 |
|
13521 | ) {
|
13522 | (true && !(!(0, _runtime.isDestroyed)(obj)) && (0, _debug.assert)((0, _runtime.isDestroyed)(obj) ? `Cannot create a new tag for \`${(0, _utils.toString)(obj)}\` after it has been destroyed.` : '', !(0, _runtime.isDestroyed)(obj)));
|
13523 | }
|
13524 |
|
13525 | return (0, _validator.tagFor)(obj, SELF_TAG);
|
13526 | }
|
13527 |
|
13528 | return _validator.CONSTANT_TAG;
|
13529 | }
|
13530 |
|
13531 | function markObjectAsDirty(obj, propertyKey) {
|
13532 | (0, _validator.dirtyTagFor)(obj, propertyKey);
|
13533 | (0, _validator.dirtyTagFor)(obj, SELF_TAG);
|
13534 | }
|
13535 | |
13536 |
|
13537 |
|
13538 |
|
13539 |
|
13540 |
|
13541 | var PROPERTY_DID_CHANGE = (0, _utils.enumerableSymbol)('PROPERTY_DID_CHANGE');
|
13542 | _exports.PROPERTY_DID_CHANGE = PROPERTY_DID_CHANGE;
|
13543 | var deferred = 0;
|
13544 | |
13545 |
|
13546 |
|
13547 |
|
13548 |
|
13549 |
|
13550 |
|
13551 |
|
13552 |
|
13553 |
|
13554 |
|
13555 |
|
13556 |
|
13557 |
|
13558 |
|
13559 |
|
13560 |
|
13561 |
|
13562 |
|
13563 | function notifyPropertyChange(obj, keyName, _meta, value) {
|
13564 | var meta$$1 = _meta === undefined ? (0, _meta2.peekMeta)(obj) : _meta;
|
13565 |
|
13566 | if (meta$$1 !== null && (meta$$1.isInitializing() || meta$$1.isPrototypeMeta(obj))) {
|
13567 | return;
|
13568 | }
|
13569 |
|
13570 | markObjectAsDirty(obj, keyName);
|
13571 |
|
13572 | if (deferred <= 0) {
|
13573 | flushSyncObservers();
|
13574 | }
|
13575 |
|
13576 | if (PROPERTY_DID_CHANGE in obj) {
|
13577 |
|
13578 |
|
13579 |
|
13580 | if (arguments.length === 4) {
|
13581 | obj[PROPERTY_DID_CHANGE](keyName, value);
|
13582 | } else {
|
13583 | obj[PROPERTY_DID_CHANGE](keyName);
|
13584 | }
|
13585 | }
|
13586 | }
|
13587 | |
13588 |
|
13589 |
|
13590 |
|
13591 |
|
13592 |
|
13593 |
|
13594 | function beginPropertyChanges() {
|
13595 | deferred++;
|
13596 | suspendedObserverDeactivation();
|
13597 | }
|
13598 | |
13599 |
|
13600 |
|
13601 |
|
13602 |
|
13603 |
|
13604 | function endPropertyChanges() {
|
13605 | deferred--;
|
13606 |
|
13607 | if (deferred <= 0) {
|
13608 | flushSyncObservers();
|
13609 | resumeObserverDeactivation();
|
13610 | }
|
13611 | }
|
13612 | |
13613 |
|
13614 |
|
13615 |
|
13616 |
|
13617 |
|
13618 |
|
13619 |
|
13620 |
|
13621 |
|
13622 |
|
13623 |
|
13624 |
|
13625 |
|
13626 |
|
13627 |
|
13628 |
|
13629 | function changeProperties(callback) {
|
13630 | beginPropertyChanges();
|
13631 |
|
13632 | try {
|
13633 | callback();
|
13634 | } finally {
|
13635 | endPropertyChanges();
|
13636 | }
|
13637 | }
|
13638 |
|
13639 | function arrayContentWillChange(array, startIdx, removeAmt, addAmt) {
|
13640 |
|
13641 | if (startIdx === undefined) {
|
13642 | startIdx = 0;
|
13643 | removeAmt = addAmt = -1;
|
13644 | } else {
|
13645 | if (removeAmt === undefined) {
|
13646 | removeAmt = -1;
|
13647 | }
|
13648 |
|
13649 | if (addAmt === undefined) {
|
13650 | addAmt = -1;
|
13651 | }
|
13652 | }
|
13653 |
|
13654 | sendEvent(array, '@array:before', [array, startIdx, removeAmt, addAmt]);
|
13655 | return array;
|
13656 | }
|
13657 |
|
13658 | function arrayContentDidChange(array, startIdx, removeAmt, addAmt, notify = true) {
|
13659 |
|
13660 | if (startIdx === undefined) {
|
13661 | startIdx = 0;
|
13662 | removeAmt = addAmt = -1;
|
13663 | } else {
|
13664 | if (removeAmt === undefined) {
|
13665 | removeAmt = -1;
|
13666 | }
|
13667 |
|
13668 | if (addAmt === undefined) {
|
13669 | addAmt = -1;
|
13670 | }
|
13671 | }
|
13672 |
|
13673 | var meta$$1 = (0, _meta2.peekMeta)(array);
|
13674 |
|
13675 | if (notify) {
|
13676 | if (addAmt < 0 || removeAmt < 0 || addAmt - removeAmt !== 0) {
|
13677 | notifyPropertyChange(array, 'length', meta$$1);
|
13678 | }
|
13679 |
|
13680 | notifyPropertyChange(array, '[]', meta$$1);
|
13681 | }
|
13682 |
|
13683 | sendEvent(array, '@array:change', [array, startIdx, removeAmt, addAmt]);
|
13684 |
|
13685 | if (meta$$1 !== null) {
|
13686 | var length = array.length;
|
13687 | var addedAmount = addAmt === -1 ? 0 : addAmt;
|
13688 | var removedAmount = removeAmt === -1 ? 0 : removeAmt;
|
13689 | var delta = addedAmount - removedAmount;
|
13690 | var previousLength = length - delta;
|
13691 | var normalStartIdx = startIdx < 0 ? previousLength + startIdx : startIdx;
|
13692 |
|
13693 | if (meta$$1.revisionFor('firstObject') !== undefined && normalStartIdx === 0) {
|
13694 | notifyPropertyChange(array, 'firstObject', meta$$1);
|
13695 | }
|
13696 |
|
13697 | if (meta$$1.revisionFor('lastObject') !== undefined) {
|
13698 | var previousLastIndex = previousLength - 1;
|
13699 | var lastAffectedIndex = normalStartIdx + removedAmount;
|
13700 |
|
13701 | if (previousLastIndex < lastAffectedIndex) {
|
13702 | notifyPropertyChange(array, 'lastObject', meta$$1);
|
13703 | }
|
13704 | }
|
13705 | }
|
13706 |
|
13707 | return array;
|
13708 | }
|
13709 |
|
13710 | var EMPTY_ARRAY = Object.freeze([]);
|
13711 |
|
13712 | function objectAt(array, index) {
|
13713 | if (Array.isArray(array)) {
|
13714 | return array[index];
|
13715 | } else {
|
13716 | return array.objectAt(index);
|
13717 | }
|
13718 | }
|
13719 |
|
13720 | function replace(array, start, deleteCount, items = EMPTY_ARRAY) {
|
13721 | if (Array.isArray(array)) {
|
13722 | replaceInNativeArray(array, start, deleteCount, items);
|
13723 | } else {
|
13724 | array.replace(start, deleteCount, items);
|
13725 | }
|
13726 | }
|
13727 |
|
13728 | var CHUNK_SIZE = 60000;
|
13729 |
|
13730 |
|
13731 | function replaceInNativeArray(array, start, deleteCount, items) {
|
13732 | arrayContentWillChange(array, start, deleteCount, items.length);
|
13733 |
|
13734 | if (items.length <= CHUNK_SIZE) {
|
13735 | array.splice(start, deleteCount, ...items);
|
13736 | } else {
|
13737 | array.splice(start, deleteCount);
|
13738 |
|
13739 | for (var i = 0; i < items.length; i += CHUNK_SIZE) {
|
13740 | var chunk = items.slice(i, i + CHUNK_SIZE);
|
13741 | array.splice(start + i, 0, ...chunk);
|
13742 | }
|
13743 | }
|
13744 |
|
13745 | arrayContentDidChange(array, start, deleteCount, items.length);
|
13746 | }
|
13747 |
|
13748 | function arrayObserversHelper(obj, target, opts, operation, notify) {
|
13749 | var willChange = opts && opts.willChange || 'arrayWillChange';
|
13750 | var didChange = opts && opts.didChange || 'arrayDidChange';
|
13751 | var hasObservers = obj.hasArrayObservers;
|
13752 | operation(obj, '@array:before', target, willChange);
|
13753 | operation(obj, '@array:change', target, didChange);
|
13754 |
|
13755 | if (hasObservers === notify) {
|
13756 | notifyPropertyChange(obj, 'hasArrayObservers');
|
13757 | }
|
13758 |
|
13759 | return obj;
|
13760 | }
|
13761 |
|
13762 | function addArrayObserver(array, target, opts) {
|
13763 | return arrayObserversHelper(array, target, opts, addListener, false);
|
13764 | }
|
13765 |
|
13766 | function removeArrayObserver(array, target, opts) {
|
13767 | return arrayObserversHelper(array, target, opts, removeListener, true);
|
13768 | }
|
13769 |
|
13770 | var CHAIN_PASS_THROUGH = new _polyfills._WeakSet();
|
13771 |
|
13772 | function finishLazyChains(meta$$1, key, value) {
|
13773 | var lazyTags = meta$$1.readableLazyChainsFor(key);
|
13774 |
|
13775 | if (lazyTags === undefined) {
|
13776 | return;
|
13777 | }
|
13778 |
|
13779 | if ((0, _utils.isObject)(value)) {
|
13780 | for (var i = 0; i < lazyTags.length; i++) {
|
13781 | var [tag, deps] = lazyTags[i];
|
13782 | (0, _validator.updateTag)(tag, getChainTagsForKey(value, deps, (0, _validator.tagMetaFor)(value), (0, _meta2.peekMeta)(value)));
|
13783 | }
|
13784 | }
|
13785 |
|
13786 | lazyTags.length = 0;
|
13787 | }
|
13788 |
|
13789 | function getChainTagsForKeys(obj, keys, tagMeta, meta$$1) {
|
13790 | var tags = [];
|
13791 |
|
13792 | for (var i = 0; i < keys.length; i++) {
|
13793 | getChainTags(tags, obj, keys[i], tagMeta, meta$$1);
|
13794 | }
|
13795 |
|
13796 | return (0, _validator.combine)(tags);
|
13797 | }
|
13798 |
|
13799 | function getChainTagsForKey(obj, key, tagMeta, meta$$1) {
|
13800 | return (0, _validator.combine)(getChainTags([], obj, key, tagMeta, meta$$1));
|
13801 | }
|
13802 |
|
13803 | function getChainTags(chainTags, obj, path, tagMeta, meta$$1) {
|
13804 | var current = obj;
|
13805 | var currentTagMeta = tagMeta;
|
13806 | var currentMeta = meta$$1;
|
13807 | var pathLength = path.length;
|
13808 | var segmentEnd = -1;
|
13809 |
|
13810 | var segment, descriptor;
|
13811 |
|
13812 | while (true) {
|
13813 | var lastSegmentEnd = segmentEnd + 1;
|
13814 | segmentEnd = path.indexOf('.', lastSegmentEnd);
|
13815 |
|
13816 | if (segmentEnd === -1) {
|
13817 | segmentEnd = pathLength;
|
13818 | }
|
13819 |
|
13820 | segment = path.slice(lastSegmentEnd, segmentEnd);
|
13821 |
|
13822 | if (segment === '@each' && segmentEnd !== pathLength) {
|
13823 | lastSegmentEnd = segmentEnd + 1;
|
13824 | segmentEnd = path.indexOf('.', lastSegmentEnd);
|
13825 |
|
13826 | (true && !(segmentEnd === -1) && (0, _debug.deprecate)(`When using @each in a dependent-key or an observer, ` + `you can only chain one property level deep after ` + `the @each. That is, \`${path.slice(0, segmentEnd)}\` ` + `is allowed but \`${path}\` (which is what you passed) ` + `is not.\n\n` + `This was never supported. Currently, the extra segments ` + `are silently ignored, i.e. \`${path}\` behaves exactly ` + `the same as \`${path.slice(0, segmentEnd)}\`. ` + `In the future, this will throw an error.\n\n` + `If the current behavior is acceptable for your use case, ` + `please remove the extraneous segments by changing your ` + `key to \`${path.slice(0, segmentEnd)}\`. ` + `Otherwise, please create an intermediary computed property ` + `or switch to using tracked properties.`, segmentEnd === -1, {
|
13827 | until: '3.17.0',
|
13828 | id: 'ember-metal.computed-deep-each'
|
13829 | }));
|
13830 | var arrLength = current.length;
|
13831 |
|
13832 | if (typeof arrLength !== 'number' ||
|
13833 | !(Array.isArray(current) || 'objectAt' in current)) {
|
13834 |
|
13835 |
|
13836 | break;
|
13837 | } else if (arrLength === 0) {
|
13838 |
|
13839 | chainTags.push(tagForProperty(current, '[]'));
|
13840 | break;
|
13841 | }
|
13842 |
|
13843 | if (segmentEnd === -1) {
|
13844 | segment = path.slice(lastSegmentEnd);
|
13845 | } else {
|
13846 |
|
13847 | segment = path.slice(lastSegmentEnd, segmentEnd);
|
13848 | }
|
13849 |
|
13850 |
|
13851 | for (var i = 0; i < arrLength; i++) {
|
13852 | var item = objectAt(current, i);
|
13853 |
|
13854 | if (item) {
|
13855 | (true && !(typeof item === 'object') && (0, _debug.assert)(`When using @each to observe the array \`${current.toString()}\`, the items in the array must be objects`, typeof item === 'object'));
|
13856 | chainTags.push(tagForProperty(item, segment, true));
|
13857 | }
|
13858 | }
|
13859 |
|
13860 |
|
13861 | chainTags.push(tagForProperty(current, '[]', true, currentTagMeta));
|
13862 | break;
|
13863 | }
|
13864 |
|
13865 | var propertyTag = tagForProperty(current, segment, true, currentTagMeta);
|
13866 | descriptor = currentMeta !== null ? currentMeta.peekDescriptors(segment) : undefined;
|
13867 | chainTags.push(propertyTag);
|
13868 |
|
13869 |
|
13870 |
|
13871 | if (segmentEnd === pathLength) {
|
13872 |
|
13873 |
|
13874 |
|
13875 | if (CHAIN_PASS_THROUGH.has(descriptor)) {
|
13876 |
|
13877 | current[segment];
|
13878 | }
|
13879 |
|
13880 | break;
|
13881 | }
|
13882 |
|
13883 | if (descriptor === undefined) {
|
13884 |
|
13885 |
|
13886 | if (!(segment in current) && typeof current.unknownProperty === 'function') {
|
13887 | current = current.unknownProperty(segment);
|
13888 | } else {
|
13889 | current = current[segment];
|
13890 | }
|
13891 | } else if (CHAIN_PASS_THROUGH.has(descriptor)) {
|
13892 | current = current[segment];
|
13893 | } else {
|
13894 |
|
13895 |
|
13896 |
|
13897 |
|
13898 |
|
13899 | var instanceMeta = currentMeta.source === current ? currentMeta : (0, _meta2.meta)(current);
|
13900 | var lastRevision = instanceMeta.revisionFor(segment);
|
13901 |
|
13902 | if (lastRevision !== undefined && (0, _validator.validateTag)(propertyTag, lastRevision)) {
|
13903 | current = instanceMeta.valueFor(segment);
|
13904 | } else {
|
13905 |
|
13906 | var lazyChains = instanceMeta.writableLazyChainsFor(segment);
|
13907 | var rest = path.substr(segmentEnd + 1);
|
13908 | var placeholderTag = (0, _validator.createUpdatableTag)();
|
13909 | lazyChains.push([placeholderTag, rest]);
|
13910 | chainTags.push(placeholderTag);
|
13911 | break;
|
13912 | }
|
13913 | }
|
13914 |
|
13915 | if (!(0, _utils.isObject)(current)) {
|
13916 |
|
13917 | break;
|
13918 | }
|
13919 |
|
13920 | currentTagMeta = (0, _validator.tagMetaFor)(current);
|
13921 | currentMeta = (0, _meta2.peekMeta)(current);
|
13922 | }
|
13923 |
|
13924 | return chainTags;
|
13925 | }
|
13926 |
|
13927 | function isElementDescriptor(args) {
|
13928 | var [maybeTarget, maybeKey, maybeDesc] = args;
|
13929 | return (
|
13930 | args.length === 3 && (
|
13931 | typeof maybeTarget === 'function' || typeof maybeTarget === 'object' && maybeTarget !== null) &&
|
13932 | typeof maybeKey === 'string' && (
|
13933 | typeof maybeDesc === 'object' && maybeDesc !== null || maybeDesc === undefined)
|
13934 | );
|
13935 | }
|
13936 |
|
13937 | function nativeDescDecorator(propertyDesc) {
|
13938 | var decorator = function () {
|
13939 | return propertyDesc;
|
13940 | };
|
13941 |
|
13942 | setClassicDecorator(decorator);
|
13943 | return decorator;
|
13944 | }
|
13945 | |
13946 |
|
13947 |
|
13948 |
|
13949 |
|
13950 |
|
13951 |
|
13952 |
|
13953 |
|
13954 | class ComputedDescriptor {
|
13955 | constructor() {
|
13956 | this.enumerable = true;
|
13957 | this.configurable = true;
|
13958 | this._dependentKeys = undefined;
|
13959 | this._meta = undefined;
|
13960 | }
|
13961 |
|
13962 | setup(_obj, keyName, _propertyDesc, meta$$1) {
|
13963 | meta$$1.writeDescriptors(keyName, this);
|
13964 | }
|
13965 |
|
13966 | teardown(_obj, keyName, meta$$1) {
|
13967 | meta$$1.removeDescriptors(keyName);
|
13968 | }
|
13969 |
|
13970 | }
|
13971 |
|
13972 | function DESCRIPTOR_GETTER_FUNCTION(name, descriptor) {
|
13973 | return function CPGETTER_FUNCTION() {
|
13974 | return descriptor.get(this, name);
|
13975 | };
|
13976 | }
|
13977 |
|
13978 | function DESCRIPTOR_SETTER_FUNCTION(name, descriptor) {
|
13979 | return function CPSETTER_FUNCTION(value) {
|
13980 | return descriptor.set(this, name, value);
|
13981 | };
|
13982 | }
|
13983 |
|
13984 | function makeComputedDecorator(desc, DecoratorClass) {
|
13985 | var decorator = function COMPUTED_DECORATOR(target, key, propertyDesc, maybeMeta, isClassicDecorator) {
|
13986 | (true && !(isClassicDecorator || !propertyDesc || !propertyDesc.get || propertyDesc.get.toString().indexOf('CPGETTER_FUNCTION') === -1) && (0, _debug.assert)(`Only one computed property decorator can be applied to a class field or accessor, but '${key}' was decorated twice. You may have added the decorator to both a getter and setter, which is unnecessary.`, isClassicDecorator || !propertyDesc || !propertyDesc.get || propertyDesc.get.toString().indexOf('CPGETTER_FUNCTION') === -1));
|
13987 | var meta$$1 = arguments.length === 3 ? (0, _meta2.meta)(target) : maybeMeta;
|
13988 | desc.setup(target, key, propertyDesc, meta$$1);
|
13989 | var computedDesc = {
|
13990 | enumerable: desc.enumerable,
|
13991 | configurable: desc.configurable,
|
13992 | get: DESCRIPTOR_GETTER_FUNCTION(key, desc),
|
13993 | set: DESCRIPTOR_SETTER_FUNCTION(key, desc)
|
13994 | };
|
13995 | return computedDesc;
|
13996 | };
|
13997 |
|
13998 | setClassicDecorator(decorator, desc);
|
13999 | Object.setPrototypeOf(decorator, DecoratorClass.prototype);
|
14000 | return decorator;
|
14001 | } /////////////
|
14002 |
|
14003 |
|
14004 | var DECORATOR_DESCRIPTOR_MAP = new WeakMap();
|
14005 | /**
|
14006 | Returns the CP descriptor associated with `obj` and `keyName`, if any.
|
14007 |
|
14008 | @method descriptorForProperty
|
14009 | @param {Object} obj the object to check
|
14010 | @param {String} keyName the key to check
|
14011 | @return {Descriptor}
|
14012 | @private
|
14013 | */
|
14014 |
|
14015 | function descriptorForProperty(obj, keyName, _meta) {
|
14016 | (true && !(obj !== null) && (0, _debug.assert)('Cannot call `descriptorForProperty` on null', obj !== null));
|
14017 | (true && !(obj !== undefined) && (0, _debug.assert)('Cannot call `descriptorForProperty` on undefined', obj !== undefined));
|
14018 | (true && !(typeof obj === 'object' || typeof obj === 'function') && (0, _debug.assert)(`Cannot call \`descriptorForProperty\` on ${typeof obj}`, typeof obj === 'object' || typeof obj === 'function'));
|
14019 | var meta$$1 = _meta === undefined ? (0, _meta2.peekMeta)(obj) : _meta;
|
14020 |
|
14021 | if (meta$$1 !== null) {
|
14022 | return meta$$1.peekDescriptors(keyName);
|
14023 | }
|
14024 | }
|
14025 |
|
14026 | function descriptorForDecorator(dec) {
|
14027 | return DECORATOR_DESCRIPTOR_MAP.get(dec);
|
14028 | }
|
14029 | |
14030 |
|
14031 |
|
14032 |
|
14033 |
|
14034 |
|
14035 |
|
14036 |
|
14037 |
|
14038 |
|
14039 | function isClassicDecorator(dec) {
|
14040 | return typeof dec === 'function' && DECORATOR_DESCRIPTOR_MAP.has(dec);
|
14041 | }
|
14042 | |
14043 |
|
14044 |
|
14045 |
|
14046 |
|
14047 |
|
14048 |
|
14049 |
|
14050 |
|
14051 | function setClassicDecorator(dec, value = true) {
|
14052 | DECORATOR_DESCRIPTOR_MAP.set(dec, value);
|
14053 | }
|
14054 | |
14055 |
|
14056 |
|
14057 |
|
14058 |
|
14059 | var END_WITH_EACH_REGEX = /\.@each$/;
|
14060 | |
14061 |
|
14062 |
|
14063 |
|
14064 |
|
14065 |
|
14066 |
|
14067 |
|
14068 |
|
14069 |
|
14070 |
|
14071 |
|
14072 |
|
14073 |
|
14074 |
|
14075 |
|
14076 |
|
14077 |
|
14078 |
|
14079 |
|
14080 |
|
14081 |
|
14082 |
|
14083 |
|
14084 |
|
14085 |
|
14086 |
|
14087 |
|
14088 |
|
14089 |
|
14090 |
|
14091 | function expandProperties(pattern, callback) {
|
14092 | (true && !(typeof pattern === 'string') && (0, _debug.assert)(`A computed property key must be a string, you passed ${typeof pattern} ${pattern}`, typeof pattern === 'string'));
|
14093 | (true && !(pattern.indexOf(' ') === -1) && (0, _debug.assert)('Brace expanded properties cannot contain spaces, e.g. "user.{firstName, lastName}" should be "user.{firstName,lastName}"', pattern.indexOf(' ') === -1));
|
14094 |
|
14095 | (true && !(pattern.match(/\{[^}{]*\{|\}[^}{]*\}|\{[^}]*$/g) === null) && (0, _debug.assert)(`Brace expanded properties have to be balanced and cannot be nested, pattern: ${pattern}`, pattern.match(/\{[^}{]*\{|\}[^}{]*\}|\{[^}]*$/g) === null));
|
14096 | var start = pattern.indexOf('{');
|
14097 |
|
14098 | if (start < 0) {
|
14099 | callback(pattern.replace(END_WITH_EACH_REGEX, '.[]'));
|
14100 | } else {
|
14101 | dive('', pattern, start, callback);
|
14102 | }
|
14103 | }
|
14104 |
|
14105 | function dive(prefix, pattern, start, callback) {
|
14106 | var end = pattern.indexOf('}'),
|
14107 | i = 0,
|
14108 | newStart,
|
14109 | arrayLength;
|
14110 | var tempArr = pattern.substring(start + 1, end).split(',');
|
14111 | var after = pattern.substring(end + 1);
|
14112 | prefix = prefix + pattern.substring(0, start);
|
14113 | arrayLength = tempArr.length;
|
14114 |
|
14115 | while (i < arrayLength) {
|
14116 | newStart = after.indexOf('{');
|
14117 |
|
14118 | if (newStart < 0) {
|
14119 | callback((prefix + tempArr[i++] + after).replace(END_WITH_EACH_REGEX, '.[]'));
|
14120 | } else {
|
14121 | dive(prefix + tempArr[i++], after, newStart, callback);
|
14122 | }
|
14123 | }
|
14124 | }
|
14125 | |
14126 |
|
14127 |
|
14128 |
|
14129 | |
14130 |
|
14131 |
|
14132 |
|
14133 |
|
14134 |
|
14135 |
|
14136 |
|
14137 |
|
14138 |
|
14139 |
|
14140 |
|
14141 |
|
14142 |
|
14143 |
|
14144 |
|
14145 |
|
14146 |
|
14147 |
|
14148 |
|
14149 |
|
14150 |
|
14151 |
|
14152 |
|
14153 |
|
14154 |
|
14155 |
|
14156 |
|
14157 |
|
14158 |
|
14159 |
|
14160 |
|
14161 |
|
14162 |
|
14163 |
|
14164 |
|
14165 |
|
14166 |
|
14167 |
|
14168 |
|
14169 |
|
14170 |
|
14171 |
|
14172 |
|
14173 |
|
14174 |
|
14175 |
|
14176 |
|
14177 |
|
14178 |
|
14179 | function defineProperty(obj, keyName, desc, data, _meta) {
|
14180 | var meta$$1 = _meta === undefined ? (0, _meta2.meta)(obj) : _meta;
|
14181 | var previousDesc = descriptorForProperty(obj, keyName, meta$$1);
|
14182 | var wasDescriptor = previousDesc !== undefined;
|
14183 |
|
14184 | if (wasDescriptor) {
|
14185 | previousDesc.teardown(obj, keyName, meta$$1);
|
14186 | }
|
14187 |
|
14188 | if (isClassicDecorator(desc)) {
|
14189 | defineDecorator(obj, keyName, desc, meta$$1);
|
14190 | } else if (desc === null || desc === undefined) {
|
14191 | defineValue(obj, keyName, data, wasDescriptor, true);
|
14192 | } else {
|
14193 |
|
14194 | Object.defineProperty(obj, keyName, desc);
|
14195 | }
|
14196 |
|
14197 |
|
14198 |
|
14199 | if (!meta$$1.isPrototypeMeta(obj)) {
|
14200 | revalidateObservers(obj);
|
14201 | }
|
14202 | }
|
14203 |
|
14204 | function defineDecorator(obj, keyName, desc, meta$$1) {
|
14205 | var propertyDesc;
|
14206 |
|
14207 | if (true
|
14208 |
|
14209 | ) {
|
14210 | propertyDesc = desc(obj, keyName, undefined, meta$$1, true);
|
14211 | } else {
|
14212 | propertyDesc = desc(obj, keyName, undefined, meta$$1);
|
14213 | }
|
14214 |
|
14215 | Object.defineProperty(obj, keyName, propertyDesc);
|
14216 |
|
14217 | return desc;
|
14218 | }
|
14219 |
|
14220 | function defineValue(obj, keyName, value, wasDescriptor, enumerable = true) {
|
14221 | if (wasDescriptor === true || enumerable === false) {
|
14222 | Object.defineProperty(obj, keyName, {
|
14223 | configurable: true,
|
14224 | enumerable,
|
14225 | writable: true,
|
14226 | value
|
14227 | });
|
14228 | } else {
|
14229 | if (true
|
14230 |
|
14231 | ) {
|
14232 | (0, _utils.setWithMandatorySetter)(obj, keyName, value);
|
14233 | } else {
|
14234 | obj[keyName] = value;
|
14235 | }
|
14236 | }
|
14237 |
|
14238 | return value;
|
14239 | }
|
14240 |
|
14241 | var firstDotIndexCache = new _utils.Cache(1000, key => key.indexOf('.'));
|
14242 |
|
14243 | function isPath(path) {
|
14244 | return typeof path === 'string' && firstDotIndexCache.get(path) !== -1;
|
14245 | }
|
14246 | |
14247 |
|
14248 |
|
14249 |
|
14250 |
|
14251 | var PROXY_CONTENT = (0, _utils.symbol)('PROXY_CONTENT');
|
14252 | _exports.PROXY_CONTENT = PROXY_CONTENT;
|
14253 | var getPossibleMandatoryProxyValue;
|
14254 |
|
14255 | if (true
|
14256 |
|
14257 | && _utils.HAS_NATIVE_PROXY) {
|
14258 | getPossibleMandatoryProxyValue = function getPossibleMandatoryProxyValue(obj, keyName) {
|
14259 | var content = obj[PROXY_CONTENT];
|
14260 |
|
14261 | if (content === undefined) {
|
14262 | return obj[keyName];
|
14263 | } else {
|
14264 |
|
14265 | return Reflect.get(content, keyName, obj);
|
14266 | }
|
14267 | };
|
14268 | }
|
14269 |
|
14270 |
|
14271 |
|
14272 |
|
14273 |
|
14274 |
|
14275 | |
14276 |
|
14277 |
|
14278 |
|
14279 |
|
14280 |
|
14281 |
|
14282 |
|
14283 |
|
14284 |
|
14285 |
|
14286 |
|
14287 |
|
14288 |
|
14289 |
|
14290 |
|
14291 |
|
14292 |
|
14293 |
|
14294 |
|
14295 |
|
14296 |
|
14297 |
|
14298 |
|
14299 |
|
14300 |
|
14301 |
|
14302 |
|
14303 |
|
14304 |
|
14305 |
|
14306 |
|
14307 |
|
14308 | function get(obj, keyName) {
|
14309 | (true && !(arguments.length === 2) && (0, _debug.assert)(`Get must be called with two arguments; an object and a property key`, arguments.length === 2));
|
14310 | (true && !(obj !== undefined && obj !== null) && (0, _debug.assert)(`Cannot call get with '${keyName}' on an undefined object.`, obj !== undefined && obj !== null));
|
14311 | (true && !(typeof keyName === 'string' || typeof keyName === 'number' && !isNaN(keyName)) && (0, _debug.assert)(`The key provided to get must be a string or number, you passed ${keyName}`, typeof keyName === 'string' || typeof keyName === 'number' && !isNaN(keyName)));
|
14312 | (true && !(typeof keyName !== 'string' || keyName.lastIndexOf('this.', 0) !== 0) && (0, _debug.assert)(`'this' in paths is not supported`, typeof keyName !== 'string' || keyName.lastIndexOf('this.', 0) !== 0));
|
14313 | return isPath(keyName) ? _getPath(obj, keyName) : _getProp(obj, keyName);
|
14314 | }
|
14315 |
|
14316 | function _getProp(obj, keyName) {
|
14317 | var type = typeof obj;
|
14318 | var isObject$$1 = type === 'object';
|
14319 | var isFunction = type === 'function';
|
14320 | var isObjectLike = isObject$$1 || isFunction;
|
14321 | var value;
|
14322 |
|
14323 | if (isObjectLike) {
|
14324 | if (true
|
14325 |
|
14326 | && _utils.HAS_NATIVE_PROXY) {
|
14327 | value = getPossibleMandatoryProxyValue(obj, keyName);
|
14328 | } else {
|
14329 | value = obj[keyName];
|
14330 | }
|
14331 |
|
14332 | if (value === undefined && isObject$$1 && !(keyName in obj) && typeof obj.unknownProperty === 'function') {
|
14333 | if (true
|
14334 |
|
14335 | ) {
|
14336 | (0, _validator.deprecateMutationsInAutotrackingTransaction)(() => {
|
14337 | value = obj.unknownProperty(keyName);
|
14338 | });
|
14339 | } else {
|
14340 | value = obj.unknownProperty(keyName);
|
14341 | }
|
14342 | }
|
14343 |
|
14344 | if ((0, _validator.isTracking)()) {
|
14345 | (0, _validator.consumeTag)((0, _validator.tagFor)(obj, keyName));
|
14346 |
|
14347 | if (Array.isArray(value) || (0, _utils.isEmberArray)(value)) {
|
14348 |
|
14349 |
|
14350 | (0, _validator.consumeTag)((0, _validator.tagFor)(value, '[]'));
|
14351 | }
|
14352 | }
|
14353 | } else {
|
14354 | value = obj[keyName];
|
14355 | }
|
14356 |
|
14357 | return value;
|
14358 | }
|
14359 |
|
14360 | function _getPath(root, path) {
|
14361 | var obj = root;
|
14362 | var parts = typeof path === 'string' ? path.split('.') : path;
|
14363 |
|
14364 | for (var i = 0; i < parts.length; i++) {
|
14365 | if (obj === undefined || obj === null || obj.isDestroyed) {
|
14366 | return undefined;
|
14367 | }
|
14368 |
|
14369 | obj = _getProp(obj, parts[i]);
|
14370 | }
|
14371 |
|
14372 | return obj;
|
14373 | }
|
14374 | |
14375 |
|
14376 |
|
14377 |
|
14378 |
|
14379 |
|
14380 |
|
14381 |
|
14382 |
|
14383 |
|
14384 |
|
14385 |
|
14386 |
|
14387 |
|
14388 |
|
14389 |
|
14390 |
|
14391 |
|
14392 |
|
14393 |
|
14394 |
|
14395 | function getWithDefault(root, key, defaultValue) {
|
14396 | (true && !(false) && (0, _debug.deprecate)('Using getWithDefault has been deprecated. Instead, consider using Ember get and explicitly checking for undefined.', false, {
|
14397 | id: 'ember-metal.get-with-default',
|
14398 | until: '4.0.0',
|
14399 | url: 'https://deprecations.emberjs.com/v3.x#toc_ember-metal-get-with-default'
|
14400 | }));
|
14401 | var value = get(root, key);
|
14402 |
|
14403 | if (value === undefined) {
|
14404 | return defaultValue;
|
14405 | }
|
14406 |
|
14407 | return value;
|
14408 | }
|
14409 |
|
14410 | _getProp('foo', 'a');
|
14411 |
|
14412 | _getProp('foo', 1);
|
14413 |
|
14414 | _getProp({}, 'a');
|
14415 |
|
14416 | _getProp({}, 1);
|
14417 |
|
14418 | _getProp({
|
14419 | unkonwnProperty() {}
|
14420 |
|
14421 | }, 'a');
|
14422 |
|
14423 | _getProp({
|
14424 | unkonwnProperty() {}
|
14425 |
|
14426 | }, 1);
|
14427 |
|
14428 | get({}, 'foo');
|
14429 | get({}, 'foo.bar');
|
14430 | var fakeProxy = {};
|
14431 | (0, _utils.setProxy)(fakeProxy);
|
14432 | (0, _validator.track)(() => _getProp({}, 'a'));
|
14433 | (0, _validator.track)(() => _getProp({}, 1));
|
14434 | (0, _validator.track)(() => _getProp({
|
14435 | a: []
|
14436 | }, 'a'));
|
14437 | (0, _validator.track)(() => _getProp({
|
14438 | a: fakeProxy
|
14439 | }, 'a'));
|
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 |
|
14466 |
|
14467 | function set(obj, keyName, value, tolerant) {
|
14468 | (true && !(arguments.length === 3 || arguments.length === 4) && (0, _debug.assert)(`Set must be called with three or four arguments; an object, a property key, a value and tolerant true/false`, arguments.length === 3 || arguments.length === 4));
|
14469 | (true && !(obj && typeof obj === 'object' || typeof obj === 'function') && (0, _debug.assert)(`Cannot call set with '${keyName}' on an undefined object.`, obj && typeof obj === 'object' || typeof obj === 'function'));
|
14470 | (true && !(typeof keyName === 'string' || typeof keyName === 'number' && !isNaN(keyName)) && (0, _debug.assert)(`The key provided to set must be a string or number, you passed ${keyName}`, typeof keyName === 'string' || typeof keyName === 'number' && !isNaN(keyName)));
|
14471 | (true && !(typeof keyName !== 'string' || keyName.lastIndexOf('this.', 0) !== 0) && (0, _debug.assert)(`'this' in paths is not supported`, typeof keyName !== 'string' || keyName.lastIndexOf('this.', 0) !== 0));
|
14472 |
|
14473 | if (obj.isDestroyed) {
|
14474 | (true && !(tolerant) && (0, _debug.assert)(`calling set on destroyed object: ${(0, _utils.toString)(obj)}.${keyName} = ${(0, _utils.toString)(value)}`, tolerant));
|
14475 | return;
|
14476 | }
|
14477 |
|
14478 | if (isPath(keyName)) {
|
14479 | return setPath(obj, keyName, value, tolerant);
|
14480 | }
|
14481 |
|
14482 | var descriptor = descriptorForProperty(obj, keyName);
|
14483 |
|
14484 | if (descriptor !== undefined) {
|
14485 | descriptor.set(obj, keyName, value);
|
14486 | return value;
|
14487 | }
|
14488 |
|
14489 | var currentValue;
|
14490 |
|
14491 | if (true
|
14492 |
|
14493 | && _utils.HAS_NATIVE_PROXY) {
|
14494 | currentValue = getPossibleMandatoryProxyValue(obj, keyName);
|
14495 | } else {
|
14496 | currentValue = obj[keyName];
|
14497 | }
|
14498 |
|
14499 | if (currentValue === undefined && 'object' === typeof obj && !(keyName in obj) && typeof obj.setUnknownProperty === 'function') {
|
14500 |
|
14501 | obj.setUnknownProperty(keyName, value);
|
14502 | } else {
|
14503 | if (true
|
14504 |
|
14505 | ) {
|
14506 | (0, _utils.setWithMandatorySetter)(obj, keyName, value);
|
14507 | } else {
|
14508 | obj[keyName] = value;
|
14509 | }
|
14510 |
|
14511 | if (currentValue !== value) {
|
14512 | notifyPropertyChange(obj, keyName);
|
14513 | }
|
14514 | }
|
14515 |
|
14516 | return value;
|
14517 | }
|
14518 |
|
14519 | function setPath(root, path, value, tolerant) {
|
14520 | var parts = path.split('.');
|
14521 | var keyName = parts.pop();
|
14522 | (true && !(keyName.trim().length > 0) && (0, _debug.assert)('Property set failed: You passed an empty path', keyName.trim().length > 0));
|
14523 |
|
14524 | var newRoot = _getPath(root, parts);
|
14525 |
|
14526 | if (newRoot !== null && newRoot !== undefined) {
|
14527 | return set(newRoot, keyName, value);
|
14528 | } else if (!tolerant) {
|
14529 | throw new _error.default(`Property set failed: object in path "${parts.join('.')}" could not be found.`);
|
14530 | }
|
14531 | }
|
14532 | |
14533 |
|
14534 |
|
14535 |
|
14536 |
|
14537 |
|
14538 |
|
14539 |
|
14540 |
|
14541 |
|
14542 |
|
14543 |
|
14544 |
|
14545 |
|
14546 |
|
14547 |
|
14548 |
|
14549 |
|
14550 |
|
14551 |
|
14552 |
|
14553 |
|
14554 |
|
14555 |
|
14556 | function trySet(root, path, value) {
|
14557 | return set(root, path, value, true);
|
14558 | }
|
14559 | /**
|
14560 | @module @ember/object
|
14561 | */
|
14562 |
|
14563 |
|
14564 | var DEEP_EACH_REGEX = /\.@each\.[^.]+\./;
|
14565 |
|
14566 | function noop() {}
|
14567 | |
14568 |
|
14569 |
|
14570 |
|
14571 |
|
14572 |
|
14573 |
|
14574 |
|
14575 |
|
14576 |
|
14577 |
|
14578 |
|
14579 |
|
14580 |
|
14581 |
|
14582 |
|
14583 |
|
14584 |
|
14585 |
|
14586 |
|
14587 |
|
14588 |
|
14589 |
|
14590 |
|
14591 |
|
14592 |
|
14593 |
|
14594 |
|
14595 |
|
14596 |
|
14597 |
|
14598 |
|
14599 |
|
14600 |
|
14601 |
|
14602 |
|
14603 |
|
14604 |
|
14605 |
|
14606 |
|
14607 |
|
14608 |
|
14609 |
|
14610 |
|
14611 |
|
14612 |
|
14613 |
|
14614 |
|
14615 |
|
14616 |
|
14617 |
|
14618 |
|
14619 |
|
14620 |
|
14621 |
|
14622 |
|
14623 |
|
14624 |
|
14625 |
|
14626 |
|
14627 |
|
14628 |
|
14629 |
|
14630 |
|
14631 |
|
14632 |
|
14633 |
|
14634 |
|
14635 |
|
14636 |
|
14637 |
|
14638 |
|
14639 |
|
14640 |
|
14641 |
|
14642 |
|
14643 |
|
14644 |
|
14645 |
|
14646 |
|
14647 |
|
14648 |
|
14649 |
|
14650 |
|
14651 |
|
14652 |
|
14653 |
|
14654 |
|
14655 |
|
14656 |
|
14657 |
|
14658 |
|
14659 |
|
14660 |
|
14661 |
|
14662 |
|
14663 |
|
14664 |
|
14665 |
|
14666 |
|
14667 |
|
14668 |
|
14669 |
|
14670 |
|
14671 |
|
14672 |
|
14673 |
|
14674 |
|
14675 |
|
14676 |
|
14677 |
|
14678 |
|
14679 |
|
14680 |
|
14681 |
|
14682 |
|
14683 |
|
14684 |
|
14685 |
|
14686 |
|
14687 |
|
14688 |
|
14689 |
|
14690 |
|
14691 |
|
14692 |
|
14693 |
|
14694 |
|
14695 |
|
14696 |
|
14697 |
|
14698 |
|
14699 |
|
14700 |
|
14701 |
|
14702 |
|
14703 |
|
14704 |
|
14705 |
|
14706 |
|
14707 |
|
14708 |
|
14709 |
|
14710 |
|
14711 |
|
14712 |
|
14713 |
|
14714 |
|
14715 |
|
14716 |
|
14717 |
|
14718 |
|
14719 |
|
14720 |
|
14721 |
|
14722 |
|
14723 |
|
14724 |
|
14725 |
|
14726 |
|
14727 |
|
14728 |
|
14729 |
|
14730 |
|
14731 |
|
14732 |
|
14733 |
|
14734 |
|
14735 |
|
14736 |
|
14737 |
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 |
|
14749 |
|
14750 |
|
14751 |
|
14752 |
|
14753 |
|
14754 |
|
14755 |
|
14756 |
|
14757 |
|
14758 |
|
14759 |
|
14760 |
|
14761 |
|
14762 |
|
14763 |
|
14764 |
|
14765 | class ComputedProperty extends ComputedDescriptor {
|
14766 | constructor(args) {
|
14767 | super();
|
14768 | this._volatile = false;
|
14769 | this._readOnly = false;
|
14770 | this._hasConfig = false;
|
14771 | this._getter = undefined;
|
14772 | this._setter = undefined;
|
14773 | var maybeConfig = args[args.length - 1];
|
14774 |
|
14775 | if (typeof maybeConfig === 'function' || maybeConfig !== null && typeof maybeConfig === 'object') {
|
14776 | this._hasConfig = true;
|
14777 | var config = args.pop();
|
14778 |
|
14779 | if (typeof config === 'function') {
|
14780 | (true && !(!isClassicDecorator(config)) && (0, _debug.assert)(`You attempted to pass a computed property instance to computed(). Computed property instances are decorator functions, and cannot be passed to computed() because they cannot be turned into decorators twice`, !isClassicDecorator(config)));
|
14781 | this._getter = config;
|
14782 | } else {
|
14783 | var objectConfig = config;
|
14784 | (true && !(typeof objectConfig === 'object' && !Array.isArray(objectConfig)) && (0, _debug.assert)('computed expects a function or an object as last argument.', typeof objectConfig === 'object' && !Array.isArray(objectConfig)));
|
14785 | (true && !(Object.keys(objectConfig).every(key => key === 'get' || key === 'set')) && (0, _debug.assert)('Config object passed to computed can only contain `get` and `set` keys.', Object.keys(objectConfig).every(key => key === 'get' || key === 'set')));
|
14786 | (true && !(Boolean(objectConfig.get) || Boolean(objectConfig.set)) && (0, _debug.assert)('Computed properties must receive a getter or a setter, you passed none.', Boolean(objectConfig.get) || Boolean(objectConfig.set)));
|
14787 | this._getter = objectConfig.get || noop;
|
14788 | this._setter = objectConfig.set;
|
14789 | }
|
14790 | }
|
14791 |
|
14792 | if (args.length > 0) {
|
14793 | this._property(...args);
|
14794 | }
|
14795 | }
|
14796 |
|
14797 | setup(obj, keyName, propertyDesc, meta$$1) {
|
14798 | super.setup(obj, keyName, propertyDesc, meta$$1);
|
14799 | (true && !(!(propertyDesc && typeof propertyDesc.value === 'function')) && (0, _debug.assert)(`@computed can only be used on accessors or fields, attempted to use it with ${keyName} but that was a method. Try converting it to a getter (e.g. \`get ${keyName}() {}\`)`, !(propertyDesc && typeof propertyDesc.value === 'function')));
|
14800 | (true && !(!propertyDesc || !propertyDesc.initializer) && (0, _debug.assert)(`@computed can only be used on empty fields. ${keyName} has an initial value (e.g. \`${keyName} = someValue\`)`, !propertyDesc || !propertyDesc.initializer));
|
14801 | (true && !(!(this._hasConfig && propertyDesc && (typeof propertyDesc.get === 'function' || typeof propertyDesc.set === 'function'))) && (0, _debug.assert)(`Attempted to apply a computed property that already has a getter/setter to a ${keyName}, but it is a method or an accessor. If you passed @computed a function or getter/setter (e.g. \`@computed({ get() { ... } })\`), then it must be applied to a field`, !(this._hasConfig && propertyDesc && (typeof propertyDesc.get === 'function' || typeof propertyDesc.set === 'function'))));
|
14802 |
|
14803 | if (true
|
14804 |
|
14805 | ) {
|
14806 | _validator.ALLOW_CYCLES.set((0, _validator.tagFor)(obj, keyName), true);
|
14807 | }
|
14808 |
|
14809 | if (this._hasConfig === false) {
|
14810 | (true && !(propertyDesc && (typeof propertyDesc.get === 'function' || typeof propertyDesc.set === 'function')) && (0, _debug.assert)(`Attempted to use @computed on ${keyName}, but it did not have a getter or a setter. You must either pass a get a function or getter/setter to @computed directly (e.g. \`@computed({ get() { ... } })\`) or apply @computed directly to a getter/setter`, propertyDesc && (typeof propertyDesc.get === 'function' || typeof propertyDesc.set === 'function')));
|
14811 | var {
|
14812 | get: _get2,
|
14813 | set: set$$1
|
14814 | } = propertyDesc;
|
14815 |
|
14816 | if (_get2 !== undefined) {
|
14817 | this._getter = _get2;
|
14818 | }
|
14819 |
|
14820 | if (set$$1 !== undefined) {
|
14821 | this._setter = function setterWrapper(_key, value) {
|
14822 | var ret = set$$1.call(this, value);
|
14823 |
|
14824 | if (_get2 !== undefined) {
|
14825 | return typeof ret === 'undefined' ? _get2.call(this) : ret;
|
14826 | }
|
14827 |
|
14828 | return ret;
|
14829 | };
|
14830 | }
|
14831 | }
|
14832 | }
|
14833 |
|
14834 | _property(...passedArgs) {
|
14835 | var args = [];
|
14836 |
|
14837 | function addArg(property) {
|
14838 | (true && (0, _debug.warn)(`Dependent keys containing @each only work one level deep. ` + `You used the key "${property}" which is invalid. ` + `Please create an intermediary computed property.`, DEEP_EACH_REGEX.test(property) === false, {
|
14839 | id: 'ember-metal.computed-deep-each'
|
14840 | }));
|
14841 | args.push(property);
|
14842 | }
|
14843 |
|
14844 | for (var i = 0; i < passedArgs.length; i++) {
|
14845 | expandProperties(passedArgs[i], addArg);
|
14846 | }
|
14847 |
|
14848 | this._dependentKeys = args;
|
14849 | }
|
14850 |
|
14851 | get(obj, keyName) {
|
14852 | if (this._volatile) {
|
14853 | return this._getter.call(obj, keyName);
|
14854 | }
|
14855 |
|
14856 | var meta$$1 = (0, _meta2.meta)(obj);
|
14857 | var tagMeta = (0, _validator.tagMetaFor)(obj);
|
14858 | var propertyTag = (0, _validator.tagFor)(obj, keyName, tagMeta);
|
14859 | var ret;
|
14860 | var revision = meta$$1.revisionFor(keyName);
|
14861 |
|
14862 | if (revision !== undefined && (0, _validator.validateTag)(propertyTag, revision)) {
|
14863 | ret = meta$$1.valueFor(keyName);
|
14864 | } else {
|
14865 |
|
14866 |
|
14867 | (true && !(this._dependentKeys === undefined || !(0, _runtime.isDestroyed)(obj)) && (0, _debug.assert)(`Attempted to access the computed ${obj}.${keyName} on a destroyed object, which is not allowed`, this._dependentKeys === undefined || !(0, _runtime.isDestroyed)(obj)));
|
14868 | var {
|
14869 | _getter,
|
14870 | _dependentKeys
|
14871 | } = this;
|
14872 |
|
14873 | (0, _validator.untrack)(() => {
|
14874 | ret = _getter.call(obj, keyName);
|
14875 | });
|
14876 |
|
14877 | if (_dependentKeys !== undefined) {
|
14878 | (0, _validator.updateTag)(propertyTag, getChainTagsForKeys(obj, _dependentKeys, tagMeta, meta$$1));
|
14879 | }
|
14880 |
|
14881 | meta$$1.setValueFor(keyName, ret);
|
14882 | meta$$1.setRevisionFor(keyName, (0, _validator.valueForTag)(propertyTag));
|
14883 | finishLazyChains(meta$$1, keyName, ret);
|
14884 | }
|
14885 |
|
14886 | (0, _validator.consumeTag)(propertyTag);
|
14887 |
|
14888 |
|
14889 | if (Array.isArray(ret)) {
|
14890 | (0, _validator.consumeTag)((0, _validator.tagFor)(ret, '[]'));
|
14891 | }
|
14892 |
|
14893 | return ret;
|
14894 | }
|
14895 |
|
14896 | set(obj, keyName, value) {
|
14897 | if (this._readOnly) {
|
14898 | this._throwReadOnlyError(obj, keyName);
|
14899 | }
|
14900 |
|
14901 | if (!this._setter) {
|
14902 | return this.clobberSet(obj, keyName, value);
|
14903 | }
|
14904 |
|
14905 | if (this._volatile) {
|
14906 | return this.volatileSet(obj, keyName, value);
|
14907 | }
|
14908 |
|
14909 | var meta$$1 = (0, _meta2.meta)(obj);
|
14910 |
|
14911 |
|
14912 |
|
14913 |
|
14914 |
|
14915 | if (
|
14916 | meta$$1.isInitializing() && this._dependentKeys !== undefined && this._dependentKeys.length > 0 &&
|
14917 | typeof obj[PROPERTY_DID_CHANGE] === 'function' && obj.isComponent) {
|
14918 | addObserver(obj, keyName, () => {
|
14919 | obj[PROPERTY_DID_CHANGE](keyName);
|
14920 | }, undefined, true);
|
14921 | }
|
14922 |
|
14923 | var ret;
|
14924 |
|
14925 | try {
|
14926 | beginPropertyChanges();
|
14927 | ret = this._set(obj, keyName, value, meta$$1);
|
14928 | finishLazyChains(meta$$1, keyName, ret);
|
14929 | var tagMeta = (0, _validator.tagMetaFor)(obj);
|
14930 | var propertyTag = (0, _validator.tagFor)(obj, keyName, tagMeta);
|
14931 | var {
|
14932 | _dependentKeys
|
14933 | } = this;
|
14934 |
|
14935 | if (_dependentKeys !== undefined) {
|
14936 | (0, _validator.updateTag)(propertyTag, getChainTagsForKeys(obj, _dependentKeys, tagMeta, meta$$1));
|
14937 | }
|
14938 |
|
14939 | meta$$1.setRevisionFor(keyName, (0, _validator.valueForTag)(propertyTag));
|
14940 | } finally {
|
14941 | endPropertyChanges();
|
14942 | }
|
14943 |
|
14944 | return ret;
|
14945 | }
|
14946 |
|
14947 | _throwReadOnlyError(obj, keyName) {
|
14948 | throw new _error.default(`Cannot set read-only property "${keyName}" on object: ${(0, _utils.inspect)(obj)}`);
|
14949 | }
|
14950 |
|
14951 | clobberSet(obj, keyName, value) {
|
14952 | (true && !(false) && (0, _debug.deprecate)(`The ${(0, _utils.toString)(obj)}#${keyName} computed property was just overridden. This removes the computed property and replaces it with a plain value, and has been deprecated. If you want this behavior, consider defining a setter which does it manually.`, false, {
|
14953 | id: 'computed-property.override',
|
14954 | until: '4.0.0',
|
14955 | url: 'https://emberjs.com/deprecations/v3.x#toc_computed-property-override'
|
14956 | }));
|
14957 | var cachedValue = (0, _meta2.meta)(obj).valueFor(keyName);
|
14958 | defineProperty(obj, keyName, null, cachedValue);
|
14959 | set(obj, keyName, value);
|
14960 | return value;
|
14961 | }
|
14962 |
|
14963 | volatileSet(obj, keyName, value) {
|
14964 | return this._setter.call(obj, keyName, value);
|
14965 | }
|
14966 |
|
14967 | _set(obj, keyName, value, meta$$1) {
|
14968 | var hadCachedValue = meta$$1.revisionFor(keyName) !== undefined;
|
14969 | var cachedValue = meta$$1.valueFor(keyName);
|
14970 | var ret;
|
14971 | var {
|
14972 | _setter
|
14973 | } = this;
|
14974 | setObserverSuspended(obj, keyName, true);
|
14975 |
|
14976 | try {
|
14977 | ret = _setter.call(obj, keyName, value, cachedValue);
|
14978 | } finally {
|
14979 | setObserverSuspended(obj, keyName, false);
|
14980 | }
|
14981 |
|
14982 |
|
14983 | if (hadCachedValue && cachedValue === ret) {
|
14984 | return ret;
|
14985 | }
|
14986 |
|
14987 | meta$$1.setValueFor(keyName, ret);
|
14988 | notifyPropertyChange(obj, keyName, meta$$1, value);
|
14989 | return ret;
|
14990 | }
|
14991 |
|
14992 |
|
14993 |
|
14994 | teardown(obj, keyName, meta$$1) {
|
14995 | if (!this._volatile) {
|
14996 | if (meta$$1.revisionFor(keyName) !== undefined) {
|
14997 | meta$$1.setRevisionFor(keyName, undefined);
|
14998 | meta$$1.setValueFor(keyName, undefined);
|
14999 | }
|
15000 | }
|
15001 |
|
15002 | super.teardown(obj, keyName, meta$$1);
|
15003 | }
|
15004 |
|
15005 | }
|
15006 |
|
15007 | _exports.ComputedProperty = ComputedProperty;
|
15008 |
|
15009 | class AutoComputedProperty extends ComputedProperty {
|
15010 | get(obj, keyName) {
|
15011 | if (this._volatile) {
|
15012 | return this._getter.call(obj, keyName);
|
15013 | }
|
15014 |
|
15015 | var meta$$1 = (0, _meta2.meta)(obj);
|
15016 | var tagMeta = (0, _validator.tagMetaFor)(obj);
|
15017 | var propertyTag = (0, _validator.tagFor)(obj, keyName, tagMeta);
|
15018 | var ret;
|
15019 | var revision = meta$$1.revisionFor(keyName);
|
15020 |
|
15021 | if (revision !== undefined && (0, _validator.validateTag)(propertyTag, revision)) {
|
15022 | ret = meta$$1.valueFor(keyName);
|
15023 | } else {
|
15024 | (true && !(!(0, _runtime.isDestroyed)(obj)) && (0, _debug.assert)(`Attempted to access the computed ${obj}.${keyName} on a destroyed object, which is not allowed`, !(0, _runtime.isDestroyed)(obj)));
|
15025 | var {
|
15026 | _getter
|
15027 | } = this;
|
15028 |
|
15029 | var tag = (0, _validator.track)(() => {
|
15030 | ret = _getter.call(obj, keyName);
|
15031 | });
|
15032 | (0, _validator.updateTag)(propertyTag, tag);
|
15033 | meta$$1.setValueFor(keyName, ret);
|
15034 | meta$$1.setRevisionFor(keyName, (0, _validator.valueForTag)(propertyTag));
|
15035 | finishLazyChains(meta$$1, keyName, ret);
|
15036 | }
|
15037 |
|
15038 | (0, _validator.consumeTag)(propertyTag);
|
15039 |
|
15040 |
|
15041 | if (Array.isArray(ret)) {
|
15042 | (0, _validator.consumeTag)((0, _validator.tagFor)(ret, '[]', tagMeta));
|
15043 | }
|
15044 |
|
15045 | return ret;
|
15046 | }
|
15047 |
|
15048 | }
|
15049 |
|
15050 |
|
15051 | class ComputedDecoratorImpl extends Function {
|
15052 | |
15053 |
|
15054 |
|
15055 |
|
15056 |
|
15057 |
|
15058 |
|
15059 |
|
15060 |
|
15061 |
|
15062 |
|
15063 |
|
15064 |
|
15065 |
|
15066 |
|
15067 |
|
15068 |
|
15069 |
|
15070 |
|
15071 |
|
15072 |
|
15073 |
|
15074 |
|
15075 |
|
15076 |
|
15077 |
|
15078 |
|
15079 |
|
15080 |
|
15081 |
|
15082 |
|
15083 | readOnly() {
|
15084 | var desc = descriptorForDecorator(this);
|
15085 | (true && !(!(desc._setter && desc._setter !== desc._getter)) && (0, _debug.assert)('Computed properties that define a setter using the new syntax cannot be read-only', !(desc._setter && desc._setter !== desc._getter)));
|
15086 | desc._readOnly = true;
|
15087 | return this;
|
15088 | }
|
15089 | |
15090 |
|
15091 |
|
15092 |
|
15093 |
|
15094 |
|
15095 |
|
15096 |
|
15097 |
|
15098 |
|
15099 |
|
15100 |
|
15101 |
|
15102 |
|
15103 |
|
15104 |
|
15105 |
|
15106 |
|
15107 |
|
15108 |
|
15109 |
|
15110 |
|
15111 |
|
15112 |
|
15113 |
|
15114 |
|
15115 |
|
15116 |
|
15117 |
|
15118 |
|
15119 |
|
15120 |
|
15121 |
|
15122 |
|
15123 |
|
15124 |
|
15125 | volatile() {
|
15126 | (true && !(false) && (0, _debug.deprecate)('Setting a computed property as volatile has been deprecated. Instead, consider using a native getter with native class syntax.', false, {
|
15127 | id: 'computed-property.volatile',
|
15128 | until: '4.0.0',
|
15129 | url: 'https://emberjs.com/deprecations/v3.x#toc_computed-property-volatile'
|
15130 | }));
|
15131 | descriptorForDecorator(this)._volatile = true;
|
15132 | return this;
|
15133 | }
|
15134 | |
15135 |
|
15136 |
|
15137 |
|
15138 |
|
15139 |
|
15140 |
|
15141 |
|
15142 |
|
15143 |
|
15144 |
|
15145 |
|
15146 |
|
15147 |
|
15148 |
|
15149 |
|
15150 |
|
15151 |
|
15152 |
|
15153 |
|
15154 |
|
15155 |
|
15156 |
|
15157 |
|
15158 |
|
15159 |
|
15160 |
|
15161 |
|
15162 |
|
15163 |
|
15164 |
|
15165 |
|
15166 |
|
15167 |
|
15168 |
|
15169 |
|
15170 |
|
15171 |
|
15172 |
|
15173 |
|
15174 |
|
15175 |
|
15176 |
|
15177 |
|
15178 |
|
15179 |
|
15180 | property(...keys) {
|
15181 | (true && !(false) && (0, _debug.deprecate)('Setting dependency keys using the `.property()` modifier has been deprecated. Pass the dependency keys directly to computed as arguments instead. If you are using `.property()` on a computed property macro, consider refactoring your macro to receive additional dependent keys in its initial declaration.', false, {
|
15182 | id: 'computed-property.property',
|
15183 | until: '4.0.0',
|
15184 | url: 'https://emberjs.com/deprecations/v3.x#toc_computed-property-property'
|
15185 | }));
|
15186 |
|
15187 | descriptorForDecorator(this)._property(...keys);
|
15188 |
|
15189 | return this;
|
15190 | }
|
15191 | |
15192 |
|
15193 |
|
15194 |
|
15195 |
|
15196 |
|
15197 |
|
15198 |
|
15199 |
|
15200 |
|
15201 |
|
15202 |
|
15203 |
|
15204 |
|
15205 |
|
15206 |
|
15207 |
|
15208 |
|
15209 |
|
15210 |
|
15211 |
|
15212 |
|
15213 |
|
15214 |
|
15215 |
|
15216 |
|
15217 |
|
15218 |
|
15219 |
|
15220 |
|
15221 |
|
15222 |
|
15223 |
|
15224 |
|
15225 |
|
15226 |
|
15227 |
|
15228 |
|
15229 |
|
15230 |
|
15231 | meta(meta$$1) {
|
15232 | var prop = descriptorForDecorator(this);
|
15233 |
|
15234 | if (arguments.length === 0) {
|
15235 | return prop._meta || {};
|
15236 | } else {
|
15237 | prop._meta = meta$$1;
|
15238 | return this;
|
15239 | }
|
15240 | }
|
15241 |
|
15242 |
|
15243 |
|
15244 | get _getter() {
|
15245 | return descriptorForDecorator(this)._getter;
|
15246 | }
|
15247 |
|
15248 |
|
15249 | set enumerable(value) {
|
15250 | descriptorForDecorator(this).enumerable = value;
|
15251 | }
|
15252 |
|
15253 | }
|
15254 |
|
15255 | function computed(...args) {
|
15256 | (true && !(!(isElementDescriptor(args.slice(0, 3)) && args.length === 5 && args[4] === true)) && (0, _debug.assert)(`@computed can only be used directly as a native decorator. If you're using tracked in classic classes, add parenthesis to call it like a function: computed()`, !(isElementDescriptor(args.slice(0, 3)) && args.length === 5 && args[4] === true)));
|
15257 |
|
15258 | if (isElementDescriptor(args)) {
|
15259 | var decorator = makeComputedDecorator(new ComputedProperty([]), ComputedDecoratorImpl);
|
15260 | return decorator(args[0], args[1], args[2]);
|
15261 | }
|
15262 |
|
15263 | return makeComputedDecorator(new ComputedProperty(args), ComputedDecoratorImpl);
|
15264 | }
|
15265 |
|
15266 | function autoComputed(...config) {
|
15267 | return makeComputedDecorator(new AutoComputedProperty(config), ComputedDecoratorImpl);
|
15268 | }
|
15269 | |
15270 |
|
15271 |
|
15272 |
|
15273 |
|
15274 |
|
15275 |
|
15276 |
|
15277 |
|
15278 |
|
15279 |
|
15280 |
|
15281 |
|
15282 |
|
15283 |
|
15284 | function isComputed(obj, key) {
|
15285 | return Boolean(descriptorForProperty(obj, key));
|
15286 | }
|
15287 |
|
15288 | var _globalsComputed = computed.bind(null);
|
15289 |
|
15290 | _exports._globalsComputed = _globalsComputed;
|
15291 |
|
15292 | function getCachedValueFor(obj, key) {
|
15293 | var meta$$1 = (0, _meta2.peekMeta)(obj);
|
15294 |
|
15295 | if (meta$$1) {
|
15296 | return meta$$1.valueFor(key);
|
15297 | }
|
15298 | }
|
15299 |
|
15300 | function alias(altKey) {
|
15301 | (true && !(!isElementDescriptor(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @alias as a decorator directly, but it requires a `altKey` parameter', !isElementDescriptor(Array.prototype.slice.call(arguments))));
|
15302 | return makeComputedDecorator(new AliasedProperty(altKey), AliasDecoratorImpl);
|
15303 | }
|
15304 |
|
15305 |
|
15306 | class AliasDecoratorImpl extends Function {
|
15307 | readOnly() {
|
15308 | descriptorForDecorator(this).readOnly();
|
15309 | return this;
|
15310 | }
|
15311 |
|
15312 | oneWay() {
|
15313 | descriptorForDecorator(this).oneWay();
|
15314 | return this;
|
15315 | }
|
15316 |
|
15317 | meta(meta$$1) {
|
15318 | var prop = descriptorForDecorator(this);
|
15319 |
|
15320 | if (arguments.length === 0) {
|
15321 | return prop._meta || {};
|
15322 | } else {
|
15323 | prop._meta = meta$$1;
|
15324 | }
|
15325 | }
|
15326 |
|
15327 | }
|
15328 |
|
15329 | class AliasedProperty extends ComputedDescriptor {
|
15330 | constructor(altKey) {
|
15331 | super();
|
15332 | this.altKey = altKey;
|
15333 | }
|
15334 |
|
15335 | setup(obj, keyName, propertyDesc, meta$$1) {
|
15336 | (true && !(this.altKey !== keyName) && (0, _debug.assert)(`Setting alias '${keyName}' on self`, this.altKey !== keyName));
|
15337 | super.setup(obj, keyName, propertyDesc, meta$$1);
|
15338 | CHAIN_PASS_THROUGH.add(this);
|
15339 | }
|
15340 |
|
15341 | get(obj, keyName) {
|
15342 | var ret;
|
15343 | var meta$$1 = (0, _meta2.meta)(obj);
|
15344 | var tagMeta = (0, _validator.tagMetaFor)(obj);
|
15345 | var propertyTag = (0, _validator.tagFor)(obj, keyName, tagMeta);
|
15346 |
|
15347 |
|
15348 | (0, _validator.untrack)(() => {
|
15349 | ret = get(obj, this.altKey);
|
15350 | });
|
15351 | var lastRevision = meta$$1.revisionFor(keyName);
|
15352 |
|
15353 | if (lastRevision === undefined || !(0, _validator.validateTag)(propertyTag, lastRevision)) {
|
15354 | (0, _validator.updateTag)(propertyTag, getChainTagsForKey(obj, this.altKey, tagMeta, meta$$1));
|
15355 | meta$$1.setRevisionFor(keyName, (0, _validator.valueForTag)(propertyTag));
|
15356 | finishLazyChains(meta$$1, keyName, ret);
|
15357 | }
|
15358 |
|
15359 | (0, _validator.consumeTag)(propertyTag);
|
15360 | return ret;
|
15361 | }
|
15362 |
|
15363 | set(obj, _keyName, value) {
|
15364 | return set(obj, this.altKey, value);
|
15365 | }
|
15366 |
|
15367 | readOnly() {
|
15368 | this.set = AliasedProperty_readOnlySet;
|
15369 | }
|
15370 |
|
15371 | oneWay() {
|
15372 | this.set = AliasedProperty_oneWaySet;
|
15373 | }
|
15374 |
|
15375 | }
|
15376 |
|
15377 | function AliasedProperty_readOnlySet(obj, keyName) {
|
15378 |
|
15379 | throw new _error.default(`Cannot set read-only property '${keyName}' on object: ${(0, _utils.inspect)(obj)}`);
|
15380 | }
|
15381 |
|
15382 | function AliasedProperty_oneWaySet(obj, keyName, value) {
|
15383 | defineProperty(obj, keyName, null);
|
15384 | return set(obj, keyName, value);
|
15385 | }
|
15386 | /**
|
15387 | @module ember
|
15388 | */
|
15389 |
|
15390 | /**
|
15391 | Used internally to allow changing properties in a backwards compatible way, and print a helpful
|
15392 | deprecation warning.
|
15393 |
|
15394 | @method deprecateProperty
|
15395 | @param {Object} object The object to add the deprecated property to.
|
15396 | @param {String} deprecatedKey The property to add (and print deprecation warnings upon accessing).
|
15397 | @param {String} newKey The property that will be aliased.
|
15398 | @private
|
15399 | @since 1.7.0
|
15400 | */
|
15401 |
|
15402 |
|
15403 | function deprecateProperty(object, deprecatedKey, newKey, options) {
|
15404 | function _deprecate() {
|
15405 | (true && !(false) && (0, _debug.deprecate)(`Usage of \`${deprecatedKey}\` is deprecated, use \`${newKey}\` instead.`, false, options));
|
15406 | }
|
15407 |
|
15408 | Object.defineProperty(object, deprecatedKey, {
|
15409 | configurable: true,
|
15410 | enumerable: false,
|
15411 |
|
15412 | set(value) {
|
15413 | _deprecate();
|
15414 |
|
15415 | set(this, newKey, value);
|
15416 | },
|
15417 |
|
15418 | get() {
|
15419 | _deprecate();
|
15420 |
|
15421 | return get(this, newKey);
|
15422 | }
|
15423 |
|
15424 | });
|
15425 | }
|
15426 |
|
15427 | var EACH_PROXIES = new WeakMap();
|
15428 |
|
15429 | function eachProxyArrayWillChange(array, idx, removedCnt, addedCnt) {
|
15430 | var eachProxy = EACH_PROXIES.get(array);
|
15431 |
|
15432 | if (eachProxy !== undefined) {
|
15433 | eachProxy.arrayWillChange(array, idx, removedCnt, addedCnt);
|
15434 | }
|
15435 | }
|
15436 |
|
15437 | function eachProxyArrayDidChange(array, idx, removedCnt, addedCnt) {
|
15438 | var eachProxy = EACH_PROXIES.get(array);
|
15439 |
|
15440 | if (eachProxy !== undefined) {
|
15441 | eachProxy.arrayDidChange(array, idx, removedCnt, addedCnt);
|
15442 | }
|
15443 | }
|
15444 | |
15445 |
|
15446 |
|
15447 |
|
15448 | |
15449 |
|
15450 |
|
15451 |
|
15452 |
|
15453 |
|
15454 |
|
15455 |
|
15456 |
|
15457 |
|
15458 |
|
15459 |
|
15460 |
|
15461 |
|
15462 |
|
15463 |
|
15464 |
|
15465 |
|
15466 |
|
15467 |
|
15468 |
|
15469 |
|
15470 |
|
15471 | function isNone(obj) {
|
15472 | return obj === null || obj === undefined;
|
15473 | }
|
15474 | |
15475 |
|
15476 |
|
15477 |
|
15478 | |
15479 |
|
15480 |
|
15481 |
|
15482 |
|
15483 |
|
15484 |
|
15485 |
|
15486 |
|
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 | function isEmpty(obj) {
|
15514 | var none = obj === null || obj === undefined;
|
15515 |
|
15516 | if (none) {
|
15517 | return none;
|
15518 | }
|
15519 |
|
15520 | if (typeof obj.size === 'number') {
|
15521 | return !obj.size;
|
15522 | }
|
15523 |
|
15524 | var objectType = typeof obj;
|
15525 |
|
15526 | if (objectType === 'object') {
|
15527 | var size = get(obj, 'size');
|
15528 |
|
15529 | if (typeof size === 'number') {
|
15530 | return !size;
|
15531 | }
|
15532 | }
|
15533 |
|
15534 | if (typeof obj.length === 'number' && objectType !== 'function') {
|
15535 | return !obj.length;
|
15536 | }
|
15537 |
|
15538 | if (objectType === 'object') {
|
15539 | var length = get(obj, 'length');
|
15540 |
|
15541 | if (typeof length === 'number') {
|
15542 | return !length;
|
15543 | }
|
15544 | }
|
15545 |
|
15546 | return false;
|
15547 | }
|
15548 | |
15549 |
|
15550 |
|
15551 |
|
15552 | |
15553 |
|
15554 |
|
15555 |
|
15556 |
|
15557 |
|
15558 |
|
15559 |
|
15560 |
|
15561 |
|
15562 |
|
15563 |
|
15564 |
|
15565 |
|
15566 |
|
15567 |
|
15568 |
|
15569 |
|
15570 |
|
15571 |
|
15572 |
|
15573 |
|
15574 |
|
15575 |
|
15576 |
|
15577 |
|
15578 |
|
15579 |
|
15580 |
|
15581 | function isBlank(obj) {
|
15582 | return isEmpty(obj) || typeof obj === 'string' && /\S/.test(obj) === false;
|
15583 | }
|
15584 | |
15585 |
|
15586 |
|
15587 |
|
15588 | |
15589 |
|
15590 |
|
15591 |
|
15592 |
|
15593 |
|
15594 |
|
15595 |
|
15596 |
|
15597 |
|
15598 |
|
15599 |
|
15600 |
|
15601 |
|
15602 |
|
15603 |
|
15604 |
|
15605 |
|
15606 |
|
15607 |
|
15608 |
|
15609 |
|
15610 |
|
15611 |
|
15612 |
|
15613 |
|
15614 |
|
15615 |
|
15616 |
|
15617 |
|
15618 |
|
15619 |
|
15620 | function isPresent(obj) {
|
15621 | return !isBlank(obj);
|
15622 | }
|
15623 | |
15624 |
|
15625 |
|
15626 |
|
15627 | |
15628 |
|
15629 |
|
15630 |
|
15631 |
|
15632 |
|
15633 |
|
15634 |
|
15635 |
|
15636 |
|
15637 |
|
15638 | class Libraries {
|
15639 | constructor() {
|
15640 | this._registry = [];
|
15641 | this._coreLibIndex = 0;
|
15642 | }
|
15643 |
|
15644 | _getLibraryByName(name) {
|
15645 | var libs = this._registry;
|
15646 | var count = libs.length;
|
15647 |
|
15648 | for (var i = 0; i < count; i++) {
|
15649 | if (libs[i].name === name) {
|
15650 | return libs[i];
|
15651 | }
|
15652 | }
|
15653 |
|
15654 | return undefined;
|
15655 | }
|
15656 |
|
15657 | register(name, version, isCoreLibrary) {
|
15658 | var index = this._registry.length;
|
15659 |
|
15660 | if (!this._getLibraryByName(name)) {
|
15661 | if (isCoreLibrary) {
|
15662 | index = this._coreLibIndex++;
|
15663 | }
|
15664 |
|
15665 | this._registry.splice(index, 0, {
|
15666 | name,
|
15667 | version
|
15668 | });
|
15669 | } else {
|
15670 | (true && (0, _debug.warn)(`Library "${name}" is already registered with Ember.`, false, {
|
15671 | id: 'ember-metal.libraries-register'
|
15672 | }));
|
15673 | }
|
15674 | }
|
15675 |
|
15676 | registerCoreLibrary(name, version) {
|
15677 | this.register(name, version, true);
|
15678 | }
|
15679 |
|
15680 | deRegister(name) {
|
15681 | var lib = this._getLibraryByName(name);
|
15682 |
|
15683 | var index;
|
15684 |
|
15685 | if (lib) {
|
15686 | index = this._registry.indexOf(lib);
|
15687 |
|
15688 | this._registry.splice(index, 1);
|
15689 | }
|
15690 | }
|
15691 |
|
15692 | }
|
15693 |
|
15694 | _exports.Libraries = Libraries;
|
15695 |
|
15696 | if (true
|
15697 |
|
15698 | ) {
|
15699 | Libraries.prototype.logVersions = function () {
|
15700 | var libs = this._registry;
|
15701 | var nameLengths = libs.map(item => get(item, 'name.length'));
|
15702 | var maxNameLength = Math.max.apply(null, nameLengths);
|
15703 | (0, _debug.debug)('-------------------------------');
|
15704 |
|
15705 | for (var i = 0; i < libs.length; i++) {
|
15706 | var lib = libs[i];
|
15707 | var spaces = new Array(maxNameLength - lib.name.length + 1).join(' ');
|
15708 | (0, _debug.debug)([lib.name, spaces, ' : ', lib.version].join(''));
|
15709 | }
|
15710 |
|
15711 | (0, _debug.debug)('-------------------------------');
|
15712 | };
|
15713 | }
|
15714 |
|
15715 | var LIBRARIES = new Libraries();
|
15716 | _exports.libraries = LIBRARIES;
|
15717 | LIBRARIES.registerCoreLibrary('Ember', _version.default);
|
15718 | |
15719 |
|
15720 |
|
15721 |
|
15722 | |
15723 |
|
15724 |
|
15725 |
|
15726 |
|
15727 |
|
15728 |
|
15729 |
|
15730 |
|
15731 |
|
15732 |
|
15733 |
|
15734 |
|
15735 |
|
15736 |
|
15737 |
|
15738 |
|
15739 |
|
15740 |
|
15741 |
|
15742 |
|
15743 |
|
15744 |
|
15745 |
|
15746 |
|
15747 |
|
15748 |
|
15749 |
|
15750 |
|
15751 | function getProperties(obj, keys) {
|
15752 | var ret = {};
|
15753 | var propertyNames = arguments;
|
15754 | var i = 1;
|
15755 |
|
15756 | if (arguments.length === 2 && Array.isArray(keys)) {
|
15757 | i = 0;
|
15758 | propertyNames = arguments[1];
|
15759 | }
|
15760 |
|
15761 | for (; i < propertyNames.length; i++) {
|
15762 | ret[propertyNames[i]] = get(obj, propertyNames[i]);
|
15763 | }
|
15764 |
|
15765 | return ret;
|
15766 | }
|
15767 | /**
|
15768 | @module @ember/object
|
15769 | */
|
15770 |
|
15771 | /**
|
15772 | Set a list of properties on an object. These properties are set inside
|
15773 | a single `beginPropertyChanges` and `endPropertyChanges` batch, so
|
15774 | observers will be buffered.
|
15775 |
|
15776 | ```javascript
|
15777 | import EmberObject from '@ember/object';
|
15778 | let anObject = EmberObject.create();
|
15779 |
|
15780 | anObject.setProperties({
|
15781 | firstName: 'Stanley',
|
15782 | lastName: 'Stuart',
|
15783 | age: 21
|
15784 | });
|
15785 | ```
|
15786 |
|
15787 | @method setProperties
|
15788 | @static
|
15789 | @for @ember/object
|
15790 | @param obj
|
15791 | @param {Object} properties
|
15792 | @return properties
|
15793 | @public
|
15794 | */
|
15795 |
|
15796 |
|
15797 | function setProperties(obj, properties) {
|
15798 | if (properties === null || typeof properties !== 'object') {
|
15799 | return properties;
|
15800 | }
|
15801 |
|
15802 | changeProperties(() => {
|
15803 | var props = Object.keys(properties);
|
15804 | var propertyName;
|
15805 |
|
15806 | for (var i = 0; i < props.length; i++) {
|
15807 | propertyName = props[i];
|
15808 | set(obj, propertyName, properties[propertyName]);
|
15809 | }
|
15810 | });
|
15811 | return properties;
|
15812 | } // move into its own package
|
15813 | // it is needed by Mixin for classToString
|
15814 | // maybe move it into environment
|
15815 |
|
15816 |
|
15817 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
15818 | var searchDisabled = false;
|
15819 | var flags = {
|
15820 | _set: 0,
|
15821 | _unprocessedNamespaces: false,
|
15822 |
|
15823 | get unprocessedNamespaces() {
|
15824 | return this._unprocessedNamespaces;
|
15825 | },
|
15826 |
|
15827 | set unprocessedNamespaces(v) {
|
15828 | this._set++;
|
15829 | this._unprocessedNamespaces = v;
|
15830 | }
|
15831 |
|
15832 | };
|
15833 | var unprocessedMixins = false;
|
15834 | var NAMESPACES = [];
|
15835 | _exports.NAMESPACES = NAMESPACES;
|
15836 | var NAMESPACES_BY_ID = Object.create(null);
|
15837 | _exports.NAMESPACES_BY_ID = NAMESPACES_BY_ID;
|
15838 |
|
15839 | function addNamespace(namespace) {
|
15840 | flags.unprocessedNamespaces = true;
|
15841 | NAMESPACES.push(namespace);
|
15842 | }
|
15843 |
|
15844 | function removeNamespace(namespace) {
|
15845 | var name = (0, _utils.getName)(namespace);
|
15846 | delete NAMESPACES_BY_ID[name];
|
15847 | NAMESPACES.splice(NAMESPACES.indexOf(namespace), 1);
|
15848 |
|
15849 | if (name in _environment.context.lookup && namespace === _environment.context.lookup[name]) {
|
15850 | _environment.context.lookup[name] = undefined;
|
15851 | }
|
15852 | }
|
15853 |
|
15854 | function findNamespaces() {
|
15855 | if (!flags.unprocessedNamespaces) {
|
15856 | return;
|
15857 | }
|
15858 |
|
15859 | var lookup = _environment.context.lookup;
|
15860 | var keys = Object.keys(lookup);
|
15861 |
|
15862 | for (var i = 0; i < keys.length; i++) {
|
15863 | var key = keys[i]; // Only process entities that start with uppercase A-Z
|
15864 |
|
15865 | if (!isUppercase(key.charCodeAt(0))) {
|
15866 | continue;
|
15867 | }
|
15868 |
|
15869 | var obj = tryIsNamespace(lookup, key);
|
15870 |
|
15871 | if (obj) {
|
15872 | (0, _utils.setName)(obj, key);
|
15873 | }
|
15874 | }
|
15875 | }
|
15876 |
|
15877 | function findNamespace(name) {
|
15878 | if (!searchDisabled) {
|
15879 | processAllNamespaces();
|
15880 | }
|
15881 |
|
15882 | return NAMESPACES_BY_ID[name];
|
15883 | }
|
15884 |
|
15885 | function processNamespace(namespace) {
|
15886 | _processNamespace([namespace.toString()], namespace, new Set());
|
15887 | }
|
15888 |
|
15889 | function processAllNamespaces() {
|
15890 | var unprocessedNamespaces = flags.unprocessedNamespaces;
|
15891 |
|
15892 | if (unprocessedNamespaces) {
|
15893 | findNamespaces();
|
15894 | flags.unprocessedNamespaces = false;
|
15895 | }
|
15896 |
|
15897 | if (unprocessedNamespaces || unprocessedMixins) {
|
15898 | var namespaces = NAMESPACES;
|
15899 |
|
15900 | for (var i = 0; i < namespaces.length; i++) {
|
15901 | processNamespace(namespaces[i]);
|
15902 | }
|
15903 |
|
15904 | unprocessedMixins = false;
|
15905 | }
|
15906 | }
|
15907 |
|
15908 | function classToString() {
|
15909 | var name = (0, _utils.getName)(this);
|
15910 |
|
15911 | if (name !== void 0) {
|
15912 | return name;
|
15913 | }
|
15914 |
|
15915 | name = calculateToString(this);
|
15916 | (0, _utils.setName)(this, name);
|
15917 | return name;
|
15918 | }
|
15919 |
|
15920 | function isSearchDisabled() {
|
15921 | return searchDisabled;
|
15922 | }
|
15923 |
|
15924 | function setSearchDisabled(flag) {
|
15925 | searchDisabled = Boolean(flag);
|
15926 | }
|
15927 |
|
15928 | function setUnprocessedMixins() {
|
15929 | unprocessedMixins = true;
|
15930 | }
|
15931 |
|
15932 | function _processNamespace(paths, root, seen) {
|
15933 | var idx = paths.length;
|
15934 | var id = paths.join('.');
|
15935 | NAMESPACES_BY_ID[id] = root;
|
15936 | (0, _utils.setName)(root, id); // Loop over all of the keys in the namespace, looking for classes
|
15937 |
|
15938 | for (var key in root) {
|
15939 | if (!hasOwnProperty.call(root, key)) {
|
15940 | continue;
|
15941 | }
|
15942 |
|
15943 | var obj = root[key]; // If we are processing the `Ember` namespace, for example, the
|
15944 | // `paths` will start with `["Ember"]`. Every iteration through
|
15945 | // the loop will update the **second** element of this list with
|
15946 | // the key, so processing `Ember.View` will make the Array
|
15947 | // `['Ember', 'View']`.
|
15948 |
|
15949 | paths[idx] = key; // If we have found an unprocessed class
|
15950 |
|
15951 | if (obj && obj.toString === classToString && (0, _utils.getName)(obj) === void 0) {
|
15952 | // Replace the class' `toString` with the dot-separated path
|
15953 | (0, _utils.setName)(obj, paths.join('.')); // Support nested namespaces
|
15954 | } else if (obj && obj.isNamespace) {
|
15955 | // Skip aliased namespaces
|
15956 | if (seen.has(obj)) {
|
15957 | continue;
|
15958 | }
|
15959 |
|
15960 | seen.add(obj); // Process the child namespace
|
15961 |
|
15962 | _processNamespace(paths, obj, seen);
|
15963 | }
|
15964 | }
|
15965 |
|
15966 | paths.length = idx; // cut out last item
|
15967 | }
|
15968 |
|
15969 | function isUppercase(code) {
|
15970 | return code >= 65 && code <= 90 // A
|
15971 | ; // Z
|
15972 | }
|
15973 |
|
15974 | function tryIsNamespace(lookup, prop) {
|
15975 | try {
|
15976 | var obj = lookup[prop];
|
15977 | return (obj !== null && typeof obj === 'object' || typeof obj === 'function') && obj.isNamespace && obj;
|
15978 | } catch (e) {// continue
|
15979 | }
|
15980 | }
|
15981 |
|
15982 | function calculateToString(target) {
|
15983 | var str;
|
15984 |
|
15985 | if (!searchDisabled) {
|
15986 | processAllNamespaces();
|
15987 | str = (0, _utils.getName)(target);
|
15988 |
|
15989 | if (str !== void 0) {
|
15990 | return str;
|
15991 | }
|
15992 |
|
15993 | var superclass = target;
|
15994 |
|
15995 | do {
|
15996 | superclass = Object.getPrototypeOf(superclass);
|
15997 |
|
15998 | if (superclass === Function.prototype || superclass === Object.prototype) {
|
15999 | break;
|
16000 | }
|
16001 |
|
16002 | str = (0, _utils.getName)(target);
|
16003 |
|
16004 | if (str !== void 0) {
|
16005 | str = `(subclass of ${str})`;
|
16006 | break;
|
16007 | }
|
16008 | } while (str === void 0);
|
16009 | }
|
16010 |
|
16011 | return str || '(unknown)';
|
16012 | }
|
16013 | /**
|
16014 | @module @ember/object
|
16015 | */
|
16016 |
|
16017 |
|
16018 | var a_concat = Array.prototype.concat;
|
16019 | var {
|
16020 | isArray
|
16021 | } = Array;
|
16022 |
|
16023 | function extractAccessors(properties) {
|
16024 | if (properties !== undefined) {
|
16025 | var keys = Object.keys(properties);
|
16026 |
|
16027 | for (var i = 0; i < keys.length; i++) {
|
16028 | var key = keys[i];
|
16029 | var desc = Object.getOwnPropertyDescriptor(properties, key);
|
16030 |
|
16031 | if (desc.get !== undefined || desc.set !== undefined) {
|
16032 | Object.defineProperty(properties, key, {
|
16033 | value: nativeDescDecorator(desc)
|
16034 | });
|
16035 | }
|
16036 | }
|
16037 | }
|
16038 |
|
16039 | return properties;
|
16040 | }
|
16041 |
|
16042 | function concatenatedMixinProperties(concatProp, props, values, base) {
|
16043 | // reset before adding each new mixin to pickup concats from previous
|
16044 | var concats = values[concatProp] || base[concatProp];
|
16045 |
|
16046 | if (props[concatProp]) {
|
16047 | concats = concats ? a_concat.call(concats, props[concatProp]) : props[concatProp];
|
16048 | }
|
16049 |
|
16050 | return concats;
|
16051 | }
|
16052 |
|
16053 | function giveDecoratorSuper(key, decorator, property, descs) {
|
16054 | if (property === true) {
|
16055 | return decorator;
|
16056 | }
|
16057 |
|
16058 | var originalGetter = property._getter;
|
16059 |
|
16060 | if (originalGetter === undefined) {
|
16061 | return decorator;
|
16062 | }
|
16063 |
|
16064 | var superDesc = descs[key]; // Check to see if the super property is a decorator first, if so load its descriptor
|
16065 |
|
16066 | var superProperty = typeof superDesc === 'function' ? descriptorForDecorator(superDesc) : superDesc;
|
16067 |
|
16068 | if (superProperty === undefined || superProperty === true) {
|
16069 | return decorator;
|
16070 | }
|
16071 |
|
16072 | var superGetter = superProperty._getter;
|
16073 |
|
16074 | if (superGetter === undefined) {
|
16075 | return decorator;
|
16076 | }
|
16077 |
|
16078 | var get = (0, _utils.wrap)(originalGetter, superGetter);
|
16079 | var set;
|
16080 | var originalSetter = property._setter;
|
16081 | var superSetter = superProperty._setter;
|
16082 |
|
16083 | if (superSetter !== undefined) {
|
16084 | if (originalSetter !== undefined) {
|
16085 | set = (0, _utils.wrap)(originalSetter, superSetter);
|
16086 | } else {
|
16087 | // If the super property has a setter, we default to using it no matter what.
|
16088 | // This is clearly very broken and weird, but it's what was here so we have
|
16089 | // to keep it until the next major at least.
|
16090 | //
|
16091 | // TODO: Add a deprecation here.
|
16092 | set = superSetter;
|
16093 | }
|
16094 | } else {
|
16095 | set = originalSetter;
|
16096 | } // only create a new CP if we must
|
16097 |
|
16098 |
|
16099 | if (get !== originalGetter || set !== originalSetter) {
|
16100 | // Since multiple mixins may inherit from the same parent, we need
|
16101 | // to clone the computed property so that other mixins do not receive
|
16102 | // the wrapped version.
|
16103 | var dependentKeys = property._dependentKeys || [];
|
16104 | var newProperty = new ComputedProperty([...dependentKeys, {
|
16105 | get,
|
16106 | set
|
16107 | }]);
|
16108 | newProperty._readOnly = property._readOnly;
|
16109 | newProperty._volatile = property._volatile;
|
16110 | newProperty._meta = property._meta;
|
16111 | newProperty.enumerable = property.enumerable;
|
16112 | return makeComputedDecorator(newProperty, ComputedProperty);
|
16113 | }
|
16114 |
|
16115 | return decorator;
|
16116 | }
|
16117 |
|
16118 | function giveMethodSuper(key, method, values, descs) {
|
16119 | // Methods overwrite computed properties, and do not call super to them.
|
16120 | if (descs[key] !== undefined) {
|
16121 | return method;
|
16122 | } // Find the original method in a parent mixin
|
16123 |
|
16124 |
|
16125 | var superMethod = values[key]; // Only wrap the new method if the original method was a function
|
16126 |
|
16127 | if (typeof superMethod === 'function') {
|
16128 | return (0, _utils.wrap)(method, superMethod);
|
16129 | }
|
16130 |
|
16131 | return method;
|
16132 | }
|
16133 |
|
16134 | function applyConcatenatedProperties(key, value, values) {
|
16135 | var baseValue = values[key];
|
16136 | var ret = (0, _utils.makeArray)(baseValue).concat((0, _utils.makeArray)(value));
|
16137 |
|
16138 | if (true
|
16139 | /* DEBUG */
|
16140 | ) {
|
16141 | // it is possible to use concatenatedProperties with strings (which cannot be frozen)
|
16142 | // only freeze objects...
|
16143 | if (typeof ret === 'object' && ret !== null) {
|
16144 | // prevent mutating `concatenatedProperties` array after it is applied
|
16145 | Object.freeze(ret);
|
16146 | }
|
16147 | }
|
16148 |
|
16149 | return ret;
|
16150 | }
|
16151 |
|
16152 | function applyMergedProperties(key, value, values) {
|
16153 | var baseValue = values[key];
|
16154 | (true && !(!isArray(value)) && (0, _debug.assert)(`You passed in \`${JSON.stringify(value)}\` as the value for \`${key}\` but \`${key}\` cannot be an Array`, !isArray(value)));
|
16155 |
|
16156 | if (!baseValue) {
|
16157 | return value;
|
16158 | }
|
16159 |
|
16160 | var newBase = (0, _polyfills.assign)({}, baseValue);
|
16161 | var hasFunction = false;
|
16162 | var props = Object.keys(value);
|
16163 |
|
16164 | for (var i = 0; i < props.length; i++) {
|
16165 | var prop = props[i];
|
16166 | var propValue = value[prop];
|
16167 |
|
16168 | if (typeof propValue === 'function') {
|
16169 | hasFunction = true;
|
16170 | newBase[prop] = giveMethodSuper(prop, propValue, baseValue, {});
|
16171 | } else {
|
16172 | newBase[prop] = propValue;
|
16173 | }
|
16174 | }
|
16175 |
|
16176 | if (hasFunction) {
|
16177 | newBase._super = _utils.ROOT;
|
16178 | }
|
16179 |
|
16180 | return newBase;
|
16181 | }
|
16182 |
|
16183 | function mergeMixins(mixins, meta$$1, descs, values, base, keys, keysWithSuper) {
|
16184 | var currentMixin;
|
16185 |
|
16186 | for (var i = 0; i < mixins.length; i++) {
|
16187 | currentMixin = mixins[i];
|
16188 | (true && !(typeof currentMixin === 'object' && currentMixin !== null && Object.prototype.toString.call(currentMixin) !== '[object Array]') && (0, _debug.assert)(`Expected hash or Mixin instance, got ${Object.prototype.toString.call(currentMixin)}`, typeof currentMixin === 'object' && currentMixin !== null && Object.prototype.toString.call(currentMixin) !== '[object Array]'));
|
16189 |
|
16190 | if (MIXINS.has(currentMixin)) {
|
16191 | if (meta$$1.hasMixin(currentMixin)) {
|
16192 | continue;
|
16193 | }
|
16194 |
|
16195 | meta$$1.addMixin(currentMixin);
|
16196 | var {
|
16197 | properties,
|
16198 | mixins: _mixins
|
16199 | } = currentMixin;
|
16200 |
|
16201 | if (properties !== undefined) {
|
16202 | mergeProps(meta$$1, properties, descs, values, base, keys, keysWithSuper);
|
16203 | } else if (_mixins !== undefined) {
|
16204 | mergeMixins(_mixins, meta$$1, descs, values, base, keys, keysWithSuper);
|
16205 |
|
16206 | if (currentMixin._without !== undefined) {
|
16207 | currentMixin._without.forEach(keyName => {
|
16208 |
|
16209 | var index = keys.indexOf(keyName);
|
16210 |
|
16211 | if (index !== -1) {
|
16212 | keys.splice(index, 1);
|
16213 | }
|
16214 | });
|
16215 | }
|
16216 | }
|
16217 | } else {
|
16218 | mergeProps(meta$$1, currentMixin, descs, values, base, keys, keysWithSuper);
|
16219 | }
|
16220 | }
|
16221 | }
|
16222 |
|
16223 | function mergeProps(meta$$1, props, descs, values, base, keys, keysWithSuper) {
|
16224 | var concats = concatenatedMixinProperties('concatenatedProperties', props, values, base);
|
16225 | var mergings = concatenatedMixinProperties('mergedProperties', props, values, base);
|
16226 | var propKeys = Object.keys(props);
|
16227 |
|
16228 | for (var i = 0; i < propKeys.length; i++) {
|
16229 | var key = propKeys[i];
|
16230 | var value = props[key];
|
16231 | if (value === undefined) continue;
|
16232 |
|
16233 | if (keys.indexOf(key) === -1) {
|
16234 | keys.push(key);
|
16235 | var desc = meta$$1.peekDescriptors(key);
|
16236 |
|
16237 | if (desc === undefined) {
|
16238 |
|
16239 |
|
16240 | var prev = values[key] = base[key];
|
16241 |
|
16242 | if (typeof prev === 'function') {
|
16243 | updateObserversAndListeners(base, key, prev, false);
|
16244 | }
|
16245 | } else {
|
16246 | descs[key] = desc;
|
16247 |
|
16248 |
|
16249 |
|
16250 | keysWithSuper.push(key);
|
16251 | desc.teardown(base, key, meta$$1);
|
16252 | }
|
16253 | }
|
16254 |
|
16255 | var isFunction = typeof value === 'function';
|
16256 |
|
16257 | if (isFunction) {
|
16258 | var _desc2 = descriptorForDecorator(value);
|
16259 |
|
16260 | if (_desc2 !== undefined) {
|
16261 |
|
16262 | descs[key] = giveDecoratorSuper(key, value, _desc2, descs);
|
16263 | values[key] = undefined;
|
16264 | continue;
|
16265 | }
|
16266 | }
|
16267 |
|
16268 | if (concats && concats.indexOf(key) >= 0 || key === 'concatenatedProperties' || key === 'mergedProperties') {
|
16269 | value = applyConcatenatedProperties(key, value, values);
|
16270 | } else if (mergings && mergings.indexOf(key) > -1) {
|
16271 | value = applyMergedProperties(key, value, values);
|
16272 | } else if (isFunction) {
|
16273 | value = giveMethodSuper(key, value, values, descs);
|
16274 | }
|
16275 |
|
16276 | values[key] = value;
|
16277 | descs[key] = undefined;
|
16278 | }
|
16279 | }
|
16280 |
|
16281 | var followMethodAlias;
|
16282 |
|
16283 | if (_deprecatedFeatures.ALIAS_METHOD) {
|
16284 | followMethodAlias = function (obj, alias, descs, values) {
|
16285 | var altKey = alias.methodName;
|
16286 | var possibleDesc;
|
16287 | var desc = descs[altKey];
|
16288 | var value = values[altKey];
|
16289 |
|
16290 | if (desc !== undefined || value !== undefined) {
|
16291 | } else if ((possibleDesc = descriptorForProperty(obj, altKey)) !== undefined) {
|
16292 | desc = possibleDesc;
|
16293 | value = undefined;
|
16294 | } else {
|
16295 | desc = undefined;
|
16296 | value = obj[altKey];
|
16297 | }
|
16298 |
|
16299 | return {
|
16300 | desc,
|
16301 | value
|
16302 | };
|
16303 | };
|
16304 | }
|
16305 |
|
16306 | function updateObserversAndListeners(obj, key, fn, add) {
|
16307 | var meta$$1 = (0, _utils.observerListenerMetaFor)(fn);
|
16308 | if (meta$$1 === undefined) return;
|
16309 | var {
|
16310 | observers,
|
16311 | listeners
|
16312 | } = meta$$1;
|
16313 |
|
16314 | if (observers !== undefined) {
|
16315 | var updateObserver = add ? addObserver : removeObserver;
|
16316 |
|
16317 | for (var i = 0; i < observers.paths.length; i++) {
|
16318 | updateObserver(obj, observers.paths[i], null, key, observers.sync);
|
16319 | }
|
16320 | }
|
16321 |
|
16322 | if (listeners !== undefined) {
|
16323 | var updateListener = add ? addListener : removeListener;
|
16324 |
|
16325 | for (var _i = 0; _i < listeners.length; _i++) {
|
16326 | updateListener(obj, listeners[_i], null, key);
|
16327 | }
|
16328 | }
|
16329 | }
|
16330 |
|
16331 | function applyMixin(obj, mixins, _hideKeys = false) {
|
16332 | var descs = Object.create(null);
|
16333 | var values = Object.create(null);
|
16334 | var meta$$1 = (0, _meta2.meta)(obj);
|
16335 | var keys = [];
|
16336 | var keysWithSuper = [];
|
16337 | obj._super = _utils.ROOT;
|
16338 |
|
16339 |
|
16340 |
|
16341 |
|
16342 |
|
16343 |
|
16344 |
|
16345 | mergeMixins(mixins, meta$$1, descs, values, obj, keys, keysWithSuper);
|
16346 |
|
16347 | for (var i = 0; i < keys.length; i++) {
|
16348 | var key = keys[i];
|
16349 | var value = values[key];
|
16350 | var desc = descs[key];
|
16351 |
|
16352 | if (_deprecatedFeatures.ALIAS_METHOD) {
|
16353 | while (value !== undefined && isAlias(value)) {
|
16354 | var followed = followMethodAlias(obj, value, descs, values);
|
16355 | desc = followed.desc;
|
16356 | value = followed.value;
|
16357 | }
|
16358 | }
|
16359 |
|
16360 | if (value !== undefined) {
|
16361 | if (typeof value === 'function') {
|
16362 | updateObserversAndListeners(obj, key, value, true);
|
16363 | }
|
16364 |
|
16365 | defineValue(obj, key, value, keysWithSuper.indexOf(key) !== -1, !_hideKeys);
|
16366 | } else if (desc !== undefined) {
|
16367 | defineDecorator(obj, key, desc, meta$$1);
|
16368 | }
|
16369 | }
|
16370 |
|
16371 | if (!meta$$1.isPrototypeMeta(obj)) {
|
16372 | revalidateObservers(obj);
|
16373 | }
|
16374 |
|
16375 | return obj;
|
16376 | }
|
16377 | |
16378 |
|
16379 |
|
16380 |
|
16381 |
|
16382 |
|
16383 |
|
16384 |
|
16385 |
|
16386 | function mixin(obj, ...args) {
|
16387 | applyMixin(obj, args);
|
16388 | return obj;
|
16389 | }
|
16390 |
|
16391 | var MIXINS = new _polyfills._WeakSet();
|
16392 | |
16393 |
|
16394 |
|
16395 |
|
16396 |
|
16397 |
|
16398 |
|
16399 |
|
16400 |
|
16401 |
|
16402 |
|
16403 |
|
16404 |
|
16405 |
|
16406 |
|
16407 |
|
16408 |
|
16409 |
|
16410 |
|
16411 |
|
16412 |
|
16413 |
|
16414 |
|
16415 |
|
16416 |
|
16417 |
|
16418 |
|
16419 |
|
16420 |
|
16421 |
|
16422 |
|
16423 |
|
16424 |
|
16425 |
|
16426 |
|
16427 |
|
16428 |
|
16429 |
|
16430 |
|
16431 |
|
16432 |
|
16433 |
|
16434 |
|
16435 |
|
16436 |
|
16437 |
|
16438 |
|
16439 |
|
16440 |
|
16441 |
|
16442 |
|
16443 |
|
16444 |
|
16445 |
|
16446 |
|
16447 |
|
16448 |
|
16449 |
|
16450 |
|
16451 |
|
16452 |
|
16453 |
|
16454 |
|
16455 |
|
16456 |
|
16457 |
|
16458 |
|
16459 |
|
16460 |
|
16461 |
|
16462 |
|
16463 |
|
16464 |
|
16465 |
|
16466 |
|
16467 |
|
16468 |
|
16469 |
|
16470 |
|
16471 |
|
16472 |
|
16473 |
|
16474 |
|
16475 | class Mixin {
|
16476 | constructor(mixins, properties) {
|
16477 | MIXINS.add(this);
|
16478 | this.properties = extractAccessors(properties);
|
16479 | this.mixins = buildMixinsArray(mixins);
|
16480 | this.ownerConstructor = undefined;
|
16481 | this._without = undefined;
|
16482 |
|
16483 | if (true
|
16484 |
|
16485 | ) {
|
16486 | |
16487 |
|
16488 |
|
16489 |
|
16490 |
|
16491 |
|
16492 | (0, _utils.guidFor)(this);
|
16493 | Object.seal(this);
|
16494 | }
|
16495 | }
|
16496 | |
16497 |
|
16498 |
|
16499 |
|
16500 |
|
16501 |
|
16502 |
|
16503 |
|
16504 |
|
16505 | static create(...args) {
|
16506 | setUnprocessedMixins();
|
16507 | var M = this;
|
16508 | return new M(args, undefined);
|
16509 | }
|
16510 |
|
16511 |
|
16512 |
|
16513 | static mixins(obj) {
|
16514 | var meta$$1 = (0, _meta2.peekMeta)(obj);
|
16515 | var ret = [];
|
16516 |
|
16517 | if (meta$$1 === null) {
|
16518 | return ret;
|
16519 | }
|
16520 |
|
16521 | meta$$1.forEachMixins(currentMixin => {
|
16522 |
|
16523 | if (!currentMixin.properties) {
|
16524 | ret.push(currentMixin);
|
16525 | }
|
16526 | });
|
16527 | return ret;
|
16528 | }
|
16529 | |
16530 |
|
16531 |
|
16532 |
|
16533 |
|
16534 |
|
16535 |
|
16536 | reopen(...args) {
|
16537 | if (args.length === 0) {
|
16538 | return;
|
16539 | }
|
16540 |
|
16541 | if (this.properties) {
|
16542 | var currentMixin = new Mixin(undefined, this.properties);
|
16543 | this.properties = undefined;
|
16544 | this.mixins = [currentMixin];
|
16545 | } else if (!this.mixins) {
|
16546 | this.mixins = [];
|
16547 | }
|
16548 |
|
16549 | this.mixins = this.mixins.concat(buildMixinsArray(args));
|
16550 | return this;
|
16551 | }
|
16552 | |
16553 |
|
16554 |
|
16555 |
|
16556 |
|
16557 |
|
16558 |
|
16559 |
|
16560 | apply(obj, _hideKeys = false) {
|
16561 |
|
16562 |
|
16563 |
|
16564 |
|
16565 |
|
16566 | return applyMixin(obj, [this], _hideKeys);
|
16567 | }
|
16568 |
|
16569 | applyPartial(obj) {
|
16570 | return applyMixin(obj, [this]);
|
16571 | }
|
16572 | |
16573 |
|
16574 |
|
16575 |
|
16576 |
|
16577 |
|
16578 |
|
16579 |
|
16580 | detect(obj) {
|
16581 | if (typeof obj !== 'object' || obj === null) {
|
16582 | return false;
|
16583 | }
|
16584 |
|
16585 | if (MIXINS.has(obj)) {
|
16586 | return _detect(obj, this);
|
16587 | }
|
16588 |
|
16589 | var meta$$1 = (0, _meta2.peekMeta)(obj);
|
16590 |
|
16591 | if (meta$$1 === null) {
|
16592 | return false;
|
16593 | }
|
16594 |
|
16595 | return meta$$1.hasMixin(this);
|
16596 | }
|
16597 |
|
16598 | without(...args) {
|
16599 | var ret = new Mixin([this]);
|
16600 | ret._without = args;
|
16601 | return ret;
|
16602 | }
|
16603 |
|
16604 | keys() {
|
16605 | return _keys(this);
|
16606 | }
|
16607 |
|
16608 | toString() {
|
16609 | return '(unknown mixin)';
|
16610 | }
|
16611 |
|
16612 | }
|
16613 |
|
16614 | _exports.Mixin = Mixin;
|
16615 |
|
16616 | function buildMixinsArray(mixins) {
|
16617 | var length = mixins && mixins.length || 0;
|
16618 | var m = undefined;
|
16619 |
|
16620 | if (length > 0) {
|
16621 | m = new Array(length);
|
16622 |
|
16623 | for (var i = 0; i < length; i++) {
|
16624 | var x = mixins[i];
|
16625 | (true && !(typeof x === 'object' && x !== null && Object.prototype.toString.call(x) !== '[object Array]') && (0, _debug.assert)(`Expected hash or Mixin instance, got ${Object.prototype.toString.call(x)}`, typeof x === 'object' && x !== null && Object.prototype.toString.call(x) !== '[object Array]'));
|
16626 |
|
16627 | if (MIXINS.has(x)) {
|
16628 | m[i] = x;
|
16629 | } else {
|
16630 | m[i] = new Mixin(undefined, x);
|
16631 | }
|
16632 | }
|
16633 | }
|
16634 |
|
16635 | return m;
|
16636 | }
|
16637 |
|
16638 | Mixin.prototype.toString = classToString;
|
16639 |
|
16640 | if (true
|
16641 |
|
16642 | ) {
|
16643 | Object.seal(Mixin.prototype);
|
16644 | }
|
16645 |
|
16646 | function _detect(curMixin, targetMixin, seen = new Set()) {
|
16647 | if (seen.has(curMixin)) {
|
16648 | return false;
|
16649 | }
|
16650 |
|
16651 | seen.add(curMixin);
|
16652 |
|
16653 | if (curMixin === targetMixin) {
|
16654 | return true;
|
16655 | }
|
16656 |
|
16657 | var mixins = curMixin.mixins;
|
16658 |
|
16659 | if (mixins) {
|
16660 | return mixins.some(mixin => _detect(mixin, targetMixin, seen));
|
16661 | }
|
16662 |
|
16663 | return false;
|
16664 | }
|
16665 |
|
16666 | function _keys(mixin, ret = new Set(), seen = new Set()) {
|
16667 | if (seen.has(mixin)) {
|
16668 | return;
|
16669 | }
|
16670 |
|
16671 | seen.add(mixin);
|
16672 |
|
16673 | if (mixin.properties) {
|
16674 | var props = Object.keys(mixin.properties);
|
16675 |
|
16676 | for (var i = 0; i < props.length; i++) {
|
16677 | ret.add(props[i]);
|
16678 | }
|
16679 | } else if (mixin.mixins) {
|
16680 | mixin.mixins.forEach(x => _keys(x, ret, seen));
|
16681 | }
|
16682 |
|
16683 | return ret;
|
16684 | }
|
16685 |
|
16686 | var AliasImpl;
|
16687 | var isAlias;
|
16688 |
|
16689 | if (_deprecatedFeatures.ALIAS_METHOD) {
|
16690 | var ALIASES = new _polyfills._WeakSet();
|
16691 |
|
16692 | isAlias = alias => {
|
16693 | return ALIASES.has(alias);
|
16694 | };
|
16695 |
|
16696 | AliasImpl = class AliasImpl {
|
16697 | constructor(methodName) {
|
16698 | this.methodName = methodName;
|
16699 | ALIASES.add(this);
|
16700 | }
|
16701 |
|
16702 | };
|
16703 | }
|
16704 | |
16705 |
|
16706 |
|
16707 |
|
16708 |
|
16709 |
|
16710 |
|
16711 |
|
16712 |
|
16713 |
|
16714 |
|
16715 |
|
16716 |
|
16717 |
|
16718 |
|
16719 |
|
16720 |
|
16721 |
|
16722 |
|
16723 |
|
16724 |
|
16725 |
|
16726 |
|
16727 |
|
16728 |
|
16729 |
|
16730 |
|
16731 |
|
16732 |
|
16733 |
|
16734 |
|
16735 |
|
16736 | var aliasMethod;
|
16737 | _exports.aliasMethod = aliasMethod;
|
16738 |
|
16739 | if (_deprecatedFeatures.ALIAS_METHOD) {
|
16740 | _exports.aliasMethod = aliasMethod = function aliasMethod(methodName) {
|
16741 | (true && !(false) && (0, _debug.deprecate)(`You attempted to alias '${methodName}, but aliasMethod has been deprecated. Consider extracting the method into a shared utility function.`, false, {
|
16742 | id: 'object.alias-method',
|
16743 | until: '4.0.0',
|
16744 | url: 'https://emberjs.com/deprecations/v3.x#toc_object-alias-method'
|
16745 | }));
|
16746 | return new AliasImpl(methodName);
|
16747 | };
|
16748 | }
|
16749 |
|
16750 | function observer(...args) {
|
16751 | var funcOrDef = args.pop();
|
16752 | (true && !(typeof funcOrDef === 'function' || typeof funcOrDef === 'object' && funcOrDef !== null) && (0, _debug.assert)('observer must be provided a function or an observer definition', typeof funcOrDef === 'function' || typeof funcOrDef === 'object' && funcOrDef !== null));
|
16753 | var func, dependentKeys, sync;
|
16754 |
|
16755 | if (typeof funcOrDef === 'function') {
|
16756 | func = funcOrDef;
|
16757 | dependentKeys = args;
|
16758 | sync = !_environment.ENV._DEFAULT_ASYNC_OBSERVERS;
|
16759 | } else {
|
16760 | func = funcOrDef.fn;
|
16761 | dependentKeys = funcOrDef.dependentKeys;
|
16762 | sync = funcOrDef.sync;
|
16763 | }
|
16764 |
|
16765 | (true && !(typeof func === 'function') && (0, _debug.assert)('observer called without a function', typeof func === 'function'));
|
16766 | (true && !(Array.isArray(dependentKeys) && dependentKeys.length > 0 && dependentKeys.every(p => typeof p === 'string' && Boolean(p.length))) && (0, _debug.assert)('observer called without valid path', Array.isArray(dependentKeys) && dependentKeys.length > 0 && dependentKeys.every(p => typeof p === 'string' && Boolean(p.length))));
|
16767 | (true && !(typeof sync === 'boolean') && (0, _debug.assert)('observer called without sync', typeof sync === 'boolean'));
|
16768 | var paths = [];
|
16769 |
|
16770 | for (var i = 0; i < dependentKeys.length; ++i) {
|
16771 | expandProperties(dependentKeys[i], path => paths.push(path));
|
16772 | }
|
16773 |
|
16774 | (0, _utils.setObservers)(func, {
|
16775 | paths,
|
16776 | sync
|
16777 | });
|
16778 | return func;
|
16779 | }
|
16780 |
|
16781 | var DEBUG_INJECTION_FUNCTIONS;
|
16782 | _exports.DEBUG_INJECTION_FUNCTIONS = DEBUG_INJECTION_FUNCTIONS;
|
16783 |
|
16784 | if (true
|
16785 |
|
16786 | ) {
|
16787 | _exports.DEBUG_INJECTION_FUNCTIONS = DEBUG_INJECTION_FUNCTIONS = new WeakMap();
|
16788 | }
|
16789 |
|
16790 | function inject(type, ...args) {
|
16791 | (true && !(typeof type === 'string') && (0, _debug.assert)('a string type must be provided to inject', typeof type === 'string'));
|
16792 | var calledAsDecorator = isElementDescriptor(args);
|
16793 | var source, namespace;
|
16794 | var name = calledAsDecorator ? undefined : args[0];
|
16795 | var options = calledAsDecorator ? undefined : args[1];
|
16796 |
|
16797 | var getInjection = function (propertyName) {
|
16798 | var owner = (0, _owner.getOwner)(this) || this.container;
|
16799 |
|
16800 | (true && !(Boolean(owner)) && (0, _debug.assert)(`Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.`, Boolean(owner)));
|
16801 | return owner.lookup(`${type}:${name || propertyName}`, {
|
16802 | source,
|
16803 | namespace
|
16804 | });
|
16805 | };
|
16806 |
|
16807 | if (true
|
16808 |
|
16809 | ) {
|
16810 | DEBUG_INJECTION_FUNCTIONS.set(getInjection, {
|
16811 | namespace,
|
16812 | source,
|
16813 | type,
|
16814 | name
|
16815 | });
|
16816 | }
|
16817 |
|
16818 | var decorator = computed({
|
16819 | get: getInjection,
|
16820 |
|
16821 | set(keyName, value) {
|
16822 | defineProperty(this, keyName, null, value);
|
16823 | }
|
16824 |
|
16825 | });
|
16826 |
|
16827 | if (calledAsDecorator) {
|
16828 | return decorator(args[0], args[1], args[2]);
|
16829 | } else {
|
16830 | return decorator;
|
16831 | }
|
16832 | }
|
16833 |
|
16834 | function tracked(...args) {
|
16835 | (true && !(!(isElementDescriptor(args.slice(0, 3)) && args.length === 5 && args[4] === true)) && (0, _debug.assert)(`@tracked can only be used directly as a native decorator. If you're using tracked in classic classes, add parenthesis to call it like a function: tracked()`, !(isElementDescriptor(args.slice(0, 3)) && args.length === 5 && args[4] === true)));
|
16836 |
|
16837 | if (!isElementDescriptor(args)) {
|
16838 | var propertyDesc = args[0];
|
16839 | (true && !(args.length === 0 || typeof propertyDesc === 'object' && propertyDesc !== null) && (0, _debug.assert)(`tracked() may only receive an options object containing 'value' or 'initializer', received ${propertyDesc}`, args.length === 0 || typeof propertyDesc === 'object' && propertyDesc !== null));
|
16840 |
|
16841 | if (true
|
16842 |
|
16843 | && propertyDesc) {
|
16844 | var keys = Object.keys(propertyDesc);
|
16845 | (true && !(keys.length <= 1 && (keys[0] === undefined || keys[0] === 'value' || keys[0] === 'initializer')) && (0, _debug.assert)(`The options object passed to tracked() may only contain a 'value' or 'initializer' property, not both. Received: [${keys}]`, keys.length <= 1 && (keys[0] === undefined || keys[0] === 'value' || keys[0] === 'initializer')));
|
16846 | (true && !(!('initializer' in propertyDesc) || typeof propertyDesc.initializer === 'function') && (0, _debug.assert)(`The initializer passed to tracked must be a function. Received ${propertyDesc.initializer}`, !('initializer' in propertyDesc) || typeof propertyDesc.initializer === 'function'));
|
16847 | }
|
16848 |
|
16849 | var initializer = propertyDesc ? propertyDesc.initializer : undefined;
|
16850 | var value = propertyDesc ? propertyDesc.value : undefined;
|
16851 |
|
16852 | var decorator = function (target, key, _desc, _meta, isClassicDecorator$$1) {
|
16853 | (true && !(isClassicDecorator$$1) && (0, _debug.assert)(`You attempted to set a default value for ${key} with the @tracked({ value: 'default' }) syntax. You can only use this syntax with classic classes. For native classes, you can use class initializers: @tracked field = 'default';`, isClassicDecorator$$1));
|
16854 | var fieldDesc = {
|
16855 | initializer: initializer || (() => value)
|
16856 | };
|
16857 | return descriptorForField([target, key, fieldDesc]);
|
16858 | };
|
16859 |
|
16860 | setClassicDecorator(decorator);
|
16861 | return decorator;
|
16862 | }
|
16863 |
|
16864 | return descriptorForField(args);
|
16865 | }
|
16866 |
|
16867 | if (true
|
16868 |
|
16869 | ) {
|
16870 |
|
16871 |
|
16872 | setClassicDecorator(tracked);
|
16873 | }
|
16874 |
|
16875 | function descriptorForField([target, key, desc]) {
|
16876 | (true && !(!desc || !desc.value && !desc.get && !desc.set) && (0, _debug.assert)(`You attempted to use @tracked on ${key}, but that element is not a class field. @tracked is only usable on class fields. Native getters and setters will autotrack add any tracked fields they encounter, so there is no need mark getters and setters with @tracked.`, !desc || !desc.value && !desc.get && !desc.set));
|
16877 | var {
|
16878 | getter,
|
16879 | setter
|
16880 | } = (0, _validator.trackedData)(key, desc ? desc.initializer : undefined);
|
16881 |
|
16882 | function get() {
|
16883 | var value = getter(this);
|
16884 |
|
16885 |
|
16886 | if (Array.isArray(value) || (0, _utils.isEmberArray)(value)) {
|
16887 | (0, _validator.consumeTag)((0, _validator.tagFor)(value, '[]'));
|
16888 | }
|
16889 |
|
16890 | return value;
|
16891 | }
|
16892 |
|
16893 | function set(newValue) {
|
16894 | setter(this, newValue);
|
16895 | (0, _validator.dirtyTagFor)(this, SELF_TAG);
|
16896 | }
|
16897 |
|
16898 | var newDesc = {
|
16899 | enumerable: true,
|
16900 | configurable: true,
|
16901 | isTracked: true,
|
16902 | get,
|
16903 | set
|
16904 | };
|
16905 | (0, _meta2.meta)(target).writeDescriptors(key, new TrackedDescriptor(get, set));
|
16906 | return newDesc;
|
16907 | }
|
16908 |
|
16909 | class TrackedDescriptor {
|
16910 | constructor(_get, _set) {
|
16911 | this._get = _get;
|
16912 | this._set = _set;
|
16913 | CHAIN_PASS_THROUGH.add(this);
|
16914 | }
|
16915 |
|
16916 | get(obj) {
|
16917 | return this._get.call(obj);
|
16918 | }
|
16919 |
|
16920 | set(obj, _key, value) {
|
16921 | this._set.call(obj, value);
|
16922 | }
|
16923 |
|
16924 | }
|
16925 | |
16926 |
|
16927 |
|
16928 |
|
16929 |
|
16930 |
|
16931 |
|
16932 |
|
16933 |
|
16934 |
|
16935 |
|
16936 |
|
16937 | |
16938 |
|
16939 |
|
16940 |
|
16941 |
|
16942 |
|
16943 |
|
16944 |
|
16945 |
|
16946 |
|
16947 |
|
16948 |
|
16949 |
|
16950 |
|
16951 |
|
16952 |
|
16953 |
|
16954 |
|
16955 |
|
16956 |
|
16957 |
|
16958 |
|
16959 |
|
16960 |
|
16961 |
|
16962 |
|
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 |
|
17009 |
|
17010 |
|
17011 |
|
17012 |
|
17013 |
|
17014 |
|
17015 |
|
17016 |
|
17017 |
|
17018 |
|
17019 |
|
17020 |
|
17021 |
|
17022 |
|
17023 |
|
17024 |
|
17025 |
|
17026 |
|
17027 |
|
17028 |
|
17029 |
|
17030 |
|
17031 |
|
17032 |
|
17033 |
|
17034 |
|
17035 |
|
17036 |
|
17037 |
|
17038 |
|
17039 |
|
17040 |
|
17041 |
|
17042 |
|
17043 |
|
17044 |
|
17045 |
|
17046 |
|
17047 |
|
17048 |
|
17049 |
|
17050 |
|
17051 | });
|
17052 | define("@ember/-internals/owner/index", ["exports", "@ember/-internals/utils", "@ember/debug"], function (_exports, _utils, _debug) {
|
17053 | "use strict";
|
17054 |
|
17055 | Object.defineProperty(_exports, "__esModule", {
|
17056 | value: true
|
17057 | });
|
17058 | _exports.getOwner = getOwner;
|
17059 | _exports.setOwner = setOwner;
|
17060 | _exports.OWNER = _exports.LEGACY_OWNER = void 0;
|
17061 |
|
17062 | |
17063 |
|
17064 |
|
17065 | var LEGACY_OWNER = (0, _utils.enumerableSymbol)('LEGACY_OWNER');
|
17066 | _exports.LEGACY_OWNER = LEGACY_OWNER;
|
17067 | var OWNER = (0, _utils.symbol)('OWNER');
|
17068 | |
17069 |
|
17070 |
|
17071 |
|
17072 |
|
17073 |
|
17074 |
|
17075 |
|
17076 |
|
17077 |
|
17078 |
|
17079 |
|
17080 |
|
17081 |
|
17082 |
|
17083 |
|
17084 |
|
17085 |
|
17086 |
|
17087 |
|
17088 |
|
17089 |
|
17090 |
|
17091 |
|
17092 |
|
17093 |
|
17094 |
|
17095 |
|
17096 |
|
17097 |
|
17098 |
|
17099 |
|
17100 |
|
17101 |
|
17102 |
|
17103 |
|
17104 |
|
17105 |
|
17106 |
|
17107 |
|
17108 |
|
17109 |
|
17110 |
|
17111 |
|
17112 |
|
17113 | _exports.OWNER = OWNER;
|
17114 |
|
17115 | function getOwner(object) {
|
17116 | var owner = object[OWNER];
|
17117 |
|
17118 | if (owner === undefined) {
|
17119 | owner = object[LEGACY_OWNER];
|
17120 | (true && !(owner === undefined) && (0, _debug.deprecate)(`You accessed the owner using \`getOwner\` on an object, but it was not set on that object with \`setOwner\`. You must use \`setOwner\` to set the owner on all objects. You cannot use Object.assign().`, owner === undefined, {
|
17121 | id: 'owner.legacy-owner-injection',
|
17122 | until: '3.25.0'
|
17123 | }));
|
17124 | }
|
17125 |
|
17126 | return owner;
|
17127 | }
|
17128 | |
17129 |
|
17130 |
|
17131 |
|
17132 |
|
17133 |
|
17134 |
|
17135 |
|
17136 |
|
17137 |
|
17138 |
|
17139 |
|
17140 |
|
17141 |
|
17142 | function setOwner(object, owner) {
|
17143 | object[OWNER] = owner;
|
17144 | object[LEGACY_OWNER] = owner;
|
17145 | }
|
17146 | });
|
17147 | define("@ember/-internals/routing/index", ["exports", "@ember/-internals/routing/lib/ext/controller", "@ember/-internals/routing/lib/location/api", "@ember/-internals/routing/lib/location/none_location", "@ember/-internals/routing/lib/location/hash_location", "@ember/-internals/routing/lib/location/history_location", "@ember/-internals/routing/lib/location/auto_location", "@ember/-internals/routing/lib/system/generate_controller", "@ember/-internals/routing/lib/system/controller_for", "@ember/-internals/routing/lib/system/dsl", "@ember/-internals/routing/lib/system/router", "@ember/-internals/routing/lib/system/route", "@ember/-internals/routing/lib/system/query_params", "@ember/-internals/routing/lib/services/routing", "@ember/-internals/routing/lib/services/router", "@ember/-internals/routing/lib/system/cache"], function (_exports, _controller, _api, _none_location, _hash_location, _history_location, _auto_location, _generate_controller, _controller_for, _dsl, _router, _route, _query_params, _routing, _router2, _cache) {
|
17148 | "use strict";
|
17149 |
|
17150 | Object.defineProperty(_exports, "__esModule", {
|
17151 | value: true
|
17152 | });
|
17153 | Object.defineProperty(_exports, "Location", {
|
17154 | enumerable: true,
|
17155 | get: function () {
|
17156 | return _api.default;
|
17157 | }
|
17158 | });
|
17159 | Object.defineProperty(_exports, "NoneLocation", {
|
17160 | enumerable: true,
|
17161 | get: function () {
|
17162 | return _none_location.default;
|
17163 | }
|
17164 | });
|
17165 | Object.defineProperty(_exports, "HashLocation", {
|
17166 | enumerable: true,
|
17167 | get: function () {
|
17168 | return _hash_location.default;
|
17169 | }
|
17170 | });
|
17171 | Object.defineProperty(_exports, "HistoryLocation", {
|
17172 | enumerable: true,
|
17173 | get: function () {
|
17174 | return _history_location.default;
|
17175 | }
|
17176 | });
|
17177 | Object.defineProperty(_exports, "AutoLocation", {
|
17178 | enumerable: true,
|
17179 | get: function () {
|
17180 | return _auto_location.default;
|
17181 | }
|
17182 | });
|
17183 | Object.defineProperty(_exports, "generateController", {
|
17184 | enumerable: true,
|
17185 | get: function () {
|
17186 | return _generate_controller.default;
|
17187 | }
|
17188 | });
|
17189 | Object.defineProperty(_exports, "generateControllerFactory", {
|
17190 | enumerable: true,
|
17191 | get: function () {
|
17192 | return _generate_controller.generateControllerFactory;
|
17193 | }
|
17194 | });
|
17195 | Object.defineProperty(_exports, "controllerFor", {
|
17196 | enumerable: true,
|
17197 | get: function () {
|
17198 | return _controller_for.default;
|
17199 | }
|
17200 | });
|
17201 | Object.defineProperty(_exports, "RouterDSL", {
|
17202 | enumerable: true,
|
17203 | get: function () {
|
17204 | return _dsl.default;
|
17205 | }
|
17206 | });
|
17207 | Object.defineProperty(_exports, "Router", {
|
17208 | enumerable: true,
|
17209 | get: function () {
|
17210 | return _router.default;
|
17211 | }
|
17212 | });
|
17213 | Object.defineProperty(_exports, "Route", {
|
17214 | enumerable: true,
|
17215 | get: function () {
|
17216 | return _route.default;
|
17217 | }
|
17218 | });
|
17219 | Object.defineProperty(_exports, "QueryParams", {
|
17220 | enumerable: true,
|
17221 | get: function () {
|
17222 | return _query_params.default;
|
17223 | }
|
17224 | });
|
17225 | Object.defineProperty(_exports, "RoutingService", {
|
17226 | enumerable: true,
|
17227 | get: function () {
|
17228 | return _routing.default;
|
17229 | }
|
17230 | });
|
17231 | Object.defineProperty(_exports, "RouterService", {
|
17232 | enumerable: true,
|
17233 | get: function () {
|
17234 | return _router2.default;
|
17235 | }
|
17236 | });
|
17237 | Object.defineProperty(_exports, "BucketCache", {
|
17238 | enumerable: true,
|
17239 | get: function () {
|
17240 | return _cache.default;
|
17241 | }
|
17242 | });
|
17243 | });
|
17244 | define("@ember/-internals/routing/lib/ext/controller", ["exports", "@ember/-internals/metal", "@ember/controller/lib/controller_mixin", "@ember/-internals/routing/lib/utils"], function (_exports, _metal, _controller_mixin, _utils) {
|
17245 | "use strict";
|
17246 |
|
17247 | Object.defineProperty(_exports, "__esModule", {
|
17248 | value: true
|
17249 | });
|
17250 | _exports.default = void 0;
|
17251 |
|
17252 | |
17253 |
|
17254 |
|
17255 | _controller_mixin.default.reopen({
|
17256 | concatenatedProperties: ['queryParams'],
|
17257 |
|
17258 | |
17259 |
|
17260 |
|
17261 |
|
17262 |
|
17263 |
|
17264 |
|
17265 |
|
17266 |
|
17267 |
|
17268 |
|
17269 |
|
17270 |
|
17271 |
|
17272 |
|
17273 |
|
17274 |
|
17275 |
|
17276 |
|
17277 |
|
17278 |
|
17279 | queryParams: null,
|
17280 |
|
17281 | |
17282 |
|
17283 |
|
17284 |
|
17285 |
|
17286 |
|
17287 |
|
17288 |
|
17289 |
|
17290 |
|
17291 |
|
17292 |
|
17293 |
|
17294 |
|
17295 |
|
17296 |
|
17297 | _qpDelegate: null,
|
17298 |
|
17299 | |
17300 |
|
17301 |
|
17302 |
|
17303 |
|
17304 |
|
17305 |
|
17306 |
|
17307 |
|
17308 |
|
17309 | _qpChanged(controller, _prop) {
|
17310 | var dotIndex = _prop.indexOf('.[]');
|
17311 |
|
17312 | var prop = dotIndex === -1 ? _prop : _prop.slice(0, dotIndex);
|
17313 | var delegate = controller._qpDelegate;
|
17314 | var value = (0, _metal.get)(controller, prop);
|
17315 | delegate(prop, value);
|
17316 | },
|
17317 |
|
17318 | |
17319 |
|
17320 |
|
17321 |
|
17322 |
|
17323 |
|
17324 |
|
17325 |
|
17326 |
|
17327 |
|
17328 |
|
17329 |
|
17330 |
|
17331 |
|
17332 |
|
17333 |
|
17334 |
|
17335 |
|
17336 |
|
17337 |
|
17338 |
|
17339 |
|
17340 |
|
17341 |
|
17342 |
|
17343 |
|
17344 |
|
17345 |
|
17346 |
|
17347 |
|
17348 |
|
17349 |
|
17350 |
|
17351 |
|
17352 |
|
17353 |
|
17354 |
|
17355 |
|
17356 |
|
17357 |
|
17358 |
|
17359 |
|
17360 |
|
17361 |
|
17362 |
|
17363 |
|
17364 |
|
17365 |
|
17366 |
|
17367 |
|
17368 |
|
17369 |
|
17370 |
|
17371 |
|
17372 |
|
17373 |
|
17374 |
|
17375 |
|
17376 | transitionToRoute(...args) {
|
17377 |
|
17378 | var target = (0, _metal.get)(this, 'target');
|
17379 | var method = target.transitionToRoute || target.transitionTo;
|
17380 | return method.apply(target, (0, _utils.prefixRouteNameArg)(this, args));
|
17381 | },
|
17382 |
|
17383 | |
17384 |
|
17385 |
|
17386 |
|
17387 |
|
17388 |
|
17389 |
|
17390 |
|
17391 |
|
17392 |
|
17393 |
|
17394 |
|
17395 |
|
17396 |
|
17397 |
|
17398 |
|
17399 |
|
17400 |
|
17401 |
|
17402 |
|
17403 |
|
17404 |
|
17405 |
|
17406 |
|
17407 |
|
17408 |
|
17409 |
|
17410 |
|
17411 |
|
17412 |
|
17413 |
|
17414 |
|
17415 |
|
17416 |
|
17417 |
|
17418 |
|
17419 |
|
17420 |
|
17421 |
|
17422 |
|
17423 |
|
17424 |
|
17425 |
|
17426 |
|
17427 |
|
17428 |
|
17429 | replaceRoute(...args) {
|
17430 |
|
17431 | var target = (0, _metal.get)(this, 'target');
|
17432 | var method = target.replaceRoute || target.replaceWith;
|
17433 | return method.apply(target, (0, _utils.prefixRouteNameArg)(this, args));
|
17434 | }
|
17435 |
|
17436 | });
|
17437 |
|
17438 | var _default = _controller_mixin.default;
|
17439 | _exports.default = _default;
|
17440 | });
|
17441 | define("@ember/-internals/routing/lib/location/api", ["exports", "@ember/debug"], function (_exports, _debug) {
|
17442 | "use strict";
|
17443 |
|
17444 | Object.defineProperty(_exports, "__esModule", {
|
17445 | value: true
|
17446 | });
|
17447 | _exports.default = void 0;
|
17448 |
|
17449 | |
17450 |
|
17451 |
|
17452 |
|
17453 | |
17454 |
|
17455 |
|
17456 |
|
17457 |
|
17458 |
|
17459 |
|
17460 |
|
17461 |
|
17462 |
|
17463 |
|
17464 |
|
17465 |
|
17466 |
|
17467 |
|
17468 |
|
17469 |
|
17470 |
|
17471 |
|
17472 |
|
17473 |
|
17474 |
|
17475 |
|
17476 |
|
17477 |
|
17478 |
|
17479 |
|
17480 |
|
17481 |
|
17482 |
|
17483 |
|
17484 |
|
17485 |
|
17486 |
|
17487 |
|
17488 |
|
17489 |
|
17490 |
|
17491 |
|
17492 |
|
17493 |
|
17494 |
|
17495 |
|
17496 |
|
17497 |
|
17498 |
|
17499 |
|
17500 |
|
17501 |
|
17502 |
|
17503 |
|
17504 |
|
17505 |
|
17506 |
|
17507 |
|
17508 |
|
17509 |
|
17510 | var _default = {
|
17511 | |
17512 |
|
17513 |
|
17514 |
|
17515 |
|
17516 |
|
17517 |
|
17518 |
|
17519 |
|
17520 |
|
17521 |
|
17522 |
|
17523 |
|
17524 |
|
17525 |
|
17526 |
|
17527 |
|
17528 | create(options) {
|
17529 | var implementation = options && options.implementation;
|
17530 | (true && !(Boolean(implementation)) && (0, _debug.assert)("Location.create: you must specify a 'implementation' option", Boolean(implementation)));
|
17531 | var implementationClass = this.implementations[implementation];
|
17532 | (true && !(Boolean(implementationClass)) && (0, _debug.assert)(`Location.create: ${implementation} is not a valid implementation`, Boolean(implementationClass)));
|
17533 | return implementationClass.create(...arguments);
|
17534 | },
|
17535 |
|
17536 | implementations: {}
|
17537 | };
|
17538 | _exports.default = _default;
|
17539 | });
|
17540 | define("@ember/-internals/routing/lib/location/auto_location", ["exports", "@ember/-internals/browser-environment", "@ember/-internals/metal", "@ember/-internals/owner", "@ember/-internals/runtime", "@ember/-internals/utils", "@ember/debug", "@ember/-internals/routing/lib/location/util"], function (_exports, _browserEnvironment, _metal, _owner, _runtime, _utils, _debug, _util) {
|
17541 | "use strict";
|
17542 |
|
17543 | Object.defineProperty(_exports, "__esModule", {
|
17544 | value: true
|
17545 | });
|
17546 | _exports.getHistoryPath = getHistoryPath;
|
17547 | _exports.getHashPath = getHashPath;
|
17548 | _exports.default = void 0;
|
17549 |
|
17550 | |
17551 |
|
17552 |
|
17553 |
|
17554 | |
17555 |
|
17556 |
|
17557 |
|
17558 |
|
17559 |
|
17560 |
|
17561 |
|
17562 |
|
17563 |
|
17564 |
|
17565 |
|
17566 |
|
17567 |
|
17568 |
|
17569 |
|
17570 |
|
17571 |
|
17572 |
|
17573 |
|
17574 |
|
17575 |
|
17576 |
|
17577 |
|
17578 |
|
17579 |
|
17580 |
|
17581 |
|
17582 |
|
17583 |
|
17584 |
|
17585 |
|
17586 |
|
17587 |
|
17588 |
|
17589 |
|
17590 |
|
17591 |
|
17592 |
|
17593 |
|
17594 |
|
17595 |
|
17596 |
|
17597 | class AutoLocation extends _runtime.Object {
|
17598 | constructor() {
|
17599 | super(...arguments);
|
17600 | this.implementation = 'auto';
|
17601 | }
|
17602 | |
17603 |
|
17604 |
|
17605 |
|
17606 |
|
17607 |
|
17608 |
|
17609 |
|
17610 | detect() {
|
17611 | var rootURL = this.rootURL;
|
17612 | (true && !(rootURL.charAt(rootURL.length - 1) === '/') && (0, _debug.assert)('rootURL must end with a trailing forward slash e.g. "/app/"', rootURL.charAt(rootURL.length - 1) === '/'));
|
17613 | var implementation = detectImplementation({
|
17614 | location: this.location,
|
17615 | history: this.history,
|
17616 | userAgent: this.userAgent,
|
17617 | rootURL,
|
17618 | documentMode: this.documentMode,
|
17619 | global: this.global
|
17620 | });
|
17621 |
|
17622 | if (implementation === false) {
|
17623 | (0, _metal.set)(this, 'cancelRouterSetup', true);
|
17624 | implementation = 'none';
|
17625 | }
|
17626 |
|
17627 | var concrete = (0, _owner.getOwner)(this).lookup(`location:${implementation}`);
|
17628 | (true && !(concrete !== undefined) && (0, _debug.assert)(`Could not find location '${implementation}'.`, concrete !== undefined));
|
17629 | (0, _metal.set)(concrete, 'rootURL', rootURL);
|
17630 | (0, _metal.set)(this, 'concreteImplementation', concrete);
|
17631 | }
|
17632 |
|
17633 | willDestroy() {
|
17634 | var {
|
17635 | concreteImplementation
|
17636 | } = this;
|
17637 |
|
17638 | if (concreteImplementation) {
|
17639 | concreteImplementation.destroy();
|
17640 | }
|
17641 | }
|
17642 |
|
17643 | }
|
17644 |
|
17645 | _exports.default = AutoLocation;
|
17646 | AutoLocation.reopen({
|
17647 | |
17648 |
|
17649 |
|
17650 |
|
17651 |
|
17652 |
|
17653 |
|
17654 | rootURL: '/',
|
17655 | initState: delegateToConcreteImplementation('initState'),
|
17656 | getURL: delegateToConcreteImplementation('getURL'),
|
17657 | setURL: delegateToConcreteImplementation('setURL'),
|
17658 | replaceURL: delegateToConcreteImplementation('replaceURL'),
|
17659 | onUpdateURL: delegateToConcreteImplementation('onUpdateURL'),
|
17660 | formatURL: delegateToConcreteImplementation('formatURL'),
|
17661 |
|
17662 | |
17663 |
|
17664 |
|
17665 |
|
17666 |
|
17667 |
|
17668 |
|
17669 | location: _browserEnvironment.location,
|
17670 |
|
17671 | |
17672 |
|
17673 |
|
17674 |
|
17675 |
|
17676 |
|
17677 |
|
17678 |
|
17679 | history: _browserEnvironment.history,
|
17680 |
|
17681 | |
17682 |
|
17683 |
|
17684 |
|
17685 |
|
17686 |
|
17687 |
|
17688 | global: _browserEnvironment.window,
|
17689 |
|
17690 | |
17691 |
|
17692 |
|
17693 |
|
17694 |
|
17695 |
|
17696 |
|
17697 |
|
17698 | userAgent: _browserEnvironment.userAgent,
|
17699 |
|
17700 | |
17701 |
|
17702 |
|
17703 |
|
17704 |
|
17705 |
|
17706 |
|
17707 |
|
17708 | cancelRouterSetup: false
|
17709 | });
|
17710 |
|
17711 | function delegateToConcreteImplementation(methodName) {
|
17712 | return function (...args) {
|
17713 | var {
|
17714 | concreteImplementation
|
17715 | } = this;
|
17716 | (true && !(Boolean(concreteImplementation)) && (0, _debug.assert)("AutoLocation's detect() method should be called before calling any other hooks.", Boolean(concreteImplementation)));
|
17717 | return (0, _utils.tryInvoke)(concreteImplementation, methodName, args);
|
17718 | };
|
17719 | }
|
17720 |
|
17721 | function detectImplementation(options) {
|
17722 | var {
|
17723 | location,
|
17724 | userAgent,
|
17725 | history,
|
17726 | documentMode,
|
17727 | global,
|
17728 | rootURL
|
17729 | } = options;
|
17730 | var implementation = 'none';
|
17731 | var cancelRouterSetup = false;
|
17732 | var currentPath = (0, _util.getFullPath)(location);
|
17733 |
|
17734 | if ((0, _util.supportsHistory)(userAgent, history)) {
|
17735 | var historyPath = getHistoryPath(rootURL, location);
|
17736 |
|
17737 |
|
17738 | if (currentPath === historyPath) {
|
17739 | implementation = 'history';
|
17740 | } else if (currentPath.substr(0, 2) === '/#') {
|
17741 | history.replaceState({
|
17742 | path: historyPath
|
17743 | }, '', historyPath);
|
17744 | implementation = 'history';
|
17745 | } else {
|
17746 | cancelRouterSetup = true;
|
17747 | (0, _util.replacePath)(location, historyPath);
|
17748 | }
|
17749 | } else if ((0, _util.supportsHashChange)(documentMode, global)) {
|
17750 | var hashPath = getHashPath(rootURL, location);
|
17751 |
|
17752 |
|
17753 |
|
17754 | if (currentPath === hashPath || currentPath === '/' && hashPath === '/#/') {
|
17755 | implementation = 'hash';
|
17756 | } else {
|
17757 |
|
17758 |
|
17759 | cancelRouterSetup = true;
|
17760 | (0, _util.replacePath)(location, hashPath);
|
17761 | }
|
17762 | }
|
17763 |
|
17764 | if (cancelRouterSetup) {
|
17765 | return false;
|
17766 | }
|
17767 |
|
17768 | return implementation;
|
17769 | }
|
17770 | |
17771 |
|
17772 |
|
17773 |
|
17774 |
|
17775 |
|
17776 |
|
17777 |
|
17778 |
|
17779 | function getHistoryPath(rootURL, location) {
|
17780 | var path = (0, _util.getPath)(location);
|
17781 | var hash = (0, _util.getHash)(location);
|
17782 | var query = (0, _util.getQuery)(location);
|
17783 | var rootURLIndex = path.indexOf(rootURL);
|
17784 | var routeHash, hashParts;
|
17785 | (true && !(rootURLIndex === 0) && (0, _debug.assert)(`Path ${path} does not start with the provided rootURL ${rootURL}`, rootURLIndex === 0));
|
17786 |
|
17787 |
|
17788 |
|
17789 | if (hash.substr(0, 2) === '#/') {
|
17790 |
|
17791 | hashParts = hash.substr(1).split('#');
|
17792 |
|
17793 | routeHash = hashParts.shift();
|
17794 |
|
17795 |
|
17796 | if (path.charAt(path.length - 1) === '/') {
|
17797 | routeHash = routeHash.substr(1);
|
17798 | }
|
17799 |
|
17800 |
|
17801 | path += routeHash + query;
|
17802 |
|
17803 | if (hashParts.length) {
|
17804 | path += `#${hashParts.join('#')}`;
|
17805 | }
|
17806 | } else {
|
17807 | path += query + hash;
|
17808 | }
|
17809 |
|
17810 | return path;
|
17811 | }
|
17812 | |
17813 |
|
17814 |
|
17815 |
|
17816 |
|
17817 |
|
17818 |
|
17819 |
|
17820 |
|
17821 |
|
17822 | function getHashPath(rootURL, location) {
|
17823 | var path = rootURL;
|
17824 | var historyPath = getHistoryPath(rootURL, location);
|
17825 | var routePath = historyPath.substr(rootURL.length);
|
17826 |
|
17827 | if (routePath !== '') {
|
17828 | if (routePath[0] !== '/') {
|
17829 | routePath = `/${routePath}`;
|
17830 | }
|
17831 |
|
17832 | path += `#${routePath}`;
|
17833 | }
|
17834 |
|
17835 | return path;
|
17836 | }
|
17837 | });
|
17838 | define("@ember/-internals/routing/lib/location/hash_location", ["exports", "@ember/-internals/metal", "@ember/-internals/runtime", "@ember/runloop", "@ember/-internals/routing/lib/location/util"], function (_exports, _metal, _runtime, _runloop, _util) {
|
17839 | "use strict";
|
17840 |
|
17841 | Object.defineProperty(_exports, "__esModule", {
|
17842 | value: true
|
17843 | });
|
17844 | _exports.default = void 0;
|
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 |
|
17876 |
|
17877 |
|
17878 | class HashLocation extends _runtime.Object {
|
17879 | constructor() {
|
17880 | super(...arguments);
|
17881 | this.implementation = 'hash';
|
17882 | }
|
17883 |
|
17884 | init() {
|
17885 | (0, _metal.set)(this, 'location', this._location || window.location);
|
17886 | this._hashchangeHandler = undefined;
|
17887 | }
|
17888 | |
17889 |
|
17890 |
|
17891 |
|
17892 |
|
17893 |
|
17894 |
|
17895 |
|
17896 | getHash() {
|
17897 | return (0, _util.getHash)(this.location);
|
17898 | }
|
17899 | |
17900 |
|
17901 |
|
17902 |
|
17903 |
|
17904 |
|
17905 |
|
17906 |
|
17907 |
|
17908 |
|
17909 | getURL() {
|
17910 | var originalPath = this.getHash().substr(1);
|
17911 | var outPath = originalPath;
|
17912 |
|
17913 | if (outPath[0] !== '/') {
|
17914 | outPath = '/';
|
17915 |
|
17916 |
|
17917 |
|
17918 |
|
17919 | if (originalPath) {
|
17920 | outPath += `#${originalPath}`;
|
17921 | }
|
17922 | }
|
17923 |
|
17924 | return outPath;
|
17925 | }
|
17926 | |
17927 |
|
17928 |
|
17929 |
|
17930 |
|
17931 |
|
17932 |
|
17933 |
|
17934 |
|
17935 |
|
17936 | setURL(path) {
|
17937 | this.location.hash = path;
|
17938 | (0, _metal.set)(this, 'lastSetURL', path);
|
17939 | }
|
17940 | |
17941 |
|
17942 |
|
17943 |
|
17944 |
|
17945 |
|
17946 |
|
17947 |
|
17948 |
|
17949 | replaceURL(path) {
|
17950 | this.location.replace(`#${path}`);
|
17951 | (0, _metal.set)(this, 'lastSetURL', path);
|
17952 | }
|
17953 | |
17954 |
|
17955 |
|
17956 |
|
17957 |
|
17958 |
|
17959 |
|
17960 |
|
17961 |
|
17962 |
|
17963 | onUpdateURL(callback) {
|
17964 | this._removeEventListener();
|
17965 |
|
17966 | this._hashchangeHandler = (0, _runloop.bind)(this, function () {
|
17967 | var path = this.getURL();
|
17968 |
|
17969 | if (this.lastSetURL === path) {
|
17970 | return;
|
17971 | }
|
17972 |
|
17973 | (0, _metal.set)(this, 'lastSetURL', null);
|
17974 | callback(path);
|
17975 | });
|
17976 | window.addEventListener('hashchange', this._hashchangeHandler);
|
17977 | }
|
17978 | |
17979 |
|
17980 |
|
17981 |
|
17982 |
|
17983 |
|
17984 |
|
17985 |
|
17986 |
|
17987 |
|
17988 |
|
17989 | formatURL(url) {
|
17990 | return `#${url}`;
|
17991 | }
|
17992 | |
17993 |
|
17994 |
|
17995 |
|
17996 |
|
17997 |
|
17998 |
|
17999 | willDestroy() {
|
18000 | this._removeEventListener();
|
18001 | }
|
18002 |
|
18003 | _removeEventListener() {
|
18004 | if (this._hashchangeHandler) {
|
18005 | window.removeEventListener('hashchange', this._hashchangeHandler);
|
18006 | }
|
18007 | }
|
18008 |
|
18009 | }
|
18010 |
|
18011 | _exports.default = HashLocation;
|
18012 | });
|
18013 | define("@ember/-internals/routing/lib/location/history_location", ["exports", "@ember/-internals/metal", "@ember/-internals/runtime", "@ember/-internals/routing/lib/location/util"], function (_exports, _metal, _runtime, _util) {
|
18014 | "use strict";
|
18015 |
|
18016 | Object.defineProperty(_exports, "__esModule", {
|
18017 | value: true
|
18018 | });
|
18019 | _exports.default = void 0;
|
18020 |
|
18021 | |
18022 |
|
18023 |
|
18024 | var popstateFired = false;
|
18025 |
|
18026 | function _uuid() {
|
18027 | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
18028 | var r, v;
|
18029 | r = Math.random() * 16 | 0;
|
18030 | v = c === 'x' ? r : r & 3 | 8;
|
18031 | return v.toString(16);
|
18032 | });
|
18033 | }
|
18034 | |
18035 |
|
18036 |
|
18037 |
|
18038 |
|
18039 |
|
18040 |
|
18041 |
|
18042 |
|
18043 |
|
18044 |
|
18045 |
|
18046 |
|
18047 |
|
18048 |
|
18049 |
|
18050 |
|
18051 |
|
18052 |
|
18053 |
|
18054 |
|
18055 |
|
18056 |
|
18057 |
|
18058 |
|
18059 |
|
18060 |
|
18061 |
|
18062 |
|
18063 |
|
18064 |
|
18065 |
|
18066 | class HistoryLocation extends _runtime.Object {
|
18067 | constructor() {
|
18068 | super(...arguments);
|
18069 | this.implementation = 'history';
|
18070 | |
18071 |
|
18072 |
|
18073 |
|
18074 |
|
18075 |
|
18076 |
|
18077 | this.rootURL = '/';
|
18078 | }
|
18079 | |
18080 |
|
18081 |
|
18082 |
|
18083 |
|
18084 |
|
18085 |
|
18086 | getHash() {
|
18087 | return (0, _util.getHash)(this.location);
|
18088 | }
|
18089 |
|
18090 | init() {
|
18091 | this._super(...arguments);
|
18092 |
|
18093 | var base = document.querySelector('base');
|
18094 | var baseURL = '';
|
18095 |
|
18096 | if (base !== null && base.hasAttribute('href')) {
|
18097 | baseURL = base.getAttribute('href');
|
18098 | }
|
18099 |
|
18100 | (0, _metal.set)(this, 'baseURL', baseURL);
|
18101 | (0, _metal.set)(this, 'location', this.location || window.location);
|
18102 | this._popstateHandler = undefined;
|
18103 | }
|
18104 | |
18105 |
|
18106 |
|
18107 |
|
18108 |
|
18109 |
|
18110 |
|
18111 | initState() {
|
18112 | var history = this.history || window.history;
|
18113 | (0, _metal.set)(this, 'history', history);
|
18114 | var {
|
18115 | state
|
18116 | } = history;
|
18117 | var path = this.formatURL(this.getURL());
|
18118 |
|
18119 | if (state && state.path === path) {
|
18120 |
|
18121 |
|
18122 | this._previousURL = this.getURL();
|
18123 | } else {
|
18124 | this.replaceState(path);
|
18125 | }
|
18126 | }
|
18127 | |
18128 |
|
18129 |
|
18130 |
|
18131 |
|
18132 |
|
18133 |
|
18134 |
|
18135 | getURL() {
|
18136 | var {
|
18137 | location,
|
18138 | rootURL,
|
18139 | baseURL
|
18140 | } = this;
|
18141 | var path = location.pathname;
|
18142 |
|
18143 | rootURL = rootURL.replace(/\/$/, '');
|
18144 | baseURL = baseURL.replace(/\/$/, '');
|
18145 |
|
18146 | var url = path.replace(new RegExp(`^${baseURL}(?=/|$)`), '').replace(new RegExp(`^${rootURL}(?=/|$)`), '').replace(/\/\//g, '/');
|
18147 |
|
18148 | var search = location.search || '';
|
18149 | url += search + this.getHash();
|
18150 | return url;
|
18151 | }
|
18152 | |
18153 |
|
18154 |
|
18155 |
|
18156 |
|
18157 |
|
18158 |
|
18159 |
|
18160 | setURL(path) {
|
18161 | var {
|
18162 | state
|
18163 | } = this.history;
|
18164 | path = this.formatURL(path);
|
18165 |
|
18166 | if (!state || state.path !== path) {
|
18167 | this.pushState(path);
|
18168 | }
|
18169 | }
|
18170 | |
18171 |
|
18172 |
|
18173 |
|
18174 |
|
18175 |
|
18176 |
|
18177 |
|
18178 |
|
18179 | replaceURL(path) {
|
18180 | var {
|
18181 | state
|
18182 | } = this.history;
|
18183 | path = this.formatURL(path);
|
18184 |
|
18185 | if (!state || state.path !== path) {
|
18186 | this.replaceState(path);
|
18187 | }
|
18188 | }
|
18189 | |
18190 |
|
18191 |
|
18192 |
|
18193 |
|
18194 |
|
18195 |
|
18196 |
|
18197 | pushState(path) {
|
18198 | var state = {
|
18199 | path,
|
18200 | uuid: _uuid()
|
18201 | };
|
18202 | this.history.pushState(state, null, path);
|
18203 |
|
18204 | this._previousURL = this.getURL();
|
18205 | }
|
18206 | |
18207 |
|
18208 |
|
18209 |
|
18210 |
|
18211 |
|
18212 |
|
18213 |
|
18214 | replaceState(path) {
|
18215 | var state = {
|
18216 | path,
|
18217 | uuid: _uuid()
|
18218 | };
|
18219 | this.history.replaceState(state, null, path);
|
18220 |
|
18221 | this._previousURL = this.getURL();
|
18222 | }
|
18223 | |
18224 |
|
18225 |
|
18226 |
|
18227 |
|
18228 |
|
18229 |
|
18230 |
|
18231 |
|
18232 | onUpdateURL(callback) {
|
18233 | this._removeEventListener();
|
18234 |
|
18235 | this._popstateHandler = () => {
|
18236 |
|
18237 | if (!popstateFired) {
|
18238 | popstateFired = true;
|
18239 |
|
18240 | if (this.getURL() === this._previousURL) {
|
18241 | return;
|
18242 | }
|
18243 | }
|
18244 |
|
18245 | callback(this.getURL());
|
18246 | };
|
18247 |
|
18248 | window.addEventListener('popstate', this._popstateHandler);
|
18249 | }
|
18250 | |
18251 |
|
18252 |
|
18253 |
|
18254 |
|
18255 |
|
18256 |
|
18257 |
|
18258 |
|
18259 | formatURL(url) {
|
18260 | var {
|
18261 | rootURL,
|
18262 | baseURL
|
18263 | } = this;
|
18264 |
|
18265 | if (url !== '') {
|
18266 |
|
18267 | rootURL = rootURL.replace(/\/$/, '');
|
18268 | baseURL = baseURL.replace(/\/$/, '');
|
18269 | } else if (baseURL[0] === '/' && rootURL[0] === '/') {
|
18270 |
|
18271 |
|
18272 | baseURL = baseURL.replace(/\/$/, '');
|
18273 | }
|
18274 |
|
18275 | return baseURL + rootURL + url;
|
18276 | }
|
18277 | |
18278 |
|
18279 |
|
18280 |
|
18281 |
|
18282 |
|
18283 |
|
18284 | willDestroy() {
|
18285 | this._removeEventListener();
|
18286 | }
|
18287 |
|
18288 | _removeEventListener() {
|
18289 | if (this._popstateHandler) {
|
18290 | window.removeEventListener('popstate', this._popstateHandler);
|
18291 | }
|
18292 | }
|
18293 |
|
18294 | }
|
18295 |
|
18296 | _exports.default = HistoryLocation;
|
18297 | });
|
18298 | define("@ember/-internals/routing/lib/location/none_location", ["exports", "@ember/-internals/metal", "@ember/-internals/runtime", "@ember/debug"], function (_exports, _metal, _runtime, _debug) {
|
18299 | "use strict";
|
18300 |
|
18301 | Object.defineProperty(_exports, "__esModule", {
|
18302 | value: true
|
18303 | });
|
18304 | _exports.default = void 0;
|
18305 |
|
18306 | |
18307 |
|
18308 |
|
18309 |
|
18310 | |
18311 |
|
18312 |
|
18313 |
|
18314 |
|
18315 |
|
18316 |
|
18317 |
|
18318 |
|
18319 |
|
18320 |
|
18321 |
|
18322 |
|
18323 |
|
18324 | class NoneLocation extends _runtime.Object {
|
18325 | constructor() {
|
18326 | super(...arguments);
|
18327 | this.implementation = 'none';
|
18328 | }
|
18329 |
|
18330 | detect() {
|
18331 | var {
|
18332 | rootURL
|
18333 | } = this;
|
18334 | (true && !(rootURL.charAt(rootURL.length - 1) === '/') && (0, _debug.assert)('rootURL must end with a trailing forward slash e.g. "/app/"', rootURL.charAt(rootURL.length - 1) === '/'));
|
18335 | }
|
18336 | |
18337 |
|
18338 |
|
18339 |
|
18340 |
|
18341 |
|
18342 |
|
18343 |
|
18344 | getURL() {
|
18345 | var {
|
18346 | path,
|
18347 | rootURL
|
18348 | } = this;
|
18349 |
|
18350 | rootURL = rootURL.replace(/\/$/, '');
|
18351 |
|
18352 | return path.replace(new RegExp(`^${rootURL}(?=/|$)`), '');
|
18353 | }
|
18354 | |
18355 |
|
18356 |
|
18357 |
|
18358 |
|
18359 |
|
18360 |
|
18361 |
|
18362 |
|
18363 | setURL(path) {
|
18364 | (0, _metal.set)(this, 'path', path);
|
18365 | }
|
18366 | |
18367 |
|
18368 |
|
18369 |
|
18370 |
|
18371 |
|
18372 |
|
18373 |
|
18374 |
|
18375 |
|
18376 | onUpdateURL(callback) {
|
18377 | this.updateCallback = callback;
|
18378 | }
|
18379 | |
18380 |
|
18381 |
|
18382 |
|
18383 |
|
18384 |
|
18385 |
|
18386 |
|
18387 | handleURL(url) {
|
18388 | (0, _metal.set)(this, 'path', url);
|
18389 | this.updateCallback(url);
|
18390 | }
|
18391 | |
18392 |
|
18393 |
|
18394 |
|
18395 |
|
18396 |
|
18397 |
|
18398 |
|
18399 |
|
18400 |
|
18401 |
|
18402 |
|
18403 | formatURL(url) {
|
18404 | var {
|
18405 | rootURL
|
18406 | } = this;
|
18407 |
|
18408 | if (url !== '') {
|
18409 |
|
18410 | rootURL = rootURL.replace(/\/$/, '');
|
18411 | }
|
18412 |
|
18413 | return rootURL + url;
|
18414 | }
|
18415 |
|
18416 | }
|
18417 |
|
18418 | _exports.default = NoneLocation;
|
18419 | NoneLocation.reopen({
|
18420 | path: '',
|
18421 |
|
18422 | |
18423 |
|
18424 |
|
18425 |
|
18426 |
|
18427 |
|
18428 | rootURL: '/'
|
18429 | });
|
18430 | });
|
18431 | define("@ember/-internals/routing/lib/location/util", ["exports"], function (_exports) {
|
18432 | "use strict";
|
18433 |
|
18434 | Object.defineProperty(_exports, "__esModule", {
|
18435 | value: true
|
18436 | });
|
18437 | _exports.getPath = getPath;
|
18438 | _exports.getQuery = getQuery;
|
18439 | _exports.getHash = getHash;
|
18440 | _exports.getFullPath = getFullPath;
|
18441 | _exports.getOrigin = getOrigin;
|
18442 | _exports.supportsHashChange = supportsHashChange;
|
18443 | _exports.supportsHistory = supportsHistory;
|
18444 | _exports.replacePath = replacePath;
|
18445 |
|
18446 | |
18447 |
|
18448 |
|
18449 |
|
18450 |
|
18451 | function getPath(location) {
|
18452 | var pathname = location.pathname;
|
18453 |
|
18454 | if (pathname[0] !== '/') {
|
18455 | pathname = `/${pathname}`;
|
18456 | }
|
18457 |
|
18458 | return pathname;
|
18459 | }
|
18460 | |
18461 |
|
18462 |
|
18463 |
|
18464 |
|
18465 |
|
18466 |
|
18467 | function getQuery(location) {
|
18468 | return location.search;
|
18469 | }
|
18470 | |
18471 |
|
18472 |
|
18473 |
|
18474 |
|
18475 |
|
18476 |
|
18477 | function getHash(location) {
|
18478 | if (location.hash !== undefined) {
|
18479 | return location.hash.substr(0);
|
18480 | }
|
18481 |
|
18482 | return '';
|
18483 | }
|
18484 |
|
18485 | function getFullPath(location) {
|
18486 | return getPath(location) + getQuery(location) + getHash(location);
|
18487 | }
|
18488 |
|
18489 | function getOrigin(location) {
|
18490 | var origin = location.origin;
|
18491 |
|
18492 | if (!origin) {
|
18493 | origin = `${location.protocol}//${location.hostname}`;
|
18494 |
|
18495 | if (location.port) {
|
18496 | origin += `:${location.port}`;
|
18497 | }
|
18498 | }
|
18499 |
|
18500 | return origin;
|
18501 | }
|
18502 | |
18503 |
|
18504 |
|
18505 |
|
18506 |
|
18507 |
|
18508 |
|
18509 |
|
18510 |
|
18511 |
|
18512 |
|
18513 | function supportsHashChange(documentMode, global) {
|
18514 | return global && 'onhashchange' in global && (documentMode === undefined || documentMode > 7);
|
18515 | }
|
18516 | |
18517 |
|
18518 |
|
18519 |
|
18520 |
|
18521 |
|
18522 |
|
18523 |
|
18524 |
|
18525 |
|
18526 | function supportsHistory(userAgent, history) {
|
18527 |
|
18528 |
|
18529 |
|
18530 |
|
18531 |
|
18532 |
|
18533 | if ((userAgent.indexOf('Android 2.') !== -1 || userAgent.indexOf('Android 4.0') !== -1) && userAgent.indexOf('Mobile Safari') !== -1 && userAgent.indexOf('Chrome') === -1 && userAgent.indexOf('Windows Phone') === -1) {
|
18534 | return false;
|
18535 | }
|
18536 |
|
18537 | return Boolean(history && 'pushState' in history);
|
18538 | }
|
18539 | |
18540 |
|
18541 |
|
18542 |
|
18543 |
|
18544 |
|
18545 |
|
18546 |
|
18547 | function replacePath(location, path) {
|
18548 | location.replace(getOrigin(location) + path);
|
18549 | }
|
18550 | });
|
18551 | define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-internals/runtime", "@ember/debug", "@ember/object/computed", "@ember/polyfills", "@ember/service", "@ember/-internals/routing/lib/utils"], function (_exports, _runtime, _debug, _computed, _polyfills, _service, _utils) {
|
18552 | "use strict";
|
18553 |
|
18554 | Object.defineProperty(_exports, "__esModule", {
|
18555 | value: true
|
18556 | });
|
18557 | _exports.default = void 0;
|
18558 | var freezeRouteInfo;
|
18559 |
|
18560 | if (true
|
18561 |
|
18562 | ) {
|
18563 | freezeRouteInfo = transition => {
|
18564 | if (transition.from !== null && !Object.isFrozen(transition.from)) {
|
18565 | Object.freeze(transition.from);
|
18566 | }
|
18567 |
|
18568 | if (transition.to !== null && !Object.isFrozen(transition.to)) {
|
18569 | Object.freeze(transition.to);
|
18570 | }
|
18571 | };
|
18572 | }
|
18573 |
|
18574 | function cleanURL(url, rootURL) {
|
18575 | if (rootURL === '/') {
|
18576 | return url;
|
18577 | }
|
18578 |
|
18579 | return url.substr(rootURL.length, url.length);
|
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 |
|
18608 |
|
18609 |
|
18610 |
|
18611 |
|
18612 |
|
18613 |
|
18614 | class RouterService extends _service.default {
|
18615 | init() {
|
18616 | super.init(...arguments);
|
18617 |
|
18618 | this._router.on('routeWillChange', transition => {
|
18619 | if (true
|
18620 |
|
18621 | ) {
|
18622 | freezeRouteInfo(transition);
|
18623 | }
|
18624 |
|
18625 | this.trigger('routeWillChange', transition);
|
18626 | });
|
18627 |
|
18628 | this._router.on('routeDidChange', transition => {
|
18629 | if (true
|
18630 |
|
18631 | ) {
|
18632 | freezeRouteInfo(transition);
|
18633 | }
|
18634 |
|
18635 | this.trigger('routeDidChange', transition);
|
18636 | });
|
18637 | }
|
18638 | |
18639 |
|
18640 |
|
18641 |
|
18642 |
|
18643 |
|
18644 |
|
18645 |
|
18646 |
|
18647 |
|
18648 |
|
18649 |
|
18650 |
|
18651 |
|
18652 |
|
18653 |
|
18654 |
|
18655 |
|
18656 |
|
18657 |
|
18658 |
|
18659 |
|
18660 |
|
18661 |
|
18662 |
|
18663 |
|
18664 |
|
18665 |
|
18666 |
|
18667 |
|
18668 |
|
18669 |
|
18670 |
|
18671 |
|
18672 |
|
18673 |
|
18674 |
|
18675 |
|
18676 |
|
18677 |
|
18678 |
|
18679 | transitionTo(...args) {
|
18680 | if ((0, _utils.resemblesURL)(args[0])) {
|
18681 |
|
18682 |
|
18683 | return this._router._doURLTransition('transitionTo', args[0]);
|
18684 | }
|
18685 |
|
18686 | var {
|
18687 | routeName,
|
18688 | models,
|
18689 | queryParams
|
18690 | } = (0, _utils.extractRouteArgs)(args);
|
18691 |
|
18692 | var transition = this._router._doTransition(routeName, models, queryParams, true);
|
18693 |
|
18694 | transition['_keepDefaultQueryParamValues'] = true;
|
18695 | return transition;
|
18696 | }
|
18697 | |
18698 |
|
18699 |
|
18700 |
|
18701 |
|
18702 |
|
18703 |
|
18704 |
|
18705 |
|
18706 |
|
18707 |
|
18708 |
|
18709 |
|
18710 |
|
18711 |
|
18712 |
|
18713 |
|
18714 |
|
18715 |
|
18716 |
|
18717 |
|
18718 |
|
18719 |
|
18720 |
|
18721 |
|
18722 |
|
18723 |
|
18724 |
|
18725 |
|
18726 |
|
18727 |
|
18728 |
|
18729 |
|
18730 | replaceWith()
|
18731 |
|
18732 | {
|
18733 | return this.transitionTo(...arguments).method('replace');
|
18734 | }
|
18735 | |
18736 |
|
18737 |
|
18738 |
|
18739 |
|
18740 |
|
18741 |
|
18742 |
|
18743 |
|
18744 |
|
18745 |
|
18746 |
|
18747 |
|
18748 |
|
18749 |
|
18750 |
|
18751 |
|
18752 |
|
18753 |
|
18754 |
|
18755 |
|
18756 |
|
18757 |
|
18758 |
|
18759 |
|
18760 |
|
18761 |
|
18762 |
|
18763 |
|
18764 |
|
18765 |
|
18766 |
|
18767 |
|
18768 |
|
18769 |
|
18770 |
|
18771 |
|
18772 |
|
18773 |
|
18774 |
|
18775 |
|
18776 |
|
18777 |
|
18778 |
|
18779 |
|
18780 |
|
18781 |
|
18782 |
|
18783 |
|
18784 |
|
18785 |
|
18786 |
|
18787 |
|
18788 |
|
18789 |
|
18790 |
|
18791 |
|
18792 |
|
18793 |
|
18794 |
|
18795 | urlFor(routeName, ...args) {
|
18796 | return this._router.generate(routeName, ...args);
|
18797 | }
|
18798 | |
18799 |
|
18800 |
|
18801 |
|
18802 |
|
18803 |
|
18804 |
|
18805 |
|
18806 |
|
18807 |
|
18808 |
|
18809 |
|
18810 |
|
18811 |
|
18812 |
|
18813 |
|
18814 |
|
18815 |
|
18816 |
|
18817 |
|
18818 |
|
18819 |
|
18820 |
|
18821 |
|
18822 |
|
18823 |
|
18824 |
|
18825 |
|
18826 |
|
18827 |
|
18828 |
|
18829 |
|
18830 |
|
18831 |
|
18832 |
|
18833 |
|
18834 |
|
18835 |
|
18836 |
|
18837 | isActive(...args) {
|
18838 | var {
|
18839 | routeName,
|
18840 | models,
|
18841 | queryParams
|
18842 | } = (0, _utils.extractRouteArgs)(args);
|
18843 | var routerMicrolib = this._router._routerMicrolib;
|
18844 |
|
18845 |
|
18846 |
|
18847 |
|
18848 |
|
18849 | if (!routerMicrolib.isActiveIntent(routeName, models)) {
|
18850 | return false;
|
18851 | }
|
18852 |
|
18853 | var hasQueryParams = Object.keys(queryParams).length > 0;
|
18854 |
|
18855 | if (hasQueryParams) {
|
18856 | queryParams = (0, _polyfills.assign)({}, queryParams);
|
18857 |
|
18858 | this._router._prepareQueryParams(
|
18859 |
|
18860 |
|
18861 |
|
18862 |
|
18863 |
|
18864 | routeName, models,
|
18865 |
|
18866 |
|
18867 | queryParams, true
|
18868 |
|
18869 | );
|
18870 |
|
18871 | return (0, _utils.shallowEqual)(queryParams, routerMicrolib.state.queryParams);
|
18872 | }
|
18873 |
|
18874 | return true;
|
18875 | }
|
18876 | |
18877 |
|
18878 |
|
18879 |
|
18880 |
|
18881 |
|
18882 |
|
18883 |
|
18884 |
|
18885 |
|
18886 |
|
18887 |
|
18888 |
|
18889 |
|
18890 |
|
18891 |
|
18892 |
|
18893 |
|
18894 |
|
18895 |
|
18896 |
|
18897 |
|
18898 |
|
18899 |
|
18900 |
|
18901 |
|
18902 | recognize(url) {
|
18903 | (true && !(url.indexOf(this.rootURL) === 0) && (0, _debug.assert)(`You must pass a url that begins with the application's rootURL "${this.rootURL}"`, url.indexOf(this.rootURL) === 0));
|
18904 | var internalURL = cleanURL(url, this.rootURL);
|
18905 | return this._router._routerMicrolib.recognize(internalURL);
|
18906 | }
|
18907 | |
18908 |
|
18909 |
|
18910 |
|
18911 |
|
18912 |
|
18913 |
|
18914 |
|
18915 |
|
18916 |
|
18917 |
|
18918 |
|
18919 | recognizeAndLoad(url) {
|
18920 | (true && !(url.indexOf(this.rootURL) === 0) && (0, _debug.assert)(`You must pass a url that begins with the application's rootURL "${this.rootURL}"`, url.indexOf(this.rootURL) === 0));
|
18921 | var internalURL = cleanURL(url, this.rootURL);
|
18922 | return this._router._routerMicrolib.recognizeAndLoad(internalURL);
|
18923 | }
|
18924 |
|
18925 | }
|
18926 |
|
18927 | _exports.default = RouterService;
|
18928 | RouterService.reopen(_runtime.Evented, {
|
18929 | |
18930 |
|
18931 |
|
18932 |
|
18933 |
|
18934 |
|
18935 |
|
18936 |
|
18937 |
|
18938 |
|
18939 |
|
18940 |
|
18941 |
|
18942 |
|
18943 |
|
18944 |
|
18945 |
|
18946 |
|
18947 |
|
18948 |
|
18949 |
|
18950 |
|
18951 | currentRouteName: (0, _computed.readOnly)('_router.currentRouteName'),
|
18952 |
|
18953 | |
18954 |
|
18955 |
|
18956 |
|
18957 |
|
18958 |
|
18959 |
|
18960 |
|
18961 |
|
18962 |
|
18963 |
|
18964 |
|
18965 |
|
18966 |
|
18967 |
|
18968 |
|
18969 |
|
18970 |
|
18971 |
|
18972 |
|
18973 |
|
18974 | currentURL: (0, _computed.readOnly)('_router.currentURL'),
|
18975 |
|
18976 | |
18977 |
|
18978 |
|
18979 |
|
18980 |
|
18981 |
|
18982 |
|
18983 |
|
18984 |
|
18985 |
|
18986 |
|
18987 |
|
18988 |
|
18989 |
|
18990 |
|
18991 |
|
18992 |
|
18993 |
|
18994 |
|
18995 |
|
18996 |
|
18997 |
|
18998 |
|
18999 |
|
19000 |
|
19001 |
|
19002 |
|
19003 |
|
19004 |
|
19005 |
|
19006 | location: (0, _computed.readOnly)('_router.location'),
|
19007 |
|
19008 | |
19009 |
|
19010 |
|
19011 |
|
19012 |
|
19013 |
|
19014 |
|
19015 |
|
19016 |
|
19017 |
|
19018 |
|
19019 |
|
19020 |
|
19021 |
|
19022 |
|
19023 |
|
19024 |
|
19025 |
|
19026 |
|
19027 |
|
19028 |
|
19029 |
|
19030 | rootURL: (0, _computed.readOnly)('_router.rootURL'),
|
19031 |
|
19032 | |
19033 |
|
19034 |
|
19035 |
|
19036 |
|
19037 |
|
19038 |
|
19039 |
|
19040 |
|
19041 |
|
19042 |
|
19043 |
|
19044 |
|
19045 |
|
19046 |
|
19047 |
|
19048 |
|
19049 |
|
19050 |
|
19051 |
|
19052 |
|
19053 |
|
19054 | currentRoute: (0, _computed.readOnly)('_router.currentRoute')
|
19055 | });
|
19056 | });
|
19057 | define("@ember/-internals/routing/lib/services/routing", ["exports", "@ember/object/computed", "@ember/polyfills", "@ember/service"], function (_exports, _computed, _polyfills, _service) {
|
19058 | "use strict";
|
19059 |
|
19060 | Object.defineProperty(_exports, "__esModule", {
|
19061 | value: true
|
19062 | });
|
19063 | _exports.default = void 0;
|
19064 |
|
19065 | |
19066 |
|
19067 |
|
19068 |
|
19069 | |
19070 |
|
19071 |
|
19072 |
|
19073 |
|
19074 |
|
19075 |
|
19076 |
|
19077 |
|
19078 |
|
19079 | class RoutingService extends _service.default {
|
19080 | hasRoute(routeName) {
|
19081 | return this.router.hasRoute(routeName);
|
19082 | }
|
19083 |
|
19084 | transitionTo(routeName, models, queryParams, shouldReplace) {
|
19085 | var transition = this.router._doTransition(routeName, models, queryParams);
|
19086 |
|
19087 | if (shouldReplace) {
|
19088 | transition.method('replace');
|
19089 | }
|
19090 |
|
19091 | return transition;
|
19092 | }
|
19093 |
|
19094 | normalizeQueryParams(routeName, models, queryParams) {
|
19095 | this.router._prepareQueryParams(routeName, models, queryParams);
|
19096 | }
|
19097 |
|
19098 | generateURL(routeName, models, queryParams) {
|
19099 | var router = this.router;
|
19100 |
|
19101 | if (!router._routerMicrolib) {
|
19102 | return;
|
19103 | }
|
19104 |
|
19105 | var visibleQueryParams = {};
|
19106 |
|
19107 | if (queryParams) {
|
19108 | (0, _polyfills.assign)(visibleQueryParams, queryParams);
|
19109 | this.normalizeQueryParams(routeName, models, visibleQueryParams);
|
19110 | }
|
19111 |
|
19112 | return router.generate(routeName, ...models, {
|
19113 | queryParams: visibleQueryParams
|
19114 | });
|
19115 | }
|
19116 |
|
19117 | isActiveForRoute(contexts, queryParams, routeName, routerState, isCurrentWhenSpecified) {
|
19118 | var handlers = this.router._routerMicrolib.recognizer.handlersFor(routeName);
|
19119 |
|
19120 | var leafName = handlers[handlers.length - 1].handler;
|
19121 | var maximumContexts = numberOfContextsAcceptedByHandler(routeName, handlers);
|
19122 |
|
19123 |
|
19124 |
|
19125 |
|
19126 |
|
19127 |
|
19128 |
|
19129 |
|
19130 |
|
19131 | if (contexts.length > maximumContexts) {
|
19132 | routeName = leafName;
|
19133 | }
|
19134 |
|
19135 | return routerState.isActiveIntent(routeName, contexts, queryParams, !isCurrentWhenSpecified);
|
19136 | }
|
19137 |
|
19138 | }
|
19139 |
|
19140 | _exports.default = RoutingService;
|
19141 | RoutingService.reopen({
|
19142 | targetState: (0, _computed.readOnly)('router.targetState'),
|
19143 | currentState: (0, _computed.readOnly)('router.currentState'),
|
19144 | currentRouteName: (0, _computed.readOnly)('router.currentRouteName'),
|
19145 | currentPath: (0, _computed.readOnly)('router.currentPath')
|
19146 | });
|
19147 |
|
19148 | function numberOfContextsAcceptedByHandler(handlerName, handlerInfos) {
|
19149 | var req = 0;
|
19150 |
|
19151 | for (var i = 0; i < handlerInfos.length; i++) {
|
19152 | req += handlerInfos[i].names.length;
|
19153 |
|
19154 | if (handlerInfos[i].handler === handlerName) {
|
19155 | break;
|
19156 | }
|
19157 | }
|
19158 |
|
19159 | return req;
|
19160 | }
|
19161 | });
|
19162 | define("@ember/-internals/routing/lib/system/cache", ["exports"], function (_exports) {
|
19163 | "use strict";
|
19164 |
|
19165 | Object.defineProperty(_exports, "__esModule", {
|
19166 | value: true
|
19167 | });
|
19168 | _exports.default = void 0;
|
19169 |
|
19170 | |
19171 |
|
19172 |
|
19173 |
|
19174 |
|
19175 |
|
19176 |
|
19177 | class BucketCache {
|
19178 | constructor() {
|
19179 | this.cache = new Map();
|
19180 | }
|
19181 |
|
19182 | has(bucketKey) {
|
19183 | return this.cache.has(bucketKey);
|
19184 | }
|
19185 |
|
19186 | stash(bucketKey, key, value) {
|
19187 | var bucket = this.cache.get(bucketKey);
|
19188 |
|
19189 | if (bucket === undefined) {
|
19190 | bucket = new Map();
|
19191 | this.cache.set(bucketKey, bucket);
|
19192 | }
|
19193 |
|
19194 | bucket.set(key, value);
|
19195 | }
|
19196 |
|
19197 | lookup(bucketKey, prop, defaultValue) {
|
19198 | if (!this.has(bucketKey)) {
|
19199 | return defaultValue;
|
19200 | }
|
19201 |
|
19202 | var bucket = this.cache.get(bucketKey);
|
19203 |
|
19204 | if (bucket.has(prop)) {
|
19205 | return bucket.get(prop);
|
19206 | } else {
|
19207 | return defaultValue;
|
19208 | }
|
19209 | }
|
19210 |
|
19211 | }
|
19212 |
|
19213 | _exports.default = BucketCache;
|
19214 | });
|
19215 | define("@ember/-internals/routing/lib/system/controller_for", ["exports"], function (_exports) {
|
19216 | "use strict";
|
19217 |
|
19218 | Object.defineProperty(_exports, "__esModule", {
|
19219 | value: true
|
19220 | });
|
19221 | _exports.default = controllerFor;
|
19222 |
|
19223 | |
19224 |
|
19225 |
|
19226 |
|
19227 | |
19228 |
|
19229 |
|
19230 |
|
19231 |
|
19232 |
|
19233 |
|
19234 | function controllerFor(container, controllerName, lookupOptions) {
|
19235 | return container.lookup(`controller:${controllerName}`, lookupOptions);
|
19236 | }
|
19237 | });
|
19238 | define("@ember/-internals/routing/lib/system/dsl", ["exports", "@ember/debug", "@ember/polyfills"], function (_exports, _debug, _polyfills) {
|
19239 | "use strict";
|
19240 |
|
19241 | Object.defineProperty(_exports, "__esModule", {
|
19242 | value: true
|
19243 | });
|
19244 | _exports.default = void 0;
|
19245 | var uuid = 0;
|
19246 |
|
19247 | function isCallback(value) {
|
19248 | return typeof value === 'function';
|
19249 | }
|
19250 |
|
19251 | function isOptions(value) {
|
19252 | return value !== null && typeof value === 'object';
|
19253 | }
|
19254 |
|
19255 | class DSLImpl {
|
19256 | constructor(name = null, options) {
|
19257 | this.explicitIndex = false;
|
19258 | this.parent = name;
|
19259 | this.enableLoadingSubstates = Boolean(options && options.enableLoadingSubstates);
|
19260 | this.matches = [];
|
19261 | this.options = options;
|
19262 | }
|
19263 |
|
19264 | route(name, _options, _callback) {
|
19265 | var options;
|
19266 | var callback = null;
|
19267 | var dummyErrorRoute = `/_unused_dummy_error_path_route_${name}/:error`;
|
19268 |
|
19269 | if (isCallback(_options)) {
|
19270 | (true && !(arguments.length === 2) && (0, _debug.assert)('Unexpected arguments', arguments.length === 2));
|
19271 | options = {};
|
19272 | callback = _options;
|
19273 | } else if (isCallback(_callback)) {
|
19274 | (true && !(arguments.length === 3) && (0, _debug.assert)('Unexpected arguments', arguments.length === 3));
|
19275 | (true && !(isOptions(_options)) && (0, _debug.assert)('Unexpected arguments', isOptions(_options)));
|
19276 | options = _options;
|
19277 | callback = _callback;
|
19278 | } else {
|
19279 | options = _options || {};
|
19280 | }
|
19281 |
|
19282 | (true && !((() => {
|
19283 | if (options.overrideNameAssertion === true) {
|
19284 | return true;
|
19285 | }
|
19286 |
|
19287 | return ['basic', 'application'].indexOf(name) === -1;
|
19288 | })()) && (0, _debug.assert)(`'${name}' cannot be used as a route name.`, (() => {
|
19289 | if (options.overrideNameAssertion === true) {
|
19290 | return true;
|
19291 | }
|
19292 |
|
19293 | return ['basic', 'application'].indexOf(name) === -1;
|
19294 | })()));
|
19295 | (true && !(name.indexOf(':') === -1) && (0, _debug.assert)(`'${name}' is not a valid route name. It cannot contain a ':'. You may want to use the 'path' option instead.`, name.indexOf(':') === -1));
|
19296 |
|
19297 | if (this.enableLoadingSubstates) {
|
19298 | createRoute(this, `${name}_loading`, {
|
19299 | resetNamespace: options.resetNamespace
|
19300 | });
|
19301 | createRoute(this, `${name}_error`, {
|
19302 | resetNamespace: options.resetNamespace,
|
19303 | path: dummyErrorRoute
|
19304 | });
|
19305 | }
|
19306 |
|
19307 | if (callback) {
|
19308 | var fullName = getFullName(this, name, options.resetNamespace);
|
19309 | var dsl = new DSLImpl(fullName, this.options);
|
19310 | createRoute(dsl, 'loading');
|
19311 | createRoute(dsl, 'error', {
|
19312 | path: dummyErrorRoute
|
19313 | });
|
19314 | callback.call(dsl);
|
19315 | createRoute(this, name, options, dsl.generate());
|
19316 | } else {
|
19317 | createRoute(this, name, options);
|
19318 | }
|
19319 | }
|
19320 |
|
19321 |
|
19322 |
|
19323 | push(url, name, callback, serialize) {
|
19324 | var parts = name.split('.');
|
19325 |
|
19326 | if (this.options.engineInfo) {
|
19327 | var localFullName = name.slice(this.options.engineInfo.fullName.length + 1);
|
19328 | var routeInfo = (0, _polyfills.assign)({
|
19329 | localFullName
|
19330 | }, this.options.engineInfo);
|
19331 |
|
19332 | if (serialize) {
|
19333 | routeInfo.serializeMethod = serialize;
|
19334 | }
|
19335 |
|
19336 | this.options.addRouteForEngine(name, routeInfo);
|
19337 | } else if (serialize) {
|
19338 | throw new Error(`Defining a route serializer on route '${name}' outside an Engine is not allowed.`);
|
19339 | }
|
19340 |
|
19341 | if (url === '' || url === '/' || parts[parts.length - 1] === 'index') {
|
19342 | this.explicitIndex = true;
|
19343 | }
|
19344 |
|
19345 | this.matches.push(url, name, callback);
|
19346 | }
|
19347 |
|
19348 | generate() {
|
19349 | var dslMatches = this.matches;
|
19350 |
|
19351 | if (!this.explicitIndex) {
|
19352 | this.route('index', {
|
19353 | path: '/'
|
19354 | });
|
19355 | }
|
19356 |
|
19357 | return match => {
|
19358 | for (var i = 0; i < dslMatches.length; i += 3) {
|
19359 | match(dslMatches[i]).to(dslMatches[i + 1], dslMatches[i + 2]);
|
19360 | }
|
19361 | };
|
19362 | }
|
19363 |
|
19364 | mount(_name, options = {}) {
|
19365 | var engineRouteMap = this.options.resolveRouteMap(_name);
|
19366 | var name = _name;
|
19367 |
|
19368 | if (options.as) {
|
19369 | name = options.as;
|
19370 | }
|
19371 |
|
19372 | var fullName = getFullName(this, name, options.resetNamespace);
|
19373 | var engineInfo = {
|
19374 | name: _name,
|
19375 | instanceId: uuid++,
|
19376 | mountPoint: fullName,
|
19377 | fullName
|
19378 | };
|
19379 | var path = options.path;
|
19380 |
|
19381 | if (typeof path !== 'string') {
|
19382 | path = `/${name}`;
|
19383 | }
|
19384 |
|
19385 | var callback;
|
19386 | var dummyErrorRoute = `/_unused_dummy_error_path_route_${name}/:error`;
|
19387 |
|
19388 | if (engineRouteMap) {
|
19389 | var shouldResetEngineInfo = false;
|
19390 | var oldEngineInfo = this.options.engineInfo;
|
19391 |
|
19392 | if (oldEngineInfo) {
|
19393 | shouldResetEngineInfo = true;
|
19394 | this.options.engineInfo = engineInfo;
|
19395 | }
|
19396 |
|
19397 | var optionsForChild = (0, _polyfills.assign)({
|
19398 | engineInfo
|
19399 | }, this.options);
|
19400 | var childDSL = new DSLImpl(fullName, optionsForChild);
|
19401 | createRoute(childDSL, 'loading');
|
19402 | createRoute(childDSL, 'error', {
|
19403 | path: dummyErrorRoute
|
19404 | });
|
19405 | engineRouteMap.class.call(childDSL);
|
19406 | callback = childDSL.generate();
|
19407 |
|
19408 | if (shouldResetEngineInfo) {
|
19409 | this.options.engineInfo = oldEngineInfo;
|
19410 | }
|
19411 | }
|
19412 |
|
19413 | var localFullName = 'application';
|
19414 | var routeInfo = (0, _polyfills.assign)({
|
19415 | localFullName
|
19416 | }, engineInfo);
|
19417 |
|
19418 | if (this.enableLoadingSubstates) {
|
19419 |
|
19420 |
|
19421 | var substateName = `${name}_loading`;
|
19422 | var _localFullName = `application_loading`;
|
19423 |
|
19424 | var _routeInfo = (0, _polyfills.assign)({
|
19425 | localFullName: _localFullName
|
19426 | }, engineInfo);
|
19427 |
|
19428 | createRoute(this, substateName, {
|
19429 | resetNamespace: options.resetNamespace
|
19430 | });
|
19431 | this.options.addRouteForEngine(substateName, _routeInfo);
|
19432 | substateName = `${name}_error`;
|
19433 | _localFullName = `application_error`;
|
19434 | _routeInfo = (0, _polyfills.assign)({
|
19435 | localFullName: _localFullName
|
19436 | }, engineInfo);
|
19437 | createRoute(this, substateName, {
|
19438 | resetNamespace: options.resetNamespace,
|
19439 | path: dummyErrorRoute
|
19440 | });
|
19441 | this.options.addRouteForEngine(substateName, _routeInfo);
|
19442 | }
|
19443 |
|
19444 | this.options.addRouteForEngine(fullName, routeInfo);
|
19445 | this.push(path, fullName, callback);
|
19446 | }
|
19447 |
|
19448 | }
|
19449 |
|
19450 | _exports.default = DSLImpl;
|
19451 |
|
19452 | function canNest(dsl) {
|
19453 | return dsl.parent !== 'application';
|
19454 | }
|
19455 |
|
19456 | function getFullName(dsl, name, resetNamespace) {
|
19457 | if (canNest(dsl) && resetNamespace !== true) {
|
19458 | return `${dsl.parent}.${name}`;
|
19459 | } else {
|
19460 | return name;
|
19461 | }
|
19462 | }
|
19463 |
|
19464 | function createRoute(dsl, name, options = {}, callback) {
|
19465 | var fullName = getFullName(dsl, name, options.resetNamespace);
|
19466 |
|
19467 | if (typeof options.path !== 'string') {
|
19468 | options.path = `/${name}`;
|
19469 | }
|
19470 |
|
19471 | dsl.push(options.path, fullName, callback, options.serialize);
|
19472 | }
|
19473 | });
|
19474 | define("@ember/-internals/routing/lib/system/engines", [], function () {
|
19475 | "use strict";
|
19476 | });
|
19477 | define("@ember/-internals/routing/lib/system/generate_controller", ["exports", "@ember/-internals/metal", "@ember/debug"], function (_exports, _metal, _debug) {
|
19478 | "use strict";
|
19479 |
|
19480 | Object.defineProperty(_exports, "__esModule", {
|
19481 | value: true
|
19482 | });
|
19483 | _exports.generateControllerFactory = generateControllerFactory;
|
19484 | _exports.default = generateController;
|
19485 |
|
19486 | |
19487 |
|
19488 |
|
19489 |
|
19490 | |
19491 |
|
19492 |
|
19493 |
|
19494 |
|
19495 |
|
19496 |
|
19497 | function generateControllerFactory(owner, controllerName) {
|
19498 | var Factory = owner.factoryFor('controller:basic').class;
|
19499 | Factory = Factory.extend({
|
19500 | toString() {
|
19501 | return `(generated ${controllerName} controller)`;
|
19502 | }
|
19503 |
|
19504 | });
|
19505 | var fullName = `controller:${controllerName}`;
|
19506 | owner.register(fullName, Factory);
|
19507 | return owner.factoryFor(fullName);
|
19508 | }
|
19509 | |
19510 |
|
19511 |
|
19512 |
|
19513 |
|
19514 |
|
19515 |
|
19516 |
|
19517 |
|
19518 |
|
19519 |
|
19520 | function generateController(owner, controllerName) {
|
19521 | generateControllerFactory(owner, controllerName);
|
19522 | var fullName = `controller:${controllerName}`;
|
19523 | var instance = owner.lookup(fullName);
|
19524 |
|
19525 | if (true
|
19526 |
|
19527 | ) {
|
19528 | if ((0, _metal.get)(instance, 'namespace.LOG_ACTIVE_GENERATION')) {
|
19529 | (0, _debug.info)(`generated -> ${fullName}`, {
|
19530 | fullName
|
19531 | });
|
19532 | }
|
19533 | }
|
19534 |
|
19535 | return instance;
|
19536 | }
|
19537 | });
|
19538 | define("@ember/-internals/routing/lib/system/query_params", ["exports"], function (_exports) {
|
19539 | "use strict";
|
19540 |
|
19541 | Object.defineProperty(_exports, "__esModule", {
|
19542 | value: true
|
19543 | });
|
19544 | _exports.default = void 0;
|
19545 |
|
19546 | class QueryParams {
|
19547 | constructor(values = null) {
|
19548 | this.isQueryParams = true;
|
19549 | this.values = values;
|
19550 | }
|
19551 |
|
19552 | }
|
19553 |
|
19554 | _exports.default = QueryParams;
|
19555 | });
|
19556 | define("@ember/-internals/routing/lib/system/route-info", [], function () {
|
19557 | "use strict";
|
19558 | |
19559 |
|
19560 |
|
19561 |
|
19562 |
|
19563 |
|
19564 |
|
19565 |
|
19566 |
|
19567 |
|
19568 |
|
19569 |
|
19570 |
|
19571 | |
19572 |
|
19573 |
|
19574 |
|
19575 |
|
19576 |
|
19577 |
|
19578 | |
19579 |
|
19580 |
|
19581 |
|
19582 |
|
19583 |
|
19584 |
|
19585 | |
19586 |
|
19587 |
|
19588 |
|
19589 |
|
19590 |
|
19591 |
|
19592 |
|
19593 |
|
19594 |
|
19595 | |
19596 |
|
19597 |
|
19598 |
|
19599 |
|
19600 |
|
19601 |
|
19602 |
|
19603 |
|
19604 |
|
19605 | |
19606 |
|
19607 |
|
19608 |
|
19609 |
|
19610 |
|
19611 | |
19612 |
|
19613 |
|
19614 |
|
19615 |
|
19616 |
|
19617 |
|
19618 | |
19619 |
|
19620 |
|
19621 |
|
19622 |
|
19623 |
|
19624 |
|
19625 | |
19626 |
|
19627 |
|
19628 |
|
19629 |
|
19630 |
|
19631 |
|
19632 |
|
19633 | |
19634 |
|
19635 |
|
19636 |
|
19637 |
|
19638 |
|
19639 |
|
19640 |
|
19641 | |
19642 |
|
19643 |
|
19644 |
|
19645 |
|
19646 |
|
19647 |
|
19648 |
|
19649 |
|
19650 |
|
19651 |
|
19652 |
|
19653 |
|
19654 |
|
19655 |
|
19656 |
|
19657 |
|
19658 |
|
19659 |
|
19660 |
|
19661 |
|
19662 |
|
19663 |
|
19664 |
|
19665 |
|
19666 |
|
19667 |
|
19668 |
|
19669 |
|
19670 |
|
19671 |
|
19672 |
|
19673 |
|
19674 |
|
19675 | |
19676 |
|
19677 |
|
19678 |
|
19679 |
|
19680 |
|
19681 |
|
19682 |
|
19683 |
|
19684 |
|
19685 |
|
19686 | |
19687 |
|
19688 |
|
19689 |
|
19690 |
|
19691 |
|
19692 |
|
19693 | |
19694 |
|
19695 |
|
19696 |
|
19697 |
|
19698 |
|
19699 |
|
19700 | |
19701 |
|
19702 |
|
19703 |
|
19704 |
|
19705 |
|
19706 |
|
19707 |
|
19708 |
|
19709 |
|
19710 | |
19711 |
|
19712 |
|
19713 |
|
19714 |
|
19715 |
|
19716 |
|
19717 |
|
19718 |
|
19719 |
|
19720 | |
19721 |
|
19722 |
|
19723 |
|
19724 |
|
19725 |
|
19726 | |
19727 |
|
19728 |
|
19729 |
|
19730 |
|
19731 |
|
19732 |
|
19733 |
|
19734 | |
19735 |
|
19736 |
|
19737 |
|
19738 |
|
19739 |
|
19740 |
|
19741 |
|
19742 | |
19743 |
|
19744 |
|
19745 |
|
19746 |
|
19747 |
|
19748 |
|
19749 |
|
19750 |
|
19751 |
|
19752 |
|
19753 |
|
19754 |
|
19755 |
|
19756 |
|
19757 |
|
19758 |
|
19759 |
|
19760 |
|
19761 |
|
19762 |
|
19763 |
|
19764 |
|
19765 |
|
19766 |
|
19767 |
|
19768 |
|
19769 |
|
19770 |
|
19771 |
|
19772 |
|
19773 |
|
19774 |
|
19775 | });
|
19776 | define("@ember/-internals/routing/lib/system/route", ["exports", "@ember/polyfills", "@ember/-internals/metal", "@ember/-internals/owner", "@ember/-internals/runtime", "@ember/-internals/utils", "@ember/debug", "@ember/deprecated-features", "@ember/object/compat", "@ember/runloop", "@ember/string", "router_js", "@ember/-internals/routing/lib/utils", "@ember/-internals/routing/lib/system/generate_controller"], function (_exports, _polyfills, _metal, _owner, _runtime, _utils, _debug, _deprecatedFeatures, _compat, _runloop, _string, _router_js, _utils2, _generate_controller) {
|
19777 | "use strict";
|
19778 |
|
19779 | Object.defineProperty(_exports, "__esModule", {
|
19780 | value: true
|
19781 | });
|
19782 | _exports.defaultSerialize = defaultSerialize;
|
19783 | _exports.hasDefaultSerialize = hasDefaultSerialize;
|
19784 | _exports.default = _exports.ROUTER_EVENT_DEPRECATIONS = _exports.ROUTE_CONNECTIONS = void 0;
|
19785 | var ROUTE_CONNECTIONS = new WeakMap();
|
19786 | _exports.ROUTE_CONNECTIONS = ROUTE_CONNECTIONS;
|
19787 |
|
19788 | function defaultSerialize(model, params) {
|
19789 | if (params.length < 1 || !model) {
|
19790 | return;
|
19791 | }
|
19792 |
|
19793 | var object = {};
|
19794 |
|
19795 | if (params.length === 1) {
|
19796 | var [name] = params;
|
19797 |
|
19798 | if (name in model) {
|
19799 | object[name] = (0, _metal.get)(model, name);
|
19800 | } else if (/_id$/.test(name)) {
|
19801 | object[name] = (0, _metal.get)(model, 'id');
|
19802 | }
|
19803 | } else {
|
19804 | object = (0, _metal.getProperties)(model, params);
|
19805 | }
|
19806 |
|
19807 | return object;
|
19808 | }
|
19809 |
|
19810 | function hasDefaultSerialize(route) {
|
19811 | return route.serialize === defaultSerialize;
|
19812 | }
|
19813 | |
19814 |
|
19815 |
|
19816 |
|
19817 | |
19818 |
|
19819 |
|
19820 |
|
19821 |
|
19822 |
|
19823 |
|
19824 |
|
19825 |
|
19826 |
|
19827 |
|
19828 |
|
19829 |
|
19830 | class Route extends _runtime.Object {
|
19831 | constructor() {
|
19832 | super(...arguments);
|
19833 | this.context = {};
|
19834 | }
|
19835 | |
19836 |
|
19837 |
|
19838 |
|
19839 |
|
19840 |
|
19841 |
|
19842 |
|
19843 |
|
19844 |
|
19845 |
|
19846 | |
19847 |
|
19848 |
|
19849 |
|
19850 |
|
19851 |
|
19852 |
|
19853 |
|
19854 |
|
19855 |
|
19856 |
|
19857 |
|
19858 | |
19859 |
|
19860 |
|
19861 |
|
19862 |
|
19863 |
|
19864 |
|
19865 |
|
19866 |
|
19867 | _setRouteName(name) {
|
19868 | this.routeName = name;
|
19869 | this.fullRouteName = getEngineRouteName((0, _owner.getOwner)(this), name);
|
19870 | }
|
19871 | |
19872 |
|
19873 |
|
19874 |
|
19875 |
|
19876 |
|
19877 | _stashNames(routeInfo, dynamicParent) {
|
19878 | if (this._names) {
|
19879 | return;
|
19880 | }
|
19881 |
|
19882 | var names = this._names = routeInfo['_names'];
|
19883 |
|
19884 | if (!names.length) {
|
19885 | routeInfo = dynamicParent;
|
19886 | names = routeInfo && routeInfo['_names'] || [];
|
19887 | }
|
19888 |
|
19889 | var qps = (0, _metal.get)(this, '_qp.qps');
|
19890 | var namePaths = new Array(names.length);
|
19891 |
|
19892 | for (var a = 0; a < names.length; ++a) {
|
19893 | namePaths[a] = `${routeInfo.name}.${names[a]}`;
|
19894 | }
|
19895 |
|
19896 | for (var i = 0; i < qps.length; ++i) {
|
19897 | var qp = qps[i];
|
19898 |
|
19899 | if (qp.scope === 'model') {
|
19900 | qp.parts = namePaths;
|
19901 | }
|
19902 | }
|
19903 | }
|
19904 | |
19905 |
|
19906 |
|
19907 |
|
19908 |
|
19909 |
|
19910 | _activeQPChanged(qp, value) {
|
19911 | this._router._activeQPChanged(qp.scopedPropertyName, value);
|
19912 | }
|
19913 | |
19914 |
|
19915 |
|
19916 |
|
19917 |
|
19918 |
|
19919 | _updatingQPChanged(qp) {
|
19920 | this._router._updatingQPChanged(qp.urlKey);
|
19921 | }
|
19922 | |
19923 |
|
19924 |
|
19925 |
|
19926 |
|
19927 |
|
19928 |
|
19929 |
|
19930 |
|
19931 |
|
19932 |
|
19933 |
|
19934 |
|
19935 |
|
19936 |
|
19937 |
|
19938 |
|
19939 |
|
19940 |
|
19941 |
|
19942 |
|
19943 |
|
19944 |
|
19945 |
|
19946 |
|
19947 |
|
19948 |
|
19949 |
|
19950 |
|
19951 |
|
19952 |
|
19953 |
|
19954 |
|
19955 |
|
19956 |
|
19957 |
|
19958 |
|
19959 |
|
19960 |
|
19961 |
|
19962 |
|
19963 |
|
19964 |
|
19965 |
|
19966 |
|
19967 | paramsFor(name) {
|
19968 | var route = (0, _owner.getOwner)(this).lookup(`route:${name}`);
|
19969 |
|
19970 | if (route === undefined) {
|
19971 | return {};
|
19972 | }
|
19973 |
|
19974 | var transition = this._router._routerMicrolib.activeTransition;
|
19975 | var state = transition ? transition[_router_js.STATE_SYMBOL] : this._router._routerMicrolib.state;
|
19976 | var fullName = route.fullRouteName;
|
19977 | var params = (0, _polyfills.assign)({}, state.params[fullName]);
|
19978 | var queryParams = getQueryParamsFor(route, state);
|
19979 | return Object.keys(queryParams).reduce((params, key) => {
|
19980 | (true && !(!params[key]) && (0, _debug.assert)(`The route '${this.routeName}' has both a dynamic segment and query param with name '${key}'. Please rename one to avoid collisions.`, !params[key]));
|
19981 | params[key] = queryParams[key];
|
19982 | return params;
|
19983 | }, params);
|
19984 | }
|
19985 | |
19986 |
|
19987 |
|
19988 |
|
19989 |
|
19990 |
|
19991 |
|
19992 |
|
19993 | serializeQueryParamKey(controllerPropertyName) {
|
19994 | return controllerPropertyName;
|
19995 | }
|
19996 | |
19997 |
|
19998 |
|
19999 |
|
20000 |
|
20001 |
|
20002 |
|
20003 |
|
20004 |
|
20005 |
|
20006 | serializeQueryParam(value, _urlKey, defaultValueType) {
|
20007 |
|
20008 |
|
20009 |
|
20010 | return this._router._serializeQueryParam(value, defaultValueType);
|
20011 | }
|
20012 | |
20013 |
|
20014 |
|
20015 |
|
20016 |
|
20017 |
|
20018 |
|
20019 |
|
20020 |
|
20021 |
|
20022 | deserializeQueryParam(value, _urlKey, defaultValueType) {
|
20023 |
|
20024 |
|
20025 |
|
20026 | return this._router._deserializeQueryParam(value, defaultValueType);
|
20027 | }
|
20028 | |
20029 |
|
20030 |
|
20031 |
|
20032 |
|
20033 |
|
20034 | _optionsForQueryParam(qp) {
|
20035 | return (0, _metal.get)(this, `queryParams.${qp.urlKey}`) || (0, _metal.get)(this, `queryParams.${qp.prop}`) || {};
|
20036 | }
|
20037 | |
20038 |
|
20039 |
|
20040 |
|
20041 |
|
20042 |
|
20043 |
|
20044 |
|
20045 |
|
20046 |
|
20047 |
|
20048 |
|
20049 |
|
20050 |
|
20051 |
|
20052 |
|
20053 |
|
20054 |
|
20055 |
|
20056 |
|
20057 |
|
20058 |
|
20059 | resetController(_controller, _isExiting, _transition) {
|
20060 | return this;
|
20061 | }
|
20062 | |
20063 |
|
20064 |
|
20065 |
|
20066 |
|
20067 |
|
20068 | exit() {
|
20069 | this.deactivate();
|
20070 | this.trigger('deactivate');
|
20071 | this.teardownViews();
|
20072 | }
|
20073 | |
20074 |
|
20075 |
|
20076 |
|
20077 |
|
20078 |
|
20079 |
|
20080 | _internalReset(isExiting, transition) {
|
20081 | var controller = this.controller;
|
20082 | controller['_qpDelegate'] = (0, _metal.get)(this, '_qp.states.inactive');
|
20083 | this.resetController(controller, isExiting, transition);
|
20084 | }
|
20085 | |
20086 |
|
20087 |
|
20088 |
|
20089 |
|
20090 |
|
20091 | enter() {
|
20092 | ROUTE_CONNECTIONS.set(this, []);
|
20093 | this.activate();
|
20094 | this.trigger('activate');
|
20095 | }
|
20096 | |
20097 |
|
20098 |
|
20099 |
|
20100 |
|
20101 |
|
20102 |
|
20103 |
|
20104 |
|
20105 |
|
20106 |
|
20107 |
|
20108 |
|
20109 |
|
20110 |
|
20111 |
|
20112 |
|
20113 |
|
20114 |
|
20115 |
|
20116 |
|
20117 |
|
20118 |
|
20119 |
|
20120 |
|
20121 |
|
20122 |
|
20123 |
|
20124 |
|
20125 |
|
20126 |
|
20127 |
|
20128 |
|
20129 |
|
20130 |
|
20131 |
|
20132 |
|
20133 |
|
20134 | |
20135 |
|
20136 |
|
20137 |
|
20138 |
|
20139 |
|
20140 |
|
20141 |
|
20142 |
|
20143 |
|
20144 |
|
20145 |
|
20146 |
|
20147 |
|
20148 |
|
20149 |
|
20150 |
|
20151 |
|
20152 |
|
20153 |
|
20154 |
|
20155 |
|
20156 |
|
20157 | |
20158 |
|
20159 |
|
20160 |
|
20161 |
|
20162 |
|
20163 |
|
20164 |
|
20165 |
|
20166 |
|
20167 |
|
20168 |
|
20169 |
|
20170 |
|
20171 |
|
20172 |
|
20173 |
|
20174 |
|
20175 |
|
20176 |
|
20177 |
|
20178 |
|
20179 |
|
20180 |
|
20181 |
|
20182 |
|
20183 | |
20184 |
|
20185 |
|
20186 |
|
20187 |
|
20188 |
|
20189 |
|
20190 |
|
20191 |
|
20192 |
|
20193 |
|
20194 |
|
20195 |
|
20196 |
|
20197 |
|
20198 |
|
20199 |
|
20200 |
|
20201 |
|
20202 |
|
20203 |
|
20204 |
|
20205 |
|
20206 |
|
20207 |
|
20208 |
|
20209 |
|
20210 |
|
20211 |
|
20212 |
|
20213 |
|
20214 |
|
20215 |
|
20216 |
|
20217 |
|
20218 |
|
20219 |
|
20220 |
|
20221 |
|
20222 |
|
20223 |
|
20224 |
|
20225 |
|
20226 |
|
20227 |
|
20228 |
|
20229 |
|
20230 |
|
20231 |
|
20232 |
|
20233 |
|
20234 |
|
20235 | |
20236 |
|
20237 |
|
20238 |
|
20239 |
|
20240 |
|
20241 |
|
20242 |
|
20243 |
|
20244 |
|
20245 |
|
20246 |
|
20247 |
|
20248 |
|
20249 |
|
20250 |
|
20251 |
|
20252 | |
20253 |
|
20254 |
|
20255 |
|
20256 |
|
20257 |
|
20258 |
|
20259 |
|
20260 |
|
20261 |
|
20262 |
|
20263 |
|
20264 |
|
20265 |
|
20266 |
|
20267 |
|
20268 |
|
20269 | |
20270 |
|
20271 |
|
20272 |
|
20273 |
|
20274 |
|
20275 |
|
20276 |
|
20277 |
|
20278 | deactivate() {}
|
20279 | |
20280 |
|
20281 |
|
20282 |
|
20283 |
|
20284 |
|
20285 |
|
20286 |
|
20287 |
|
20288 | activate() {}
|
20289 | |
20290 |
|
20291 |
|
20292 |
|
20293 |
|
20294 |
|
20295 |
|
20296 |
|
20297 |
|
20298 |
|
20299 |
|
20300 |
|
20301 |
|
20302 |
|
20303 |
|
20304 |
|
20305 |
|
20306 |
|
20307 |
|
20308 |
|
20309 |
|
20310 |
|
20311 |
|
20312 |
|
20313 |
|
20314 |
|
20315 |
|
20316 |
|
20317 |
|
20318 |
|
20319 |
|
20320 |
|
20321 |
|
20322 |
|
20323 |
|
20324 |
|
20325 |
|
20326 |
|
20327 |
|
20328 |
|
20329 |
|
20330 |
|
20331 |
|
20332 |
|
20333 |
|
20334 |
|
20335 |
|
20336 |
|
20337 |
|
20338 |
|
20339 |
|
20340 |
|
20341 |
|
20342 |
|
20343 |
|
20344 |
|
20345 |
|
20346 |
|
20347 |
|
20348 |
|
20349 |
|
20350 |
|
20351 |
|
20352 |
|
20353 |
|
20354 |
|
20355 |
|
20356 |
|
20357 |
|
20358 |
|
20359 |
|
20360 |
|
20361 |
|
20362 |
|
20363 |
|
20364 |
|
20365 |
|
20366 |
|
20367 |
|
20368 |
|
20369 |
|
20370 |
|
20371 |
|
20372 |
|
20373 |
|
20374 |
|
20375 |
|
20376 |
|
20377 |
|
20378 |
|
20379 |
|
20380 |
|
20381 |
|
20382 |
|
20383 |
|
20384 |
|
20385 |
|
20386 |
|
20387 |
|
20388 |
|
20389 |
|
20390 |
|
20391 |
|
20392 |
|
20393 |
|
20394 |
|
20395 |
|
20396 |
|
20397 |
|
20398 |
|
20399 |
|
20400 |
|
20401 |
|
20402 |
|
20403 |
|
20404 |
|
20405 |
|
20406 |
|
20407 |
|
20408 |
|
20409 |
|
20410 |
|
20411 |
|
20412 |
|
20413 |
|
20414 |
|
20415 |
|
20416 |
|
20417 |
|
20418 |
|
20419 |
|
20420 |
|
20421 |
|
20422 |
|
20423 |
|
20424 |
|
20425 |
|
20426 |
|
20427 |
|
20428 |
|
20429 |
|
20430 |
|
20431 |
|
20432 |
|
20433 |
|
20434 |
|
20435 |
|
20436 |
|
20437 |
|
20438 |
|
20439 |
|
20440 | transitionTo(...args) {
|
20441 |
|
20442 | return this._router.transitionTo(...(0, _utils2.prefixRouteNameArg)(this, args));
|
20443 | }
|
20444 | |
20445 |
|
20446 |
|
20447 |
|
20448 |
|
20449 |
|
20450 |
|
20451 |
|
20452 |
|
20453 |
|
20454 |
|
20455 |
|
20456 |
|
20457 |
|
20458 |
|
20459 |
|
20460 |
|
20461 | intermediateTransitionTo(...args) {
|
20462 | var [name, ...preparedArgs] = (0, _utils2.prefixRouteNameArg)(this, args);
|
20463 |
|
20464 | this._router.intermediateTransitionTo(name, ...preparedArgs);
|
20465 | }
|
20466 | |
20467 |
|
20468 |
|
20469 |
|
20470 |
|
20471 |
|
20472 |
|
20473 |
|
20474 |
|
20475 |
|
20476 |
|
20477 |
|
20478 |
|
20479 |
|
20480 |
|
20481 |
|
20482 |
|
20483 |
|
20484 |
|
20485 |
|
20486 |
|
20487 | refresh() {
|
20488 | return this._router._routerMicrolib.refresh(this);
|
20489 | }
|
20490 | |
20491 |
|
20492 |
|
20493 |
|
20494 |
|
20495 |
|
20496 |
|
20497 |
|
20498 |
|
20499 |
|
20500 |
|
20501 |
|
20502 |
|
20503 |
|
20504 |
|
20505 |
|
20506 |
|
20507 |
|
20508 |
|
20509 |
|
20510 |
|
20511 |
|
20512 |
|
20513 |
|
20514 |
|
20515 |
|
20516 |
|
20517 |
|
20518 |
|
20519 |
|
20520 |
|
20521 |
|
20522 |
|
20523 |
|
20524 |
|
20525 |
|
20526 |
|
20527 | replaceWith(...args) {
|
20528 | return this._router.replaceWith(...(0, _utils2.prefixRouteNameArg)(this, args));
|
20529 | }
|
20530 | |
20531 |
|
20532 |
|
20533 |
|
20534 |
|
20535 |
|
20536 |
|
20537 | setup(context, transition) {
|
20538 | var controllerName = this.controllerName || this.routeName;
|
20539 | var definedController = this.controllerFor(controllerName, true);
|
20540 | var controller;
|
20541 |
|
20542 | if (definedController) {
|
20543 | controller = definedController;
|
20544 | } else {
|
20545 | controller = this.generateController(controllerName);
|
20546 | }
|
20547 |
|
20548 |
|
20549 |
|
20550 | if (!this.controller) {
|
20551 | var qp = (0, _metal.get)(this, '_qp');
|
20552 | var propNames = qp !== undefined ? (0, _metal.get)(qp, 'propertyNames') : [];
|
20553 | addQueryParamsObservers(controller, propNames);
|
20554 | this.controller = controller;
|
20555 | }
|
20556 |
|
20557 | var queryParams = (0, _metal.get)(this, '_qp');
|
20558 | var states = queryParams.states;
|
20559 | controller._qpDelegate = states.allowOverrides;
|
20560 |
|
20561 | if (transition) {
|
20562 |
|
20563 | (0, _utils2.stashParamNames)(this._router, transition[_router_js.STATE_SYMBOL].routeInfos);
|
20564 | var cache = this._bucketCache;
|
20565 | var params = transition[_router_js.PARAMS_SYMBOL];
|
20566 | var allParams = queryParams.propertyNames;
|
20567 | allParams.forEach(prop => {
|
20568 | var aQp = queryParams.map[prop];
|
20569 | aQp.values = params;
|
20570 | var cacheKey = (0, _utils2.calculateCacheKey)(aQp.route.fullRouteName, aQp.parts, aQp.values);
|
20571 | var value = cache.lookup(cacheKey, prop, aQp.undecoratedDefaultValue);
|
20572 | (0, _metal.set)(controller, prop, value);
|
20573 | });
|
20574 | var qpValues = getQueryParamsFor(this, transition[_router_js.STATE_SYMBOL]);
|
20575 | (0, _metal.setProperties)(controller, qpValues);
|
20576 | }
|
20577 |
|
20578 | this.setupController(controller, context, transition);
|
20579 |
|
20580 | if (this._environment.options.shouldRender) {
|
20581 | this.renderTemplate(controller, context);
|
20582 | }
|
20583 |
|
20584 |
|
20585 |
|
20586 | (0, _metal.flushAsyncObservers)(false);
|
20587 | }
|
20588 | |
20589 |
|
20590 |
|
20591 |
|
20592 |
|
20593 |
|
20594 |
|
20595 | _qpChanged(prop, value, qp) {
|
20596 | if (!qp) {
|
20597 | return;
|
20598 | }
|
20599 |
|
20600 |
|
20601 | var cache = this._bucketCache;
|
20602 | var cacheKey = (0, _utils2.calculateCacheKey)(qp.route.fullRouteName, qp.parts, qp.values);
|
20603 | cache.stash(cacheKey, prop, value);
|
20604 | }
|
20605 | |
20606 |
|
20607 |
|
20608 |
|
20609 |
|
20610 |
|
20611 |
|
20612 |
|
20613 |
|
20614 |
|
20615 |
|
20616 |
|
20617 |
|
20618 |
|
20619 |
|
20620 |
|
20621 |
|
20622 |
|
20623 |
|
20624 |
|
20625 |
|
20626 |
|
20627 |
|
20628 |
|
20629 |
|
20630 |
|
20631 |
|
20632 |
|
20633 |
|
20634 |
|
20635 | beforeModel() {}
|
20636 | |
20637 |
|
20638 |
|
20639 |
|
20640 |
|
20641 |
|
20642 |
|
20643 |
|
20644 |
|
20645 |
|
20646 |
|
20647 |
|
20648 |
|
20649 |
|
20650 |
|
20651 |
|
20652 |
|
20653 |
|
20654 |
|
20655 |
|
20656 |
|
20657 |
|
20658 |
|
20659 |
|
20660 |
|
20661 |
|
20662 |
|
20663 |
|
20664 |
|
20665 |
|
20666 |
|
20667 |
|
20668 |
|
20669 | afterModel() {}
|
20670 | |
20671 |
|
20672 |
|
20673 |
|
20674 |
|
20675 |
|
20676 |
|
20677 |
|
20678 |
|
20679 |
|
20680 |
|
20681 |
|
20682 |
|
20683 |
|
20684 |
|
20685 |
|
20686 |
|
20687 |
|
20688 |
|
20689 |
|
20690 |
|
20691 |
|
20692 | redirect() {}
|
20693 | |
20694 |
|
20695 |
|
20696 |
|
20697 |
|
20698 |
|
20699 |
|
20700 | contextDidChange() {
|
20701 | this.currentModel = this.context;
|
20702 | }
|
20703 | |
20704 |
|
20705 |
|
20706 |
|
20707 |
|
20708 |
|
20709 |
|
20710 |
|
20711 |
|
20712 |
|
20713 |
|
20714 |
|
20715 |
|
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 |
|
20751 |
|
20752 |
|
20753 |
|
20754 |
|
20755 |
|
20756 |
|
20757 |
|
20758 |
|
20759 |
|
20760 |
|
20761 |
|
20762 |
|
20763 |
|
20764 |
|
20765 | model(params, transition) {
|
20766 | var name, sawParams, value;
|
20767 | var queryParams = (0, _metal.get)(this, '_qp.map');
|
20768 |
|
20769 | for (var prop in params) {
|
20770 | if (prop === 'queryParams' || queryParams && prop in queryParams) {
|
20771 | continue;
|
20772 | }
|
20773 |
|
20774 | var match = prop.match(/^(.*)_id$/);
|
20775 |
|
20776 | if (match !== null) {
|
20777 | name = match[1];
|
20778 | value = params[prop];
|
20779 | }
|
20780 |
|
20781 | sawParams = true;
|
20782 | }
|
20783 |
|
20784 | if (!name) {
|
20785 | if (sawParams) {
|
20786 | return (0, _polyfills.assign)({}, params);
|
20787 | } else {
|
20788 | if (transition.resolveIndex < 1) {
|
20789 | return;
|
20790 | }
|
20791 |
|
20792 | return transition[_router_js.STATE_SYMBOL].routeInfos[transition.resolveIndex - 1].context;
|
20793 | }
|
20794 | }
|
20795 |
|
20796 | return this.findModel(name, value);
|
20797 | }
|
20798 | |
20799 |
|
20800 |
|
20801 |
|
20802 |
|
20803 |
|
20804 |
|
20805 |
|
20806 |
|
20807 |
|
20808 | deserialize(_params, transition) {
|
20809 | return this.model(this._paramsFor(this.routeName, _params), transition);
|
20810 | }
|
20811 | |
20812 |
|
20813 |
|
20814 |
|
20815 |
|
20816 |
|
20817 |
|
20818 |
|
20819 | findModel(...args) {
|
20820 | return (0, _metal.get)(this, 'store').find(...args);
|
20821 | }
|
20822 | |
20823 |
|
20824 |
|
20825 |
|
20826 |
|
20827 |
|
20828 |
|
20829 |
|
20830 |
|
20831 |
|
20832 |
|
20833 |
|
20834 |
|
20835 |
|
20836 |
|
20837 |
|
20838 |
|
20839 |
|
20840 |
|
20841 |
|
20842 |
|
20843 |
|
20844 |
|
20845 |
|
20846 |
|
20847 |
|
20848 |
|
20849 |
|
20850 |
|
20851 |
|
20852 |
|
20853 |
|
20854 |
|
20855 |
|
20856 |
|
20857 |
|
20858 |
|
20859 |
|
20860 |
|
20861 |
|
20862 |
|
20863 |
|
20864 |
|
20865 |
|
20866 |
|
20867 |
|
20868 |
|
20869 |
|
20870 |
|
20871 |
|
20872 |
|
20873 |
|
20874 |
|
20875 |
|
20876 | setupController(controller, context, _transition) {
|
20877 |
|
20878 | if (controller && context !== undefined) {
|
20879 | (0, _metal.set)(controller, 'model', context);
|
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 | controllerFor(name, _skipAssert) {
|
20905 | var owner = (0, _owner.getOwner)(this);
|
20906 | var route = owner.lookup(`route:${name}`);
|
20907 |
|
20908 | if (route && route.controllerName) {
|
20909 | name = route.controllerName;
|
20910 | }
|
20911 |
|
20912 | var controller = owner.lookup(`controller:${name}`);
|
20913 |
|
20914 |
|
20915 |
|
20916 | (true && !(controller !== undefined || _skipAssert === true) && (0, _debug.assert)(`The controller named '${name}' could not be found. Make sure that this route exists and has already been entered at least once. If you are accessing a controller not associated with a route, make sure the controller class is explicitly defined.`, controller !== undefined || _skipAssert === true));
|
20917 | return controller;
|
20918 | }
|
20919 | |
20920 |
|
20921 |
|
20922 |
|
20923 |
|
20924 |
|
20925 |
|
20926 |
|
20927 |
|
20928 |
|
20929 |
|
20930 |
|
20931 |
|
20932 |
|
20933 |
|
20934 |
|
20935 |
|
20936 |
|
20937 | generateController(name) {
|
20938 | var owner = (0, _owner.getOwner)(this);
|
20939 | return (0, _generate_controller.default)(owner, name);
|
20940 | }
|
20941 | |
20942 |
|
20943 |
|
20944 |
|
20945 |
|
20946 |
|
20947 |
|
20948 |
|
20949 |
|
20950 |
|
20951 |
|
20952 |
|
20953 |
|
20954 |
|
20955 |
|
20956 |
|
20957 |
|
20958 |
|
20959 |
|
20960 |
|
20961 |
|
20962 |
|
20963 |
|
20964 |
|
20965 |
|
20966 |
|
20967 |
|
20968 |
|
20969 |
|
20970 |
|
20971 |
|
20972 |
|
20973 |
|
20974 |
|
20975 |
|
20976 |
|
20977 | modelFor(_name) {
|
20978 | var name;
|
20979 | var owner = (0, _owner.getOwner)(this);
|
20980 | var transition = this._router && this._router._routerMicrolib ? this._router._routerMicrolib.activeTransition : undefined;
|
20981 |
|
20982 |
|
20983 | if (owner.routable && transition !== undefined) {
|
20984 | name = getEngineRouteName(owner, _name);
|
20985 | } else {
|
20986 | name = _name;
|
20987 | }
|
20988 |
|
20989 | var route = owner.lookup(`route:${name}`);
|
20990 |
|
20991 |
|
20992 | if (transition !== undefined && transition !== null) {
|
20993 | var modelLookupName = route && route.routeName || name;
|
20994 |
|
20995 | if (Object.prototype.hasOwnProperty.call(transition.resolvedModels, modelLookupName)) {
|
20996 | return transition.resolvedModels[modelLookupName];
|
20997 | }
|
20998 | }
|
20999 |
|
21000 | return route && route.currentModel;
|
21001 | }
|
21002 | |
21003 |
|
21004 |
|
21005 |
|
21006 |
|
21007 |
|
21008 |
|
21009 |
|
21010 |
|
21011 |
|
21012 |
|
21013 |
|
21014 |
|
21015 |
|
21016 |
|
21017 |
|
21018 |
|
21019 |
|
21020 |
|
21021 |
|
21022 |
|
21023 |
|
21024 |
|
21025 |
|
21026 |
|
21027 |
|
21028 |
|
21029 |
|
21030 |
|
21031 |
|
21032 | renderTemplate(_controller, _model) {
|
21033 |
|
21034 | this.render();
|
21035 | }
|
21036 | |
21037 |
|
21038 |
|
21039 |
|
21040 |
|
21041 |
|
21042 |
|
21043 |
|
21044 |
|
21045 |
|
21046 |
|
21047 |
|
21048 |
|
21049 |
|
21050 |
|
21051 |
|
21052 |
|
21053 |
|
21054 |
|
21055 |
|
21056 |
|
21057 |
|
21058 |
|
21059 |
|
21060 |
|
21061 |
|
21062 |
|
21063 |
|
21064 |
|
21065 |
|
21066 |
|
21067 |
|
21068 |
|
21069 |
|
21070 |
|
21071 |
|
21072 |
|
21073 |
|
21074 |
|
21075 |
|
21076 |
|
21077 |
|
21078 |
|
21079 |
|
21080 |
|
21081 |
|
21082 |
|
21083 |
|
21084 |
|
21085 |
|
21086 |
|
21087 |
|
21088 |
|
21089 |
|
21090 |
|
21091 |
|
21092 |
|
21093 |
|
21094 |
|
21095 |
|
21096 |
|
21097 |
|
21098 |
|
21099 |
|
21100 |
|
21101 |
|
21102 |
|
21103 |
|
21104 |
|
21105 |
|
21106 |
|
21107 |
|
21108 |
|
21109 |
|
21110 |
|
21111 |
|
21112 |
|
21113 |
|
21114 |
|
21115 |
|
21116 |
|
21117 |
|
21118 |
|
21119 |
|
21120 |
|
21121 |
|
21122 |
|
21123 |
|
21124 |
|
21125 |
|
21126 |
|
21127 |
|
21128 |
|
21129 |
|
21130 |
|
21131 |
|
21132 |
|
21133 |
|
21134 |
|
21135 |
|
21136 |
|
21137 |
|
21138 |
|
21139 |
|
21140 | render(name, options) {
|
21141 | var renderOptions = buildRenderOptions(this, name, options);
|
21142 | ROUTE_CONNECTIONS.get(this).push(renderOptions);
|
21143 | (0, _runloop.once)(this._router, '_setOutlets');
|
21144 | }
|
21145 | |
21146 |
|
21147 |
|
21148 |
|
21149 |
|
21150 |
|
21151 |
|
21152 |
|
21153 |
|
21154 |
|
21155 |
|
21156 |
|
21157 |
|
21158 |
|
21159 |
|
21160 |
|
21161 |
|
21162 |
|
21163 |
|
21164 |
|
21165 |
|
21166 |
|
21167 |
|
21168 |
|
21169 |
|
21170 |
|
21171 |
|
21172 |
|
21173 |
|
21174 |
|
21175 |
|
21176 |
|
21177 |
|
21178 |
|
21179 |
|
21180 |
|
21181 |
|
21182 |
|
21183 |
|
21184 |
|
21185 |
|
21186 |
|
21187 |
|
21188 |
|
21189 |
|
21190 |
|
21191 |
|
21192 |
|
21193 |
|
21194 |
|
21195 | disconnectOutlet(options) {
|
21196 | var outletName;
|
21197 | var parentView;
|
21198 |
|
21199 | if (options) {
|
21200 | if (typeof options === 'string') {
|
21201 | outletName = options;
|
21202 | } else {
|
21203 | outletName = options.outlet;
|
21204 | parentView = options.parentView ? options.parentView.replace(/\//g, '.') : undefined;
|
21205 | (true && !(!('outlet' in options && options.outlet === undefined)) && (0, _debug.assert)('You passed undefined as the outlet name.', !('outlet' in options && options.outlet === undefined)));
|
21206 | }
|
21207 | }
|
21208 |
|
21209 | outletName = outletName || 'main';
|
21210 |
|
21211 | this._disconnectOutlet(outletName, parentView);
|
21212 |
|
21213 | var routeInfos = this._router._routerMicrolib.currentRouteInfos;
|
21214 |
|
21215 | for (var i = 0; i < routeInfos.length; i++) {
|
21216 |
|
21217 |
|
21218 |
|
21219 |
|
21220 | routeInfos[i].route._disconnectOutlet(outletName, parentView);
|
21221 | }
|
21222 | }
|
21223 |
|
21224 | _disconnectOutlet(outletName, parentView) {
|
21225 | var parent = parentRoute(this);
|
21226 |
|
21227 | if (parent && parentView === parent.routeName) {
|
21228 | parentView = undefined;
|
21229 | }
|
21230 |
|
21231 | var connections = ROUTE_CONNECTIONS.get(this);
|
21232 |
|
21233 | for (var i = 0; i < connections.length; i++) {
|
21234 | var connection = connections[i];
|
21235 |
|
21236 | if (connection.outlet === outletName && connection.into === parentView) {
|
21237 |
|
21238 |
|
21239 |
|
21240 |
|
21241 |
|
21242 |
|
21243 | connections[i] = {
|
21244 | owner: connection.owner,
|
21245 | into: connection.into,
|
21246 | outlet: connection.outlet,
|
21247 | name: connection.name,
|
21248 | controller: undefined,
|
21249 | template: undefined,
|
21250 | model: undefined
|
21251 | };
|
21252 | (0, _runloop.once)(this._router, '_setOutlets');
|
21253 | }
|
21254 | }
|
21255 | }
|
21256 |
|
21257 | willDestroy() {
|
21258 | this.teardownViews();
|
21259 | }
|
21260 | |
21261 |
|
21262 |
|
21263 |
|
21264 |
|
21265 |
|
21266 | teardownViews() {
|
21267 | var connections = ROUTE_CONNECTIONS.get(this);
|
21268 |
|
21269 | if (connections !== undefined && connections.length > 0) {
|
21270 | ROUTE_CONNECTIONS.set(this, []);
|
21271 | (0, _runloop.once)(this._router, '_setOutlets');
|
21272 | }
|
21273 | }
|
21274 | |
21275 |
|
21276 |
|
21277 |
|
21278 |
|
21279 |
|
21280 |
|
21281 |
|
21282 |
|
21283 |
|
21284 |
|
21285 |
|
21286 |
|
21287 |
|
21288 |
|
21289 |
|
21290 |
|
21291 |
|
21292 |
|
21293 |
|
21294 |
|
21295 |
|
21296 |
|
21297 |
|
21298 |
|
21299 |
|
21300 |
|
21301 |
|
21302 |
|
21303 |
|
21304 |
|
21305 |
|
21306 |
|
21307 |
|
21308 | buildRouteInfoMetadata() {}
|
21309 |
|
21310 | }
|
21311 |
|
21312 | Route.reopenClass({
|
21313 | isRouteFactory: true
|
21314 | });
|
21315 |
|
21316 | function parentRoute(route) {
|
21317 | var routeInfo = routeInfoFor(route, route._router._routerMicrolib.state.routeInfos, -1);
|
21318 | return routeInfo && routeInfo.route;
|
21319 | }
|
21320 |
|
21321 | function routeInfoFor(route, routeInfos, offset = 0) {
|
21322 | if (!routeInfos) {
|
21323 | return;
|
21324 | }
|
21325 |
|
21326 | var current;
|
21327 |
|
21328 | for (var i = 0; i < routeInfos.length; i++) {
|
21329 | current = routeInfos[i].route;
|
21330 |
|
21331 | if (current === route) {
|
21332 | return routeInfos[i + offset];
|
21333 | }
|
21334 | }
|
21335 |
|
21336 | return;
|
21337 | }
|
21338 |
|
21339 | function buildRenderOptions(route, nameOrOptions, options) {
|
21340 | var isDefaultRender = !nameOrOptions && !options;
|
21341 |
|
21342 | var _name;
|
21343 |
|
21344 | if (!isDefaultRender) {
|
21345 | if (typeof nameOrOptions === 'object' && !options) {
|
21346 | _name = route.templateName || route.routeName;
|
21347 | options = nameOrOptions;
|
21348 | } else {
|
21349 | (true && !(!(0, _metal.isEmpty)(nameOrOptions)) && (0, _debug.assert)('The name in the given arguments is undefined or empty string', !(0, _metal.isEmpty)(nameOrOptions)));
|
21350 | _name = nameOrOptions;
|
21351 | }
|
21352 | }
|
21353 |
|
21354 | (true && !(isDefaultRender || !(options && 'outlet' in options && options.outlet === undefined)) && (0, _debug.assert)('You passed undefined as the outlet name.', isDefaultRender || !(options && 'outlet' in options && options.outlet === undefined)));
|
21355 | var owner = (0, _owner.getOwner)(route);
|
21356 | var name, templateName, into, outlet, model;
|
21357 | var controller = undefined;
|
21358 |
|
21359 | if (options) {
|
21360 | into = options.into && options.into.replace(/\//g, '.');
|
21361 | outlet = options.outlet;
|
21362 | controller = options.controller;
|
21363 | model = options.model;
|
21364 | }
|
21365 |
|
21366 | outlet = outlet || 'main';
|
21367 |
|
21368 | if (isDefaultRender) {
|
21369 | name = route.routeName;
|
21370 | templateName = route.templateName || name;
|
21371 | } else {
|
21372 | name = _name.replace(/\//g, '.');
|
21373 | templateName = name;
|
21374 | }
|
21375 |
|
21376 | if (controller === undefined) {
|
21377 | if (isDefaultRender) {
|
21378 | controller = route.controllerName || owner.lookup(`controller:${name}`);
|
21379 | } else {
|
21380 | controller = owner.lookup(`controller:${name}`) || route.controllerName || route.routeName;
|
21381 | }
|
21382 | }
|
21383 |
|
21384 | if (typeof controller === 'string') {
|
21385 | var controllerName = controller;
|
21386 | controller = owner.lookup(`controller:${controllerName}`);
|
21387 | (true && !(isDefaultRender || controller !== undefined) && (0, _debug.assert)(`You passed \`controller: '${controllerName}'\` into the \`render\` method, but no such controller could be found.`, isDefaultRender || controller !== undefined));
|
21388 | }
|
21389 |
|
21390 | if (model === undefined) {
|
21391 | model = route.currentModel;
|
21392 | } else {
|
21393 | controller.set('model', model);
|
21394 | }
|
21395 |
|
21396 | var template = owner.lookup(`template:${templateName}`);
|
21397 | (true && !(isDefaultRender || template !== undefined) && (0, _debug.assert)(`Could not find "${templateName}" template, view, or component.`, isDefaultRender || template !== undefined));
|
21398 | var parent;
|
21399 |
|
21400 | if (into && (parent = parentRoute(route)) && into === parent.routeName) {
|
21401 | into = undefined;
|
21402 | }
|
21403 |
|
21404 | var renderOptions = {
|
21405 | owner,
|
21406 | into,
|
21407 | outlet,
|
21408 | name,
|
21409 | controller,
|
21410 | model,
|
21411 | template: template !== undefined ? template(owner) : route._topLevelViewTemplate(owner)
|
21412 | };
|
21413 |
|
21414 | if (true
|
21415 |
|
21416 | ) {
|
21417 | var LOG_VIEW_LOOKUPS = (0, _metal.get)(route._router, 'namespace.LOG_VIEW_LOOKUPS');
|
21418 |
|
21419 | if (LOG_VIEW_LOOKUPS && !template) {
|
21420 | (0, _debug.info)(`Could not find "${name}" template. Nothing will be rendered`, {
|
21421 | fullName: `template:${name}`
|
21422 | });
|
21423 | }
|
21424 | }
|
21425 |
|
21426 | return renderOptions;
|
21427 | }
|
21428 |
|
21429 | function getFullQueryParams(router, state) {
|
21430 | if (state['fullQueryParams']) {
|
21431 | return state['fullQueryParams'];
|
21432 | }
|
21433 |
|
21434 | state['fullQueryParams'] = {};
|
21435 | (0, _polyfills.assign)(state['fullQueryParams'], state.queryParams);
|
21436 |
|
21437 | router._deserializeQueryParams(state.routeInfos, state['fullQueryParams']);
|
21438 |
|
21439 | return state['fullQueryParams'];
|
21440 | }
|
21441 |
|
21442 | function getQueryParamsFor(route, state) {
|
21443 | state['queryParamsFor'] = state['queryParamsFor'] || {};
|
21444 | var name = route.fullRouteName;
|
21445 |
|
21446 | if (state['queryParamsFor'][name]) {
|
21447 | return state['queryParamsFor'][name];
|
21448 | }
|
21449 |
|
21450 | var fullQueryParams = getFullQueryParams(route._router, state);
|
21451 | var params = state['queryParamsFor'][name] = {};
|
21452 |
|
21453 | var qps = (0, _metal.get)(route, '_qp.qps');
|
21454 |
|
21455 | for (var i = 0; i < qps.length; ++i) {
|
21456 |
|
21457 | var qp = qps[i];
|
21458 | var qpValueWasPassedIn = (qp.prop in fullQueryParams);
|
21459 | params[qp.prop] = qpValueWasPassedIn ? fullQueryParams[qp.prop] : copyDefaultValue(qp.defaultValue);
|
21460 | }
|
21461 |
|
21462 | return params;
|
21463 | }
|
21464 |
|
21465 | function copyDefaultValue(value) {
|
21466 | if (Array.isArray(value)) {
|
21467 | return (0, _runtime.A)(value.slice());
|
21468 | }
|
21469 |
|
21470 | return value;
|
21471 | }
|
21472 | |
21473 |
|
21474 |
|
21475 |
|
21476 |
|
21477 |
|
21478 |
|
21479 | function mergeEachQueryParams(controllerQP, routeQP) {
|
21480 | var qps = {};
|
21481 | var keysAlreadyMergedOrSkippable = {
|
21482 | defaultValue: true,
|
21483 | type: true,
|
21484 | scope: true,
|
21485 | as: true
|
21486 | };
|
21487 |
|
21488 |
|
21489 | for (var cqpName in controllerQP) {
|
21490 | if (!Object.prototype.hasOwnProperty.call(controllerQP, cqpName)) {
|
21491 | continue;
|
21492 | }
|
21493 |
|
21494 | var newControllerParameterConfiguration = {};
|
21495 | (0, _polyfills.assign)(newControllerParameterConfiguration, controllerQP[cqpName], routeQP[cqpName]);
|
21496 | qps[cqpName] = newControllerParameterConfiguration;
|
21497 |
|
21498 | keysAlreadyMergedOrSkippable[cqpName] = true;
|
21499 | }
|
21500 |
|
21501 |
|
21502 |
|
21503 | for (var rqpName in routeQP) {
|
21504 | if (!Object.prototype.hasOwnProperty.call(routeQP, rqpName) || keysAlreadyMergedOrSkippable[rqpName]) {
|
21505 | continue;
|
21506 | }
|
21507 |
|
21508 | var newRouteParameterConfiguration = {};
|
21509 | (0, _polyfills.assign)(newRouteParameterConfiguration, routeQP[rqpName], controllerQP[rqpName]);
|
21510 | qps[rqpName] = newRouteParameterConfiguration;
|
21511 | }
|
21512 |
|
21513 | return qps;
|
21514 | }
|
21515 |
|
21516 | function addQueryParamsObservers(controller, propNames) {
|
21517 | propNames.forEach(prop => {
|
21518 | if ((0, _metal.descriptorForProperty)(controller, prop) === undefined) {
|
21519 | var desc = (0, _utils.lookupDescriptor)(controller, prop);
|
21520 |
|
21521 | if (desc !== null && (typeof desc.get === 'function' || typeof desc.set === 'function')) {
|
21522 | (0, _metal.defineProperty)(controller, prop, (0, _compat.dependentKeyCompat)({
|
21523 | get: desc.get,
|
21524 | set: desc.set
|
21525 | }));
|
21526 | }
|
21527 | }
|
21528 |
|
21529 | (0, _metal.addObserver)(controller, `${prop}.[]`, controller, controller._qpChanged, false);
|
21530 | });
|
21531 | }
|
21532 |
|
21533 | function getEngineRouteName(engine, routeName) {
|
21534 | if (engine.routable) {
|
21535 | var prefix = engine.mountPoint;
|
21536 |
|
21537 | if (routeName === 'application') {
|
21538 | return prefix;
|
21539 | } else {
|
21540 | return `${prefix}.${routeName}`;
|
21541 | }
|
21542 | }
|
21543 |
|
21544 | return routeName;
|
21545 | }
|
21546 | /**
|
21547 | A hook you can implement to convert the route's model into parameters
|
21548 | for the URL.
|
21549 |
|
21550 | ```app/router.js
|
21551 |
|
21552 |
|
21553 | Router.map(function() {
|
21554 | this.route('post', { path: '/posts/:post_id' });
|
21555 | });
|
21556 |
|
21557 | ```
|
21558 |
|
21559 | ```app/routes/post.js
|
21560 | import Route from '@ember/routing/route';
|
21561 |
|
21562 | export default class PostRoute extends Route {
|
21563 | model({ post_id }) {
|
21564 |
|
21565 | return fetch(`/posts/${post_id}`;
|
21566 | }
|
21567 |
|
21568 | serialize(model) {
|
21569 |
|
21570 | return { post_id: model.id };
|
21571 | }
|
21572 | }
|
21573 | ```
|
21574 |
|
21575 | The default `serialize` method will insert the model's `id` into the
|
21576 | route's dynamic segment (in this case, `:post_id`) if the segment contains '_id'.
|
21577 | If the route has multiple dynamic segments or does not contain '_id', `serialize`
|
21578 | will return `getProperties(model, params)`
|
21579 |
|
21580 | This method is called when `transitionTo` is called with a context
|
21581 | in order to populate the URL.
|
21582 |
|
21583 | @method serialize
|
21584 | @param {Object} model the routes model
|
21585 | @param {Array} params an Array of parameter names for the current
|
21586 | route (in the example, `['post_id']`.
|
21587 | @return {Object} the serialized parameters
|
21588 | @since 1.0.0
|
21589 | @public
|
21590 | */
|
21591 |
|
21592 |
|
21593 | Route.prototype.serialize = defaultSerialize;
|
21594 | Route.reopen(_runtime.ActionHandler, _runtime.Evented, {
|
21595 | mergedProperties: ['queryParams'],
|
21596 |
|
21597 | /**
|
21598 | Configuration hash for this route's queryParams. The possible
|
21599 | configuration options and their defaults are as follows
|
21600 | (assuming a query param whose controller property is `page`):
|
21601 | ```javascript
|
21602 | queryParams: {
|
21603 | page: {
|
21604 |
|
21605 |
|
21606 |
|
21607 |
|
21608 |
|
21609 |
|
21610 |
|
21611 |
|
21612 | refreshModel: false,
|
21613 |
|
21614 |
|
21615 |
|
21616 |
|
21617 |
|
21618 |
|
21619 |
|
21620 |
|
21621 |
|
21622 | replace: false,
|
21623 |
|
21624 |
|
21625 |
|
21626 | as: 'page'
|
21627 | }
|
21628 | }
|
21629 | ```
|
21630 | @property queryParams
|
21631 | @for Route
|
21632 | @type Object
|
21633 | @since 1.6.0
|
21634 | @public
|
21635 | */
|
21636 | queryParams: {},
|
21637 |
|
21638 | /**
|
21639 | The name of the template to use by default when rendering this routes
|
21640 | template.
|
21641 | ```app/routes/posts/list.js
|
21642 | import Route from '@ember/routing/route';
|
21643 | export default class extends Route {
|
21644 | templateName = 'posts/list'
|
21645 | });
|
21646 | ```
|
21647 | ```app/routes/posts/index.js
|
21648 | import PostsList from '../posts/list';
|
21649 | export default class extends PostsList {};
|
21650 | ```
|
21651 | ```app/routes/posts/archived.js
|
21652 | import PostsList from '../posts/list';
|
21653 | export default class extends PostsList {};
|
21654 | ```
|
21655 | @property templateName
|
21656 | @type String
|
21657 | @default null
|
21658 | @since 1.4.0
|
21659 | @public
|
21660 | */
|
21661 | templateName: null,
|
21662 |
|
21663 | /**
|
21664 | @private
|
21665 | @property _names
|
21666 | */
|
21667 | _names: null,
|
21668 |
|
21669 | /**
|
21670 | The name of the controller to associate with this route.
|
21671 | By default, Ember will lookup a route's controller that matches the name
|
21672 | of the route (i.e. `posts.new`). However,
|
21673 | if you would like to define a specific controller to use, you can do so
|
21674 | using this property.
|
21675 | This is useful in many ways, as the controller specified will be:
|
21676 | * passed to the `setupController` method.
|
21677 | * used as the controller for the template being rendered by the route.
|
21678 | * returned from a call to `controllerFor` for the route.
|
21679 | @property controllerName
|
21680 | @type String
|
21681 | @default null
|
21682 | @since 1.4.0
|
21683 | @public
|
21684 | */
|
21685 | controllerName: null,
|
21686 |
|
21687 | /**
|
21688 | Store property provides a hook for data persistence libraries to inject themselves.
|
21689 | By default, this store property provides the exact same functionality previously
|
21690 | in the model hook.
|
21691 | Currently, the required interface is:
|
21692 | `store.find(modelName, findArguments)`
|
21693 | @property store
|
21694 | @type {Object}
|
21695 | @private
|
21696 | */
|
21697 | store: (0, _metal.computed)({
|
21698 | get() {
|
21699 | var owner = (0, _owner.getOwner)(this);
|
21700 | var routeName = this.routeName;
|
21701 | var namespace = (0, _metal.get)(this, '_router.namespace');
|
21702 | return {
|
21703 | find(name, value) {
|
21704 | var modelClass = owner.factoryFor(`model:${name}`);
|
21705 | (true && !(Boolean(modelClass)) && (0, _debug.assert)(`You used the dynamic segment ${name}_id in your route ${routeName}, but ${namespace}.${(0, _string.classify)(name)} did not exist and you did not override your route's \`model\` hook.`, Boolean(modelClass)));
|
21706 |
|
21707 | if (!modelClass) {
|
21708 | return;
|
21709 | }
|
21710 |
|
21711 | modelClass = modelClass.class;
|
21712 | (true && !(typeof modelClass.find === 'function') && (0, _debug.assert)(`${(0, _string.classify)(name)} has no method \`find\`.`, typeof modelClass.find === 'function'));
|
21713 | return modelClass.find(value);
|
21714 | }
|
21715 |
|
21716 | };
|
21717 | },
|
21718 |
|
21719 | set(key, value) {
|
21720 | (0, _metal.defineProperty)(this, key, null, value);
|
21721 | }
|
21722 |
|
21723 | }),
|
21724 |
|
21725 | |
21726 |
|
21727 |
|
21728 |
|
21729 | _qp: (0, _metal.computed)(function () {
|
21730 | var combinedQueryParameterConfiguration;
|
21731 | var controllerName = this.controllerName || this.routeName;
|
21732 | var owner = (0, _owner.getOwner)(this);
|
21733 | var controller = owner.lookup(`controller:${controllerName}`);
|
21734 | var queryParameterConfiguraton = (0, _metal.get)(this, 'queryParams');
|
21735 | var hasRouterDefinedQueryParams = Object.keys(queryParameterConfiguraton).length > 0;
|
21736 |
|
21737 | if (controller) {
|
21738 |
|
21739 |
|
21740 |
|
21741 |
|
21742 | var controllerDefinedQueryParameterConfiguration = (0, _metal.get)(controller, 'queryParams') || {};
|
21743 | var normalizedControllerQueryParameterConfiguration = (0, _utils2.normalizeControllerQueryParams)(controllerDefinedQueryParameterConfiguration);
|
21744 | combinedQueryParameterConfiguration = mergeEachQueryParams(normalizedControllerQueryParameterConfiguration, queryParameterConfiguraton);
|
21745 | } else if (hasRouterDefinedQueryParams) {
|
21746 |
|
21747 |
|
21748 | controller = (0, _generate_controller.default)(owner, controllerName);
|
21749 | combinedQueryParameterConfiguration = queryParameterConfiguraton;
|
21750 | }
|
21751 |
|
21752 | var qps = [];
|
21753 | var map = {};
|
21754 | var propertyNames = [];
|
21755 |
|
21756 | for (var propName in combinedQueryParameterConfiguration) {
|
21757 | if (!Object.prototype.hasOwnProperty.call(combinedQueryParameterConfiguration, propName)) {
|
21758 | continue;
|
21759 | }
|
21760 |
|
21761 |
|
21762 |
|
21763 | if (propName === 'unknownProperty' || propName === '_super') {
|
21764 |
|
21765 | continue;
|
21766 | }
|
21767 |
|
21768 | var desc = combinedQueryParameterConfiguration[propName];
|
21769 | var scope = desc.scope || 'model';
|
21770 | var parts = void 0;
|
21771 |
|
21772 | if (scope === 'controller') {
|
21773 | parts = [];
|
21774 | }
|
21775 |
|
21776 | var urlKey = desc.as || this.serializeQueryParamKey(propName);
|
21777 | var defaultValue = (0, _metal.get)(controller, propName);
|
21778 | defaultValue = copyDefaultValue(defaultValue);
|
21779 | var type = desc.type || (0, _runtime.typeOf)(defaultValue);
|
21780 | var defaultValueSerialized = this.serializeQueryParam(defaultValue, urlKey, type);
|
21781 | var scopedPropertyName = `${controllerName}:${propName}`;
|
21782 | var qp = {
|
21783 | undecoratedDefaultValue: (0, _metal.get)(controller, propName),
|
21784 | defaultValue,
|
21785 | serializedDefaultValue: defaultValueSerialized,
|
21786 | serializedValue: defaultValueSerialized,
|
21787 | type,
|
21788 | urlKey,
|
21789 | prop: propName,
|
21790 | scopedPropertyName,
|
21791 | controllerName,
|
21792 | route: this,
|
21793 | parts,
|
21794 | values: null,
|
21795 | scope
|
21796 | };
|
21797 | map[propName] = map[urlKey] = map[scopedPropertyName] = qp;
|
21798 | qps.push(qp);
|
21799 | propertyNames.push(propName);
|
21800 | }
|
21801 |
|
21802 | return {
|
21803 | qps,
|
21804 | map,
|
21805 | propertyNames,
|
21806 | states: {
|
21807 | |
21808 |
|
21809 |
|
21810 |
|
21811 |
|
21812 | inactive: (prop, value) => {
|
21813 | var qp = map[prop];
|
21814 |
|
21815 | this._qpChanged(prop, value, qp);
|
21816 | },
|
21817 |
|
21818 | |
21819 |
|
21820 |
|
21821 |
|
21822 |
|
21823 | active: (prop, value) => {
|
21824 | var qp = map[prop];
|
21825 |
|
21826 | this._qpChanged(prop, value, qp);
|
21827 |
|
21828 | return this._activeQPChanged(qp, value);
|
21829 | },
|
21830 |
|
21831 | |
21832 |
|
21833 |
|
21834 |
|
21835 | allowOverrides: (prop, value) => {
|
21836 | var qp = map[prop];
|
21837 |
|
21838 | this._qpChanged(prop, value, qp);
|
21839 |
|
21840 | return this._updatingQPChanged(qp);
|
21841 | }
|
21842 | }
|
21843 | };
|
21844 | }),
|
21845 |
|
21846 | |
21847 |
|
21848 |
|
21849 |
|
21850 |
|
21851 |
|
21852 |
|
21853 |
|
21854 |
|
21855 |
|
21856 |
|
21857 |
|
21858 |
|
21859 |
|
21860 |
|
21861 |
|
21862 |
|
21863 |
|
21864 |
|
21865 |
|
21866 |
|
21867 |
|
21868 |
|
21869 |
|
21870 |
|
21871 |
|
21872 |
|
21873 |
|
21874 |
|
21875 |
|
21876 |
|
21877 |
|
21878 |
|
21879 |
|
21880 |
|
21881 |
|
21882 |
|
21883 |
|
21884 |
|
21885 | send(...args) {
|
21886 | (true && !(!this.isDestroying && !this.isDestroyed) && (0, _debug.assert)(`Attempted to call .send() with the action '${args[0]}' on the destroyed route '${this.routeName}'.`, !this.isDestroying && !this.isDestroyed));
|
21887 |
|
21888 | if (this._router && this._router._routerMicrolib || !(0, _debug.isTesting)()) {
|
21889 | this._router.send(...args);
|
21890 | } else {
|
21891 | var name = args.shift();
|
21892 | var action = this.actions[name];
|
21893 |
|
21894 | if (action) {
|
21895 | return action.apply(this, args);
|
21896 | }
|
21897 | }
|
21898 | },
|
21899 |
|
21900 | |
21901 |
|
21902 |
|
21903 |
|
21904 |
|
21905 |
|
21906 |
|
21907 |
|
21908 |
|
21909 |
|
21910 |
|
21911 |
|
21912 |
|
21913 |
|
21914 |
|
21915 |
|
21916 |
|
21917 |
|
21918 |
|
21919 |
|
21920 |
|
21921 |
|
21922 |
|
21923 |
|
21924 |
|
21925 | actions: {
|
21926 | |
21927 |
|
21928 |
|
21929 |
|
21930 |
|
21931 |
|
21932 |
|
21933 |
|
21934 |
|
21935 | queryParamsDidChange(changed, _totalPresent, removed) {
|
21936 | var qpMap = (0, _metal.get)(this, '_qp').map;
|
21937 | var totalChanged = Object.keys(changed).concat(Object.keys(removed));
|
21938 |
|
21939 | for (var i = 0; i < totalChanged.length; ++i) {
|
21940 | var qp = qpMap[totalChanged[i]];
|
21941 |
|
21942 | if (qp && (0, _metal.get)(this._optionsForQueryParam(qp), 'refreshModel') && this._router.currentState) {
|
21943 | this.refresh();
|
21944 | break;
|
21945 | }
|
21946 | }
|
21947 |
|
21948 | return true;
|
21949 | },
|
21950 |
|
21951 | finalizeQueryParamChange(params, finalParams, transition) {
|
21952 | if (this.fullRouteName !== 'application') {
|
21953 | return true;
|
21954 | }
|
21955 |
|
21956 |
|
21957 | if (!transition) {
|
21958 | return;
|
21959 | }
|
21960 |
|
21961 | var routeInfos = transition[_router_js.STATE_SYMBOL].routeInfos;
|
21962 | var router = this._router;
|
21963 |
|
21964 | var qpMeta = router._queryParamsFor(routeInfos);
|
21965 |
|
21966 | var changes = router._qpUpdates;
|
21967 | var qpUpdated = false;
|
21968 | var replaceUrl;
|
21969 | (0, _utils2.stashParamNames)(router, routeInfos);
|
21970 |
|
21971 | for (var i = 0; i < qpMeta.qps.length; ++i) {
|
21972 | var qp = qpMeta.qps[i];
|
21973 | var route = qp.route;
|
21974 | var controller = route.controller;
|
21975 | var presentKey = qp.urlKey in params && qp.urlKey;
|
21976 |
|
21977 |
|
21978 |
|
21979 | var value = void 0,
|
21980 | svalue = void 0;
|
21981 |
|
21982 | if (changes.has(qp.urlKey)) {
|
21983 |
|
21984 | value = (0, _metal.get)(controller, qp.prop);
|
21985 | svalue = route.serializeQueryParam(value, qp.urlKey, qp.type);
|
21986 | } else {
|
21987 | if (presentKey) {
|
21988 | svalue = params[presentKey];
|
21989 |
|
21990 | if (svalue !== undefined) {
|
21991 | value = route.deserializeQueryParam(svalue, qp.urlKey, qp.type);
|
21992 | }
|
21993 | } else {
|
21994 |
|
21995 | svalue = qp.serializedDefaultValue;
|
21996 | value = copyDefaultValue(qp.defaultValue);
|
21997 | }
|
21998 | }
|
21999 |
|
22000 | controller._qpDelegate = (0, _metal.get)(route, '_qp.states.inactive');
|
22001 | var thisQueryParamChanged = svalue !== qp.serializedValue;
|
22002 |
|
22003 | if (thisQueryParamChanged) {
|
22004 | if (transition.queryParamsOnly && replaceUrl !== false) {
|
22005 | var options = route._optionsForQueryParam(qp);
|
22006 |
|
22007 | var replaceConfigValue = (0, _metal.get)(options, 'replace');
|
22008 |
|
22009 | if (replaceConfigValue) {
|
22010 | replaceUrl = true;
|
22011 | } else if (replaceConfigValue === false) {
|
22012 |
|
22013 | replaceUrl = false;
|
22014 | }
|
22015 | }
|
22016 |
|
22017 | (0, _metal.set)(controller, qp.prop, value);
|
22018 | qpUpdated = true;
|
22019 | }
|
22020 |
|
22021 |
|
22022 | qp.serializedValue = svalue;
|
22023 | var thisQueryParamHasDefaultValue = qp.serializedDefaultValue === svalue;
|
22024 |
|
22025 | if (!thisQueryParamHasDefaultValue || transition._keepDefaultQueryParamValues) {
|
22026 | finalParams.push({
|
22027 | value: svalue,
|
22028 | visible: true,
|
22029 | key: presentKey || qp.urlKey
|
22030 | });
|
22031 | }
|
22032 | }
|
22033 |
|
22034 |
|
22035 |
|
22036 | if (qpUpdated === true) {
|
22037 | (0, _metal.flushAsyncObservers)(false);
|
22038 | }
|
22039 |
|
22040 | if (replaceUrl) {
|
22041 | transition.method('replace');
|
22042 | }
|
22043 |
|
22044 | qpMeta.qps.forEach(qp => {
|
22045 | var routeQpMeta = (0, _metal.get)(qp.route, '_qp');
|
22046 | var finalizedController = qp.route.controller;
|
22047 | finalizedController['_qpDelegate'] = (0, _metal.get)(routeQpMeta, 'states.active');
|
22048 | });
|
22049 |
|
22050 | router._qpUpdates.clear();
|
22051 |
|
22052 | return;
|
22053 | }
|
22054 |
|
22055 | }
|
22056 | });
|
22057 | var ROUTER_EVENT_DEPRECATIONS;
|
22058 | _exports.ROUTER_EVENT_DEPRECATIONS = ROUTER_EVENT_DEPRECATIONS;
|
22059 |
|
22060 | if (_deprecatedFeatures.ROUTER_EVENTS) {
|
22061 | _exports.ROUTER_EVENT_DEPRECATIONS = ROUTER_EVENT_DEPRECATIONS = {
|
22062 | on(name) {
|
22063 | this._super(...arguments);
|
22064 |
|
22065 | var hasDidTransition = name === 'didTransition';
|
22066 | var hasWillTransition = name === 'willTransition';
|
22067 |
|
22068 | if (hasDidTransition) {
|
22069 | (true && !(false) && (0, _debug.deprecate)('You attempted to listen to the "didTransition" event which is deprecated. Please inject the router service and listen to the "routeDidChange" event.', false, {
|
22070 | id: 'deprecate-router-events',
|
22071 | until: '4.0.0',
|
22072 | url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-router-events'
|
22073 | }));
|
22074 | }
|
22075 |
|
22076 | if (hasWillTransition) {
|
22077 | (true && !(false) && (0, _debug.deprecate)('You attempted to listen to the "willTransition" event which is deprecated. Please inject the router service and listen to the "routeWillChange" event.', false, {
|
22078 | id: 'deprecate-router-events',
|
22079 | until: '4.0.0',
|
22080 | url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-router-events'
|
22081 | }));
|
22082 | }
|
22083 | }
|
22084 |
|
22085 | };
|
22086 | Route.reopen(ROUTER_EVENT_DEPRECATIONS, {
|
22087 | _paramsFor(routeName, params) {
|
22088 | var transition = this._router._routerMicrolib.activeTransition;
|
22089 |
|
22090 | if (transition !== undefined) {
|
22091 | return this.paramsFor(routeName);
|
22092 | }
|
22093 |
|
22094 | return params;
|
22095 | }
|
22096 |
|
22097 | });
|
22098 | }
|
22099 |
|
22100 | var _default = Route;
|
22101 | _exports.default = _default;
|
22102 | });
|
22103 | define("@ember/-internals/routing/lib/system/router", ["exports", "@ember/-internals/metal", "@ember/-internals/owner", "@ember/-internals/runtime", "@ember/debug", "@ember/deprecated-features", "@ember/error", "@ember/polyfills", "@ember/runloop", "@ember/-internals/routing/lib/location/api", "@ember/-internals/routing/lib/utils", "@ember/-internals/routing/lib/system/dsl", "@ember/-internals/routing/lib/system/route", "@ember/-internals/routing/lib/system/router_state", "router_js"], function (_exports, _metal, _owner, _runtime, _debug, _deprecatedFeatures, _error2, _polyfills, _runloop, _api, _utils, _dsl, _route, _router_state, _router_js) {
|
22104 | "use strict";
|
22105 |
|
22106 | Object.defineProperty(_exports, "__esModule", {
|
22107 | value: true
|
22108 | });
|
22109 | _exports.triggerEvent = triggerEvent;
|
22110 | _exports.default = void 0;
|
22111 |
|
22112 | function defaultDidTransition(infos) {
|
22113 | updatePaths(this);
|
22114 |
|
22115 | this._cancelSlowTransitionTimer();
|
22116 |
|
22117 | this.notifyPropertyChange('url');
|
22118 | this.set('currentState', this.targetState);
|
22119 |
|
22120 |
|
22121 | (0, _runloop.once)(this, this.trigger, 'didTransition');
|
22122 |
|
22123 | if (true
|
22124 |
|
22125 | ) {
|
22126 | if ((0, _metal.get)(this, 'namespace').LOG_TRANSITIONS) {
|
22127 |
|
22128 | console.log(`Transitioned into '${EmberRouter._routePath(infos)}'`);
|
22129 | }
|
22130 | }
|
22131 | }
|
22132 |
|
22133 | function defaultWillTransition(oldInfos, newInfos, transition) {
|
22134 | (0, _runloop.once)(this, this.trigger, 'willTransition', transition);
|
22135 |
|
22136 | if (true
|
22137 |
|
22138 | ) {
|
22139 | if ((0, _metal.get)(this, 'namespace').LOG_TRANSITIONS) {
|
22140 |
|
22141 | console.log(`Preparing to transition from '${EmberRouter._routePath(oldInfos)}' to '${EmberRouter._routePath(newInfos)}'`);
|
22142 | }
|
22143 | }
|
22144 | }
|
22145 |
|
22146 | function K() {
|
22147 | return this;
|
22148 | }
|
22149 |
|
22150 | var {
|
22151 | slice
|
22152 | } = Array.prototype;
|
22153 | |
22154 |
|
22155 |
|
22156 |
|
22157 |
|
22158 |
|
22159 |
|
22160 |
|
22161 |
|
22162 |
|
22163 | class EmberRouter extends _runtime.Object {
|
22164 | constructor() {
|
22165 | super(...arguments);
|
22166 | this.currentURL = null;
|
22167 | this.currentRouteName = null;
|
22168 | this.currentPath = null;
|
22169 | this.currentRoute = null;
|
22170 | this._qpCache = Object.create(null);
|
22171 | this._qpUpdates = new Set();
|
22172 | this._queuedQPChanges = {};
|
22173 | this._toplevelView = null;
|
22174 | this._handledErrors = new Set();
|
22175 | this._engineInstances = Object.create(null);
|
22176 | this._engineInfoByRoute = Object.create(null);
|
22177 | this.currentState = null;
|
22178 | this.targetState = null;
|
22179 |
|
22180 | this._resetQueuedQueryParameterChanges();
|
22181 | }
|
22182 |
|
22183 | _initRouterJs() {
|
22184 | var location = (0, _metal.get)(this, 'location');
|
22185 | var router = this;
|
22186 | var owner = (0, _owner.getOwner)(this);
|
22187 | var seen = Object.create(null);
|
22188 |
|
22189 | class PrivateRouter extends _router_js.default {
|
22190 | getRoute(name) {
|
22191 | var routeName = name;
|
22192 | var routeOwner = owner;
|
22193 | var engineInfo = router._engineInfoByRoute[routeName];
|
22194 |
|
22195 | if (engineInfo) {
|
22196 | var engineInstance = router._getEngineInstance(engineInfo);
|
22197 |
|
22198 | routeOwner = engineInstance;
|
22199 | routeName = engineInfo.localFullName;
|
22200 | }
|
22201 |
|
22202 | var fullRouteName = `route:${routeName}`;
|
22203 | var route = routeOwner.lookup(fullRouteName);
|
22204 |
|
22205 | if (seen[name]) {
|
22206 | return route;
|
22207 | }
|
22208 |
|
22209 | seen[name] = true;
|
22210 |
|
22211 | if (!route) {
|
22212 | var DefaultRoute = routeOwner.factoryFor('route:basic').class;
|
22213 | routeOwner.register(fullRouteName, DefaultRoute.extend());
|
22214 | route = routeOwner.lookup(fullRouteName);
|
22215 |
|
22216 | if (true
|
22217 |
|
22218 | ) {
|
22219 | if ((0, _metal.get)(router, 'namespace.LOG_ACTIVE_GENERATION')) {
|
22220 | (0, _debug.info)(`generated -> ${fullRouteName}`, {
|
22221 | fullName: fullRouteName
|
22222 | });
|
22223 | }
|
22224 | }
|
22225 | }
|
22226 |
|
22227 | route._setRouteName(routeName);
|
22228 |
|
22229 | if (engineInfo && !(0, _route.hasDefaultSerialize)(route)) {
|
22230 | throw new Error('Defining a custom serialize method on an Engine route is not supported.');
|
22231 | }
|
22232 |
|
22233 | return route;
|
22234 | }
|
22235 |
|
22236 | getSerializer(name) {
|
22237 | var engineInfo = router._engineInfoByRoute[name];
|
22238 |
|
22239 | if (!engineInfo) {
|
22240 | return;
|
22241 | }
|
22242 |
|
22243 | return engineInfo.serializeMethod || _route.defaultSerialize;
|
22244 | }
|
22245 |
|
22246 | updateURL(path) {
|
22247 | (0, _runloop.once)(() => {
|
22248 | location.setURL(path);
|
22249 | (0, _metal.set)(router, 'currentURL', path);
|
22250 | });
|
22251 | }
|
22252 |
|
22253 | didTransition(infos) {
|
22254 | if (_deprecatedFeatures.ROUTER_EVENTS) {
|
22255 | if (router.didTransition !== defaultDidTransition) {
|
22256 | (true && !(false) && (0, _debug.deprecate)('You attempted to override the "didTransition" method which is deprecated. Please inject the router service and listen to the "routeDidChange" event.', false, {
|
22257 | id: 'deprecate-router-events',
|
22258 | until: '4.0.0',
|
22259 | url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-router-events'
|
22260 | }));
|
22261 | }
|
22262 | }
|
22263 |
|
22264 | router.didTransition(infos);
|
22265 | }
|
22266 |
|
22267 | willTransition(oldInfos, newInfos, transition) {
|
22268 | if (_deprecatedFeatures.ROUTER_EVENTS) {
|
22269 | if (router.willTransition !== defaultWillTransition) {
|
22270 | (true && !(false) && (0, _debug.deprecate)('You attempted to override the "willTransition" method which is deprecated. Please inject the router service and listen to the "routeWillChange" event.', false, {
|
22271 | id: 'deprecate-router-events',
|
22272 | until: '4.0.0',
|
22273 | url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-router-events'
|
22274 | }));
|
22275 | }
|
22276 | }
|
22277 |
|
22278 | router.willTransition(oldInfos, newInfos, transition);
|
22279 | }
|
22280 |
|
22281 | triggerEvent(routeInfos, ignoreFailure, name, args) {
|
22282 | return triggerEvent.bind(router)(routeInfos, ignoreFailure, name, args);
|
22283 | }
|
22284 |
|
22285 | routeWillChange(transition) {
|
22286 | router.trigger('routeWillChange', transition);
|
22287 | }
|
22288 |
|
22289 | routeDidChange(transition) {
|
22290 | router.set('currentRoute', transition.to);
|
22291 | (0, _runloop.once)(() => {
|
22292 | router.trigger('routeDidChange', transition);
|
22293 | });
|
22294 | }
|
22295 |
|
22296 | transitionDidError(error, transition) {
|
22297 | if (error.wasAborted || transition.isAborted) {
|
22298 |
|
22299 |
|
22300 | return (0, _router_js.logAbort)(transition);
|
22301 | } else {
|
22302 |
|
22303 |
|
22304 | transition.trigger(false, 'error', error.error, transition, error.route);
|
22305 |
|
22306 | if (router._isErrorHandled(error.error)) {
|
22307 |
|
22308 |
|
22309 |
|
22310 | transition.rollback();
|
22311 | this.routeDidChange(transition);
|
22312 | return error.error;
|
22313 | } else {
|
22314 |
|
22315 |
|
22316 | transition.abort();
|
22317 | return error.error;
|
22318 | }
|
22319 | }
|
22320 | }
|
22321 |
|
22322 | replaceURL(url) {
|
22323 | if (location.replaceURL) {
|
22324 | var doReplaceURL = () => {
|
22325 | location.replaceURL(url);
|
22326 | (0, _metal.set)(router, 'currentURL', url);
|
22327 | };
|
22328 |
|
22329 | (0, _runloop.once)(doReplaceURL);
|
22330 | } else {
|
22331 | this.updateURL(url);
|
22332 | }
|
22333 | }
|
22334 |
|
22335 | }
|
22336 |
|
22337 | var routerMicrolib = this._routerMicrolib = new PrivateRouter();
|
22338 | var dslCallbacks = this.constructor.dslCallbacks || [K];
|
22339 |
|
22340 | var dsl = this._buildDSL();
|
22341 |
|
22342 | dsl.route('application', {
|
22343 | path: '/',
|
22344 | resetNamespace: true,
|
22345 | overrideNameAssertion: true
|
22346 | }, function () {
|
22347 | for (var i = 0; i < dslCallbacks.length; i++) {
|
22348 | dslCallbacks[i].call(this);
|
22349 | }
|
22350 | });
|
22351 |
|
22352 | if (true
|
22353 |
|
22354 | ) {
|
22355 | if ((0, _metal.get)(this, 'namespace.LOG_TRANSITIONS_INTERNAL')) {
|
22356 | routerMicrolib.log = console.log.bind(console);
|
22357 | }
|
22358 | }
|
22359 |
|
22360 | routerMicrolib.map(dsl.generate());
|
22361 | }
|
22362 |
|
22363 | _buildDSL() {
|
22364 | var enableLoadingSubstates = this._hasModuleBasedResolver();
|
22365 |
|
22366 | var router = this;
|
22367 | var owner = (0, _owner.getOwner)(this);
|
22368 | var options = {
|
22369 | enableLoadingSubstates,
|
22370 |
|
22371 | resolveRouteMap(name) {
|
22372 | return owner.factoryFor(`route-map:${name}`);
|
22373 | },
|
22374 |
|
22375 | addRouteForEngine(name, engineInfo) {
|
22376 | if (!router._engineInfoByRoute[name]) {
|
22377 | router._engineInfoByRoute[name] = engineInfo;
|
22378 | }
|
22379 | }
|
22380 |
|
22381 | };
|
22382 | return new _dsl.default(null, options);
|
22383 | }
|
22384 | |
22385 |
|
22386 |
|
22387 |
|
22388 |
|
22389 |
|
22390 |
|
22391 | _resetQueuedQueryParameterChanges() {
|
22392 | this._queuedQPChanges = {};
|
22393 | }
|
22394 |
|
22395 | _hasModuleBasedResolver() {
|
22396 | var owner = (0, _owner.getOwner)(this);
|
22397 |
|
22398 | if (!owner) {
|
22399 | return false;
|
22400 | }
|
22401 |
|
22402 | var resolver = (0, _metal.get)(owner, 'application.__registry__.resolver.moduleBasedResolver');
|
22403 | return Boolean(resolver);
|
22404 | }
|
22405 | |
22406 |
|
22407 |
|
22408 |
|
22409 |
|
22410 |
|
22411 |
|
22412 |
|
22413 |
|
22414 |
|
22415 | startRouting() {
|
22416 | var initialURL = (0, _metal.get)(this, 'initialURL');
|
22417 |
|
22418 | if (this.setupRouter()) {
|
22419 | if (initialURL === undefined) {
|
22420 | initialURL = (0, _metal.get)(this, 'location').getURL();
|
22421 | }
|
22422 |
|
22423 | var initialTransition = this.handleURL(initialURL);
|
22424 |
|
22425 | if (initialTransition && initialTransition.error) {
|
22426 | throw initialTransition.error;
|
22427 | }
|
22428 | }
|
22429 | }
|
22430 |
|
22431 | setupRouter() {
|
22432 | this._setupLocation();
|
22433 |
|
22434 | var location = (0, _metal.get)(this, 'location');
|
22435 |
|
22436 |
|
22437 | if ((0, _metal.get)(location, 'cancelRouterSetup')) {
|
22438 | return false;
|
22439 | }
|
22440 |
|
22441 | this._initRouterJs();
|
22442 |
|
22443 | location.onUpdateURL(url => {
|
22444 | this.handleURL(url);
|
22445 | });
|
22446 | return true;
|
22447 | }
|
22448 |
|
22449 | _setOutlets() {
|
22450 |
|
22451 |
|
22452 |
|
22453 | if (this.isDestroying || this.isDestroyed) {
|
22454 | return;
|
22455 | }
|
22456 |
|
22457 | var routeInfos = this._routerMicrolib.currentRouteInfos;
|
22458 |
|
22459 | if (!routeInfos) {
|
22460 | return;
|
22461 | }
|
22462 |
|
22463 | var defaultParentState;
|
22464 | var liveRoutes = null;
|
22465 |
|
22466 | for (var i = 0; i < routeInfos.length; i++) {
|
22467 | var route = routeInfos[i].route;
|
22468 |
|
22469 | var connections = _route.ROUTE_CONNECTIONS.get(route);
|
22470 |
|
22471 | var ownState = void 0;
|
22472 |
|
22473 | if (connections.length === 0) {
|
22474 | ownState = representEmptyRoute(liveRoutes, defaultParentState, route);
|
22475 | } else {
|
22476 | for (var j = 0; j < connections.length; j++) {
|
22477 | var appended = appendLiveRoute(liveRoutes, defaultParentState, connections[j]);
|
22478 | liveRoutes = appended.liveRoutes;
|
22479 | var {
|
22480 | name,
|
22481 | outlet
|
22482 | } = appended.ownState.render;
|
22483 |
|
22484 | if (name === route.routeName || outlet === 'main') {
|
22485 | ownState = appended.ownState;
|
22486 | }
|
22487 | }
|
22488 | }
|
22489 |
|
22490 | defaultParentState = ownState;
|
22491 | }
|
22492 |
|
22493 |
|
22494 |
|
22495 |
|
22496 |
|
22497 |
|
22498 | if (!liveRoutes) {
|
22499 | return;
|
22500 | }
|
22501 |
|
22502 | if (!this._toplevelView) {
|
22503 | var owner = (0, _owner.getOwner)(this);
|
22504 | var OutletView = owner.factoryFor('view:-outlet');
|
22505 | this._toplevelView = OutletView.create();
|
22506 |
|
22507 | this._toplevelView.setOutletState(liveRoutes);
|
22508 |
|
22509 | var instance = owner.lookup('-application-instance:main');
|
22510 | instance.didCreateRootView(this._toplevelView);
|
22511 | } else {
|
22512 | this._toplevelView.setOutletState(liveRoutes);
|
22513 | }
|
22514 | }
|
22515 |
|
22516 | handleURL(url) {
|
22517 |
|
22518 |
|
22519 | var _url = url.split(/#(.+)?/)[0];
|
22520 | return this._doURLTransition('handleURL', _url);
|
22521 | }
|
22522 |
|
22523 | _doURLTransition(routerJsMethod, url) {
|
22524 | var transition = this._routerMicrolib[routerJsMethod](url || '/');
|
22525 |
|
22526 | didBeginTransition(transition, this);
|
22527 | return transition;
|
22528 | }
|
22529 | |
22530 |
|
22531 |
|
22532 |
|
22533 |
|
22534 |
|
22535 |
|
22536 |
|
22537 |
|
22538 |
|
22539 |
|
22540 |
|
22541 |
|
22542 |
|
22543 |
|
22544 |
|
22545 | transitionTo(...args) {
|
22546 | if ((0, _utils.resemblesURL)(args[0])) {
|
22547 | (true && !(!this.isDestroying && !this.isDestroyed) && (0, _debug.assert)(`A transition was attempted from '${this.currentRouteName}' to '${args[0]}' but the application instance has already been destroyed.`, !this.isDestroying && !this.isDestroyed));
|
22548 | return this._doURLTransition('transitionTo', args[0]);
|
22549 | }
|
22550 |
|
22551 | var {
|
22552 | routeName,
|
22553 | models,
|
22554 | queryParams
|
22555 | } = (0, _utils.extractRouteArgs)(args);
|
22556 | (true && !(!this.isDestroying && !this.isDestroyed) && (0, _debug.assert)(`A transition was attempted from '${this.currentRouteName}' to '${routeName}' but the application instance has already been destroyed.`, !this.isDestroying && !this.isDestroyed));
|
22557 | return this._doTransition(routeName, models, queryParams);
|
22558 | }
|
22559 |
|
22560 | intermediateTransitionTo(name, ...args) {
|
22561 | this._routerMicrolib.intermediateTransitionTo(name, ...args);
|
22562 |
|
22563 | updatePaths(this);
|
22564 |
|
22565 | if (true
|
22566 |
|
22567 | ) {
|
22568 | var infos = this._routerMicrolib.currentRouteInfos;
|
22569 |
|
22570 | if ((0, _metal.get)(this, 'namespace').LOG_TRANSITIONS) {
|
22571 |
|
22572 | console.log(`Intermediate-transitioned into '${EmberRouter._routePath(infos)}'`);
|
22573 | }
|
22574 | }
|
22575 | }
|
22576 |
|
22577 | replaceWith(...args) {
|
22578 | return this.transitionTo(...args).method('replace');
|
22579 | }
|
22580 |
|
22581 | generate(name, ...args) {
|
22582 | var url = this._routerMicrolib.generate(name, ...args);
|
22583 |
|
22584 | return this.location.formatURL(url);
|
22585 | }
|
22586 | |
22587 |
|
22588 |
|
22589 |
|
22590 |
|
22591 |
|
22592 |
|
22593 |
|
22594 |
|
22595 | isActive(routeName) {
|
22596 | return this._routerMicrolib.isActive(routeName);
|
22597 | }
|
22598 | |
22599 |
|
22600 |
|
22601 |
|
22602 |
|
22603 |
|
22604 |
|
22605 |
|
22606 |
|
22607 |
|
22608 |
|
22609 |
|
22610 |
|
22611 |
|
22612 | isActiveIntent(routeName, models, queryParams) {
|
22613 | return this.currentState.isActiveIntent(routeName, models, queryParams);
|
22614 | }
|
22615 |
|
22616 | send(name, ...args) {
|
22617 |
|
22618 | this._routerMicrolib.trigger(name, ...args);
|
22619 | }
|
22620 | |
22621 |
|
22622 |
|
22623 |
|
22624 |
|
22625 |
|
22626 |
|
22627 |
|
22628 | hasRoute(route) {
|
22629 | return this._routerMicrolib.hasRoute(route);
|
22630 | }
|
22631 | |
22632 |
|
22633 |
|
22634 |
|
22635 |
|
22636 |
|
22637 |
|
22638 |
|
22639 | reset() {
|
22640 | if (this._routerMicrolib) {
|
22641 | this._routerMicrolib.reset();
|
22642 | }
|
22643 | }
|
22644 |
|
22645 | willDestroy() {
|
22646 | if (this._toplevelView) {
|
22647 | this._toplevelView.destroy();
|
22648 |
|
22649 | this._toplevelView = null;
|
22650 | }
|
22651 |
|
22652 | this._super(...arguments);
|
22653 |
|
22654 | this.reset();
|
22655 | var instances = this._engineInstances;
|
22656 |
|
22657 | for (var name in instances) {
|
22658 | for (var id in instances[name]) {
|
22659 | (0, _runloop.run)(instances[name][id], 'destroy');
|
22660 | }
|
22661 | }
|
22662 | }
|
22663 | |
22664 |
|
22665 |
|
22666 |
|
22667 |
|
22668 |
|
22669 |
|
22670 | _activeQPChanged(queryParameterName, newValue) {
|
22671 | this._queuedQPChanges[queryParameterName] = newValue;
|
22672 | (0, _runloop.once)(this, this._fireQueryParamTransition);
|
22673 | }
|
22674 |
|
22675 | _updatingQPChanged(queryParameterName) {
|
22676 | this._qpUpdates.add(queryParameterName);
|
22677 | }
|
22678 | |
22679 |
|
22680 |
|
22681 |
|
22682 |
|
22683 |
|
22684 |
|
22685 |
|
22686 |
|
22687 |
|
22688 |
|
22689 |
|
22690 |
|
22691 |
|
22692 |
|
22693 | _fireQueryParamTransition() {
|
22694 | this.transitionTo({
|
22695 | queryParams: this._queuedQPChanges
|
22696 | });
|
22697 |
|
22698 | this._resetQueuedQueryParameterChanges();
|
22699 | }
|
22700 |
|
22701 | _setupLocation() {
|
22702 | var location = this.location;
|
22703 | var rootURL = this.rootURL;
|
22704 | var owner = (0, _owner.getOwner)(this);
|
22705 |
|
22706 | if ('string' === typeof location && owner) {
|
22707 | var resolvedLocation = owner.lookup(`location:${location}`);
|
22708 |
|
22709 | if (resolvedLocation !== undefined) {
|
22710 | location = (0, _metal.set)(this, 'location', resolvedLocation);
|
22711 | } else {
|
22712 |
|
22713 | var options = {
|
22714 | implementation: location
|
22715 | };
|
22716 | location = (0, _metal.set)(this, 'location', _api.default.create(options));
|
22717 | }
|
22718 | }
|
22719 |
|
22720 | if (location !== null && typeof location === 'object') {
|
22721 | if (rootURL) {
|
22722 | (0, _metal.set)(location, 'rootURL', rootURL);
|
22723 | }
|
22724 |
|
22725 |
|
22726 |
|
22727 |
|
22728 | if (typeof location.detect === 'function') {
|
22729 | location.detect();
|
22730 | }
|
22731 |
|
22732 |
|
22733 |
|
22734 | if (typeof location.initState === 'function') {
|
22735 | location.initState();
|
22736 | }
|
22737 | }
|
22738 | }
|
22739 | |
22740 |
|
22741 |
|
22742 |
|
22743 |
|
22744 |
|
22745 |
|
22746 |
|
22747 |
|
22748 |
|
22749 | _serializeQueryParams(routeInfos, queryParams) {
|
22750 | forEachQueryParam(this, routeInfos, queryParams, (key, value, qp) => {
|
22751 | if (qp) {
|
22752 | delete queryParams[key];
|
22753 | queryParams[qp.urlKey] = qp.route.serializeQueryParam(value, qp.urlKey, qp.type);
|
22754 | } else if (value === undefined) {
|
22755 | return;
|
22756 | } else {
|
22757 | queryParams[key] = this._serializeQueryParam(value, (0, _runtime.typeOf)(value));
|
22758 | }
|
22759 | });
|
22760 | }
|
22761 | |
22762 |
|
22763 |
|
22764 |
|
22765 |
|
22766 |
|
22767 |
|
22768 |
|
22769 |
|
22770 | _serializeQueryParam(value, type) {
|
22771 | if (value === null || value === undefined) {
|
22772 | return value;
|
22773 | } else if (type === 'array') {
|
22774 | return JSON.stringify(value);
|
22775 | }
|
22776 |
|
22777 | return `${value}`;
|
22778 | }
|
22779 | |
22780 |
|
22781 |
|
22782 |
|
22783 |
|
22784 |
|
22785 |
|
22786 |
|
22787 |
|
22788 |
|
22789 | _deserializeQueryParams(routeInfos, queryParams) {
|
22790 | forEachQueryParam(this, routeInfos, queryParams, (key, value, qp) => {
|
22791 |
|
22792 |
|
22793 | if (qp) {
|
22794 | delete queryParams[key];
|
22795 | queryParams[qp.prop] = qp.route.deserializeQueryParam(value, qp.urlKey, qp.type);
|
22796 | }
|
22797 | });
|
22798 | }
|
22799 | |
22800 |
|
22801 |
|
22802 |
|
22803 |
|
22804 |
|
22805 |
|
22806 |
|
22807 |
|
22808 | _deserializeQueryParam(value, defaultType) {
|
22809 | if (value === null || value === undefined) {
|
22810 | return value;
|
22811 | } else if (defaultType === 'boolean') {
|
22812 | return value === 'true';
|
22813 | } else if (defaultType === 'number') {
|
22814 | return Number(value).valueOf();
|
22815 | } else if (defaultType === 'array') {
|
22816 | return (0, _runtime.A)(JSON.parse(value));
|
22817 | }
|
22818 |
|
22819 | return value;
|
22820 | }
|
22821 | |
22822 |
|
22823 |
|
22824 |
|
22825 |
|
22826 |
|
22827 |
|
22828 |
|
22829 |
|
22830 |
|
22831 |
|
22832 | _pruneDefaultQueryParamValues(routeInfos, queryParams) {
|
22833 | var qps = this._queryParamsFor(routeInfos);
|
22834 |
|
22835 | for (var key in queryParams) {
|
22836 | var qp = qps.map[key];
|
22837 |
|
22838 | if (qp && qp.serializedDefaultValue === queryParams[key]) {
|
22839 | delete queryParams[key];
|
22840 | }
|
22841 | }
|
22842 | }
|
22843 |
|
22844 | _doTransition(_targetRouteName, models, _queryParams, _keepDefaultQueryParamValues) {
|
22845 | var targetRouteName = _targetRouteName || (0, _utils.getActiveTargetName)(this._routerMicrolib);
|
22846 |
|
22847 | (true && !(Boolean(targetRouteName) && this._routerMicrolib.hasRoute(targetRouteName)) && (0, _debug.assert)(`The route ${targetRouteName} was not found`, Boolean(targetRouteName) && this._routerMicrolib.hasRoute(targetRouteName)));
|
22848 | var queryParams = {};
|
22849 |
|
22850 | this._processActiveTransitionQueryParams(targetRouteName, models, queryParams, _queryParams);
|
22851 |
|
22852 | (0, _polyfills.assign)(queryParams, _queryParams);
|
22853 |
|
22854 | this._prepareQueryParams(targetRouteName, models, queryParams, Boolean(_keepDefaultQueryParamValues));
|
22855 |
|
22856 | var transition = this._routerMicrolib.transitionTo(targetRouteName, ...models, {
|
22857 | queryParams
|
22858 | });
|
22859 |
|
22860 | didBeginTransition(transition, this);
|
22861 | return transition;
|
22862 | }
|
22863 |
|
22864 | _processActiveTransitionQueryParams(targetRouteName, models, queryParams, _queryParams) {
|
22865 |
|
22866 |
|
22867 | if (!this._routerMicrolib.activeTransition) {
|
22868 | return;
|
22869 | }
|
22870 |
|
22871 | var unchangedQPs = {};
|
22872 | var qpUpdates = this._qpUpdates;
|
22873 | var params = this._routerMicrolib.activeTransition[_router_js.QUERY_PARAMS_SYMBOL];
|
22874 |
|
22875 | for (var key in params) {
|
22876 | if (!qpUpdates.has(key)) {
|
22877 | unchangedQPs[key] = params[key];
|
22878 | }
|
22879 | }
|
22880 |
|
22881 |
|
22882 |
|
22883 |
|
22884 | this._fullyScopeQueryParams(targetRouteName, models, _queryParams);
|
22885 |
|
22886 | this._fullyScopeQueryParams(targetRouteName, models, unchangedQPs);
|
22887 |
|
22888 | (0, _polyfills.assign)(queryParams, unchangedQPs);
|
22889 | }
|
22890 | |
22891 |
|
22892 |
|
22893 |
|
22894 |
|
22895 |
|
22896 |
|
22897 |
|
22898 |
|
22899 |
|
22900 |
|
22901 |
|
22902 |
|
22903 | _prepareQueryParams(targetRouteName, models, queryParams, _fromRouterService) {
|
22904 | var state = calculatePostTransitionState(this, targetRouteName, models);
|
22905 |
|
22906 | this._hydrateUnsuppliedQueryParams(state, queryParams, Boolean(_fromRouterService));
|
22907 |
|
22908 | this._serializeQueryParams(state.routeInfos, queryParams);
|
22909 |
|
22910 | if (!_fromRouterService) {
|
22911 | this._pruneDefaultQueryParamValues(state.routeInfos, queryParams);
|
22912 | }
|
22913 | }
|
22914 | |
22915 |
|
22916 |
|
22917 |
|
22918 |
|
22919 |
|
22920 |
|
22921 |
|
22922 |
|
22923 |
|
22924 | _getQPMeta(routeInfo) {
|
22925 | var route = routeInfo.route;
|
22926 | return route && (0, _metal.get)(route, '_qp');
|
22927 | }
|
22928 | |
22929 |
|
22930 |
|
22931 |
|
22932 |
|
22933 |
|
22934 |
|
22935 |
|
22936 |
|
22937 |
|
22938 | _queryParamsFor(routeInfos) {
|
22939 | var routeInfoLength = routeInfos.length;
|
22940 | var leafRouteName = routeInfos[routeInfoLength - 1].name;
|
22941 | var cached = this._qpCache[leafRouteName];
|
22942 |
|
22943 | if (cached !== undefined) {
|
22944 | return cached;
|
22945 | }
|
22946 |
|
22947 | var shouldCache = true;
|
22948 | var map = {};
|
22949 | var qps = [];
|
22950 | var qpsByUrlKey = true
|
22951 |
|
22952 | ? {} : null;
|
22953 | var qpMeta;
|
22954 | var qp;
|
22955 | var urlKey;
|
22956 | var qpOther;
|
22957 |
|
22958 | for (var i = 0; i < routeInfoLength; ++i) {
|
22959 | qpMeta = this._getQPMeta(routeInfos[i]);
|
22960 |
|
22961 | if (!qpMeta) {
|
22962 | shouldCache = false;
|
22963 | continue;
|
22964 | }
|
22965 |
|
22966 |
|
22967 | for (var _i = 0; _i < qpMeta.qps.length; _i++) {
|
22968 | qp = qpMeta.qps[_i];
|
22969 |
|
22970 | if (true
|
22971 |
|
22972 | ) {
|
22973 | urlKey = qp.urlKey;
|
22974 | qpOther = qpsByUrlKey[urlKey];
|
22975 |
|
22976 | if (qpOther && qpOther.controllerName !== qp.controllerName) {
|
22977 | (true && !(false) && (0, _debug.assert)(`You're not allowed to have more than one controller property map to the same query param key, but both \`${qpOther.scopedPropertyName}\` and \`${qp.scopedPropertyName}\` map to \`${urlKey}\`. You can fix this by mapping one of the controller properties to a different query param key via the \`as\` config option, e.g. \`${qpOther.prop}: { as: 'other-${qpOther.prop}' }\``, false));
|
22978 | }
|
22979 |
|
22980 | qpsByUrlKey[urlKey] = qp;
|
22981 | }
|
22982 |
|
22983 | qps.push(qp);
|
22984 | }
|
22985 |
|
22986 | (0, _polyfills.assign)(map, qpMeta.map);
|
22987 | }
|
22988 |
|
22989 | var finalQPMeta = {
|
22990 | qps,
|
22991 | map
|
22992 | };
|
22993 |
|
22994 | if (shouldCache) {
|
22995 | this._qpCache[leafRouteName] = finalQPMeta;
|
22996 | }
|
22997 |
|
22998 | return finalQPMeta;
|
22999 | }
|
23000 | |
23001 |
|
23002 |
|
23003 |
|
23004 |
|
23005 |
|
23006 |
|
23007 |
|
23008 |
|
23009 |
|
23010 |
|
23011 |
|
23012 | _fullyScopeQueryParams(leafRouteName, contexts, queryParams) {
|
23013 | var state = calculatePostTransitionState(this, leafRouteName, contexts);
|
23014 | var routeInfos = state.routeInfos;
|
23015 | var qpMeta;
|
23016 |
|
23017 | for (var i = 0, len = routeInfos.length; i < len; ++i) {
|
23018 | qpMeta = this._getQPMeta(routeInfos[i]);
|
23019 |
|
23020 | if (!qpMeta) {
|
23021 | continue;
|
23022 | }
|
23023 |
|
23024 | var qp = void 0;
|
23025 | var presentProp = void 0;
|
23026 |
|
23027 | for (var j = 0, qpLen = qpMeta.qps.length; j < qpLen; ++j) {
|
23028 | qp = qpMeta.qps[j];
|
23029 | presentProp = qp.prop in queryParams && qp.prop || qp.scopedPropertyName in queryParams && qp.scopedPropertyName || qp.urlKey in queryParams && qp.urlKey;
|
23030 |
|
23031 | if (presentProp) {
|
23032 | if (presentProp !== qp.scopedPropertyName) {
|
23033 | queryParams[qp.scopedPropertyName] = queryParams[presentProp];
|
23034 | delete queryParams[presentProp];
|
23035 | }
|
23036 | }
|
23037 | }
|
23038 | }
|
23039 | }
|
23040 | |
23041 |
|
23042 |
|
23043 |
|
23044 |
|
23045 |
|
23046 |
|
23047 |
|
23048 |
|
23049 |
|
23050 |
|
23051 |
|
23052 | _hydrateUnsuppliedQueryParams(state, queryParams, _fromRouterService) {
|
23053 | var routeInfos = state.routeInfos;
|
23054 | var appCache = this._bucketCache;
|
23055 | var qpMeta;
|
23056 | var qp;
|
23057 | var presentProp;
|
23058 |
|
23059 | for (var i = 0; i < routeInfos.length; ++i) {
|
23060 | qpMeta = this._getQPMeta(routeInfos[i]);
|
23061 |
|
23062 | if (!qpMeta) {
|
23063 | continue;
|
23064 | }
|
23065 |
|
23066 | for (var j = 0, qpLen = qpMeta.qps.length; j < qpLen; ++j) {
|
23067 | qp = qpMeta.qps[j];
|
23068 | presentProp = qp.prop in queryParams && qp.prop || qp.scopedPropertyName in queryParams && qp.scopedPropertyName || qp.urlKey in queryParams && qp.urlKey;
|
23069 | (true && !(function () {
|
23070 | if (qp.urlKey === presentProp || qp.scopedPropertyName === presentProp) {
|
23071 | return true;
|
23072 | }
|
23073 |
|
23074 | if (_fromRouterService && presentProp !== false && qp.urlKey !== qp.prop) {
|
23075 |
|
23076 |
|
23077 |
|
23078 | return false;
|
23079 | }
|
23080 |
|
23081 | return true;
|
23082 | }()) && (0, _debug.assert)(`You passed the \`${presentProp}\` query parameter during a transition into ${qp.route.routeName}, please update to ${qp.urlKey}`, function () {
|
23083 | if (qp.urlKey === presentProp || qp.scopedPropertyName === presentProp) {
|
23084 | return true;
|
23085 | }
|
23086 |
|
23087 | if (_fromRouterService && presentProp !== false && qp.urlKey !== qp.prop) {
|
23088 | return false;
|
23089 | }
|
23090 |
|
23091 | return true;
|
23092 | }()));
|
23093 |
|
23094 | if (presentProp) {
|
23095 | if (presentProp !== qp.scopedPropertyName) {
|
23096 | queryParams[qp.scopedPropertyName] = queryParams[presentProp];
|
23097 | delete queryParams[presentProp];
|
23098 | }
|
23099 | } else {
|
23100 | var cacheKey = (0, _utils.calculateCacheKey)(qp.route.fullRouteName, qp.parts, state.params);
|
23101 | queryParams[qp.scopedPropertyName] = appCache.lookup(cacheKey, qp.prop, qp.defaultValue);
|
23102 | }
|
23103 | }
|
23104 | }
|
23105 | }
|
23106 |
|
23107 | _scheduleLoadingEvent(transition, originRoute) {
|
23108 | this._cancelSlowTransitionTimer();
|
23109 |
|
23110 | this._slowTransitionTimer = (0, _runloop.scheduleOnce)('routerTransitions', this, '_handleSlowTransition', transition, originRoute);
|
23111 | }
|
23112 |
|
23113 | _handleSlowTransition(transition, originRoute) {
|
23114 | if (!this._routerMicrolib.activeTransition) {
|
23115 |
|
23116 |
|
23117 | return;
|
23118 | }
|
23119 |
|
23120 | var targetState = new _router_state.default(this, this._routerMicrolib, this._routerMicrolib.activeTransition[_router_js.STATE_SYMBOL]);
|
23121 | this.set('targetState', targetState);
|
23122 | transition.trigger(true, 'loading', transition, originRoute);
|
23123 | }
|
23124 |
|
23125 | _cancelSlowTransitionTimer() {
|
23126 | if (this._slowTransitionTimer) {
|
23127 | (0, _runloop.cancel)(this._slowTransitionTimer);
|
23128 | }
|
23129 |
|
23130 | this._slowTransitionTimer = null;
|
23131 | }
|
23132 |
|
23133 |
|
23134 |
|
23135 | _markErrorAsHandled(error) {
|
23136 | this._handledErrors.add(error);
|
23137 | }
|
23138 |
|
23139 | _isErrorHandled(error) {
|
23140 | return this._handledErrors.has(error);
|
23141 | }
|
23142 |
|
23143 | _clearHandledError(error) {
|
23144 | this._handledErrors.delete(error);
|
23145 | }
|
23146 |
|
23147 | _getEngineInstance({
|
23148 | name,
|
23149 | instanceId,
|
23150 | mountPoint
|
23151 | }) {
|
23152 | var engineInstances = this._engineInstances;
|
23153 |
|
23154 | if (!engineInstances[name]) {
|
23155 | engineInstances[name] = Object.create(null);
|
23156 | }
|
23157 |
|
23158 | var engineInstance = engineInstances[name][instanceId];
|
23159 |
|
23160 | if (!engineInstance) {
|
23161 | var owner = (0, _owner.getOwner)(this);
|
23162 | (true && !(owner.hasRegistration(`engine:${name}`)) && (0, _debug.assert)(`You attempted to mount the engine '${name}' in your router map, but the engine can not be found.`, owner.hasRegistration(`engine:${name}`)));
|
23163 | engineInstance = owner.buildChildEngineInstance(name, {
|
23164 | routable: true,
|
23165 | mountPoint
|
23166 | });
|
23167 | engineInstance.boot();
|
23168 | engineInstances[name][instanceId] = engineInstance;
|
23169 | }
|
23170 |
|
23171 | return engineInstance;
|
23172 | }
|
23173 |
|
23174 | }
|
23175 | |
23176 |
|
23177 |
|
23178 |
|
23179 |
|
23180 |
|
23181 |
|
23182 |
|
23183 |
|
23184 |
|
23185 |
|
23186 |
|
23187 |
|
23188 |
|
23189 |
|
23190 |
|
23191 |
|
23192 | function forEachRouteAbove(routeInfos, callback) {
|
23193 | for (var i = routeInfos.length - 1; i >= 0; --i) {
|
23194 | var routeInfo = routeInfos[i];
|
23195 | var route = routeInfo.route;
|
23196 |
|
23197 |
|
23198 |
|
23199 |
|
23200 |
|
23201 |
|
23202 |
|
23203 | if (route === undefined) {
|
23204 | continue;
|
23205 | }
|
23206 |
|
23207 | if (callback(route, routeInfo) !== true) {
|
23208 | return;
|
23209 | }
|
23210 | }
|
23211 | }
|
23212 |
|
23213 |
|
23214 |
|
23215 | var defaultActionHandlers = {
|
23216 | willResolveModel(_routeInfos, transition, originRoute) {
|
23217 | this._scheduleLoadingEvent(transition, originRoute);
|
23218 | },
|
23219 |
|
23220 |
|
23221 | error(routeInfos, error, transition) {
|
23222 | var router = this;
|
23223 | var routeInfoWithError = routeInfos[routeInfos.length - 1];
|
23224 | forEachRouteAbove(routeInfos, (route, routeInfo) => {
|
23225 |
|
23226 |
|
23227 | if (routeInfo !== routeInfoWithError) {
|
23228 |
|
23229 | var errorRouteName = findRouteStateName(route, 'error');
|
23230 |
|
23231 | if (errorRouteName) {
|
23232 | router._markErrorAsHandled(error);
|
23233 |
|
23234 | router.intermediateTransitionTo(errorRouteName, error);
|
23235 | return false;
|
23236 | }
|
23237 | }
|
23238 |
|
23239 |
|
23240 | var errorSubstateName = findRouteSubstateName(route, 'error');
|
23241 |
|
23242 | if (errorSubstateName) {
|
23243 | router._markErrorAsHandled(error);
|
23244 |
|
23245 | router.intermediateTransitionTo(errorSubstateName, error);
|
23246 | return false;
|
23247 | }
|
23248 |
|
23249 | return true;
|
23250 | });
|
23251 | logError(error, `Error while processing route: ${transition.targetName}`);
|
23252 | },
|
23253 |
|
23254 |
|
23255 | loading(routeInfos, transition) {
|
23256 | var router = this;
|
23257 | var routeInfoWithSlowLoading = routeInfos[routeInfos.length - 1];
|
23258 | forEachRouteAbove(routeInfos, (route, routeInfo) => {
|
23259 |
|
23260 |
|
23261 | if (routeInfo !== routeInfoWithSlowLoading) {
|
23262 |
|
23263 | var loadingRouteName = findRouteStateName(route, 'loading');
|
23264 |
|
23265 | if (loadingRouteName) {
|
23266 | router.intermediateTransitionTo(loadingRouteName);
|
23267 | return false;
|
23268 | }
|
23269 | }
|
23270 |
|
23271 |
|
23272 | var loadingSubstateName = findRouteSubstateName(route, 'loading');
|
23273 |
|
23274 | if (loadingSubstateName) {
|
23275 | router.intermediateTransitionTo(loadingSubstateName);
|
23276 | return false;
|
23277 | }
|
23278 |
|
23279 |
|
23280 | return transition.pivotHandler !== route;
|
23281 | });
|
23282 | }
|
23283 |
|
23284 | };
|
23285 |
|
23286 | function logError(_error, initialMessage) {
|
23287 | var errorArgs = [];
|
23288 | var error;
|
23289 |
|
23290 | if (_error && typeof _error === 'object' && typeof _error.errorThrown === 'object') {
|
23291 | error = _error.errorThrown;
|
23292 | } else {
|
23293 | error = _error;
|
23294 | }
|
23295 |
|
23296 | if (initialMessage) {
|
23297 | errorArgs.push(initialMessage);
|
23298 | }
|
23299 |
|
23300 | if (error) {
|
23301 | if (error.message) {
|
23302 | errorArgs.push(error.message);
|
23303 | }
|
23304 |
|
23305 | if (error.stack) {
|
23306 | errorArgs.push(error.stack);
|
23307 | }
|
23308 |
|
23309 | if (typeof error === 'string') {
|
23310 | errorArgs.push(error);
|
23311 | }
|
23312 | }
|
23313 |
|
23314 | console.error(...errorArgs);
|
23315 | }
|
23316 | |
23317 |
|
23318 |
|
23319 |
|
23320 |
|
23321 |
|
23322 |
|
23323 |
|
23324 |
|
23325 |
|
23326 |
|
23327 | function findRouteSubstateName(route, state) {
|
23328 | var owner = (0, _owner.getOwner)(route);
|
23329 | var {
|
23330 | routeName,
|
23331 | fullRouteName,
|
23332 | _router: router
|
23333 | } = route;
|
23334 | var substateName = `${routeName}_${state}`;
|
23335 | var substateNameFull = `${fullRouteName}_${state}`;
|
23336 | return routeHasBeenDefined(owner, router, substateName, substateNameFull) ? substateNameFull : '';
|
23337 | }
|
23338 | |
23339 |
|
23340 |
|
23341 |
|
23342 |
|
23343 |
|
23344 |
|
23345 |
|
23346 |
|
23347 |
|
23348 |
|
23349 |
|
23350 | function findRouteStateName(route, state) {
|
23351 | var owner = (0, _owner.getOwner)(route);
|
23352 | var {
|
23353 | routeName,
|
23354 | fullRouteName,
|
23355 | _router: router
|
23356 | } = route;
|
23357 | var stateName = routeName === 'application' ? state : `${routeName}.${state}`;
|
23358 | var stateNameFull = fullRouteName === 'application' ? state : `${fullRouteName}.${state}`;
|
23359 | return routeHasBeenDefined(owner, router, stateName, stateNameFull) ? stateNameFull : '';
|
23360 | }
|
23361 | |
23362 |
|
23363 |
|
23364 |
|
23365 |
|
23366 |
|
23367 |
|
23368 |
|
23369 |
|
23370 |
|
23371 |
|
23372 |
|
23373 |
|
23374 | function routeHasBeenDefined(owner, router, localName, fullName) {
|
23375 | var routerHasRoute = router.hasRoute(fullName);
|
23376 | var ownerHasRoute = owner.hasRegistration(`template:${localName}`) || owner.hasRegistration(`route:${localName}`);
|
23377 | return routerHasRoute && ownerHasRoute;
|
23378 | }
|
23379 |
|
23380 | function triggerEvent(routeInfos, ignoreFailure, name, args) {
|
23381 | if (!routeInfos) {
|
23382 | if (ignoreFailure) {
|
23383 | return;
|
23384 | }
|
23385 |
|
23386 | throw new _error2.default(`Can't trigger action '${name}' because your app hasn't finished transitioning into its first route. To trigger an action on destination routes during a transition, you can call \`.send()\` on the \`Transition\` object passed to the \`model/beforeModel/afterModel\` hooks.`);
|
23387 | }
|
23388 |
|
23389 | var eventWasHandled = false;
|
23390 | var routeInfo, handler, actionHandler;
|
23391 |
|
23392 | for (var i = routeInfos.length - 1; i >= 0; i--) {
|
23393 | routeInfo = routeInfos[i];
|
23394 | handler = routeInfo.route;
|
23395 | actionHandler = handler && handler.actions && handler.actions[name];
|
23396 |
|
23397 | if (actionHandler) {
|
23398 | if (actionHandler.apply(handler, args) === true) {
|
23399 | eventWasHandled = true;
|
23400 | } else {
|
23401 |
|
23402 | if (name === 'error') {
|
23403 | handler._router._markErrorAsHandled(args[0]);
|
23404 | }
|
23405 |
|
23406 | return;
|
23407 | }
|
23408 | }
|
23409 | }
|
23410 |
|
23411 | var defaultHandler = defaultActionHandlers[name];
|
23412 |
|
23413 | if (defaultHandler) {
|
23414 | defaultHandler.apply(this, [routeInfos, ...args]);
|
23415 | return;
|
23416 | }
|
23417 |
|
23418 | if (!eventWasHandled && !ignoreFailure) {
|
23419 | throw new _error2.default(`Nothing handled the action '${name}'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.`);
|
23420 | }
|
23421 | }
|
23422 |
|
23423 | function calculatePostTransitionState(emberRouter, leafRouteName, contexts) {
|
23424 | var state = emberRouter._routerMicrolib.applyIntent(leafRouteName, contexts);
|
23425 |
|
23426 | var {
|
23427 | routeInfos,
|
23428 | params
|
23429 | } = state;
|
23430 |
|
23431 | for (var i = 0; i < routeInfos.length; ++i) {
|
23432 | var routeInfo = routeInfos[i];
|
23433 |
|
23434 | if (!routeInfo.isResolved) {
|
23435 | params[routeInfo.name] = routeInfo.serialize(routeInfo.context);
|
23436 | } else {
|
23437 | params[routeInfo.name] = routeInfo.params;
|
23438 | }
|
23439 | }
|
23440 |
|
23441 | return state;
|
23442 | }
|
23443 |
|
23444 | function updatePaths(router) {
|
23445 | var infos = router._routerMicrolib.currentRouteInfos;
|
23446 |
|
23447 | if (infos.length === 0) {
|
23448 | return;
|
23449 | }
|
23450 |
|
23451 | var path = EmberRouter._routePath(infos);
|
23452 |
|
23453 | var currentRouteName = infos[infos.length - 1].name;
|
23454 | var currentURL = router.get('location').getURL();
|
23455 | (0, _metal.set)(router, 'currentPath', path);
|
23456 | (0, _metal.set)(router, 'currentRouteName', currentRouteName);
|
23457 | (0, _metal.set)(router, 'currentURL', currentURL);
|
23458 | var appController = (0, _owner.getOwner)(router).lookup('controller:application');
|
23459 |
|
23460 | if (!appController) {
|
23461 |
|
23462 |
|
23463 |
|
23464 | return;
|
23465 | }
|
23466 |
|
23467 | if (_deprecatedFeatures.APP_CTRL_ROUTER_PROPS) {
|
23468 | if (!('currentPath' in appController)) {
|
23469 | Object.defineProperty(appController, 'currentPath', {
|
23470 | get() {
|
23471 | (true && !(false) && (0, _debug.deprecate)('Accessing `currentPath` on `controller:application` is deprecated, use the `currentPath` property on `service:router` instead.', false, {
|
23472 | id: 'application-controller.router-properties',
|
23473 | until: '4.0.0',
|
23474 | url: 'https://emberjs.com/deprecations/v3.x#toc_application-controller-router-properties'
|
23475 | }));
|
23476 | return (0, _metal.get)(router, 'currentPath');
|
23477 | }
|
23478 |
|
23479 | });
|
23480 | }
|
23481 |
|
23482 | (0, _metal.notifyPropertyChange)(appController, 'currentPath');
|
23483 |
|
23484 | if (!('currentRouteName' in appController)) {
|
23485 | Object.defineProperty(appController, 'currentRouteName', {
|
23486 | get() {
|
23487 | (true && !(false) && (0, _debug.deprecate)('Accessing `currentRouteName` on `controller:application` is deprecated, use the `currentRouteName` property on `service:router` instead.', false, {
|
23488 | id: 'application-controller.router-properties',
|
23489 | until: '4.0.0',
|
23490 | url: 'https://emberjs.com/deprecations/v3.x#toc_application-controller-router-properties'
|
23491 | }));
|
23492 | return (0, _metal.get)(router, 'currentRouteName');
|
23493 | }
|
23494 |
|
23495 | });
|
23496 | }
|
23497 |
|
23498 | (0, _metal.notifyPropertyChange)(appController, 'currentRouteName');
|
23499 | }
|
23500 | }
|
23501 |
|
23502 | EmberRouter.reopenClass({
|
23503 | |
23504 |
|
23505 |
|
23506 |
|
23507 |
|
23508 |
|
23509 |
|
23510 |
|
23511 |
|
23512 |
|
23513 |
|
23514 |
|
23515 |
|
23516 |
|
23517 |
|
23518 |
|
23519 |
|
23520 |
|
23521 |
|
23522 |
|
23523 |
|
23524 |
|
23525 |
|
23526 |
|
23527 |
|
23528 |
|
23529 |
|
23530 |
|
23531 |
|
23532 |
|
23533 |
|
23534 |
|
23535 | map(callback) {
|
23536 | if (!this.dslCallbacks) {
|
23537 | this.dslCallbacks = [];
|
23538 | this.reopenClass({
|
23539 | dslCallbacks: this.dslCallbacks
|
23540 | });
|
23541 | }
|
23542 |
|
23543 | this.dslCallbacks.push(callback);
|
23544 | return this;
|
23545 | },
|
23546 |
|
23547 | _routePath(routeInfos) {
|
23548 | var path = [];
|
23549 |
|
23550 |
|
23551 |
|
23552 | function intersectionMatches(a1, a2) {
|
23553 | for (var i = 0; i < a1.length; ++i) {
|
23554 | if (a1[i] !== a2[i]) {
|
23555 | return false;
|
23556 | }
|
23557 | }
|
23558 |
|
23559 | return true;
|
23560 | }
|
23561 |
|
23562 | var name, nameParts, oldNameParts;
|
23563 |
|
23564 | for (var i = 1; i < routeInfos.length; i++) {
|
23565 | name = routeInfos[i].name;
|
23566 | nameParts = name.split('.');
|
23567 | oldNameParts = slice.call(path);
|
23568 |
|
23569 | while (oldNameParts.length) {
|
23570 | if (intersectionMatches(oldNameParts, nameParts)) {
|
23571 | break;
|
23572 | }
|
23573 |
|
23574 | oldNameParts.shift();
|
23575 | }
|
23576 |
|
23577 | path.push(...nameParts.slice(oldNameParts.length));
|
23578 | }
|
23579 |
|
23580 | return path.join('.');
|
23581 | }
|
23582 |
|
23583 | });
|
23584 |
|
23585 | function didBeginTransition(transition, router) {
|
23586 | var routerState = new _router_state.default(router, router._routerMicrolib, transition[_router_js.STATE_SYMBOL]);
|
23587 |
|
23588 | if (!router.currentState) {
|
23589 | router.set('currentState', routerState);
|
23590 | }
|
23591 |
|
23592 | router.set('targetState', routerState);
|
23593 | transition.promise = transition.catch(error => {
|
23594 | if (router._isErrorHandled(error)) {
|
23595 | router._clearHandledError(error);
|
23596 | } else {
|
23597 | throw error;
|
23598 | }
|
23599 | }, 'Transition Error');
|
23600 | }
|
23601 |
|
23602 | function forEachQueryParam(router, routeInfos, queryParams, callback) {
|
23603 | var qpCache = router._queryParamsFor(routeInfos);
|
23604 |
|
23605 | for (var key in queryParams) {
|
23606 | if (!Object.prototype.hasOwnProperty.call(queryParams, key)) {
|
23607 | continue;
|
23608 | }
|
23609 |
|
23610 | var value = queryParams[key];
|
23611 | var qp = qpCache.map[key];
|
23612 | callback(key, value, qp);
|
23613 | }
|
23614 | }
|
23615 |
|
23616 | function findLiveRoute(liveRoutes, name) {
|
23617 | if (!liveRoutes) {
|
23618 | return;
|
23619 | }
|
23620 |
|
23621 | var stack = [liveRoutes];
|
23622 |
|
23623 | while (stack.length > 0) {
|
23624 | var test = stack.shift();
|
23625 |
|
23626 | if (test.render.name === name) {
|
23627 | return test;
|
23628 | }
|
23629 |
|
23630 | var outlets = test.outlets;
|
23631 |
|
23632 | for (var outletName in outlets) {
|
23633 | stack.push(outlets[outletName]);
|
23634 | }
|
23635 | }
|
23636 |
|
23637 | return;
|
23638 | }
|
23639 |
|
23640 | function appendLiveRoute(liveRoutes, defaultParentState, renderOptions) {
|
23641 | var ownState = {
|
23642 | render: renderOptions,
|
23643 | outlets: Object.create(null),
|
23644 | wasUsed: false
|
23645 | };
|
23646 | var target;
|
23647 |
|
23648 | if (renderOptions.into) {
|
23649 | target = findLiveRoute(liveRoutes, renderOptions.into);
|
23650 | } else {
|
23651 | target = defaultParentState;
|
23652 | }
|
23653 |
|
23654 | if (target) {
|
23655 | (0, _metal.set)(target.outlets, renderOptions.outlet, ownState);
|
23656 | } else {
|
23657 | liveRoutes = ownState;
|
23658 | }
|
23659 |
|
23660 | return {
|
23661 | liveRoutes,
|
23662 | ownState
|
23663 | };
|
23664 | }
|
23665 |
|
23666 | function representEmptyRoute(liveRoutes, defaultParentState, {
|
23667 | routeName
|
23668 | }) {
|
23669 |
|
23670 | var alreadyAppended = findLiveRoute(liveRoutes, routeName);
|
23671 |
|
23672 | if (alreadyAppended) {
|
23673 |
|
23674 |
|
23675 |
|
23676 | return alreadyAppended;
|
23677 | } else {
|
23678 |
|
23679 |
|
23680 |
|
23681 | defaultParentState.outlets.main = {
|
23682 | render: {
|
23683 | name: routeName,
|
23684 | outlet: 'main'
|
23685 | },
|
23686 | outlets: {}
|
23687 | };
|
23688 | return defaultParentState;
|
23689 | }
|
23690 | }
|
23691 |
|
23692 | EmberRouter.reopen(_runtime.Evented, {
|
23693 | |
23694 |
|
23695 |
|
23696 |
|
23697 |
|
23698 |
|
23699 |
|
23700 |
|
23701 |
|
23702 |
|
23703 |
|
23704 |
|
23705 |
|
23706 |
|
23707 |
|
23708 |
|
23709 |
|
23710 |
|
23711 |
|
23712 |
|
23713 |
|
23714 |
|
23715 |
|
23716 |
|
23717 |
|
23718 |
|
23719 | didTransition: defaultDidTransition,
|
23720 |
|
23721 | |
23722 |
|
23723 |
|
23724 |
|
23725 |
|
23726 |
|
23727 |
|
23728 |
|
23729 | willTransition: defaultWillTransition,
|
23730 |
|
23731 | |
23732 |
|
23733 |
|
23734 |
|
23735 |
|
23736 |
|
23737 |
|
23738 | rootURL: '/',
|
23739 |
|
23740 | |
23741 |
|
23742 |
|
23743 |
|
23744 |
|
23745 |
|
23746 |
|
23747 |
|
23748 |
|
23749 |
|
23750 |
|
23751 |
|
23752 |
|
23753 |
|
23754 | location: 'hash',
|
23755 |
|
23756 | |
23757 |
|
23758 |
|
23759 |
|
23760 |
|
23761 |
|
23762 | url: (0, _metal.computed)(function () {
|
23763 | var location = (0, _metal.get)(this, 'location');
|
23764 |
|
23765 | if (typeof location === 'string') {
|
23766 | return undefined;
|
23767 | }
|
23768 |
|
23769 | return location.getURL();
|
23770 | })
|
23771 | });
|
23772 |
|
23773 | if (_deprecatedFeatures.ROUTER_EVENTS) {
|
23774 | EmberRouter.reopen(_route.ROUTER_EVENT_DEPRECATIONS);
|
23775 | }
|
23776 |
|
23777 | var _default = EmberRouter;
|
23778 | _exports.default = _default;
|
23779 | });
|
23780 | define("@ember/-internals/routing/lib/system/router_state", ["exports", "@ember/polyfills", "@ember/-internals/routing/lib/utils"], function (_exports, _polyfills, _utils) {
|
23781 | "use strict";
|
23782 |
|
23783 | Object.defineProperty(_exports, "__esModule", {
|
23784 | value: true
|
23785 | });
|
23786 | _exports.default = void 0;
|
23787 |
|
23788 | class RouterState {
|
23789 | constructor(emberRouter, router, routerJsState) {
|
23790 | this.emberRouter = emberRouter;
|
23791 | this.router = router;
|
23792 | this.routerJsState = routerJsState;
|
23793 | }
|
23794 |
|
23795 | isActiveIntent(routeName, models, queryParams, queryParamsMustMatch) {
|
23796 | var state = this.routerJsState;
|
23797 |
|
23798 | if (!this.router.isActiveIntent(routeName, models, undefined, state)) {
|
23799 | return false;
|
23800 | }
|
23801 |
|
23802 | if (queryParamsMustMatch && Object.keys(queryParams).length > 0) {
|
23803 | var visibleQueryParams = (0, _polyfills.assign)({}, queryParams);
|
23804 |
|
23805 | this.emberRouter._prepareQueryParams(routeName, models, visibleQueryParams);
|
23806 |
|
23807 | return (0, _utils.shallowEqual)(visibleQueryParams, state.queryParams);
|
23808 | }
|
23809 |
|
23810 | return true;
|
23811 | }
|
23812 |
|
23813 | }
|
23814 |
|
23815 | _exports.default = RouterState;
|
23816 | });
|
23817 | define("@ember/-internals/routing/lib/system/transition", [], function () {
|
23818 | "use strict";
|
23819 | |
23820 |
|
23821 |
|
23822 |
|
23823 |
|
23824 |
|
23825 |
|
23826 |
|
23827 |
|
23828 |
|
23829 |
|
23830 | |
23831 |
|
23832 |
|
23833 |
|
23834 |
|
23835 |
|
23836 |
|
23837 |
|
23838 |
|
23839 |
|
23840 |
|
23841 |
|
23842 |
|
23843 | |
23844 |
|
23845 |
|
23846 |
|
23847 |
|
23848 |
|
23849 |
|
23850 |
|
23851 |
|
23852 |
|
23853 |
|
23854 |
|
23855 | |
23856 |
|
23857 |
|
23858 |
|
23859 |
|
23860 |
|
23861 |
|
23862 |
|
23863 |
|
23864 |
|
23865 |
|
23866 |
|
23867 |
|
23868 |
|
23869 |
|
23870 |
|
23871 |
|
23872 | |
23873 |
|
23874 |
|
23875 |
|
23876 |
|
23877 |
|
23878 |
|
23879 |
|
23880 |
|
23881 |
|
23882 |
|
23883 |
|
23884 |
|
23885 |
|
23886 | |
23887 |
|
23888 |
|
23889 |
|
23890 |
|
23891 |
|
23892 |
|
23893 |
|
23894 |
|
23895 |
|
23896 |
|
23897 |
|
23898 |
|
23899 |
|
23900 | |
23901 |
|
23902 |
|
23903 |
|
23904 |
|
23905 |
|
23906 |
|
23907 |
|
23908 |
|
23909 | |
23910 |
|
23911 |
|
23912 |
|
23913 |
|
23914 |
|
23915 |
|
23916 |
|
23917 |
|
23918 |
|
23919 |
|
23920 | |
23921 |
|
23922 |
|
23923 |
|
23924 |
|
23925 |
|
23926 |
|
23927 |
|
23928 |
|
23929 |
|
23930 |
|
23931 |
|
23932 |
|
23933 |
|
23934 |
|
23935 |
|
23936 |
|
23937 |
|
23938 |
|
23939 |
|
23940 |
|
23941 | |
23942 |
|
23943 |
|
23944 |
|
23945 |
|
23946 |
|
23947 |
|
23948 |
|
23949 |
|
23950 |
|
23951 |
|
23952 |
|
23953 |
|
23954 |
|
23955 | |
23956 |
|
23957 |
|
23958 |
|
23959 |
|
23960 |
|
23961 |
|
23962 |
|
23963 |
|
23964 | |
23965 |
|
23966 |
|
23967 |
|
23968 |
|
23969 |
|
23970 |
|
23971 |
|
23972 |
|
23973 |
|
23974 |
|
23975 | |
23976 |
|
23977 |
|
23978 |
|
23979 |
|
23980 |
|
23981 |
|
23982 |
|
23983 |
|
23984 |
|
23985 |
|
23986 |
|
23987 | });
|
23988 | define("@ember/-internals/routing/lib/utils", ["exports", "@ember/-internals/metal", "@ember/-internals/owner", "@ember/error", "@ember/polyfills", "router_js"], function (_exports, _metal, _owner, _error, _polyfills, _router_js) {
|
23989 | "use strict";
|
23990 |
|
23991 | Object.defineProperty(_exports, "__esModule", {
|
23992 | value: true
|
23993 | });
|
23994 | _exports.extractRouteArgs = extractRouteArgs;
|
23995 | _exports.getActiveTargetName = getActiveTargetName;
|
23996 | _exports.stashParamNames = stashParamNames;
|
23997 | _exports.calculateCacheKey = calculateCacheKey;
|
23998 | _exports.normalizeControllerQueryParams = normalizeControllerQueryParams;
|
23999 | _exports.resemblesURL = resemblesURL;
|
24000 | _exports.prefixRouteNameArg = prefixRouteNameArg;
|
24001 | _exports.shallowEqual = shallowEqual;
|
24002 | var ALL_PERIODS_REGEX = /\./g;
|
24003 |
|
24004 | function extractRouteArgs(args) {
|
24005 | args = args.slice();
|
24006 | var possibleQueryParams = args[args.length - 1];
|
24007 | var queryParams;
|
24008 |
|
24009 | if (possibleQueryParams && Object.prototype.hasOwnProperty.call(possibleQueryParams, 'queryParams')) {
|
24010 |
|
24011 |
|
24012 |
|
24013 |
|
24014 | queryParams = args.pop().queryParams;
|
24015 | } else {
|
24016 | queryParams = {};
|
24017 | }
|
24018 |
|
24019 |
|
24020 |
|
24021 |
|
24022 | var routeName = args.shift();
|
24023 | var models = args;
|
24024 | return {
|
24025 | routeName,
|
24026 | models,
|
24027 | queryParams
|
24028 | };
|
24029 | }
|
24030 |
|
24031 | function getActiveTargetName(router) {
|
24032 | var routeInfos = router.activeTransition ? router.activeTransition[_router_js.STATE_SYMBOL].routeInfos : router.state.routeInfos;
|
24033 | return routeInfos[routeInfos.length - 1].name;
|
24034 | }
|
24035 |
|
24036 | function stashParamNames(router, routeInfos) {
|
24037 | if (routeInfos['_namesStashed']) {
|
24038 | return;
|
24039 | }
|
24040 |
|
24041 |
|
24042 |
|
24043 |
|
24044 |
|
24045 | var targetRouteName = routeInfos[routeInfos.length - 1].name;
|
24046 |
|
24047 | var recogHandlers = router._routerMicrolib.recognizer.handlersFor(targetRouteName);
|
24048 |
|
24049 | var dynamicParent;
|
24050 |
|
24051 | for (var i = 0; i < routeInfos.length; ++i) {
|
24052 | var routeInfo = routeInfos[i];
|
24053 | var names = recogHandlers[i].names;
|
24054 |
|
24055 | if (names.length) {
|
24056 | dynamicParent = routeInfo;
|
24057 | }
|
24058 |
|
24059 | routeInfo['_names'] = names;
|
24060 | var route = routeInfo.route;
|
24061 |
|
24062 | route._stashNames(routeInfo, dynamicParent);
|
24063 | }
|
24064 |
|
24065 | routeInfos['_namesStashed'] = true;
|
24066 | }
|
24067 |
|
24068 | function _calculateCacheValuePrefix(prefix, part) {
|
24069 |
|
24070 |
|
24071 |
|
24072 |
|
24073 |
|
24074 |
|
24075 | var prefixParts = prefix.split('.');
|
24076 | var currPrefix = '';
|
24077 |
|
24078 | for (var i = 0; i < prefixParts.length; i++) {
|
24079 | var currPart = prefixParts.slice(0, i + 1).join('.');
|
24080 |
|
24081 | if (part.indexOf(currPart) !== 0) {
|
24082 | break;
|
24083 | }
|
24084 |
|
24085 | currPrefix = currPart;
|
24086 | }
|
24087 |
|
24088 | return currPrefix;
|
24089 | }
|
24090 | |
24091 |
|
24092 |
|
24093 |
|
24094 |
|
24095 | function calculateCacheKey(prefix, parts = [], values) {
|
24096 | var suffixes = '';
|
24097 |
|
24098 | for (var i = 0; i < parts.length; ++i) {
|
24099 | var part = parts[i];
|
24100 |
|
24101 | var cacheValuePrefix = _calculateCacheValuePrefix(prefix, part);
|
24102 |
|
24103 | var value = void 0;
|
24104 |
|
24105 | if (values) {
|
24106 | if (cacheValuePrefix && cacheValuePrefix in values) {
|
24107 | var partRemovedPrefix = part.indexOf(cacheValuePrefix) === 0 ? part.substr(cacheValuePrefix.length + 1) : part;
|
24108 | value = (0, _metal.get)(values[cacheValuePrefix], partRemovedPrefix);
|
24109 | } else {
|
24110 | value = (0, _metal.get)(values, part);
|
24111 | }
|
24112 | }
|
24113 |
|
24114 | suffixes += `::${part}:${value}`;
|
24115 | }
|
24116 |
|
24117 | return prefix + suffixes.replace(ALL_PERIODS_REGEX, '-');
|
24118 | }
|
24119 | |
24120 |
|
24121 |
|
24122 |
|
24123 |
|
24124 |
|
24125 |
|
24126 |
|
24127 |
|
24128 |
|
24129 |
|
24130 |
|
24131 |
|
24132 |
|
24133 |
|
24134 |
|
24135 |
|
24136 |
|
24137 |
|
24138 |
|
24139 |
|
24140 |
|
24141 |
|
24142 |
|
24143 |
|
24144 |
|
24145 |
|
24146 |
|
24147 |
|
24148 |
|
24149 |
|
24150 |
|
24151 |
|
24152 |
|
24153 | function normalizeControllerQueryParams(queryParams) {
|
24154 | var qpMap = {};
|
24155 |
|
24156 | for (var i = 0; i < queryParams.length; ++i) {
|
24157 | accumulateQueryParamDescriptors(queryParams[i], qpMap);
|
24158 | }
|
24159 |
|
24160 | return qpMap;
|
24161 | }
|
24162 |
|
24163 | function accumulateQueryParamDescriptors(_desc, accum) {
|
24164 | var desc = _desc;
|
24165 | var tmp;
|
24166 |
|
24167 | if (typeof desc === 'string') {
|
24168 | tmp = {};
|
24169 | tmp[desc] = {
|
24170 | as: null
|
24171 | };
|
24172 | desc = tmp;
|
24173 | }
|
24174 |
|
24175 | for (var key in desc) {
|
24176 | if (!Object.prototype.hasOwnProperty.call(desc, key)) {
|
24177 | return;
|
24178 | }
|
24179 |
|
24180 | var singleDesc = desc[key];
|
24181 |
|
24182 | if (typeof singleDesc === 'string') {
|
24183 | singleDesc = {
|
24184 | as: singleDesc
|
24185 | };
|
24186 | }
|
24187 |
|
24188 | tmp = accum[key] || {
|
24189 | as: null,
|
24190 | scope: 'model'
|
24191 | };
|
24192 | (0, _polyfills.assign)(tmp, singleDesc);
|
24193 | accum[key] = tmp;
|
24194 | }
|
24195 | }
|
24196 | |
24197 |
|
24198 |
|
24199 |
|
24200 |
|
24201 |
|
24202 |
|
24203 | function resemblesURL(str) {
|
24204 | return typeof str === 'string' && (str === '' || str[0] === '/');
|
24205 | }
|
24206 | |
24207 |
|
24208 |
|
24209 |
|
24210 |
|
24211 |
|
24212 |
|
24213 | function prefixRouteNameArg(route, args) {
|
24214 | var routeName = args[0];
|
24215 | var owner = (0, _owner.getOwner)(route);
|
24216 | var prefix = owner.mountPoint;
|
24217 |
|
24218 | if (owner.routable && typeof routeName === 'string') {
|
24219 | if (resemblesURL(routeName)) {
|
24220 | throw new _error.default('Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.');
|
24221 | } else {
|
24222 | routeName = `${prefix}.${routeName}`;
|
24223 | args[0] = routeName;
|
24224 | }
|
24225 | }
|
24226 |
|
24227 | return args;
|
24228 | }
|
24229 |
|
24230 | function shallowEqual(a, b) {
|
24231 | var k;
|
24232 | var aCount = 0;
|
24233 | var bCount = 0;
|
24234 |
|
24235 | for (k in a) {
|
24236 | if (Object.prototype.hasOwnProperty.call(a, k)) {
|
24237 | if (a[k] !== b[k]) {
|
24238 | return false;
|
24239 | }
|
24240 |
|
24241 | aCount++;
|
24242 | }
|
24243 | }
|
24244 |
|
24245 | for (k in b) {
|
24246 | if (Object.prototype.hasOwnProperty.call(b, k)) {
|
24247 | bCount++;
|
24248 | }
|
24249 | }
|
24250 |
|
24251 | return aCount === bCount;
|
24252 | }
|
24253 | });
|
24254 | define("@ember/-internals/runtime/index", ["exports", "@ember/-internals/runtime/lib/system/object", "@ember/-internals/runtime/lib/mixins/registry_proxy", "@ember/-internals/runtime/lib/mixins/container_proxy", "@ember/-internals/runtime/lib/copy", "@ember/-internals/runtime/lib/compare", "@ember/-internals/runtime/lib/is-equal", "@ember/-internals/runtime/lib/mixins/array", "@ember/-internals/runtime/lib/mixins/comparable", "@ember/-internals/runtime/lib/system/namespace", "@ember/-internals/runtime/lib/system/array_proxy", "@ember/-internals/runtime/lib/system/object_proxy", "@ember/-internals/runtime/lib/system/core_object", "@ember/-internals/runtime/lib/mixins/action_handler", "@ember/-internals/runtime/lib/mixins/copyable", "@ember/-internals/runtime/lib/mixins/enumerable", "@ember/-internals/runtime/lib/mixins/-proxy", "@ember/-internals/runtime/lib/mixins/observable", "@ember/-internals/runtime/lib/mixins/mutable_enumerable", "@ember/-internals/runtime/lib/mixins/target_action_support", "@ember/-internals/runtime/lib/mixins/evented", "@ember/-internals/runtime/lib/mixins/promise_proxy", "@ember/-internals/runtime/lib/ext/rsvp", "@ember/-internals/runtime/lib/type-of", "@ember/-internals/runtime/lib/ext/function"], function (_exports, _object, _registry_proxy, _container_proxy, _copy, _compare, _isEqual, _array, _comparable, _namespace, _array_proxy, _object_proxy, _core_object, _action_handler, _copyable, _enumerable, _proxy, _observable, _mutable_enumerable, _target_action_support, _evented, _promise_proxy, _rsvp, _typeOf, _function) {
|
24255 | "use strict";
|
24256 |
|
24257 | Object.defineProperty(_exports, "__esModule", {
|
24258 | value: true
|
24259 | });
|
24260 | Object.defineProperty(_exports, "Object", {
|
24261 | enumerable: true,
|
24262 | get: function () {
|
24263 | return _object.default;
|
24264 | }
|
24265 | });
|
24266 | Object.defineProperty(_exports, "FrameworkObject", {
|
24267 | enumerable: true,
|
24268 | get: function () {
|
24269 | return _object.FrameworkObject;
|
24270 | }
|
24271 | });
|
24272 | Object.defineProperty(_exports, "RegistryProxyMixin", {
|
24273 | enumerable: true,
|
24274 | get: function () {
|
24275 | return _registry_proxy.default;
|
24276 | }
|
24277 | });
|
24278 | Object.defineProperty(_exports, "ContainerProxyMixin", {
|
24279 | enumerable: true,
|
24280 | get: function () {
|
24281 | return _container_proxy.default;
|
24282 | }
|
24283 | });
|
24284 | Object.defineProperty(_exports, "copy", {
|
24285 | enumerable: true,
|
24286 | get: function () {
|
24287 | return _copy.default;
|
24288 | }
|
24289 | });
|
24290 | Object.defineProperty(_exports, "compare", {
|
24291 | enumerable: true,
|
24292 | get: function () {
|
24293 | return _compare.default;
|
24294 | }
|
24295 | });
|
24296 | Object.defineProperty(_exports, "isEqual", {
|
24297 | enumerable: true,
|
24298 | get: function () {
|
24299 | return _isEqual.default;
|
24300 | }
|
24301 | });
|
24302 | Object.defineProperty(_exports, "Array", {
|
24303 | enumerable: true,
|
24304 | get: function () {
|
24305 | return _array.default;
|
24306 | }
|
24307 | });
|
24308 | Object.defineProperty(_exports, "NativeArray", {
|
24309 | enumerable: true,
|
24310 | get: function () {
|
24311 | return _array.NativeArray;
|
24312 | }
|
24313 | });
|
24314 | Object.defineProperty(_exports, "A", {
|
24315 | enumerable: true,
|
24316 | get: function () {
|
24317 | return _array.A;
|
24318 | }
|
24319 | });
|
24320 | Object.defineProperty(_exports, "MutableArray", {
|
24321 | enumerable: true,
|
24322 | get: function () {
|
24323 | return _array.MutableArray;
|
24324 | }
|
24325 | });
|
24326 | Object.defineProperty(_exports, "removeAt", {
|
24327 | enumerable: true,
|
24328 | get: function () {
|
24329 | return _array.removeAt;
|
24330 | }
|
24331 | });
|
24332 | Object.defineProperty(_exports, "uniqBy", {
|
24333 | enumerable: true,
|
24334 | get: function () {
|
24335 | return _array.uniqBy;
|
24336 | }
|
24337 | });
|
24338 | Object.defineProperty(_exports, "isArray", {
|
24339 | enumerable: true,
|
24340 | get: function () {
|
24341 | return _array.isArray;
|
24342 | }
|
24343 | });
|
24344 | Object.defineProperty(_exports, "Comparable", {
|
24345 | enumerable: true,
|
24346 | get: function () {
|
24347 | return _comparable.default;
|
24348 | }
|
24349 | });
|
24350 | Object.defineProperty(_exports, "Namespace", {
|
24351 | enumerable: true,
|
24352 | get: function () {
|
24353 | return _namespace.default;
|
24354 | }
|
24355 | });
|
24356 | Object.defineProperty(_exports, "ArrayProxy", {
|
24357 | enumerable: true,
|
24358 | get: function () {
|
24359 | return _array_proxy.default;
|
24360 | }
|
24361 | });
|
24362 | Object.defineProperty(_exports, "ObjectProxy", {
|
24363 | enumerable: true,
|
24364 | get: function () {
|
24365 | return _object_proxy.default;
|
24366 | }
|
24367 | });
|
24368 | Object.defineProperty(_exports, "CoreObject", {
|
24369 | enumerable: true,
|
24370 | get: function () {
|
24371 | return _core_object.default;
|
24372 | }
|
24373 | });
|
24374 | Object.defineProperty(_exports, "ActionHandler", {
|
24375 | enumerable: true,
|
24376 | get: function () {
|
24377 | return _action_handler.default;
|
24378 | }
|
24379 | });
|
24380 | Object.defineProperty(_exports, "Copyable", {
|
24381 | enumerable: true,
|
24382 | get: function () {
|
24383 | return _copyable.default;
|
24384 | }
|
24385 | });
|
24386 | Object.defineProperty(_exports, "Enumerable", {
|
24387 | enumerable: true,
|
24388 | get: function () {
|
24389 | return _enumerable.default;
|
24390 | }
|
24391 | });
|
24392 | Object.defineProperty(_exports, "_ProxyMixin", {
|
24393 | enumerable: true,
|
24394 | get: function () {
|
24395 | return _proxy.default;
|
24396 | }
|
24397 | });
|
24398 | Object.defineProperty(_exports, "_contentFor", {
|
24399 | enumerable: true,
|
24400 | get: function () {
|
24401 | return _proxy.contentFor;
|
24402 | }
|
24403 | });
|
24404 | Object.defineProperty(_exports, "Observable", {
|
24405 | enumerable: true,
|
24406 | get: function () {
|
24407 | return _observable.default;
|
24408 | }
|
24409 | });
|
24410 | Object.defineProperty(_exports, "MutableEnumerable", {
|
24411 | enumerable: true,
|
24412 | get: function () {
|
24413 | return _mutable_enumerable.default;
|
24414 | }
|
24415 | });
|
24416 | Object.defineProperty(_exports, "TargetActionSupport", {
|
24417 | enumerable: true,
|
24418 | get: function () {
|
24419 | return _target_action_support.default;
|
24420 | }
|
24421 | });
|
24422 | Object.defineProperty(_exports, "Evented", {
|
24423 | enumerable: true,
|
24424 | get: function () {
|
24425 | return _evented.default;
|
24426 | }
|
24427 | });
|
24428 | Object.defineProperty(_exports, "PromiseProxyMixin", {
|
24429 | enumerable: true,
|
24430 | get: function () {
|
24431 | return _promise_proxy.default;
|
24432 | }
|
24433 | });
|
24434 | Object.defineProperty(_exports, "RSVP", {
|
24435 | enumerable: true,
|
24436 | get: function () {
|
24437 | return _rsvp.default;
|
24438 | }
|
24439 | });
|
24440 | Object.defineProperty(_exports, "onerrorDefault", {
|
24441 | enumerable: true,
|
24442 | get: function () {
|
24443 | return _rsvp.onerrorDefault;
|
24444 | }
|
24445 | });
|
24446 | Object.defineProperty(_exports, "typeOf", {
|
24447 | enumerable: true,
|
24448 | get: function () {
|
24449 | return _typeOf.typeOf;
|
24450 | }
|
24451 | });
|
24452 | });
|
24453 | define("@ember/-internals/runtime/lib/compare", ["exports", "@ember/-internals/runtime/lib/type-of", "@ember/-internals/runtime/lib/mixins/comparable"], function (_exports, _typeOf, _comparable) {
|
24454 | "use strict";
|
24455 |
|
24456 | Object.defineProperty(_exports, "__esModule", {
|
24457 | value: true
|
24458 | });
|
24459 | _exports.default = compare;
|
24460 | var TYPE_ORDER = {
|
24461 | undefined: 0,
|
24462 | null: 1,
|
24463 | boolean: 2,
|
24464 | number: 3,
|
24465 | string: 4,
|
24466 | array: 5,
|
24467 | object: 6,
|
24468 | instance: 7,
|
24469 | function: 8,
|
24470 | class: 9,
|
24471 | date: 10
|
24472 | }; //
|
24473 | // the spaceship operator
|
24474 | //
|
24475 | // `. ___
|
24476 | // __,' __`. _..----....____
|
24477 | // __...--.'``;. ,. ;``--..__ .' ,-._ _.-'
|
24478 | // _..-''-------' `' `' `' O ``-''._ (,;') _,'
|
24479 | // ,'________________ \`-._`-','
|
24480 |
|
24481 |
|
24482 |
|
24483 |
|
24484 |
|
24485 |
|
24486 |
|
24487 |
|
24488 |
|
24489 |
|
24490 | function spaceship(a, b) {
|
24491 | var diff = a - b;
|
24492 | return (diff > 0) - (diff < 0);
|
24493 | }
|
24494 | |
24495 |
|
24496 |
|
24497 |
|
24498 | |
24499 |
|
24500 |
|
24501 |
|
24502 |
|
24503 |
|
24504 |
|
24505 |
|
24506 |
|
24507 |
|
24508 |
|
24509 |
|
24510 |
|
24511 |
|
24512 |
|
24513 |
|
24514 |
|
24515 |
|
24516 |
|
24517 |
|
24518 |
|
24519 |
|
24520 |
|
24521 |
|
24522 |
|
24523 |
|
24524 |
|
24525 |
|
24526 |
|
24527 |
|
24528 |
|
24529 |
|
24530 |
|
24531 |
|
24532 |
|
24533 |
|
24534 |
|
24535 |
|
24536 |
|
24537 |
|
24538 |
|
24539 |
|
24540 |
|
24541 |
|
24542 |
|
24543 |
|
24544 |
|
24545 |
|
24546 | function compare(v, w) {
|
24547 | if (v === w) {
|
24548 | return 0;
|
24549 | }
|
24550 |
|
24551 | var type1 = (0, _typeOf.typeOf)(v);
|
24552 | var type2 = (0, _typeOf.typeOf)(w);
|
24553 |
|
24554 | if (type1 === 'instance' && _comparable.default.detect(v) && v.constructor.compare) {
|
24555 | return v.constructor.compare(v, w);
|
24556 | }
|
24557 |
|
24558 | if (type2 === 'instance' && _comparable.default.detect(w) && w.constructor.compare) {
|
24559 | return w.constructor.compare(w, v) * -1;
|
24560 | }
|
24561 |
|
24562 | var res = spaceship(TYPE_ORDER[type1], TYPE_ORDER[type2]);
|
24563 |
|
24564 | if (res !== 0) {
|
24565 | return res;
|
24566 | }
|
24567 |
|
24568 |
|
24569 | switch (type1) {
|
24570 | case 'boolean':
|
24571 | case 'number':
|
24572 | return spaceship(v, w);
|
24573 |
|
24574 | case 'string':
|
24575 | return spaceship(v.localeCompare(w), 0);
|
24576 |
|
24577 | case 'array':
|
24578 | {
|
24579 | var vLen = v.length;
|
24580 | var wLen = w.length;
|
24581 | var len = Math.min(vLen, wLen);
|
24582 |
|
24583 | for (var i = 0; i < len; i++) {
|
24584 | var r = compare(v[i], w[i]);
|
24585 |
|
24586 | if (r !== 0) {
|
24587 | return r;
|
24588 | }
|
24589 | }
|
24590 |
|
24591 |
|
24592 |
|
24593 | return spaceship(vLen, wLen);
|
24594 | }
|
24595 |
|
24596 | case 'instance':
|
24597 | if (_comparable.default.detect(v)) {
|
24598 | return v.compare(v, w);
|
24599 | }
|
24600 |
|
24601 | return 0;
|
24602 |
|
24603 | case 'date':
|
24604 | return spaceship(v.getTime(), w.getTime());
|
24605 |
|
24606 | default:
|
24607 | return 0;
|
24608 | }
|
24609 | }
|
24610 | });
|
24611 | define("@ember/-internals/runtime/lib/copy", ["exports", "@ember/debug", "@ember/-internals/runtime/lib/system/object", "@ember/-internals/runtime/lib/mixins/copyable"], function (_exports, _debug, _object, _copyable) {
|
24612 | "use strict";
|
24613 |
|
24614 | Object.defineProperty(_exports, "__esModule", {
|
24615 | value: true
|
24616 | });
|
24617 | _exports.default = copy;
|
24618 |
|
24619 | |
24620 |
|
24621 |
|
24622 | function _copy(obj, deep, seen, copies) {
|
24623 |
|
24624 | if (typeof obj !== 'object' || obj === null) {
|
24625 | return obj;
|
24626 | }
|
24627 |
|
24628 | var ret, loc;
|
24629 |
|
24630 | if (deep && (loc = seen.indexOf(obj)) >= 0) {
|
24631 | return copies[loc];
|
24632 | }
|
24633 |
|
24634 | if (deep) {
|
24635 | seen.push(obj);
|
24636 | }
|
24637 |
|
24638 |
|
24639 |
|
24640 | if (Array.isArray(obj)) {
|
24641 | ret = obj.slice();
|
24642 |
|
24643 | if (deep) {
|
24644 | copies.push(ret);
|
24645 | loc = ret.length;
|
24646 |
|
24647 | while (--loc >= 0) {
|
24648 | ret[loc] = _copy(ret[loc], deep, seen, copies);
|
24649 | }
|
24650 | }
|
24651 | } else if (_copyable.default.detect(obj)) {
|
24652 | ret = obj.copy(deep, seen, copies);
|
24653 |
|
24654 | if (deep) {
|
24655 | copies.push(ret);
|
24656 | }
|
24657 | } else if (obj instanceof Date) {
|
24658 | ret = new Date(obj.getTime());
|
24659 |
|
24660 | if (deep) {
|
24661 | copies.push(ret);
|
24662 | }
|
24663 | } else {
|
24664 | (true && !(!(obj instanceof _object.default) || _copyable.default.detect(obj)) && (0, _debug.assert)('Cannot clone an EmberObject that does not implement Copyable', !(obj instanceof _object.default) || _copyable.default.detect(obj)));
|
24665 | ret = {};
|
24666 |
|
24667 | if (deep) {
|
24668 | copies.push(ret);
|
24669 | }
|
24670 |
|
24671 | var key;
|
24672 |
|
24673 | for (key in obj) {
|
24674 |
|
24675 | if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
24676 | continue;
|
24677 | }
|
24678 |
|
24679 |
|
24680 |
|
24681 | if (key.substring(0, 2) === '__') {
|
24682 | continue;
|
24683 | }
|
24684 |
|
24685 | ret[key] = deep ? _copy(obj[key], deep, seen, copies) : obj[key];
|
24686 | }
|
24687 | }
|
24688 |
|
24689 | return ret;
|
24690 | }
|
24691 | |
24692 |
|
24693 |
|
24694 |
|
24695 |
|
24696 |
|
24697 |
|
24698 |
|
24699 |
|
24700 |
|
24701 |
|
24702 |
|
24703 |
|
24704 |
|
24705 |
|
24706 |
|
24707 |
|
24708 |
|
24709 |
|
24710 |
|
24711 |
|
24712 |
|
24713 | function copy(obj, deep) {
|
24714 | (true && !(false) && (0, _debug.deprecate)('Use ember-copy addon instead of copy method and Copyable mixin.', false, {
|
24715 | id: 'ember-runtime.deprecate-copy-copyable',
|
24716 | until: '4.0.0',
|
24717 | url: 'https://emberjs.com/deprecations/v3.x/#toc_ember-runtime-deprecate-copy-copyable'
|
24718 | }));
|
24719 |
|
24720 | if ('object' !== typeof obj || obj === null) {
|
24721 | return obj;
|
24722 | }
|
24723 |
|
24724 | if (!Array.isArray(obj) && _copyable.default.detect(obj)) {
|
24725 | return obj.copy(deep);
|
24726 | }
|
24727 |
|
24728 | return _copy(obj, deep, deep ? [] : null, deep ? [] : null);
|
24729 | }
|
24730 | });
|
24731 | define("@ember/-internals/runtime/lib/ext/function", ["@ember/-internals/environment", "@ember/-internals/metal", "@ember/debug", "@ember/deprecated-features"], function (_environment, _metal, _debug, _deprecatedFeatures) {
|
24732 | "use strict";
|
24733 |
|
24734 | |
24735 |
|
24736 |
|
24737 | if (_deprecatedFeatures.FUNCTION_PROTOTYPE_EXTENSIONS && _environment.ENV.EXTEND_PROTOTYPES.Function) {
|
24738 | Object.defineProperties(Function.prototype, {
|
24739 | |
24740 |
|
24741 |
|
24742 |
|
24743 |
|
24744 |
|
24745 |
|
24746 |
|
24747 |
|
24748 |
|
24749 |
|
24750 |
|
24751 |
|
24752 |
|
24753 |
|
24754 |
|
24755 |
|
24756 |
|
24757 |
|
24758 |
|
24759 |
|
24760 |
|
24761 |
|
24762 |
|
24763 |
|
24764 |
|
24765 |
|
24766 |
|
24767 |
|
24768 |
|
24769 |
|
24770 |
|
24771 |
|
24772 |
|
24773 |
|
24774 |
|
24775 |
|
24776 |
|
24777 |
|
24778 |
|
24779 |
|
24780 |
|
24781 |
|
24782 |
|
24783 |
|
24784 |
|
24785 |
|
24786 |
|
24787 |
|
24788 |
|
24789 | property: {
|
24790 | configurable: true,
|
24791 | enumerable: false,
|
24792 | writable: true,
|
24793 | value: function () {
|
24794 | (true && !(false) && (0, _debug.deprecate)(`Function prototype extensions have been deprecated, please migrate from function(){}.property('bar') to computed('bar', function() {}).`, false, {
|
24795 | id: 'function-prototype-extensions.property',
|
24796 | until: '4.0.0',
|
24797 | url: 'https://deprecations.emberjs.com/v3.x#toc_function-prototype-extensions-property'
|
24798 | }));
|
24799 | return (0, _metal.computed)(...arguments, this);
|
24800 | }
|
24801 | },
|
24802 |
|
24803 | |
24804 |
|
24805 |
|
24806 |
|
24807 |
|
24808 |
|
24809 |
|
24810 |
|
24811 |
|
24812 |
|
24813 |
|
24814 |
|
24815 |
|
24816 |
|
24817 |
|
24818 |
|
24819 |
|
24820 |
|
24821 |
|
24822 |
|
24823 |
|
24824 | observes: {
|
24825 | configurable: true,
|
24826 | enumerable: false,
|
24827 | writable: true,
|
24828 | value: function () {
|
24829 | (true && !(false) && (0, _debug.deprecate)(`Function prototype extensions have been deprecated, please migrate from function(){}.observes('foo') to observer('foo', function() {}).`, false, {
|
24830 | id: 'function-prototype-extensions.observes',
|
24831 | until: '4.0.0',
|
24832 | url: 'https://deprecations.emberjs.com/v3.x#toc_function-prototype-extensions-observes'
|
24833 | }));
|
24834 | return (0, _metal.observer)(...arguments, this);
|
24835 | }
|
24836 | },
|
24837 |
|
24838 | |
24839 |
|
24840 |
|
24841 |
|
24842 |
|
24843 |
|
24844 |
|
24845 |
|
24846 |
|
24847 |
|
24848 |
|
24849 |
|
24850 |
|
24851 |
|
24852 |
|
24853 |
|
24854 |
|
24855 |
|
24856 |
|
24857 | on: {
|
24858 | configurable: true,
|
24859 | enumerable: false,
|
24860 | writable: true,
|
24861 | value: function () {
|
24862 | (true && !(false) && (0, _debug.deprecate)(`Function prototype extensions have been deprecated, please migrate from function(){}.on('foo') to on('foo', function() {}).`, false, {
|
24863 | id: 'function-prototype-extensions.on',
|
24864 | until: '4.0.0',
|
24865 | url: 'https://deprecations.emberjs.com/v3.x#toc_function-prototype-extensions-on'
|
24866 | }));
|
24867 | return (0, _metal.on)(...arguments, this);
|
24868 | }
|
24869 | }
|
24870 | });
|
24871 | }
|
24872 | });
|
24873 | define("@ember/-internals/runtime/lib/ext/rsvp", ["exports", "rsvp", "@ember/runloop", "@ember/-internals/error-handling", "@ember/debug"], function (_exports, RSVP, _runloop, _errorHandling, _debug) {
|
24874 | "use strict";
|
24875 |
|
24876 | Object.defineProperty(_exports, "__esModule", {
|
24877 | value: true
|
24878 | });
|
24879 | _exports.onerrorDefault = onerrorDefault;
|
24880 | _exports.default = void 0;
|
24881 | RSVP.configure('async', (callback, promise) => {
|
24882 | _runloop.backburner.schedule('actions', null, callback, promise);
|
24883 | });
|
24884 | RSVP.configure('after', cb => {
|
24885 | _runloop.backburner.schedule(_runloop._rsvpErrorQueue, null, cb);
|
24886 | });
|
24887 | RSVP.on('error', onerrorDefault);
|
24888 |
|
24889 | function onerrorDefault(reason) {
|
24890 | var error = errorFor(reason);
|
24891 |
|
24892 | if (error) {
|
24893 | var overrideDispatch = (0, _errorHandling.getDispatchOverride)();
|
24894 |
|
24895 | if (overrideDispatch) {
|
24896 | overrideDispatch(error);
|
24897 | } else {
|
24898 | throw error;
|
24899 | }
|
24900 | }
|
24901 | }
|
24902 |
|
24903 | function errorFor(reason) {
|
24904 | if (!reason) return;
|
24905 |
|
24906 | if (reason.errorThrown) {
|
24907 | return unwrapErrorThrown(reason);
|
24908 | }
|
24909 |
|
24910 | if (reason.name === 'UnrecognizedURLError') {
|
24911 | (true && !(false) && (0, _debug.assert)(`The URL '${reason.message}' did not match any routes in your application`, false));
|
24912 | return;
|
24913 | }
|
24914 |
|
24915 | if (reason.name === 'TransitionAborted') {
|
24916 | return;
|
24917 | }
|
24918 |
|
24919 | return reason;
|
24920 | }
|
24921 |
|
24922 | function unwrapErrorThrown(reason) {
|
24923 | var error = reason.errorThrown;
|
24924 |
|
24925 | if (typeof error === 'string') {
|
24926 | error = new Error(error);
|
24927 | }
|
24928 |
|
24929 | Object.defineProperty(error, '__reason_with_error_thrown__', {
|
24930 | value: reason,
|
24931 | enumerable: false
|
24932 | });
|
24933 | return error;
|
24934 | }
|
24935 |
|
24936 | var _default = RSVP;
|
24937 | _exports.default = _default;
|
24938 | });
|
24939 | define("@ember/-internals/runtime/lib/is-equal", ["exports"], function (_exports) {
|
24940 | "use strict";
|
24941 |
|
24942 | Object.defineProperty(_exports, "__esModule", {
|
24943 | value: true
|
24944 | });
|
24945 | _exports.default = isEqual;
|
24946 |
|
24947 | |
24948 |
|
24949 |
|
24950 |
|
24951 | |
24952 |
|
24953 |
|
24954 |
|
24955 |
|
24956 |
|
24957 |
|
24958 |
|
24959 |
|
24960 |
|
24961 |
|
24962 |
|
24963 |
|
24964 |
|
24965 |
|
24966 |
|
24967 |
|
24968 |
|
24969 |
|
24970 |
|
24971 |
|
24972 |
|
24973 |
|
24974 |
|
24975 |
|
24976 |
|
24977 |
|
24978 |
|
24979 |
|
24980 |
|
24981 |
|
24982 |
|
24983 |
|
24984 |
|
24985 |
|
24986 |
|
24987 |
|
24988 |
|
24989 |
|
24990 |
|
24991 |
|
24992 |
|
24993 |
|
24994 |
|
24995 |
|
24996 |
|
24997 | function isEqual(a, b) {
|
24998 | if (a && typeof a.isEqual === 'function') {
|
24999 | return a.isEqual(b);
|
25000 | }
|
25001 |
|
25002 | if (a instanceof Date && b instanceof Date) {
|
25003 | return a.getTime() === b.getTime();
|
25004 | }
|
25005 |
|
25006 | return a === b;
|
25007 | }
|
25008 | });
|
25009 | define("@ember/-internals/runtime/lib/mixins/-proxy", ["exports", "@ember/-internals/meta", "@ember/-internals/metal", "@ember/-internals/utils", "@ember/debug", "@glimmer/validator"], function (_exports, _meta, _metal, _utils, _debug, _validator) {
|
25010 | "use strict";
|
25011 |
|
25012 | Object.defineProperty(_exports, "__esModule", {
|
25013 | value: true
|
25014 | });
|
25015 | _exports.contentFor = contentFor;
|
25016 | _exports.default = void 0;
|
25017 |
|
25018 | |
25019 |
|
25020 |
|
25021 | function contentFor(proxy) {
|
25022 | var content = (0, _metal.get)(proxy, 'content');
|
25023 | (0, _validator.updateTag)((0, _metal.tagForObject)(proxy), (0, _metal.tagForObject)(content));
|
25024 | return content;
|
25025 | }
|
25026 | |
25027 |
|
25028 |
|
25029 |
|
25030 |
|
25031 |
|
25032 |
|
25033 |
|
25034 |
|
25035 |
|
25036 | var _default = _metal.Mixin.create({
|
25037 | |
25038 |
|
25039 |
|
25040 |
|
25041 |
|
25042 |
|
25043 |
|
25044 | content: null,
|
25045 |
|
25046 | init() {
|
25047 | this._super(...arguments);
|
25048 |
|
25049 | (0, _utils.setProxy)(this);
|
25050 | (0, _metal.tagForObject)(this);
|
25051 | },
|
25052 |
|
25053 | willDestroy() {
|
25054 | this.set('content', null);
|
25055 |
|
25056 | this._super(...arguments);
|
25057 | },
|
25058 |
|
25059 | isTruthy: (0, _metal.computed)('content', function () {
|
25060 | return Boolean((0, _metal.get)(this, 'content'));
|
25061 | }),
|
25062 |
|
25063 | [_metal.CUSTOM_TAG_FOR](key, addMandatorySetter) {
|
25064 | var meta = (0, _validator.tagMetaFor)(this);
|
25065 | var tag = (0, _validator.tagFor)(this, key, meta);
|
25066 |
|
25067 | if (true
|
25068 |
|
25069 | ) {
|
25070 |
|
25071 | tag._propertyKey = key;
|
25072 | }
|
25073 |
|
25074 | if (key in this) {
|
25075 | if (true
|
25076 |
|
25077 | && addMandatorySetter) {
|
25078 | (0, _utils.setupMandatorySetter)(tag, this, key);
|
25079 | }
|
25080 |
|
25081 | return tag;
|
25082 | } else {
|
25083 | var tags = [tag, (0, _validator.tagFor)(this, 'content', meta)];
|
25084 | var content = contentFor(this);
|
25085 |
|
25086 | if ((0, _utils.isObject)(content)) {
|
25087 | tags.push((0, _metal.tagForProperty)(content, key, addMandatorySetter));
|
25088 | }
|
25089 |
|
25090 | return (0, _validator.combine)(tags);
|
25091 | }
|
25092 | },
|
25093 |
|
25094 | unknownProperty(key) {
|
25095 | var content = contentFor(this);
|
25096 |
|
25097 | if (content) {
|
25098 | return (0, _metal.get)(content, key);
|
25099 | }
|
25100 | },
|
25101 |
|
25102 | setUnknownProperty(key, value) {
|
25103 | var m = (0, _meta.meta)(this);
|
25104 |
|
25105 | if (m.isInitializing() || m.isPrototypeMeta(this)) {
|
25106 |
|
25107 |
|
25108 | (0, _metal.defineProperty)(this, key, null, value);
|
25109 | return value;
|
25110 | }
|
25111 |
|
25112 | var content = contentFor(this);
|
25113 | (true && !(content) && (0, _debug.assert)(`Cannot delegate set('${key}', ${value}) to the 'content' property of object proxy ${this}: its 'content' is undefined.`, content));
|
25114 | return (0, _metal.set)(content, key, value);
|
25115 | }
|
25116 |
|
25117 | });
|
25118 |
|
25119 | _exports.default = _default;
|
25120 | });
|
25121 | define("@ember/-internals/runtime/lib/mixins/action_handler", ["exports", "@ember/-internals/metal", "@ember/debug"], function (_exports, _metal, _debug) {
|
25122 | "use strict";
|
25123 |
|
25124 | Object.defineProperty(_exports, "__esModule", {
|
25125 | value: true
|
25126 | });
|
25127 | _exports.default = void 0;
|
25128 |
|
25129 | |
25130 |
|
25131 |
|
25132 |
|
25133 | |
25134 |
|
25135 |
|
25136 |
|
25137 |
|
25138 |
|
25139 |
|
25140 |
|
25141 |
|
25142 |
|
25143 |
|
25144 | var ActionHandler = _metal.Mixin.create({
|
25145 | mergedProperties: ['actions'],
|
25146 |
|
25147 | |
25148 |
|
25149 |
|
25150 |
|
25151 |
|
25152 |
|
25153 |
|
25154 |
|
25155 |
|
25156 |
|
25157 |
|
25158 |
|
25159 |
|
25160 |
|
25161 |
|
25162 |
|
25163 |
|
25164 |
|
25165 |
|
25166 |
|
25167 |
|
25168 |
|
25169 |
|
25170 |
|
25171 |
|
25172 |
|
25173 |
|
25174 |
|
25175 |
|
25176 |
|
25177 |
|
25178 |
|
25179 |
|
25180 |
|
25181 |
|
25182 |
|
25183 |
|
25184 |
|
25185 |
|
25186 |
|
25187 |
|
25188 |
|
25189 |
|
25190 |
|
25191 |
|
25192 |
|
25193 |
|
25194 |
|
25195 |
|
25196 |
|
25197 |
|
25198 |
|
25199 |
|
25200 |
|
25201 |
|
25202 |
|
25203 |
|
25204 |
|
25205 |
|
25206 |
|
25207 |
|
25208 |
|
25209 |
|
25210 |
|
25211 |
|
25212 |
|
25213 |
|
25214 |
|
25215 |
|
25216 |
|
25217 |
|
25218 |
|
25219 |
|
25220 |
|
25221 |
|
25222 |
|
25223 |
|
25224 |
|
25225 |
|
25226 |
|
25227 |
|
25228 |
|
25229 |
|
25230 |
|
25231 |
|
25232 |
|
25233 |
|
25234 |
|
25235 |
|
25236 |
|
25237 |
|
25238 |
|
25239 |
|
25240 |
|
25241 |
|
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 |
|
25273 |
|
25274 |
|
25275 |
|
25276 |
|
25277 |
|
25278 |
|
25279 |
|
25280 |
|
25281 |
|
25282 |
|
25283 |
|
25284 |
|
25285 |
|
25286 |
|
25287 |
|
25288 |
|
25289 |
|
25290 |
|
25291 |
|
25292 | send(actionName, ...args) {
|
25293 | (true && !(!this.isDestroying && !this.isDestroyed) && (0, _debug.assert)(`Attempted to call .send() with the action '${actionName}' on the destroyed object '${this}'.`, !this.isDestroying && !this.isDestroyed));
|
25294 |
|
25295 | if (this.actions && this.actions[actionName]) {
|
25296 | var shouldBubble = this.actions[actionName].apply(this, args) === true;
|
25297 |
|
25298 | if (!shouldBubble) {
|
25299 | return;
|
25300 | }
|
25301 | }
|
25302 |
|
25303 | var target = (0, _metal.get)(this, 'target');
|
25304 |
|
25305 | if (target) {
|
25306 | (true && !(typeof target.send === 'function') && (0, _debug.assert)(`The \`target\` for ${this} (${target}) does not have a \`send\` method`, typeof target.send === 'function'));
|
25307 | target.send(...arguments);
|
25308 | }
|
25309 | }
|
25310 |
|
25311 | });
|
25312 |
|
25313 | var _default = ActionHandler;
|
25314 | _exports.default = _default;
|
25315 | });
|
25316 | define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-internals/metal", "@ember/-internals/utils", "@ember/debug", "@ember/-internals/runtime/lib/mixins/enumerable", "@ember/-internals/runtime/lib/compare", "@ember/-internals/environment", "@ember/-internals/runtime/lib/mixins/observable", "@ember/-internals/runtime/lib/mixins/mutable_enumerable", "@ember/-internals/runtime/lib/type-of"], function (_exports, _metal, _utils, _debug, _enumerable, _compare, _environment, _observable, _mutable_enumerable, _typeOf) {
|
25317 | "use strict";
|
25318 |
|
25319 | Object.defineProperty(_exports, "__esModule", {
|
25320 | value: true
|
25321 | });
|
25322 | _exports.uniqBy = uniqBy;
|
25323 | _exports.removeAt = removeAt;
|
25324 | _exports.isArray = isArray;
|
25325 | _exports.default = _exports.MutableArray = _exports.NativeArray = _exports.A = void 0;
|
25326 |
|
25327 | |
25328 |
|
25329 |
|
25330 | var EMPTY_ARRAY = Object.freeze([]);
|
25331 |
|
25332 | var identityFunction = item => item;
|
25333 |
|
25334 | function uniqBy(array, key = identityFunction) {
|
25335 | (true && !(isArray(array)) && (0, _debug.assert)(`first argument passed to \`uniqBy\` should be array`, isArray(array)));
|
25336 | var ret = A();
|
25337 | var seen = new Set();
|
25338 | var getter = typeof key === 'function' ? key : item => (0, _metal.get)(item, key);
|
25339 | array.forEach(item => {
|
25340 | var val = getter(item);
|
25341 |
|
25342 | if (!seen.has(val)) {
|
25343 | seen.add(val);
|
25344 | ret.push(item);
|
25345 | }
|
25346 | });
|
25347 | return ret;
|
25348 | }
|
25349 |
|
25350 | function iter(key, value) {
|
25351 | var valueProvided = arguments.length === 2;
|
25352 | return valueProvided ? item => value === (0, _metal.get)(item, key) : item => Boolean((0, _metal.get)(item, key));
|
25353 | }
|
25354 |
|
25355 | function findIndex(array, predicate, startAt) {
|
25356 | var len = array.length;
|
25357 |
|
25358 | for (var index = startAt; index < len; index++) {
|
25359 | var item = (0, _metal.objectAt)(array, index);
|
25360 |
|
25361 | if (predicate(item, index, array)) {
|
25362 | return index;
|
25363 | }
|
25364 | }
|
25365 |
|
25366 | return -1;
|
25367 | }
|
25368 |
|
25369 | function find(array, callback, target) {
|
25370 | var predicate = callback.bind(target);
|
25371 | var index = findIndex(array, predicate, 0);
|
25372 | return index === -1 ? undefined : (0, _metal.objectAt)(array, index);
|
25373 | }
|
25374 |
|
25375 | function any(array, callback, target) {
|
25376 | var predicate = callback.bind(target);
|
25377 | return findIndex(array, predicate, 0) !== -1;
|
25378 | }
|
25379 |
|
25380 | function every(array, callback, target) {
|
25381 | var cb = callback.bind(target);
|
25382 |
|
25383 | var predicate = (item, index, array) => !cb(item, index, array);
|
25384 |
|
25385 | return findIndex(array, predicate, 0) === -1;
|
25386 | }
|
25387 |
|
25388 | function indexOf(array, val, startAt = 0, withNaNCheck) {
|
25389 | var len = array.length;
|
25390 |
|
25391 | if (startAt < 0) {
|
25392 | startAt += len;
|
25393 | }
|
25394 |
|
25395 |
|
25396 | var predicate = withNaNCheck && val !== val ? item => item !== item : item => item === val;
|
25397 | return findIndex(array, predicate, startAt);
|
25398 | }
|
25399 |
|
25400 | function removeAt(array, index, len = 1) {
|
25401 | (true && !(index > -1 && index < array.length) && (0, _debug.assert)(`\`removeAt\` index provided is out of range`, index > -1 && index < array.length));
|
25402 | (0, _metal.replace)(array, index, len, EMPTY_ARRAY);
|
25403 | return array;
|
25404 | }
|
25405 |
|
25406 | function insertAt(array, index, item) {
|
25407 | (true && !(index > -1 && index <= array.length) && (0, _debug.assert)(`\`insertAt\` index provided is out of range`, index > -1 && index <= array.length));
|
25408 | (0, _metal.replace)(array, index, 0, [item]);
|
25409 | return item;
|
25410 | }
|
25411 | |
25412 |
|
25413 |
|
25414 |
|
25415 |
|
25416 |
|
25417 |
|
25418 |
|
25419 |
|
25420 |
|
25421 |
|
25422 |
|
25423 |
|
25424 |
|
25425 |
|
25426 |
|
25427 |
|
25428 |
|
25429 |
|
25430 |
|
25431 |
|
25432 |
|
25433 |
|
25434 |
|
25435 |
|
25436 |
|
25437 |
|
25438 |
|
25439 |
|
25440 |
|
25441 | function isArray(_obj) {
|
25442 | var obj = _obj;
|
25443 |
|
25444 | if (true
|
25445 |
|
25446 | && _utils.HAS_NATIVE_PROXY && typeof _obj === 'object' && _obj !== null) {
|
25447 | var possibleProxyContent = _obj[_metal.PROXY_CONTENT];
|
25448 |
|
25449 | if (possibleProxyContent !== undefined) {
|
25450 | obj = possibleProxyContent;
|
25451 | }
|
25452 | }
|
25453 |
|
25454 | if (!obj || obj.setInterval) {
|
25455 | return false;
|
25456 | }
|
25457 |
|
25458 | if (Array.isArray(obj) || ArrayMixin.detect(obj)) {
|
25459 | return true;
|
25460 | }
|
25461 |
|
25462 | var type = (0, _typeOf.typeOf)(obj);
|
25463 |
|
25464 | if ('array' === type) {
|
25465 | return true;
|
25466 | }
|
25467 |
|
25468 | var length = obj.length;
|
25469 |
|
25470 | if (typeof length === 'number' && length === length && 'object' === type) {
|
25471 | return true;
|
25472 | }
|
25473 |
|
25474 | return false;
|
25475 | }
|
25476 | |
25477 |
|
25478 |
|
25479 |
|
25480 |
|
25481 |
|
25482 |
|
25483 |
|
25484 | function nonEnumerableComputed() {
|
25485 | var property = (0, _metal.computed)(...arguments);
|
25486 | property.enumerable = false;
|
25487 | return property;
|
25488 | }
|
25489 |
|
25490 | function mapBy(key) {
|
25491 | return this.map(next => (0, _metal.get)(next, key));
|
25492 | }
|
25493 |
|
25494 |
|
25495 |
|
25496 | |
25497 |
|
25498 |
|
25499 |
|
25500 |
|
25501 |
|
25502 |
|
25503 |
|
25504 |
|
25505 |
|
25506 |
|
25507 |
|
25508 |
|
25509 |
|
25510 |
|
25511 |
|
25512 |
|
25513 |
|
25514 |
|
25515 |
|
25516 |
|
25517 |
|
25518 |
|
25519 |
|
25520 |
|
25521 |
|
25522 |
|
25523 |
|
25524 |
|
25525 |
|
25526 |
|
25527 |
|
25528 |
|
25529 |
|
25530 |
|
25531 | var ArrayMixin = _metal.Mixin.create(_enumerable.default, {
|
25532 | init() {
|
25533 | this._super(...arguments);
|
25534 |
|
25535 | (0, _utils.setEmberArray)(this);
|
25536 | },
|
25537 |
|
25538 | |
25539 |
|
25540 |
|
25541 |
|
25542 |
|
25543 |
|
25544 |
|
25545 |
|
25546 | |
25547 |
|
25548 |
|
25549 |
|
25550 |
|
25551 |
|
25552 |
|
25553 |
|
25554 |
|
25555 |
|
25556 |
|
25557 |
|
25558 |
|
25559 |
|
25560 |
|
25561 |
|
25562 |
|
25563 |
|
25564 |
|
25565 |
|
25566 |
|
25567 | |
25568 |
|
25569 |
|
25570 |
|
25571 |
|
25572 |
|
25573 |
|
25574 |
|
25575 |
|
25576 |
|
25577 |
|
25578 |
|
25579 | objectsAt(indexes) {
|
25580 | return indexes.map(idx => (0, _metal.objectAt)(this, idx));
|
25581 | },
|
25582 |
|
25583 | |
25584 |
|
25585 |
|
25586 |
|
25587 |
|
25588 |
|
25589 |
|
25590 |
|
25591 |
|
25592 |
|
25593 |
|
25594 |
|
25595 |
|
25596 |
|
25597 | '[]': nonEnumerableComputed({
|
25598 | get() {
|
25599 | return this;
|
25600 | },
|
25601 |
|
25602 | set(key, value) {
|
25603 | this.replace(0, this.length, value);
|
25604 | return this;
|
25605 | }
|
25606 |
|
25607 | }),
|
25608 |
|
25609 | |
25610 |
|
25611 |
|
25612 |
|
25613 |
|
25614 |
|
25615 |
|
25616 |
|
25617 |
|
25618 |
|
25619 |
|
25620 |
|
25621 |
|
25622 |
|
25623 |
|
25624 |
|
25625 | firstObject: nonEnumerableComputed(function () {
|
25626 | return (0, _metal.objectAt)(this, 0);
|
25627 | }).readOnly(),
|
25628 |
|
25629 | |
25630 |
|
25631 |
|
25632 |
|
25633 |
|
25634 |
|
25635 | lastObject: nonEnumerableComputed(function () {
|
25636 | return (0, _metal.objectAt)(this, this.length - 1);
|
25637 | }).readOnly(),
|
25638 |
|
25639 |
|
25640 |
|
25641 | |
25642 |
|
25643 |
|
25644 |
|
25645 |
|
25646 |
|
25647 |
|
25648 |
|
25649 |
|
25650 |
|
25651 |
|
25652 |
|
25653 |
|
25654 |
|
25655 |
|
25656 |
|
25657 | slice(beginIndex = 0, endIndex) {
|
25658 | var ret = A();
|
25659 | var length = this.length;
|
25660 |
|
25661 | if (beginIndex < 0) {
|
25662 | beginIndex = length + beginIndex;
|
25663 | }
|
25664 |
|
25665 | if (endIndex === undefined || endIndex > length) {
|
25666 | endIndex = length;
|
25667 | } else if (endIndex < 0) {
|
25668 | endIndex = length + endIndex;
|
25669 | }
|
25670 |
|
25671 | while (beginIndex < endIndex) {
|
25672 | ret[ret.length] = (0, _metal.objectAt)(this, beginIndex++);
|
25673 | }
|
25674 |
|
25675 | return ret;
|
25676 | },
|
25677 |
|
25678 | |
25679 |
|
25680 |
|
25681 |
|
25682 |
|
25683 |
|
25684 |
|
25685 |
|
25686 |
|
25687 |
|
25688 |
|
25689 |
|
25690 |
|
25691 |
|
25692 |
|
25693 |
|
25694 |
|
25695 |
|
25696 |
|
25697 |
|
25698 |
|
25699 |
|
25700 |
|
25701 |
|
25702 |
|
25703 |
|
25704 |
|
25705 |
|
25706 |
|
25707 |
|
25708 |
|
25709 | indexOf(object, startAt) {
|
25710 | return indexOf(this, object, startAt, false);
|
25711 | },
|
25712 |
|
25713 | |
25714 |
|
25715 |
|
25716 |
|
25717 |
|
25718 |
|
25719 |
|
25720 |
|
25721 |
|
25722 |
|
25723 |
|
25724 |
|
25725 |
|
25726 |
|
25727 |
|
25728 |
|
25729 |
|
25730 |
|
25731 |
|
25732 |
|
25733 |
|
25734 |
|
25735 |
|
25736 |
|
25737 |
|
25738 |
|
25739 |
|
25740 |
|
25741 |
|
25742 | lastIndexOf(object, startAt) {
|
25743 | var len = this.length;
|
25744 |
|
25745 | if (startAt === undefined || startAt >= len) {
|
25746 | startAt = len - 1;
|
25747 | }
|
25748 |
|
25749 | if (startAt < 0) {
|
25750 | startAt += len;
|
25751 | }
|
25752 |
|
25753 | for (var idx = startAt; idx >= 0; idx--) {
|
25754 | if ((0, _metal.objectAt)(this, idx) === object) {
|
25755 | return idx;
|
25756 | }
|
25757 | }
|
25758 |
|
25759 | return -1;
|
25760 | },
|
25761 |
|
25762 |
|
25763 |
|
25764 |
|
25765 |
|
25766 | |
25767 |
|
25768 |
|
25769 |
|
25770 |
|
25771 |
|
25772 |
|
25773 |
|
25774 |
|
25775 |
|
25776 |
|
25777 |
|
25778 |
|
25779 |
|
25780 |
|
25781 |
|
25782 |
|
25783 |
|
25784 |
|
25785 |
|
25786 |
|
25787 |
|
25788 |
|
25789 |
|
25790 |
|
25791 |
|
25792 |
|
25793 |
|
25794 |
|
25795 |
|
25796 |
|
25797 |
|
25798 |
|
25799 |
|
25800 |
|
25801 |
|
25802 |
|
25803 |
|
25804 |
|
25805 | addArrayObserver(target, opts) {
|
25806 | return (0, _metal.addArrayObserver)(this, target, opts);
|
25807 | },
|
25808 |
|
25809 | |
25810 |
|
25811 |
|
25812 |
|
25813 |
|
25814 |
|
25815 |
|
25816 |
|
25817 |
|
25818 |
|
25819 |
|
25820 | removeArrayObserver(target, opts) {
|
25821 | return (0, _metal.removeArrayObserver)(this, target, opts);
|
25822 | },
|
25823 |
|
25824 | |
25825 |
|
25826 |
|
25827 |
|
25828 |
|
25829 |
|
25830 |
|
25831 |
|
25832 |
|
25833 |
|
25834 |
|
25835 |
|
25836 |
|
25837 |
|
25838 |
|
25839 |
|
25840 | hasArrayObservers: (0, _metal.nativeDescDecorator)({
|
25841 | configurable: true,
|
25842 | enumerable: false,
|
25843 |
|
25844 | get() {
|
25845 | return (0, _metal.hasListeners)(this, '@array:change') || (0, _metal.hasListeners)(this, '@array:before');
|
25846 | }
|
25847 |
|
25848 | }),
|
25849 |
|
25850 | |
25851 |
|
25852 |
|
25853 |
|
25854 |
|
25855 |
|
25856 |
|
25857 |
|
25858 |
|
25859 |
|
25860 |
|
25861 |
|
25862 |
|
25863 |
|
25864 |
|
25865 |
|
25866 |
|
25867 |
|
25868 |
|
25869 |
|
25870 |
|
25871 |
|
25872 |
|
25873 |
|
25874 |
|
25875 |
|
25876 |
|
25877 |
|
25878 |
|
25879 |
|
25880 |
|
25881 |
|
25882 |
|
25883 |
|
25884 |
|
25885 |
|
25886 |
|
25887 |
|
25888 |
|
25889 |
|
25890 |
|
25891 |
|
25892 |
|
25893 |
|
25894 |
|
25895 |
|
25896 |
|
25897 |
|
25898 |
|
25899 |
|
25900 |
|
25901 |
|
25902 |
|
25903 |
|
25904 | arrayContentWillChange(startIdx, removeAmt, addAmt) {
|
25905 | return (0, _metal.arrayContentWillChange)(this, startIdx, removeAmt, addAmt);
|
25906 | },
|
25907 |
|
25908 | |
25909 |
|
25910 |
|
25911 |
|
25912 |
|
25913 |
|
25914 |
|
25915 |
|
25916 |
|
25917 |
|
25918 |
|
25919 |
|
25920 |
|
25921 |
|
25922 |
|
25923 |
|
25924 |
|
25925 |
|
25926 |
|
25927 |
|
25928 |
|
25929 | arrayContentDidChange(startIdx, removeAmt, addAmt) {
|
25930 | return (0, _metal.arrayContentDidChange)(this, startIdx, removeAmt, addAmt);
|
25931 | },
|
25932 |
|
25933 | |
25934 |
|
25935 |
|
25936 |
|
25937 |
|
25938 |
|
25939 |
|
25940 |
|
25941 |
|
25942 |
|
25943 |
|
25944 |
|
25945 |
|
25946 |
|
25947 |
|
25948 |
|
25949 |
|
25950 |
|
25951 |
|
25952 |
|
25953 |
|
25954 |
|
25955 |
|
25956 |
|
25957 |
|
25958 |
|
25959 |
|
25960 |
|
25961 |
|
25962 |
|
25963 |
|
25964 |
|
25965 |
|
25966 |
|
25967 |
|
25968 |
|
25969 |
|
25970 |
|
25971 | forEach(callback, target = null) {
|
25972 | (true && !(typeof callback === 'function') && (0, _debug.assert)('`forEach` expects a function as first argument.', typeof callback === 'function'));
|
25973 | var length = this.length;
|
25974 |
|
25975 | for (var index = 0; index < length; index++) {
|
25976 | var item = this.objectAt(index);
|
25977 | callback.call(target, item, index, this);
|
25978 | }
|
25979 |
|
25980 | return this;
|
25981 | },
|
25982 |
|
25983 | |
25984 |
|
25985 |
|
25986 |
|
25987 |
|
25988 |
|
25989 |
|
25990 |
|
25991 |
|
25992 |
|
25993 |
|
25994 |
|
25995 |
|
25996 |
|
25997 |
|
25998 |
|
25999 | getEach: mapBy,
|
26000 |
|
26001 | |
26002 |
|
26003 |
|
26004 |
|
26005 |
|
26006 |
|
26007 |
|
26008 |
|
26009 |
|
26010 |
|
26011 |
|
26012 |
|
26013 |
|
26014 |
|
26015 |
|
26016 |
|
26017 | setEach(key, value) {
|
26018 | return this.forEach(item => (0, _metal.set)(item, key, value));
|
26019 | },
|
26020 |
|
26021 | |
26022 |
|
26023 |
|
26024 |
|
26025 |
|
26026 |
|
26027 |
|
26028 |
|
26029 |
|
26030 |
|
26031 |
|
26032 |
|
26033 |
|
26034 |
|
26035 |
|
26036 |
|
26037 |
|
26038 |
|
26039 |
|
26040 |
|
26041 |
|
26042 |
|
26043 |
|
26044 |
|
26045 |
|
26046 |
|
26047 | map(callback, target = null) {
|
26048 | (true && !(typeof callback === 'function') && (0, _debug.assert)('`map` expects a function as first argument.', typeof callback === 'function'));
|
26049 | var ret = A();
|
26050 | this.forEach((x, idx, i) => ret[idx] = callback.call(target, x, idx, i));
|
26051 | return ret;
|
26052 | },
|
26053 |
|
26054 | |
26055 |
|
26056 |
|
26057 |
|
26058 |
|
26059 |
|
26060 |
|
26061 |
|
26062 |
|
26063 |
|
26064 |
|
26065 |
|
26066 |
|
26067 |
|
26068 |
|
26069 | mapBy,
|
26070 |
|
26071 | |
26072 |
|
26073 |
|
26074 |
|
26075 |
|
26076 |
|
26077 |
|
26078 |
|
26079 |
|
26080 |
|
26081 |
|
26082 |
|
26083 |
|
26084 |
|
26085 |
|
26086 |
|
26087 |
|
26088 |
|
26089 |
|
26090 |
|
26091 |
|
26092 |
|
26093 |
|
26094 |
|
26095 |
|
26096 |
|
26097 |
|
26098 |
|
26099 |
|
26100 |
|
26101 |
|
26102 |
|
26103 |
|
26104 |
|
26105 |
|
26106 |
|
26107 |
|
26108 |
|
26109 |
|
26110 |
|
26111 |
|
26112 |
|
26113 |
|
26114 |
|
26115 | filter(callback, target = null) {
|
26116 | (true && !(typeof callback === 'function') && (0, _debug.assert)('`filter` expects a function as first argument.', typeof callback === 'function'));
|
26117 | var ret = A();
|
26118 | this.forEach((x, idx, i) => {
|
26119 | if (callback.call(target, x, idx, i)) {
|
26120 | ret.push(x);
|
26121 | }
|
26122 | });
|
26123 | return ret;
|
26124 | },
|
26125 |
|
26126 | |
26127 |
|
26128 |
|
26129 |
|
26130 |
|
26131 |
|
26132 |
|
26133 |
|
26134 |
|
26135 |
|
26136 |
|
26137 |
|
26138 |
|
26139 |
|
26140 |
|
26141 |
|
26142 |
|
26143 |
|
26144 |
|
26145 |
|
26146 |
|
26147 |
|
26148 |
|
26149 |
|
26150 |
|
26151 |
|
26152 |
|
26153 |
|
26154 |
|
26155 |
|
26156 |
|
26157 |
|
26158 | reject(callback, target = null) {
|
26159 | (true && !(typeof callback === 'function') && (0, _debug.assert)('`reject` expects a function as first argument.', typeof callback === 'function'));
|
26160 | return this.filter(function () {
|
26161 | return !callback.apply(target, arguments);
|
26162 | });
|
26163 | },
|
26164 |
|
26165 | |
26166 |
|
26167 |
|
26168 |
|
26169 |
|
26170 |
|
26171 |
|
26172 |
|
26173 |
|
26174 |
|
26175 |
|
26176 |
|
26177 |
|
26178 |
|
26179 |
|
26180 |
|
26181 | filterBy() {
|
26182 | return this.filter(iter(...arguments));
|
26183 | },
|
26184 |
|
26185 | |
26186 |
|
26187 |
|
26188 |
|
26189 |
|
26190 |
|
26191 |
|
26192 |
|
26193 |
|
26194 |
|
26195 |
|
26196 |
|
26197 |
|
26198 |
|
26199 |
|
26200 |
|
26201 |
|
26202 |
|
26203 |
|
26204 |
|
26205 | rejectBy() {
|
26206 | return this.reject(iter(...arguments));
|
26207 | },
|
26208 |
|
26209 | |
26210 |
|
26211 |
|
26212 |
|
26213 |
|
26214 |
|
26215 |
|
26216 |
|
26217 |
|
26218 |
|
26219 |
|
26220 |
|
26221 |
|
26222 |
|
26223 |
|
26224 |
|
26225 |
|
26226 |
|
26227 |
|
26228 |
|
26229 |
|
26230 |
|
26231 |
|
26232 |
|
26233 |
|
26234 |
|
26235 |
|
26236 |
|
26237 |
|
26238 |
|
26239 |
|
26240 |
|
26241 |
|
26242 | find(callback, target = null) {
|
26243 | (true && !(typeof callback === 'function') && (0, _debug.assert)('`find` expects a function as first argument.', typeof callback === 'function'));
|
26244 | return find(this, callback, target);
|
26245 | },
|
26246 |
|
26247 | |
26248 |
|
26249 |
|
26250 |
|
26251 |
|
26252 |
|
26253 |
|
26254 |
|
26255 |
|
26256 |
|
26257 |
|
26258 |
|
26259 |
|
26260 |
|
26261 |
|
26262 |
|
26263 |
|
26264 |
|
26265 |
|
26266 |
|
26267 |
|
26268 |
|
26269 |
|
26270 | findBy() {
|
26271 | return find(this, iter(...arguments));
|
26272 | },
|
26273 |
|
26274 | |
26275 |
|
26276 |
|
26277 |
|
26278 |
|
26279 |
|
26280 |
|
26281 |
|
26282 |
|
26283 |
|
26284 |
|
26285 |
|
26286 |
|
26287 |
|
26288 |
|
26289 |
|
26290 |
|
26291 |
|
26292 |
|
26293 |
|
26294 |
|
26295 |
|
26296 |
|
26297 |
|
26298 |
|
26299 |
|
26300 |
|
26301 |
|
26302 | every(callback, target = null) {
|
26303 | (true && !(typeof callback === 'function') && (0, _debug.assert)('`every` expects a function as first argument.', typeof callback === 'function'));
|
26304 | return every(this, callback, target);
|
26305 | },
|
26306 |
|
26307 | |
26308 |
|
26309 |
|
26310 |
|
26311 |
|
26312 |
|
26313 |
|
26314 |
|
26315 |
|
26316 |
|
26317 |
|
26318 |
|
26319 |
|
26320 |
|
26321 |
|
26322 |
|
26323 |
|
26324 |
|
26325 |
|
26326 |
|
26327 |
|
26328 |
|
26329 |
|
26330 |
|
26331 |
|
26332 |
|
26333 |
|
26334 |
|
26335 |
|
26336 |
|
26337 |
|
26338 |
|
26339 |
|
26340 | isEvery() {
|
26341 | return every(this, iter(...arguments));
|
26342 | },
|
26343 |
|
26344 | |
26345 |
|
26346 |
|
26347 |
|
26348 |
|
26349 |
|
26350 |
|
26351 |
|
26352 |
|
26353 |
|
26354 |
|
26355 |
|
26356 |
|
26357 |
|
26358 |
|
26359 |
|
26360 |
|
26361 |
|
26362 |
|
26363 |
|
26364 |
|
26365 |
|
26366 |
|
26367 |
|
26368 |
|
26369 |
|
26370 |
|
26371 |
|
26372 |
|
26373 |
|
26374 |
|
26375 | any(callback, target = null) {
|
26376 | (true && !(typeof callback === 'function') && (0, _debug.assert)('`any` expects a function as first argument.', typeof callback === 'function'));
|
26377 | return any(this, callback, target);
|
26378 | },
|
26379 |
|
26380 | |
26381 |
|
26382 |
|
26383 |
|
26384 |
|
26385 |
|
26386 |
|
26387 |
|
26388 |
|
26389 |
|
26390 |
|
26391 |
|
26392 |
|
26393 |
|
26394 |
|
26395 |
|
26396 |
|
26397 |
|
26398 |
|
26399 |
|
26400 | isAny() {
|
26401 | return any(this, iter(...arguments));
|
26402 | },
|
26403 |
|
26404 | |
26405 |
|
26406 |
|
26407 |
|
26408 |
|
26409 |
|
26410 |
|
26411 |
|
26412 |
|
26413 |
|
26414 |
|
26415 |
|
26416 |
|
26417 |
|
26418 |
|
26419 |
|
26420 |
|
26421 |
|
26422 |
|
26423 |
|
26424 |
|
26425 |
|
26426 |
|
26427 |
|
26428 |
|
26429 |
|
26430 |
|
26431 |
|
26432 |
|
26433 |
|
26434 |
|
26435 |
|
26436 |
|
26437 |
|
26438 |
|
26439 |
|
26440 |
|
26441 |
|
26442 |
|
26443 |
|
26444 | reduce(callback, initialValue) {
|
26445 | (true && !(typeof callback === 'function') && (0, _debug.assert)('`reduce` expects a function as first argument.', typeof callback === 'function'));
|
26446 | var ret = initialValue;
|
26447 | this.forEach(function (item, i) {
|
26448 | ret = callback(ret, item, i, this);
|
26449 | }, this);
|
26450 | return ret;
|
26451 | },
|
26452 |
|
26453 | |
26454 |
|
26455 |
|
26456 |
|
26457 |
|
26458 |
|
26459 |
|
26460 |
|
26461 |
|
26462 |
|
26463 |
|
26464 |
|
26465 |
|
26466 |
|
26467 |
|
26468 |
|
26469 |
|
26470 |
|
26471 |
|
26472 |
|
26473 |
|
26474 |
|
26475 |
|
26476 |
|
26477 | invoke(methodName, ...args) {
|
26478 | var ret = A();
|
26479 | this.forEach(item => ret.push((0, _utils.tryInvoke)(item, methodName, args)));
|
26480 | return ret;
|
26481 | },
|
26482 |
|
26483 | |
26484 |
|
26485 |
|
26486 |
|
26487 |
|
26488 |
|
26489 |
|
26490 | toArray() {
|
26491 | return this.map(item => item);
|
26492 | },
|
26493 |
|
26494 | |
26495 |
|
26496 |
|
26497 |
|
26498 |
|
26499 |
|
26500 |
|
26501 |
|
26502 |
|
26503 |
|
26504 | compact() {
|
26505 | return this.filter(value => value != null);
|
26506 | },
|
26507 |
|
26508 | |
26509 |
|
26510 |
|
26511 |
|
26512 |
|
26513 |
|
26514 |
|
26515 |
|
26516 |
|
26517 |
|
26518 |
|
26519 |
|
26520 |
|
26521 |
|
26522 |
|
26523 |
|
26524 |
|
26525 |
|
26526 |
|
26527 |
|
26528 |
|
26529 |
|
26530 |
|
26531 |
|
26532 |
|
26533 | includes(object, startAt) {
|
26534 | return indexOf(this, object, startAt, true) !== -1;
|
26535 | },
|
26536 |
|
26537 | |
26538 |
|
26539 |
|
26540 |
|
26541 |
|
26542 |
|
26543 |
|
26544 |
|
26545 |
|
26546 |
|
26547 |
|
26548 |
|
26549 |
|
26550 |
|
26551 |
|
26552 |
|
26553 |
|
26554 |
|
26555 |
|
26556 |
|
26557 | sortBy() {
|
26558 | var sortKeys = arguments;
|
26559 | return this.toArray().sort((a, b) => {
|
26560 | for (var i = 0; i < sortKeys.length; i++) {
|
26561 | var key = sortKeys[i];
|
26562 | var propA = (0, _metal.get)(a, key);
|
26563 | var propB = (0, _metal.get)(b, key);
|
26564 |
|
26565 | var compareValue = (0, _compare.default)(propA, propB);
|
26566 |
|
26567 | if (compareValue) {
|
26568 | return compareValue;
|
26569 | }
|
26570 | }
|
26571 |
|
26572 | return 0;
|
26573 | });
|
26574 | },
|
26575 |
|
26576 | |
26577 |
|
26578 |
|
26579 |
|
26580 |
|
26581 |
|
26582 |
|
26583 |
|
26584 |
|
26585 |
|
26586 |
|
26587 |
|
26588 | uniq() {
|
26589 | return uniqBy(this);
|
26590 | },
|
26591 |
|
26592 | |
26593 |
|
26594 |
|
26595 |
|
26596 |
|
26597 |
|
26598 |
|
26599 |
|
26600 |
|
26601 |
|
26602 |
|
26603 |
|
26604 |
|
26605 |
|
26606 | uniqBy(key) {
|
26607 | return uniqBy(this, key);
|
26608 | },
|
26609 |
|
26610 | |
26611 |
|
26612 |
|
26613 |
|
26614 |
|
26615 |
|
26616 |
|
26617 |
|
26618 |
|
26619 |
|
26620 |
|
26621 |
|
26622 |
|
26623 | without(value) {
|
26624 | if (!this.includes(value)) {
|
26625 | return this;
|
26626 | }
|
26627 |
|
26628 |
|
26629 | var predicate = value === value ? item => item !== value : item => item === item;
|
26630 | return this.filter(predicate);
|
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 | var MutableArray = _metal.Mixin.create(ArrayMixin, _mutable_enumerable.default, {
|
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 | clear() {
|
26687 | var len = this.length;
|
26688 |
|
26689 | if (len === 0) {
|
26690 | return this;
|
26691 | }
|
26692 |
|
26693 | this.replace(0, len, EMPTY_ARRAY);
|
26694 | return this;
|
26695 | },
|
26696 |
|
26697 | |
26698 |
|
26699 |
|
26700 |
|
26701 |
|
26702 |
|
26703 |
|
26704 |
|
26705 |
|
26706 |
|
26707 |
|
26708 |
|
26709 |
|
26710 |
|
26711 | insertAt(idx, object) {
|
26712 | insertAt(this, idx, object);
|
26713 | return this;
|
26714 | },
|
26715 |
|
26716 | |
26717 |
|
26718 |
|
26719 |
|
26720 |
|
26721 |
|
26722 |
|
26723 |
|
26724 |
|
26725 |
|
26726 |
|
26727 |
|
26728 |
|
26729 |
|
26730 |
|
26731 |
|
26732 |
|
26733 | removeAt(start, len) {
|
26734 | return removeAt(this, start, len);
|
26735 | },
|
26736 |
|
26737 | |
26738 |
|
26739 |
|
26740 |
|
26741 |
|
26742 |
|
26743 |
|
26744 |
|
26745 |
|
26746 |
|
26747 |
|
26748 |
|
26749 |
|
26750 | pushObject(obj) {
|
26751 | return insertAt(this, this.length, obj);
|
26752 | },
|
26753 |
|
26754 | |
26755 |
|
26756 |
|
26757 |
|
26758 |
|
26759 |
|
26760 |
|
26761 |
|
26762 |
|
26763 |
|
26764 |
|
26765 |
|
26766 | pushObjects(objects) {
|
26767 | this.replace(this.length, 0, objects);
|
26768 | return this;
|
26769 | },
|
26770 |
|
26771 | |
26772 |
|
26773 |
|
26774 |
|
26775 |
|
26776 |
|
26777 |
|
26778 |
|
26779 |
|
26780 |
|
26781 |
|
26782 |
|
26783 | popObject() {
|
26784 | var len = this.length;
|
26785 |
|
26786 | if (len === 0) {
|
26787 | return null;
|
26788 | }
|
26789 |
|
26790 | var ret = (0, _metal.objectAt)(this, len - 1);
|
26791 | this.removeAt(len - 1, 1);
|
26792 | return ret;
|
26793 | },
|
26794 |
|
26795 | |
26796 |
|
26797 |
|
26798 |
|
26799 |
|
26800 |
|
26801 |
|
26802 |
|
26803 |
|
26804 |
|
26805 |
|
26806 |
|
26807 | shiftObject() {
|
26808 | if (this.length === 0) {
|
26809 | return null;
|
26810 | }
|
26811 |
|
26812 | var ret = (0, _metal.objectAt)(this, 0);
|
26813 | this.removeAt(0);
|
26814 | return ret;
|
26815 | },
|
26816 |
|
26817 | |
26818 |
|
26819 |
|
26820 |
|
26821 |
|
26822 |
|
26823 |
|
26824 |
|
26825 |
|
26826 |
|
26827 |
|
26828 |
|
26829 |
|
26830 | unshiftObject(obj) {
|
26831 | return insertAt(this, 0, obj);
|
26832 | },
|
26833 |
|
26834 | |
26835 |
|
26836 |
|
26837 |
|
26838 |
|
26839 |
|
26840 |
|
26841 |
|
26842 |
|
26843 |
|
26844 |
|
26845 |
|
26846 |
|
26847 | unshiftObjects(objects) {
|
26848 | this.replace(0, 0, objects);
|
26849 | return this;
|
26850 | },
|
26851 |
|
26852 | |
26853 |
|
26854 |
|
26855 |
|
26856 |
|
26857 |
|
26858 |
|
26859 | reverseObjects() {
|
26860 | var len = this.length;
|
26861 |
|
26862 | if (len === 0) {
|
26863 | return this;
|
26864 | }
|
26865 |
|
26866 | var objects = this.toArray().reverse();
|
26867 | this.replace(0, len, objects);
|
26868 | return this;
|
26869 | },
|
26870 |
|
26871 | |
26872 |
|
26873 |
|
26874 |
|
26875 |
|
26876 |
|
26877 |
|
26878 |
|
26879 |
|
26880 |
|
26881 |
|
26882 |
|
26883 |
|
26884 |
|
26885 | setObjects(objects) {
|
26886 | if (objects.length === 0) {
|
26887 | return this.clear();
|
26888 | }
|
26889 |
|
26890 | var len = this.length;
|
26891 | this.replace(0, len, objects);
|
26892 | return this;
|
26893 | },
|
26894 |
|
26895 | |
26896 |
|
26897 |
|
26898 |
|
26899 |
|
26900 |
|
26901 |
|
26902 |
|
26903 |
|
26904 |
|
26905 |
|
26906 |
|
26907 |
|
26908 | removeObject(obj) {
|
26909 | var loc = this.length || 0;
|
26910 |
|
26911 | while (--loc >= 0) {
|
26912 | var curObject = (0, _metal.objectAt)(this, loc);
|
26913 |
|
26914 | if (curObject === obj) {
|
26915 | this.removeAt(loc);
|
26916 | }
|
26917 | }
|
26918 |
|
26919 | return this;
|
26920 | },
|
26921 |
|
26922 | |
26923 |
|
26924 |
|
26925 |
|
26926 |
|
26927 |
|
26928 |
|
26929 | removeObjects(objects) {
|
26930 | (0, _metal.beginPropertyChanges)();
|
26931 |
|
26932 | for (var i = objects.length - 1; i >= 0; i--) {
|
26933 | this.removeObject(objects[i]);
|
26934 | }
|
26935 |
|
26936 | (0, _metal.endPropertyChanges)();
|
26937 | return this;
|
26938 | },
|
26939 |
|
26940 | |
26941 |
|
26942 |
|
26943 |
|
26944 |
|
26945 |
|
26946 |
|
26947 |
|
26948 |
|
26949 |
|
26950 |
|
26951 |
|
26952 |
|
26953 | addObject(obj) {
|
26954 | var included = this.includes(obj);
|
26955 |
|
26956 | if (!included) {
|
26957 | this.pushObject(obj);
|
26958 | }
|
26959 |
|
26960 | return this;
|
26961 | },
|
26962 |
|
26963 | |
26964 |
|
26965 |
|
26966 |
|
26967 |
|
26968 |
|
26969 |
|
26970 | addObjects(objects) {
|
26971 | (0, _metal.beginPropertyChanges)();
|
26972 | objects.forEach(obj => this.addObject(obj));
|
26973 | (0, _metal.endPropertyChanges)();
|
26974 | return this;
|
26975 | }
|
26976 |
|
26977 | });
|
26978 | |
26979 |
|
26980 |
|
26981 |
|
26982 |
|
26983 |
|
26984 |
|
26985 |
|
26986 |
|
26987 |
|
26988 |
|
26989 |
|
26990 |
|
26991 |
|
26992 |
|
26993 |
|
26994 |
|
26995 |
|
26996 |
|
26997 |
|
26998 |
|
26999 |
|
27000 |
|
27001 |
|
27002 |
|
27003 |
|
27004 |
|
27005 |
|
27006 |
|
27007 |
|
27008 |
|
27009 |
|
27010 |
|
27011 |
|
27012 |
|
27013 |
|
27014 |
|
27015 |
|
27016 |
|
27017 | |
27018 |
|
27019 |
|
27020 |
|
27021 | |
27022 |
|
27023 |
|
27024 |
|
27025 |
|
27026 |
|
27027 |
|
27028 |
|
27029 |
|
27030 |
|
27031 |
|
27032 |
|
27033 |
|
27034 |
|
27035 | _exports.MutableArray = MutableArray;
|
27036 |
|
27037 | var NativeArray = _metal.Mixin.create(MutableArray, _observable.default, {
|
27038 | objectAt(idx) {
|
27039 | return this[idx];
|
27040 | },
|
27041 |
|
27042 |
|
27043 | replace(start, deleteCount, items = EMPTY_ARRAY) {
|
27044 | (true && !(Array.isArray(items)) && (0, _debug.assert)('The third argument to replace needs to be an array.', Array.isArray(items)));
|
27045 | (0, _metal.replaceInNativeArray)(this, start, deleteCount, items);
|
27046 | return this;
|
27047 | }
|
27048 |
|
27049 | });
|
27050 |
|
27051 |
|
27052 | _exports.NativeArray = NativeArray;
|
27053 | var ignore = ['length'];
|
27054 | NativeArray.keys().forEach(methodName => {
|
27055 | if (Array.prototype[methodName]) {
|
27056 | ignore.push(methodName);
|
27057 | }
|
27058 | });
|
27059 | _exports.NativeArray = NativeArray = NativeArray.without(...ignore);
|
27060 | var A;
|
27061 | _exports.A = A;
|
27062 |
|
27063 | if (_environment.ENV.EXTEND_PROTOTYPES.Array) {
|
27064 | NativeArray.apply(Array.prototype, true);
|
27065 |
|
27066 | _exports.A = A = function (arr) {
|
27067 | (true && !(!(this instanceof A)) && (0, _debug.assert)('You cannot create an Ember Array with `new A()`, please update to calling A as a function: `A()`', !(this instanceof A)));
|
27068 | return arr || [];
|
27069 | };
|
27070 | } else {
|
27071 | _exports.A = A = function (arr) {
|
27072 | (true && !(!(this instanceof A)) && (0, _debug.assert)('You cannot create an Ember Array with `new A()`, please update to calling A as a function: `A()`', !(this instanceof A)));
|
27073 |
|
27074 | if (!arr) {
|
27075 | arr = [];
|
27076 | }
|
27077 |
|
27078 | return ArrayMixin.detect(arr) ? arr : NativeArray.apply(arr);
|
27079 | };
|
27080 | }
|
27081 |
|
27082 | var _default = ArrayMixin;
|
27083 | _exports.default = _default;
|
27084 | });
|
27085 | define("@ember/-internals/runtime/lib/mixins/comparable", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
27086 | "use strict";
|
27087 |
|
27088 | Object.defineProperty(_exports, "__esModule", {
|
27089 | value: true
|
27090 | });
|
27091 | _exports.default = void 0;
|
27092 |
|
27093 | |
27094 |
|
27095 |
|
27096 |
|
27097 | |
27098 |
|
27099 |
|
27100 |
|
27101 |
|
27102 |
|
27103 |
|
27104 |
|
27105 |
|
27106 |
|
27107 |
|
27108 | var _default = _metal.Mixin.create({
|
27109 | |
27110 |
|
27111 |
|
27112 |
|
27113 |
|
27114 |
|
27115 |
|
27116 |
|
27117 |
|
27118 |
|
27119 |
|
27120 |
|
27121 |
|
27122 |
|
27123 | compare: null
|
27124 | });
|
27125 |
|
27126 | _exports.default = _default;
|
27127 | });
|
27128 | define("@ember/-internals/runtime/lib/mixins/container_proxy", ["exports", "@ember/runloop", "@ember/-internals/metal"], function (_exports, _runloop, _metal) {
|
27129 | "use strict";
|
27130 |
|
27131 | Object.defineProperty(_exports, "__esModule", {
|
27132 | value: true
|
27133 | });
|
27134 | _exports.default = void 0;
|
27135 |
|
27136 | |
27137 |
|
27138 |
|
27139 |
|
27140 | |
27141 |
|
27142 |
|
27143 |
|
27144 |
|
27145 |
|
27146 |
|
27147 | var containerProxyMixin = {
|
27148 | |
27149 |
|
27150 |
|
27151 |
|
27152 |
|
27153 | __container__: null,
|
27154 |
|
27155 | |
27156 |
|
27157 |
|
27158 |
|
27159 |
|
27160 |
|
27161 |
|
27162 |
|
27163 |
|
27164 |
|
27165 |
|
27166 |
|
27167 |
|
27168 |
|
27169 |
|
27170 |
|
27171 |
|
27172 | ownerInjection() {
|
27173 | return this.__container__.ownerInjection();
|
27174 | },
|
27175 |
|
27176 | |
27177 |
|
27178 |
|
27179 |
|
27180 |
|
27181 |
|
27182 |
|
27183 |
|
27184 |
|
27185 |
|
27186 |
|
27187 |
|
27188 |
|
27189 |
|
27190 |
|
27191 |
|
27192 |
|
27193 |
|
27194 |
|
27195 |
|
27196 |
|
27197 |
|
27198 |
|
27199 |
|
27200 |
|
27201 |
|
27202 |
|
27203 |
|
27204 |
|
27205 |
|
27206 |
|
27207 | lookup(fullName, options) {
|
27208 | return this.__container__.lookup(fullName, options);
|
27209 | },
|
27210 |
|
27211 | destroy() {
|
27212 | var container = this.__container__;
|
27213 |
|
27214 | if (container) {
|
27215 | (0, _runloop.join)(() => {
|
27216 | container.destroy();
|
27217 | (0, _runloop.schedule)('destroy', container, 'finalizeDestroy');
|
27218 | });
|
27219 | }
|
27220 |
|
27221 | this._super();
|
27222 | },
|
27223 |
|
27224 | |
27225 |
|
27226 |
|
27227 |
|
27228 |
|
27229 |
|
27230 |
|
27231 |
|
27232 |
|
27233 |
|
27234 |
|
27235 |
|
27236 |
|
27237 |
|
27238 |
|
27239 |
|
27240 |
|
27241 |
|
27242 |
|
27243 |
|
27244 |
|
27245 |
|
27246 |
|
27247 |
|
27248 |
|
27249 |
|
27250 |
|
27251 |
|
27252 |
|
27253 |
|
27254 |
|
27255 |
|
27256 |
|
27257 | factoryFor(fullName, options = {}) {
|
27258 | return this.__container__.factoryFor(fullName, options);
|
27259 | }
|
27260 |
|
27261 | };
|
27262 |
|
27263 | var _default = _metal.Mixin.create(containerProxyMixin);
|
27264 |
|
27265 | _exports.default = _default;
|
27266 | });
|
27267 | define("@ember/-internals/runtime/lib/mixins/copyable", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
27268 | "use strict";
|
27269 |
|
27270 | Object.defineProperty(_exports, "__esModule", {
|
27271 | value: true
|
27272 | });
|
27273 | _exports.default = void 0;
|
27274 |
|
27275 | |
27276 |
|
27277 |
|
27278 |
|
27279 | |
27280 |
|
27281 |
|
27282 |
|
27283 |
|
27284 |
|
27285 |
|
27286 |
|
27287 |
|
27288 |
|
27289 |
|
27290 |
|
27291 |
|
27292 |
|
27293 | var _default = _metal.Mixin.create({
|
27294 | |
27295 |
|
27296 |
|
27297 |
|
27298 |
|
27299 |
|
27300 |
|
27301 |
|
27302 |
|
27303 | copy: null
|
27304 | });
|
27305 |
|
27306 | _exports.default = _default;
|
27307 | });
|
27308 | define("@ember/-internals/runtime/lib/mixins/enumerable", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
27309 | "use strict";
|
27310 |
|
27311 | Object.defineProperty(_exports, "__esModule", {
|
27312 | value: true
|
27313 | });
|
27314 | _exports.default = void 0;
|
27315 |
|
27316 | |
27317 |
|
27318 |
|
27319 |
|
27320 |
|
27321 | |
27322 |
|
27323 |
|
27324 |
|
27325 |
|
27326 |
|
27327 |
|
27328 |
|
27329 | var _default = _metal.Mixin.create();
|
27330 |
|
27331 | _exports.default = _default;
|
27332 | });
|
27333 | define("@ember/-internals/runtime/lib/mixins/evented", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
27334 | "use strict";
|
27335 |
|
27336 | Object.defineProperty(_exports, "__esModule", {
|
27337 | value: true
|
27338 | });
|
27339 | _exports.default = void 0;
|
27340 |
|
27341 | |
27342 |
|
27343 |
|
27344 |
|
27345 | |
27346 |
|
27347 |
|
27348 |
|
27349 |
|
27350 |
|
27351 |
|
27352 |
|
27353 |
|
27354 |
|
27355 |
|
27356 |
|
27357 |
|
27358 |
|
27359 |
|
27360 |
|
27361 |
|
27362 |
|
27363 |
|
27364 |
|
27365 |
|
27366 |
|
27367 |
|
27368 |
|
27369 |
|
27370 |
|
27371 |
|
27372 |
|
27373 |
|
27374 |
|
27375 |
|
27376 |
|
27377 |
|
27378 |
|
27379 |
|
27380 |
|
27381 |
|
27382 |
|
27383 |
|
27384 |
|
27385 | var _default = _metal.Mixin.create({
|
27386 | |
27387 |
|
27388 |
|
27389 |
|
27390 |
|
27391 |
|
27392 |
|
27393 |
|
27394 |
|
27395 |
|
27396 |
|
27397 |
|
27398 |
|
27399 |
|
27400 |
|
27401 |
|
27402 |
|
27403 |
|
27404 | on(name, target, method) {
|
27405 | (0, _metal.addListener)(this, name, target, method);
|
27406 | return this;
|
27407 | },
|
27408 |
|
27409 | |
27410 |
|
27411 |
|
27412 |
|
27413 |
|
27414 |
|
27415 |
|
27416 |
|
27417 |
|
27418 |
|
27419 |
|
27420 |
|
27421 |
|
27422 |
|
27423 | one(name, target, method) {
|
27424 | (0, _metal.addListener)(this, name, target, method, true);
|
27425 | return this;
|
27426 | },
|
27427 |
|
27428 | |
27429 |
|
27430 |
|
27431 |
|
27432 |
|
27433 |
|
27434 |
|
27435 |
|
27436 |
|
27437 |
|
27438 |
|
27439 |
|
27440 |
|
27441 |
|
27442 |
|
27443 |
|
27444 | trigger(name, ...args) {
|
27445 | (0, _metal.sendEvent)(this, name, args);
|
27446 | },
|
27447 |
|
27448 | |
27449 |
|
27450 |
|
27451 |
|
27452 |
|
27453 |
|
27454 |
|
27455 |
|
27456 |
|
27457 | off(name, target, method) {
|
27458 | (0, _metal.removeListener)(this, name, target, method);
|
27459 | return this;
|
27460 | },
|
27461 |
|
27462 | |
27463 |
|
27464 |
|
27465 |
|
27466 |
|
27467 |
|
27468 |
|
27469 | has(name) {
|
27470 | return (0, _metal.hasListeners)(this, name);
|
27471 | }
|
27472 |
|
27473 | });
|
27474 |
|
27475 | _exports.default = _default;
|
27476 | });
|
27477 | define("@ember/-internals/runtime/lib/mixins/mutable_enumerable", ["exports", "@ember/-internals/runtime/lib/mixins/enumerable", "@ember/-internals/metal"], function (_exports, _enumerable, _metal) {
|
27478 | "use strict";
|
27479 |
|
27480 | Object.defineProperty(_exports, "__esModule", {
|
27481 | value: true
|
27482 | });
|
27483 | _exports.default = void 0;
|
27484 |
|
27485 | |
27486 |
|
27487 |
|
27488 |
|
27489 | |
27490 |
|
27491 |
|
27492 |
|
27493 |
|
27494 |
|
27495 |
|
27496 |
|
27497 |
|
27498 |
|
27499 | var _default = _metal.Mixin.create(_enumerable.default);
|
27500 |
|
27501 | _exports.default = _default;
|
27502 | });
|
27503 | define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-internals/meta", "@ember/-internals/metal", "@ember/debug"], function (_exports, _meta, _metal, _debug) {
|
27504 | "use strict";
|
27505 |
|
27506 | Object.defineProperty(_exports, "__esModule", {
|
27507 | value: true
|
27508 | });
|
27509 | _exports.default = void 0;
|
27510 |
|
27511 | |
27512 |
|
27513 |
|
27514 |
|
27515 | |
27516 |
|
27517 |
|
27518 |
|
27519 |
|
27520 |
|
27521 |
|
27522 |
|
27523 |
|
27524 |
|
27525 |
|
27526 |
|
27527 |
|
27528 |
|
27529 |
|
27530 |
|
27531 |
|
27532 |
|
27533 |
|
27534 |
|
27535 |
|
27536 |
|
27537 |
|
27538 |
|
27539 |
|
27540 |
|
27541 |
|
27542 |
|
27543 |
|
27544 |
|
27545 |
|
27546 |
|
27547 |
|
27548 |
|
27549 |
|
27550 |
|
27551 |
|
27552 |
|
27553 |
|
27554 |
|
27555 |
|
27556 |
|
27557 |
|
27558 |
|
27559 |
|
27560 |
|
27561 |
|
27562 |
|
27563 |
|
27564 |
|
27565 |
|
27566 |
|
27567 |
|
27568 |
|
27569 |
|
27570 |
|
27571 |
|
27572 |
|
27573 |
|
27574 |
|
27575 |
|
27576 |
|
27577 |
|
27578 |
|
27579 |
|
27580 |
|
27581 |
|
27582 |
|
27583 |
|
27584 |
|
27585 | var _default = _metal.Mixin.create({
|
27586 | |
27587 |
|
27588 |
|
27589 |
|
27590 |
|
27591 |
|
27592 |
|
27593 |
|
27594 |
|
27595 |
|
27596 |
|
27597 |
|
27598 |
|
27599 |
|
27600 |
|
27601 |
|
27602 |
|
27603 |
|
27604 |
|
27605 |
|
27606 |
|
27607 |
|
27608 |
|
27609 |
|
27610 |
|
27611 |
|
27612 |
|
27613 |
|
27614 |
|
27615 |
|
27616 |
|
27617 | get(keyName) {
|
27618 | return (0, _metal.get)(this, keyName);
|
27619 | },
|
27620 |
|
27621 | |
27622 |
|
27623 |
|
27624 |
|
27625 |
|
27626 |
|
27627 |
|
27628 |
|
27629 |
|
27630 |
|
27631 |
|
27632 |
|
27633 |
|
27634 |
|
27635 |
|
27636 |
|
27637 |
|
27638 | getProperties(...args) {
|
27639 | return (0, _metal.getProperties)(...[this].concat(args));
|
27640 | },
|
27641 |
|
27642 | |
27643 |
|
27644 |
|
27645 |
|
27646 |
|
27647 |
|
27648 |
|
27649 |
|
27650 |
|
27651 |
|
27652 |
|
27653 |
|
27654 |
|
27655 |
|
27656 |
|
27657 |
|
27658 |
|
27659 |
|
27660 |
|
27661 |
|
27662 |
|
27663 |
|
27664 |
|
27665 |
|
27666 |
|
27667 |
|
27668 |
|
27669 |
|
27670 |
|
27671 |
|
27672 |
|
27673 |
|
27674 |
|
27675 |
|
27676 |
|
27677 | set(keyName, value) {
|
27678 | return (0, _metal.set)(this, keyName, value);
|
27679 | },
|
27680 |
|
27681 | |
27682 |
|
27683 |
|
27684 |
|
27685 |
|
27686 |
|
27687 |
|
27688 |
|
27689 |
|
27690 |
|
27691 |
|
27692 |
|
27693 | setProperties(hash) {
|
27694 | return (0, _metal.setProperties)(this, hash);
|
27695 | },
|
27696 |
|
27697 | |
27698 |
|
27699 |
|
27700 |
|
27701 |
|
27702 |
|
27703 |
|
27704 |
|
27705 |
|
27706 |
|
27707 |
|
27708 |
|
27709 |
|
27710 | beginPropertyChanges() {
|
27711 | (0, _metal.beginPropertyChanges)();
|
27712 | return this;
|
27713 | },
|
27714 |
|
27715 | |
27716 |
|
27717 |
|
27718 |
|
27719 |
|
27720 |
|
27721 |
|
27722 |
|
27723 |
|
27724 |
|
27725 |
|
27726 |
|
27727 | endPropertyChanges() {
|
27728 | (0, _metal.endPropertyChanges)();
|
27729 | return this;
|
27730 | },
|
27731 |
|
27732 | |
27733 |
|
27734 |
|
27735 |
|
27736 |
|
27737 |
|
27738 |
|
27739 |
|
27740 |
|
27741 |
|
27742 |
|
27743 | notifyPropertyChange(keyName) {
|
27744 | (0, _metal.notifyPropertyChange)(this, keyName);
|
27745 | return this;
|
27746 | },
|
27747 |
|
27748 | |
27749 |
|
27750 |
|
27751 |
|
27752 |
|
27753 |
|
27754 |
|
27755 |
|
27756 |
|
27757 |
|
27758 |
|
27759 |
|
27760 |
|
27761 |
|
27762 |
|
27763 |
|
27764 |
|
27765 |
|
27766 |
|
27767 |
|
27768 |
|
27769 |
|
27770 |
|
27771 |
|
27772 |
|
27773 |
|
27774 |
|
27775 |
|
27776 |
|
27777 |
|
27778 |
|
27779 |
|
27780 |
|
27781 |
|
27782 |
|
27783 |
|
27784 |
|
27785 |
|
27786 |
|
27787 |
|
27788 |
|
27789 |
|
27790 |
|
27791 |
|
27792 |
|
27793 |
|
27794 |
|
27795 |
|
27796 |
|
27797 |
|
27798 |
|
27799 |
|
27800 |
|
27801 |
|
27802 |
|
27803 |
|
27804 |
|
27805 |
|
27806 |
|
27807 |
|
27808 |
|
27809 |
|
27810 |
|
27811 |
|
27812 |
|
27813 | addObserver(key, target, method, sync) {
|
27814 | (0, _metal.addObserver)(this, key, target, method, sync);
|
27815 | return this;
|
27816 | },
|
27817 |
|
27818 | |
27819 |
|
27820 |
|
27821 |
|
27822 |
|
27823 |
|
27824 |
|
27825 |
|
27826 |
|
27827 |
|
27828 |
|
27829 |
|
27830 | removeObserver(key, target, method, sync) {
|
27831 | (0, _metal.removeObserver)(this, key, target, method, sync);
|
27832 | return this;
|
27833 | },
|
27834 |
|
27835 | |
27836 |
|
27837 |
|
27838 |
|
27839 |
|
27840 |
|
27841 |
|
27842 |
|
27843 |
|
27844 |
|
27845 | hasObserverFor(key) {
|
27846 | return (0, _metal.hasListeners)(this, `${key}:change`);
|
27847 | },
|
27848 |
|
27849 | |
27850 |
|
27851 |
|
27852 |
|
27853 |
|
27854 |
|
27855 |
|
27856 |
|
27857 |
|
27858 |
|
27859 |
|
27860 |
|
27861 |
|
27862 | getWithDefault(keyName, defaultValue) {
|
27863 | return (0, _metal.getWithDefault)(this, keyName, defaultValue);
|
27864 | },
|
27865 |
|
27866 | |
27867 |
|
27868 |
|
27869 |
|
27870 |
|
27871 |
|
27872 |
|
27873 |
|
27874 |
|
27875 |
|
27876 |
|
27877 |
|
27878 | incrementProperty(keyName, increment = 1) {
|
27879 | (true && !(!isNaN(parseFloat(increment)) && isFinite(increment)) && (0, _debug.assert)('Must pass a numeric value to incrementProperty', !isNaN(parseFloat(increment)) && isFinite(increment)));
|
27880 | return (0, _metal.set)(this, keyName, (parseFloat((0, _metal.get)(this, keyName)) || 0) + increment);
|
27881 | },
|
27882 |
|
27883 | |
27884 |
|
27885 |
|
27886 |
|
27887 |
|
27888 |
|
27889 |
|
27890 |
|
27891 |
|
27892 |
|
27893 |
|
27894 |
|
27895 | decrementProperty(keyName, decrement = 1) {
|
27896 | (true && !(!isNaN(parseFloat(decrement)) && isFinite(decrement)) && (0, _debug.assert)('Must pass a numeric value to decrementProperty', !isNaN(parseFloat(decrement)) && isFinite(decrement)));
|
27897 | return (0, _metal.set)(this, keyName, ((0, _metal.get)(this, keyName) || 0) - decrement);
|
27898 | },
|
27899 |
|
27900 | |
27901 |
|
27902 |
|
27903 |
|
27904 |
|
27905 |
|
27906 |
|
27907 |
|
27908 |
|
27909 |
|
27910 |
|
27911 | toggleProperty(keyName) {
|
27912 | return (0, _metal.set)(this, keyName, !(0, _metal.get)(this, keyName));
|
27913 | },
|
27914 |
|
27915 | |
27916 |
|
27917 |
|
27918 |
|
27919 |
|
27920 |
|
27921 |
|
27922 |
|
27923 |
|
27924 |
|
27925 | cacheFor(keyName) {
|
27926 | var meta = (0, _meta.peekMeta)(this);
|
27927 |
|
27928 | if (meta !== null) {
|
27929 | return meta.valueFor(keyName);
|
27930 | }
|
27931 | }
|
27932 |
|
27933 | });
|
27934 |
|
27935 | _exports.default = _default;
|
27936 | });
|
27937 | define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember/-internals/metal", "@ember/error"], function (_exports, _metal, _error) {
|
27938 | "use strict";
|
27939 |
|
27940 | Object.defineProperty(_exports, "__esModule", {
|
27941 | value: true
|
27942 | });
|
27943 | _exports.default = void 0;
|
27944 |
|
27945 | |
27946 |
|
27947 |
|
27948 | function tap(proxy, promise) {
|
27949 | (0, _metal.setProperties)(proxy, {
|
27950 | isFulfilled: false,
|
27951 | isRejected: false
|
27952 | });
|
27953 | return promise.then(value => {
|
27954 | if (!proxy.isDestroyed && !proxy.isDestroying) {
|
27955 | (0, _metal.setProperties)(proxy, {
|
27956 | content: value,
|
27957 | isFulfilled: true
|
27958 | });
|
27959 | }
|
27960 |
|
27961 | return value;
|
27962 | }, reason => {
|
27963 | if (!proxy.isDestroyed && !proxy.isDestroying) {
|
27964 | (0, _metal.setProperties)(proxy, {
|
27965 | reason,
|
27966 | isRejected: true
|
27967 | });
|
27968 | }
|
27969 |
|
27970 | throw reason;
|
27971 | }, 'Ember: PromiseProxy');
|
27972 | }
|
27973 | |
27974 |
|
27975 |
|
27976 |
|
27977 |
|
27978 |
|
27979 |
|
27980 |
|
27981 |
|
27982 |
|
27983 |
|
27984 |
|
27985 |
|
27986 |
|
27987 |
|
27988 |
|
27989 |
|
27990 |
|
27991 |
|
27992 |
|
27993 |
|
27994 |
|
27995 |
|
27996 |
|
27997 |
|
27998 |
|
27999 |
|
28000 |
|
28001 |
|
28002 |
|
28003 |
|
28004 |
|
28005 |
|
28006 |
|
28007 |
|
28008 |
|
28009 |
|
28010 |
|
28011 |
|
28012 |
|
28013 |
|
28014 |
|
28015 |
|
28016 |
|
28017 |
|
28018 |
|
28019 |
|
28020 |
|
28021 |
|
28022 |
|
28023 |
|
28024 |
|
28025 |
|
28026 |
|
28027 |
|
28028 |
|
28029 |
|
28030 |
|
28031 |
|
28032 |
|
28033 |
|
28034 |
|
28035 |
|
28036 |
|
28037 |
|
28038 | var _default = _metal.Mixin.create({
|
28039 | |
28040 |
|
28041 |
|
28042 |
|
28043 |
|
28044 |
|
28045 |
|
28046 | reason: null,
|
28047 |
|
28048 | |
28049 |
|
28050 |
|
28051 |
|
28052 |
|
28053 |
|
28054 | isPending: (0, _metal.computed)('isSettled', function () {
|
28055 | return !(0, _metal.get)(this, 'isSettled');
|
28056 | }).readOnly(),
|
28057 |
|
28058 | |
28059 |
|
28060 |
|
28061 |
|
28062 |
|
28063 |
|
28064 | isSettled: (0, _metal.computed)('isRejected', 'isFulfilled', function () {
|
28065 | return (0, _metal.get)(this, 'isRejected') || (0, _metal.get)(this, 'isFulfilled');
|
28066 | }).readOnly(),
|
28067 |
|
28068 | |
28069 |
|
28070 |
|
28071 |
|
28072 |
|
28073 |
|
28074 | isRejected: false,
|
28075 |
|
28076 | |
28077 |
|
28078 |
|
28079 |
|
28080 |
|
28081 |
|
28082 | isFulfilled: false,
|
28083 |
|
28084 | |
28085 |
|
28086 |
|
28087 |
|
28088 |
|
28089 |
|
28090 |
|
28091 |
|
28092 |
|
28093 |
|
28094 |
|
28095 |
|
28096 |
|
28097 |
|
28098 |
|
28099 | promise: (0, _metal.computed)({
|
28100 | get() {
|
28101 | throw new _error.default("PromiseProxy's promise must be set");
|
28102 | },
|
28103 |
|
28104 | set(key, promise) {
|
28105 | return tap(this, promise);
|
28106 | }
|
28107 |
|
28108 | }),
|
28109 |
|
28110 | |
28111 |
|
28112 |
|
28113 |
|
28114 |
|
28115 |
|
28116 |
|
28117 |
|
28118 | then: promiseAlias('then'),
|
28119 |
|
28120 | |
28121 |
|
28122 |
|
28123 |
|
28124 |
|
28125 |
|
28126 |
|
28127 |
|
28128 |
|
28129 | catch: promiseAlias('catch'),
|
28130 |
|
28131 | |
28132 |
|
28133 |
|
28134 |
|
28135 |
|
28136 |
|
28137 |
|
28138 |
|
28139 |
|
28140 | finally: promiseAlias('finally')
|
28141 | });
|
28142 |
|
28143 | _exports.default = _default;
|
28144 |
|
28145 | function promiseAlias(name) {
|
28146 | return function () {
|
28147 | var promise = (0, _metal.get)(this, 'promise');
|
28148 | return promise[name](...arguments);
|
28149 | };
|
28150 | }
|
28151 | });
|
28152 | define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@ember/debug", "@ember/-internals/metal"], function (_exports, _debug, _metal) {
|
28153 | "use strict";
|
28154 |
|
28155 | Object.defineProperty(_exports, "__esModule", {
|
28156 | value: true
|
28157 | });
|
28158 | _exports.default = void 0;
|
28159 |
|
28160 | |
28161 |
|
28162 |
|
28163 |
|
28164 | |
28165 |
|
28166 |
|
28167 |
|
28168 |
|
28169 |
|
28170 |
|
28171 | var _default = _metal.Mixin.create({
|
28172 | __registry__: null,
|
28173 |
|
28174 | |
28175 |
|
28176 |
|
28177 |
|
28178 |
|
28179 |
|
28180 |
|
28181 | resolveRegistration(fullName, options) {
|
28182 | (true && !(this.__registry__.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.__registry__.isValidFullName(fullName)));
|
28183 | return this.__registry__.resolve(fullName, options);
|
28184 | },
|
28185 |
|
28186 | |
28187 |
|
28188 |
|
28189 |
|
28190 |
|
28191 |
|
28192 |
|
28193 |
|
28194 |
|
28195 |
|
28196 |
|
28197 |
|
28198 |
|
28199 |
|
28200 |
|
28201 |
|
28202 |
|
28203 |
|
28204 |
|
28205 |
|
28206 |
|
28207 |
|
28208 |
|
28209 |
|
28210 |
|
28211 |
|
28212 |
|
28213 |
|
28214 |
|
28215 |
|
28216 |
|
28217 |
|
28218 |
|
28219 |
|
28220 |
|
28221 |
|
28222 |
|
28223 |
|
28224 |
|
28225 |
|
28226 |
|
28227 |
|
28228 |
|
28229 |
|
28230 |
|
28231 |
|
28232 |
|
28233 |
|
28234 |
|
28235 |
|
28236 |
|
28237 | register: registryAlias('register'),
|
28238 |
|
28239 | |
28240 |
|
28241 |
|
28242 |
|
28243 |
|
28244 |
|
28245 |
|
28246 |
|
28247 |
|
28248 |
|
28249 |
|
28250 |
|
28251 |
|
28252 |
|
28253 |
|
28254 |
|
28255 | unregister: registryAlias('unregister'),
|
28256 |
|
28257 | |
28258 |
|
28259 |
|
28260 |
|
28261 |
|
28262 |
|
28263 |
|
28264 | hasRegistration: registryAlias('has'),
|
28265 |
|
28266 | |
28267 |
|
28268 |
|
28269 |
|
28270 |
|
28271 |
|
28272 |
|
28273 |
|
28274 | registeredOption: registryAlias('getOption'),
|
28275 |
|
28276 | |
28277 |
|
28278 |
|
28279 |
|
28280 |
|
28281 |
|
28282 |
|
28283 | registerOptions: registryAlias('options'),
|
28284 |
|
28285 | |
28286 |
|
28287 |
|
28288 |
|
28289 |
|
28290 |
|
28291 |
|
28292 | registeredOptions: registryAlias('getOptions'),
|
28293 |
|
28294 | |
28295 |
|
28296 |
|
28297 |
|
28298 |
|
28299 |
|
28300 |
|
28301 |
|
28302 |
|
28303 |
|
28304 |
|
28305 |
|
28306 |
|
28307 |
|
28308 |
|
28309 |
|
28310 |
|
28311 |
|
28312 |
|
28313 |
|
28314 |
|
28315 |
|
28316 | registerOptionsForType: registryAlias('optionsForType'),
|
28317 |
|
28318 | |
28319 |
|
28320 |
|
28321 |
|
28322 |
|
28323 |
|
28324 |
|
28325 | registeredOptionsForType: registryAlias('getOptionsForType'),
|
28326 |
|
28327 | |
28328 |
|
28329 |
|
28330 |
|
28331 |
|
28332 |
|
28333 |
|
28334 |
|
28335 |
|
28336 |
|
28337 |
|
28338 |
|
28339 |
|
28340 |
|
28341 |
|
28342 |
|
28343 |
|
28344 |
|
28345 |
|
28346 |
|
28347 |
|
28348 |
|
28349 |
|
28350 |
|
28351 |
|
28352 |
|
28353 |
|
28354 |
|
28355 |
|
28356 |
|
28357 |
|
28358 |
|
28359 |
|
28360 |
|
28361 |
|
28362 |
|
28363 |
|
28364 |
|
28365 |
|
28366 | inject: registryAlias('injection')
|
28367 | });
|
28368 |
|
28369 | _exports.default = _default;
|
28370 |
|
28371 | function registryAlias(name) {
|
28372 | return function () {
|
28373 | return this.__registry__[name](...arguments);
|
28374 | };
|
28375 | }
|
28376 | });
|
28377 | define("@ember/-internals/runtime/lib/mixins/target_action_support", ["exports", "@ember/-internals/environment", "@ember/-internals/metal", "@ember/debug"], function (_exports, _environment, _metal, _debug) {
|
28378 | "use strict";
|
28379 |
|
28380 | Object.defineProperty(_exports, "__esModule", {
|
28381 | value: true
|
28382 | });
|
28383 | _exports.default = void 0;
|
28384 |
|
28385 | |
28386 |
|
28387 |
|
28388 |
|
28389 | |
28390 |
|
28391 |
|
28392 |
|
28393 |
|
28394 |
|
28395 |
|
28396 |
|
28397 |
|
28398 |
|
28399 |
|
28400 |
|
28401 | var _default = _metal.Mixin.create({
|
28402 | target: null,
|
28403 | action: null,
|
28404 | actionContext: null,
|
28405 | actionContextObject: (0, _metal.computed)('actionContext', function () {
|
28406 | var actionContext = (0, _metal.get)(this, 'actionContext');
|
28407 |
|
28408 | if (typeof actionContext === 'string') {
|
28409 | var value = (0, _metal.get)(this, actionContext);
|
28410 |
|
28411 | if (value === undefined) {
|
28412 | value = (0, _metal.get)(_environment.context.lookup, actionContext);
|
28413 | }
|
28414 |
|
28415 | return value;
|
28416 | } else {
|
28417 | return actionContext;
|
28418 | }
|
28419 | }),
|
28420 |
|
28421 | |
28422 |
|
28423 |
|
28424 |
|
28425 |
|
28426 |
|
28427 |
|
28428 |
|
28429 |
|
28430 |
|
28431 |
|
28432 |
|
28433 |
|
28434 |
|
28435 |
|
28436 |
|
28437 |
|
28438 |
|
28439 |
|
28440 |
|
28441 |
|
28442 |
|
28443 |
|
28444 |
|
28445 |
|
28446 |
|
28447 |
|
28448 |
|
28449 |
|
28450 |
|
28451 |
|
28452 |
|
28453 |
|
28454 |
|
28455 |
|
28456 |
|
28457 |
|
28458 |
|
28459 |
|
28460 |
|
28461 |
|
28462 |
|
28463 |
|
28464 |
|
28465 |
|
28466 |
|
28467 |
|
28468 |
|
28469 |
|
28470 | triggerAction(opts = {}) {
|
28471 | var {
|
28472 | action,
|
28473 | target,
|
28474 | actionContext
|
28475 | } = opts;
|
28476 | action = action || (0, _metal.get)(this, 'action');
|
28477 | target = target || getTarget(this);
|
28478 |
|
28479 | if (actionContext === undefined) {
|
28480 | actionContext = (0, _metal.get)(this, 'actionContextObject') || this;
|
28481 | }
|
28482 |
|
28483 | if (target && action) {
|
28484 | var ret;
|
28485 |
|
28486 | if (target.send) {
|
28487 | ret = target.send(...[action].concat(actionContext));
|
28488 | } else {
|
28489 | (true && !(typeof target[action] === 'function') && (0, _debug.assert)(`The action '${action}' did not exist on ${target}`, typeof target[action] === 'function'));
|
28490 | ret = target[action](...[].concat(actionContext));
|
28491 | }
|
28492 |
|
28493 | if (ret !== false) {
|
28494 | return true;
|
28495 | }
|
28496 | }
|
28497 |
|
28498 | return false;
|
28499 | }
|
28500 |
|
28501 | });
|
28502 |
|
28503 | _exports.default = _default;
|
28504 |
|
28505 | function getTarget(instance) {
|
28506 | var target = (0, _metal.get)(instance, 'target');
|
28507 |
|
28508 | if (target) {
|
28509 | if (typeof target === 'string') {
|
28510 | var value = (0, _metal.get)(instance, target);
|
28511 |
|
28512 | if (value === undefined) {
|
28513 | value = (0, _metal.get)(_environment.context.lookup, target);
|
28514 | }
|
28515 |
|
28516 | return value;
|
28517 | } else {
|
28518 | return target;
|
28519 | }
|
28520 | }
|
28521 |
|
28522 | if (instance._target) {
|
28523 | return instance._target;
|
28524 | }
|
28525 |
|
28526 | return null;
|
28527 | }
|
28528 | });
|
28529 | define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-internals/metal", "@ember/-internals/utils", "@ember/-internals/runtime/lib/system/object", "@ember/-internals/runtime/lib/mixins/array", "@ember/debug", "@glimmer/validator"], function (_exports, _metal, _utils, _object, _array, _debug, _validator) {
|
28530 | "use strict";
|
28531 |
|
28532 | Object.defineProperty(_exports, "__esModule", {
|
28533 | value: true
|
28534 | });
|
28535 | _exports.default = void 0;
|
28536 |
|
28537 | |
28538 |
|
28539 |
|
28540 | var ARRAY_OBSERVER_MAPPING = {
|
28541 | willChange: '_arrangedContentArrayWillChange',
|
28542 | didChange: '_arrangedContentArrayDidChange'
|
28543 | };
|
28544 | |
28545 |
|
28546 |
|
28547 |
|
28548 |
|
28549 |
|
28550 |
|
28551 |
|
28552 |
|
28553 |
|
28554 |
|
28555 |
|
28556 |
|
28557 |
|
28558 |
|
28559 |
|
28560 |
|
28561 |
|
28562 |
|
28563 |
|
28564 |
|
28565 |
|
28566 |
|
28567 |
|
28568 |
|
28569 |
|
28570 |
|
28571 |
|
28572 |
|
28573 |
|
28574 |
|
28575 |
|
28576 |
|
28577 |
|
28578 |
|
28579 |
|
28580 |
|
28581 |
|
28582 |
|
28583 |
|
28584 |
|
28585 |
|
28586 |
|
28587 |
|
28588 |
|
28589 |
|
28590 |
|
28591 |
|
28592 |
|
28593 |
|
28594 |
|
28595 |
|
28596 |
|
28597 |
|
28598 |
|
28599 |
|
28600 |
|
28601 |
|
28602 |
|
28603 |
|
28604 |
|
28605 | class ArrayProxy extends _object.default {
|
28606 | init() {
|
28607 | super.init(...arguments);
|
28608 | |
28609 |
|
28610 |
|
28611 |
|
28612 |
|
28613 |
|
28614 |
|
28615 |
|
28616 |
|
28617 | this._objectsDirtyIndex = 0;
|
28618 | this._objects = null;
|
28619 | this._lengthDirty = true;
|
28620 | this._length = 0;
|
28621 | this._arrangedContent = null;
|
28622 | this._arrangedContentIsUpdating = false;
|
28623 | this._arrangedContentTag = null;
|
28624 | this._arrangedContentRevision = null;
|
28625 | this._lengthTag = null;
|
28626 | this._arrTag = null;
|
28627 | }
|
28628 |
|
28629 | [_metal.PROPERTY_DID_CHANGE]() {
|
28630 | this._revalidate();
|
28631 | }
|
28632 |
|
28633 | [_metal.CUSTOM_TAG_FOR](key) {
|
28634 | if (key === '[]') {
|
28635 | this._revalidate();
|
28636 |
|
28637 | return this._arrTag;
|
28638 | } else if (key === 'length') {
|
28639 | this._revalidate();
|
28640 |
|
28641 | return this._lengthTag;
|
28642 | }
|
28643 |
|
28644 | return (0, _validator.tagFor)(this, key);
|
28645 | }
|
28646 |
|
28647 | willDestroy() {
|
28648 | this._removeArrangedContentArrayObserver();
|
28649 | }
|
28650 | |
28651 |
|
28652 |
|
28653 |
|
28654 |
|
28655 |
|
28656 |
|
28657 |
|
28658 | |
28659 |
|
28660 |
|
28661 |
|
28662 |
|
28663 |
|
28664 |
|
28665 |
|
28666 |
|
28667 |
|
28668 |
|
28669 |
|
28670 | objectAtContent(idx) {
|
28671 | return (0, _metal.objectAt)((0, _metal.get)(this, 'arrangedContent'), idx);
|
28672 | }
|
28673 |
|
28674 |
|
28675 |
|
28676 | replace(idx, amt, objects) {
|
28677 | (true && !((0, _metal.get)(this, 'arrangedContent') === (0, _metal.get)(this, 'content')) && (0, _debug.assert)('Mutating an arranged ArrayProxy is not allowed', (0, _metal.get)(this, 'arrangedContent') === (0, _metal.get)(this, 'content')));
|
28678 | this.replaceContent(idx, amt, objects);
|
28679 | }
|
28680 | |
28681 |
|
28682 |
|
28683 |
|
28684 |
|
28685 |
|
28686 |
|
28687 |
|
28688 |
|
28689 |
|
28690 |
|
28691 |
|
28692 |
|
28693 |
|
28694 |
|
28695 | replaceContent(idx, amt, objects) {
|
28696 | (0, _metal.get)(this, 'content').replace(idx, amt, objects);
|
28697 | }
|
28698 |
|
28699 |
|
28700 | objectAt(idx) {
|
28701 | this._revalidate();
|
28702 |
|
28703 | if (this._objects === null) {
|
28704 | this._objects = [];
|
28705 | }
|
28706 |
|
28707 | if (this._objectsDirtyIndex !== -1 && idx >= this._objectsDirtyIndex) {
|
28708 | var arrangedContent = (0, _metal.get)(this, 'arrangedContent');
|
28709 |
|
28710 | if (arrangedContent) {
|
28711 | var length = this._objects.length = (0, _metal.get)(arrangedContent, 'length');
|
28712 |
|
28713 | for (var i = this._objectsDirtyIndex; i < length; i++) {
|
28714 | this._objects[i] = this.objectAtContent(i);
|
28715 | }
|
28716 | } else {
|
28717 | this._objects.length = 0;
|
28718 | }
|
28719 |
|
28720 | this._objectsDirtyIndex = -1;
|
28721 | }
|
28722 |
|
28723 | return this._objects[idx];
|
28724 | }
|
28725 |
|
28726 |
|
28727 | get length() {
|
28728 | this._revalidate();
|
28729 |
|
28730 | if (this._lengthDirty) {
|
28731 | var arrangedContent = (0, _metal.get)(this, 'arrangedContent');
|
28732 | this._length = arrangedContent ? (0, _metal.get)(arrangedContent, 'length') : 0;
|
28733 | this._lengthDirty = false;
|
28734 | }
|
28735 |
|
28736 | (0, _validator.consumeTag)(this._lengthTag);
|
28737 | return this._length;
|
28738 | }
|
28739 |
|
28740 | set length(value) {
|
28741 | var length = this.length;
|
28742 | var removedCount = length - value;
|
28743 | var added;
|
28744 |
|
28745 | if (removedCount === 0) {
|
28746 | return;
|
28747 | } else if (removedCount < 0) {
|
28748 | added = new Array(-removedCount);
|
28749 | removedCount = 0;
|
28750 | }
|
28751 |
|
28752 | var content = (0, _metal.get)(this, 'content');
|
28753 |
|
28754 | if (content) {
|
28755 | (0, _metal.replace)(content, value, removedCount, added);
|
28756 |
|
28757 | this._invalidate();
|
28758 | }
|
28759 | }
|
28760 |
|
28761 | _updateArrangedContentArray(arrangedContent) {
|
28762 | var oldLength = this._objects === null ? 0 : this._objects.length;
|
28763 | var newLength = arrangedContent ? (0, _metal.get)(arrangedContent, 'length') : 0;
|
28764 |
|
28765 | this._removeArrangedContentArrayObserver();
|
28766 |
|
28767 | this.arrayContentWillChange(0, oldLength, newLength);
|
28768 |
|
28769 | this._invalidate();
|
28770 |
|
28771 | this.arrayContentDidChange(0, oldLength, newLength);
|
28772 |
|
28773 | this._addArrangedContentArrayObserver(arrangedContent);
|
28774 | }
|
28775 |
|
28776 | _addArrangedContentArrayObserver(arrangedContent) {
|
28777 | if (arrangedContent && !arrangedContent.isDestroyed) {
|
28778 | (true && !(arrangedContent !== this) && (0, _debug.assert)("Can't set ArrayProxy's content to itself", arrangedContent !== this));
|
28779 | (true && !((0, _array.isArray)(arrangedContent) || arrangedContent.isDestroyed) && (0, _debug.assert)(`ArrayProxy expects an Array or ArrayProxy, but you passed ${typeof arrangedContent}`, (0, _array.isArray)(arrangedContent) || arrangedContent.isDestroyed));
|
28780 | (0, _metal.addArrayObserver)(arrangedContent, this, ARRAY_OBSERVER_MAPPING);
|
28781 | this._arrangedContent = arrangedContent;
|
28782 | }
|
28783 | }
|
28784 |
|
28785 | _removeArrangedContentArrayObserver() {
|
28786 | if (this._arrangedContent) {
|
28787 | (0, _metal.removeArrayObserver)(this._arrangedContent, this, ARRAY_OBSERVER_MAPPING);
|
28788 | }
|
28789 | }
|
28790 |
|
28791 | _arrangedContentArrayWillChange() {}
|
28792 |
|
28793 | _arrangedContentArrayDidChange(proxy, idx, removedCnt, addedCnt) {
|
28794 | this.arrayContentWillChange(idx, removedCnt, addedCnt);
|
28795 | var dirtyIndex = idx;
|
28796 |
|
28797 | if (dirtyIndex < 0) {
|
28798 | var length = (0, _metal.get)(this._arrangedContent, 'length');
|
28799 | dirtyIndex += length + removedCnt - addedCnt;
|
28800 | }
|
28801 |
|
28802 | if (this._objectsDirtyIndex === -1 || this._objectsDirtyIndex > dirtyIndex) {
|
28803 | this._objectsDirtyIndex = dirtyIndex;
|
28804 | }
|
28805 |
|
28806 | this._lengthDirty = true;
|
28807 | this.arrayContentDidChange(idx, removedCnt, addedCnt);
|
28808 | }
|
28809 |
|
28810 | _invalidate() {
|
28811 | this._objectsDirtyIndex = 0;
|
28812 | this._lengthDirty = true;
|
28813 | }
|
28814 |
|
28815 | _revalidate() {
|
28816 | if (this._arrangedContentIsUpdating === true) return;
|
28817 |
|
28818 | if (this._arrangedContentTag === null || !(0, _validator.validateTag)(this._arrangedContentTag, this._arrangedContentRevision)) {
|
28819 | var arrangedContent = this.get('arrangedContent');
|
28820 |
|
28821 | if (this._arrangedContentTag === null) {
|
28822 |
|
28823 |
|
28824 | this._addArrangedContentArrayObserver(arrangedContent);
|
28825 | } else {
|
28826 | this._arrangedContentIsUpdating = true;
|
28827 |
|
28828 | this._updateArrangedContentArray(arrangedContent);
|
28829 |
|
28830 | this._arrangedContentIsUpdating = false;
|
28831 | }
|
28832 |
|
28833 | var arrangedContentTag = this._arrangedContentTag = (0, _validator.tagFor)(this, 'arrangedContent');
|
28834 | this._arrangedContentRevision = (0, _validator.valueForTag)(this._arrangedContentTag);
|
28835 |
|
28836 | if ((0, _utils.isObject)(arrangedContent)) {
|
28837 | this._lengthTag = (0, _validator.combine)([arrangedContentTag, (0, _metal.tagForProperty)(arrangedContent, 'length')]);
|
28838 | this._arrTag = (0, _validator.combine)([arrangedContentTag, (0, _metal.tagForProperty)(arrangedContent, '[]')]);
|
28839 | } else {
|
28840 | this._lengthTag = this._arrTag = arrangedContentTag;
|
28841 | }
|
28842 | }
|
28843 | }
|
28844 |
|
28845 | }
|
28846 |
|
28847 | _exports.default = ArrayProxy;
|
28848 | ArrayProxy.reopen(_array.MutableArray, {
|
28849 | |
28850 |
|
28851 |
|
28852 |
|
28853 |
|
28854 |
|
28855 |
|
28856 | arrangedContent: (0, _metal.alias)('content'),
|
28857 |
|
28858 |
|
28859 |
|
28860 | arrayContentDidChange(startIdx, removeAmt, addAmt) {
|
28861 | return (0, _metal.arrayContentDidChange)(this, startIdx, removeAmt, addAmt, false);
|
28862 | }
|
28863 |
|
28864 | });
|
28865 | });
|
28866 | define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-internals/container", "@ember/-internals/owner", "@ember/polyfills", "@ember/-internals/utils", "@ember/-internals/meta", "@ember/-internals/metal", "@ember/-internals/runtime/lib/mixins/action_handler", "@ember/debug", "@glimmer/runtime"], function (_exports, _container, _owner, _polyfills, _utils, _meta2, _metal, _action_handler, _debug, _runtime) {
|
28867 | "use strict";
|
28868 |
|
28869 | Object.defineProperty(_exports, "__esModule", {
|
28870 | value: true
|
28871 | });
|
28872 | _exports.default = void 0;
|
28873 |
|
28874 | |
28875 |
|
28876 |
|
28877 | var reopen = _metal.Mixin.prototype.reopen;
|
28878 | var wasApplied = new _polyfills._WeakSet();
|
28879 | var prototypeMixinMap = new WeakMap();
|
28880 | var initCalled = true
|
28881 |
|
28882 | ? new _polyfills._WeakSet() : undefined;
|
28883 |
|
28884 | var destroyCalled = new Set();
|
28885 |
|
28886 | function ensureDestroyCalled(instance) {
|
28887 | if (!destroyCalled.has(instance)) {
|
28888 | instance.destroy();
|
28889 | }
|
28890 | }
|
28891 |
|
28892 | function initialize(obj, properties) {
|
28893 | var m = (0, _meta2.meta)(obj);
|
28894 |
|
28895 | if (properties !== undefined) {
|
28896 | (true && !(typeof properties === 'object' && properties !== null) && (0, _debug.assert)('EmberObject.create only accepts objects.', typeof properties === 'object' && properties !== null));
|
28897 | (true && !(!(properties instanceof _metal.Mixin)) && (0, _debug.assert)('EmberObject.create no longer supports mixing in other ' + 'definitions, use .extend & .create separately instead.', !(properties instanceof _metal.Mixin)));
|
28898 | var concatenatedProperties = obj.concatenatedProperties;
|
28899 | var mergedProperties = obj.mergedProperties;
|
28900 | var hasConcatenatedProps = concatenatedProperties !== undefined && concatenatedProperties.length > 0;
|
28901 | var hasMergedProps = mergedProperties !== undefined && mergedProperties.length > 0;
|
28902 | var keyNames = Object.keys(properties);
|
28903 |
|
28904 | for (var i = 0; i < keyNames.length; i++) {
|
28905 | var keyName = keyNames[i];
|
28906 | var value = properties[keyName];
|
28907 | (true && !(!(0, _metal.isClassicDecorator)(value)) && (0, _debug.assert)('EmberObject.create no longer supports defining computed ' + 'properties. Define computed properties using extend() or reopen() ' + 'before calling create().', !(0, _metal.isClassicDecorator)(value)));
|
28908 | (true && !(!(typeof value === 'function' && value.toString().indexOf('._super') !== -1)) && (0, _debug.assert)('EmberObject.create no longer supports defining methods that call _super.', !(typeof value === 'function' && value.toString().indexOf('._super') !== -1)));
|
28909 | (true && !(!(keyName === 'actions' && _action_handler.default.detect(obj))) && (0, _debug.assert)('`actions` must be provided at extend time, not at create time, ' + 'when Ember.ActionHandler is used (i.e. views, controllers & routes).', !(keyName === 'actions' && _action_handler.default.detect(obj))));
|
28910 | var possibleDesc = (0, _metal.descriptorForProperty)(obj, keyName, m);
|
28911 | var isDescriptor = possibleDesc !== undefined;
|
28912 |
|
28913 | if (!isDescriptor) {
|
28914 | if (hasConcatenatedProps && concatenatedProperties.indexOf(keyName) > -1) {
|
28915 | var baseValue = obj[keyName];
|
28916 |
|
28917 | if (baseValue) {
|
28918 | value = (0, _utils.makeArray)(baseValue).concat(value);
|
28919 | } else {
|
28920 | value = (0, _utils.makeArray)(value);
|
28921 | }
|
28922 | }
|
28923 |
|
28924 | if (hasMergedProps && mergedProperties.indexOf(keyName) > -1) {
|
28925 | var _baseValue = obj[keyName];
|
28926 | value = (0, _polyfills.assign)({}, _baseValue, value);
|
28927 | }
|
28928 | }
|
28929 |
|
28930 | if (isDescriptor) {
|
28931 | possibleDesc.set(obj, keyName, value);
|
28932 | } else if (typeof obj.setUnknownProperty === 'function' && !(keyName in obj)) {
|
28933 | obj.setUnknownProperty(keyName, value);
|
28934 | } else {
|
28935 | if (true
|
28936 |
|
28937 | ) {
|
28938 | (0, _metal.defineProperty)(obj, keyName, null, value, m);
|
28939 | } else {
|
28940 | obj[keyName] = value;
|
28941 | }
|
28942 | }
|
28943 | }
|
28944 | }
|
28945 |
|
28946 |
|
28947 | if (true
|
28948 |
|
28949 | ) {
|
28950 | initCalled.add(obj);
|
28951 | }
|
28952 |
|
28953 | obj.init(properties);
|
28954 | m.unsetInitializing();
|
28955 | var observerEvents = m.observerEvents();
|
28956 |
|
28957 | if (observerEvents !== undefined) {
|
28958 | for (var _i = 0; _i < observerEvents.length; _i++) {
|
28959 | (0, _metal.activateObserver)(obj, observerEvents[_i].event, observerEvents[_i].sync);
|
28960 | }
|
28961 | }
|
28962 |
|
28963 | (0, _metal.sendEvent)(obj, 'init', undefined, undefined, undefined, m);
|
28964 | }
|
28965 | |
28966 |
|
28967 |
|
28968 |
|
28969 |
|
28970 |
|
28971 |
|
28972 |
|
28973 |
|
28974 |
|
28975 |
|
28976 |
|
28977 |
|
28978 |
|
28979 |
|
28980 |
|
28981 |
|
28982 |
|
28983 |
|
28984 |
|
28985 |
|
28986 |
|
28987 |
|
28988 |
|
28989 |
|
28990 |
|
28991 |
|
28992 |
|
28993 |
|
28994 |
|
28995 |
|
28996 |
|
28997 |
|
28998 |
|
28999 |
|
29000 |
|
29001 |
|
29002 |
|
29003 |
|
29004 |
|
29005 |
|
29006 |
|
29007 |
|
29008 |
|
29009 |
|
29010 |
|
29011 |
|
29012 |
|
29013 |
|
29014 |
|
29015 |
|
29016 |
|
29017 |
|
29018 |
|
29019 |
|
29020 |
|
29021 |
|
29022 |
|
29023 |
|
29024 |
|
29025 |
|
29026 |
|
29027 |
|
29028 | class CoreObject {
|
29029 | constructor(owner) {
|
29030 |
|
29031 |
|
29032 |
|
29033 | this[_owner.OWNER] = owner;
|
29034 |
|
29035 | this.constructor.proto();
|
29036 | var self = this;
|
29037 |
|
29038 | if (true
|
29039 |
|
29040 | && _utils.HAS_NATIVE_PROXY && typeof self.unknownProperty === 'function') {
|
29041 | var messageFor = (obj, property) => {
|
29042 | return `You attempted to access the \`${String(property)}\` property (of ${obj}).\n` + `Since Ember 3.1, this is usually fine as you no longer need to use \`.get()\`\n` + `to access computed properties. However, in this case, the object in question\n` + `is a special kind of Ember object (a proxy). Therefore, it is still necessary\n` + `to use \`.get('${String(property)}')\` in this case.\n\n` + `If you encountered this error because of third-party code that you don't control,\n` + `there is more information at https://github.com/emberjs/ember.js/issues/16148, and\n` + `you can help us improve this error message by telling us more about what happened in\n` + `this situation.`;
|
29043 | };
|
29044 |
|
29045 |
|
29046 |
|
29047 | self = new Proxy(this, {
|
29048 | get(target, property, receiver) {
|
29049 | if (property === _metal.PROXY_CONTENT) {
|
29050 | return target;
|
29051 | } else if (
|
29052 | !initCalled.has(receiver) || typeof property === 'symbol' || (0, _utils.isInternalSymbol)(property) || property === 'toJSON' || property === 'toString' || property === 'toStringExtension' || property === 'didDefineProperty' || property === 'willWatchProperty' || property === 'didUnwatchProperty' || property === 'didAddListener' || property === 'didRemoveListener' || property === 'isDescriptor' || property === '_onLookup' || property in target) {
|
29053 | return Reflect.get(target, property, receiver);
|
29054 | }
|
29055 |
|
29056 | var value = target.unknownProperty.call(receiver, property);
|
29057 |
|
29058 | if (typeof value !== 'function') {
|
29059 | (true && !(value === undefined || value === null) && (0, _debug.assert)(messageFor(receiver, property), value === undefined || value === null));
|
29060 | }
|
29061 | }
|
29062 |
|
29063 | });
|
29064 | }
|
29065 |
|
29066 | (0, _runtime.registerDestructor)(self, ensureDestroyCalled, true);
|
29067 | (0, _runtime.registerDestructor)(self, () => self.willDestroy());
|
29068 |
|
29069 | var m = (0, _meta2.meta)(self);
|
29070 | m.setInitializing();
|
29071 |
|
29072 | if (true
|
29073 |
|
29074 | && self !== this) {
|
29075 | return self;
|
29076 | }
|
29077 | }
|
29078 |
|
29079 |
|
29080 |
|
29081 | set [_owner.LEGACY_OWNER](value) {}
|
29082 |
|
29083 | reopen(...args) {
|
29084 | (0, _metal.applyMixin)(this, args);
|
29085 | return this;
|
29086 | }
|
29087 | |
29088 |
|
29089 |
|
29090 |
|
29091 |
|
29092 |
|
29093 |
|
29094 |
|
29095 |
|
29096 |
|
29097 |
|
29098 |
|
29099 |
|
29100 |
|
29101 |
|
29102 |
|
29103 |
|
29104 |
|
29105 |
|
29106 |
|
29107 |
|
29108 |
|
29109 |
|
29110 |
|
29111 |
|
29112 |
|
29113 |
|
29114 | init() {}
|
29115 | |
29116 |
|
29117 |
|
29118 |
|
29119 |
|
29120 |
|
29121 |
|
29122 |
|
29123 |
|
29124 |
|
29125 |
|
29126 |
|
29127 |
|
29128 |
|
29129 |
|
29130 |
|
29131 |
|
29132 |
|
29133 |
|
29134 |
|
29135 |
|
29136 |
|
29137 |
|
29138 |
|
29139 |
|
29140 |
|
29141 |
|
29142 |
|
29143 |
|
29144 |
|
29145 |
|
29146 |
|
29147 |
|
29148 |
|
29149 |
|
29150 |
|
29151 |
|
29152 |
|
29153 |
|
29154 |
|
29155 |
|
29156 |
|
29157 |
|
29158 |
|
29159 |
|
29160 |
|
29161 |
|
29162 |
|
29163 |
|
29164 |
|
29165 |
|
29166 |
|
29167 |
|
29168 |
|
29169 |
|
29170 |
|
29171 |
|
29172 |
|
29173 |
|
29174 | |
29175 |
|
29176 |
|
29177 |
|
29178 |
|
29179 |
|
29180 |
|
29181 |
|
29182 |
|
29183 |
|
29184 |
|
29185 |
|
29186 |
|
29187 |
|
29188 |
|
29189 |
|
29190 |
|
29191 |
|
29192 |
|
29193 |
|
29194 |
|
29195 |
|
29196 |
|
29197 |
|
29198 |
|
29199 |
|
29200 |
|
29201 |
|
29202 |
|
29203 |
|
29204 |
|
29205 |
|
29206 |
|
29207 |
|
29208 |
|
29209 |
|
29210 |
|
29211 |
|
29212 |
|
29213 |
|
29214 |
|
29215 |
|
29216 |
|
29217 |
|
29218 |
|
29219 |
|
29220 |
|
29221 |
|
29222 |
|
29223 |
|
29224 |
|
29225 |
|
29226 |
|
29227 |
|
29228 |
|
29229 |
|
29230 |
|
29231 |
|
29232 |
|
29233 |
|
29234 |
|
29235 |
|
29236 | |
29237 |
|
29238 |
|
29239 |
|
29240 |
|
29241 |
|
29242 |
|
29243 |
|
29244 |
|
29245 |
|
29246 | get isDestroyed() {
|
29247 | return (0, _runtime.isDestroyed)(this);
|
29248 | }
|
29249 |
|
29250 | set isDestroyed(value) {
|
29251 | (true && !(false) && (0, _debug.assert)(`You cannot set \`${this}.isDestroyed\` directly, please use \`.destroy()\`.`, false));
|
29252 | }
|
29253 | |
29254 |
|
29255 |
|
29256 |
|
29257 |
|
29258 |
|
29259 |
|
29260 |
|
29261 |
|
29262 |
|
29263 | get isDestroying() {
|
29264 | return (0, _runtime.isDestroying)(this);
|
29265 | }
|
29266 |
|
29267 | set isDestroying(value) {
|
29268 | (true && !(false) && (0, _debug.assert)(`You cannot set \`${this}.isDestroying\` directly, please use \`.destroy()\`.`, false));
|
29269 | }
|
29270 | |
29271 |
|
29272 |
|
29273 |
|
29274 |
|
29275 |
|
29276 |
|
29277 |
|
29278 |
|
29279 |
|
29280 |
|
29281 |
|
29282 |
|
29283 | destroy() {
|
29284 |
|
29285 | destroyCalled.add(this);
|
29286 |
|
29287 | try {
|
29288 | (0, _runtime.destroy)(this);
|
29289 | } finally {
|
29290 | destroyCalled.delete(this);
|
29291 | }
|
29292 |
|
29293 | return this;
|
29294 | }
|
29295 | |
29296 |
|
29297 |
|
29298 |
|
29299 |
|
29300 |
|
29301 |
|
29302 | willDestroy() {}
|
29303 | |
29304 |
|
29305 |
|
29306 |
|
29307 |
|
29308 |
|
29309 |
|
29310 |
|
29311 |
|
29312 |
|
29313 |
|
29314 |
|
29315 |
|
29316 |
|
29317 |
|
29318 |
|
29319 |
|
29320 |
|
29321 |
|
29322 |
|
29323 |
|
29324 |
|
29325 |
|
29326 |
|
29327 |
|
29328 |
|
29329 |
|
29330 |
|
29331 |
|
29332 |
|
29333 |
|
29334 |
|
29335 |
|
29336 |
|
29337 | toString() {
|
29338 | var hasToStringExtension = typeof this.toStringExtension === 'function';
|
29339 | var extension = hasToStringExtension ? `:${this.toStringExtension()}` : '';
|
29340 | var ret = `<${(0, _utils.getName)(this) || (0, _container.getFactoryFor)(this) || this.constructor.toString()}:${(0, _utils.guidFor)(this)}${extension}>`;
|
29341 | return ret;
|
29342 | }
|
29343 | |
29344 |
|
29345 |
|
29346 |
|
29347 |
|
29348 |
|
29349 |
|
29350 |
|
29351 |
|
29352 |
|
29353 |
|
29354 |
|
29355 |
|
29356 |
|
29357 |
|
29358 |
|
29359 |
|
29360 |
|
29361 |
|
29362 |
|
29363 |
|
29364 |
|
29365 |
|
29366 |
|
29367 |
|
29368 |
|
29369 |
|
29370 |
|
29371 |
|
29372 |
|
29373 |
|
29374 |
|
29375 |
|
29376 |
|
29377 |
|
29378 |
|
29379 |
|
29380 |
|
29381 |
|
29382 |
|
29383 |
|
29384 |
|
29385 |
|
29386 |
|
29387 |
|
29388 |
|
29389 |
|
29390 |
|
29391 |
|
29392 |
|
29393 |
|
29394 |
|
29395 |
|
29396 |
|
29397 |
|
29398 |
|
29399 |
|
29400 |
|
29401 |
|
29402 |
|
29403 |
|
29404 |
|
29405 |
|
29406 |
|
29407 |
|
29408 |
|
29409 |
|
29410 |
|
29411 |
|
29412 |
|
29413 |
|
29414 |
|
29415 |
|
29416 |
|
29417 |
|
29418 |
|
29419 | static extend() {
|
29420 | var Class = class extends this {};
|
29421 | reopen.apply(Class.PrototypeMixin, arguments);
|
29422 | return Class;
|
29423 | }
|
29424 | |
29425 |
|
29426 |
|
29427 |
|
29428 |
|
29429 |
|
29430 |
|
29431 |
|
29432 |
|
29433 |
|
29434 |
|
29435 |
|
29436 |
|
29437 |
|
29438 |
|
29439 |
|
29440 |
|
29441 |
|
29442 |
|
29443 |
|
29444 |
|
29445 |
|
29446 |
|
29447 |
|
29448 |
|
29449 |
|
29450 |
|
29451 |
|
29452 |
|
29453 |
|
29454 |
|
29455 |
|
29456 |
|
29457 |
|
29458 | static create(props, extra) {
|
29459 | var instance;
|
29460 |
|
29461 | if (props !== undefined) {
|
29462 | instance = new this((0, _owner.getOwner)(props));
|
29463 | (0, _container.setFactoryFor)(instance, (0, _container.getFactoryFor)(props));
|
29464 | } else {
|
29465 | instance = new this();
|
29466 | }
|
29467 |
|
29468 | if (extra === undefined) {
|
29469 | initialize(instance, props);
|
29470 | } else {
|
29471 | initialize(instance, flattenProps.apply(this, arguments));
|
29472 | }
|
29473 |
|
29474 | return instance;
|
29475 | }
|
29476 | |
29477 |
|
29478 |
|
29479 |
|
29480 |
|
29481 |
|
29482 |
|
29483 |
|
29484 |
|
29485 |
|
29486 |
|
29487 |
|
29488 |
|
29489 |
|
29490 |
|
29491 |
|
29492 |
|
29493 |
|
29494 |
|
29495 |
|
29496 |
|
29497 |
|
29498 |
|
29499 |
|
29500 |
|
29501 |
|
29502 |
|
29503 |
|
29504 | static reopen() {
|
29505 | this.willReopen();
|
29506 | reopen.apply(this.PrototypeMixin, arguments);
|
29507 | return this;
|
29508 | }
|
29509 |
|
29510 | static willReopen() {
|
29511 | var p = this.prototype;
|
29512 |
|
29513 | if (wasApplied.has(p)) {
|
29514 | wasApplied.delete(p);
|
29515 |
|
29516 |
|
29517 |
|
29518 | if (prototypeMixinMap.has(this)) {
|
29519 | prototypeMixinMap.set(this, _metal.Mixin.create(this.PrototypeMixin));
|
29520 | }
|
29521 | }
|
29522 | }
|
29523 | |
29524 |
|
29525 |
|
29526 |
|
29527 |
|
29528 |
|
29529 |
|
29530 |
|
29531 |
|
29532 |
|
29533 |
|
29534 |
|
29535 |
|
29536 |
|
29537 |
|
29538 |
|
29539 |
|
29540 |
|
29541 |
|
29542 |
|
29543 |
|
29544 |
|
29545 |
|
29546 |
|
29547 |
|
29548 |
|
29549 |
|
29550 |
|
29551 |
|
29552 |
|
29553 |
|
29554 |
|
29555 |
|
29556 |
|
29557 |
|
29558 |
|
29559 |
|
29560 |
|
29561 |
|
29562 |
|
29563 |
|
29564 |
|
29565 |
|
29566 |
|
29567 |
|
29568 |
|
29569 |
|
29570 |
|
29571 |
|
29572 | static reopenClass() {
|
29573 | (0, _metal.applyMixin)(this, arguments);
|
29574 | return this;
|
29575 | }
|
29576 |
|
29577 | static detect(obj) {
|
29578 | if ('function' !== typeof obj) {
|
29579 | return false;
|
29580 | }
|
29581 |
|
29582 | while (obj) {
|
29583 | if (obj === this) {
|
29584 | return true;
|
29585 | }
|
29586 |
|
29587 | obj = obj.superclass;
|
29588 | }
|
29589 |
|
29590 | return false;
|
29591 | }
|
29592 |
|
29593 | static detectInstance(obj) {
|
29594 | return obj instanceof this;
|
29595 | }
|
29596 | |
29597 |
|
29598 |
|
29599 |
|
29600 |
|
29601 |
|
29602 |
|
29603 |
|
29604 |
|
29605 |
|
29606 |
|
29607 |
|
29608 |
|
29609 |
|
29610 |
|
29611 |
|
29612 |
|
29613 |
|
29614 |
|
29615 |
|
29616 |
|
29617 |
|
29618 |
|
29619 |
|
29620 |
|
29621 |
|
29622 | static metaForProperty(key) {
|
29623 | var proto = this.proto();
|
29624 |
|
29625 | var possibleDesc = (0, _metal.descriptorForProperty)(proto, key);
|
29626 | (true && !(possibleDesc !== undefined) && (0, _debug.assert)(`metaForProperty() could not find a computed property with key '${key}'.`, possibleDesc !== undefined));
|
29627 | return possibleDesc._meta || {};
|
29628 | }
|
29629 | |
29630 |
|
29631 |
|
29632 |
|
29633 |
|
29634 |
|
29635 |
|
29636 |
|
29637 |
|
29638 |
|
29639 |
|
29640 | static eachComputedProperty(callback, binding = this) {
|
29641 | this.proto();
|
29642 |
|
29643 | var empty = {};
|
29644 | (0, _meta2.meta)(this.prototype).forEachDescriptors((name, descriptor) => {
|
29645 | if (descriptor.enumerable) {
|
29646 | var _meta = descriptor._meta || empty;
|
29647 |
|
29648 | callback.call(binding, name, _meta);
|
29649 | }
|
29650 | });
|
29651 | }
|
29652 |
|
29653 | static get PrototypeMixin() {
|
29654 | var prototypeMixin = prototypeMixinMap.get(this);
|
29655 |
|
29656 | if (prototypeMixin === undefined) {
|
29657 | prototypeMixin = _metal.Mixin.create();
|
29658 | prototypeMixin.ownerConstructor = this;
|
29659 | prototypeMixinMap.set(this, prototypeMixin);
|
29660 | }
|
29661 |
|
29662 | return prototypeMixin;
|
29663 | }
|
29664 |
|
29665 | static get superclass() {
|
29666 | var c = Object.getPrototypeOf(this);
|
29667 | return c !== Function.prototype ? c : undefined;
|
29668 | }
|
29669 |
|
29670 | static proto() {
|
29671 | var p = this.prototype;
|
29672 |
|
29673 | if (!wasApplied.has(p)) {
|
29674 | wasApplied.add(p);
|
29675 | var parent = this.superclass;
|
29676 |
|
29677 | if (parent) {
|
29678 | parent.proto();
|
29679 | }
|
29680 |
|
29681 |
|
29682 |
|
29683 | if (prototypeMixinMap.has(this)) {
|
29684 | this.PrototypeMixin.apply(p);
|
29685 | }
|
29686 | }
|
29687 |
|
29688 | return p;
|
29689 | }
|
29690 |
|
29691 | }
|
29692 |
|
29693 | CoreObject.toString = _metal.classToString;
|
29694 | (0, _utils.setName)(CoreObject, 'Ember.CoreObject');
|
29695 | CoreObject.isClass = true;
|
29696 | CoreObject.isMethod = false;
|
29697 |
|
29698 | function flattenProps(...props) {
|
29699 | var {
|
29700 | concatenatedProperties,
|
29701 | mergedProperties
|
29702 | } = this;
|
29703 | var hasConcatenatedProps = concatenatedProperties !== undefined && concatenatedProperties.length > 0;
|
29704 | var hasMergedProps = mergedProperties !== undefined && mergedProperties.length > 0;
|
29705 | var initProperties = {};
|
29706 |
|
29707 | for (var i = 0; i < props.length; i++) {
|
29708 | var properties = props[i];
|
29709 | (true && !(!(properties instanceof _metal.Mixin)) && (0, _debug.assert)('EmberObject.create no longer supports mixing in other ' + 'definitions, use .extend & .create separately instead.', !(properties instanceof _metal.Mixin)));
|
29710 | var keyNames = Object.keys(properties);
|
29711 |
|
29712 | for (var j = 0, k = keyNames.length; j < k; j++) {
|
29713 | var keyName = keyNames[j];
|
29714 | var value = properties[keyName];
|
29715 |
|
29716 | if (hasConcatenatedProps && concatenatedProperties.indexOf(keyName) > -1) {
|
29717 | var baseValue = initProperties[keyName];
|
29718 |
|
29719 | if (baseValue) {
|
29720 | value = (0, _utils.makeArray)(baseValue).concat(value);
|
29721 | } else {
|
29722 | value = (0, _utils.makeArray)(value);
|
29723 | }
|
29724 | }
|
29725 |
|
29726 | if (hasMergedProps && mergedProperties.indexOf(keyName) > -1) {
|
29727 | var _baseValue2 = initProperties[keyName];
|
29728 | value = (0, _polyfills.assign)({}, _baseValue2, value);
|
29729 | }
|
29730 |
|
29731 | initProperties[keyName] = value;
|
29732 | }
|
29733 | }
|
29734 |
|
29735 | return initProperties;
|
29736 | }
|
29737 |
|
29738 | if (true
|
29739 |
|
29740 | ) {
|
29741 | |
29742 |
|
29743 |
|
29744 |
|
29745 |
|
29746 | CoreObject._onLookup = function injectedPropertyAssertion(debugContainerKey) {
|
29747 | var [type] = debugContainerKey.split(':');
|
29748 | var proto = this.proto();
|
29749 |
|
29750 | for (var key in proto) {
|
29751 | var desc = (0, _metal.descriptorForProperty)(proto, key);
|
29752 |
|
29753 | if (desc && _metal.DEBUG_INJECTION_FUNCTIONS.has(desc._getter)) {
|
29754 | (true && !(type === 'controller' || _metal.DEBUG_INJECTION_FUNCTIONS.get(desc._getter).type !== 'controller') && (0, _debug.assert)(`Defining \`${key}\` as an injected controller property on a non-controller (\`${debugContainerKey}\`) is not allowed.`, type === 'controller' || _metal.DEBUG_INJECTION_FUNCTIONS.get(desc._getter).type !== 'controller'));
|
29755 | }
|
29756 | }
|
29757 | };
|
29758 | |
29759 |
|
29760 |
|
29761 |
|
29762 |
|
29763 |
|
29764 |
|
29765 |
|
29766 |
|
29767 | CoreObject._lazyInjections = function () {
|
29768 | var injections = {};
|
29769 | var proto = this.proto();
|
29770 | var key;
|
29771 | var desc;
|
29772 |
|
29773 | for (key in proto) {
|
29774 | desc = (0, _metal.descriptorForProperty)(proto, key);
|
29775 |
|
29776 | if (desc && _metal.DEBUG_INJECTION_FUNCTIONS.has(desc._getter)) {
|
29777 | var {
|
29778 | namespace,
|
29779 | source,
|
29780 | type,
|
29781 | name
|
29782 | } = _metal.DEBUG_INJECTION_FUNCTIONS.get(desc._getter);
|
29783 |
|
29784 | injections[key] = {
|
29785 | namespace,
|
29786 | source,
|
29787 | specifier: `${type}:${name || key}`
|
29788 | };
|
29789 | }
|
29790 | }
|
29791 |
|
29792 | return injections;
|
29793 | };
|
29794 | }
|
29795 |
|
29796 | if (!_utils.HAS_NATIVE_SYMBOL) {
|
29797 |
|
29798 | var instanceOwner = new WeakMap();
|
29799 | var instanceFactory = new WeakMap();
|
29800 | Object.defineProperty(CoreObject.prototype, _owner.OWNER, {
|
29801 | get() {
|
29802 | return instanceOwner.get(this);
|
29803 | },
|
29804 |
|
29805 | set(value) {
|
29806 | instanceOwner.set(this, value);
|
29807 | }
|
29808 |
|
29809 | });
|
29810 | Object.defineProperty(CoreObject.prototype, _container.INIT_FACTORY, {
|
29811 | get() {
|
29812 | return instanceFactory.get(this);
|
29813 | },
|
29814 |
|
29815 | set(value) {
|
29816 | instanceFactory.set(this, value);
|
29817 | }
|
29818 |
|
29819 | });
|
29820 | }
|
29821 |
|
29822 | var _default = CoreObject;
|
29823 | _exports.default = _default;
|
29824 | });
|
29825 | define("@ember/-internals/runtime/lib/system/namespace", ["exports", "@ember/-internals/metal", "@ember/-internals/utils", "@ember/-internals/runtime/lib/system/object"], function (_exports, _metal, _utils, _object) {
|
29826 | "use strict";
|
29827 |
|
29828 | Object.defineProperty(_exports, "__esModule", {
|
29829 | value: true
|
29830 | });
|
29831 | _exports.default = void 0;
|
29832 |
|
29833 | |
29834 |
|
29835 |
|
29836 |
|
29837 |
|
29838 | |
29839 |
|
29840 |
|
29841 |
|
29842 |
|
29843 |
|
29844 |
|
29845 |
|
29846 |
|
29847 |
|
29848 |
|
29849 |
|
29850 |
|
29851 |
|
29852 |
|
29853 |
|
29854 |
|
29855 |
|
29856 | class Namespace extends _object.default {
|
29857 | init() {
|
29858 | (0, _metal.addNamespace)(this);
|
29859 | }
|
29860 |
|
29861 | toString() {
|
29862 | var name = (0, _metal.get)(this, 'name') || (0, _metal.get)(this, 'modulePrefix');
|
29863 |
|
29864 | if (name) {
|
29865 | return name;
|
29866 | }
|
29867 |
|
29868 | (0, _metal.findNamespaces)();
|
29869 | name = (0, _utils.getName)(this);
|
29870 |
|
29871 | if (name === undefined) {
|
29872 | name = (0, _utils.guidFor)(this);
|
29873 | (0, _utils.setName)(this, name);
|
29874 | }
|
29875 |
|
29876 | return name;
|
29877 | }
|
29878 |
|
29879 | nameClasses() {
|
29880 | (0, _metal.processNamespace)(this);
|
29881 | }
|
29882 |
|
29883 | destroy() {
|
29884 | (0, _metal.removeNamespace)(this);
|
29885 | super.destroy();
|
29886 | }
|
29887 |
|
29888 | }
|
29889 |
|
29890 | _exports.default = Namespace;
|
29891 | Namespace.prototype.isNamespace = true;
|
29892 | Namespace.NAMESPACES = _metal.NAMESPACES;
|
29893 | Namespace.NAMESPACES_BY_ID = _metal.NAMESPACES_BY_ID;
|
29894 | Namespace.processAll = _metal.processAllNamespaces;
|
29895 | Namespace.byName = _metal.findNamespace;
|
29896 | });
|
29897 | define("@ember/-internals/runtime/lib/system/object", ["exports", "@ember/-internals/container", "@ember/-internals/utils", "@ember/-internals/metal", "@ember/-internals/runtime/lib/system/core_object", "@ember/-internals/runtime/lib/mixins/observable", "@ember/debug"], function (_exports, _container, _utils, _metal, _core_object, _observable, _debug) {
|
29898 | "use strict";
|
29899 |
|
29900 | Object.defineProperty(_exports, "__esModule", {
|
29901 | value: true
|
29902 | });
|
29903 | _exports.FrameworkObject = _exports.default = void 0;
|
29904 |
|
29905 | |
29906 |
|
29907 |
|
29908 |
|
29909 | |
29910 |
|
29911 |
|
29912 |
|
29913 |
|
29914 |
|
29915 |
|
29916 |
|
29917 |
|
29918 |
|
29919 | class EmberObject extends _core_object.default {
|
29920 | get _debugContainerKey() {
|
29921 | var factory = (0, _container.getFactoryFor)(this);
|
29922 | return factory !== undefined && factory.fullName;
|
29923 | }
|
29924 |
|
29925 | }
|
29926 |
|
29927 | _exports.default = EmberObject;
|
29928 | (0, _utils.setName)(EmberObject, 'Ember.Object');
|
29929 |
|
29930 | _observable.default.apply(EmberObject.prototype);
|
29931 |
|
29932 | var FrameworkObject;
|
29933 | _exports.FrameworkObject = FrameworkObject;
|
29934 | _exports.FrameworkObject = FrameworkObject = class FrameworkObject extends _core_object.default {
|
29935 | get _debugContainerKey() {
|
29936 | var factory = (0, _container.getFactoryFor)(this);
|
29937 | return factory !== undefined && factory.fullName;
|
29938 | }
|
29939 |
|
29940 | };
|
29941 |
|
29942 | _observable.default.apply(FrameworkObject.prototype);
|
29943 |
|
29944 | if (true
|
29945 |
|
29946 | ) {
|
29947 | var INIT_WAS_CALLED = (0, _utils.symbol)('INIT_WAS_CALLED');
|
29948 | var ASSERT_INIT_WAS_CALLED = (0, _utils.symbol)('ASSERT_INIT_WAS_CALLED');
|
29949 | _exports.FrameworkObject = FrameworkObject = class DebugFrameworkObject extends EmberObject {
|
29950 | init() {
|
29951 | super.init(...arguments);
|
29952 | this[INIT_WAS_CALLED] = true;
|
29953 | }
|
29954 |
|
29955 | [ASSERT_INIT_WAS_CALLED]() {
|
29956 | (true && !(this[INIT_WAS_CALLED]) && (0, _debug.assert)(`You must call \`super.init(...arguments);\` or \`this._super(...arguments)\` when overriding \`init\` on a framework object. Please update ${this} to call \`super.init(...arguments);\` from \`init\` when using native classes or \`this._super(...arguments)\` when using \`EmberObject.extend()\`.`, this[INIT_WAS_CALLED]));
|
29957 | }
|
29958 |
|
29959 | };
|
29960 | (0, _metal.addListener)(FrameworkObject.prototype, 'init', null, ASSERT_INIT_WAS_CALLED);
|
29961 | }
|
29962 | });
|
29963 | define("@ember/-internals/runtime/lib/system/object_proxy", ["exports", "@ember/-internals/runtime/lib/system/object", "@ember/-internals/runtime/lib/mixins/-proxy"], function (_exports, _object, _proxy) {
|
29964 | "use strict";
|
29965 |
|
29966 | Object.defineProperty(_exports, "__esModule", {
|
29967 | value: true
|
29968 | });
|
29969 | _exports.default = void 0;
|
29970 |
|
29971 | |
29972 |
|
29973 |
|
29974 |
|
29975 |
|
29976 |
|
29977 |
|
29978 |
|
29979 |
|
29980 |
|
29981 |
|
29982 |
|
29983 |
|
29984 |
|
29985 |
|
29986 |
|
29987 |
|
29988 |
|
29989 |
|
29990 |
|
29991 |
|
29992 |
|
29993 |
|
29994 |
|
29995 |
|
29996 |
|
29997 |
|
29998 |
|
29999 |
|
30000 |
|
30001 |
|
30002 |
|
30003 |
|
30004 |
|
30005 |
|
30006 |
|
30007 |
|
30008 |
|
30009 |
|
30010 |
|
30011 |
|
30012 |
|
30013 |
|
30014 |
|
30015 |
|
30016 |
|
30017 |
|
30018 |
|
30019 |
|
30020 |
|
30021 |
|
30022 |
|
30023 |
|
30024 |
|
30025 |
|
30026 |
|
30027 |
|
30028 |
|
30029 |
|
30030 |
|
30031 |
|
30032 |
|
30033 |
|
30034 |
|
30035 |
|
30036 |
|
30037 |
|
30038 |
|
30039 |
|
30040 |
|
30041 |
|
30042 |
|
30043 |
|
30044 |
|
30045 |
|
30046 |
|
30047 | class ObjectProxy extends _object.default {}
|
30048 |
|
30049 | _exports.default = ObjectProxy;
|
30050 | ObjectProxy.PrototypeMixin.reopen(_proxy.default);
|
30051 | });
|
30052 | define("@ember/-internals/runtime/lib/type-of", ["exports", "@ember/-internals/runtime/lib/system/core_object"], function (_exports, _core_object) {
|
30053 | "use strict";
|
30054 |
|
30055 | Object.defineProperty(_exports, "__esModule", {
|
30056 | value: true
|
30057 | });
|
30058 | _exports.typeOf = typeOf;
|
30059 |
|
30060 |
|
30061 |
|
30062 | var TYPE_MAP = {
|
30063 | '[object Boolean]': 'boolean',
|
30064 | '[object Number]': 'number',
|
30065 | '[object String]': 'string',
|
30066 | '[object Function]': 'function',
|
30067 | '[object AsyncFunction]': 'function',
|
30068 | '[object Array]': 'array',
|
30069 | '[object Date]': 'date',
|
30070 | '[object RegExp]': 'regexp',
|
30071 | '[object Object]': 'object',
|
30072 | '[object FileList]': 'filelist'
|
30073 | };
|
30074 | var {
|
30075 | toString
|
30076 | } = Object.prototype;
|
30077 | |
30078 |
|
30079 |
|
30080 |
|
30081 | |
30082 |
|
30083 |
|
30084 |
|
30085 |
|
30086 |
|
30087 |
|
30088 |
|
30089 |
|
30090 |
|
30091 |
|
30092 |
|
30093 |
|
30094 |
|
30095 |
|
30096 |
|
30097 |
|
30098 |
|
30099 |
|
30100 |
|
30101 |
|
30102 |
|
30103 |
|
30104 |
|
30105 |
|
30106 |
|
30107 |
|
30108 |
|
30109 |
|
30110 |
|
30111 |
|
30112 |
|
30113 |
|
30114 |
|
30115 |
|
30116 |
|
30117 |
|
30118 |
|
30119 |
|
30120 |
|
30121 |
|
30122 |
|
30123 |
|
30124 |
|
30125 |
|
30126 |
|
30127 |
|
30128 |
|
30129 |
|
30130 |
|
30131 |
|
30132 |
|
30133 |
|
30134 |
|
30135 |
|
30136 |
|
30137 |
|
30138 |
|
30139 |
|
30140 |
|
30141 |
|
30142 |
|
30143 | function typeOf(item) {
|
30144 | if (item === null) {
|
30145 | return 'null';
|
30146 | }
|
30147 |
|
30148 | if (item === undefined) {
|
30149 | return 'undefined';
|
30150 | }
|
30151 |
|
30152 | var ret = TYPE_MAP[toString.call(item)] || 'object';
|
30153 |
|
30154 | if (ret === 'function') {
|
30155 | if (_core_object.default.detect(item)) {
|
30156 | ret = 'class';
|
30157 | }
|
30158 | } else if (ret === 'object') {
|
30159 | if (item instanceof Error) {
|
30160 | ret = 'error';
|
30161 | } else if (item instanceof _core_object.default) {
|
30162 | ret = 'instance';
|
30163 | } else if (item instanceof Date) {
|
30164 | ret = 'date';
|
30165 | }
|
30166 | }
|
30167 |
|
30168 | return ret;
|
30169 | }
|
30170 | });
|
30171 | define("@ember/-internals/utils/index", ["exports", "@ember/polyfills", "@ember/debug"], function (_exports, _polyfills, _debug) {
|
30172 | "use strict";
|
30173 |
|
30174 | Object.defineProperty(_exports, "__esModule", {
|
30175 | value: true
|
30176 | });
|
30177 | _exports.enumerableSymbol = enumerableSymbol;
|
30178 | _exports.isInternalSymbol = isInternalSymbol;
|
30179 | _exports.dictionary = makeDictionary;
|
30180 | _exports.uuid = uuid;
|
30181 | _exports.generateGuid = generateGuid;
|
30182 | _exports.guidFor = guidFor;
|
30183 | _exports.intern = intern;
|
30184 | _exports.wrap = wrap;
|
30185 | _exports.observerListenerMetaFor = observerListenerMetaFor;
|
30186 | _exports.setObservers = setObservers;
|
30187 | _exports.setListeners = setListeners;
|
30188 | _exports.inspect = inspect;
|
30189 | _exports.lookupDescriptor = lookupDescriptor;
|
30190 | _exports.canInvoke = canInvoke;
|
30191 | _exports.tryInvoke = tryInvoke;
|
30192 | _exports.makeArray = makeArray;
|
30193 | _exports.getName = getName;
|
30194 | _exports.setName = setName;
|
30195 | _exports.toString = toString;
|
30196 | _exports.isObject = isObject;
|
30197 | _exports.isProxy = isProxy;
|
30198 | _exports.setProxy = setProxy;
|
30199 | _exports.setEmberArray = setEmberArray;
|
30200 | _exports.isEmberArray = isEmberArray;
|
30201 | _exports.setWithMandatorySetter = _exports.teardownMandatorySetter = _exports.setupMandatorySetter = _exports.Cache = _exports.HAS_NATIVE_PROXY = _exports.HAS_NATIVE_SYMBOL = _exports.ROOT = _exports.checkHasSuper = _exports.GUID_KEY = _exports.getDebugName = _exports.symbol = void 0;
|
30202 |
|
30203 | |
30204 |
|
30205 |
|
30206 |
|
30207 |
|
30208 |
|
30209 |
|
30210 |
|
30211 |
|
30212 |
|
30213 |
|
30214 |
|
30215 |
|
30216 |
|
30217 |
|
30218 |
|
30219 |
|
30220 |
|
30221 |
|
30222 |
|
30223 |
|
30224 |
|
30225 |
|
30226 |
|
30227 |
|
30228 |
|
30229 |
|
30230 |
|
30231 |
|
30232 |
|
30233 |
|
30234 |
|
30235 |
|
30236 |
|
30237 |
|
30238 |
|
30239 |
|
30240 |
|
30241 |
|
30242 | function intern(str) {
|
30243 | var obj = {};
|
30244 | obj[str] = 1;
|
30245 |
|
30246 | for (var key in obj) {
|
30247 | if (key === str) {
|
30248 | return key;
|
30249 | }
|
30250 | }
|
30251 |
|
30252 | return str;
|
30253 | }
|
30254 | |
30255 |
|
30256 |
|
30257 |
|
30258 |
|
30259 |
|
30260 |
|
30261 |
|
30262 |
|
30263 |
|
30264 |
|
30265 |
|
30266 |
|
30267 | function isObject(value) {
|
30268 | return value !== null && (typeof value === 'object' || typeof value === 'function');
|
30269 | }
|
30270 | |
30271 |
|
30272 |
|
30273 |
|
30274 | |
30275 |
|
30276 |
|
30277 |
|
30278 |
|
30279 |
|
30280 |
|
30281 |
|
30282 |
|
30283 | var _uuid = 0;
|
30284 | |
30285 |
|
30286 |
|
30287 |
|
30288 |
|
30289 |
|
30290 |
|
30291 |
|
30292 |
|
30293 | function uuid() {
|
30294 | return ++_uuid;
|
30295 | }
|
30296 | |
30297 |
|
30298 |
|
30299 |
|
30300 |
|
30301 |
|
30302 |
|
30303 |
|
30304 |
|
30305 |
|
30306 | var GUID_PREFIX = 'ember';
|
30307 |
|
30308 | var OBJECT_GUIDS = new WeakMap();
|
30309 | var NON_OBJECT_GUIDS = new Map();
|
30310 | |
30311 |
|
30312 |
|
30313 |
|
30314 |
|
30315 |
|
30316 |
|
30317 |
|
30318 |
|
30319 |
|
30320 |
|
30321 |
|
30322 |
|
30323 |
|
30324 |
|
30325 | var GUID_KEY = intern(`__ember${Date.now()}`);
|
30326 | |
30327 |
|
30328 |
|
30329 |
|
30330 |
|
30331 |
|
30332 |
|
30333 |
|
30334 |
|
30335 |
|
30336 |
|
30337 |
|
30338 |
|
30339 |
|
30340 |
|
30341 |
|
30342 |
|
30343 |
|
30344 |
|
30345 | _exports.GUID_KEY = GUID_KEY;
|
30346 |
|
30347 | function generateGuid(obj, prefix = GUID_PREFIX) {
|
30348 | var guid = prefix + uuid();
|
30349 |
|
30350 | if (isObject(obj)) {
|
30351 | OBJECT_GUIDS.set(obj, guid);
|
30352 | }
|
30353 |
|
30354 | return guid;
|
30355 | }
|
30356 | |
30357 |
|
30358 |
|
30359 |
|
30360 |
|
30361 |
|
30362 |
|
30363 |
|
30364 |
|
30365 |
|
30366 |
|
30367 |
|
30368 |
|
30369 |
|
30370 |
|
30371 |
|
30372 | function guidFor(value) {
|
30373 | var guid;
|
30374 |
|
30375 | if (isObject(value)) {
|
30376 | guid = OBJECT_GUIDS.get(value);
|
30377 |
|
30378 | if (guid === undefined) {
|
30379 | guid = GUID_PREFIX + uuid();
|
30380 | OBJECT_GUIDS.set(value, guid);
|
30381 | }
|
30382 | } else {
|
30383 | guid = NON_OBJECT_GUIDS.get(value);
|
30384 |
|
30385 | if (guid === undefined) {
|
30386 | var type = typeof value;
|
30387 |
|
30388 | if (type === 'string') {
|
30389 | guid = 'st' + uuid();
|
30390 | } else if (type === 'number') {
|
30391 | guid = 'nu' + uuid();
|
30392 | } else if (type === 'symbol') {
|
30393 | guid = 'sy' + uuid();
|
30394 | } else {
|
30395 | guid = '(' + value + ')';
|
30396 | }
|
30397 |
|
30398 | NON_OBJECT_GUIDS.set(value, guid);
|
30399 | }
|
30400 | }
|
30401 |
|
30402 | return guid;
|
30403 | }
|
30404 |
|
30405 | var HAS_NATIVE_SYMBOL = function () {
|
30406 | if (typeof Symbol !== 'function') {
|
30407 | return false;
|
30408 | }
|
30409 |
|
30410 | return typeof Symbol() === 'symbol';
|
30411 | }();
|
30412 |
|
30413 | _exports.HAS_NATIVE_SYMBOL = HAS_NATIVE_SYMBOL;
|
30414 | var GENERATED_SYMBOLS = [];
|
30415 |
|
30416 | function isInternalSymbol(possibleSymbol) {
|
30417 | return GENERATED_SYMBOLS.indexOf(possibleSymbol) !== -1;
|
30418 | }
|
30419 |
|
30420 |
|
30421 |
|
30422 |
|
30423 | function enumerableSymbol(debugName) {
|
30424 |
|
30425 |
|
30426 |
|
30427 | var id = GUID_KEY + Math.floor(Math.random() * Date.now());
|
30428 | var symbol = intern(`__${debugName}${id}__`);
|
30429 |
|
30430 | if (true
|
30431 |
|
30432 | ) {
|
30433 | GENERATED_SYMBOLS.push(symbol);
|
30434 | }
|
30435 |
|
30436 | return symbol;
|
30437 | }
|
30438 |
|
30439 | var symbol = HAS_NATIVE_SYMBOL ? Symbol : enumerableSymbol;
|
30440 |
|
30441 |
|
30442 |
|
30443 |
|
30444 |
|
30445 | _exports.symbol = symbol;
|
30446 |
|
30447 | function makeDictionary(parent) {
|
30448 | var dict = Object.create(parent);
|
30449 | dict['_dict'] = null;
|
30450 | delete dict['_dict'];
|
30451 | return dict;
|
30452 | }
|
30453 |
|
30454 | var getDebugName;
|
30455 |
|
30456 | if (true
|
30457 |
|
30458 | ) {
|
30459 | var getFunctionName = fn => {
|
30460 | var functionName = fn.name;
|
30461 |
|
30462 | if (functionName === undefined) {
|
30463 | var match = Function.prototype.toString.call(fn).match(/function (\w+)\s*\(/);
|
30464 | functionName = match && match[1] || '';
|
30465 | }
|
30466 |
|
30467 | return functionName.replace(/^bound /, '');
|
30468 | };
|
30469 |
|
30470 | var getObjectName = obj => {
|
30471 | var name;
|
30472 | var className;
|
30473 |
|
30474 | if (obj.constructor && obj.constructor !== Object) {
|
30475 | className = getFunctionName(obj.constructor);
|
30476 | }
|
30477 |
|
30478 | if ('toString' in obj && obj.toString !== Object.prototype.toString && obj.toString !== Function.prototype.toString) {
|
30479 | name = obj.toString();
|
30480 | }
|
30481 |
|
30482 |
|
30483 |
|
30484 |
|
30485 |
|
30486 | if (name && name.match(/<.*:ember\d+>/) && className && className[0] !== '_' && className.length > 2 && className !== 'Class') {
|
30487 | return name.replace(/<.*:/, `<${className}:`);
|
30488 | }
|
30489 |
|
30490 | return name || className;
|
30491 | };
|
30492 |
|
30493 | var getPrimitiveName = value => {
|
30494 | return String(value);
|
30495 | };
|
30496 |
|
30497 | getDebugName = value => {
|
30498 | if (typeof value === 'function') {
|
30499 | return getFunctionName(value) || `(unknown function)`;
|
30500 | } else if (typeof value === 'object' && value !== null) {
|
30501 | return getObjectName(value) || `(unknown object)`;
|
30502 | } else {
|
30503 | return getPrimitiveName(value);
|
30504 | }
|
30505 | };
|
30506 | }
|
30507 |
|
30508 | var getDebugName$1 = getDebugName;
|
30509 | _exports.getDebugName = getDebugName$1;
|
30510 | var HAS_SUPER_PATTERN = /\.(_super|call\(this|apply\(this)/;
|
30511 | var fnToString = Function.prototype.toString;
|
30512 |
|
30513 | var checkHasSuper = (() => {
|
30514 | var sourceAvailable = fnToString.call(function () {
|
30515 | return this;
|
30516 | }).indexOf('return this') > -1;
|
30517 |
|
30518 | if (sourceAvailable) {
|
30519 | return function checkHasSuper(func) {
|
30520 | return HAS_SUPER_PATTERN.test(fnToString.call(func));
|
30521 | };
|
30522 | }
|
30523 |
|
30524 | return function checkHasSuper() {
|
30525 | return true;
|
30526 | };
|
30527 | })();
|
30528 |
|
30529 | _exports.checkHasSuper = checkHasSuper;
|
30530 | var HAS_SUPER_MAP = new WeakMap();
|
30531 | var ROOT = Object.freeze(function () {});
|
30532 | _exports.ROOT = ROOT;
|
30533 | HAS_SUPER_MAP.set(ROOT, false);
|
30534 |
|
30535 | function hasSuper(func) {
|
30536 | var hasSuper = HAS_SUPER_MAP.get(func);
|
30537 |
|
30538 | if (hasSuper === undefined) {
|
30539 | hasSuper = checkHasSuper(func);
|
30540 | HAS_SUPER_MAP.set(func, hasSuper);
|
30541 | }
|
30542 |
|
30543 | return hasSuper;
|
30544 | }
|
30545 |
|
30546 | class ObserverListenerMeta {
|
30547 | constructor() {
|
30548 | this.listeners = undefined;
|
30549 | this.observers = undefined;
|
30550 | }
|
30551 |
|
30552 | }
|
30553 |
|
30554 | var OBSERVERS_LISTENERS_MAP = new WeakMap();
|
30555 |
|
30556 | function createObserverListenerMetaFor(fn) {
|
30557 | var meta = OBSERVERS_LISTENERS_MAP.get(fn);
|
30558 |
|
30559 | if (meta === undefined) {
|
30560 | meta = new ObserverListenerMeta();
|
30561 | OBSERVERS_LISTENERS_MAP.set(fn, meta);
|
30562 | }
|
30563 |
|
30564 | return meta;
|
30565 | }
|
30566 |
|
30567 | function observerListenerMetaFor(fn) {
|
30568 | return OBSERVERS_LISTENERS_MAP.get(fn);
|
30569 | }
|
30570 |
|
30571 | function setObservers(func, observers) {
|
30572 | var meta = createObserverListenerMetaFor(func);
|
30573 | meta.observers = observers;
|
30574 | }
|
30575 |
|
30576 | function setListeners(func, listeners) {
|
30577 | var meta = createObserverListenerMetaFor(func);
|
30578 | meta.listeners = listeners;
|
30579 | }
|
30580 |
|
30581 | var IS_WRAPPED_FUNCTION_SET = new _polyfills._WeakSet();
|
30582 | |
30583 |
|
30584 |
|
30585 |
|
30586 |
|
30587 |
|
30588 |
|
30589 |
|
30590 |
|
30591 |
|
30592 |
|
30593 |
|
30594 |
|
30595 | function wrap(func, superFunc) {
|
30596 | if (!hasSuper(func)) {
|
30597 | return func;
|
30598 | }
|
30599 |
|
30600 |
|
30601 | if (!IS_WRAPPED_FUNCTION_SET.has(superFunc) && hasSuper(superFunc)) {
|
30602 | return _wrap(func, _wrap(superFunc, ROOT));
|
30603 | }
|
30604 |
|
30605 | return _wrap(func, superFunc);
|
30606 | }
|
30607 |
|
30608 | function _wrap(func, superFunc) {
|
30609 | function superWrapper() {
|
30610 | var orig = this._super;
|
30611 | this._super = superFunc;
|
30612 | var ret = func.apply(this, arguments);
|
30613 | this._super = orig;
|
30614 | return ret;
|
30615 | }
|
30616 |
|
30617 | IS_WRAPPED_FUNCTION_SET.add(superWrapper);
|
30618 | var meta = OBSERVERS_LISTENERS_MAP.get(func);
|
30619 |
|
30620 | if (meta !== undefined) {
|
30621 | OBSERVERS_LISTENERS_MAP.set(superWrapper, meta);
|
30622 | }
|
30623 |
|
30624 | return superWrapper;
|
30625 | }
|
30626 |
|
30627 | var {
|
30628 | toString: objectToString
|
30629 | } = Object.prototype;
|
30630 | var {
|
30631 | toString: functionToString
|
30632 | } = Function.prototype;
|
30633 | var {
|
30634 | isArray
|
30635 | } = Array;
|
30636 | var {
|
30637 | keys: objectKeys
|
30638 | } = Object;
|
30639 | var {
|
30640 | stringify
|
30641 | } = JSON;
|
30642 | var LIST_LIMIT = 100;
|
30643 | var DEPTH_LIMIT = 4;
|
30644 | var SAFE_KEY = /^[\w$]+$/;
|
30645 | |
30646 |
|
30647 |
|
30648 |
|
30649 | |
30650 |
|
30651 |
|
30652 |
|
30653 |
|
30654 |
|
30655 |
|
30656 |
|
30657 |
|
30658 |
|
30659 |
|
30660 |
|
30661 |
|
30662 |
|
30663 |
|
30664 | function inspect(obj) {
|
30665 |
|
30666 | if (typeof obj === 'number' && arguments.length === 2) {
|
30667 | return this;
|
30668 | }
|
30669 |
|
30670 | return inspectValue(obj, 0);
|
30671 | }
|
30672 |
|
30673 | function inspectValue(value, depth, seen) {
|
30674 | var valueIsArray = false;
|
30675 |
|
30676 | switch (typeof value) {
|
30677 | case 'undefined':
|
30678 | return 'undefined';
|
30679 |
|
30680 | case 'object':
|
30681 | if (value === null) return 'null';
|
30682 |
|
30683 | if (isArray(value)) {
|
30684 | valueIsArray = true;
|
30685 | break;
|
30686 | }
|
30687 |
|
30688 |
|
30689 | if (value.toString === objectToString || value.toString === undefined) {
|
30690 | break;
|
30691 | }
|
30692 |
|
30693 |
|
30694 | return value.toString();
|
30695 |
|
30696 | case 'function':
|
30697 | return value.toString === functionToString ? value.name ? `[Function:${value.name}]` : `[Function]` : value.toString();
|
30698 |
|
30699 | case 'string':
|
30700 | return stringify(value);
|
30701 |
|
30702 | case 'symbol':
|
30703 | case 'boolean':
|
30704 | case 'number':
|
30705 | default:
|
30706 | return value.toString();
|
30707 | }
|
30708 |
|
30709 | if (seen === undefined) {
|
30710 | seen = new _polyfills._WeakSet();
|
30711 | } else {
|
30712 | if (seen.has(value)) return `[Circular]`;
|
30713 | }
|
30714 |
|
30715 | seen.add(value);
|
30716 | return valueIsArray ? inspectArray(value, depth + 1, seen) : inspectObject(value, depth + 1, seen);
|
30717 | }
|
30718 |
|
30719 | function inspectKey(key) {
|
30720 | return SAFE_KEY.test(key) ? key : stringify(key);
|
30721 | }
|
30722 |
|
30723 | function inspectObject(obj, depth, seen) {
|
30724 | if (depth > DEPTH_LIMIT) {
|
30725 | return '[Object]';
|
30726 | }
|
30727 |
|
30728 | var s = '{';
|
30729 | var keys = objectKeys(obj);
|
30730 |
|
30731 | for (var i = 0; i < keys.length; i++) {
|
30732 | s += i === 0 ? ' ' : ', ';
|
30733 |
|
30734 | if (i >= LIST_LIMIT) {
|
30735 | s += `... ${keys.length - LIST_LIMIT} more keys`;
|
30736 | break;
|
30737 | }
|
30738 |
|
30739 | var key = keys[i];
|
30740 | s += inspectKey(key) + ': ' + inspectValue(obj[key], depth, seen);
|
30741 | }
|
30742 |
|
30743 | s += ' }';
|
30744 | return s;
|
30745 | }
|
30746 |
|
30747 | function inspectArray(arr, depth, seen) {
|
30748 | if (depth > DEPTH_LIMIT) {
|
30749 | return '[Array]';
|
30750 | }
|
30751 |
|
30752 | var s = '[';
|
30753 |
|
30754 | for (var i = 0; i < arr.length; i++) {
|
30755 | s += i === 0 ? ' ' : ', ';
|
30756 |
|
30757 | if (i >= LIST_LIMIT) {
|
30758 | s += `... ${arr.length - LIST_LIMIT} more items`;
|
30759 | break;
|
30760 | }
|
30761 |
|
30762 | s += inspectValue(arr[i], depth, seen);
|
30763 | }
|
30764 |
|
30765 | s += ' ]';
|
30766 | return s;
|
30767 | }
|
30768 |
|
30769 | function lookupDescriptor(obj, keyName) {
|
30770 | var current = obj;
|
30771 |
|
30772 | do {
|
30773 | var descriptor = Object.getOwnPropertyDescriptor(current, keyName);
|
30774 |
|
30775 | if (descriptor !== undefined) {
|
30776 | return descriptor;
|
30777 | }
|
30778 |
|
30779 | current = Object.getPrototypeOf(current);
|
30780 | } while (current !== null);
|
30781 |
|
30782 | return null;
|
30783 | }
|
30784 | |
30785 |
|
30786 |
|
30787 |
|
30788 |
|
30789 |
|
30790 |
|
30791 |
|
30792 |
|
30793 |
|
30794 |
|
30795 |
|
30796 |
|
30797 |
|
30798 |
|
30799 |
|
30800 |
|
30801 |
|
30802 |
|
30803 |
|
30804 | function canInvoke(obj, methodName) {
|
30805 | return obj !== null && obj !== undefined && typeof obj[methodName] === 'function';
|
30806 | }
|
30807 | |
30808 |
|
30809 |
|
30810 |
|
30811 | |
30812 |
|
30813 |
|
30814 |
|
30815 |
|
30816 |
|
30817 |
|
30818 |
|
30819 |
|
30820 |
|
30821 |
|
30822 |
|
30823 |
|
30824 |
|
30825 |
|
30826 |
|
30827 |
|
30828 |
|
30829 |
|
30830 |
|
30831 |
|
30832 |
|
30833 |
|
30834 |
|
30835 |
|
30836 | function tryInvoke(obj, methodName, args) {
|
30837 | if (canInvoke(obj, methodName)) {
|
30838 | var method = obj[methodName];
|
30839 | return method.apply(obj, args);
|
30840 | }
|
30841 | }
|
30842 |
|
30843 | var {
|
30844 | isArray: isArray$1
|
30845 | } = Array;
|
30846 |
|
30847 | function makeArray(obj) {
|
30848 | if (obj === null || obj === undefined) {
|
30849 | return [];
|
30850 | }
|
30851 |
|
30852 | return isArray$1(obj) ? obj : [obj];
|
30853 | }
|
30854 |
|
30855 | var NAMES = new WeakMap();
|
30856 |
|
30857 | function setName(obj, name) {
|
30858 | if (isObject(obj)) NAMES.set(obj, name);
|
30859 | }
|
30860 |
|
30861 | function getName(obj) {
|
30862 | return NAMES.get(obj);
|
30863 | }
|
30864 |
|
30865 | var objectToString$1 = Object.prototype.toString;
|
30866 |
|
30867 | function isNone(obj) {
|
30868 | return obj === null || obj === undefined;
|
30869 | }
|
30870 | |
30871 |
|
30872 |
|
30873 |
|
30874 |
|
30875 |
|
30876 | function toString(obj) {
|
30877 | if (typeof obj === 'string') {
|
30878 | return obj;
|
30879 | }
|
30880 |
|
30881 | if (null === obj) return 'null';
|
30882 | if (undefined === obj) return 'undefined';
|
30883 |
|
30884 | if (Array.isArray(obj)) {
|
30885 |
|
30886 |
|
30887 | var r = '';
|
30888 |
|
30889 | for (var k = 0; k < obj.length; k++) {
|
30890 | if (k > 0) {
|
30891 | r += ',';
|
30892 | }
|
30893 |
|
30894 | if (!isNone(obj[k])) {
|
30895 | r += toString(obj[k]);
|
30896 | }
|
30897 | }
|
30898 |
|
30899 | return r;
|
30900 | }
|
30901 |
|
30902 | if (typeof obj.toString === 'function') {
|
30903 | return obj.toString();
|
30904 | }
|
30905 |
|
30906 | return objectToString$1.call(obj);
|
30907 | }
|
30908 |
|
30909 | var HAS_NATIVE_PROXY = typeof Proxy === 'function';
|
30910 | _exports.HAS_NATIVE_PROXY = HAS_NATIVE_PROXY;
|
30911 | var PROXIES = new _polyfills._WeakSet();
|
30912 |
|
30913 | function isProxy(value) {
|
30914 | if (isObject(value)) {
|
30915 | return PROXIES.has(value);
|
30916 | }
|
30917 |
|
30918 | return false;
|
30919 | }
|
30920 |
|
30921 | function setProxy(object) {
|
30922 | if (isObject(object)) {
|
30923 | PROXIES.add(object);
|
30924 | }
|
30925 | }
|
30926 |
|
30927 | class Cache {
|
30928 | constructor(limit, func, store) {
|
30929 | this.limit = limit;
|
30930 | this.func = func;
|
30931 | this.store = store;
|
30932 | this.size = 0;
|
30933 | this.misses = 0;
|
30934 | this.hits = 0;
|
30935 | this.store = store || new Map();
|
30936 | }
|
30937 |
|
30938 | get(key) {
|
30939 | if (this.store.has(key)) {
|
30940 | this.hits++;
|
30941 | return this.store.get(key);
|
30942 | } else {
|
30943 | this.misses++;
|
30944 | return this.set(key, this.func(key));
|
30945 | }
|
30946 | }
|
30947 |
|
30948 | set(key, value) {
|
30949 | if (this.limit > this.size) {
|
30950 | this.size++;
|
30951 | this.store.set(key, value);
|
30952 | }
|
30953 |
|
30954 | return value;
|
30955 | }
|
30956 |
|
30957 | purge() {
|
30958 | this.store.clear();
|
30959 | this.size = 0;
|
30960 | this.hits = 0;
|
30961 | this.misses = 0;
|
30962 | }
|
30963 |
|
30964 | }
|
30965 |
|
30966 | _exports.Cache = Cache;
|
30967 | var EMBER_ARRAYS = new _polyfills._WeakSet();
|
30968 |
|
30969 | function setEmberArray(obj) {
|
30970 | EMBER_ARRAYS.add(obj);
|
30971 | }
|
30972 |
|
30973 | function isEmberArray(obj) {
|
30974 | return EMBER_ARRAYS.has(obj);
|
30975 | }
|
30976 |
|
30977 | var setupMandatorySetter;
|
30978 | _exports.setupMandatorySetter = setupMandatorySetter;
|
30979 | var teardownMandatorySetter;
|
30980 | _exports.teardownMandatorySetter = teardownMandatorySetter;
|
30981 | var setWithMandatorySetter;
|
30982 | _exports.setWithMandatorySetter = setWithMandatorySetter;
|
30983 |
|
30984 | function isElementKey(key) {
|
30985 | return typeof key === 'number' ? isPositiveInt(key) : isStringInt(key);
|
30986 | }
|
30987 |
|
30988 | function isStringInt(str) {
|
30989 | var num = parseInt(str, 10);
|
30990 | return isPositiveInt(num) && str === String(num);
|
30991 | }
|
30992 |
|
30993 | function isPositiveInt(num) {
|
30994 | return num >= 0 && num % 1 === 0;
|
30995 | }
|
30996 |
|
30997 | if (true
|
30998 |
|
30999 | ) {
|
31000 | var SEEN_TAGS = new _polyfills._WeakSet();
|
31001 | var MANDATORY_SETTERS = new WeakMap();
|
31002 |
|
31003 | var _propertyIsEnumerable = function (obj, key) {
|
31004 | return Object.prototype.propertyIsEnumerable.call(obj, key);
|
31005 | };
|
31006 |
|
31007 | _exports.setupMandatorySetter = setupMandatorySetter = function (tag, obj, keyName) {
|
31008 | if (SEEN_TAGS.has(tag)) {
|
31009 | return;
|
31010 | }
|
31011 |
|
31012 | SEEN_TAGS.add(tag);
|
31013 |
|
31014 | if (Array.isArray(obj) && isElementKey(keyName)) {
|
31015 | return;
|
31016 | }
|
31017 |
|
31018 | var desc = lookupDescriptor(obj, keyName) || {};
|
31019 |
|
31020 | if (desc.get || desc.set) {
|
31021 |
|
31022 |
|
31023 |
|
31024 | return;
|
31025 | }
|
31026 |
|
31027 | if (desc && (!desc.configurable || !desc.writable)) {
|
31028 |
|
31029 |
|
31030 | return;
|
31031 | }
|
31032 |
|
31033 | var setters = MANDATORY_SETTERS.get(obj);
|
31034 |
|
31035 | if (setters === undefined) {
|
31036 | setters = {};
|
31037 | MANDATORY_SETTERS.set(obj, setters);
|
31038 | }
|
31039 |
|
31040 | desc.hadOwnProperty = Object.hasOwnProperty.call(obj, keyName);
|
31041 | setters[keyName] = desc;
|
31042 | Object.defineProperty(obj, keyName, {
|
31043 | configurable: true,
|
31044 | enumerable: _propertyIsEnumerable(obj, keyName),
|
31045 |
|
31046 | get() {
|
31047 | if (desc.get) {
|
31048 | return desc.get.call(this);
|
31049 | } else {
|
31050 | return desc.value;
|
31051 | }
|
31052 | },
|
31053 |
|
31054 | set(value) {
|
31055 | (true && !(false) && (0, _debug.assert)(`You attempted to update ${this}.${String(keyName)} to "${String(value)}", but it is being tracked by a tracking context, such as a template, computed property, or observer. In order to make sure the context updates properly, you must invalidate the property when updating it. You can mark the property as \`@tracked\`, or use \`@ember/object#set\` to do this.`));
|
31056 | }
|
31057 |
|
31058 | });
|
31059 | };
|
31060 |
|
31061 | _exports.teardownMandatorySetter = teardownMandatorySetter = function (obj, keyName) {
|
31062 | var setters = MANDATORY_SETTERS.get(obj);
|
31063 |
|
31064 | if (setters !== undefined && setters[keyName] !== undefined) {
|
31065 | Object.defineProperty(obj, keyName, setters[keyName]);
|
31066 | setters[keyName] = undefined;
|
31067 | }
|
31068 | };
|
31069 |
|
31070 | _exports.setWithMandatorySetter = setWithMandatorySetter = function (obj, keyName, value) {
|
31071 | var setters = MANDATORY_SETTERS.get(obj);
|
31072 |
|
31073 | if (setters !== undefined && setters[keyName] !== undefined) {
|
31074 | var setter = setters[keyName];
|
31075 |
|
31076 | if (setter.set) {
|
31077 | setter.set.call(obj, value);
|
31078 | } else {
|
31079 | setter.value = value;
|
31080 |
|
31081 |
|
31082 | if (!setter.hadOwnProperty) {
|
31083 | var desc = lookupDescriptor(obj, keyName);
|
31084 | desc.enumerable = true;
|
31085 | Object.defineProperty(obj, keyName, desc);
|
31086 | }
|
31087 | }
|
31088 | } else {
|
31089 | obj[keyName] = value;
|
31090 | }
|
31091 | };
|
31092 | }
|
31093 | |
31094 |
|
31095 |
|
31096 |
|
31097 |
|
31098 |
|
31099 |
|
31100 |
|
31101 |
|
31102 |
|
31103 |
|
31104 | });
|
31105 | define("@ember/-internals/views/index", ["exports", "@ember/-internals/views/lib/system/jquery", "@ember/-internals/views/lib/system/utils", "@ember/-internals/views/lib/system/event_dispatcher", "@ember/-internals/views/lib/component_lookup", "@ember/-internals/views/lib/mixins/text_support", "@ember/-internals/views/lib/views/core_view", "@ember/-internals/views/lib/mixins/class_names_support", "@ember/-internals/views/lib/mixins/child_views_support", "@ember/-internals/views/lib/mixins/view_state_support", "@ember/-internals/views/lib/mixins/view_support", "@ember/-internals/views/lib/mixins/action_support", "@ember/-internals/views/lib/compat/attrs", "@ember/-internals/views/lib/system/action_manager"], function (_exports, _jquery, _utils, _event_dispatcher, _component_lookup, _text_support, _core_view, _class_names_support, _child_views_support, _view_state_support, _view_support, _action_support, _attrs, _action_manager) {
|
31106 | "use strict";
|
31107 |
|
31108 | Object.defineProperty(_exports, "__esModule", {
|
31109 | value: true
|
31110 | });
|
31111 | Object.defineProperty(_exports, "jQuery", {
|
31112 | enumerable: true,
|
31113 | get: function () {
|
31114 | return _jquery.jQuery;
|
31115 | }
|
31116 | });
|
31117 | Object.defineProperty(_exports, "jQueryDisabled", {
|
31118 | enumerable: true,
|
31119 | get: function () {
|
31120 | return _jquery.jQueryDisabled;
|
31121 | }
|
31122 | });
|
31123 | Object.defineProperty(_exports, "addChildView", {
|
31124 | enumerable: true,
|
31125 | get: function () {
|
31126 | return _utils.addChildView;
|
31127 | }
|
31128 | });
|
31129 | Object.defineProperty(_exports, "isSimpleClick", {
|
31130 | enumerable: true,
|
31131 | get: function () {
|
31132 | return _utils.isSimpleClick;
|
31133 | }
|
31134 | });
|
31135 | Object.defineProperty(_exports, "getViewBounds", {
|
31136 | enumerable: true,
|
31137 | get: function () {
|
31138 | return _utils.getViewBounds;
|
31139 | }
|
31140 | });
|
31141 | Object.defineProperty(_exports, "getViewClientRects", {
|
31142 | enumerable: true,
|
31143 | get: function () {
|
31144 | return _utils.getViewClientRects;
|
31145 | }
|
31146 | });
|
31147 | Object.defineProperty(_exports, "getViewBoundingClientRect", {
|
31148 | enumerable: true,
|
31149 | get: function () {
|
31150 | return _utils.getViewBoundingClientRect;
|
31151 | }
|
31152 | });
|
31153 | Object.defineProperty(_exports, "getRootViews", {
|
31154 | enumerable: true,
|
31155 | get: function () {
|
31156 | return _utils.getRootViews;
|
31157 | }
|
31158 | });
|
31159 | Object.defineProperty(_exports, "getChildViews", {
|
31160 | enumerable: true,
|
31161 | get: function () {
|
31162 | return _utils.getChildViews;
|
31163 | }
|
31164 | });
|
31165 | Object.defineProperty(_exports, "getViewId", {
|
31166 | enumerable: true,
|
31167 | get: function () {
|
31168 | return _utils.getViewId;
|
31169 | }
|
31170 | });
|
31171 | Object.defineProperty(_exports, "getElementView", {
|
31172 | enumerable: true,
|
31173 | get: function () {
|
31174 | return _utils.getElementView;
|
31175 | }
|
31176 | });
|
31177 | Object.defineProperty(_exports, "getViewElement", {
|
31178 | enumerable: true,
|
31179 | get: function () {
|
31180 | return _utils.getViewElement;
|
31181 | }
|
31182 | });
|
31183 | Object.defineProperty(_exports, "setElementView", {
|
31184 | enumerable: true,
|
31185 | get: function () {
|
31186 | return _utils.setElementView;
|
31187 | }
|
31188 | });
|
31189 | Object.defineProperty(_exports, "setViewElement", {
|
31190 | enumerable: true,
|
31191 | get: function () {
|
31192 | return _utils.setViewElement;
|
31193 | }
|
31194 | });
|
31195 | Object.defineProperty(_exports, "clearElementView", {
|
31196 | enumerable: true,
|
31197 | get: function () {
|
31198 | return _utils.clearElementView;
|
31199 | }
|
31200 | });
|
31201 | Object.defineProperty(_exports, "clearViewElement", {
|
31202 | enumerable: true,
|
31203 | get: function () {
|
31204 | return _utils.clearViewElement;
|
31205 | }
|
31206 | });
|
31207 | Object.defineProperty(_exports, "constructStyleDeprecationMessage", {
|
31208 | enumerable: true,
|
31209 | get: function () {
|
31210 | return _utils.constructStyleDeprecationMessage;
|
31211 | }
|
31212 | });
|
31213 | Object.defineProperty(_exports, "EventDispatcher", {
|
31214 | enumerable: true,
|
31215 | get: function () {
|
31216 | return _event_dispatcher.default;
|
31217 | }
|
31218 | });
|
31219 | Object.defineProperty(_exports, "ComponentLookup", {
|
31220 | enumerable: true,
|
31221 | get: function () {
|
31222 | return _component_lookup.default;
|
31223 | }
|
31224 | });
|
31225 | Object.defineProperty(_exports, "TextSupport", {
|
31226 | enumerable: true,
|
31227 | get: function () {
|
31228 | return _text_support.default;
|
31229 | }
|
31230 | });
|
31231 | Object.defineProperty(_exports, "CoreView", {
|
31232 | enumerable: true,
|
31233 | get: function () {
|
31234 | return _core_view.default;
|
31235 | }
|
31236 | });
|
31237 | Object.defineProperty(_exports, "ClassNamesSupport", {
|
31238 | enumerable: true,
|
31239 | get: function () {
|
31240 | return _class_names_support.default;
|
31241 | }
|
31242 | });
|
31243 | Object.defineProperty(_exports, "ChildViewsSupport", {
|
31244 | enumerable: true,
|
31245 | get: function () {
|
31246 | return _child_views_support.default;
|
31247 | }
|
31248 | });
|
31249 | Object.defineProperty(_exports, "ViewStateSupport", {
|
31250 | enumerable: true,
|
31251 | get: function () {
|
31252 | return _view_state_support.default;
|
31253 | }
|
31254 | });
|
31255 | Object.defineProperty(_exports, "ViewMixin", {
|
31256 | enumerable: true,
|
31257 | get: function () {
|
31258 | return _view_support.default;
|
31259 | }
|
31260 | });
|
31261 | Object.defineProperty(_exports, "ActionSupport", {
|
31262 | enumerable: true,
|
31263 | get: function () {
|
31264 | return _action_support.default;
|
31265 | }
|
31266 | });
|
31267 | Object.defineProperty(_exports, "MUTABLE_CELL", {
|
31268 | enumerable: true,
|
31269 | get: function () {
|
31270 | return _attrs.MUTABLE_CELL;
|
31271 | }
|
31272 | });
|
31273 | Object.defineProperty(_exports, "ActionManager", {
|
31274 | enumerable: true,
|
31275 | get: function () {
|
31276 | return _action_manager.default;
|
31277 | }
|
31278 | });
|
31279 | });
|
31280 | define("@ember/-internals/views/lib/compat/attrs", ["exports", "@ember/-internals/utils"], function (_exports, _utils) {
|
31281 | "use strict";
|
31282 |
|
31283 | Object.defineProperty(_exports, "__esModule", {
|
31284 | value: true
|
31285 | });
|
31286 | _exports.MUTABLE_CELL = void 0;
|
31287 | var MUTABLE_CELL = (0, _utils.symbol)('MUTABLE_CELL');
|
31288 | _exports.MUTABLE_CELL = MUTABLE_CELL;
|
31289 | });
|
31290 | define("@ember/-internals/views/lib/compat/fallback-view-registry", ["exports", "@ember/-internals/utils"], function (_exports, _utils) {
|
31291 | "use strict";
|
31292 |
|
31293 | Object.defineProperty(_exports, "__esModule", {
|
31294 | value: true
|
31295 | });
|
31296 | _exports.default = void 0;
|
31297 |
|
31298 | var _default = (0, _utils.dictionary)(null);
|
31299 |
|
31300 | _exports.default = _default;
|
31301 | });
|
31302 | define("@ember/-internals/views/lib/component_lookup", ["exports", "@ember/-internals/runtime"], function (_exports, _runtime) {
|
31303 | "use strict";
|
31304 |
|
31305 | Object.defineProperty(_exports, "__esModule", {
|
31306 | value: true
|
31307 | });
|
31308 | _exports.default = void 0;
|
31309 |
|
31310 | var _default = _runtime.Object.extend({
|
31311 | componentFor(name, owner, options) {
|
31312 | var fullName = `component:${name}`;
|
31313 | return owner.factoryFor(fullName, options);
|
31314 | },
|
31315 |
|
31316 | layoutFor(name, owner, options) {
|
31317 | var templateFullName = `template:components/${name}`;
|
31318 | return owner.lookup(templateFullName, options);
|
31319 | }
|
31320 |
|
31321 | });
|
31322 |
|
31323 | _exports.default = _default;
|
31324 | });
|
31325 | define("@ember/-internals/views/lib/mixins/action_support", ["exports", "@ember/-internals/utils", "@ember/-internals/metal", "@ember/debug", "@ember/-internals/views/lib/compat/attrs", "@ember/deprecated-features"], function (_exports, _utils, _metal, _debug, _attrs, _deprecatedFeatures) {
|
31326 | "use strict";
|
31327 |
|
31328 | Object.defineProperty(_exports, "__esModule", {
|
31329 | value: true
|
31330 | });
|
31331 | _exports.default = void 0;
|
31332 |
|
31333 | |
31334 |
|
31335 |
|
31336 | var mixinObj = {
|
31337 | send(actionName, ...args) {
|
31338 | (true && !(!this.isDestroying && !this.isDestroyed) && (0, _debug.assert)(`Attempted to call .send() with the action '${actionName}' on the destroyed object '${this}'.`, !this.isDestroying && !this.isDestroyed));
|
31339 | var action = this.actions && this.actions[actionName];
|
31340 |
|
31341 | if (action) {
|
31342 | var shouldBubble = action.apply(this, args) === true;
|
31343 |
|
31344 | if (!shouldBubble) {
|
31345 | return;
|
31346 | }
|
31347 | }
|
31348 |
|
31349 | var target = (0, _metal.get)(this, 'target');
|
31350 |
|
31351 | if (target) {
|
31352 | (true && !(typeof target.send === 'function') && (0, _debug.assert)(`The \`target\` for ${this} (${target}) does not have a \`send\` method`, typeof target.send === 'function'));
|
31353 | target.send(...arguments);
|
31354 | } else {
|
31355 | (true && !(action) && (0, _debug.assert)(`${(0, _utils.inspect)(this)} had no action handler for: ${actionName}`, action));
|
31356 | }
|
31357 | }
|
31358 |
|
31359 | };
|
31360 |
|
31361 | if (_deprecatedFeatures.SEND_ACTION) {
|
31362 | |
31363 |
|
31364 |
|
31365 |
|
31366 |
|
31367 |
|
31368 |
|
31369 |
|
31370 |
|
31371 |
|
31372 |
|
31373 |
|
31374 |
|
31375 |
|
31376 |
|
31377 |
|
31378 |
|
31379 |
|
31380 |
|
31381 |
|
31382 |
|
31383 |
|
31384 |
|
31385 |
|
31386 |
|
31387 |
|
31388 |
|
31389 |
|
31390 |
|
31391 |
|
31392 |
|
31393 |
|
31394 |
|
31395 |
|
31396 |
|
31397 |
|
31398 |
|
31399 |
|
31400 |
|
31401 |
|
31402 |
|
31403 |
|
31404 |
|
31405 |
|
31406 |
|
31407 |
|
31408 |
|
31409 |
|
31410 |
|
31411 |
|
31412 |
|
31413 |
|
31414 |
|
31415 |
|
31416 |
|
31417 |
|
31418 |
|
31419 |
|
31420 |
|
31421 |
|
31422 |
|
31423 |
|
31424 |
|
31425 |
|
31426 |
|
31427 |
|
31428 |
|
31429 |
|
31430 |
|
31431 |
|
31432 | var sendAction = function sendAction(action, ...contexts) {
|
31433 | (true && !(!this.isDestroying && !this.isDestroyed) && (0, _debug.assert)(`Attempted to call .sendAction() with the action '${action}' on the destroyed object '${this}'.`, !this.isDestroying && !this.isDestroyed));
|
31434 | (true && !(false) && (0, _debug.deprecate)(`You called ${(0, _utils.inspect)(this)}.sendAction(${typeof action === 'string' ? `"${action}"` : ''}) but Component#sendAction is deprecated. Please use closure actions instead.`, false, {
|
31435 | id: 'ember-component.send-action',
|
31436 | until: '4.0.0',
|
31437 | url: 'https://emberjs.com/deprecations/v3.x#toc_ember-component-send-action'
|
31438 | }));
|
31439 | var actionName;
|
31440 |
|
31441 | if (action === undefined) {
|
31442 | action = 'action';
|
31443 | }
|
31444 |
|
31445 | actionName = (0, _metal.get)(this, `attrs.${action}`) || (0, _metal.get)(this, action);
|
31446 | actionName = validateAction(this, actionName);
|
31447 |
|
31448 | if (actionName === undefined) {
|
31449 | return;
|
31450 | }
|
31451 |
|
31452 | if (typeof actionName === 'function') {
|
31453 | actionName(...contexts);
|
31454 | } else {
|
31455 | this.triggerAction({
|
31456 | action: actionName,
|
31457 | actionContext: contexts
|
31458 | });
|
31459 | }
|
31460 | };
|
31461 |
|
31462 | var validateAction = function validateAction(component, actionName) {
|
31463 | if (actionName && actionName[_attrs.MUTABLE_CELL]) {
|
31464 | actionName = actionName.value;
|
31465 | }
|
31466 |
|
31467 | (true && !(actionName === null || actionName === undefined || typeof actionName === 'string' || typeof actionName === 'function') && (0, _debug.assert)(`The default action was triggered on the component ${component.toString()}, but the action name (${actionName}) was not a string.`, actionName === null || actionName === undefined || typeof actionName === 'string' || typeof actionName === 'function'));
|
31468 | return actionName;
|
31469 | };
|
31470 |
|
31471 | mixinObj.sendAction = sendAction;
|
31472 | }
|
31473 | |
31474 |
|
31475 |
|
31476 |
|
31477 |
|
31478 |
|
31479 |
|
31480 | var _default = _metal.Mixin.create(mixinObj);
|
31481 |
|
31482 | _exports.default = _default;
|
31483 | });
|
31484 | define("@ember/-internals/views/lib/mixins/child_views_support", ["exports", "@ember/-internals/metal", "@ember/-internals/views/lib/system/utils"], function (_exports, _metal, _utils) {
|
31485 | "use strict";
|
31486 |
|
31487 | Object.defineProperty(_exports, "__esModule", {
|
31488 | value: true
|
31489 | });
|
31490 | _exports.default = void 0;
|
31491 |
|
31492 | |
31493 |
|
31494 |
|
31495 | var _default = _metal.Mixin.create({
|
31496 | |
31497 |
|
31498 |
|
31499 |
|
31500 |
|
31501 |
|
31502 |
|
31503 | childViews: (0, _metal.nativeDescDecorator)({
|
31504 | configurable: false,
|
31505 | enumerable: false,
|
31506 |
|
31507 | get() {
|
31508 | return (0, _utils.getChildViews)(this);
|
31509 | }
|
31510 |
|
31511 | }),
|
31512 |
|
31513 | appendChild(view) {
|
31514 | (0, _utils.addChildView)(this, view);
|
31515 | }
|
31516 |
|
31517 | });
|
31518 |
|
31519 | _exports.default = _default;
|
31520 | });
|
31521 | define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@ember/-internals/metal", "@ember/debug"], function (_exports, _metal, _debug) {
|
31522 | "use strict";
|
31523 |
|
31524 | Object.defineProperty(_exports, "__esModule", {
|
31525 | value: true
|
31526 | });
|
31527 | _exports.default = void 0;
|
31528 |
|
31529 | |
31530 |
|
31531 |
|
31532 | var EMPTY_ARRAY = Object.freeze([]);
|
31533 | |
31534 |
|
31535 |
|
31536 |
|
31537 |
|
31538 |
|
31539 | var _default = _metal.Mixin.create({
|
31540 | concatenatedProperties: ['classNames', 'classNameBindings'],
|
31541 |
|
31542 | init() {
|
31543 | this._super(...arguments);
|
31544 |
|
31545 | (true && !((0, _metal.descriptorForProperty)(this, 'classNameBindings') === undefined && Array.isArray(this.classNameBindings)) && (0, _debug.assert)(`Only arrays are allowed for 'classNameBindings'`, (0, _metal.descriptorForProperty)(this, 'classNameBindings') === undefined && Array.isArray(this.classNameBindings)));
|
31546 | (true && !((0, _metal.descriptorForProperty)(this, 'classNames') === undefined && Array.isArray(this.classNames)) && (0, _debug.assert)(`Only arrays of static class strings are allowed for 'classNames'. For dynamic classes, use 'classNameBindings'.`, (0, _metal.descriptorForProperty)(this, 'classNames') === undefined && Array.isArray(this.classNames)));
|
31547 | },
|
31548 |
|
31549 | |
31550 |
|
31551 |
|
31552 |
|
31553 |
|
31554 |
|
31555 |
|
31556 |
|
31557 |
|
31558 | classNames: EMPTY_ARRAY,
|
31559 |
|
31560 | |
31561 |
|
31562 |
|
31563 |
|
31564 |
|
31565 |
|
31566 |
|
31567 |
|
31568 |
|
31569 |
|
31570 |
|
31571 |
|
31572 |
|
31573 |
|
31574 |
|
31575 |
|
31576 |
|
31577 |
|
31578 |
|
31579 |
|
31580 |
|
31581 |
|
31582 |
|
31583 |
|
31584 |
|
31585 |
|
31586 |
|
31587 |
|
31588 |
|
31589 |
|
31590 |
|
31591 |
|
31592 |
|
31593 |
|
31594 |
|
31595 |
|
31596 |
|
31597 |
|
31598 |
|
31599 |
|
31600 |
|
31601 |
|
31602 |
|
31603 |
|
31604 |
|
31605 |
|
31606 |
|
31607 |
|
31608 | classNameBindings: EMPTY_ARRAY
|
31609 | });
|
31610 |
|
31611 | _exports.default = _default;
|
31612 | });
|
31613 | define("@ember/-internals/views/lib/mixins/text_support", ["exports", "@ember/-internals/metal", "@ember/-internals/runtime", "@ember/debug", "@ember/deprecated-features", "@ember/-internals/views"], function (_exports, _metal, _runtime, _debug, _deprecatedFeatures, _views) {
|
31614 | "use strict";
|
31615 |
|
31616 | Object.defineProperty(_exports, "__esModule", {
|
31617 | value: true
|
31618 | });
|
31619 | _exports.default = void 0;
|
31620 |
|
31621 | |
31622 |
|
31623 |
|
31624 | var KEY_EVENTS = {
|
31625 | 13: 'insertNewline',
|
31626 | 27: 'cancel'
|
31627 | };
|
31628 | |
31629 |
|
31630 |
|
31631 |
|
31632 |
|
31633 |
|
31634 |
|
31635 |
|
31636 |
|
31637 |
|
31638 |
|
31639 |
|
31640 |
|
31641 |
|
31642 |
|
31643 |
|
31644 |
|
31645 |
|
31646 |
|
31647 |
|
31648 |
|
31649 |
|
31650 |
|
31651 |
|
31652 |
|
31653 |
|
31654 |
|
31655 |
|
31656 |
|
31657 |
|
31658 |
|
31659 |
|
31660 |
|
31661 |
|
31662 |
|
31663 |
|
31664 |
|
31665 |
|
31666 |
|
31667 |
|
31668 |
|
31669 |
|
31670 |
|
31671 |
|
31672 |
|
31673 |
|
31674 |
|
31675 |
|
31676 |
|
31677 |
|
31678 |
|
31679 |
|
31680 |
|
31681 |
|
31682 |
|
31683 |
|
31684 |
|
31685 |
|
31686 |
|
31687 |
|
31688 |
|
31689 |
|
31690 |
|
31691 |
|
31692 |
|
31693 |
|
31694 |
|
31695 |
|
31696 |
|
31697 |
|
31698 |
|
31699 |
|
31700 |
|
31701 |
|
31702 |
|
31703 |
|
31704 |
|
31705 |
|
31706 |
|
31707 |
|
31708 |
|
31709 |
|
31710 |
|
31711 |
|
31712 |
|
31713 |
|
31714 |
|
31715 |
|
31716 |
|
31717 |
|
31718 |
|
31719 |
|
31720 |
|
31721 |
|
31722 |
|
31723 |
|
31724 |
|
31725 |
|
31726 |
|
31727 |
|
31728 |
|
31729 | var _default = _metal.Mixin.create(_runtime.TargetActionSupport, {
|
31730 | value: '',
|
31731 | attributeBindings: ['autocapitalize', 'autocorrect', 'autofocus', 'disabled', 'form', 'maxlength', 'minlength', 'placeholder', 'readonly', 'required', 'selectionDirection', 'spellcheck', 'tabindex', 'title'],
|
31732 | placeholder: null,
|
31733 | disabled: false,
|
31734 | maxlength: null,
|
31735 |
|
31736 | init() {
|
31737 | this._super(...arguments);
|
31738 |
|
31739 | this.on('paste', this, this._elementValueDidChange);
|
31740 | this.on('cut', this, this._elementValueDidChange);
|
31741 | this.on('input', this, this._elementValueDidChange);
|
31742 | },
|
31743 |
|
31744 | |
31745 |
|
31746 |
|
31747 |
|
31748 |
|
31749 |
|
31750 |
|
31751 |
|
31752 |
|
31753 |
|
31754 |
|
31755 |
|
31756 |
|
31757 | bubbles: false,
|
31758 |
|
31759 | interpretKeyEvents(event) {
|
31760 | var map = KEY_EVENTS;
|
31761 | var method = map[event.keyCode];
|
31762 |
|
31763 | this._elementValueDidChange();
|
31764 |
|
31765 | if (method) {
|
31766 | return this[method](event);
|
31767 | }
|
31768 | },
|
31769 |
|
31770 | _elementValueDidChange() {
|
31771 | (0, _metal.set)(this, 'value', this.element.value);
|
31772 | },
|
31773 |
|
31774 | change(event) {
|
31775 | this._elementValueDidChange(event);
|
31776 | },
|
31777 |
|
31778 | |
31779 |
|
31780 |
|
31781 |
|
31782 |
|
31783 |
|
31784 |
|
31785 |
|
31786 |
|
31787 |
|
31788 |
|
31789 |
|
31790 | insertNewline(event) {
|
31791 | sendAction('enter', this, event);
|
31792 | sendAction('insert-newline', this, event);
|
31793 | },
|
31794 |
|
31795 | |
31796 |
|
31797 |
|
31798 |
|
31799 |
|
31800 |
|
31801 |
|
31802 |
|
31803 |
|
31804 |
|
31805 |
|
31806 | cancel(event) {
|
31807 | sendAction('escape-press', this, event);
|
31808 | },
|
31809 |
|
31810 | |
31811 |
|
31812 |
|
31813 |
|
31814 |
|
31815 |
|
31816 |
|
31817 |
|
31818 |
|
31819 |
|
31820 |
|
31821 | focusIn(event) {
|
31822 | sendAction('focus-in', this, event);
|
31823 | },
|
31824 |
|
31825 | |
31826 |
|
31827 |
|
31828 |
|
31829 |
|
31830 |
|
31831 |
|
31832 |
|
31833 |
|
31834 |
|
31835 |
|
31836 | focusOut(event) {
|
31837 | this._elementValueDidChange(event);
|
31838 |
|
31839 | sendAction('focus-out', this, event);
|
31840 | },
|
31841 |
|
31842 | |
31843 |
|
31844 |
|
31845 |
|
31846 |
|
31847 |
|
31848 |
|
31849 |
|
31850 |
|
31851 |
|
31852 |
|
31853 | keyPress(event) {
|
31854 | sendAction('key-press', this, event);
|
31855 | },
|
31856 |
|
31857 | |
31858 |
|
31859 |
|
31860 |
|
31861 |
|
31862 |
|
31863 |
|
31864 |
|
31865 |
|
31866 |
|
31867 |
|
31868 | keyUp(event) {
|
31869 | this.interpretKeyEvents(event);
|
31870 | sendAction('key-up', this, event);
|
31871 | },
|
31872 |
|
31873 | |
31874 |
|
31875 |
|
31876 |
|
31877 |
|
31878 |
|
31879 |
|
31880 |
|
31881 |
|
31882 |
|
31883 |
|
31884 | keyDown(event) {
|
31885 | sendAction('key-down', this, event);
|
31886 | }
|
31887 |
|
31888 | });
|
31889 |
|
31890 |
|
31891 |
|
31892 |
|
31893 | _exports.default = _default;
|
31894 |
|
31895 | function sendAction(eventName, view, event) {
|
31896 | var action = (0, _metal.get)(view, `attrs.${eventName}`);
|
31897 |
|
31898 | if (action !== null && typeof action === 'object' && action[_views.MUTABLE_CELL] === true) {
|
31899 | action = action.value;
|
31900 | }
|
31901 |
|
31902 | if (action === undefined) {
|
31903 | action = (0, _metal.get)(view, eventName);
|
31904 | }
|
31905 |
|
31906 | var value = (0, _metal.get)(view, 'value');
|
31907 |
|
31908 | if (_deprecatedFeatures.SEND_ACTION && typeof action === 'string') {
|
31909 | var message = `Passing actions to components as strings (like \`<Input @${eventName}="${action}" />\`) is deprecated. Please use closure actions instead (\`<Input @${eventName}={{action "${action}"}} />\`).`;
|
31910 | (true && !(false) && (0, _debug.deprecate)(message, false, {
|
31911 | id: 'ember-component.send-action',
|
31912 | until: '4.0.0',
|
31913 | url: 'https://emberjs.com/deprecations/v3.x#toc_ember-component-send-action'
|
31914 | }));
|
31915 | view.triggerAction({
|
31916 | action: action,
|
31917 | actionContext: [value, event]
|
31918 | });
|
31919 | } else if (typeof action === 'function') {
|
31920 | action(value, event);
|
31921 | }
|
31922 |
|
31923 | if (action && !(0, _metal.get)(view, 'bubbles')) {
|
31924 | event.stopPropagation();
|
31925 | }
|
31926 | }
|
31927 | });
|
31928 | define("@ember/-internals/views/lib/mixins/view_state_support", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
31929 | "use strict";
|
31930 |
|
31931 | Object.defineProperty(_exports, "__esModule", {
|
31932 | value: true
|
31933 | });
|
31934 | _exports.default = void 0;
|
31935 |
|
31936 | |
31937 |
|
31938 |
|
31939 | var _default = _metal.Mixin.create({
|
31940 | _transitionTo(state) {
|
31941 | var priorState = this._currentState;
|
31942 | var currentState = this._currentState = this._states[state];
|
31943 | this._state = state;
|
31944 |
|
31945 | if (priorState && priorState.exit) {
|
31946 | priorState.exit(this);
|
31947 | }
|
31948 |
|
31949 | if (currentState.enter) {
|
31950 | currentState.enter(this);
|
31951 | }
|
31952 | }
|
31953 |
|
31954 | });
|
31955 |
|
31956 | _exports.default = _default;
|
31957 | });
|
31958 | define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-internals/utils", "@ember/-internals/metal", "@ember/debug", "@ember/-internals/browser-environment", "@ember/-internals/views/lib/system/utils", "@ember/-internals/views/lib/system/jquery", "@ember/deprecated-features"], function (_exports, _utils, _metal, _debug, _browserEnvironment, _utils2, _jquery, _deprecatedFeatures) {
|
31959 | "use strict";
|
31960 |
|
31961 | Object.defineProperty(_exports, "__esModule", {
|
31962 | value: true
|
31963 | });
|
31964 | _exports.default = void 0;
|
31965 |
|
31966 | function K() {
|
31967 | return this;
|
31968 | }
|
31969 |
|
31970 | var mixin = {
|
31971 | |
31972 |
|
31973 |
|
31974 |
|
31975 |
|
31976 |
|
31977 |
|
31978 |
|
31979 |
|
31980 |
|
31981 |
|
31982 |
|
31983 |
|
31984 |
|
31985 |
|
31986 |
|
31987 |
|
31988 |
|
31989 |
|
31990 |
|
31991 |
|
31992 |
|
31993 |
|
31994 |
|
31995 |
|
31996 |
|
31997 |
|
31998 |
|
31999 |
|
32000 |
|
32001 |
|
32002 |
|
32003 |
|
32004 |
|
32005 |
|
32006 |
|
32007 |
|
32008 |
|
32009 |
|
32010 |
|
32011 | concatenatedProperties: ['attributeBindings'],
|
32012 |
|
32013 |
|
32014 |
|
32015 |
|
32016 |
|
32017 | |
32018 |
|
32019 |
|
32020 |
|
32021 |
|
32022 |
|
32023 |
|
32024 |
|
32025 |
|
32026 |
|
32027 | nearestOfType(klass) {
|
32028 | var view = this.parentView;
|
32029 | var isOfType = klass instanceof _metal.Mixin ? view => klass.detect(view) : view => klass.detect(view.constructor);
|
32030 |
|
32031 | while (view) {
|
32032 | if (isOfType(view)) {
|
32033 | return view;
|
32034 | }
|
32035 |
|
32036 | view = view.parentView;
|
32037 | }
|
32038 | },
|
32039 |
|
32040 | |
32041 |
|
32042 |
|
32043 |
|
32044 |
|
32045 |
|
32046 |
|
32047 |
|
32048 | nearestWithProperty(property) {
|
32049 | var view = this.parentView;
|
32050 |
|
32051 | while (view) {
|
32052 | if (property in view) {
|
32053 | return view;
|
32054 | }
|
32055 |
|
32056 | view = view.parentView;
|
32057 | }
|
32058 | },
|
32059 |
|
32060 | |
32061 |
|
32062 |
|
32063 |
|
32064 |
|
32065 |
|
32066 |
|
32067 |
|
32068 |
|
32069 |
|
32070 |
|
32071 |
|
32072 |
|
32073 |
|
32074 | rerender() {
|
32075 | return this._currentState.rerender(this);
|
32076 | },
|
32077 |
|
32078 |
|
32079 |
|
32080 |
|
32081 |
|
32082 | |
32083 |
|
32084 |
|
32085 |
|
32086 |
|
32087 |
|
32088 | element: (0, _metal.nativeDescDecorator)({
|
32089 | configurable: false,
|
32090 | enumerable: false,
|
32091 |
|
32092 | get() {
|
32093 | return this.renderer.getElement(this);
|
32094 | }
|
32095 |
|
32096 | }),
|
32097 |
|
32098 | |
32099 |
|
32100 |
|
32101 |
|
32102 |
|
32103 |
|
32104 |
|
32105 |
|
32106 |
|
32107 |
|
32108 |
|
32109 |
|
32110 |
|
32111 |
|
32112 | appendTo(selector) {
|
32113 | var target;
|
32114 |
|
32115 | if (_browserEnvironment.hasDOM) {
|
32116 | target = typeof selector === 'string' ? document.querySelector(selector) : selector;
|
32117 | (true && !(target) && (0, _debug.assert)(`You tried to append to (${selector}) but that isn't in the DOM`, target));
|
32118 | (true && !(!(0, _utils2.matches)(target, '.ember-view')) && (0, _debug.assert)('You cannot append to an existing Ember.View.', !(0, _utils2.matches)(target, '.ember-view')));
|
32119 | (true && !((() => {
|
32120 | var node = target.parentNode;
|
32121 |
|
32122 | while (node) {
|
32123 | if (node.nodeType !== 9 && (0, _utils2.matches)(node, '.ember-view')) {
|
32124 | return false;
|
32125 | }
|
32126 |
|
32127 | node = node.parentNode;
|
32128 | }
|
32129 |
|
32130 | return true;
|
32131 | })()) && (0, _debug.assert)('You cannot append to an existing Ember.View.', (() => {
|
32132 | var node = target.parentNode;
|
32133 |
|
32134 | while (node) {
|
32135 | if (node.nodeType !== 9 && (0, _utils2.matches)(node, '.ember-view')) {
|
32136 | return false;
|
32137 | }
|
32138 |
|
32139 | node = node.parentNode;
|
32140 | }
|
32141 |
|
32142 | return true;
|
32143 | })()));
|
32144 | } else {
|
32145 | target = selector;
|
32146 | (true && !(typeof target !== 'string') && (0, _debug.assert)(`You tried to append to a selector string (${selector}) in an environment without jQuery`, typeof target !== 'string'));
|
32147 | (true && !(typeof selector.appendChild === 'function') && (0, _debug.assert)(`You tried to append to a non-Element (${selector}) in an environment without jQuery`, typeof selector.appendChild === 'function'));
|
32148 | }
|
32149 |
|
32150 | this.renderer.appendTo(this, target);
|
32151 | return this;
|
32152 | },
|
32153 |
|
32154 | |
32155 |
|
32156 |
|
32157 |
|
32158 |
|
32159 |
|
32160 |
|
32161 |
|
32162 |
|
32163 |
|
32164 |
|
32165 |
|
32166 |
|
32167 |
|
32168 | append() {
|
32169 | return this.appendTo(document.body);
|
32170 | },
|
32171 |
|
32172 | |
32173 |
|
32174 |
|
32175 |
|
32176 |
|
32177 |
|
32178 |
|
32179 |
|
32180 |
|
32181 |
|
32182 |
|
32183 |
|
32184 |
|
32185 |
|
32186 |
|
32187 |
|
32188 |
|
32189 |
|
32190 |
|
32191 |
|
32192 |
|
32193 |
|
32194 |
|
32195 |
|
32196 |
|
32197 | elementId: null,
|
32198 |
|
32199 | |
32200 |
|
32201 |
|
32202 |
|
32203 |
|
32204 | willInsertElement: K,
|
32205 |
|
32206 | |
32207 |
|
32208 |
|
32209 |
|
32210 |
|
32211 |
|
32212 |
|
32213 |
|
32214 |
|
32215 | didInsertElement: K,
|
32216 |
|
32217 | |
32218 |
|
32219 |
|
32220 |
|
32221 |
|
32222 |
|
32223 |
|
32224 | willClearRender: K,
|
32225 |
|
32226 | |
32227 |
|
32228 |
|
32229 |
|
32230 |
|
32231 |
|
32232 |
|
32233 |
|
32234 | destroy() {
|
32235 | this._super(...arguments);
|
32236 |
|
32237 | this._currentState.destroy(this);
|
32238 | },
|
32239 |
|
32240 | |
32241 |
|
32242 |
|
32243 |
|
32244 |
|
32245 |
|
32246 |
|
32247 |
|
32248 |
|
32249 | willDestroyElement: K,
|
32250 |
|
32251 | |
32252 |
|
32253 |
|
32254 |
|
32255 |
|
32256 | didDestroyElement: K,
|
32257 |
|
32258 | |
32259 |
|
32260 |
|
32261 |
|
32262 |
|
32263 | parentViewDidChange: K,
|
32264 |
|
32265 |
|
32266 |
|
32267 |
|
32268 | |
32269 |
|
32270 |
|
32271 |
|
32272 |
|
32273 |
|
32274 |
|
32275 |
|
32276 |
|
32277 |
|
32278 |
|
32279 |
|
32280 |
|
32281 |
|
32282 |
|
32283 |
|
32284 |
|
32285 | tagName: null,
|
32286 |
|
32287 |
|
32288 |
|
32289 |
|
32290 |
|
32291 | |
32292 |
|
32293 |
|
32294 |
|
32295 |
|
32296 |
|
32297 |
|
32298 |
|
32299 | init() {
|
32300 | this._super(...arguments);
|
32301 |
|
32302 |
|
32303 | (true && !((0, _metal.descriptorForProperty)(this, 'elementId') === undefined) && (0, _debug.assert)(`You cannot use a computed property for the component's \`elementId\` (${this}).`, (0, _metal.descriptorForProperty)(this, 'elementId') === undefined));
|
32304 |
|
32305 | (true && !((0, _metal.descriptorForProperty)(this, 'tagName') === undefined) && (0, _debug.assert)(`You cannot use a computed property for the component's \`tagName\` (${this}).`, (0, _metal.descriptorForProperty)(this, 'tagName') === undefined));
|
32306 |
|
32307 | if (!this.elementId && this.tagName !== '') {
|
32308 | this.elementId = (0, _utils.guidFor)(this);
|
32309 | }
|
32310 |
|
32311 | (true && !(!this.render) && (0, _debug.assert)('Using a custom `.render` function is no longer supported.', !this.render));
|
32312 | },
|
32313 |
|
32314 |
|
32315 |
|
32316 |
|
32317 |
|
32318 | |
32319 |
|
32320 |
|
32321 |
|
32322 |
|
32323 |
|
32324 |
|
32325 | handleEvent(eventName, evt) {
|
32326 | return this._currentState.handleEvent(this, eventName, evt);
|
32327 | }
|
32328 |
|
32329 | };
|
32330 |
|
32331 | if (_deprecatedFeatures.JQUERY_INTEGRATION) {
|
32332 | |
32333 |
|
32334 |
|
32335 |
|
32336 |
|
32337 |
|
32338 |
|
32339 |
|
32340 |
|
32341 |
|
32342 |
|
32343 |
|
32344 | mixin.$ = function $(sel) {
|
32345 | (true && !(this.tagName !== '') && (0, _debug.assert)("You cannot access this.$() on a component with `tagName: ''` specified.", this.tagName !== ''));
|
32346 | (true && !(!_jquery.jQueryDisabled) && (0, _debug.assert)('You cannot access this.$() with `jQuery` disabled.', !_jquery.jQueryDisabled));
|
32347 | (true && !(false) && (0, _debug.deprecate)('Using this.$() in a component has been deprecated, consider using this.element', false, {
|
32348 | id: 'ember-views.curly-components.jquery-element',
|
32349 | until: '4.0.0',
|
32350 | url: 'https://emberjs.com/deprecations/v3.x#toc_jquery-apis'
|
32351 | }));
|
32352 |
|
32353 | if (this.element) {
|
32354 | return sel ? (0, _jquery.jQuery)(sel, this.element) : (0, _jquery.jQuery)(this.element);
|
32355 | }
|
32356 | };
|
32357 | }
|
32358 | |
32359 |
|
32360 |
|
32361 |
|
32362 |
|
32363 |
|
32364 |
|
32365 | var _default = _metal.Mixin.create(mixin);
|
32366 |
|
32367 | _exports.default = _default;
|
32368 | });
|
32369 | define("@ember/-internals/views/lib/system/action_manager", ["exports"], function (_exports) {
|
32370 | "use strict";
|
32371 |
|
32372 | Object.defineProperty(_exports, "__esModule", {
|
32373 | value: true
|
32374 | });
|
32375 | _exports.default = ActionManager;
|
32376 |
|
32377 | |
32378 |
|
32379 |
|
32380 | function ActionManager() {}
|
32381 | |
32382 |
|
32383 |
|
32384 |
|
32385 |
|
32386 |
|
32387 |
|
32388 |
|
32389 |
|
32390 | ActionManager.registeredActions = {};
|
32391 | });
|
32392 | define("@ember/-internals/views/lib/system/event_dispatcher", ["exports", "@ember/-internals/owner", "@ember/polyfills", "@ember/debug", "@ember/-internals/metal", "@ember/-internals/runtime", "@ember/-internals/views", "@ember/-internals/views/lib/system/jquery", "@ember/-internals/views/lib/system/action_manager", "@ember/-internals/views/lib/system/jquery_event_deprecation", "@ember/-internals/views/lib/system/utils", "@ember/deprecated-features"], function (_exports, _owner, _polyfills, _debug, _metal, _runtime, _views, _jquery, _action_manager, _jquery_event_deprecation, _utils, _deprecatedFeatures) {
|
32393 | "use strict";
|
32394 |
|
32395 | Object.defineProperty(_exports, "__esModule", {
|
32396 | value: true
|
32397 | });
|
32398 | _exports.default = void 0;
|
32399 |
|
32400 | |
32401 |
|
32402 |
|
32403 | var ROOT_ELEMENT_CLASS = 'ember-application';
|
32404 | var ROOT_ELEMENT_SELECTOR = `.${ROOT_ELEMENT_CLASS}`;
|
32405 | var EVENT_MAP = {
|
32406 | mouseenter: 'mouseover',
|
32407 | mouseleave: 'mouseout'
|
32408 | };
|
32409 | |
32410 |
|
32411 |
|
32412 |
|
32413 |
|
32414 |
|
32415 |
|
32416 |
|
32417 |
|
32418 |
|
32419 |
|
32420 |
|
32421 | var _default = _runtime.Object.extend({
|
32422 | |
32423 |
|
32424 |
|
32425 |
|
32426 |
|
32427 |
|
32428 |
|
32429 |
|
32430 |
|
32431 |
|
32432 |
|
32433 |
|
32434 |
|
32435 |
|
32436 |
|
32437 |
|
32438 |
|
32439 |
|
32440 |
|
32441 |
|
32442 |
|
32443 |
|
32444 |
|
32445 |
|
32446 |
|
32447 |
|
32448 |
|
32449 | events: (0, _polyfills.assign)({
|
32450 | touchstart: 'touchStart',
|
32451 | touchmove: 'touchMove',
|
32452 | touchend: 'touchEnd',
|
32453 | touchcancel: 'touchCancel',
|
32454 | keydown: 'keyDown',
|
32455 | keyup: 'keyUp',
|
32456 | keypress: 'keyPress',
|
32457 | mousedown: 'mouseDown',
|
32458 | mouseup: 'mouseUp',
|
32459 | contextmenu: 'contextMenu',
|
32460 | click: 'click',
|
32461 | dblclick: 'doubleClick',
|
32462 | focusin: 'focusIn',
|
32463 | focusout: 'focusOut',
|
32464 | submit: 'submit',
|
32465 | input: 'input',
|
32466 | change: 'change',
|
32467 | dragstart: 'dragStart',
|
32468 | drag: 'drag',
|
32469 | dragenter: 'dragEnter',
|
32470 | dragleave: 'dragLeave',
|
32471 | dragover: 'dragOver',
|
32472 | drop: 'drop',
|
32473 | dragend: 'dragEnd'
|
32474 | }, _deprecatedFeatures.MOUSE_ENTER_LEAVE_MOVE_EVENTS ? {
|
32475 | mouseenter: 'mouseEnter',
|
32476 | mouseleave: 'mouseLeave',
|
32477 | mousemove: 'mouseMove'
|
32478 | } : {}),
|
32479 |
|
32480 | |
32481 |
|
32482 |
|
32483 |
|
32484 |
|
32485 |
|
32486 |
|
32487 |
|
32488 |
|
32489 |
|
32490 |
|
32491 | rootElement: 'body',
|
32492 |
|
32493 | init() {
|
32494 | this._super();
|
32495 |
|
32496 | (true && !((() => {
|
32497 | var owner = (0, _owner.getOwner)(this);
|
32498 | var environment = owner.lookup('-environment:main');
|
32499 | return environment.isInteractive;
|
32500 | })()) && (0, _debug.assert)('EventDispatcher should never be instantiated in fastboot mode. Please report this as an Ember bug.', (() => {
|
32501 | var owner = (0, _owner.getOwner)(this);
|
32502 | var environment = owner.lookup('-environment:main');
|
32503 | return environment.isInteractive;
|
32504 | })()));
|
32505 | this._eventHandlers = Object.create(null);
|
32506 | },
|
32507 |
|
32508 | |
32509 |
|
32510 |
|
32511 |
|
32512 |
|
32513 |
|
32514 |
|
32515 |
|
32516 |
|
32517 |
|
32518 | setup(addedEvents, _rootElement) {
|
32519 | var events = this._finalEvents = (0, _polyfills.assign)({}, (0, _metal.get)(this, 'events'), addedEvents);
|
32520 |
|
32521 | if (_rootElement !== undefined && _rootElement !== null) {
|
32522 | (0, _metal.set)(this, 'rootElement', _rootElement);
|
32523 | }
|
32524 |
|
32525 | var rootElementSelector = (0, _metal.get)(this, 'rootElement');
|
32526 | var rootElement;
|
32527 |
|
32528 | if (!_deprecatedFeatures.JQUERY_INTEGRATION || _jquery.jQueryDisabled) {
|
32529 | if (typeof rootElementSelector !== 'string') {
|
32530 | rootElement = rootElementSelector;
|
32531 | } else {
|
32532 | rootElement = document.querySelector(rootElementSelector);
|
32533 | }
|
32534 |
|
32535 | (true && !(!rootElement.classList.contains(ROOT_ELEMENT_CLASS)) && (0, _debug.assert)(`You cannot use the same root element (${(0, _metal.get)(this, 'rootElement') || rootElement.tagName}) multiple times in an Ember.Application`, !rootElement.classList.contains(ROOT_ELEMENT_CLASS)));
|
32536 | (true && !((() => {
|
32537 | var target = rootElement.parentNode;
|
32538 |
|
32539 | do {
|
32540 | if (target.classList.contains(ROOT_ELEMENT_CLASS)) {
|
32541 | return false;
|
32542 | }
|
32543 |
|
32544 | target = target.parentNode;
|
32545 | } while (target && target.nodeType === 1);
|
32546 |
|
32547 | return true;
|
32548 | })()) && (0, _debug.assert)('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', (() => {
|
32549 | var target = rootElement.parentNode;
|
32550 |
|
32551 | do {
|
32552 | if (target.classList.contains(ROOT_ELEMENT_CLASS)) {
|
32553 | return false;
|
32554 | }
|
32555 |
|
32556 | target = target.parentNode;
|
32557 | } while (target && target.nodeType === 1);
|
32558 |
|
32559 | return true;
|
32560 | })()));
|
32561 | (true && !(!rootElement.querySelector(ROOT_ELEMENT_SELECTOR)) && (0, _debug.assert)('You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application', !rootElement.querySelector(ROOT_ELEMENT_SELECTOR)));
|
32562 | rootElement.classList.add(ROOT_ELEMENT_CLASS);
|
32563 | (true && !(rootElement.classList.contains(ROOT_ELEMENT_CLASS)) && (0, _debug.assert)(`Unable to add '${ROOT_ELEMENT_CLASS}' class to root element (${(0, _metal.get)(this, 'rootElement') || rootElement.tagName}). Make sure you set rootElement to the body or an element in the body.`, rootElement.classList.contains(ROOT_ELEMENT_CLASS)));
|
32564 | } else {
|
32565 | rootElement = (0, _jquery.jQuery)(rootElementSelector);
|
32566 | (true && !(!rootElement.is(ROOT_ELEMENT_SELECTOR)) && (0, _debug.assert)(`You cannot use the same root element (${rootElement.selector || rootElement[0].tagName}) multiple times in an Ember.Application`, !rootElement.is(ROOT_ELEMENT_SELECTOR)));
|
32567 | (true && !(!rootElement.closest(ROOT_ELEMENT_SELECTOR).length) && (0, _debug.assert)('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', !rootElement.closest(ROOT_ELEMENT_SELECTOR).length));
|
32568 | (true && !(!rootElement.find(ROOT_ELEMENT_SELECTOR).length) && (0, _debug.assert)('You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application', !rootElement.find(ROOT_ELEMENT_SELECTOR).length));
|
32569 | rootElement.addClass(ROOT_ELEMENT_CLASS);
|
32570 |
|
32571 | if (!rootElement.is(ROOT_ELEMENT_SELECTOR)) {
|
32572 | throw new TypeError(`Unable to add '${ROOT_ELEMENT_CLASS}' class to root element (${rootElement.selector || rootElement[0].tagName}). Make sure you set rootElement to the body or an element in the body.`);
|
32573 | }
|
32574 | }
|
32575 |
|
32576 | for (var event in events) {
|
32577 | if (Object.prototype.hasOwnProperty.call(events, event)) {
|
32578 | this.setupHandler(rootElement, event, events[event]);
|
32579 | }
|
32580 | }
|
32581 | },
|
32582 |
|
32583 | |
32584 |
|
32585 |
|
32586 |
|
32587 |
|
32588 |
|
32589 |
|
32590 |
|
32591 |
|
32592 |
|
32593 |
|
32594 |
|
32595 | setupHandler(rootElement, event, eventName) {
|
32596 | if (eventName === null) {
|
32597 | return;
|
32598 | }
|
32599 |
|
32600 | if (!_deprecatedFeatures.JQUERY_INTEGRATION || _jquery.jQueryDisabled) {
|
32601 | var viewHandler = (target, event) => {
|
32602 | var view = (0, _views.getElementView)(target);
|
32603 | var result = true;
|
32604 |
|
32605 | if (view) {
|
32606 | result = view.handleEvent(eventName, event);
|
32607 | }
|
32608 |
|
32609 | return result;
|
32610 | };
|
32611 |
|
32612 | var actionHandler = (target, event) => {
|
32613 | var actionId = target.getAttribute('data-ember-action');
|
32614 | var actions = _action_manager.default.registeredActions[actionId];
|
32615 |
|
32616 |
|
32617 |
|
32618 |
|
32619 | if (actionId === '') {
|
32620 | var attributes = target.attributes;
|
32621 | var attributeCount = attributes.length;
|
32622 | actions = [];
|
32623 |
|
32624 | for (var i = 0; i < attributeCount; i++) {
|
32625 | var attr = attributes.item(i);
|
32626 | var attrName = attr.name;
|
32627 |
|
32628 | if (attrName.indexOf('data-ember-action-') === 0) {
|
32629 | actions = actions.concat(_action_manager.default.registeredActions[attr.value]);
|
32630 | }
|
32631 | }
|
32632 | }
|
32633 |
|
32634 |
|
32635 |
|
32636 |
|
32637 | if (!actions) {
|
32638 | return;
|
32639 | }
|
32640 |
|
32641 | var result = true;
|
32642 |
|
32643 | for (var index = 0; index < actions.length; index++) {
|
32644 | var action = actions[index];
|
32645 |
|
32646 | if (action && action.eventName === eventName) {
|
32647 |
|
32648 | result = action.handler(event) && result;
|
32649 | }
|
32650 | }
|
32651 |
|
32652 | return result;
|
32653 | };
|
32654 |
|
32655 |
|
32656 |
|
32657 |
|
32658 | if (_deprecatedFeatures.MOUSE_ENTER_LEAVE_MOVE_EVENTS && EVENT_MAP[event] !== undefined) {
|
32659 | var mappedEventType = EVENT_MAP[event];
|
32660 | var origEventType = event;
|
32661 |
|
32662 | var createFakeEvent = (eventType, event) => {
|
32663 | var fakeEvent = document.createEvent('MouseEvent');
|
32664 | fakeEvent.initMouseEvent(eventType, false, false, event.view, event.detail, event.screenX, event.screenY, event.clientX, event.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, event.button, event.relatedTarget);
|
32665 |
|
32666 | Object.defineProperty(fakeEvent, 'target', {
|
32667 | value: event.target,
|
32668 | enumerable: true
|
32669 | });
|
32670 | return fakeEvent;
|
32671 | };
|
32672 |
|
32673 | var handleMappedEvent = this._eventHandlers[mappedEventType] = event => {
|
32674 | var target = event.target;
|
32675 | var related = event.relatedTarget;
|
32676 |
|
32677 | while (target && target.nodeType === 1 && (related === null || related !== target && !(0, _utils.contains)(target, related))) {
|
32678 |
|
32679 | if ((0, _views.getElementView)(target)) {
|
32680 | viewHandler(target, createFakeEvent(origEventType, event));
|
32681 | } else if (target.hasAttribute('data-ember-action')) {
|
32682 | actionHandler(target, createFakeEvent(origEventType, event));
|
32683 | }
|
32684 |
|
32685 |
|
32686 |
|
32687 | target = target.parentNode;
|
32688 | }
|
32689 | };
|
32690 |
|
32691 | rootElement.addEventListener(mappedEventType, handleMappedEvent);
|
32692 | } else {
|
32693 | var handleEvent = this._eventHandlers[event] = event => {
|
32694 | var target = event.target;
|
32695 |
|
32696 | do {
|
32697 | if ((0, _views.getElementView)(target)) {
|
32698 | if (viewHandler(target, event) === false) {
|
32699 | event.preventDefault();
|
32700 | event.stopPropagation();
|
32701 | break;
|
32702 | } else if (event.cancelBubble === true) {
|
32703 | break;
|
32704 | }
|
32705 | } else if (typeof target.hasAttribute === 'function' && target.hasAttribute('data-ember-action')) {
|
32706 | if (actionHandler(target, event) === false) {
|
32707 | break;
|
32708 | }
|
32709 | }
|
32710 |
|
32711 | target = target.parentNode;
|
32712 | } while (target && target.nodeType === 1);
|
32713 | };
|
32714 |
|
32715 | rootElement.addEventListener(event, handleEvent);
|
32716 | }
|
32717 | } else {
|
32718 | rootElement.on(`${event}.ember`, '.ember-view', function (evt) {
|
32719 | var view = (0, _views.getElementView)(this);
|
32720 | var result = true;
|
32721 |
|
32722 | if (view) {
|
32723 | result = view.handleEvent(eventName, (0, _jquery_event_deprecation.default)(evt));
|
32724 | }
|
32725 |
|
32726 | return result;
|
32727 | });
|
32728 | rootElement.on(`${event}.ember`, '[data-ember-action]', evt => {
|
32729 | var attributes = evt.currentTarget.attributes;
|
32730 | var handledActions = [];
|
32731 | evt = (0, _jquery_event_deprecation.default)(evt);
|
32732 |
|
32733 | for (var i = 0; i < attributes.length; i++) {
|
32734 | var attr = attributes.item(i);
|
32735 | var attrName = attr.name;
|
32736 |
|
32737 | if (attrName.lastIndexOf('data-ember-action-', 0) !== -1) {
|
32738 | var action = _action_manager.default.registeredActions[attr.value];
|
32739 |
|
32740 |
|
32741 |
|
32742 | if (action && action.eventName === eventName && handledActions.indexOf(action) === -1) {
|
32743 | action.handler(evt);
|
32744 |
|
32745 |
|
32746 |
|
32747 | handledActions.push(action);
|
32748 | }
|
32749 | }
|
32750 | }
|
32751 | });
|
32752 | }
|
32753 | },
|
32754 |
|
32755 | destroy() {
|
32756 | var rootElementSelector = (0, _metal.get)(this, 'rootElement');
|
32757 | var rootElement;
|
32758 |
|
32759 | if (rootElementSelector.nodeType) {
|
32760 | rootElement = rootElementSelector;
|
32761 | } else {
|
32762 | rootElement = document.querySelector(rootElementSelector);
|
32763 | }
|
32764 |
|
32765 | if (!rootElement) {
|
32766 | return;
|
32767 | }
|
32768 |
|
32769 | if (!_deprecatedFeatures.JQUERY_INTEGRATION || _jquery.jQueryDisabled) {
|
32770 | for (var event in this._eventHandlers) {
|
32771 | rootElement.removeEventListener(event, this._eventHandlers[event]);
|
32772 | }
|
32773 | } else {
|
32774 | (0, _jquery.jQuery)(rootElementSelector).off('.ember', '**');
|
32775 | }
|
32776 |
|
32777 | rootElement.classList.remove(ROOT_ELEMENT_CLASS);
|
32778 | return this._super(...arguments);
|
32779 | },
|
32780 |
|
32781 | toString() {
|
32782 | return '(EventDispatcher)';
|
32783 | }
|
32784 |
|
32785 | });
|
32786 |
|
32787 | _exports.default = _default;
|
32788 | });
|
32789 | define("@ember/-internals/views/lib/system/jquery", ["exports", "@ember/-internals/environment", "@ember/-internals/browser-environment", "@ember/deprecated-features"], function (_exports, _environment, _browserEnvironment, _deprecatedFeatures) {
|
32790 | "use strict";
|
32791 |
|
32792 | Object.defineProperty(_exports, "__esModule", {
|
32793 | value: true
|
32794 | });
|
32795 | _exports.jQueryDisabled = _exports.jQuery = void 0;
|
32796 | var jQuery;
|
32797 | _exports.jQuery = jQuery;
|
32798 | var jQueryDisabled = !_deprecatedFeatures.JQUERY_INTEGRATION || _environment.ENV._JQUERY_INTEGRATION === false;
|
32799 | _exports.jQueryDisabled = jQueryDisabled;
|
32800 |
|
32801 | if (_deprecatedFeatures.JQUERY_INTEGRATION && _browserEnvironment.hasDOM) {
|
32802 | _exports.jQuery = jQuery = _environment.context.imports.jQuery;
|
32803 |
|
32804 | if (!jQueryDisabled && jQuery) {
|
32805 | if (jQuery.event.addProp) {
|
32806 | jQuery.event.addProp('dataTransfer');
|
32807 | } else {
|
32808 |
|
32809 | ['dragstart', 'drag', 'dragenter', 'dragleave', 'dragover', 'drop', 'dragend'].forEach(eventName => {
|
32810 | jQuery.event.fixHooks[eventName] = {
|
32811 | props: ['dataTransfer']
|
32812 | };
|
32813 | });
|
32814 | }
|
32815 | } else {
|
32816 | _exports.jQuery = jQuery = undefined;
|
32817 | _exports.jQueryDisabled = jQueryDisabled = true;
|
32818 | }
|
32819 | }
|
32820 | });
|
32821 | define("@ember/-internals/views/lib/system/jquery_event_deprecation", ["exports", "@ember/debug", "@ember/-internals/environment", "@ember/-internals/utils", "@ember/deprecated-features"], function (_exports, _debug, _environment, _utils, _deprecatedFeatures) {
|
32822 | "use strict";
|
32823 |
|
32824 | Object.defineProperty(_exports, "__esModule", {
|
32825 | value: true
|
32826 | });
|
32827 | _exports.default = addJQueryEventDeprecation;
|
32828 |
|
32829 |
|
32830 | function addJQueryEventDeprecation(jqEvent) {
|
32831 | if (true
|
32832 |
|
32833 | && _deprecatedFeatures.JQUERY_INTEGRATION && _utils.HAS_NATIVE_PROXY) {
|
32834 | var boundFunctions = new Map();
|
32835 |
|
32836 |
|
32837 |
|
32838 | return new Proxy(jqEvent, {
|
32839 | get(target, name) {
|
32840 | switch (name) {
|
32841 | case 'originalEvent':
|
32842 | (true && !((EmberENV => {
|
32843 |
|
32844 |
|
32845 |
|
32846 |
|
32847 | if (typeof EmberENV !== 'object' || EmberENV === null) return false;
|
32848 | return EmberENV._JQUERY_INTEGRATION === true;
|
32849 | })(_environment.global.EmberENV)) && (0, _debug.deprecate)('Accessing jQuery.Event specific properties is deprecated. Either use the ember-jquery-legacy addon to normalize events to native events, or explicitly opt into jQuery integration using @ember/optional-features.', (EmberENV => {
|
32850 | if (typeof EmberENV !== 'object' || EmberENV === null) return false;
|
32851 | return EmberENV._JQUERY_INTEGRATION === true;
|
32852 | })(_environment.global.EmberENV), {
|
32853 | id: 'ember-views.event-dispatcher.jquery-event',
|
32854 | until: '4.0.0',
|
32855 | url: 'https://emberjs.com/deprecations/v3.x#toc_jquery-event'
|
32856 | }));
|
32857 | return target[name];
|
32858 |
|
32859 |
|
32860 | case '__originalEvent':
|
32861 | return target.originalEvent;
|
32862 |
|
32863 | default:
|
32864 | if (typeof target[name] === 'function') {
|
32865 |
|
32866 | if (!boundFunctions.has(name)) {
|
32867 |
|
32868 |
|
32869 | boundFunctions.set(name, target[name].bind(target));
|
32870 | }
|
32871 |
|
32872 | return boundFunctions.get(name);
|
32873 | }
|
32874 |
|
32875 |
|
32876 | return target[name];
|
32877 | }
|
32878 | }
|
32879 |
|
32880 | });
|
32881 | }
|
32882 |
|
32883 | return jqEvent;
|
32884 | }
|
32885 | });
|
32886 | define("@ember/-internals/views/lib/system/utils", ["exports", "@ember/-internals/owner", "@ember/-internals/utils", "@ember/debug"], function (_exports, _owner, _utils, _debug) {
|
32887 | "use strict";
|
32888 |
|
32889 | Object.defineProperty(_exports, "__esModule", {
|
32890 | value: true
|
32891 | });
|
32892 | _exports.isSimpleClick = isSimpleClick;
|
32893 | _exports.constructStyleDeprecationMessage = constructStyleDeprecationMessage;
|
32894 | _exports.getRootViews = getRootViews;
|
32895 | _exports.getViewId = getViewId;
|
32896 | _exports.getElementView = getElementView;
|
32897 | _exports.getViewElement = getViewElement;
|
32898 | _exports.setElementView = setElementView;
|
32899 | _exports.setViewElement = setViewElement;
|
32900 | _exports.clearElementView = clearElementView;
|
32901 | _exports.clearViewElement = clearViewElement;
|
32902 | _exports.getChildViews = getChildViews;
|
32903 | _exports.initChildViews = initChildViews;
|
32904 | _exports.addChildView = addChildView;
|
32905 | _exports.collectChildViews = collectChildViews;
|
32906 | _exports.getViewBounds = getViewBounds;
|
32907 | _exports.getViewRange = getViewRange;
|
32908 | _exports.getViewClientRects = getViewClientRects;
|
32909 | _exports.getViewBoundingClientRect = getViewBoundingClientRect;
|
32910 | _exports.matches = matches;
|
32911 | _exports.contains = contains;
|
32912 | _exports.elMatches = void 0;
|
32913 |
|
32914 |
|
32915 |
|
32916 | |
32917 |
|
32918 |
|
32919 | function isSimpleClick(event) {
|
32920 | var modifier = event.shiftKey || event.metaKey || event.altKey || event.ctrlKey;
|
32921 | var secondaryClick = event.which > 1;
|
32922 |
|
32923 | return !modifier && !secondaryClick;
|
32924 | }
|
32925 |
|
32926 | function constructStyleDeprecationMessage(affectedStyle) {
|
32927 | return '' + 'Binding style attributes may introduce cross-site scripting vulnerabilities; ' + 'please ensure that values being bound are properly escaped. For more information, ' + 'including how to disable this warning, see ' + 'https://emberjs.com/deprecations/v1.x/#toc_binding-style-attributes. ' + 'Style affected: "' + affectedStyle + '"';
|
32928 | }
|
32929 | |
32930 |
|
32931 |
|
32932 |
|
32933 |
|
32934 |
|
32935 |
|
32936 | function getRootViews(owner) {
|
32937 | var registry = owner.lookup('-view-registry:main');
|
32938 | var rootViews = [];
|
32939 | Object.keys(registry).forEach(id => {
|
32940 | var view = registry[id];
|
32941 |
|
32942 | if (view.parentView === null) {
|
32943 | rootViews.push(view);
|
32944 | }
|
32945 | });
|
32946 | return rootViews;
|
32947 | }
|
32948 | |
32949 |
|
32950 |
|
32951 |
|
32952 |
|
32953 |
|
32954 |
|
32955 | function getViewId(view) {
|
32956 | if (view.tagName !== '' && view.elementId) {
|
32957 | return view.elementId;
|
32958 | } else {
|
32959 | return (0, _utils.guidFor)(view);
|
32960 | }
|
32961 | }
|
32962 |
|
32963 | var ELEMENT_VIEW = new WeakMap();
|
32964 | var VIEW_ELEMENT = new WeakMap();
|
32965 |
|
32966 | function getElementView(element) {
|
32967 | return ELEMENT_VIEW.get(element) || null;
|
32968 | }
|
32969 | |
32970 |
|
32971 |
|
32972 |
|
32973 |
|
32974 |
|
32975 |
|
32976 | function getViewElement(view) {
|
32977 | return VIEW_ELEMENT.get(view) || null;
|
32978 | }
|
32979 |
|
32980 | function setElementView(element, view) {
|
32981 | ELEMENT_VIEW.set(element, view);
|
32982 | }
|
32983 |
|
32984 | function setViewElement(view, element) {
|
32985 | VIEW_ELEMENT.set(view, element);
|
32986 | }
|
32987 |
|
32988 |
|
32989 |
|
32990 |
|
32991 |
|
32992 | function clearElementView(element) {
|
32993 | ELEMENT_VIEW.delete(element);
|
32994 | }
|
32995 |
|
32996 | function clearViewElement(view) {
|
32997 | VIEW_ELEMENT.delete(view);
|
32998 | }
|
32999 |
|
33000 | var CHILD_VIEW_IDS = new WeakMap();
|
33001 | |
33002 |
|
33003 |
|
33004 |
|
33005 |
|
33006 |
|
33007 | function getChildViews(view) {
|
33008 | var owner = (0, _owner.getOwner)(view);
|
33009 | var registry = owner.lookup('-view-registry:main');
|
33010 | return collectChildViews(view, registry);
|
33011 | }
|
33012 |
|
33013 | function initChildViews(view) {
|
33014 | var childViews = new Set();
|
33015 | CHILD_VIEW_IDS.set(view, childViews);
|
33016 | return childViews;
|
33017 | }
|
33018 |
|
33019 | function addChildView(parent, child) {
|
33020 | var childViews = CHILD_VIEW_IDS.get(parent);
|
33021 |
|
33022 | if (childViews === undefined) {
|
33023 | childViews = initChildViews(parent);
|
33024 | }
|
33025 |
|
33026 | childViews.add(getViewId(child));
|
33027 | }
|
33028 |
|
33029 | function collectChildViews(view, registry) {
|
33030 | var views = [];
|
33031 | var childViews = CHILD_VIEW_IDS.get(view);
|
33032 |
|
33033 | if (childViews !== undefined) {
|
33034 | childViews.forEach(id => {
|
33035 | var view = registry[id];
|
33036 |
|
33037 | if (view && !view.isDestroying && !view.isDestroyed) {
|
33038 | views.push(view);
|
33039 | }
|
33040 | });
|
33041 | }
|
33042 |
|
33043 | return views;
|
33044 | }
|
33045 | |
33046 |
|
33047 |
|
33048 |
|
33049 |
|
33050 |
|
33051 |
|
33052 | function getViewBounds(view) {
|
33053 | return view.renderer.getBounds(view);
|
33054 | }
|
33055 | |
33056 |
|
33057 |
|
33058 |
|
33059 |
|
33060 |
|
33061 |
|
33062 | function getViewRange(view) {
|
33063 | var bounds = getViewBounds(view);
|
33064 | var range = document.createRange();
|
33065 | range.setStartBefore(bounds.firstNode);
|
33066 | range.setEndAfter(bounds.lastNode);
|
33067 | return range;
|
33068 | }
|
33069 | |
33070 |
|
33071 |
|
33072 |
|
33073 |
|
33074 |
|
33075 |
|
33076 |
|
33077 |
|
33078 |
|
33079 |
|
33080 |
|
33081 |
|
33082 | function getViewClientRects(view) {
|
33083 | var range = getViewRange(view);
|
33084 | return range.getClientRects();
|
33085 | }
|
33086 | |
33087 |
|
33088 |
|
33089 |
|
33090 |
|
33091 |
|
33092 |
|
33093 |
|
33094 |
|
33095 |
|
33096 |
|
33097 |
|
33098 |
|
33099 | function getViewBoundingClientRect(view) {
|
33100 | var range = getViewRange(view);
|
33101 | return range.getBoundingClientRect();
|
33102 | }
|
33103 | |
33104 |
|
33105 |
|
33106 |
|
33107 |
|
33108 |
|
33109 |
|
33110 |
|
33111 |
|
33112 |
|
33113 | var elMatches = typeof Element !== 'undefined' ? Element.prototype.matches || Element.prototype['matchesSelector'] || Element.prototype['mozMatchesSelector'] || Element.prototype['msMatchesSelector'] || Element.prototype['oMatchesSelector'] || Element.prototype['webkitMatchesSelector'] : undefined;
|
33114 | _exports.elMatches = elMatches;
|
33115 |
|
33116 | function matches(el, selector) {
|
33117 | (true && !(elMatches !== undefined) && (0, _debug.assert)('cannot call `matches` in fastboot mode', elMatches !== undefined));
|
33118 | return elMatches.call(el, selector);
|
33119 | }
|
33120 |
|
33121 | function contains(a, b) {
|
33122 | if (a.contains !== undefined) {
|
33123 | return a.contains(b);
|
33124 | }
|
33125 |
|
33126 | var current = b.parentNode;
|
33127 |
|
33128 | while (current && (current = current.parentNode)) {
|
33129 | if (current === a) {
|
33130 | return true;
|
33131 | }
|
33132 | }
|
33133 |
|
33134 | return false;
|
33135 | }
|
33136 | });
|
33137 | define("@ember/-internals/views/lib/views/core_view", ["exports", "@ember/-internals/runtime", "@ember/-internals/views/lib/views/states"], function (_exports, _runtime, _states) {
|
33138 | "use strict";
|
33139 |
|
33140 | Object.defineProperty(_exports, "__esModule", {
|
33141 | value: true
|
33142 | });
|
33143 | _exports.default = void 0;
|
33144 |
|
33145 | |
33146 |
|
33147 |
|
33148 |
|
33149 |
|
33150 |
|
33151 |
|
33152 |
|
33153 |
|
33154 |
|
33155 |
|
33156 |
|
33157 |
|
33158 |
|
33159 |
|
33160 |
|
33161 | var CoreView = _runtime.FrameworkObject.extend(_runtime.Evented, _runtime.ActionHandler, {
|
33162 | isView: true,
|
33163 | _states: _states.default,
|
33164 |
|
33165 | init() {
|
33166 | this._super(...arguments);
|
33167 |
|
33168 | this._state = 'preRender';
|
33169 | this._currentState = this._states.preRender;
|
33170 |
|
33171 | if (!this.renderer) {
|
33172 | throw new Error(`Cannot instantiate a component without a renderer. Please ensure that you are creating ${this} with a proper container/registry.`);
|
33173 | }
|
33174 | },
|
33175 |
|
33176 | |
33177 |
|
33178 |
|
33179 |
|
33180 |
|
33181 |
|
33182 |
|
33183 |
|
33184 | parentView: null,
|
33185 |
|
33186 | instrumentDetails(hash) {
|
33187 | hash.object = this.toString();
|
33188 | hash.containerKey = this._debugContainerKey;
|
33189 | hash.view = this;
|
33190 | return hash;
|
33191 | },
|
33192 |
|
33193 | |
33194 |
|
33195 |
|
33196 |
|
33197 |
|
33198 |
|
33199 |
|
33200 | trigger(name, ...args) {
|
33201 | this._super(...arguments);
|
33202 |
|
33203 | var method = this[name];
|
33204 |
|
33205 | if (typeof method === 'function') {
|
33206 | return method.apply(this, args);
|
33207 | }
|
33208 | },
|
33209 |
|
33210 | has(name) {
|
33211 | return typeof this[name] === 'function' || this._super(name);
|
33212 | }
|
33213 |
|
33214 | });
|
33215 |
|
33216 | CoreView.reopenClass({
|
33217 | isViewFactory: true
|
33218 | });
|
33219 | var _default = CoreView;
|
33220 | _exports.default = _default;
|
33221 | });
|
33222 | define("@ember/-internals/views/lib/views/states", ["exports", "@ember/-internals/views/lib/views/states/pre_render", "@ember/-internals/views/lib/views/states/has_element", "@ember/-internals/views/lib/views/states/in_dom", "@ember/-internals/views/lib/views/states/destroying"], function (_exports, _pre_render, _has_element, _in_dom, _destroying) {
|
33223 | "use strict";
|
33224 |
|
33225 | Object.defineProperty(_exports, "__esModule", {
|
33226 | value: true
|
33227 | });
|
33228 | _exports.default = void 0;
|
33229 |
|
33230 | |
33231 |
|
33232 |
|
33233 |
|
33234 |
|
33235 |
|
33236 |
|
33237 |
|
33238 |
|
33239 |
|
33240 |
|
33241 |
|
33242 |
|
33243 |
|
33244 |
|
33245 | var states = Object.freeze({
|
33246 | preRender: _pre_render.default,
|
33247 | inDOM: _in_dom.default,
|
33248 | hasElement: _has_element.default,
|
33249 | destroying: _destroying.default
|
33250 | });
|
33251 | var _default = states;
|
33252 | _exports.default = _default;
|
33253 | });
|
33254 | define("@ember/-internals/views/lib/views/states/default", ["exports", "@ember/error"], function (_exports, _error) {
|
33255 | "use strict";
|
33256 |
|
33257 | Object.defineProperty(_exports, "__esModule", {
|
33258 | value: true
|
33259 | });
|
33260 | _exports.default = void 0;
|
33261 | var _default = {
|
33262 |
|
33263 | appendChild() {
|
33264 | throw new _error.default("You can't use appendChild outside of the rendering process");
|
33265 | },
|
33266 |
|
33267 |
|
33268 | handleEvent() {
|
33269 | return true;
|
33270 | },
|
33271 |
|
33272 | rerender() {},
|
33273 |
|
33274 | destroy() {}
|
33275 |
|
33276 | };
|
33277 |
|
33278 | var _default2 = Object.freeze(_default);
|
33279 |
|
33280 | _exports.default = _default2;
|
33281 | });
|
33282 | define("@ember/-internals/views/lib/views/states/destroying", ["exports", "@ember/polyfills", "@ember/error", "@ember/-internals/views/lib/views/states/default"], function (_exports, _polyfills, _error, _default3) {
|
33283 | "use strict";
|
33284 |
|
33285 | Object.defineProperty(_exports, "__esModule", {
|
33286 | value: true
|
33287 | });
|
33288 | _exports.default = void 0;
|
33289 | var destroying = (0, _polyfills.assign)({}, _default3.default, {
|
33290 | appendChild() {
|
33291 | throw new _error.default("You can't call appendChild on a view being destroyed");
|
33292 | },
|
33293 |
|
33294 | rerender() {
|
33295 | throw new _error.default("You can't call rerender on a view being destroyed");
|
33296 | }
|
33297 |
|
33298 | });
|
33299 |
|
33300 | var _default2 = Object.freeze(destroying);
|
33301 |
|
33302 | _exports.default = _default2;
|
33303 | });
|
33304 | define("@ember/-internals/views/lib/views/states/has_element", ["exports", "@ember/polyfills", "@ember/-internals/views/lib/views/states/default", "@ember/runloop", "@ember/instrumentation"], function (_exports, _polyfills, _default3, _runloop, _instrumentation) {
|
33305 | "use strict";
|
33306 |
|
33307 | Object.defineProperty(_exports, "__esModule", {
|
33308 | value: true
|
33309 | });
|
33310 | _exports.default = void 0;
|
33311 | var hasElement = (0, _polyfills.assign)({}, _default3.default, {
|
33312 | rerender(view) {
|
33313 | view.renderer.rerender(view);
|
33314 | },
|
33315 |
|
33316 | destroy(view) {
|
33317 | view.renderer.remove(view);
|
33318 | },
|
33319 |
|
33320 |
|
33321 | handleEvent(view, eventName, event) {
|
33322 | if (view.has(eventName)) {
|
33323 |
|
33324 |
|
33325 | return (0, _instrumentation.flaggedInstrument)(`interaction.${eventName}`, {
|
33326 | event,
|
33327 | view
|
33328 | }, () => {
|
33329 | return (0, _runloop.join)(view, view.trigger, eventName, event);
|
33330 | });
|
33331 | } else {
|
33332 | return true;
|
33333 | }
|
33334 | }
|
33335 |
|
33336 | });
|
33337 |
|
33338 | var _default2 = Object.freeze(hasElement);
|
33339 |
|
33340 | _exports.default = _default2;
|
33341 | });
|
33342 | define("@ember/-internals/views/lib/views/states/in_dom", ["exports", "@ember/-internals/utils", "@ember/polyfills", "@ember/error", "@ember/-internals/views/lib/views/states/has_element"], function (_exports, _utils, _polyfills, _error, _has_element) {
|
33343 | "use strict";
|
33344 |
|
33345 | Object.defineProperty(_exports, "__esModule", {
|
33346 | value: true
|
33347 | });
|
33348 | _exports.default = void 0;
|
33349 | var inDOM = (0, _polyfills.assign)({}, _has_element.default, {
|
33350 | enter(view) {
|
33351 |
|
33352 |
|
33353 | view.renderer.register(view);
|
33354 |
|
33355 | if (true
|
33356 |
|
33357 | ) {
|
33358 | var elementId = view.elementId;
|
33359 | (0, _utils.teardownMandatorySetter)(view, 'elementId');
|
33360 | Object.defineProperty(view, 'elementId', {
|
33361 | configurable: true,
|
33362 | enumerable: true,
|
33363 |
|
33364 | get() {
|
33365 | return elementId;
|
33366 | },
|
33367 |
|
33368 | set(value) {
|
33369 | if (value !== elementId) {
|
33370 | throw new _error.default("Changing a view's elementId after creation is not allowed");
|
33371 | }
|
33372 | }
|
33373 |
|
33374 | });
|
33375 | }
|
33376 | }
|
33377 |
|
33378 | });
|
33379 |
|
33380 | var _default = Object.freeze(inDOM);
|
33381 |
|
33382 | _exports.default = _default;
|
33383 | });
|
33384 | define("@ember/-internals/views/lib/views/states/pre_render", ["exports", "@ember/-internals/views/lib/views/states/default", "@ember/polyfills"], function (_exports, _default3, _polyfills) {
|
33385 | "use strict";
|
33386 |
|
33387 | Object.defineProperty(_exports, "__esModule", {
|
33388 | value: true
|
33389 | });
|
33390 | _exports.default = void 0;
|
33391 | var preRender = (0, _polyfills.assign)({}, _default3.default);
|
33392 |
|
33393 | var _default2 = Object.freeze(preRender);
|
33394 |
|
33395 | _exports.default = _default2;
|
33396 | });
|
33397 | define("@ember/application/globals-resolver", ["exports", "@ember/-internals/utils", "@ember/-internals/metal", "@ember/debug", "@ember/string", "@ember/-internals/runtime", "@ember/-internals/glimmer", "@ember/deprecated-features"], function (_exports, _utils, _metal, _debug, _string, _runtime, _glimmer, _deprecatedFeatures) {
|
33398 | "use strict";
|
33399 |
|
33400 | Object.defineProperty(_exports, "__esModule", {
|
33401 | value: true
|
33402 | });
|
33403 | _exports.default = void 0;
|
33404 |
|
33405 | |
33406 |
|
33407 |
|
33408 |
|
33409 | |
33410 |
|
33411 |
|
33412 |
|
33413 |
|
33414 |
|
33415 |
|
33416 |
|
33417 |
|
33418 |
|
33419 |
|
33420 |
|
33421 |
|
33422 |
|
33423 |
|
33424 |
|
33425 |
|
33426 |
|
33427 |
|
33428 |
|
33429 |
|
33430 |
|
33431 |
|
33432 |
|
33433 |
|
33434 |
|
33435 |
|
33436 |
|
33437 |
|
33438 |
|
33439 |
|
33440 |
|
33441 |
|
33442 |
|
33443 |
|
33444 |
|
33445 |
|
33446 |
|
33447 |
|
33448 |
|
33449 |
|
33450 |
|
33451 |
|
33452 |
|
33453 |
|
33454 |
|
33455 |
|
33456 |
|
33457 |
|
33458 |
|
33459 |
|
33460 |
|
33461 |
|
33462 |
|
33463 |
|
33464 |
|
33465 |
|
33466 |
|
33467 |
|
33468 |
|
33469 |
|
33470 |
|
33471 |
|
33472 |
|
33473 |
|
33474 |
|
33475 |
|
33476 |
|
33477 |
|
33478 | var DefaultResolver;
|
33479 |
|
33480 | if (_deprecatedFeatures.GLOBALS_RESOLVER) {
|
33481 | DefaultResolver = class DefaultResolver extends _runtime.Object {
|
33482 | static create(props) {
|
33483 |
|
33484 |
|
33485 |
|
33486 | return super.create(props);
|
33487 | }
|
33488 | |
33489 |
|
33490 |
|
33491 |
|
33492 |
|
33493 |
|
33494 |
|
33495 |
|
33496 |
|
33497 | init() {
|
33498 | (true && !(false) && (0, _debug.deprecate)('Using the globals resolver is deprecated. Use the ember-resolver package instead. See https://deprecations.emberjs.com/v3.x#toc_ember-deprecate-globals-resolver', false, {
|
33499 | until: '4.0.0',
|
33500 | id: 'globals-resolver',
|
33501 | url: 'https://deprecations.emberjs.com/v3.x#toc_ember-deprecate-globals-resolver'
|
33502 | }));
|
33503 | this._parseNameCache = (0, _utils.dictionary)(null);
|
33504 | }
|
33505 |
|
33506 | normalize(fullName) {
|
33507 | var [type, name] = fullName.split(':');
|
33508 | (true && !(fullName.split(':').length === 2) && (0, _debug.assert)('Tried to normalize a container name without a colon (:) in it. ' + 'You probably tried to lookup a name that did not contain a type, ' + 'a colon, and a name. A proper lookup name would be `view:post`.', fullName.split(':').length === 2));
|
33509 |
|
33510 | if (type !== 'template') {
|
33511 | var result = name.replace(/(\.|_|-)./g, m => m.charAt(1).toUpperCase());
|
33512 | return `${type}:${result}`;
|
33513 | } else {
|
33514 | return fullName;
|
33515 | }
|
33516 | }
|
33517 | |
33518 |
|
33519 |
|
33520 |
|
33521 |
|
33522 |
|
33523 |
|
33524 |
|
33525 |
|
33526 |
|
33527 |
|
33528 | resolve(fullName) {
|
33529 | var parsedName = this.parseName(fullName);
|
33530 | var resolveMethodName = parsedName.resolveMethodName;
|
33531 | var resolved;
|
33532 |
|
33533 | if (this[resolveMethodName]) {
|
33534 | resolved = this[resolveMethodName](parsedName);
|
33535 | }
|
33536 |
|
33537 | resolved = resolved || this.resolveOther(parsedName);
|
33538 |
|
33539 | if (true
|
33540 |
|
33541 | ) {
|
33542 | if (parsedName.root && parsedName.root.LOG_RESOLVER) {
|
33543 | this._logLookup(resolved, parsedName);
|
33544 | }
|
33545 |
|
33546 | if (resolved) {
|
33547 | var VALIDATED_TYPES = {
|
33548 | route: ['isRouteFactory', 'Ember.Route'],
|
33549 | component: ['isComponentFactory', 'Ember.Component'],
|
33550 | view: ['isViewFactory', 'Ember.View'],
|
33551 | service: ['isServiceFactory', 'Ember.Service']
|
33552 | };
|
33553 | var validationAttributes = VALIDATED_TYPES[parsedName.type];
|
33554 |
|
33555 | if (validationAttributes) {
|
33556 | var [factoryFlag, expectedType] = validationAttributes;
|
33557 | (true && !(Boolean(resolved[factoryFlag])) && (0, _debug.assert)(`Expected ${parsedName.fullName} to resolve to an ${expectedType} but ` + `instead it was ${resolved}.`, Boolean(resolved[factoryFlag])));
|
33558 | }
|
33559 | }
|
33560 | }
|
33561 |
|
33562 | return resolved;
|
33563 | }
|
33564 | |
33565 |
|
33566 |
|
33567 |
|
33568 |
|
33569 |
|
33570 |
|
33571 |
|
33572 |
|
33573 |
|
33574 | parseName(fullName) {
|
33575 | return this._parseNameCache[fullName] || (this._parseNameCache[fullName] = this._parseName(fullName));
|
33576 | }
|
33577 |
|
33578 | _parseName(fullName) {
|
33579 | var [type, fullNameWithoutType] = fullName.split(':');
|
33580 | var name = fullNameWithoutType;
|
33581 | var namespace = (0, _metal.get)(this, 'namespace');
|
33582 | var root = namespace;
|
33583 | var lastSlashIndex = name.lastIndexOf('/');
|
33584 | var dirname = lastSlashIndex !== -1 ? name.slice(0, lastSlashIndex) : null;
|
33585 |
|
33586 | if (type !== 'template' && lastSlashIndex !== -1) {
|
33587 | var parts = name.split('/');
|
33588 | name = parts[parts.length - 1];
|
33589 | var namespaceName = (0, _string.capitalize)(parts.slice(0, -1).join('.'));
|
33590 | root = (0, _metal.findNamespace)(namespaceName);
|
33591 | (true && !(root) && (0, _debug.assert)(`You are looking for a ${name} ${type} in the ${namespaceName} namespace, but the namespace could not be found`, root));
|
33592 | }
|
33593 |
|
33594 | var resolveMethodName = fullNameWithoutType === 'main' ? 'Main' : (0, _string.classify)(type);
|
33595 |
|
33596 | if (!(name && type)) {
|
33597 | throw new TypeError(`Invalid fullName: \`${fullName}\`, must be of the form \`type:name\` `);
|
33598 | }
|
33599 |
|
33600 | return {
|
33601 | fullName,
|
33602 | type,
|
33603 | fullNameWithoutType,
|
33604 | dirname,
|
33605 | name,
|
33606 | root,
|
33607 | resolveMethodName: `resolve${resolveMethodName}`
|
33608 | };
|
33609 | }
|
33610 | |
33611 |
|
33612 |
|
33613 |
|
33614 |
|
33615 |
|
33616 |
|
33617 |
|
33618 |
|
33619 |
|
33620 |
|
33621 | lookupDescription(fullName) {
|
33622 | var parsedName = this.parseName(fullName);
|
33623 | var description;
|
33624 |
|
33625 | if (parsedName.type === 'template') {
|
33626 | return `template at ${parsedName.fullNameWithoutType.replace(/\./g, '/')}`;
|
33627 | }
|
33628 |
|
33629 | description = `${parsedName.root}.${(0, _string.classify)(parsedName.name).replace(/\./g, '')}`;
|
33630 |
|
33631 | if (parsedName.type !== 'model') {
|
33632 | description += (0, _string.classify)(parsedName.type);
|
33633 | }
|
33634 |
|
33635 | return description;
|
33636 | }
|
33637 |
|
33638 | makeToString(factory) {
|
33639 | return factory.toString();
|
33640 | }
|
33641 | |
33642 |
|
33643 |
|
33644 |
|
33645 |
|
33646 |
|
33647 |
|
33648 |
|
33649 |
|
33650 |
|
33651 | useRouterNaming(parsedName) {
|
33652 | if (parsedName.name === 'basic') {
|
33653 | parsedName.name = '';
|
33654 | } else {
|
33655 | parsedName.name = parsedName.name.replace(/\./g, '_');
|
33656 | }
|
33657 | }
|
33658 | |
33659 |
|
33660 |
|
33661 |
|
33662 |
|
33663 |
|
33664 |
|
33665 |
|
33666 |
|
33667 | resolveTemplate(parsedName) {
|
33668 | var templateName = parsedName.fullNameWithoutType.replace(/\./g, '/');
|
33669 | return (0, _glimmer.getTemplate)(templateName) || (0, _glimmer.getTemplate)((0, _string.decamelize)(templateName));
|
33670 | }
|
33671 | |
33672 |
|
33673 |
|
33674 |
|
33675 |
|
33676 |
|
33677 |
|
33678 |
|
33679 |
|
33680 | resolveView(parsedName) {
|
33681 | this.useRouterNaming(parsedName);
|
33682 | return this.resolveOther(parsedName);
|
33683 | }
|
33684 | |
33685 |
|
33686 |
|
33687 |
|
33688 |
|
33689 |
|
33690 |
|
33691 |
|
33692 |
|
33693 | resolveController(parsedName) {
|
33694 | this.useRouterNaming(parsedName);
|
33695 | return this.resolveOther(parsedName);
|
33696 | }
|
33697 | |
33698 |
|
33699 |
|
33700 |
|
33701 |
|
33702 |
|
33703 |
|
33704 |
|
33705 |
|
33706 | resolveRoute(parsedName) {
|
33707 | this.useRouterNaming(parsedName);
|
33708 | return this.resolveOther(parsedName);
|
33709 | }
|
33710 | |
33711 |
|
33712 |
|
33713 |
|
33714 |
|
33715 |
|
33716 |
|
33717 |
|
33718 |
|
33719 | resolveModel(parsedName) {
|
33720 | var className = (0, _string.classify)(parsedName.name);
|
33721 | var factory = (0, _metal.get)(parsedName.root, className);
|
33722 | return factory;
|
33723 | }
|
33724 | |
33725 |
|
33726 |
|
33727 |
|
33728 |
|
33729 |
|
33730 |
|
33731 |
|
33732 |
|
33733 |
|
33734 | resolveHelper(parsedName) {
|
33735 | return this.resolveOther(parsedName);
|
33736 | }
|
33737 | |
33738 |
|
33739 |
|
33740 |
|
33741 |
|
33742 |
|
33743 |
|
33744 |
|
33745 |
|
33746 |
|
33747 | resolveOther(parsedName) {
|
33748 | var className = (0, _string.classify)(parsedName.name) + (0, _string.classify)(parsedName.type);
|
33749 | var factory = (0, _metal.get)(parsedName.root, className);
|
33750 | return factory;
|
33751 | }
|
33752 |
|
33753 | resolveMain(parsedName) {
|
33754 | var className = (0, _string.classify)(parsedName.type);
|
33755 | return (0, _metal.get)(parsedName.root, className);
|
33756 | }
|
33757 | |
33758 |
|
33759 |
|
33760 |
|
33761 |
|
33762 |
|
33763 |
|
33764 |
|
33765 | knownForType(type) {
|
33766 | var namespace = (0, _metal.get)(this, 'namespace');
|
33767 | var suffix = (0, _string.classify)(type);
|
33768 | var typeRegexp = new RegExp(`${suffix}$`);
|
33769 | var known = (0, _utils.dictionary)(null);
|
33770 | var knownKeys = Object.keys(namespace);
|
33771 |
|
33772 | for (var index = 0; index < knownKeys.length; index++) {
|
33773 | var name = knownKeys[index];
|
33774 |
|
33775 | if (typeRegexp.test(name)) {
|
33776 | var containerName = this.translateToContainerFullname(type, name);
|
33777 | known[containerName] = true;
|
33778 | }
|
33779 | }
|
33780 |
|
33781 | return known;
|
33782 | }
|
33783 | |
33784 |
|
33785 |
|
33786 |
|
33787 |
|
33788 |
|
33789 |
|
33790 |
|
33791 |
|
33792 |
|
33793 |
|
33794 |
|
33795 | translateToContainerFullname(type, name) {
|
33796 | var suffix = (0, _string.classify)(type);
|
33797 | var namePrefix = name.slice(0, suffix.length * -1);
|
33798 | var dasherizedName = (0, _string.dasherize)(namePrefix);
|
33799 | return `${type}:${dasherizedName}`;
|
33800 | }
|
33801 |
|
33802 | };
|
33803 |
|
33804 | if (true
|
33805 |
|
33806 | ) {
|
33807 | |
33808 |
|
33809 |
|
33810 |
|
33811 |
|
33812 |
|
33813 | DefaultResolver.prototype._logLookup = function (found, parsedName) {
|
33814 | var symbol = found ? '[✓]' : '[ ]';
|
33815 | var padding;
|
33816 |
|
33817 | if (parsedName.fullName.length > 60) {
|
33818 | padding = '.';
|
33819 | } else {
|
33820 | padding = new Array(60 - parsedName.fullName.length).join('.');
|
33821 | }
|
33822 |
|
33823 | (0, _debug.info)(symbol, parsedName.fullName, padding, this.lookupDescription(parsedName.fullName));
|
33824 | };
|
33825 | }
|
33826 | }
|
33827 |
|
33828 | var _default = DefaultResolver;
|
33829 | _exports.default = _default;
|
33830 | });
|
33831 | define("@ember/application/index", ["exports", "@ember/-internals/owner", "@ember/application/lib/lazy_load", "@ember/application/lib/application"], function (_exports, _owner, _lazy_load, _application) {
|
33832 | "use strict";
|
33833 |
|
33834 | Object.defineProperty(_exports, "__esModule", {
|
33835 | value: true
|
33836 | });
|
33837 | Object.defineProperty(_exports, "getOwner", {
|
33838 | enumerable: true,
|
33839 | get: function () {
|
33840 | return _owner.getOwner;
|
33841 | }
|
33842 | });
|
33843 | Object.defineProperty(_exports, "setOwner", {
|
33844 | enumerable: true,
|
33845 | get: function () {
|
33846 | return _owner.setOwner;
|
33847 | }
|
33848 | });
|
33849 | Object.defineProperty(_exports, "onLoad", {
|
33850 | enumerable: true,
|
33851 | get: function () {
|
33852 | return _lazy_load.onLoad;
|
33853 | }
|
33854 | });
|
33855 | Object.defineProperty(_exports, "runLoadHooks", {
|
33856 | enumerable: true,
|
33857 | get: function () {
|
33858 | return _lazy_load.runLoadHooks;
|
33859 | }
|
33860 | });
|
33861 | Object.defineProperty(_exports, "_loaded", {
|
33862 | enumerable: true,
|
33863 | get: function () {
|
33864 | return _lazy_load._loaded;
|
33865 | }
|
33866 | });
|
33867 | Object.defineProperty(_exports, "default", {
|
33868 | enumerable: true,
|
33869 | get: function () {
|
33870 | return _application.default;
|
33871 | }
|
33872 | });
|
33873 | });
|
33874 | define("@ember/application/instance", ["exports", "@ember/polyfills", "@ember/-internals/metal", "@ember/-internals/browser-environment", "@ember/-internals/views", "@ember/engine/instance", "@ember/-internals/glimmer"], function (_exports, _polyfills, _metal, environment, _views, _instance, _glimmer) {
|
33875 | "use strict";
|
33876 |
|
33877 | Object.defineProperty(_exports, "__esModule", {
|
33878 | value: true
|
33879 | });
|
33880 | _exports.default = void 0;
|
33881 |
|
33882 | |
33883 |
|
33884 |
|
33885 |
|
33886 | |
33887 |
|
33888 |
|
33889 |
|
33890 |
|
33891 |
|
33892 |
|
33893 |
|
33894 |
|
33895 |
|
33896 |
|
33897 |
|
33898 |
|
33899 |
|
33900 |
|
33901 |
|
33902 |
|
33903 |
|
33904 |
|
33905 |
|
33906 |
|
33907 |
|
33908 |
|
33909 |
|
33910 | var ApplicationInstance = _instance.default.extend({
|
33911 | |
33912 |
|
33913 |
|
33914 |
|
33915 |
|
33916 | application: null,
|
33917 |
|
33918 | |
33919 |
|
33920 |
|
33921 |
|
33922 |
|
33923 |
|
33924 |
|
33925 |
|
33926 |
|
33927 | customEvents: null,
|
33928 |
|
33929 | |
33930 |
|
33931 |
|
33932 |
|
33933 |
|
33934 |
|
33935 |
|
33936 | rootElement: null,
|
33937 |
|
33938 | init() {
|
33939 | this._super(...arguments);
|
33940 |
|
33941 | this.application._watchInstance(this);
|
33942 |
|
33943 |
|
33944 |
|
33945 |
|
33946 |
|
33947 |
|
33948 |
|
33949 |
|
33950 | this.register('-application-instance:main', this, {
|
33951 | instantiate: false
|
33952 | });
|
33953 | },
|
33954 |
|
33955 | |
33956 |
|
33957 |
|
33958 |
|
33959 |
|
33960 |
|
33961 |
|
33962 |
|
33963 |
|
33964 |
|
33965 |
|
33966 | _bootSync(options) {
|
33967 | if (this._booted) {
|
33968 | return this;
|
33969 | }
|
33970 |
|
33971 | options = new BootOptions(options);
|
33972 | this.setupRegistry(options);
|
33973 |
|
33974 | if (options.rootElement) {
|
33975 | this.rootElement = options.rootElement;
|
33976 | } else {
|
33977 | this.rootElement = this.application.rootElement;
|
33978 | }
|
33979 |
|
33980 | if (options.location) {
|
33981 | (0, _metal.set)(this.router, 'location', options.location);
|
33982 | }
|
33983 |
|
33984 | this.application.runInstanceInitializers(this);
|
33985 |
|
33986 | if (options.isInteractive) {
|
33987 | this.setupEventDispatcher();
|
33988 | }
|
33989 |
|
33990 | this._booted = true;
|
33991 | return this;
|
33992 | },
|
33993 |
|
33994 | setupRegistry(options) {
|
33995 | this.constructor.setupRegistry(this.__registry__, options);
|
33996 | },
|
33997 |
|
33998 | router: (0, _metal.computed)(function () {
|
33999 | return this.lookup('router:main');
|
34000 | }).readOnly(),
|
34001 |
|
34002 | |
34003 |
|
34004 |
|
34005 |
|
34006 |
|
34007 |
|
34008 |
|
34009 |
|
34010 |
|
34011 |
|
34012 |
|
34013 | didCreateRootView(view) {
|
34014 | view.appendTo(this.rootElement);
|
34015 | },
|
34016 |
|
34017 | |
34018 |
|
34019 |
|
34020 |
|
34021 |
|
34022 |
|
34023 | startRouting() {
|
34024 | this.router.startRouting();
|
34025 | this._didSetupRouter = true;
|
34026 | },
|
34027 |
|
34028 | |
34029 |
|
34030 |
|
34031 |
|
34032 |
|
34033 |
|
34034 |
|
34035 |
|
34036 |
|
34037 |
|
34038 |
|
34039 |
|
34040 |
|
34041 |
|
34042 |
|
34043 |
|
34044 | setupRouter() {
|
34045 | if (this._didSetupRouter) {
|
34046 | return;
|
34047 | }
|
34048 |
|
34049 | this._didSetupRouter = true;
|
34050 | this.router.setupRouter();
|
34051 | },
|
34052 |
|
34053 | |
34054 |
|
34055 |
|
34056 |
|
34057 |
|
34058 |
|
34059 | handleURL(url) {
|
34060 | this.setupRouter();
|
34061 | return this.router.handleURL(url);
|
34062 | },
|
34063 |
|
34064 | |
34065 |
|
34066 |
|
34067 | setupEventDispatcher() {
|
34068 | var dispatcher = this.lookup('event_dispatcher:main');
|
34069 | var applicationCustomEvents = (0, _metal.get)(this.application, 'customEvents');
|
34070 | var instanceCustomEvents = (0, _metal.get)(this, 'customEvents');
|
34071 | var customEvents = (0, _polyfills.assign)({}, applicationCustomEvents, instanceCustomEvents);
|
34072 | dispatcher.setup(customEvents, this.rootElement);
|
34073 | return dispatcher;
|
34074 | },
|
34075 |
|
34076 | |
34077 |
|
34078 |
|
34079 |
|
34080 |
|
34081 |
|
34082 |
|
34083 | getURL() {
|
34084 | return this.router.url;
|
34085 | },
|
34086 |
|
34087 |
|
34088 |
|
34089 |
|
34090 | |
34091 |
|
34092 |
|
34093 |
|
34094 |
|
34095 |
|
34096 |
|
34097 |
|
34098 |
|
34099 | visit(url) {
|
34100 | this.setupRouter();
|
34101 |
|
34102 | var bootOptions = this.__container__.lookup('-environment:main');
|
34103 |
|
34104 | var router = this.router;
|
34105 |
|
34106 | var handleTransitionResolve = () => {
|
34107 | if (!bootOptions.options.shouldRender) {
|
34108 |
|
34109 | return this;
|
34110 | } else {
|
34111 |
|
34112 | return (0, _glimmer.renderSettled)().then(() => this);
|
34113 | }
|
34114 | };
|
34115 |
|
34116 | var handleTransitionReject = error => {
|
34117 | if (error.error) {
|
34118 | throw error.error;
|
34119 | } else if (error.name === 'TransitionAborted' && router._routerMicrolib.activeTransition) {
|
34120 | return router._routerMicrolib.activeTransition.then(handleTransitionResolve, handleTransitionReject);
|
34121 | } else if (error.name === 'TransitionAborted') {
|
34122 | throw new Error(error.message);
|
34123 | } else {
|
34124 | throw error;
|
34125 | }
|
34126 | };
|
34127 |
|
34128 | var location = (0, _metal.get)(router, 'location');
|
34129 |
|
34130 | location.setURL(url);
|
34131 |
|
34132 | return router.handleURL(location.getURL()).then(handleTransitionResolve, handleTransitionReject);
|
34133 | },
|
34134 |
|
34135 | willDestroy() {
|
34136 | this._super(...arguments);
|
34137 |
|
34138 | this.application._unwatchInstance(this);
|
34139 | }
|
34140 |
|
34141 | });
|
34142 |
|
34143 | ApplicationInstance.reopenClass({
|
34144 | |
34145 |
|
34146 |
|
34147 |
|
34148 |
|
34149 |
|
34150 | setupRegistry(registry, options = {}) {
|
34151 | if (!options.toEnvironment) {
|
34152 | options = new BootOptions(options);
|
34153 | }
|
34154 |
|
34155 | registry.register('-environment:main', options.toEnvironment(), {
|
34156 | instantiate: false
|
34157 | });
|
34158 | registry.register('service:-document', options.document, {
|
34159 | instantiate: false
|
34160 | });
|
34161 |
|
34162 | this._super(registry, options);
|
34163 | }
|
34164 |
|
34165 | });
|
34166 | |
34167 |
|
34168 |
|
34169 |
|
34170 |
|
34171 |
|
34172 |
|
34173 |
|
34174 |
|
34175 |
|
34176 |
|
34177 |
|
34178 |
|
34179 |
|
34180 |
|
34181 |
|
34182 |
|
34183 |
|
34184 |
|
34185 |
|
34186 |
|
34187 |
|
34188 |
|
34189 | class BootOptions {
|
34190 | constructor(options = {}) {
|
34191 | |
34192 |
|
34193 |
|
34194 |
|
34195 |
|
34196 |
|
34197 |
|
34198 |
|
34199 |
|
34200 |
|
34201 | this.jQuery = _views.jQuery;
|
34202 |
|
34203 | |
34204 |
|
34205 |
|
34206 |
|
34207 |
|
34208 |
|
34209 |
|
34210 |
|
34211 |
|
34212 | this.isInteractive = environment.hasDOM;
|
34213 |
|
34214 | |
34215 |
|
34216 |
|
34217 |
|
34218 |
|
34219 |
|
34220 |
|
34221 | this._renderMode = options._renderMode;
|
34222 | |
34223 |
|
34224 |
|
34225 |
|
34226 |
|
34227 |
|
34228 |
|
34229 |
|
34230 |
|
34231 |
|
34232 |
|
34233 |
|
34234 |
|
34235 |
|
34236 |
|
34237 |
|
34238 |
|
34239 |
|
34240 |
|
34241 | if (options.isBrowser !== undefined) {
|
34242 | this.isBrowser = Boolean(options.isBrowser);
|
34243 | } else {
|
34244 | this.isBrowser = environment.hasDOM;
|
34245 | }
|
34246 |
|
34247 | if (!this.isBrowser) {
|
34248 | this.jQuery = null;
|
34249 | this.isInteractive = false;
|
34250 | this.location = 'none';
|
34251 | }
|
34252 | |
34253 |
|
34254 |
|
34255 |
|
34256 |
|
34257 |
|
34258 |
|
34259 |
|
34260 |
|
34261 |
|
34262 |
|
34263 |
|
34264 | if (options.shouldRender !== undefined) {
|
34265 | this.shouldRender = Boolean(options.shouldRender);
|
34266 | } else {
|
34267 | this.shouldRender = true;
|
34268 | }
|
34269 |
|
34270 | if (!this.shouldRender) {
|
34271 | this.jQuery = null;
|
34272 | this.isInteractive = false;
|
34273 | }
|
34274 | |
34275 |
|
34276 |
|
34277 |
|
34278 |
|
34279 |
|
34280 |
|
34281 |
|
34282 |
|
34283 |
|
34284 |
|
34285 |
|
34286 |
|
34287 |
|
34288 |
|
34289 |
|
34290 |
|
34291 |
|
34292 |
|
34293 |
|
34294 | if (options.document) {
|
34295 | this.document = options.document;
|
34296 | } else {
|
34297 | this.document = typeof document !== 'undefined' ? document : null;
|
34298 | }
|
34299 | |
34300 |
|
34301 |
|
34302 |
|
34303 |
|
34304 |
|
34305 |
|
34306 |
|
34307 |
|
34308 |
|
34309 |
|
34310 |
|
34311 |
|
34312 |
|
34313 |
|
34314 |
|
34315 | if (options.rootElement) {
|
34316 | this.rootElement = options.rootElement;
|
34317 | }
|
34318 |
|
34319 |
|
34320 |
|
34321 | |
34322 |
|
34323 |
|
34324 |
|
34325 |
|
34326 |
|
34327 |
|
34328 |
|
34329 |
|
34330 |
|
34331 |
|
34332 | if (options.location !== undefined) {
|
34333 | this.location = options.location;
|
34334 | }
|
34335 |
|
34336 | if (options.jQuery !== undefined) {
|
34337 | this.jQuery = options.jQuery;
|
34338 | }
|
34339 |
|
34340 | if (options.isInteractive !== undefined) {
|
34341 | this.isInteractive = Boolean(options.isInteractive);
|
34342 | }
|
34343 | }
|
34344 |
|
34345 | toEnvironment() {
|
34346 |
|
34347 | var env = (0, _polyfills.assign)({}, environment);
|
34348 |
|
34349 | env.hasDOM = this.isBrowser;
|
34350 | env.isInteractive = this.isInteractive;
|
34351 | env._renderMode = this._renderMode;
|
34352 | env.options = this;
|
34353 | return env;
|
34354 | }
|
34355 |
|
34356 | }
|
34357 |
|
34358 | var _default = ApplicationInstance;
|
34359 | _exports.default = _default;
|
34360 | });
|
34361 | define("@ember/application/lib/application", ["exports", "@ember/-internals/utils", "@ember/-internals/environment", "@ember/-internals/browser-environment", "@ember/debug", "@ember/runloop", "@ember/-internals/metal", "@ember/application/lib/lazy_load", "@ember/-internals/runtime", "@ember/-internals/views", "@ember/-internals/routing", "@ember/application/instance", "@ember/engine", "@ember/-internals/container", "@ember/-internals/glimmer", "@ember/deprecated-features"], function (_exports, _utils, _environment, _browserEnvironment, _debug, _runloop, _metal, _lazy_load, _runtime, _views, _routing, _instance, _engine, _container, _glimmer, _deprecatedFeatures) {
|
34362 | "use strict";
|
34363 |
|
34364 | Object.defineProperty(_exports, "__esModule", {
|
34365 | value: true
|
34366 | });
|
34367 | _exports.default = void 0;
|
34368 |
|
34369 | |
34370 |
|
34371 |
|
34372 | var librariesRegistered = false;
|
34373 | |
34374 |
|
34375 |
|
34376 |
|
34377 |
|
34378 |
|
34379 |
|
34380 |
|
34381 |
|
34382 |
|
34383 |
|
34384 |
|
34385 |
|
34386 |
|
34387 |
|
34388 |
|
34389 |
|
34390 |
|
34391 |
|
34392 |
|
34393 |
|
34394 |
|
34395 |
|
34396 |
|
34397 |
|
34398 |
|
34399 |
|
34400 |
|
34401 |
|
34402 |
|
34403 |
|
34404 |
|
34405 |
|
34406 |
|
34407 |
|
34408 |
|
34409 |
|
34410 |
|
34411 |
|
34412 |
|
34413 |
|
34414 |
|
34415 |
|
34416 |
|
34417 |
|
34418 |
|
34419 |
|
34420 |
|
34421 |
|
34422 |
|
34423 |
|
34424 |
|
34425 |
|
34426 |
|
34427 |
|
34428 |
|
34429 |
|
34430 |
|
34431 |
|
34432 |
|
34433 |
|
34434 |
|
34435 |
|
34436 |
|
34437 |
|
34438 |
|
34439 |
|
34440 |
|
34441 |
|
34442 |
|
34443 |
|
34444 |
|
34445 |
|
34446 |
|
34447 |
|
34448 |
|
34449 |
|
34450 |
|
34451 |
|
34452 |
|
34453 |
|
34454 |
|
34455 |
|
34456 |
|
34457 |
|
34458 |
|
34459 |
|
34460 |
|
34461 |
|
34462 |
|
34463 |
|
34464 |
|
34465 |
|
34466 |
|
34467 |
|
34468 |
|
34469 |
|
34470 |
|
34471 |
|
34472 |
|
34473 |
|
34474 |
|
34475 |
|
34476 |
|
34477 |
|
34478 |
|
34479 |
|
34480 |
|
34481 |
|
34482 |
|
34483 |
|
34484 |
|
34485 |
|
34486 |
|
34487 |
|
34488 |
|
34489 |
|
34490 |
|
34491 |
|
34492 |
|
34493 |
|
34494 |
|
34495 |
|
34496 |
|
34497 |
|
34498 |
|
34499 |
|
34500 |
|
34501 |
|
34502 |
|
34503 |
|
34504 |
|
34505 |
|
34506 |
|
34507 |
|
34508 |
|
34509 |
|
34510 |
|
34511 |
|
34512 |
|
34513 |
|
34514 |
|
34515 |
|
34516 |
|
34517 |
|
34518 |
|
34519 |
|
34520 |
|
34521 |
|
34522 |
|
34523 |
|
34524 |
|
34525 |
|
34526 |
|
34527 | var Application = _engine.default.extend({
|
34528 | |
34529 |
|
34530 |
|
34531 |
|
34532 |
|
34533 |
|
34534 |
|
34535 |
|
34536 |
|
34537 |
|
34538 |
|
34539 |
|
34540 | rootElement: 'body',
|
34541 |
|
34542 | |
34543 |
|
34544 |
|
34545 |
|
34546 |
|
34547 |
|
34548 |
|
34549 |
|
34550 |
|
34551 |
|
34552 |
|
34553 |
|
34554 | eventDispatcher: null,
|
34555 |
|
34556 | |
34557 |
|
34558 |
|
34559 |
|
34560 |
|
34561 |
|
34562 |
|
34563 |
|
34564 |
|
34565 |
|
34566 |
|
34567 |
|
34568 |
|
34569 |
|
34570 |
|
34571 |
|
34572 |
|
34573 |
|
34574 |
|
34575 |
|
34576 |
|
34577 |
|
34578 |
|
34579 |
|
34580 |
|
34581 |
|
34582 |
|
34583 |
|
34584 |
|
34585 |
|
34586 |
|
34587 |
|
34588 |
|
34589 |
|
34590 |
|
34591 |
|
34592 |
|
34593 |
|
34594 | customEvents: null,
|
34595 |
|
34596 | |
34597 |
|
34598 |
|
34599 |
|
34600 |
|
34601 |
|
34602 |
|
34603 |
|
34604 |
|
34605 |
|
34606 |
|
34607 | autoboot: true,
|
34608 |
|
34609 | |
34610 |
|
34611 |
|
34612 |
|
34613 |
|
34614 |
|
34615 |
|
34616 |
|
34617 |
|
34618 |
|
34619 |
|
34620 |
|
34621 |
|
34622 |
|
34623 |
|
34624 |
|
34625 |
|
34626 |
|
34627 |
|
34628 |
|
34629 |
|
34630 |
|
34631 |
|
34632 |
|
34633 |
|
34634 |
|
34635 |
|
34636 |
|
34637 |
|
34638 |
|
34639 |
|
34640 |
|
34641 |
|
34642 |
|
34643 |
|
34644 |
|
34645 |
|
34646 | _globalsMode: true,
|
34647 |
|
34648 | |
34649 |
|
34650 |
|
34651 |
|
34652 |
|
34653 |
|
34654 |
|
34655 |
|
34656 | _applicationInstances: null,
|
34657 |
|
34658 | init() {
|
34659 |
|
34660 | this._super(...arguments);
|
34661 |
|
34662 | if (!this.$) {
|
34663 | this.$ = _views.jQuery;
|
34664 | }
|
34665 |
|
34666 | registerLibraries();
|
34667 |
|
34668 | if (true
|
34669 |
|
34670 | ) {
|
34671 | if (_environment.ENV.LOG_VERSION) {
|
34672 |
|
34673 | _environment.ENV.LOG_VERSION = false;
|
34674 |
|
34675 | _metal.libraries.logVersions();
|
34676 | }
|
34677 | }
|
34678 |
|
34679 |
|
34680 |
|
34681 | this._readinessDeferrals = 1;
|
34682 | this._booted = false;
|
34683 | this._applicationInstances = new Set();
|
34684 | this.autoboot = this._globalsMode = Boolean(this.autoboot);
|
34685 |
|
34686 | if (this._globalsMode) {
|
34687 | this._prepareForGlobalsMode();
|
34688 | }
|
34689 |
|
34690 | if (this.autoboot) {
|
34691 | this.waitForDOMReady();
|
34692 | }
|
34693 | },
|
34694 |
|
34695 | |
34696 |
|
34697 |
|
34698 |
|
34699 |
|
34700 |
|
34701 | buildInstance(options = {}) {
|
34702 | (true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot build new instances of this application since it has already been destroyed', !this.isDestroyed));
|
34703 | (true && !(!this.isDestroying) && (0, _debug.assert)('You cannot build new instances of this application since it is being destroyed', !this.isDestroying));
|
34704 | options.base = this;
|
34705 | options.application = this;
|
34706 | return _instance.default.create(options);
|
34707 | },
|
34708 |
|
34709 | |
34710 |
|
34711 |
|
34712 |
|
34713 |
|
34714 |
|
34715 | _watchInstance(instance) {
|
34716 | this._applicationInstances.add(instance);
|
34717 | },
|
34718 |
|
34719 | |
34720 |
|
34721 |
|
34722 |
|
34723 |
|
34724 |
|
34725 | _unwatchInstance(instance) {
|
34726 | return this._applicationInstances.delete(instance);
|
34727 | },
|
34728 |
|
34729 | |
34730 |
|
34731 |
|
34732 |
|
34733 |
|
34734 |
|
34735 |
|
34736 |
|
34737 |
|
34738 | _prepareForGlobalsMode() {
|
34739 |
|
34740 |
|
34741 |
|
34742 | this.Router = (this.Router || _routing.Router).extend();
|
34743 |
|
34744 | this._buildDeprecatedInstance();
|
34745 | },
|
34746 |
|
34747 | |
34748 |
|
34749 |
|
34750 |
|
34751 |
|
34752 |
|
34753 |
|
34754 |
|
34755 |
|
34756 |
|
34757 |
|
34758 |
|
34759 | _buildDeprecatedInstance() {
|
34760 |
|
34761 | var instance = this.buildInstance();
|
34762 |
|
34763 |
|
34764 | this.__deprecatedInstance__ = instance;
|
34765 | this.__container__ = instance.__container__;
|
34766 | },
|
34767 |
|
34768 | |
34769 |
|
34770 |
|
34771 |
|
34772 |
|
34773 |
|
34774 |
|
34775 |
|
34776 |
|
34777 |
|
34778 |
|
34779 | waitForDOMReady() {
|
34780 | if (!this.$ || this.$.isReady) {
|
34781 | (0, _runloop.schedule)('actions', this, 'domReady');
|
34782 | } else {
|
34783 | this.$().ready((0, _runloop.bind)(this, 'domReady'));
|
34784 | }
|
34785 | },
|
34786 |
|
34787 | |
34788 |
|
34789 |
|
34790 |
|
34791 |
|
34792 |
|
34793 |
|
34794 |
|
34795 |
|
34796 |
|
34797 |
|
34798 |
|
34799 |
|
34800 |
|
34801 |
|
34802 |
|
34803 |
|
34804 |
|
34805 |
|
34806 |
|
34807 |
|
34808 |
|
34809 |
|
34810 |
|
34811 |
|
34812 |
|
34813 |
|
34814 |
|
34815 |
|
34816 | domReady() {
|
34817 | if (this.isDestroying || this.isDestroyed) {
|
34818 | return;
|
34819 | }
|
34820 |
|
34821 | this._bootSync();
|
34822 |
|
34823 | },
|
34824 |
|
34825 | |
34826 |
|
34827 |
|
34828 |
|
34829 |
|
34830 |
|
34831 |
|
34832 |
|
34833 |
|
34834 |
|
34835 |
|
34836 |
|
34837 |
|
34838 |
|
34839 |
|
34840 |
|
34841 |
|
34842 |
|
34843 |
|
34844 |
|
34845 |
|
34846 | deferReadiness() {
|
34847 | (true && !(this instanceof Application) && (0, _debug.assert)('You must call deferReadiness on an instance of Application', this instanceof Application));
|
34848 | (true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot defer readiness since application has already destroyed', !this.isDestroyed));
|
34849 | (true && !(!this.isDestroying) && (0, _debug.assert)('You cannot defer readiness since the application is being destroyed', !this.isDestroying));
|
34850 | (true && !(this._readinessDeferrals > 0) && (0, _debug.assert)('You cannot defer readiness since the `ready()` hook has already been called', this._readinessDeferrals > 0));
|
34851 | this._readinessDeferrals++;
|
34852 | },
|
34853 |
|
34854 | |
34855 |
|
34856 |
|
34857 |
|
34858 |
|
34859 |
|
34860 |
|
34861 |
|
34862 | advanceReadiness() {
|
34863 | (true && !(this instanceof Application) && (0, _debug.assert)('You must call advanceReadiness on an instance of Application', this instanceof Application));
|
34864 | (true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot advance readiness since application has already destroyed', !this.isDestroyed));
|
34865 | (true && !(!this.isDestroying) && (0, _debug.assert)('You cannot advance readiness since the application is being destroyed', !this.isDestroying));
|
34866 | (true && !(this._readinessDeferrals > 0) && (0, _debug.assert)('You cannot advance readiness since the `ready()` hook has already been called', this._readinessDeferrals > 0));
|
34867 | this._readinessDeferrals--;
|
34868 |
|
34869 | if (this._readinessDeferrals === 0) {
|
34870 | (0, _runloop.once)(this, this.didBecomeReady);
|
34871 | }
|
34872 | },
|
34873 |
|
34874 | |
34875 |
|
34876 |
|
34877 |
|
34878 |
|
34879 |
|
34880 |
|
34881 |
|
34882 |
|
34883 |
|
34884 |
|
34885 |
|
34886 |
|
34887 | boot() {
|
34888 | (true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot boot this application since it has already been destroyed', !this.isDestroyed));
|
34889 | (true && !(!this.isDestroying) && (0, _debug.assert)('You cannot boot this application since it is being destroyed', !this.isDestroying));
|
34890 |
|
34891 | if (this._bootPromise) {
|
34892 | return this._bootPromise;
|
34893 | }
|
34894 |
|
34895 | try {
|
34896 | this._bootSync();
|
34897 | } catch (_) {
|
34898 |
|
34899 | }
|
34900 |
|
34901 | return this._bootPromise;
|
34902 | },
|
34903 |
|
34904 | |
34905 |
|
34906 |
|
34907 |
|
34908 |
|
34909 |
|
34910 |
|
34911 |
|
34912 |
|
34913 |
|
34914 |
|
34915 | _bootSync() {
|
34916 | if (this._booted || this.isDestroying || this.isDestroyed) {
|
34917 | return;
|
34918 | }
|
34919 |
|
34920 |
|
34921 |
|
34922 |
|
34923 |
|
34924 | var defer = this._bootResolver = _runtime.RSVP.defer();
|
34925 |
|
34926 | this._bootPromise = defer.promise;
|
34927 |
|
34928 | try {
|
34929 | this.runInitializers();
|
34930 | (0, _lazy_load.runLoadHooks)('application', this);
|
34931 | this.advanceReadiness();
|
34932 | } catch (error) {
|
34933 |
|
34934 | defer.reject(error);
|
34935 |
|
34936 | throw error;
|
34937 | }
|
34938 | },
|
34939 |
|
34940 | |
34941 |
|
34942 |
|
34943 |
|
34944 |
|
34945 |
|
34946 |
|
34947 |
|
34948 |
|
34949 |
|
34950 |
|
34951 |
|
34952 |
|
34953 |
|
34954 |
|
34955 |
|
34956 |
|
34957 |
|
34958 |
|
34959 |
|
34960 |
|
34961 |
|
34962 |
|
34963 |
|
34964 |
|
34965 |
|
34966 |
|
34967 |
|
34968 |
|
34969 |
|
34970 |
|
34971 |
|
34972 |
|
34973 |
|
34974 |
|
34975 |
|
34976 |
|
34977 |
|
34978 |
|
34979 |
|
34980 |
|
34981 |
|
34982 |
|
34983 |
|
34984 |
|
34985 |
|
34986 |
|
34987 |
|
34988 |
|
34989 |
|
34990 |
|
34991 |
|
34992 |
|
34993 |
|
34994 |
|
34995 | reset() {
|
34996 | (true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot reset this application since it has already been destroyed', !this.isDestroyed));
|
34997 | (true && !(!this.isDestroying) && (0, _debug.assert)('You cannot reset this application since it is being destroyed', !this.isDestroying));
|
34998 | (true && !(this._globalsMode && this.autoboot) && (0, _debug.assert)(`Calling reset() on instances of \`Application\` is not
|
34999 | supported when globals mode is disabled; call \`visit()\` to
|
35000 | create new \`ApplicationInstance\`s and dispose them
|
35001 | via their \`destroy()\` method instead.`, this._globalsMode && this.autoboot));
|
35002 | var instance = this.__deprecatedInstance__;
|
35003 | this._readinessDeferrals = 1;
|
35004 | this._bootPromise = null;
|
35005 | this._bootResolver = null;
|
35006 | this._booted = false;
|
35007 |
|
35008 | function handleReset() {
|
35009 | (0, _runloop.run)(instance, 'destroy');
|
35010 |
|
35011 | this._buildDeprecatedInstance();
|
35012 |
|
35013 | (0, _runloop.schedule)('actions', this, '_bootSync');
|
35014 | }
|
35015 |
|
35016 | (0, _runloop.join)(this, handleReset);
|
35017 | },
|
35018 |
|
35019 | |
35020 |
|
35021 |
|
35022 |
|
35023 | didBecomeReady() {
|
35024 | if (this.isDestroying || this.isDestroyed) {
|
35025 | return;
|
35026 | }
|
35027 |
|
35028 | try {
|
35029 |
|
35030 | if (!(0, _debug.isTesting)()) {
|
35031 |
|
35032 | (0, _metal.processAllNamespaces)();
|
35033 | (0, _metal.setNamespaceSearchDisabled)(true);
|
35034 | }
|
35035 |
|
35036 |
|
35037 | if (this.autoboot) {
|
35038 | var instance;
|
35039 |
|
35040 | if (this._globalsMode) {
|
35041 |
|
35042 |
|
35043 | instance = this.__deprecatedInstance__;
|
35044 | } else {
|
35045 |
|
35046 |
|
35047 |
|
35048 |
|
35049 | instance = this.buildInstance();
|
35050 | }
|
35051 |
|
35052 | instance._bootSync();
|
35053 |
|
35054 |
|
35055 | this.ready();
|
35056 | instance.startRouting();
|
35057 | }
|
35058 |
|
35059 |
|
35060 | this._bootResolver.resolve(this);
|
35061 |
|
35062 |
|
35063 | this._booted = true;
|
35064 | } catch (error) {
|
35065 |
|
35066 | this._bootResolver.reject(error);
|
35067 |
|
35068 |
|
35069 | throw error;
|
35070 | }
|
35071 | },
|
35072 |
|
35073 | |
35074 |
|
35075 |
|
35076 |
|
35077 |
|
35078 |
|
35079 | ready() {
|
35080 | return this;
|
35081 | },
|
35082 |
|
35083 |
|
35084 | willDestroy() {
|
35085 | this._super(...arguments);
|
35086 |
|
35087 | (0, _metal.setNamespaceSearchDisabled)(false);
|
35088 |
|
35089 | if (_lazy_load._loaded.application === this) {
|
35090 | _lazy_load._loaded.application = undefined;
|
35091 | }
|
35092 |
|
35093 | if (this._applicationInstances.size) {
|
35094 | this._applicationInstances.forEach(i => i.destroy());
|
35095 |
|
35096 | this._applicationInstances.clear();
|
35097 | }
|
35098 | },
|
35099 |
|
35100 | |
35101 |
|
35102 |
|
35103 |
|
35104 |
|
35105 |
|
35106 |
|
35107 |
|
35108 |
|
35109 |
|
35110 |
|
35111 |
|
35112 |
|
35113 |
|
35114 |
|
35115 |
|
35116 |
|
35117 |
|
35118 |
|
35119 |
|
35120 |
|
35121 |
|
35122 |
|
35123 |
|
35124 |
|
35125 |
|
35126 |
|
35127 |
|
35128 |
|
35129 |
|
35130 |
|
35131 |
|
35132 |
|
35133 |
|
35134 |
|
35135 |
|
35136 |
|
35137 |
|
35138 |
|
35139 |
|
35140 |
|
35141 |
|
35142 |
|
35143 |
|
35144 |
|
35145 |
|
35146 |
|
35147 |
|
35148 |
|
35149 |
|
35150 |
|
35151 |
|
35152 |
|
35153 |
|
35154 |
|
35155 |
|
35156 |
|
35157 |
|
35158 |
|
35159 |
|
35160 |
|
35161 |
|
35162 |
|
35163 |
|
35164 |
|
35165 |
|
35166 |
|
35167 |
|
35168 |
|
35169 |
|
35170 |
|
35171 |
|
35172 |
|
35173 |
|
35174 |
|
35175 |
|
35176 |
|
35177 |
|
35178 |
|
35179 |
|
35180 |
|
35181 |
|
35182 |
|
35183 |
|
35184 |
|
35185 |
|
35186 |
|
35187 |
|
35188 |
|
35189 |
|
35190 |
|
35191 |
|
35192 |
|
35193 |
|
35194 |
|
35195 |
|
35196 |
|
35197 |
|
35198 |
|
35199 |
|
35200 |
|
35201 |
|
35202 |
|
35203 |
|
35204 |
|
35205 |
|
35206 |
|
35207 |
|
35208 |
|
35209 |
|
35210 |
|
35211 |
|
35212 |
|
35213 |
|
35214 |
|
35215 |
|
35216 |
|
35217 |
|
35218 |
|
35219 |
|
35220 |
|
35221 |
|
35222 |
|
35223 |
|
35224 |
|
35225 |
|
35226 |
|
35227 |
|
35228 |
|
35229 |
|
35230 |
|
35231 |
|
35232 |
|
35233 |
|
35234 |
|
35235 |
|
35236 |
|
35237 |
|
35238 |
|
35239 |
|
35240 |
|
35241 |
|
35242 |
|
35243 |
|
35244 |
|
35245 |
|
35246 |
|
35247 |
|
35248 |
|
35249 |
|
35250 |
|
35251 |
|
35252 | visit(url, options) {
|
35253 | (true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot visit this application since it has already been destroyed', !this.isDestroyed));
|
35254 | (true && !(!this.isDestroying) && (0, _debug.assert)('You cannot visit this application since it is being destroyed', !this.isDestroying));
|
35255 | return this.boot().then(() => {
|
35256 | var instance = this.buildInstance();
|
35257 | return instance.boot(options).then(() => instance.visit(url)).catch(error => {
|
35258 | (0, _runloop.run)(instance, 'destroy');
|
35259 | throw error;
|
35260 | });
|
35261 | });
|
35262 | }
|
35263 |
|
35264 | });
|
35265 |
|
35266 | Application.reopenClass({
|
35267 | |
35268 |
|
35269 |
|
35270 |
|
35271 |
|
35272 |
|
35273 |
|
35274 |
|
35275 |
|
35276 |
|
35277 |
|
35278 |
|
35279 |
|
35280 |
|
35281 |
|
35282 |
|
35283 |
|
35284 |
|
35285 |
|
35286 |
|
35287 |
|
35288 |
|
35289 | buildRegistry() {
|
35290 |
|
35291 | var registry = this._super(...arguments);
|
35292 |
|
35293 | commonSetupRegistry(registry);
|
35294 | (0, _glimmer.setupApplicationRegistry)(registry);
|
35295 | return registry;
|
35296 | }
|
35297 |
|
35298 | });
|
35299 |
|
35300 | function commonSetupRegistry(registry) {
|
35301 | registry.register('router:main', _routing.Router.extend());
|
35302 | registry.register('-view-registry:main', {
|
35303 | create() {
|
35304 | return (0, _utils.dictionary)(null);
|
35305 | }
|
35306 |
|
35307 | });
|
35308 | registry.register('route:basic', _routing.Route);
|
35309 | registry.register('event_dispatcher:main', _views.EventDispatcher);
|
35310 | registry.injection('router:main', 'namespace', 'application:main');
|
35311 | registry.register('location:auto', _routing.AutoLocation);
|
35312 | registry.register('location:hash', _routing.HashLocation);
|
35313 | registry.register('location:history', _routing.HistoryLocation);
|
35314 | registry.register('location:none', _routing.NoneLocation);
|
35315 | registry.register((0, _container.privatize)`-bucket-cache:main`, {
|
35316 | create() {
|
35317 | return new _routing.BucketCache();
|
35318 | }
|
35319 |
|
35320 | });
|
35321 | registry.register('service:router', _routing.RouterService);
|
35322 | registry.injection('service:router', '_router', 'router:main');
|
35323 | }
|
35324 |
|
35325 | function registerLibraries() {
|
35326 | if (!librariesRegistered) {
|
35327 | librariesRegistered = true;
|
35328 |
|
35329 | if (_deprecatedFeatures.JQUERY_INTEGRATION && _browserEnvironment.hasDOM && !_views.jQueryDisabled) {
|
35330 | _metal.libraries.registerCoreLibrary('jQuery', (0, _views.jQuery)().jquery);
|
35331 | }
|
35332 | }
|
35333 | }
|
35334 |
|
35335 | var _default = Application;
|
35336 | _exports.default = _default;
|
35337 | });
|
35338 | define("@ember/application/lib/lazy_load", ["exports", "@ember/-internals/environment", "@ember/-internals/browser-environment"], function (_exports, _environment, _browserEnvironment) {
|
35339 | "use strict";
|
35340 |
|
35341 | Object.defineProperty(_exports, "__esModule", {
|
35342 | value: true
|
35343 | });
|
35344 | _exports.onLoad = onLoad;
|
35345 | _exports.runLoadHooks = runLoadHooks;
|
35346 | _exports._loaded = void 0;
|
35347 |
|
35348 |
|
35349 |
|
35350 | |
35351 |
|
35352 |
|
35353 | var loadHooks = _environment.ENV.EMBER_LOAD_HOOKS || {};
|
35354 | var loaded = {};
|
35355 | var _loaded = loaded;
|
35356 | |
35357 |
|
35358 |
|
35359 |
|
35360 |
|
35361 |
|
35362 |
|
35363 |
|
35364 |
|
35365 |
|
35366 |
|
35367 |
|
35368 |
|
35369 |
|
35370 |
|
35371 |
|
35372 |
|
35373 |
|
35374 |
|
35375 |
|
35376 |
|
35377 |
|
35378 |
|
35379 | _exports._loaded = _loaded;
|
35380 |
|
35381 | function onLoad(name, callback) {
|
35382 | var object = loaded[name];
|
35383 | loadHooks[name] = loadHooks[name] || [];
|
35384 | loadHooks[name].push(callback);
|
35385 |
|
35386 | if (object) {
|
35387 | callback(object);
|
35388 | }
|
35389 | }
|
35390 | |
35391 |
|
35392 |
|
35393 |
|
35394 |
|
35395 |
|
35396 |
|
35397 |
|
35398 |
|
35399 |
|
35400 |
|
35401 |
|
35402 |
|
35403 | function runLoadHooks(name, object) {
|
35404 | loaded[name] = object;
|
35405 |
|
35406 | if (_browserEnvironment.window && typeof CustomEvent === 'function') {
|
35407 | var event = new CustomEvent(name, {
|
35408 | detail: object,
|
35409 | name
|
35410 | });
|
35411 |
|
35412 | _browserEnvironment.window.dispatchEvent(event);
|
35413 | }
|
35414 |
|
35415 | if (loadHooks[name]) {
|
35416 | loadHooks[name].forEach(callback => callback(object));
|
35417 | }
|
35418 | }
|
35419 | });
|
35420 | define("@ember/canary-features/index", ["exports", "@ember/-internals/environment", "@ember/polyfills"], function (_exports, _environment, _polyfills) {
|
35421 | "use strict";
|
35422 |
|
35423 | Object.defineProperty(_exports, "__esModule", {
|
35424 | value: true
|
35425 | });
|
35426 | _exports.isEnabled = isEnabled;
|
35427 | _exports.EMBER_CACHE_API = _exports.EMBER_GLIMMER_IN_ELEMENT = _exports.EMBER_ROUTING_MODEL_ARG = _exports.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE = _exports.EMBER_CUSTOM_COMPONENT_ARG_PROXY = _exports.EMBER_MODULE_UNIFICATION = _exports.EMBER_NAMED_BLOCKS = _exports.EMBER_IMPROVED_INSTRUMENTATION = _exports.EMBER_LIBRARIES_ISREGISTERED = _exports.FEATURES = _exports.DEFAULT_FEATURES = void 0;
|
35428 |
|
35429 | |
35430 |
|
35431 |
|
35432 |
|
35433 |
|
35434 |
|
35435 |
|
35436 |
|
35437 |
|
35438 |
|
35439 | var DEFAULT_FEATURES = {
|
35440 | EMBER_LIBRARIES_ISREGISTERED: false,
|
35441 | EMBER_IMPROVED_INSTRUMENTATION: false,
|
35442 | EMBER_NAMED_BLOCKS: false,
|
35443 | EMBER_MODULE_UNIFICATION: false,
|
35444 | EMBER_CUSTOM_COMPONENT_ARG_PROXY: true,
|
35445 | EMBER_GLIMMER_SET_COMPONENT_TEMPLATE: true,
|
35446 | EMBER_ROUTING_MODEL_ARG: true,
|
35447 | EMBER_GLIMMER_IN_ELEMENT: true,
|
35448 | EMBER_CACHE_API: false
|
35449 | };
|
35450 | |
35451 |
|
35452 |
|
35453 |
|
35454 |
|
35455 |
|
35456 |
|
35457 |
|
35458 |
|
35459 |
|
35460 | _exports.DEFAULT_FEATURES = DEFAULT_FEATURES;
|
35461 | var FEATURES = (0, _polyfills.assign)(DEFAULT_FEATURES, _environment.ENV.FEATURES);
|
35462 | |
35463 |
|
35464 |
|
35465 |
|
35466 |
|
35467 |
|
35468 |
|
35469 |
|
35470 |
|
35471 |
|
35472 |
|
35473 |
|
35474 |
|
35475 |
|
35476 |
|
35477 |
|
35478 | _exports.FEATURES = FEATURES;
|
35479 |
|
35480 | function isEnabled(feature) {
|
35481 | var featureValue = FEATURES[feature];
|
35482 |
|
35483 | if (featureValue === true || featureValue === false) {
|
35484 | return featureValue;
|
35485 | } else if (_environment.ENV.ENABLE_OPTIONAL_FEATURES) {
|
35486 | return true;
|
35487 | } else {
|
35488 | return false;
|
35489 | }
|
35490 | }
|
35491 |
|
35492 | function featureValue(value) {
|
35493 | if (_environment.ENV.ENABLE_OPTIONAL_FEATURES && value === null) {
|
35494 | return true;
|
35495 | }
|
35496 |
|
35497 | return value;
|
35498 | }
|
35499 |
|
35500 | var EMBER_LIBRARIES_ISREGISTERED = featureValue(FEATURES.EMBER_LIBRARIES_ISREGISTERED);
|
35501 | _exports.EMBER_LIBRARIES_ISREGISTERED = EMBER_LIBRARIES_ISREGISTERED;
|
35502 | var EMBER_IMPROVED_INSTRUMENTATION = featureValue(FEATURES.EMBER_IMPROVED_INSTRUMENTATION);
|
35503 | _exports.EMBER_IMPROVED_INSTRUMENTATION = EMBER_IMPROVED_INSTRUMENTATION;
|
35504 | var EMBER_NAMED_BLOCKS = featureValue(FEATURES.EMBER_NAMED_BLOCKS);
|
35505 | _exports.EMBER_NAMED_BLOCKS = EMBER_NAMED_BLOCKS;
|
35506 | var EMBER_MODULE_UNIFICATION = featureValue(FEATURES.EMBER_MODULE_UNIFICATION);
|
35507 | _exports.EMBER_MODULE_UNIFICATION = EMBER_MODULE_UNIFICATION;
|
35508 | var EMBER_CUSTOM_COMPONENT_ARG_PROXY = featureValue(FEATURES.EMBER_CUSTOM_COMPONENT_ARG_PROXY);
|
35509 | _exports.EMBER_CUSTOM_COMPONENT_ARG_PROXY = EMBER_CUSTOM_COMPONENT_ARG_PROXY;
|
35510 | var EMBER_GLIMMER_SET_COMPONENT_TEMPLATE = featureValue(FEATURES.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE);
|
35511 | _exports.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE = EMBER_GLIMMER_SET_COMPONENT_TEMPLATE;
|
35512 | var EMBER_ROUTING_MODEL_ARG = featureValue(FEATURES.EMBER_ROUTING_MODEL_ARG);
|
35513 | _exports.EMBER_ROUTING_MODEL_ARG = EMBER_ROUTING_MODEL_ARG;
|
35514 | var EMBER_GLIMMER_IN_ELEMENT = featureValue(FEATURES.EMBER_GLIMMER_IN_ELEMENT);
|
35515 | _exports.EMBER_GLIMMER_IN_ELEMENT = EMBER_GLIMMER_IN_ELEMENT;
|
35516 | var EMBER_CACHE_API = featureValue(FEATURES.EMBER_CACHE_API);
|
35517 | _exports.EMBER_CACHE_API = EMBER_CACHE_API;
|
35518 | });
|
35519 | define("@ember/component/index", ["exports", "@ember/-internals/glimmer"], function (_exports, _glimmer) {
|
35520 | "use strict";
|
35521 |
|
35522 | Object.defineProperty(_exports, "__esModule", {
|
35523 | value: true
|
35524 | });
|
35525 | Object.defineProperty(_exports, "Component", {
|
35526 | enumerable: true,
|
35527 | get: function () {
|
35528 | return _glimmer.Component;
|
35529 | }
|
35530 | });
|
35531 | });
|
35532 | define("@ember/component/template-only", ["exports"], function (_exports) {
|
35533 | "use strict";
|
35534 |
|
35535 | Object.defineProperty(_exports, "__esModule", {
|
35536 | value: true
|
35537 | });
|
35538 | _exports.default = templateOnlyComponent;
|
35539 | _exports.isTemplateOnlyComponent = isTemplateOnlyComponent;
|
35540 | _exports.TemplateOnlyComponent = void 0;
|
35541 |
|
35542 |
|
35543 | class TemplateOnlyComponent {
|
35544 | constructor(moduleName = '@ember/component/template-only') {
|
35545 | this.moduleName = moduleName;
|
35546 | }
|
35547 |
|
35548 | toString() {
|
35549 | return this.moduleName;
|
35550 | }
|
35551 |
|
35552 | }
|
35553 | |
35554 |
|
35555 |
|
35556 |
|
35557 |
|
35558 | |
35559 |
|
35560 |
|
35561 |
|
35562 |
|
35563 |
|
35564 |
|
35565 |
|
35566 |
|
35567 |
|
35568 |
|
35569 |
|
35570 |
|
35571 |
|
35572 |
|
35573 |
|
35574 |
|
35575 |
|
35576 |
|
35577 |
|
35578 |
|
35579 |
|
35580 |
|
35581 |
|
35582 |
|
35583 |
|
35584 | _exports.TemplateOnlyComponent = TemplateOnlyComponent;
|
35585 |
|
35586 | function templateOnlyComponent(moduleName) {
|
35587 | return new TemplateOnlyComponent(moduleName);
|
35588 | }
|
35589 |
|
35590 | function isTemplateOnlyComponent(component) {
|
35591 | return component instanceof TemplateOnlyComponent;
|
35592 | }
|
35593 | });
|
35594 | define("@ember/controller/index", ["exports", "@ember/-internals/runtime", "@ember/-internals/metal", "@ember/controller/lib/controller_mixin"], function (_exports, _runtime, _metal, _controller_mixin) {
|
35595 | "use strict";
|
35596 |
|
35597 | Object.defineProperty(_exports, "__esModule", {
|
35598 | value: true
|
35599 | });
|
35600 | _exports.inject = inject;
|
35601 | _exports.default = void 0;
|
35602 |
|
35603 | |
35604 |
|
35605 |
|
35606 |
|
35607 | |
35608 |
|
35609 |
|
35610 |
|
35611 |
|
35612 |
|
35613 | var Controller = _runtime.FrameworkObject.extend(_controller_mixin.default);
|
35614 | |
35615 |
|
35616 |
|
35617 |
|
35618 |
|
35619 |
|
35620 |
|
35621 |
|
35622 |
|
35623 |
|
35624 |
|
35625 |
|
35626 |
|
35627 |
|
35628 |
|
35629 |
|
35630 |
|
35631 |
|
35632 |
|
35633 |
|
35634 |
|
35635 |
|
35636 |
|
35637 |
|
35638 |
|
35639 |
|
35640 |
|
35641 |
|
35642 |
|
35643 |
|
35644 |
|
35645 |
|
35646 |
|
35647 |
|
35648 |
|
35649 |
|
35650 |
|
35651 |
|
35652 |
|
35653 |
|
35654 |
|
35655 |
|
35656 |
|
35657 | function inject() {
|
35658 | return (0, _metal.inject)('controller', ...arguments);
|
35659 | }
|
35660 |
|
35661 | var _default = Controller;
|
35662 | _exports.default = _default;
|
35663 | });
|
35664 | define("@ember/controller/lib/controller_mixin", ["exports", "@ember/-internals/metal", "@ember/-internals/runtime", "@ember/-internals/utils"], function (_exports, _metal, _runtime, _utils) {
|
35665 | "use strict";
|
35666 |
|
35667 | Object.defineProperty(_exports, "__esModule", {
|
35668 | value: true
|
35669 | });
|
35670 | _exports.default = void 0;
|
35671 | var MODEL = (0, _utils.symbol)('MODEL');
|
35672 | |
35673 |
|
35674 |
|
35675 |
|
35676 | |
35677 |
|
35678 |
|
35679 |
|
35680 |
|
35681 |
|
35682 |
|
35683 | var _default = _metal.Mixin.create(_runtime.ActionHandler, {
|
35684 |
|
35685 | isController: true,
|
35686 |
|
35687 | |
35688 |
|
35689 |
|
35690 |
|
35691 |
|
35692 |
|
35693 |
|
35694 |
|
35695 |
|
35696 |
|
35697 |
|
35698 |
|
35699 |
|
35700 | target: null,
|
35701 | store: null,
|
35702 |
|
35703 | |
35704 |
|
35705 |
|
35706 |
|
35707 |
|
35708 |
|
35709 | model: (0, _metal.computed)({
|
35710 | get() {
|
35711 | return this[MODEL];
|
35712 | },
|
35713 |
|
35714 | set(key, value) {
|
35715 | return this[MODEL] = value;
|
35716 | }
|
35717 |
|
35718 | })
|
35719 | });
|
35720 |
|
35721 | _exports.default = _default;
|
35722 | });
|
35723 | define("@ember/debug/index", ["exports", "@ember/-internals/browser-environment", "@ember/error", "@ember/debug/lib/deprecate", "@ember/debug/lib/testing", "@ember/debug/lib/warn", "@ember/debug/lib/capture-render-tree"], function (_exports, _browserEnvironment, _error, _deprecate2, _testing, _warn2, _captureRenderTree) {
|
35724 | "use strict";
|
35725 |
|
35726 | Object.defineProperty(_exports, "__esModule", {
|
35727 | value: true
|
35728 | });
|
35729 | Object.defineProperty(_exports, "registerDeprecationHandler", {
|
35730 | enumerable: true,
|
35731 | get: function () {
|
35732 | return _deprecate2.registerHandler;
|
35733 | }
|
35734 | });
|
35735 | Object.defineProperty(_exports, "isTesting", {
|
35736 | enumerable: true,
|
35737 | get: function () {
|
35738 | return _testing.isTesting;
|
35739 | }
|
35740 | });
|
35741 | Object.defineProperty(_exports, "setTesting", {
|
35742 | enumerable: true,
|
35743 | get: function () {
|
35744 | return _testing.setTesting;
|
35745 | }
|
35746 | });
|
35747 | Object.defineProperty(_exports, "registerWarnHandler", {
|
35748 | enumerable: true,
|
35749 | get: function () {
|
35750 | return _warn2.registerHandler;
|
35751 | }
|
35752 | });
|
35753 | Object.defineProperty(_exports, "captureRenderTree", {
|
35754 | enumerable: true,
|
35755 | get: function () {
|
35756 | return _captureRenderTree.default;
|
35757 | }
|
35758 | });
|
35759 | _exports._warnIfUsingStrippedFeatureFlags = _exports.getDebugFunction = _exports.setDebugFunction = _exports.deprecateFunc = _exports.runInDebug = _exports.debugFreeze = _exports.debugSeal = _exports.deprecate = _exports.debug = _exports.warn = _exports.info = _exports.assert = void 0;
|
35760 |
|
35761 |
|
35762 | var noop = () => {};
|
35763 |
|
35764 | var assert = noop;
|
35765 | _exports.assert = assert;
|
35766 | var info = noop;
|
35767 | _exports.info = info;
|
35768 | var warn = noop;
|
35769 | _exports.warn = warn;
|
35770 | var debug = noop;
|
35771 | _exports.debug = debug;
|
35772 | var deprecate = noop;
|
35773 | _exports.deprecate = deprecate;
|
35774 | var debugSeal = noop;
|
35775 | _exports.debugSeal = debugSeal;
|
35776 | var debugFreeze = noop;
|
35777 | _exports.debugFreeze = debugFreeze;
|
35778 | var runInDebug = noop;
|
35779 | _exports.runInDebug = runInDebug;
|
35780 | var setDebugFunction = noop;
|
35781 | _exports.setDebugFunction = setDebugFunction;
|
35782 | var getDebugFunction = noop;
|
35783 | _exports.getDebugFunction = getDebugFunction;
|
35784 |
|
35785 | var deprecateFunc = function () {
|
35786 | return arguments[arguments.length - 1];
|
35787 | };
|
35788 |
|
35789 | _exports.deprecateFunc = deprecateFunc;
|
35790 |
|
35791 | if (true
|
35792 |
|
35793 | ) {
|
35794 | _exports.setDebugFunction = setDebugFunction = function (type, callback) {
|
35795 | switch (type) {
|
35796 | case 'assert':
|
35797 | return _exports.assert = assert = callback;
|
35798 |
|
35799 | case 'info':
|
35800 | return _exports.info = info = callback;
|
35801 |
|
35802 | case 'warn':
|
35803 | return _exports.warn = warn = callback;
|
35804 |
|
35805 | case 'debug':
|
35806 | return _exports.debug = debug = callback;
|
35807 |
|
35808 | case 'deprecate':
|
35809 | return _exports.deprecate = deprecate = callback;
|
35810 |
|
35811 | case 'debugSeal':
|
35812 | return _exports.debugSeal = debugSeal = callback;
|
35813 |
|
35814 | case 'debugFreeze':
|
35815 | return _exports.debugFreeze = debugFreeze = callback;
|
35816 |
|
35817 | case 'runInDebug':
|
35818 | return _exports.runInDebug = runInDebug = callback;
|
35819 |
|
35820 | case 'deprecateFunc':
|
35821 | return _exports.deprecateFunc = deprecateFunc = callback;
|
35822 | }
|
35823 | };
|
35824 |
|
35825 | _exports.getDebugFunction = getDebugFunction = function (type) {
|
35826 | switch (type) {
|
35827 | case 'assert':
|
35828 | return assert;
|
35829 |
|
35830 | case 'info':
|
35831 | return info;
|
35832 |
|
35833 | case 'warn':
|
35834 | return warn;
|
35835 |
|
35836 | case 'debug':
|
35837 | return debug;
|
35838 |
|
35839 | case 'deprecate':
|
35840 | return deprecate;
|
35841 |
|
35842 | case 'debugSeal':
|
35843 | return debugSeal;
|
35844 |
|
35845 | case 'debugFreeze':
|
35846 | return debugFreeze;
|
35847 |
|
35848 | case 'runInDebug':
|
35849 | return runInDebug;
|
35850 |
|
35851 | case 'deprecateFunc':
|
35852 | return deprecateFunc;
|
35853 | }
|
35854 | };
|
35855 | }
|
35856 | |
35857 |
|
35858 |
|
35859 |
|
35860 |
|
35861 | if (true
|
35862 |
|
35863 | ) {
|
35864 | |
35865 |
|
35866 |
|
35867 |
|
35868 |
|
35869 |
|
35870 |
|
35871 |
|
35872 |
|
35873 |
|
35874 |
|
35875 |
|
35876 |
|
35877 |
|
35878 |
|
35879 |
|
35880 |
|
35881 |
|
35882 |
|
35883 |
|
35884 |
|
35885 |
|
35886 |
|
35887 |
|
35888 |
|
35889 |
|
35890 |
|
35891 |
|
35892 | setDebugFunction('assert', function assert(desc, test) {
|
35893 | if (!test) {
|
35894 | throw new _error.default(`Assertion Failed: ${desc}`);
|
35895 | }
|
35896 | });
|
35897 | |
35898 |
|
35899 |
|
35900 |
|
35901 |
|
35902 |
|
35903 |
|
35904 |
|
35905 |
|
35906 |
|
35907 |
|
35908 |
|
35909 |
|
35910 |
|
35911 |
|
35912 |
|
35913 | setDebugFunction('debug', function debug(message) {
|
35914 |
|
35915 | if (console.debug) {
|
35916 | console.debug(`DEBUG: ${message}`);
|
35917 | } else {
|
35918 | console.log(`DEBUG: ${message}`);
|
35919 | }
|
35920 |
|
35921 |
|
35922 | });
|
35923 | |
35924 |
|
35925 |
|
35926 |
|
35927 |
|
35928 |
|
35929 |
|
35930 |
|
35931 |
|
35932 | setDebugFunction('info', function info() {
|
35933 | console.info(...arguments);
|
35934 |
|
35935 | });
|
35936 | |
35937 |
|
35938 |
|
35939 |
|
35940 |
|
35941 | |
35942 |
|
35943 |
|
35944 |
|
35945 |
|
35946 |
|
35947 |
|
35948 |
|
35949 |
|
35950 |
|
35951 |
|
35952 |
|
35953 |
|
35954 |
|
35955 |
|
35956 |
|
35957 |
|
35958 |
|
35959 |
|
35960 |
|
35961 |
|
35962 | setDebugFunction('deprecateFunc', function deprecateFunc(...args) {
|
35963 | if (args.length === 3) {
|
35964 | var [message, options, func] = args;
|
35965 | return function (...args) {
|
35966 | deprecate(message, false, options);
|
35967 | return func.apply(this, args);
|
35968 | };
|
35969 | } else {
|
35970 | var [_message, _func] = args;
|
35971 | return function () {
|
35972 | deprecate(_message);
|
35973 | return _func.apply(this, arguments);
|
35974 | };
|
35975 | }
|
35976 | });
|
35977 | |
35978 |
|
35979 |
|
35980 |
|
35981 |
|
35982 | |
35983 |
|
35984 |
|
35985 |
|
35986 |
|
35987 |
|
35988 |
|
35989 |
|
35990 |
|
35991 |
|
35992 |
|
35993 |
|
35994 |
|
35995 |
|
35996 |
|
35997 |
|
35998 |
|
35999 |
|
36000 |
|
36001 |
|
36002 |
|
36003 |
|
36004 |
|
36005 |
|
36006 | setDebugFunction('runInDebug', function runInDebug(func) {
|
36007 | func();
|
36008 | });
|
36009 | setDebugFunction('debugSeal', function debugSeal(obj) {
|
36010 | Object.seal(obj);
|
36011 | });
|
36012 | setDebugFunction('debugFreeze', function debugFreeze(obj) {
|
36013 |
|
36014 |
|
36015 |
|
36016 |
|
36017 | if (!Object.isFrozen(obj)) {
|
36018 | Object.freeze(obj);
|
36019 | }
|
36020 | });
|
36021 | setDebugFunction('deprecate', _deprecate2.default);
|
36022 | setDebugFunction('warn', _warn2.default);
|
36023 | }
|
36024 |
|
36025 | var _warnIfUsingStrippedFeatureFlags;
|
36026 |
|
36027 | _exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
|
36028 |
|
36029 | if (true
|
36030 |
|
36031 | && !(0, _testing.isTesting)()) {
|
36032 | if (typeof window !== 'undefined' && (_browserEnvironment.isFirefox || _browserEnvironment.isChrome) && window.addEventListener) {
|
36033 | window.addEventListener('load', () => {
|
36034 | if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset.emberExtension) {
|
36035 | var downloadURL;
|
36036 |
|
36037 | if (_browserEnvironment.isChrome) {
|
36038 | downloadURL = 'https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi';
|
36039 | } else if (_browserEnvironment.isFirefox) {
|
36040 | downloadURL = 'https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/';
|
36041 | }
|
36042 |
|
36043 | debug(`For more advanced debugging, install the Ember Inspector from ${downloadURL}`);
|
36044 | }
|
36045 | }, false);
|
36046 | }
|
36047 | }
|
36048 | });
|
36049 | define("@ember/debug/lib/capture-render-tree", ["exports", "@glimmer/util"], function (_exports, _util) {
|
36050 | "use strict";
|
36051 |
|
36052 | Object.defineProperty(_exports, "__esModule", {
|
36053 | value: true
|
36054 | });
|
36055 | _exports.default = captureRenderTree;
|
36056 |
|
36057 | |
36058 |
|
36059 |
|
36060 |
|
36061 | |
36062 |
|
36063 |
|
36064 |
|
36065 |
|
36066 |
|
36067 |
|
36068 |
|
36069 |
|
36070 |
|
36071 |
|
36072 |
|
36073 |
|
36074 | function captureRenderTree(app) {
|
36075 | var env = (0, _util.expect)(app.lookup('-environment:main'), 'BUG: owner is missing -environment:main');
|
36076 | var rendererType = env.isInteractive ? 'renderer:-dom' : 'renderer:-inert';
|
36077 | var renderer = (0, _util.expect)(app.lookup(rendererType), `BUG: owner is missing ${rendererType}`);
|
36078 | return renderer.debugRenderTree.capture();
|
36079 | }
|
36080 | });
|
36081 | define("@ember/debug/lib/deprecate", ["exports", "@ember/-internals/environment", "@ember/debug/index", "@ember/debug/lib/handlers"], function (_exports, _environment, _index, _handlers) {
|
36082 | "use strict";
|
36083 |
|
36084 | Object.defineProperty(_exports, "__esModule", {
|
36085 | value: true
|
36086 | });
|
36087 | _exports.missingOptionsUntilDeprecation = _exports.missingOptionsIdDeprecation = _exports.missingOptionsDeprecation = _exports.registerHandler = _exports.default = void 0;
|
36088 |
|
36089 | |
36090 |
|
36091 |
|
36092 |
|
36093 |
|
36094 | |
36095 |
|
36096 |
|
36097 |
|
36098 |
|
36099 |
|
36100 |
|
36101 |
|
36102 |
|
36103 |
|
36104 |
|
36105 |
|
36106 |
|
36107 |
|
36108 |
|
36109 |
|
36110 |
|
36111 |
|
36112 |
|
36113 |
|
36114 |
|
36115 |
|
36116 |
|
36117 |
|
36118 |
|
36119 |
|
36120 |
|
36121 |
|
36122 |
|
36123 |
|
36124 |
|
36125 |
|
36126 |
|
36127 |
|
36128 |
|
36129 |
|
36130 |
|
36131 |
|
36132 | var registerHandler = () => {};
|
36133 |
|
36134 | _exports.registerHandler = registerHandler;
|
36135 | var missingOptionsDeprecation;
|
36136 | _exports.missingOptionsDeprecation = missingOptionsDeprecation;
|
36137 | var missingOptionsIdDeprecation;
|
36138 | _exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation;
|
36139 | var missingOptionsUntilDeprecation;
|
36140 | _exports.missingOptionsUntilDeprecation = missingOptionsUntilDeprecation;
|
36141 |
|
36142 | var deprecate = () => {};
|
36143 |
|
36144 | if (true
|
36145 |
|
36146 | ) {
|
36147 | _exports.registerHandler = registerHandler = function registerHandler(handler) {
|
36148 | (0, _handlers.registerHandler)('deprecate', handler);
|
36149 | };
|
36150 |
|
36151 | var formatMessage = function formatMessage(_message, options) {
|
36152 | var message = _message;
|
36153 |
|
36154 | if (options && options.id) {
|
36155 | message = message + ` [deprecation id: ${options.id}]`;
|
36156 | }
|
36157 |
|
36158 | if (options && options.url) {
|
36159 | message += ` See ${options.url} for more details.`;
|
36160 | }
|
36161 |
|
36162 | return message;
|
36163 | };
|
36164 |
|
36165 | registerHandler(function logDeprecationToConsole(message, options) {
|
36166 | var updatedMessage = formatMessage(message, options);
|
36167 | console.warn(`DEPRECATION: ${updatedMessage}`);
|
36168 | });
|
36169 | var captureErrorForStack;
|
36170 |
|
36171 | if (new Error().stack) {
|
36172 | captureErrorForStack = () => new Error();
|
36173 | } else {
|
36174 | captureErrorForStack = () => {
|
36175 | try {
|
36176 | __fail__.fail();
|
36177 | } catch (e) {
|
36178 | return e;
|
36179 | }
|
36180 | };
|
36181 | }
|
36182 |
|
36183 | registerHandler(function logDeprecationStackTrace(message, options, next) {
|
36184 | if (_environment.ENV.LOG_STACKTRACE_ON_DEPRECATION) {
|
36185 | var stackStr = '';
|
36186 | var error = captureErrorForStack();
|
36187 | var stack;
|
36188 |
|
36189 | if (error.stack) {
|
36190 | if (error['arguments']) {
|
36191 |
|
36192 | stack = error.stack.replace(/^\s+at\s+/gm, '').replace(/^([^(]+?)([\n$])/gm, '{anonymous}($1)$2').replace(/^Object.<anonymous>\s*\(([^)]+)\)/gm, '{anonymous}($1)').split('\n');
|
36193 | stack.shift();
|
36194 | } else {
|
36195 |
|
36196 | stack = error.stack.replace(/(?:\n@:0)?\s+$/m, '').replace(/^\(/gm, '{anonymous}(').split('\n');
|
36197 | }
|
36198 |
|
36199 | stackStr = `\n ${stack.slice(2).join('\n ')}`;
|
36200 | }
|
36201 |
|
36202 | var updatedMessage = formatMessage(message, options);
|
36203 | console.warn(`DEPRECATION: ${updatedMessage}${stackStr}`);
|
36204 | } else {
|
36205 | next(message, options);
|
36206 | }
|
36207 | });
|
36208 | registerHandler(function raiseOnDeprecation(message, options, next) {
|
36209 | if (_environment.ENV.RAISE_ON_DEPRECATION) {
|
36210 | var updatedMessage = formatMessage(message);
|
36211 | throw new Error(updatedMessage);
|
36212 | } else {
|
36213 | next(message, options);
|
36214 | }
|
36215 | });
|
36216 | _exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `deprecate` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include `id` and `until` properties.';
|
36217 | _exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `deprecate` you must provide `id` in options.';
|
36218 | _exports.missingOptionsUntilDeprecation = missingOptionsUntilDeprecation = 'When calling `deprecate` you must provide `until` in options.';
|
36219 | |
36220 |
|
36221 |
|
36222 |
|
36223 |
|
36224 | |
36225 |
|
36226 |
|
36227 |
|
36228 |
|
36229 |
|
36230 |
|
36231 |
|
36232 |
|
36233 |
|
36234 |
|
36235 |
|
36236 |
|
36237 |
|
36238 |
|
36239 |
|
36240 |
|
36241 |
|
36242 |
|
36243 |
|
36244 |
|
36245 |
|
36246 |
|
36247 | deprecate = function deprecate(message, test, options) {
|
36248 | (0, _index.assert)(missingOptionsDeprecation, Boolean(options && (options.id || options.until)));
|
36249 | (0, _index.assert)(missingOptionsIdDeprecation, Boolean(options.id));
|
36250 | (0, _index.assert)(missingOptionsUntilDeprecation, Boolean(options.until));
|
36251 | (0, _handlers.invoke)('deprecate', message, test, options);
|
36252 | };
|
36253 | }
|
36254 |
|
36255 | var _default = deprecate;
|
36256 | _exports.default = _default;
|
36257 | });
|
36258 | define("@ember/debug/lib/handlers", ["exports"], function (_exports) {
|
36259 | "use strict";
|
36260 |
|
36261 | Object.defineProperty(_exports, "__esModule", {
|
36262 | value: true
|
36263 | });
|
36264 | _exports.invoke = _exports.registerHandler = _exports.HANDLERS = void 0;
|
36265 | var HANDLERS = {};
|
36266 | _exports.HANDLERS = HANDLERS;
|
36267 |
|
36268 | var registerHandler = () => {};
|
36269 |
|
36270 | _exports.registerHandler = registerHandler;
|
36271 |
|
36272 | var invoke = () => {};
|
36273 |
|
36274 | _exports.invoke = invoke;
|
36275 |
|
36276 | if (true
|
36277 |
|
36278 | ) {
|
36279 | _exports.registerHandler = registerHandler = function registerHandler(type, callback) {
|
36280 | var nextHandler = HANDLERS[type] || (() => {});
|
36281 |
|
36282 | HANDLERS[type] = (message, options) => {
|
36283 | callback(message, options, nextHandler);
|
36284 | };
|
36285 | };
|
36286 |
|
36287 | _exports.invoke = invoke = function invoke(type, message, test, options) {
|
36288 | if (test) {
|
36289 | return;
|
36290 | }
|
36291 |
|
36292 | var handlerForType = HANDLERS[type];
|
36293 |
|
36294 | if (handlerForType) {
|
36295 | handlerForType(message, options);
|
36296 | }
|
36297 | };
|
36298 | }
|
36299 | });
|
36300 | define("@ember/debug/lib/testing", ["exports"], function (_exports) {
|
36301 | "use strict";
|
36302 |
|
36303 | Object.defineProperty(_exports, "__esModule", {
|
36304 | value: true
|
36305 | });
|
36306 | _exports.isTesting = isTesting;
|
36307 | _exports.setTesting = setTesting;
|
36308 | var testing = false;
|
36309 |
|
36310 | function isTesting() {
|
36311 | return testing;
|
36312 | }
|
36313 |
|
36314 | function setTesting(value) {
|
36315 | testing = Boolean(value);
|
36316 | }
|
36317 | });
|
36318 | define("@ember/debug/lib/warn", ["exports", "@ember/debug/index", "@ember/debug/lib/handlers"], function (_exports, _index, _handlers) {
|
36319 | "use strict";
|
36320 |
|
36321 | Object.defineProperty(_exports, "__esModule", {
|
36322 | value: true
|
36323 | });
|
36324 | _exports.missingOptionsDeprecation = _exports.missingOptionsIdDeprecation = _exports.registerHandler = _exports.default = void 0;
|
36325 |
|
36326 | var registerHandler = () => {};
|
36327 |
|
36328 | _exports.registerHandler = registerHandler;
|
36329 |
|
36330 | var warn = () => {};
|
36331 |
|
36332 | var missingOptionsDeprecation;
|
36333 | _exports.missingOptionsDeprecation = missingOptionsDeprecation;
|
36334 | var missingOptionsIdDeprecation;
|
36335 | |
36336 |
|
36337 |
|
36338 |
|
36339 | _exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation;
|
36340 |
|
36341 | if (true
|
36342 |
|
36343 | ) {
|
36344 | |
36345 |
|
36346 |
|
36347 |
|
36348 |
|
36349 |
|
36350 |
|
36351 |
|
36352 |
|
36353 |
|
36354 |
|
36355 |
|
36356 |
|
36357 |
|
36358 |
|
36359 |
|
36360 |
|
36361 |
|
36362 |
|
36363 |
|
36364 |
|
36365 |
|
36366 |
|
36367 |
|
36368 |
|
36369 |
|
36370 | _exports.registerHandler = registerHandler = function registerHandler(handler) {
|
36371 | (0, _handlers.registerHandler)('warn', handler);
|
36372 | };
|
36373 |
|
36374 | registerHandler(function logWarning(message) {
|
36375 |
|
36376 | console.warn(`WARNING: ${message}`);
|
36377 |
|
36378 | });
|
36379 | _exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `warn` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include an `id` property.';
|
36380 | _exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `warn` you must provide `id` in options.';
|
36381 | |
36382 |
|
36383 |
|
36384 |
|
36385 |
|
36386 |
|
36387 |
|
36388 |
|
36389 |
|
36390 |
|
36391 |
|
36392 |
|
36393 |
|
36394 |
|
36395 |
|
36396 |
|
36397 |
|
36398 |
|
36399 |
|
36400 |
|
36401 |
|
36402 |
|
36403 |
|
36404 |
|
36405 |
|
36406 |
|
36407 | warn = function warn(message, test, options) {
|
36408 | if (arguments.length === 2 && typeof test === 'object') {
|
36409 | options = test;
|
36410 | test = false;
|
36411 | }
|
36412 |
|
36413 | (0, _index.assert)(missingOptionsDeprecation, Boolean(options));
|
36414 | (0, _index.assert)(missingOptionsIdDeprecation, Boolean(options && options.id));
|
36415 | (0, _handlers.invoke)('warn', message, test, options);
|
36416 | };
|
36417 | }
|
36418 |
|
36419 | var _default = warn;
|
36420 | _exports.default = _default;
|
36421 | });
|
36422 | define("@ember/deprecated-features/index", ["exports"], function (_exports) {
|
36423 | "use strict";
|
36424 |
|
36425 | Object.defineProperty(_exports, "__esModule", {
|
36426 | value: true
|
36427 | });
|
36428 | _exports.GLOBALS_RESOLVER = _exports.PARTIALS = _exports.EMBER_COMPONENT_IS_VISIBLE = _exports.MOUSE_ENTER_LEAVE_MOVE_EVENTS = _exports.FUNCTION_PROTOTYPE_EXTENSIONS = _exports.APP_CTRL_ROUTER_PROPS = _exports.ALIAS_METHOD = _exports.JQUERY_INTEGRATION = _exports.COMPONENT_MANAGER_STRING_LOOKUP = _exports.ROUTER_EVENTS = _exports.MERGE = _exports.LOGGER = _exports.EMBER_EXTEND_PROTOTYPES = _exports.SEND_ACTION = void 0;
|
36429 |
|
36430 |
|
36431 |
|
36432 |
|
36433 | var SEND_ACTION = !!'3.4.0';
|
36434 | _exports.SEND_ACTION = SEND_ACTION;
|
36435 | var EMBER_EXTEND_PROTOTYPES = !!'3.2.0-beta.5';
|
36436 | _exports.EMBER_EXTEND_PROTOTYPES = EMBER_EXTEND_PROTOTYPES;
|
36437 | var LOGGER = !!'3.2.0-beta.1';
|
36438 | _exports.LOGGER = LOGGER;
|
36439 | var MERGE = !!'3.6.0-beta.1';
|
36440 | _exports.MERGE = MERGE;
|
36441 | var ROUTER_EVENTS = !!'4.0.0';
|
36442 | _exports.ROUTER_EVENTS = ROUTER_EVENTS;
|
36443 | var COMPONENT_MANAGER_STRING_LOOKUP = !!'3.8.0';
|
36444 | _exports.COMPONENT_MANAGER_STRING_LOOKUP = COMPONENT_MANAGER_STRING_LOOKUP;
|
36445 | var JQUERY_INTEGRATION = !!'3.9.0';
|
36446 | _exports.JQUERY_INTEGRATION = JQUERY_INTEGRATION;
|
36447 | var ALIAS_METHOD = !!'3.9.0';
|
36448 | _exports.ALIAS_METHOD = ALIAS_METHOD;
|
36449 | var APP_CTRL_ROUTER_PROPS = !!'3.10.0-beta.1';
|
36450 | _exports.APP_CTRL_ROUTER_PROPS = APP_CTRL_ROUTER_PROPS;
|
36451 | var FUNCTION_PROTOTYPE_EXTENSIONS = !!'3.11.0-beta.1';
|
36452 | _exports.FUNCTION_PROTOTYPE_EXTENSIONS = FUNCTION_PROTOTYPE_EXTENSIONS;
|
36453 | var MOUSE_ENTER_LEAVE_MOVE_EVENTS = !!'3.13.0-beta.1';
|
36454 | _exports.MOUSE_ENTER_LEAVE_MOVE_EVENTS = MOUSE_ENTER_LEAVE_MOVE_EVENTS;
|
36455 | var EMBER_COMPONENT_IS_VISIBLE = !!'3.15.0-beta.1';
|
36456 | _exports.EMBER_COMPONENT_IS_VISIBLE = EMBER_COMPONENT_IS_VISIBLE;
|
36457 | var PARTIALS = !!'3.15.0-beta.1';
|
36458 | _exports.PARTIALS = PARTIALS;
|
36459 | var GLOBALS_RESOLVER = !!'3.16.0-beta.1';
|
36460 | _exports.GLOBALS_RESOLVER = GLOBALS_RESOLVER;
|
36461 | });
|
36462 | define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@ember/-internals/utils", "@ember/controller", "@ember/-internals/runtime", "@ember/-internals/container", "dag-map", "@ember/debug", "@ember/-internals/metal", "@ember/application/globals-resolver", "@ember/engine/instance", "@ember/-internals/routing", "@ember/-internals/extension-support", "@ember/-internals/views", "@ember/-internals/glimmer"], function (_exports, _engineParent, _utils, _controller, _runtime, _container, _dagMap, _debug, _metal, _globalsResolver, _instance, _routing, _extensionSupport, _views, _glimmer) {
|
36463 | "use strict";
|
36464 |
|
36465 | Object.defineProperty(_exports, "__esModule", {
|
36466 | value: true
|
36467 | });
|
36468 | Object.defineProperty(_exports, "getEngineParent", {
|
36469 | enumerable: true,
|
36470 | get: function () {
|
36471 | return _engineParent.getEngineParent;
|
36472 | }
|
36473 | });
|
36474 | Object.defineProperty(_exports, "setEngineParent", {
|
36475 | enumerable: true,
|
36476 | get: function () {
|
36477 | return _engineParent.setEngineParent;
|
36478 | }
|
36479 | });
|
36480 | _exports.default = void 0;
|
36481 |
|
36482 | function props(obj) {
|
36483 | var properties = [];
|
36484 |
|
36485 | for (var key in obj) {
|
36486 | properties.push(key);
|
36487 | }
|
36488 |
|
36489 | return properties;
|
36490 | }
|
36491 | |
36492 |
|
36493 |
|
36494 |
|
36495 | |
36496 |
|
36497 |
|
36498 |
|
36499 |
|
36500 |
|
36501 |
|
36502 |
|
36503 |
|
36504 |
|
36505 |
|
36506 |
|
36507 |
|
36508 |
|
36509 |
|
36510 |
|
36511 |
|
36512 |
|
36513 | var Engine = _runtime.Namespace.extend(_runtime.RegistryProxyMixin, {
|
36514 | init() {
|
36515 | this._super(...arguments);
|
36516 |
|
36517 | this.buildRegistry();
|
36518 | },
|
36519 |
|
36520 | |
36521 |
|
36522 |
|
36523 |
|
36524 |
|
36525 | _initializersRan: false,
|
36526 |
|
36527 | |
36528 |
|
36529 |
|
36530 |
|
36531 |
|
36532 | ensureInitializers() {
|
36533 | if (!this._initializersRan) {
|
36534 | this.runInitializers();
|
36535 | this._initializersRan = true;
|
36536 | }
|
36537 | },
|
36538 |
|
36539 | |
36540 |
|
36541 |
|
36542 |
|
36543 |
|
36544 |
|
36545 | buildInstance(options = {}) {
|
36546 | this.ensureInitializers();
|
36547 | options.base = this;
|
36548 | return _instance.default.create(options);
|
36549 | },
|
36550 |
|
36551 | |
36552 |
|
36553 |
|
36554 |
|
36555 |
|
36556 |
|
36557 | buildRegistry() {
|
36558 | var registry = this.__registry__ = this.constructor.buildRegistry(this);
|
36559 | return registry;
|
36560 | },
|
36561 |
|
36562 | |
36563 |
|
36564 |
|
36565 |
|
36566 | initializer(options) {
|
36567 | this.constructor.initializer(options);
|
36568 | },
|
36569 |
|
36570 | |
36571 |
|
36572 |
|
36573 |
|
36574 | instanceInitializer(options) {
|
36575 | this.constructor.instanceInitializer(options);
|
36576 | },
|
36577 |
|
36578 | |
36579 |
|
36580 |
|
36581 |
|
36582 | runInitializers() {
|
36583 | this._runInitializer('initializers', (name, initializer) => {
|
36584 | (true && !(Boolean(initializer)) && (0, _debug.assert)(`No application initializer named '${name}'`, Boolean(initializer)));
|
36585 | initializer.initialize(this);
|
36586 | });
|
36587 | },
|
36588 |
|
36589 | |
36590 |
|
36591 |
|
36592 |
|
36593 |
|
36594 | runInstanceInitializers(instance) {
|
36595 | this._runInitializer('instanceInitializers', (name, initializer) => {
|
36596 | (true && !(Boolean(initializer)) && (0, _debug.assert)(`No instance initializer named '${name}'`, Boolean(initializer)));
|
36597 | initializer.initialize(instance);
|
36598 | });
|
36599 | },
|
36600 |
|
36601 | _runInitializer(bucketName, cb) {
|
36602 | var initializersByName = (0, _metal.get)(this.constructor, bucketName);
|
36603 | var initializers = props(initializersByName);
|
36604 | var graph = new _dagMap.default();
|
36605 | var initializer;
|
36606 |
|
36607 | for (var i = 0; i < initializers.length; i++) {
|
36608 | initializer = initializersByName[initializers[i]];
|
36609 | graph.add(initializer.name, initializer, initializer.before, initializer.after);
|
36610 | }
|
36611 |
|
36612 | graph.topsort(cb);
|
36613 | }
|
36614 |
|
36615 | });
|
36616 |
|
36617 | Engine.reopenClass({
|
36618 | initializers: Object.create(null),
|
36619 | instanceInitializers: Object.create(null),
|
36620 |
|
36621 | |
36622 |
|
36623 |
|
36624 |
|
36625 |
|
36626 |
|
36627 |
|
36628 |
|
36629 |
|
36630 |
|
36631 |
|
36632 |
|
36633 |
|
36634 |
|
36635 |
|
36636 |
|
36637 |
|
36638 |
|
36639 |
|
36640 |
|
36641 |
|
36642 |
|
36643 |
|
36644 |
|
36645 |
|
36646 |
|
36647 |
|
36648 |
|
36649 |
|
36650 |
|
36651 |
|
36652 |
|
36653 |
|
36654 |
|
36655 |
|
36656 |
|
36657 |
|
36658 |
|
36659 |
|
36660 |
|
36661 |
|
36662 |
|
36663 |
|
36664 |
|
36665 |
|
36666 |
|
36667 |
|
36668 |
|
36669 |
|
36670 |
|
36671 |
|
36672 |
|
36673 |
|
36674 |
|
36675 |
|
36676 |
|
36677 |
|
36678 |
|
36679 |
|
36680 |
|
36681 |
|
36682 |
|
36683 |
|
36684 |
|
36685 |
|
36686 |
|
36687 |
|
36688 |
|
36689 |
|
36690 |
|
36691 |
|
36692 |
|
36693 |
|
36694 |
|
36695 |
|
36696 |
|
36697 |
|
36698 |
|
36699 |
|
36700 |
|
36701 |
|
36702 |
|
36703 |
|
36704 |
|
36705 |
|
36706 |
|
36707 |
|
36708 |
|
36709 |
|
36710 |
|
36711 |
|
36712 |
|
36713 |
|
36714 |
|
36715 |
|
36716 |
|
36717 |
|
36718 |
|
36719 |
|
36720 |
|
36721 |
|
36722 |
|
36723 |
|
36724 |
|
36725 |
|
36726 |
|
36727 |
|
36728 |
|
36729 |
|
36730 |
|
36731 |
|
36732 |
|
36733 | initializer: buildInitializerMethod('initializers', 'initializer'),
|
36734 |
|
36735 | |
36736 |
|
36737 |
|
36738 |
|
36739 |
|
36740 |
|
36741 |
|
36742 |
|
36743 |
|
36744 |
|
36745 |
|
36746 |
|
36747 |
|
36748 |
|
36749 |
|
36750 |
|
36751 |
|
36752 |
|
36753 |
|
36754 |
|
36755 |
|
36756 |
|
36757 |
|
36758 |
|
36759 |
|
36760 |
|
36761 |
|
36762 |
|
36763 |
|
36764 |
|
36765 |
|
36766 |
|
36767 |
|
36768 |
|
36769 |
|
36770 |
|
36771 |
|
36772 |
|
36773 |
|
36774 |
|
36775 |
|
36776 |
|
36777 |
|
36778 |
|
36779 |
|
36780 |
|
36781 |
|
36782 |
|
36783 |
|
36784 |
|
36785 |
|
36786 |
|
36787 |
|
36788 |
|
36789 |
|
36790 |
|
36791 | instanceInitializer: buildInitializerMethod('instanceInitializers', 'instance initializer'),
|
36792 |
|
36793 | |
36794 |
|
36795 |
|
36796 |
|
36797 |
|
36798 |
|
36799 |
|
36800 |
|
36801 |
|
36802 |
|
36803 |
|
36804 |
|
36805 |
|
36806 |
|
36807 |
|
36808 |
|
36809 |
|
36810 |
|
36811 |
|
36812 |
|
36813 |
|
36814 |
|
36815 | buildRegistry(namespace) {
|
36816 | var registry = new _container.Registry({
|
36817 | resolver: resolverFor(namespace)
|
36818 | });
|
36819 | registry.set = _metal.set;
|
36820 | registry.register('application:main', namespace, {
|
36821 | instantiate: false
|
36822 | });
|
36823 | commonSetupRegistry(registry);
|
36824 | (0, _glimmer.setupEngineRegistry)(registry);
|
36825 | return registry;
|
36826 | },
|
36827 |
|
36828 | |
36829 |
|
36830 |
|
36831 |
|
36832 |
|
36833 |
|
36834 | resolver: null,
|
36835 |
|
36836 | |
36837 |
|
36838 |
|
36839 |
|
36840 |
|
36841 | Resolver: null
|
36842 | });
|
36843 | |
36844 |
|
36845 |
|
36846 |
|
36847 |
|
36848 |
|
36849 |
|
36850 |
|
36851 |
|
36852 |
|
36853 |
|
36854 |
|
36855 |
|
36856 |
|
36857 |
|
36858 |
|
36859 |
|
36860 | function resolverFor(namespace) {
|
36861 | var ResolverClass = (0, _metal.get)(namespace, 'Resolver') || _globalsResolver.default;
|
36862 |
|
36863 | var props = {
|
36864 | namespace
|
36865 | };
|
36866 | return ResolverClass.create(props);
|
36867 | }
|
36868 |
|
36869 | function buildInitializerMethod(bucketName, humanName) {
|
36870 | return function (initializer) {
|
36871 |
|
36872 |
|
36873 |
|
36874 |
|
36875 | if (this.superclass[bucketName] !== undefined && this.superclass[bucketName] === this[bucketName]) {
|
36876 | var attrs = {};
|
36877 | attrs[bucketName] = Object.create(this[bucketName]);
|
36878 | this.reopenClass(attrs);
|
36879 | }
|
36880 |
|
36881 | (true && !(!this[bucketName][initializer.name]) && (0, _debug.assert)(`The ${humanName} '${initializer.name}' has already been registered`, !this[bucketName][initializer.name]));
|
36882 | (true && !((0, _utils.canInvoke)(initializer, 'initialize')) && (0, _debug.assert)(`An ${humanName} cannot be registered without an initialize function`, (0, _utils.canInvoke)(initializer, 'initialize')));
|
36883 | (true && !(initializer.name !== undefined) && (0, _debug.assert)(`An ${humanName} cannot be registered without a name property`, initializer.name !== undefined));
|
36884 | this[bucketName][initializer.name] = initializer;
|
36885 | };
|
36886 | }
|
36887 |
|
36888 | function commonSetupRegistry(registry) {
|
36889 | registry.optionsForType('component', {
|
36890 | singleton: false
|
36891 | });
|
36892 | registry.optionsForType('view', {
|
36893 | singleton: false
|
36894 | });
|
36895 | registry.register('controller:basic', _controller.default, {
|
36896 | instantiate: false
|
36897 | });
|
36898 | registry.injection('view', '_viewRegistry', '-view-registry:main');
|
36899 | registry.injection('renderer', '_viewRegistry', '-view-registry:main');
|
36900 | registry.injection('route', '_topLevelViewTemplate', 'template:-outlet');
|
36901 | registry.injection('view:-outlet', 'namespace', 'application:main');
|
36902 | registry.injection('controller', 'target', 'router:main');
|
36903 | registry.injection('controller', 'namespace', 'application:main');
|
36904 | registry.injection('router', '_bucketCache', (0, _container.privatize)`-bucket-cache:main`);
|
36905 | registry.injection('route', '_bucketCache', (0, _container.privatize)`-bucket-cache:main`);
|
36906 | registry.injection('route', '_router', 'router:main');
|
36907 |
|
36908 | registry.register('service:-routing', _routing.RoutingService);
|
36909 |
|
36910 | registry.injection('service:-routing', 'router', 'router:main');
|
36911 |
|
36912 | registry.register('resolver-for-debugging:main', registry.resolver, {
|
36913 | instantiate: false
|
36914 | });
|
36915 | registry.injection('container-debug-adapter:main', 'resolver', 'resolver-for-debugging:main');
|
36916 | registry.injection('data-adapter:main', 'containerDebugAdapter', 'container-debug-adapter:main');
|
36917 |
|
36918 | registry.register('container-debug-adapter:main', _extensionSupport.ContainerDebugAdapter);
|
36919 | registry.register('component-lookup:main', _views.ComponentLookup);
|
36920 | }
|
36921 |
|
36922 | var _default = Engine;
|
36923 | _exports.default = _default;
|
36924 | });
|
36925 | define("@ember/engine/instance", ["exports", "@ember/-internals/runtime", "@ember/debug", "@ember/error", "@ember/-internals/container", "@ember/-internals/utils", "@ember/engine/lib/engine-parent"], function (_exports, _runtime, _debug, _error, _container, _utils, _engineParent) {
|
36926 | "use strict";
|
36927 |
|
36928 | Object.defineProperty(_exports, "__esModule", {
|
36929 | value: true
|
36930 | });
|
36931 | _exports.default = void 0;
|
36932 |
|
36933 | |
36934 |
|
36935 |
|
36936 |
|
36937 | |
36938 |
|
36939 |
|
36940 |
|
36941 |
|
36942 |
|
36943 |
|
36944 |
|
36945 |
|
36946 |
|
36947 | var EngineInstance = _runtime.Object.extend(_runtime.RegistryProxyMixin, _runtime.ContainerProxyMixin, {
|
36948 | |
36949 |
|
36950 |
|
36951 |
|
36952 |
|
36953 | base: null,
|
36954 |
|
36955 | init() {
|
36956 | this._super(...arguments);
|
36957 |
|
36958 |
|
36959 | (0, _utils.guidFor)(this);
|
36960 | var base = this.base;
|
36961 |
|
36962 | if (!base) {
|
36963 | base = this.application;
|
36964 | this.base = base;
|
36965 | }
|
36966 |
|
36967 |
|
36968 |
|
36969 | var registry = this.__registry__ = new _container.Registry({
|
36970 | fallback: base.__registry__
|
36971 | });
|
36972 |
|
36973 | this.__container__ = registry.container({
|
36974 | owner: this
|
36975 | });
|
36976 | this._booted = false;
|
36977 | },
|
36978 |
|
36979 | |
36980 |
|
36981 |
|
36982 |
|
36983 |
|
36984 |
|
36985 |
|
36986 |
|
36987 |
|
36988 |
|
36989 | boot(options) {
|
36990 | if (this._bootPromise) {
|
36991 | return this._bootPromise;
|
36992 | }
|
36993 |
|
36994 | this._bootPromise = new _runtime.RSVP.Promise(resolve => resolve(this._bootSync(options)));
|
36995 | return this._bootPromise;
|
36996 | },
|
36997 |
|
36998 | |
36999 |
|
37000 |
|
37001 |
|
37002 |
|
37003 |
|
37004 |
|
37005 |
|
37006 |
|
37007 |
|
37008 |
|
37009 |
|
37010 | _bootSync(options) {
|
37011 | if (this._booted) {
|
37012 | return this;
|
37013 | }
|
37014 |
|
37015 | (true && !((0, _engineParent.getEngineParent)(this)) && (0, _debug.assert)("An engine instance's parent must be set via `setEngineParent(engine, parent)` prior to calling `engine.boot()`.", (0, _engineParent.getEngineParent)(this)));
|
37016 | this.cloneParentDependencies();
|
37017 | this.setupRegistry(options);
|
37018 | this.base.runInstanceInitializers(this);
|
37019 | this._booted = true;
|
37020 | return this;
|
37021 | },
|
37022 |
|
37023 | setupRegistry(options = this.__container__.lookup('-environment:main')) {
|
37024 | this.constructor.setupRegistry(this.__registry__, options);
|
37025 | },
|
37026 |
|
37027 | |
37028 |
|
37029 |
|
37030 |
|
37031 |
|
37032 |
|
37033 |
|
37034 |
|
37035 | unregister(fullName) {
|
37036 | this.__container__.reset(fullName);
|
37037 |
|
37038 | this._super(...arguments);
|
37039 | },
|
37040 |
|
37041 | |
37042 |
|
37043 |
|
37044 |
|
37045 |
|
37046 |
|
37047 |
|
37048 |
|
37049 |
|
37050 |
|
37051 | buildChildEngineInstance(name, options = {}) {
|
37052 | var Engine = this.lookup(`engine:${name}`);
|
37053 |
|
37054 | if (!Engine) {
|
37055 | throw new _error.default(`You attempted to mount the engine '${name}', but it is not registered with its parent.`);
|
37056 | }
|
37057 |
|
37058 | var engineInstance = Engine.buildInstance(options);
|
37059 | (0, _engineParent.setEngineParent)(engineInstance, this);
|
37060 | return engineInstance;
|
37061 | },
|
37062 |
|
37063 | |
37064 |
|
37065 |
|
37066 |
|
37067 |
|
37068 | cloneParentDependencies() {
|
37069 | var parent = (0, _engineParent.getEngineParent)(this);
|
37070 | var registrations = ['route:basic', 'service:-routing'];
|
37071 | registrations.forEach(key => this.register(key, parent.resolveRegistration(key)));
|
37072 | var env = parent.lookup('-environment:main');
|
37073 | this.register('-environment:main', env, {
|
37074 | instantiate: false
|
37075 | });
|
37076 | var singletons = ['router:main', (0, _container.privatize)`-bucket-cache:main`, '-view-registry:main', `renderer:-${env.isInteractive ? 'dom' : 'inert'}`, 'service:-document'];
|
37077 |
|
37078 | if (env.isInteractive) {
|
37079 | singletons.push('event_dispatcher:main');
|
37080 | }
|
37081 |
|
37082 | singletons.forEach(key => this.register(key, parent.lookup(key), {
|
37083 | instantiate: false
|
37084 | }));
|
37085 | this.inject('view', '_environment', '-environment:main');
|
37086 | this.inject('route', '_environment', '-environment:main');
|
37087 | }
|
37088 |
|
37089 | });
|
37090 |
|
37091 | EngineInstance.reopenClass({
|
37092 | |
37093 |
|
37094 |
|
37095 |
|
37096 |
|
37097 |
|
37098 | setupRegistry(registry, options) {
|
37099 |
|
37100 | if (!options) {
|
37101 | return;
|
37102 | }
|
37103 |
|
37104 | registry.injection('view', '_environment', '-environment:main');
|
37105 | registry.injection('route', '_environment', '-environment:main');
|
37106 |
|
37107 | if (options.isInteractive) {
|
37108 | registry.injection('view', 'renderer', 'renderer:-dom');
|
37109 | registry.injection('component', 'renderer', 'renderer:-dom');
|
37110 | } else {
|
37111 | registry.injection('view', 'renderer', 'renderer:-inert');
|
37112 | registry.injection('component', 'renderer', 'renderer:-inert');
|
37113 | }
|
37114 | }
|
37115 |
|
37116 | });
|
37117 | var _default = EngineInstance;
|
37118 | _exports.default = _default;
|
37119 | });
|
37120 | define("@ember/engine/lib/engine-parent", ["exports", "@ember/-internals/utils"], function (_exports, _utils) {
|
37121 | "use strict";
|
37122 |
|
37123 | Object.defineProperty(_exports, "__esModule", {
|
37124 | value: true
|
37125 | });
|
37126 | _exports.getEngineParent = getEngineParent;
|
37127 | _exports.setEngineParent = setEngineParent;
|
37128 |
|
37129 | |
37130 |
|
37131 |
|
37132 | var ENGINE_PARENT = (0, _utils.symbol)('ENGINE_PARENT');
|
37133 | |
37134 |
|
37135 |
|
37136 |
|
37137 |
|
37138 |
|
37139 |
|
37140 |
|
37141 |
|
37142 |
|
37143 |
|
37144 | function getEngineParent(engine) {
|
37145 | return engine[ENGINE_PARENT];
|
37146 | }
|
37147 | |
37148 |
|
37149 |
|
37150 |
|
37151 |
|
37152 |
|
37153 |
|
37154 |
|
37155 |
|
37156 |
|
37157 | function setEngineParent(engine, parent) {
|
37158 | engine[ENGINE_PARENT] = parent;
|
37159 | }
|
37160 | });
|
37161 | define("@ember/error/index", ["exports"], function (_exports) {
|
37162 | "use strict";
|
37163 |
|
37164 | Object.defineProperty(_exports, "__esModule", {
|
37165 | value: true
|
37166 | });
|
37167 | _exports.default = void 0;
|
37168 |
|
37169 | |
37170 |
|
37171 |
|
37172 |
|
37173 | |
37174 |
|
37175 |
|
37176 |
|
37177 |
|
37178 |
|
37179 |
|
37180 |
|
37181 |
|
37182 | var _default = Error;
|
37183 | _exports.default = _default;
|
37184 | });
|
37185 | define("@ember/instrumentation/index", ["exports", "@ember/-internals/environment"], function (_exports, _environment) {
|
37186 | "use strict";
|
37187 |
|
37188 | Object.defineProperty(_exports, "__esModule", {
|
37189 | value: true
|
37190 | });
|
37191 | _exports.instrument = instrument;
|
37192 | _exports._instrumentStart = _instrumentStart;
|
37193 | _exports.subscribe = subscribe;
|
37194 | _exports.unsubscribe = unsubscribe;
|
37195 | _exports.reset = reset;
|
37196 | _exports.flaggedInstrument = _exports.subscribers = void 0;
|
37197 |
|
37198 |
|
37199 |
|
37200 |
|
37201 |
|
37202 | |
37203 |
|
37204 |
|
37205 |
|
37206 |
|
37207 | |
37208 |
|
37209 |
|
37210 |
|
37211 |
|
37212 |
|
37213 |
|
37214 |
|
37215 |
|
37216 |
|
37217 |
|
37218 |
|
37219 |
|
37220 |
|
37221 |
|
37222 |
|
37223 |
|
37224 |
|
37225 |
|
37226 |
|
37227 |
|
37228 |
|
37229 |
|
37230 |
|
37231 |
|
37232 |
|
37233 |
|
37234 |
|
37235 |
|
37236 |
|
37237 |
|
37238 |
|
37239 |
|
37240 |
|
37241 |
|
37242 |
|
37243 |
|
37244 |
|
37245 |
|
37246 |
|
37247 |
|
37248 |
|
37249 |
|
37250 |
|
37251 |
|
37252 |
|
37253 |
|
37254 |
|
37255 |
|
37256 |
|
37257 | var subscribers = [];
|
37258 | _exports.subscribers = subscribers;
|
37259 | var cache = {};
|
37260 |
|
37261 | function populateListeners(name) {
|
37262 | var listeners = [];
|
37263 | var subscriber;
|
37264 |
|
37265 | for (var i = 0; i < subscribers.length; i++) {
|
37266 | subscriber = subscribers[i];
|
37267 |
|
37268 | if (subscriber.regex.test(name)) {
|
37269 | listeners.push(subscriber.object);
|
37270 | }
|
37271 | }
|
37272 |
|
37273 | cache[name] = listeners;
|
37274 | return listeners;
|
37275 | }
|
37276 |
|
37277 | var time = (() => {
|
37278 | var perf = 'undefined' !== typeof window ? window.performance || {} : {};
|
37279 | var fn = perf.now || perf.mozNow || perf.webkitNow || perf.msNow || perf.oNow;
|
37280 | return fn ? fn.bind(perf) : Date.now;
|
37281 | })();
|
37282 |
|
37283 | function isCallback(value) {
|
37284 | return typeof value === 'function';
|
37285 | }
|
37286 |
|
37287 | function instrument(name, p1, p2, p3) {
|
37288 | var _payload;
|
37289 |
|
37290 | var callback;
|
37291 | var binding;
|
37292 |
|
37293 | if (arguments.length <= 3 && isCallback(p1)) {
|
37294 | callback = p1;
|
37295 | binding = p2;
|
37296 | } else {
|
37297 | _payload = p1;
|
37298 | callback = p2;
|
37299 | binding = p3;
|
37300 | }
|
37301 |
|
37302 |
|
37303 | if (subscribers.length === 0) {
|
37304 | return callback.call(binding);
|
37305 | }
|
37306 |
|
37307 |
|
37308 | var payload = _payload || {};
|
37309 |
|
37310 | var finalizer = _instrumentStart(name, () => payload);
|
37311 |
|
37312 | if (finalizer === NOOP) {
|
37313 | return callback.call(binding);
|
37314 | } else {
|
37315 | return withFinalizer(callback, finalizer, payload, binding);
|
37316 | }
|
37317 | }
|
37318 |
|
37319 | var flaggedInstrument;
|
37320 | _exports.flaggedInstrument = flaggedInstrument;
|
37321 |
|
37322 | if (false
|
37323 |
|
37324 | ) {
|
37325 | _exports.flaggedInstrument = flaggedInstrument = instrument;
|
37326 | } else {
|
37327 | _exports.flaggedInstrument = flaggedInstrument = function instrument(_name, _payload, callback) {
|
37328 | return callback();
|
37329 | };
|
37330 | }
|
37331 |
|
37332 | function withFinalizer(callback, finalizer, payload, binding) {
|
37333 | try {
|
37334 | return callback.call(binding);
|
37335 | } catch (e) {
|
37336 | payload.exception = e;
|
37337 | throw e;
|
37338 | } finally {
|
37339 | finalizer();
|
37340 | }
|
37341 | }
|
37342 |
|
37343 | function NOOP() {}
|
37344 |
|
37345 | function _instrumentStart(name, payloadFunc, payloadArg) {
|
37346 | if (subscribers.length === 0) {
|
37347 | return NOOP;
|
37348 | }
|
37349 |
|
37350 | var listeners = cache[name];
|
37351 |
|
37352 | if (!listeners) {
|
37353 | listeners = populateListeners(name);
|
37354 | }
|
37355 |
|
37356 | if (listeners.length === 0) {
|
37357 | return NOOP;
|
37358 | }
|
37359 |
|
37360 | var payload = payloadFunc(payloadArg);
|
37361 | var STRUCTURED_PROFILE = _environment.ENV.STRUCTURED_PROFILE;
|
37362 | var timeName;
|
37363 |
|
37364 | if (STRUCTURED_PROFILE) {
|
37365 | timeName = `${name}: ${payload.object}`;
|
37366 | console.time(timeName);
|
37367 | }
|
37368 |
|
37369 | var beforeValues = [];
|
37370 | var timestamp = time();
|
37371 |
|
37372 | for (var i = 0; i < listeners.length; i++) {
|
37373 | var listener = listeners[i];
|
37374 | beforeValues.push(listener.before(name, timestamp, payload));
|
37375 | }
|
37376 |
|
37377 | return function _instrumentEnd() {
|
37378 | var timestamp = time();
|
37379 |
|
37380 | for (var _i = 0; _i < listeners.length; _i++) {
|
37381 | var _listener = listeners[_i];
|
37382 |
|
37383 | if (typeof _listener.after === 'function') {
|
37384 | _listener.after(name, timestamp, payload, beforeValues[_i]);
|
37385 | }
|
37386 | }
|
37387 |
|
37388 | if (STRUCTURED_PROFILE) {
|
37389 | console.timeEnd(timeName);
|
37390 | }
|
37391 | };
|
37392 | }
|
37393 | |
37394 |
|
37395 |
|
37396 |
|
37397 |
|
37398 |
|
37399 |
|
37400 |
|
37401 |
|
37402 |
|
37403 |
|
37404 |
|
37405 |
|
37406 |
|
37407 |
|
37408 | function subscribe(pattern, object) {
|
37409 | var paths = pattern.split('.');
|
37410 | var path;
|
37411 | var regexes = [];
|
37412 |
|
37413 | for (var i = 0; i < paths.length; i++) {
|
37414 | path = paths[i];
|
37415 |
|
37416 | if (path === '*') {
|
37417 | regexes.push('[^\\.]*');
|
37418 | } else {
|
37419 | regexes.push(path);
|
37420 | }
|
37421 | }
|
37422 |
|
37423 | var regex = regexes.join('\\.');
|
37424 | regex = `${regex}(\\..*)?`;
|
37425 | var subscriber = {
|
37426 | pattern,
|
37427 | regex: new RegExp(`^${regex}$`),
|
37428 | object
|
37429 | };
|
37430 | subscribers.push(subscriber);
|
37431 | cache = {};
|
37432 | return subscriber;
|
37433 | }
|
37434 | |
37435 |
|
37436 |
|
37437 |
|
37438 |
|
37439 |
|
37440 |
|
37441 |
|
37442 |
|
37443 |
|
37444 |
|
37445 |
|
37446 | function unsubscribe(subscriber) {
|
37447 | var index = 0;
|
37448 |
|
37449 | for (var i = 0; i < subscribers.length; i++) {
|
37450 | if (subscribers[i] === subscriber) {
|
37451 | index = i;
|
37452 | }
|
37453 | }
|
37454 |
|
37455 | subscribers.splice(index, 1);
|
37456 | cache = {};
|
37457 | }
|
37458 | |
37459 |
|
37460 |
|
37461 |
|
37462 |
|
37463 |
|
37464 |
|
37465 |
|
37466 |
|
37467 |
|
37468 | function reset() {
|
37469 | subscribers.length = 0;
|
37470 | cache = {};
|
37471 | }
|
37472 | });
|
37473 | define("@ember/modifier/index", ["exports", "@ember/-internals/glimmer"], function (_exports, _glimmer) {
|
37474 | "use strict";
|
37475 |
|
37476 | Object.defineProperty(_exports, "__esModule", {
|
37477 | value: true
|
37478 | });
|
37479 | Object.defineProperty(_exports, "setModifierManager", {
|
37480 | enumerable: true,
|
37481 | get: function () {
|
37482 | return _glimmer.setModifierManager;
|
37483 | }
|
37484 | });
|
37485 | Object.defineProperty(_exports, "capabilties", {
|
37486 | enumerable: true,
|
37487 | get: function () {
|
37488 | return _glimmer.modifierCapabilities;
|
37489 | }
|
37490 | });
|
37491 | });
|
37492 | define("@ember/object/compat", ["exports", "@ember/-internals/metal", "@ember/debug", "@glimmer/validator"], function (_exports, _metal, _debug, _validator) {
|
37493 | "use strict";
|
37494 |
|
37495 | Object.defineProperty(_exports, "__esModule", {
|
37496 | value: true
|
37497 | });
|
37498 | _exports.dependentKeyCompat = dependentKeyCompat;
|
37499 |
|
37500 | var wrapGetterSetter = function (target, key, desc) {
|
37501 | var {
|
37502 | get: originalGet
|
37503 | } = desc;
|
37504 | (true && !((0, _metal.descriptorForProperty)(target, key) === undefined) && (0, _debug.assert)('You attempted to use @dependentKeyCompat on a property that already has been decorated with either @computed or @tracked. @dependentKeyCompat is only necessary for native getters that are not decorated with @computed.', (0, _metal.descriptorForProperty)(target, key) === undefined));
|
37505 |
|
37506 | if (originalGet !== undefined) {
|
37507 | desc.get = function () {
|
37508 | var propertyTag = (0, _validator.tagFor)(this, key);
|
37509 | var ret;
|
37510 | var tag = (0, _validator.track)(() => {
|
37511 | ret = originalGet.call(this);
|
37512 | });
|
37513 | (0, _validator.updateTag)(propertyTag, tag);
|
37514 | (0, _validator.consumeTag)(tag);
|
37515 | return ret;
|
37516 | };
|
37517 | }
|
37518 |
|
37519 | return desc;
|
37520 | };
|
37521 |
|
37522 | function dependentKeyCompat(target, key, desc) {
|
37523 | if (!(0, _metal.isElementDescriptor)([target, key, desc])) {
|
37524 | desc = target;
|
37525 |
|
37526 | var decorator = function (target, key, _desc, _meta, isClassicDecorator) {
|
37527 | (true && !(isClassicDecorator) && (0, _debug.assert)('The @dependentKeyCompat decorator may only be passed a method when used in classic classes. You should decorate getters/setters directly in native classes', isClassicDecorator));
|
37528 | (true && !(desc !== null && typeof desc === 'object' && (typeof desc.get === 'function' || typeof desc.set === 'function')) && (0, _debug.assert)('The dependentKeyCompat() decorator must be passed a getter or setter when used in classic classes', desc !== null && typeof desc === 'object' && (typeof desc.get === 'function' || typeof desc.set === 'function')));
|
37529 | return wrapGetterSetter(target, key, desc);
|
37530 | };
|
37531 |
|
37532 | (0, _metal.setClassicDecorator)(decorator);
|
37533 | return decorator;
|
37534 | }
|
37535 |
|
37536 | (true && !(desc !== null && typeof desc.get === 'function' || typeof desc.set === 'function') && (0, _debug.assert)('The @dependentKeyCompat decorator must be applied to getters/setters when used in native classes', desc !== null && typeof desc.get === 'function' || typeof desc.set === 'function'));
|
37537 | return wrapGetterSetter(target, key, desc);
|
37538 | }
|
37539 |
|
37540 | (0, _metal.setClassicDecorator)(dependentKeyCompat);
|
37541 | });
|
37542 | define("@ember/object/computed", ["exports", "@ember/object/lib/computed/computed_macros", "@ember/object/lib/computed/reduce_computed_macros"], function (_exports, _computed_macros, _reduce_computed_macros) {
|
37543 | "use strict";
|
37544 |
|
37545 | Object.defineProperty(_exports, "__esModule", {
|
37546 | value: true
|
37547 | });
|
37548 | Object.defineProperty(_exports, "empty", {
|
37549 | enumerable: true,
|
37550 | get: function () {
|
37551 | return _computed_macros.empty;
|
37552 | }
|
37553 | });
|
37554 | Object.defineProperty(_exports, "notEmpty", {
|
37555 | enumerable: true,
|
37556 | get: function () {
|
37557 | return _computed_macros.notEmpty;
|
37558 | }
|
37559 | });
|
37560 | Object.defineProperty(_exports, "none", {
|
37561 | enumerable: true,
|
37562 | get: function () {
|
37563 | return _computed_macros.none;
|
37564 | }
|
37565 | });
|
37566 | Object.defineProperty(_exports, "not", {
|
37567 | enumerable: true,
|
37568 | get: function () {
|
37569 | return _computed_macros.not;
|
37570 | }
|
37571 | });
|
37572 | Object.defineProperty(_exports, "bool", {
|
37573 | enumerable: true,
|
37574 | get: function () {
|
37575 | return _computed_macros.bool;
|
37576 | }
|
37577 | });
|
37578 | Object.defineProperty(_exports, "match", {
|
37579 | enumerable: true,
|
37580 | get: function () {
|
37581 | return _computed_macros.match;
|
37582 | }
|
37583 | });
|
37584 | Object.defineProperty(_exports, "equal", {
|
37585 | enumerable: true,
|
37586 | get: function () {
|
37587 | return _computed_macros.equal;
|
37588 | }
|
37589 | });
|
37590 | Object.defineProperty(_exports, "gt", {
|
37591 | enumerable: true,
|
37592 | get: function () {
|
37593 | return _computed_macros.gt;
|
37594 | }
|
37595 | });
|
37596 | Object.defineProperty(_exports, "gte", {
|
37597 | enumerable: true,
|
37598 | get: function () {
|
37599 | return _computed_macros.gte;
|
37600 | }
|
37601 | });
|
37602 | Object.defineProperty(_exports, "lt", {
|
37603 | enumerable: true,
|
37604 | get: function () {
|
37605 | return _computed_macros.lt;
|
37606 | }
|
37607 | });
|
37608 | Object.defineProperty(_exports, "lte", {
|
37609 | enumerable: true,
|
37610 | get: function () {
|
37611 | return _computed_macros.lte;
|
37612 | }
|
37613 | });
|
37614 | Object.defineProperty(_exports, "oneWay", {
|
37615 | enumerable: true,
|
37616 | get: function () {
|
37617 | return _computed_macros.oneWay;
|
37618 | }
|
37619 | });
|
37620 | Object.defineProperty(_exports, "readOnly", {
|
37621 | enumerable: true,
|
37622 | get: function () {
|
37623 | return _computed_macros.readOnly;
|
37624 | }
|
37625 | });
|
37626 | Object.defineProperty(_exports, "deprecatingAlias", {
|
37627 | enumerable: true,
|
37628 | get: function () {
|
37629 | return _computed_macros.deprecatingAlias;
|
37630 | }
|
37631 | });
|
37632 | Object.defineProperty(_exports, "and", {
|
37633 | enumerable: true,
|
37634 | get: function () {
|
37635 | return _computed_macros.and;
|
37636 | }
|
37637 | });
|
37638 | Object.defineProperty(_exports, "or", {
|
37639 | enumerable: true,
|
37640 | get: function () {
|
37641 | return _computed_macros.or;
|
37642 | }
|
37643 | });
|
37644 | Object.defineProperty(_exports, "sum", {
|
37645 | enumerable: true,
|
37646 | get: function () {
|
37647 | return _reduce_computed_macros.sum;
|
37648 | }
|
37649 | });
|
37650 | Object.defineProperty(_exports, "min", {
|
37651 | enumerable: true,
|
37652 | get: function () {
|
37653 | return _reduce_computed_macros.min;
|
37654 | }
|
37655 | });
|
37656 | Object.defineProperty(_exports, "max", {
|
37657 | enumerable: true,
|
37658 | get: function () {
|
37659 | return _reduce_computed_macros.max;
|
37660 | }
|
37661 | });
|
37662 | Object.defineProperty(_exports, "map", {
|
37663 | enumerable: true,
|
37664 | get: function () {
|
37665 | return _reduce_computed_macros.map;
|
37666 | }
|
37667 | });
|
37668 | Object.defineProperty(_exports, "sort", {
|
37669 | enumerable: true,
|
37670 | get: function () {
|
37671 | return _reduce_computed_macros.sort;
|
37672 | }
|
37673 | });
|
37674 | Object.defineProperty(_exports, "setDiff", {
|
37675 | enumerable: true,
|
37676 | get: function () {
|
37677 | return _reduce_computed_macros.setDiff;
|
37678 | }
|
37679 | });
|
37680 | Object.defineProperty(_exports, "mapBy", {
|
37681 | enumerable: true,
|
37682 | get: function () {
|
37683 | return _reduce_computed_macros.mapBy;
|
37684 | }
|
37685 | });
|
37686 | Object.defineProperty(_exports, "filter", {
|
37687 | enumerable: true,
|
37688 | get: function () {
|
37689 | return _reduce_computed_macros.filter;
|
37690 | }
|
37691 | });
|
37692 | Object.defineProperty(_exports, "filterBy", {
|
37693 | enumerable: true,
|
37694 | get: function () {
|
37695 | return _reduce_computed_macros.filterBy;
|
37696 | }
|
37697 | });
|
37698 | Object.defineProperty(_exports, "uniq", {
|
37699 | enumerable: true,
|
37700 | get: function () {
|
37701 | return _reduce_computed_macros.uniq;
|
37702 | }
|
37703 | });
|
37704 | Object.defineProperty(_exports, "uniqBy", {
|
37705 | enumerable: true,
|
37706 | get: function () {
|
37707 | return _reduce_computed_macros.uniqBy;
|
37708 | }
|
37709 | });
|
37710 | Object.defineProperty(_exports, "union", {
|
37711 | enumerable: true,
|
37712 | get: function () {
|
37713 | return _reduce_computed_macros.union;
|
37714 | }
|
37715 | });
|
37716 | Object.defineProperty(_exports, "intersect", {
|
37717 | enumerable: true,
|
37718 | get: function () {
|
37719 | return _reduce_computed_macros.intersect;
|
37720 | }
|
37721 | });
|
37722 | Object.defineProperty(_exports, "collect", {
|
37723 | enumerable: true,
|
37724 | get: function () {
|
37725 | return _reduce_computed_macros.collect;
|
37726 | }
|
37727 | });
|
37728 | });
|
37729 | define("@ember/object/index", ["exports", "@ember/debug", "@ember/polyfills", "@ember/-internals/metal"], function (_exports, _debug, _polyfills, _metal) {
|
37730 | "use strict";
|
37731 |
|
37732 | Object.defineProperty(_exports, "__esModule", {
|
37733 | value: true
|
37734 | });
|
37735 | _exports.action = action;
|
37736 |
|
37737 | |
37738 |
|
37739 |
|
37740 |
|
37741 |
|
37742 |
|
37743 |
|
37744 |
|
37745 |
|
37746 |
|
37747 |
|
37748 |
|
37749 |
|
37750 |
|
37751 |
|
37752 |
|
37753 |
|
37754 |
|
37755 |
|
37756 |
|
37757 |
|
37758 |
|
37759 |
|
37760 |
|
37761 |
|
37762 |
|
37763 |
|
37764 |
|
37765 |
|
37766 |
|
37767 |
|
37768 |
|
37769 |
|
37770 |
|
37771 |
|
37772 |
|
37773 |
|
37774 |
|
37775 |
|
37776 |
|
37777 |
|
37778 |
|
37779 |
|
37780 |
|
37781 |
|
37782 |
|
37783 |
|
37784 |
|
37785 |
|
37786 |
|
37787 |
|
37788 |
|
37789 |
|
37790 |
|
37791 |
|
37792 |
|
37793 |
|
37794 |
|
37795 |
|
37796 |
|
37797 |
|
37798 |
|
37799 |
|
37800 |
|
37801 |
|
37802 |
|
37803 |
|
37804 |
|
37805 |
|
37806 |
|
37807 |
|
37808 |
|
37809 |
|
37810 |
|
37811 |
|
37812 |
|
37813 |
|
37814 |
|
37815 |
|
37816 |
|
37817 |
|
37818 |
|
37819 |
|
37820 |
|
37821 |
|
37822 |
|
37823 |
|
37824 |
|
37825 |
|
37826 |
|
37827 |
|
37828 |
|
37829 |
|
37830 |
|
37831 |
|
37832 |
|
37833 |
|
37834 |
|
37835 |
|
37836 |
|
37837 |
|
37838 |
|
37839 |
|
37840 |
|
37841 |
|
37842 |
|
37843 |
|
37844 |
|
37845 |
|
37846 |
|
37847 |
|
37848 |
|
37849 | var BINDINGS_MAP = new WeakMap();
|
37850 |
|
37851 | function setupAction(target, key, actionFn) {
|
37852 | if (target.constructor !== undefined && typeof target.constructor.proto === 'function') {
|
37853 | target.constructor.proto();
|
37854 | }
|
37855 |
|
37856 | if (!Object.prototype.hasOwnProperty.call(target, 'actions')) {
|
37857 | var parentActions = target.actions;
|
37858 |
|
37859 | target.actions = parentActions ? (0, _polyfills.assign)({}, parentActions) : {};
|
37860 | }
|
37861 |
|
37862 | target.actions[key] = actionFn;
|
37863 | return {
|
37864 | get() {
|
37865 | var bindings = BINDINGS_MAP.get(this);
|
37866 |
|
37867 | if (bindings === undefined) {
|
37868 | bindings = new Map();
|
37869 | BINDINGS_MAP.set(this, bindings);
|
37870 | }
|
37871 |
|
37872 | var fn = bindings.get(actionFn);
|
37873 |
|
37874 | if (fn === undefined) {
|
37875 | fn = actionFn.bind(this);
|
37876 | bindings.set(actionFn, fn);
|
37877 | }
|
37878 |
|
37879 | return fn;
|
37880 | }
|
37881 |
|
37882 | };
|
37883 | }
|
37884 |
|
37885 | function action(target, key, desc) {
|
37886 | var actionFn;
|
37887 |
|
37888 | if (!(0, _metal.isElementDescriptor)([target, key, desc])) {
|
37889 | actionFn = target;
|
37890 |
|
37891 | var decorator = function (target, key, desc, meta, isClassicDecorator) {
|
37892 | (true && !(isClassicDecorator) && (0, _debug.assert)('The @action decorator may only be passed a method when used in classic classes. You should decorate methods directly in native classes', isClassicDecorator));
|
37893 | (true && !(typeof actionFn === 'function') && (0, _debug.assert)('The action() decorator must be passed a method when used in classic classes', typeof actionFn === 'function'));
|
37894 | return setupAction(target, key, actionFn);
|
37895 | };
|
37896 |
|
37897 | (0, _metal.setClassicDecorator)(decorator);
|
37898 | return decorator;
|
37899 | }
|
37900 |
|
37901 | actionFn = desc.value;
|
37902 | (true && !(typeof actionFn === 'function') && (0, _debug.assert)('The @action decorator must be applied to methods when used in native classes', typeof actionFn === 'function'));
|
37903 | return setupAction(target, key, actionFn);
|
37904 | }
|
37905 |
|
37906 | (0, _metal.setClassicDecorator)(action);
|
37907 | });
|
37908 | define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-internals/metal", "@ember/debug"], function (_exports, _metal, _debug) {
|
37909 | "use strict";
|
37910 |
|
37911 | Object.defineProperty(_exports, "__esModule", {
|
37912 | value: true
|
37913 | });
|
37914 | _exports.empty = empty;
|
37915 | _exports.notEmpty = notEmpty;
|
37916 | _exports.none = none;
|
37917 | _exports.not = not;
|
37918 | _exports.bool = bool;
|
37919 | _exports.match = match;
|
37920 | _exports.equal = equal;
|
37921 | _exports.gt = gt;
|
37922 | _exports.gte = gte;
|
37923 | _exports.lt = lt;
|
37924 | _exports.lte = lte;
|
37925 | _exports.oneWay = oneWay;
|
37926 | _exports.readOnly = readOnly;
|
37927 | _exports.deprecatingAlias = deprecatingAlias;
|
37928 | _exports.or = _exports.and = void 0;
|
37929 |
|
37930 | |
37931 |
|
37932 |
|
37933 | function expandPropertiesToArray(predicateName, properties) {
|
37934 | var expandedProperties = [];
|
37935 |
|
37936 | function extractProperty(entry) {
|
37937 | expandedProperties.push(entry);
|
37938 | }
|
37939 |
|
37940 | for (var i = 0; i < properties.length; i++) {
|
37941 | var property = properties[i];
|
37942 | (true && !(property.indexOf(' ') < 0) && (0, _debug.assert)(`Dependent keys passed to computed.${predicateName}() can't have spaces.`, property.indexOf(' ') < 0));
|
37943 | (0, _metal.expandProperties)(property, extractProperty);
|
37944 | }
|
37945 |
|
37946 | return expandedProperties;
|
37947 | }
|
37948 |
|
37949 | function generateComputedWithPredicate(name, predicate) {
|
37950 | return (...properties) => {
|
37951 | (true && !(!(0, _metal.isElementDescriptor)(properties)) && (0, _debug.assert)(`You attempted to use @${name} as a decorator directly, but it requires at least one dependent key parameter`, !(0, _metal.isElementDescriptor)(properties)));
|
37952 | var dependentKeys = expandPropertiesToArray(name, properties);
|
37953 | var computedFunc = (0, _metal.computed)(...dependentKeys, function () {
|
37954 | var lastIdx = dependentKeys.length - 1;
|
37955 |
|
37956 | for (var i = 0; i < lastIdx; i++) {
|
37957 | var value = (0, _metal.get)(this, dependentKeys[i]);
|
37958 |
|
37959 | if (!predicate(value)) {
|
37960 | return value;
|
37961 | }
|
37962 | }
|
37963 |
|
37964 | return (0, _metal.get)(this, dependentKeys[lastIdx]);
|
37965 | });
|
37966 | return computedFunc;
|
37967 | };
|
37968 | }
|
37969 | |
37970 |
|
37971 |
|
37972 |
|
37973 |
|
37974 |
|
37975 |
|
37976 |
|
37977 |
|
37978 |
|
37979 |
|
37980 |
|
37981 |
|
37982 |
|
37983 |
|
37984 |
|
37985 |
|
37986 |
|
37987 |
|
37988 |
|
37989 |
|
37990 |
|
37991 |
|
37992 |
|
37993 |
|
37994 |
|
37995 |
|
37996 |
|
37997 |
|
37998 |
|
37999 |
|
38000 |
|
38001 |
|
38002 |
|
38003 |
|
38004 |
|
38005 |
|
38006 |
|
38007 |
|
38008 |
|
38009 |
|
38010 |
|
38011 |
|
38012 |
|
38013 |
|
38014 |
|
38015 |
|
38016 |
|
38017 |
|
38018 |
|
38019 |
|
38020 |
|
38021 |
|
38022 |
|
38023 |
|
38024 |
|
38025 |
|
38026 |
|
38027 |
|
38028 | function empty(dependentKey) {
|
38029 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @empty as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38030 | return (0, _metal.computed)(`${dependentKey}.length`, function () {
|
38031 | return (0, _metal.isEmpty)((0, _metal.get)(this, dependentKey));
|
38032 | });
|
38033 | }
|
38034 | |
38035 |
|
38036 |
|
38037 |
|
38038 |
|
38039 |
|
38040 |
|
38041 |
|
38042 |
|
38043 |
|
38044 |
|
38045 |
|
38046 |
|
38047 |
|
38048 |
|
38049 |
|
38050 |
|
38051 |
|
38052 |
|
38053 |
|
38054 |
|
38055 |
|
38056 |
|
38057 |
|
38058 |
|
38059 |
|
38060 |
|
38061 |
|
38062 |
|
38063 |
|
38064 |
|
38065 |
|
38066 |
|
38067 |
|
38068 |
|
38069 |
|
38070 |
|
38071 |
|
38072 |
|
38073 |
|
38074 |
|
38075 |
|
38076 |
|
38077 |
|
38078 |
|
38079 |
|
38080 |
|
38081 |
|
38082 |
|
38083 |
|
38084 |
|
38085 |
|
38086 |
|
38087 |
|
38088 |
|
38089 |
|
38090 | function notEmpty(dependentKey) {
|
38091 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @notEmpty as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38092 | return (0, _metal.computed)(`${dependentKey}.length`, function () {
|
38093 | return !(0, _metal.isEmpty)((0, _metal.get)(this, dependentKey));
|
38094 | });
|
38095 | }
|
38096 | |
38097 |
|
38098 |
|
38099 |
|
38100 |
|
38101 |
|
38102 |
|
38103 |
|
38104 |
|
38105 |
|
38106 |
|
38107 |
|
38108 |
|
38109 |
|
38110 |
|
38111 |
|
38112 |
|
38113 |
|
38114 |
|
38115 |
|
38116 |
|
38117 |
|
38118 |
|
38119 |
|
38120 |
|
38121 |
|
38122 |
|
38123 |
|
38124 |
|
38125 |
|
38126 |
|
38127 |
|
38128 |
|
38129 |
|
38130 |
|
38131 |
|
38132 |
|
38133 |
|
38134 |
|
38135 |
|
38136 |
|
38137 |
|
38138 |
|
38139 |
|
38140 |
|
38141 |
|
38142 |
|
38143 |
|
38144 |
|
38145 |
|
38146 |
|
38147 |
|
38148 |
|
38149 |
|
38150 |
|
38151 | function none(dependentKey) {
|
38152 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @none as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38153 | return (0, _metal.computed)(dependentKey, function () {
|
38154 | return (0, _metal.isNone)((0, _metal.get)(this, dependentKey));
|
38155 | });
|
38156 | }
|
38157 | |
38158 |
|
38159 |
|
38160 |
|
38161 |
|
38162 |
|
38163 |
|
38164 |
|
38165 |
|
38166 |
|
38167 |
|
38168 |
|
38169 |
|
38170 |
|
38171 |
|
38172 |
|
38173 |
|
38174 |
|
38175 |
|
38176 |
|
38177 |
|
38178 |
|
38179 |
|
38180 |
|
38181 |
|
38182 |
|
38183 |
|
38184 |
|
38185 |
|
38186 |
|
38187 |
|
38188 |
|
38189 |
|
38190 |
|
38191 |
|
38192 |
|
38193 |
|
38194 |
|
38195 |
|
38196 |
|
38197 |
|
38198 |
|
38199 |
|
38200 |
|
38201 |
|
38202 |
|
38203 |
|
38204 |
|
38205 |
|
38206 |
|
38207 |
|
38208 |
|
38209 | function not(dependentKey) {
|
38210 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @not as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38211 | return (0, _metal.computed)(dependentKey, function () {
|
38212 | return !(0, _metal.get)(this, dependentKey);
|
38213 | });
|
38214 | }
|
38215 | |
38216 |
|
38217 |
|
38218 |
|
38219 |
|
38220 |
|
38221 |
|
38222 |
|
38223 |
|
38224 |
|
38225 |
|
38226 |
|
38227 |
|
38228 |
|
38229 |
|
38230 |
|
38231 |
|
38232 |
|
38233 |
|
38234 |
|
38235 |
|
38236 |
|
38237 |
|
38238 |
|
38239 |
|
38240 |
|
38241 |
|
38242 |
|
38243 |
|
38244 |
|
38245 |
|
38246 |
|
38247 |
|
38248 |
|
38249 |
|
38250 |
|
38251 |
|
38252 |
|
38253 |
|
38254 |
|
38255 |
|
38256 |
|
38257 |
|
38258 |
|
38259 |
|
38260 |
|
38261 |
|
38262 |
|
38263 |
|
38264 |
|
38265 |
|
38266 |
|
38267 |
|
38268 |
|
38269 |
|
38270 |
|
38271 |
|
38272 |
|
38273 |
|
38274 |
|
38275 |
|
38276 |
|
38277 |
|
38278 |
|
38279 | function bool(dependentKey) {
|
38280 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @bool as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38281 | return (0, _metal.computed)(dependentKey, function () {
|
38282 | return Boolean((0, _metal.get)(this, dependentKey));
|
38283 | });
|
38284 | }
|
38285 | |
38286 |
|
38287 |
|
38288 |
|
38289 |
|
38290 |
|
38291 |
|
38292 |
|
38293 |
|
38294 |
|
38295 |
|
38296 |
|
38297 |
|
38298 |
|
38299 |
|
38300 |
|
38301 |
|
38302 |
|
38303 |
|
38304 |
|
38305 |
|
38306 |
|
38307 |
|
38308 |
|
38309 |
|
38310 |
|
38311 |
|
38312 |
|
38313 |
|
38314 |
|
38315 |
|
38316 |
|
38317 |
|
38318 |
|
38319 |
|
38320 |
|
38321 |
|
38322 |
|
38323 |
|
38324 |
|
38325 |
|
38326 |
|
38327 |
|
38328 |
|
38329 |
|
38330 |
|
38331 |
|
38332 |
|
38333 |
|
38334 |
|
38335 |
|
38336 |
|
38337 |
|
38338 |
|
38339 |
|
38340 |
|
38341 |
|
38342 |
|
38343 | function match(dependentKey, regexp) {
|
38344 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @match as a decorator directly, but it requires `dependentKey` and `regexp` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38345 | return (0, _metal.computed)(dependentKey, function () {
|
38346 | var value = (0, _metal.get)(this, dependentKey);
|
38347 | return regexp.test(value);
|
38348 | });
|
38349 | }
|
38350 | |
38351 |
|
38352 |
|
38353 |
|
38354 |
|
38355 |
|
38356 |
|
38357 |
|
38358 |
|
38359 |
|
38360 |
|
38361 |
|
38362 |
|
38363 |
|
38364 |
|
38365 |
|
38366 |
|
38367 |
|
38368 |
|
38369 |
|
38370 |
|
38371 |
|
38372 |
|
38373 |
|
38374 |
|
38375 |
|
38376 |
|
38377 |
|
38378 |
|
38379 |
|
38380 |
|
38381 |
|
38382 |
|
38383 |
|
38384 |
|
38385 |
|
38386 |
|
38387 |
|
38388 |
|
38389 |
|
38390 |
|
38391 |
|
38392 |
|
38393 |
|
38394 |
|
38395 |
|
38396 |
|
38397 |
|
38398 |
|
38399 |
|
38400 |
|
38401 |
|
38402 |
|
38403 |
|
38404 |
|
38405 |
|
38406 |
|
38407 | function equal(dependentKey, value) {
|
38408 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @equal as a decorator directly, but it requires `dependentKey` and `value` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38409 | return (0, _metal.computed)(dependentKey, function () {
|
38410 | return (0, _metal.get)(this, dependentKey) === value;
|
38411 | });
|
38412 | }
|
38413 | |
38414 |
|
38415 |
|
38416 |
|
38417 |
|
38418 |
|
38419 |
|
38420 |
|
38421 |
|
38422 |
|
38423 |
|
38424 |
|
38425 |
|
38426 |
|
38427 |
|
38428 |
|
38429 |
|
38430 |
|
38431 |
|
38432 |
|
38433 |
|
38434 |
|
38435 |
|
38436 |
|
38437 |
|
38438 |
|
38439 |
|
38440 |
|
38441 |
|
38442 |
|
38443 |
|
38444 |
|
38445 |
|
38446 |
|
38447 |
|
38448 |
|
38449 |
|
38450 |
|
38451 |
|
38452 |
|
38453 |
|
38454 |
|
38455 |
|
38456 |
|
38457 |
|
38458 |
|
38459 |
|
38460 |
|
38461 |
|
38462 |
|
38463 |
|
38464 |
|
38465 |
|
38466 |
|
38467 |
|
38468 |
|
38469 |
|
38470 | function gt(dependentKey, value) {
|
38471 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @gt as a decorator directly, but it requires `dependentKey` and `value` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38472 | return (0, _metal.computed)(dependentKey, function () {
|
38473 | return (0, _metal.get)(this, dependentKey) > value;
|
38474 | });
|
38475 | }
|
38476 | |
38477 |
|
38478 |
|
38479 |
|
38480 |
|
38481 |
|
38482 |
|
38483 |
|
38484 |
|
38485 |
|
38486 |
|
38487 |
|
38488 |
|
38489 |
|
38490 |
|
38491 |
|
38492 |
|
38493 |
|
38494 |
|
38495 |
|
38496 |
|
38497 |
|
38498 |
|
38499 |
|
38500 |
|
38501 |
|
38502 |
|
38503 |
|
38504 |
|
38505 |
|
38506 |
|
38507 |
|
38508 |
|
38509 |
|
38510 |
|
38511 |
|
38512 |
|
38513 |
|
38514 |
|
38515 |
|
38516 |
|
38517 |
|
38518 |
|
38519 |
|
38520 |
|
38521 |
|
38522 |
|
38523 |
|
38524 |
|
38525 |
|
38526 |
|
38527 |
|
38528 |
|
38529 |
|
38530 |
|
38531 |
|
38532 |
|
38533 | function gte(dependentKey, value) {
|
38534 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @gte as a decorator directly, but it requires `dependentKey` and `value` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38535 | return (0, _metal.computed)(dependentKey, function () {
|
38536 | return (0, _metal.get)(this, dependentKey) >= value;
|
38537 | });
|
38538 | }
|
38539 | |
38540 |
|
38541 |
|
38542 |
|
38543 |
|
38544 |
|
38545 |
|
38546 |
|
38547 |
|
38548 |
|
38549 |
|
38550 |
|
38551 |
|
38552 |
|
38553 |
|
38554 |
|
38555 |
|
38556 |
|
38557 |
|
38558 |
|
38559 |
|
38560 |
|
38561 |
|
38562 |
|
38563 |
|
38564 |
|
38565 |
|
38566 |
|
38567 |
|
38568 |
|
38569 |
|
38570 |
|
38571 |
|
38572 |
|
38573 |
|
38574 |
|
38575 |
|
38576 |
|
38577 |
|
38578 |
|
38579 |
|
38580 |
|
38581 |
|
38582 |
|
38583 |
|
38584 |
|
38585 |
|
38586 |
|
38587 |
|
38588 |
|
38589 |
|
38590 |
|
38591 |
|
38592 |
|
38593 |
|
38594 |
|
38595 |
|
38596 | function lt(dependentKey, value) {
|
38597 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @lt as a decorator directly, but it requires `dependentKey` and `value` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38598 | return (0, _metal.computed)(dependentKey, function () {
|
38599 | return (0, _metal.get)(this, dependentKey) < value;
|
38600 | });
|
38601 | }
|
38602 | |
38603 |
|
38604 |
|
38605 |
|
38606 |
|
38607 |
|
38608 |
|
38609 |
|
38610 |
|
38611 |
|
38612 |
|
38613 |
|
38614 |
|
38615 |
|
38616 |
|
38617 |
|
38618 |
|
38619 |
|
38620 |
|
38621 |
|
38622 |
|
38623 |
|
38624 |
|
38625 |
|
38626 |
|
38627 |
|
38628 |
|
38629 |
|
38630 |
|
38631 |
|
38632 |
|
38633 |
|
38634 |
|
38635 |
|
38636 |
|
38637 |
|
38638 |
|
38639 |
|
38640 |
|
38641 |
|
38642 |
|
38643 |
|
38644 |
|
38645 |
|
38646 |
|
38647 |
|
38648 |
|
38649 |
|
38650 |
|
38651 |
|
38652 |
|
38653 |
|
38654 |
|
38655 |
|
38656 |
|
38657 |
|
38658 |
|
38659 | function lte(dependentKey, value) {
|
38660 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @lte as a decorator directly, but it requires `dependentKey` and `value` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38661 | return (0, _metal.computed)(dependentKey, function () {
|
38662 | return (0, _metal.get)(this, dependentKey) <= value;
|
38663 | });
|
38664 | }
|
38665 | |
38666 |
|
38667 |
|
38668 |
|
38669 |
|
38670 |
|
38671 |
|
38672 |
|
38673 |
|
38674 |
|
38675 |
|
38676 |
|
38677 |
|
38678 |
|
38679 |
|
38680 |
|
38681 |
|
38682 |
|
38683 |
|
38684 |
|
38685 |
|
38686 |
|
38687 |
|
38688 |
|
38689 |
|
38690 |
|
38691 |
|
38692 |
|
38693 |
|
38694 |
|
38695 |
|
38696 |
|
38697 |
|
38698 |
|
38699 |
|
38700 |
|
38701 |
|
38702 |
|
38703 |
|
38704 |
|
38705 |
|
38706 |
|
38707 |
|
38708 |
|
38709 |
|
38710 |
|
38711 |
|
38712 |
|
38713 |
|
38714 |
|
38715 |
|
38716 |
|
38717 |
|
38718 |
|
38719 |
|
38720 |
|
38721 |
|
38722 |
|
38723 |
|
38724 |
|
38725 |
|
38726 |
|
38727 |
|
38728 |
|
38729 |
|
38730 |
|
38731 |
|
38732 |
|
38733 |
|
38734 |
|
38735 |
|
38736 |
|
38737 |
|
38738 |
|
38739 | var and = generateComputedWithPredicate('and', value => value);
|
38740 | |
38741 |
|
38742 |
|
38743 |
|
38744 |
|
38745 |
|
38746 |
|
38747 |
|
38748 |
|
38749 |
|
38750 |
|
38751 |
|
38752 |
|
38753 |
|
38754 |
|
38755 |
|
38756 |
|
38757 |
|
38758 |
|
38759 |
|
38760 |
|
38761 |
|
38762 |
|
38763 |
|
38764 |
|
38765 |
|
38766 |
|
38767 |
|
38768 |
|
38769 |
|
38770 |
|
38771 |
|
38772 |
|
38773 |
|
38774 |
|
38775 |
|
38776 |
|
38777 |
|
38778 |
|
38779 |
|
38780 |
|
38781 |
|
38782 |
|
38783 |
|
38784 |
|
38785 |
|
38786 |
|
38787 |
|
38788 |
|
38789 |
|
38790 |
|
38791 |
|
38792 |
|
38793 |
|
38794 |
|
38795 |
|
38796 |
|
38797 |
|
38798 |
|
38799 |
|
38800 |
|
38801 |
|
38802 |
|
38803 |
|
38804 |
|
38805 |
|
38806 |
|
38807 | _exports.and = and;
|
38808 | var or = generateComputedWithPredicate('or', value => !value);
|
38809 | |
38810 |
|
38811 |
|
38812 |
|
38813 |
|
38814 |
|
38815 |
|
38816 |
|
38817 |
|
38818 |
|
38819 |
|
38820 |
|
38821 |
|
38822 |
|
38823 |
|
38824 |
|
38825 |
|
38826 |
|
38827 |
|
38828 |
|
38829 |
|
38830 |
|
38831 |
|
38832 |
|
38833 |
|
38834 |
|
38835 |
|
38836 |
|
38837 |
|
38838 |
|
38839 |
|
38840 |
|
38841 |
|
38842 |
|
38843 |
|
38844 |
|
38845 |
|
38846 |
|
38847 |
|
38848 |
|
38849 |
|
38850 |
|
38851 |
|
38852 |
|
38853 |
|
38854 |
|
38855 |
|
38856 |
|
38857 |
|
38858 |
|
38859 |
|
38860 |
|
38861 |
|
38862 |
|
38863 |
|
38864 |
|
38865 | |
38866 |
|
38867 |
|
38868 |
|
38869 |
|
38870 |
|
38871 |
|
38872 |
|
38873 |
|
38874 |
|
38875 |
|
38876 |
|
38877 |
|
38878 |
|
38879 |
|
38880 |
|
38881 |
|
38882 |
|
38883 |
|
38884 |
|
38885 |
|
38886 |
|
38887 |
|
38888 |
|
38889 |
|
38890 |
|
38891 |
|
38892 |
|
38893 |
|
38894 |
|
38895 |
|
38896 |
|
38897 |
|
38898 |
|
38899 |
|
38900 |
|
38901 |
|
38902 |
|
38903 |
|
38904 |
|
38905 |
|
38906 |
|
38907 |
|
38908 |
|
38909 |
|
38910 |
|
38911 |
|
38912 |
|
38913 |
|
38914 |
|
38915 |
|
38916 |
|
38917 |
|
38918 |
|
38919 |
|
38920 |
|
38921 |
|
38922 |
|
38923 |
|
38924 |
|
38925 |
|
38926 |
|
38927 |
|
38928 |
|
38929 |
|
38930 | _exports.or = or;
|
38931 |
|
38932 | function oneWay(dependentKey) {
|
38933 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @oneWay as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
38934 | return (0, _metal.alias)(dependentKey).oneWay();
|
38935 | }
|
38936 | |
38937 |
|
38938 |
|
38939 |
|
38940 |
|
38941 |
|
38942 |
|
38943 |
|
38944 |
|
38945 |
|
38946 |
|
38947 |
|
38948 |
|
38949 | |
38950 |
|
38951 |
|
38952 |
|
38953 |
|
38954 |
|
38955 |
|
38956 |
|
38957 |
|
38958 |
|
38959 |
|
38960 |
|
38961 |
|
38962 |
|
38963 |
|
38964 |
|
38965 |
|
38966 |
|
38967 |
|
38968 |
|
38969 |
|
38970 |
|
38971 |
|
38972 |
|
38973 |
|
38974 |
|
38975 |
|
38976 |
|
38977 |
|
38978 |
|
38979 |
|
38980 |
|
38981 |
|
38982 |
|
38983 |
|
38984 |
|
38985 |
|
38986 |
|
38987 |
|
38988 |
|
38989 |
|
38990 |
|
38991 |
|
38992 |
|
38993 |
|
38994 |
|
38995 |
|
38996 |
|
38997 |
|
38998 |
|
38999 |
|
39000 |
|
39001 |
|
39002 |
|
39003 |
|
39004 |
|
39005 |
|
39006 |
|
39007 |
|
39008 |
|
39009 |
|
39010 |
|
39011 |
|
39012 |
|
39013 |
|
39014 |
|
39015 |
|
39016 |
|
39017 |
|
39018 | function readOnly(dependentKey) {
|
39019 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @readOnly as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39020 | return (0, _metal.alias)(dependentKey).readOnly();
|
39021 | }
|
39022 | |
39023 |
|
39024 |
|
39025 |
|
39026 |
|
39027 |
|
39028 |
|
39029 |
|
39030 |
|
39031 |
|
39032 |
|
39033 |
|
39034 |
|
39035 |
|
39036 |
|
39037 |
|
39038 |
|
39039 |
|
39040 |
|
39041 |
|
39042 |
|
39043 |
|
39044 |
|
39045 |
|
39046 |
|
39047 |
|
39048 |
|
39049 |
|
39050 |
|
39051 |
|
39052 |
|
39053 |
|
39054 |
|
39055 |
|
39056 |
|
39057 |
|
39058 |
|
39059 |
|
39060 |
|
39061 |
|
39062 |
|
39063 |
|
39064 |
|
39065 |
|
39066 |
|
39067 |
|
39068 |
|
39069 |
|
39070 |
|
39071 |
|
39072 |
|
39073 |
|
39074 |
|
39075 |
|
39076 |
|
39077 |
|
39078 | function deprecatingAlias(dependentKey, options) {
|
39079 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @deprecatingAlias as a decorator directly, but it requires `dependentKey` and `options` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39080 | return (0, _metal.computed)(dependentKey, {
|
39081 | get(key) {
|
39082 | (true && !(false) && (0, _debug.deprecate)(`Usage of \`${key}\` is deprecated, use \`${dependentKey}\` instead.`, false, options));
|
39083 | return (0, _metal.get)(this, dependentKey);
|
39084 | },
|
39085 |
|
39086 | set(key, value) {
|
39087 | (true && !(false) && (0, _debug.deprecate)(`Usage of \`${key}\` is deprecated, use \`${dependentKey}\` instead.`, false, options));
|
39088 | (0, _metal.set)(this, dependentKey, value);
|
39089 | return value;
|
39090 | }
|
39091 |
|
39092 | });
|
39093 | }
|
39094 | });
|
39095 | define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/debug", "@ember/-internals/metal", "@ember/-internals/runtime"], function (_exports, _debug, _metal, _runtime) {
|
39096 | "use strict";
|
39097 |
|
39098 | Object.defineProperty(_exports, "__esModule", {
|
39099 | value: true
|
39100 | });
|
39101 | _exports.sum = sum;
|
39102 | _exports.max = max;
|
39103 | _exports.min = min;
|
39104 | _exports.map = map;
|
39105 | _exports.mapBy = mapBy;
|
39106 | _exports.filter = filter;
|
39107 | _exports.filterBy = filterBy;
|
39108 | _exports.uniq = uniq;
|
39109 | _exports.uniqBy = uniqBy;
|
39110 | _exports.intersect = intersect;
|
39111 | _exports.setDiff = setDiff;
|
39112 | _exports.collect = collect;
|
39113 | _exports.sort = sort;
|
39114 | _exports.union = void 0;
|
39115 |
|
39116 | |
39117 |
|
39118 |
|
39119 | function reduceMacro(dependentKey, callback, initialValue, name) {
|
39120 | (true && !(!/[[\]{}]/g.test(dependentKey)) && (0, _debug.assert)(`Dependent key passed to \`computed.${name}\` shouldn't contain brace expanding pattern.`, !/[[\]{}]/g.test(dependentKey)));
|
39121 | return (0, _metal.computed)(`${dependentKey}.[]`, function () {
|
39122 | var arr = (0, _metal.get)(this, dependentKey);
|
39123 |
|
39124 | if (arr === null || typeof arr !== 'object') {
|
39125 | return initialValue;
|
39126 | }
|
39127 |
|
39128 | return arr.reduce(callback, initialValue, this);
|
39129 | }).readOnly();
|
39130 | }
|
39131 |
|
39132 | function arrayMacro(dependentKey, additionalDependentKeys, callback) {
|
39133 |
|
39134 | var propertyName;
|
39135 |
|
39136 | if (/@each/.test(dependentKey)) {
|
39137 | propertyName = dependentKey.replace(/\.@each.*$/, '');
|
39138 | } else {
|
39139 | propertyName = dependentKey;
|
39140 | dependentKey += '.[]';
|
39141 | }
|
39142 |
|
39143 | return (0, _metal.computed)(dependentKey, ...additionalDependentKeys, function () {
|
39144 | var value = (0, _metal.get)(this, propertyName);
|
39145 |
|
39146 | if ((0, _runtime.isArray)(value)) {
|
39147 | return (0, _runtime.A)(callback.call(this, value));
|
39148 | } else {
|
39149 | return (0, _runtime.A)();
|
39150 | }
|
39151 | }).readOnly();
|
39152 | }
|
39153 |
|
39154 | function multiArrayMacro(_dependentKeys, callback, name) {
|
39155 | (true && !(_dependentKeys.every(dependentKey => !/[[\]{}]/g.test(dependentKey))) && (0, _debug.assert)(`Dependent keys passed to \`computed.${name}\` shouldn't contain brace expanding pattern.`, _dependentKeys.every(dependentKey => !/[[\]{}]/g.test(dependentKey))));
|
39156 |
|
39157 | var dependentKeys = _dependentKeys.map(key => `${key}.[]`);
|
39158 |
|
39159 | return (0, _metal.computed)(...dependentKeys, function () {
|
39160 | return (0, _runtime.A)(callback.call(this, _dependentKeys));
|
39161 | }).readOnly();
|
39162 | }
|
39163 | |
39164 |
|
39165 |
|
39166 |
|
39167 |
|
39168 |
|
39169 |
|
39170 |
|
39171 |
|
39172 |
|
39173 |
|
39174 |
|
39175 |
|
39176 |
|
39177 |
|
39178 |
|
39179 |
|
39180 |
|
39181 |
|
39182 |
|
39183 |
|
39184 |
|
39185 |
|
39186 |
|
39187 |
|
39188 |
|
39189 |
|
39190 |
|
39191 |
|
39192 |
|
39193 |
|
39194 |
|
39195 |
|
39196 |
|
39197 |
|
39198 |
|
39199 |
|
39200 |
|
39201 |
|
39202 |
|
39203 |
|
39204 |
|
39205 |
|
39206 |
|
39207 |
|
39208 |
|
39209 |
|
39210 | function sum(dependentKey) {
|
39211 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @sum as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39212 | return reduceMacro(dependentKey, (sum, item) => sum + item, 0, 'sum');
|
39213 | }
|
39214 | |
39215 |
|
39216 |
|
39217 |
|
39218 |
|
39219 |
|
39220 |
|
39221 |
|
39222 |
|
39223 |
|
39224 |
|
39225 |
|
39226 |
|
39227 |
|
39228 |
|
39229 |
|
39230 |
|
39231 |
|
39232 |
|
39233 |
|
39234 |
|
39235 |
|
39236 |
|
39237 |
|
39238 |
|
39239 |
|
39240 |
|
39241 |
|
39242 |
|
39243 |
|
39244 |
|
39245 |
|
39246 |
|
39247 |
|
39248 |
|
39249 |
|
39250 |
|
39251 |
|
39252 |
|
39253 |
|
39254 |
|
39255 |
|
39256 |
|
39257 |
|
39258 |
|
39259 |
|
39260 |
|
39261 |
|
39262 |
|
39263 |
|
39264 |
|
39265 |
|
39266 |
|
39267 |
|
39268 |
|
39269 |
|
39270 |
|
39271 |
|
39272 |
|
39273 |
|
39274 |
|
39275 |
|
39276 |
|
39277 |
|
39278 |
|
39279 |
|
39280 |
|
39281 |
|
39282 |
|
39283 |
|
39284 |
|
39285 |
|
39286 |
|
39287 |
|
39288 |
|
39289 |
|
39290 |
|
39291 |
|
39292 |
|
39293 |
|
39294 |
|
39295 |
|
39296 |
|
39297 |
|
39298 |
|
39299 |
|
39300 |
|
39301 |
|
39302 |
|
39303 |
|
39304 |
|
39305 |
|
39306 |
|
39307 | function max(dependentKey) {
|
39308 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @max as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39309 | return reduceMacro(dependentKey, (max, item) => Math.max(max, item), -Infinity, 'max');
|
39310 | }
|
39311 | |
39312 |
|
39313 |
|
39314 |
|
39315 |
|
39316 |
|
39317 |
|
39318 |
|
39319 |
|
39320 |
|
39321 |
|
39322 |
|
39323 |
|
39324 |
|
39325 |
|
39326 |
|
39327 |
|
39328 |
|
39329 |
|
39330 |
|
39331 |
|
39332 |
|
39333 |
|
39334 |
|
39335 |
|
39336 |
|
39337 |
|
39338 |
|
39339 |
|
39340 |
|
39341 |
|
39342 |
|
39343 |
|
39344 |
|
39345 |
|
39346 |
|
39347 |
|
39348 |
|
39349 |
|
39350 |
|
39351 |
|
39352 |
|
39353 |
|
39354 |
|
39355 |
|
39356 |
|
39357 |
|
39358 |
|
39359 |
|
39360 |
|
39361 |
|
39362 |
|
39363 |
|
39364 |
|
39365 |
|
39366 |
|
39367 |
|
39368 |
|
39369 |
|
39370 |
|
39371 |
|
39372 |
|
39373 |
|
39374 |
|
39375 |
|
39376 |
|
39377 |
|
39378 |
|
39379 |
|
39380 |
|
39381 |
|
39382 |
|
39383 |
|
39384 |
|
39385 |
|
39386 |
|
39387 |
|
39388 |
|
39389 |
|
39390 |
|
39391 |
|
39392 |
|
39393 |
|
39394 |
|
39395 |
|
39396 |
|
39397 |
|
39398 |
|
39399 |
|
39400 |
|
39401 |
|
39402 |
|
39403 | function min(dependentKey) {
|
39404 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @min as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39405 | return reduceMacro(dependentKey, (min, item) => Math.min(min, item), Infinity, 'min');
|
39406 | }
|
39407 | |
39408 |
|
39409 |
|
39410 |
|
39411 |
|
39412 |
|
39413 |
|
39414 |
|
39415 |
|
39416 |
|
39417 |
|
39418 |
|
39419 |
|
39420 |
|
39421 |
|
39422 |
|
39423 |
|
39424 |
|
39425 |
|
39426 |
|
39427 |
|
39428 |
|
39429 |
|
39430 |
|
39431 |
|
39432 |
|
39433 |
|
39434 |
|
39435 |
|
39436 |
|
39437 |
|
39438 |
|
39439 |
|
39440 |
|
39441 |
|
39442 |
|
39443 |
|
39444 |
|
39445 |
|
39446 |
|
39447 |
|
39448 |
|
39449 |
|
39450 |
|
39451 |
|
39452 |
|
39453 |
|
39454 |
|
39455 |
|
39456 |
|
39457 |
|
39458 |
|
39459 |
|
39460 |
|
39461 |
|
39462 |
|
39463 |
|
39464 |
|
39465 |
|
39466 |
|
39467 |
|
39468 |
|
39469 |
|
39470 |
|
39471 |
|
39472 |
|
39473 |
|
39474 |
|
39475 |
|
39476 |
|
39477 |
|
39478 |
|
39479 |
|
39480 |
|
39481 |
|
39482 |
|
39483 |
|
39484 |
|
39485 |
|
39486 |
|
39487 |
|
39488 |
|
39489 |
|
39490 |
|
39491 |
|
39492 |
|
39493 |
|
39494 |
|
39495 |
|
39496 |
|
39497 |
|
39498 |
|
39499 |
|
39500 |
|
39501 |
|
39502 |
|
39503 | function map(dependentKey, additionalDependentKeys, callback) {
|
39504 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @map as a decorator directly, but it requires atleast `dependentKey` and `callback` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39505 |
|
39506 | if (callback === undefined && typeof additionalDependentKeys === 'function') {
|
39507 | callback = additionalDependentKeys;
|
39508 | additionalDependentKeys = [];
|
39509 | }
|
39510 |
|
39511 | (true && !(typeof callback === 'function') && (0, _debug.assert)('The final parameter provided to map must be a callback function', typeof callback === 'function'));
|
39512 | (true && !(Array.isArray(additionalDependentKeys)) && (0, _debug.assert)('The second parameter provided to map must either be the callback or an array of additional dependent keys', Array.isArray(additionalDependentKeys)));
|
39513 | return arrayMacro(dependentKey, additionalDependentKeys, function (value) {
|
39514 | return value.map(callback, this);
|
39515 | });
|
39516 | }
|
39517 | |
39518 |
|
39519 |
|
39520 |
|
39521 |
|
39522 |
|
39523 |
|
39524 |
|
39525 |
|
39526 |
|
39527 |
|
39528 |
|
39529 |
|
39530 |
|
39531 |
|
39532 |
|
39533 |
|
39534 |
|
39535 |
|
39536 |
|
39537 |
|
39538 |
|
39539 |
|
39540 |
|
39541 |
|
39542 |
|
39543 |
|
39544 |
|
39545 |
|
39546 |
|
39547 |
|
39548 |
|
39549 |
|
39550 |
|
39551 |
|
39552 |
|
39553 |
|
39554 |
|
39555 |
|
39556 |
|
39557 |
|
39558 |
|
39559 |
|
39560 |
|
39561 |
|
39562 |
|
39563 |
|
39564 |
|
39565 |
|
39566 |
|
39567 |
|
39568 |
|
39569 |
|
39570 |
|
39571 |
|
39572 |
|
39573 |
|
39574 |
|
39575 |
|
39576 |
|
39577 |
|
39578 |
|
39579 |
|
39580 |
|
39581 |
|
39582 |
|
39583 |
|
39584 |
|
39585 |
|
39586 |
|
39587 |
|
39588 |
|
39589 |
|
39590 |
|
39591 |
|
39592 |
|
39593 |
|
39594 |
|
39595 |
|
39596 |
|
39597 |
|
39598 |
|
39599 |
|
39600 |
|
39601 |
|
39602 | function mapBy(dependentKey, propertyKey) {
|
39603 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @mapBy as a decorator directly, but it requires `dependentKey` and `propertyKey` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39604 | (true && !(typeof propertyKey === 'string') && (0, _debug.assert)('`computed.mapBy` expects a property string for its second argument, ' + 'perhaps you meant to use "map"', typeof propertyKey === 'string'));
|
39605 | (true && !(!/[[\]{}]/g.test(dependentKey)) && (0, _debug.assert)(`Dependent key passed to \`computed.mapBy\` shouldn't contain brace expanding pattern.`, !/[[\]{}]/g.test(dependentKey)));
|
39606 | return map(`${dependentKey}.@each.${propertyKey}`, item => (0, _metal.get)(item, propertyKey));
|
39607 | }
|
39608 | |
39609 |
|
39610 |
|
39611 |
|
39612 |
|
39613 |
|
39614 |
|
39615 |
|
39616 |
|
39617 |
|
39618 |
|
39619 |
|
39620 |
|
39621 |
|
39622 |
|
39623 |
|
39624 |
|
39625 |
|
39626 |
|
39627 |
|
39628 |
|
39629 |
|
39630 |
|
39631 |
|
39632 |
|
39633 |
|
39634 |
|
39635 |
|
39636 |
|
39637 |
|
39638 |
|
39639 |
|
39640 |
|
39641 |
|
39642 |
|
39643 |
|
39644 |
|
39645 |
|
39646 |
|
39647 |
|
39648 |
|
39649 |
|
39650 |
|
39651 |
|
39652 |
|
39653 |
|
39654 |
|
39655 |
|
39656 |
|
39657 |
|
39658 |
|
39659 |
|
39660 |
|
39661 |
|
39662 |
|
39663 |
|
39664 |
|
39665 |
|
39666 |
|
39667 |
|
39668 |
|
39669 |
|
39670 |
|
39671 |
|
39672 |
|
39673 |
|
39674 |
|
39675 |
|
39676 |
|
39677 |
|
39678 |
|
39679 |
|
39680 |
|
39681 |
|
39682 |
|
39683 |
|
39684 |
|
39685 |
|
39686 |
|
39687 |
|
39688 |
|
39689 |
|
39690 |
|
39691 |
|
39692 |
|
39693 |
|
39694 |
|
39695 |
|
39696 |
|
39697 |
|
39698 |
|
39699 |
|
39700 |
|
39701 |
|
39702 |
|
39703 |
|
39704 |
|
39705 |
|
39706 |
|
39707 |
|
39708 |
|
39709 |
|
39710 |
|
39711 |
|
39712 |
|
39713 |
|
39714 |
|
39715 |
|
39716 |
|
39717 |
|
39718 |
|
39719 |
|
39720 |
|
39721 |
|
39722 |
|
39723 |
|
39724 |
|
39725 |
|
39726 |
|
39727 |
|
39728 |
|
39729 |
|
39730 |
|
39731 |
|
39732 |
|
39733 |
|
39734 |
|
39735 |
|
39736 |
|
39737 |
|
39738 | function filter(dependentKey, additionalDependentKeys, callback) {
|
39739 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @filter as a decorator directly, but it requires atleast `dependentKey` and `callback` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39740 |
|
39741 | if (callback === undefined && typeof additionalDependentKeys === 'function') {
|
39742 | callback = additionalDependentKeys;
|
39743 | additionalDependentKeys = [];
|
39744 | }
|
39745 |
|
39746 | (true && !(typeof callback === 'function') && (0, _debug.assert)('The final parameter provided to filter must be a callback function', typeof callback === 'function'));
|
39747 | (true && !(Array.isArray(additionalDependentKeys)) && (0, _debug.assert)('The second parameter provided to filter must either be the callback or an array of additional dependent keys', Array.isArray(additionalDependentKeys)));
|
39748 | return arrayMacro(dependentKey, additionalDependentKeys, function (value) {
|
39749 | return value.filter(callback, this);
|
39750 | });
|
39751 | }
|
39752 | |
39753 |
|
39754 |
|
39755 |
|
39756 |
|
39757 |
|
39758 |
|
39759 |
|
39760 |
|
39761 |
|
39762 |
|
39763 |
|
39764 |
|
39765 |
|
39766 |
|
39767 |
|
39768 |
|
39769 |
|
39770 |
|
39771 |
|
39772 |
|
39773 |
|
39774 |
|
39775 |
|
39776 |
|
39777 |
|
39778 |
|
39779 |
|
39780 |
|
39781 |
|
39782 |
|
39783 |
|
39784 |
|
39785 |
|
39786 |
|
39787 |
|
39788 |
|
39789 |
|
39790 |
|
39791 |
|
39792 |
|
39793 |
|
39794 |
|
39795 |
|
39796 |
|
39797 |
|
39798 |
|
39799 |
|
39800 |
|
39801 |
|
39802 |
|
39803 |
|
39804 |
|
39805 |
|
39806 |
|
39807 |
|
39808 |
|
39809 |
|
39810 | function filterBy(dependentKey, propertyKey, value) {
|
39811 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @filterBy as a decorator directly, but it requires atleast `dependentKey` and `propertyKey` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39812 | (true && !(!/[[\]{}]/g.test(dependentKey)) && (0, _debug.assert)(`Dependent key passed to \`computed.filterBy\` shouldn't contain brace expanding pattern.`, !/[[\]{}]/g.test(dependentKey)));
|
39813 | var callback;
|
39814 |
|
39815 | if (arguments.length === 2) {
|
39816 | callback = item => (0, _metal.get)(item, propertyKey);
|
39817 | } else {
|
39818 | callback = item => (0, _metal.get)(item, propertyKey) === value;
|
39819 | }
|
39820 |
|
39821 | return filter(`${dependentKey}.@each.${propertyKey}`, callback);
|
39822 | }
|
39823 | |
39824 |
|
39825 |
|
39826 |
|
39827 |
|
39828 |
|
39829 |
|
39830 |
|
39831 |
|
39832 |
|
39833 |
|
39834 |
|
39835 |
|
39836 |
|
39837 |
|
39838 |
|
39839 |
|
39840 |
|
39841 |
|
39842 |
|
39843 |
|
39844 |
|
39845 |
|
39846 |
|
39847 |
|
39848 |
|
39849 |
|
39850 |
|
39851 |
|
39852 |
|
39853 |
|
39854 |
|
39855 |
|
39856 |
|
39857 |
|
39858 |
|
39859 |
|
39860 |
|
39861 |
|
39862 |
|
39863 |
|
39864 |
|
39865 |
|
39866 |
|
39867 |
|
39868 |
|
39869 |
|
39870 |
|
39871 |
|
39872 |
|
39873 |
|
39874 |
|
39875 |
|
39876 |
|
39877 |
|
39878 |
|
39879 |
|
39880 |
|
39881 |
|
39882 |
|
39883 | function uniq(...args) {
|
39884 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @uniq/@union as a decorator directly, but it requires atleast one dependent key parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39885 | return multiArrayMacro(args, function (dependentKeys) {
|
39886 | var uniq = (0, _runtime.A)();
|
39887 | var seen = new Set();
|
39888 | dependentKeys.forEach(dependentKey => {
|
39889 | var value = (0, _metal.get)(this, dependentKey);
|
39890 |
|
39891 | if ((0, _runtime.isArray)(value)) {
|
39892 | value.forEach(item => {
|
39893 | if (!seen.has(item)) {
|
39894 | seen.add(item);
|
39895 | uniq.push(item);
|
39896 | }
|
39897 | });
|
39898 | }
|
39899 | });
|
39900 | return uniq;
|
39901 | }, 'uniq');
|
39902 | }
|
39903 | |
39904 |
|
39905 |
|
39906 |
|
39907 |
|
39908 |
|
39909 |
|
39910 |
|
39911 |
|
39912 |
|
39913 |
|
39914 |
|
39915 |
|
39916 |
|
39917 |
|
39918 |
|
39919 |
|
39920 |
|
39921 |
|
39922 |
|
39923 |
|
39924 |
|
39925 |
|
39926 |
|
39927 |
|
39928 |
|
39929 |
|
39930 |
|
39931 |
|
39932 |
|
39933 |
|
39934 |
|
39935 |
|
39936 |
|
39937 |
|
39938 |
|
39939 |
|
39940 |
|
39941 |
|
39942 |
|
39943 |
|
39944 |
|
39945 |
|
39946 |
|
39947 |
|
39948 |
|
39949 |
|
39950 |
|
39951 |
|
39952 |
|
39953 |
|
39954 |
|
39955 |
|
39956 |
|
39957 |
|
39958 |
|
39959 |
|
39960 |
|
39961 |
|
39962 |
|
39963 |
|
39964 | function uniqBy(dependentKey, propertyKey) {
|
39965 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @uniqBy as a decorator directly, but it requires `dependentKey` and `propertyKey` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
39966 | (true && !(!/[[\]{}]/g.test(dependentKey)) && (0, _debug.assert)(`Dependent key passed to \`computed.uniqBy\` shouldn't contain brace expanding pattern.`, !/[[\]{}]/g.test(dependentKey)));
|
39967 | return (0, _metal.computed)(`${dependentKey}.[]`, function () {
|
39968 | var list = (0, _metal.get)(this, dependentKey);
|
39969 | return (0, _runtime.isArray)(list) ? (0, _runtime.uniqBy)(list, propertyKey) : (0, _runtime.A)();
|
39970 | }).readOnly();
|
39971 | }
|
39972 | |
39973 |
|
39974 |
|
39975 |
|
39976 |
|
39977 |
|
39978 |
|
39979 |
|
39980 |
|
39981 |
|
39982 |
|
39983 |
|
39984 |
|
39985 |
|
39986 |
|
39987 |
|
39988 |
|
39989 |
|
39990 |
|
39991 |
|
39992 |
|
39993 |
|
39994 |
|
39995 |
|
39996 |
|
39997 |
|
39998 |
|
39999 |
|
40000 |
|
40001 |
|
40002 |
|
40003 |
|
40004 |
|
40005 |
|
40006 |
|
40007 |
|
40008 |
|
40009 |
|
40010 |
|
40011 |
|
40012 |
|
40013 |
|
40014 |
|
40015 |
|
40016 |
|
40017 |
|
40018 |
|
40019 |
|
40020 |
|
40021 |
|
40022 |
|
40023 |
|
40024 |
|
40025 |
|
40026 |
|
40027 |
|
40028 |
|
40029 |
|
40030 |
|
40031 |
|
40032 |
|
40033 |
|
40034 |
|
40035 |
|
40036 |
|
40037 |
|
40038 |
|
40039 |
|
40040 |
|
40041 |
|
40042 |
|
40043 |
|
40044 |
|
40045 |
|
40046 |
|
40047 | var union = uniq;
|
40048 | |
40049 |
|
40050 |
|
40051 |
|
40052 |
|
40053 |
|
40054 |
|
40055 |
|
40056 |
|
40057 |
|
40058 |
|
40059 |
|
40060 |
|
40061 |
|
40062 |
|
40063 |
|
40064 |
|
40065 |
|
40066 |
|
40067 |
|
40068 |
|
40069 |
|
40070 |
|
40071 |
|
40072 |
|
40073 |
|
40074 |
|
40075 |
|
40076 |
|
40077 |
|
40078 |
|
40079 |
|
40080 |
|
40081 |
|
40082 |
|
40083 |
|
40084 |
|
40085 |
|
40086 |
|
40087 |
|
40088 |
|
40089 |
|
40090 |
|
40091 |
|
40092 |
|
40093 |
|
40094 |
|
40095 |
|
40096 |
|
40097 |
|
40098 |
|
40099 |
|
40100 |
|
40101 |
|
40102 | _exports.union = union;
|
40103 |
|
40104 | function intersect(...args) {
|
40105 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @intersect as a decorator directly, but it requires atleast one dependent key parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
40106 | return multiArrayMacro(args, function (dependentKeys) {
|
40107 | var arrays = dependentKeys.map(dependentKey => {
|
40108 | var array = (0, _metal.get)(this, dependentKey);
|
40109 | return (0, _runtime.isArray)(array) ? array : [];
|
40110 | });
|
40111 | var results = arrays.pop().filter(candidate => {
|
40112 | for (var i = 0; i < arrays.length; i++) {
|
40113 | var found = false;
|
40114 | var array = arrays[i];
|
40115 |
|
40116 | for (var j = 0; j < array.length; j++) {
|
40117 | if (array[j] === candidate) {
|
40118 | found = true;
|
40119 | break;
|
40120 | }
|
40121 | }
|
40122 |
|
40123 | if (found === false) {
|
40124 | return false;
|
40125 | }
|
40126 | }
|
40127 |
|
40128 | return true;
|
40129 | });
|
40130 | return (0, _runtime.A)(results);
|
40131 | }, 'intersect');
|
40132 | }
|
40133 | |
40134 |
|
40135 |
|
40136 |
|
40137 |
|
40138 |
|
40139 |
|
40140 |
|
40141 |
|
40142 |
|
40143 |
|
40144 |
|
40145 |
|
40146 |
|
40147 |
|
40148 |
|
40149 |
|
40150 |
|
40151 |
|
40152 |
|
40153 |
|
40154 |
|
40155 |
|
40156 |
|
40157 |
|
40158 |
|
40159 |
|
40160 |
|
40161 |
|
40162 |
|
40163 |
|
40164 |
|
40165 |
|
40166 |
|
40167 |
|
40168 |
|
40169 |
|
40170 |
|
40171 |
|
40172 |
|
40173 |
|
40174 |
|
40175 |
|
40176 |
|
40177 |
|
40178 |
|
40179 |
|
40180 |
|
40181 |
|
40182 |
|
40183 |
|
40184 |
|
40185 |
|
40186 |
|
40187 |
|
40188 |
|
40189 |
|
40190 |
|
40191 |
|
40192 |
|
40193 |
|
40194 |
|
40195 |
|
40196 |
|
40197 |
|
40198 |
|
40199 |
|
40200 |
|
40201 |
|
40202 |
|
40203 | function setDiff(setAProperty, setBProperty) {
|
40204 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @setDiff as a decorator directly, but it requires atleast one dependent key parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
40205 | (true && !(arguments.length === 2) && (0, _debug.assert)('`computed.setDiff` requires exactly two dependent arrays.', arguments.length === 2));
|
40206 | (true && !(!/[[\]{}]/g.test(setAProperty) && !/[[\]{}]/g.test(setBProperty)) && (0, _debug.assert)(`Dependent keys passed to \`computed.setDiff\` shouldn't contain brace expanding pattern.`, !/[[\]{}]/g.test(setAProperty) && !/[[\]{}]/g.test(setBProperty)));
|
40207 | return (0, _metal.computed)(`${setAProperty}.[]`, `${setBProperty}.[]`, function () {
|
40208 | var setA = (0, _metal.get)(this, setAProperty);
|
40209 | var setB = (0, _metal.get)(this, setBProperty);
|
40210 |
|
40211 | if (!(0, _runtime.isArray)(setA)) {
|
40212 | return (0, _runtime.A)();
|
40213 | }
|
40214 |
|
40215 | if (!(0, _runtime.isArray)(setB)) {
|
40216 | return (0, _runtime.A)(setA);
|
40217 | }
|
40218 |
|
40219 | return setA.filter(x => setB.indexOf(x) === -1);
|
40220 | }).readOnly();
|
40221 | }
|
40222 | |
40223 |
|
40224 |
|
40225 |
|
40226 |
|
40227 |
|
40228 |
|
40229 |
|
40230 |
|
40231 |
|
40232 |
|
40233 |
|
40234 |
|
40235 |
|
40236 |
|
40237 |
|
40238 |
|
40239 |
|
40240 |
|
40241 |
|
40242 |
|
40243 |
|
40244 |
|
40245 |
|
40246 |
|
40247 |
|
40248 |
|
40249 |
|
40250 |
|
40251 |
|
40252 |
|
40253 |
|
40254 |
|
40255 |
|
40256 |
|
40257 |
|
40258 |
|
40259 |
|
40260 |
|
40261 |
|
40262 |
|
40263 |
|
40264 |
|
40265 |
|
40266 |
|
40267 |
|
40268 |
|
40269 |
|
40270 |
|
40271 |
|
40272 |
|
40273 |
|
40274 | function collect(...dependentKeys) {
|
40275 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @collect as a decorator directly, but it requires atleast one dependent key parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
40276 | return multiArrayMacro(dependentKeys, function () {
|
40277 | var res = dependentKeys.map(key => {
|
40278 | var val = (0, _metal.get)(this, key);
|
40279 | return val === undefined ? null : val;
|
40280 | });
|
40281 | return (0, _runtime.A)(res);
|
40282 | }, 'collect');
|
40283 | }
|
40284 | |
40285 |
|
40286 |
|
40287 |
|
40288 |
|
40289 |
|
40290 |
|
40291 |
|
40292 |
|
40293 |
|
40294 |
|
40295 |
|
40296 |
|
40297 |
|
40298 |
|
40299 |
|
40300 |
|
40301 |
|
40302 |
|
40303 |
|
40304 |
|
40305 |
|
40306 |
|
40307 |
|
40308 |
|
40309 |
|
40310 |
|
40311 |
|
40312 |
|
40313 |
|
40314 |
|
40315 |
|
40316 |
|
40317 |
|
40318 |
|
40319 |
|
40320 |
|
40321 |
|
40322 |
|
40323 |
|
40324 |
|
40325 |
|
40326 |
|
40327 |
|
40328 |
|
40329 |
|
40330 |
|
40331 |
|
40332 |
|
40333 |
|
40334 |
|
40335 |
|
40336 |
|
40337 |
|
40338 |
|
40339 |
|
40340 |
|
40341 |
|
40342 |
|
40343 |
|
40344 |
|
40345 |
|
40346 |
|
40347 |
|
40348 |
|
40349 |
|
40350 |
|
40351 |
|
40352 |
|
40353 |
|
40354 |
|
40355 |
|
40356 |
|
40357 |
|
40358 |
|
40359 |
|
40360 |
|
40361 |
|
40362 |
|
40363 |
|
40364 |
|
40365 |
|
40366 |
|
40367 |
|
40368 |
|
40369 |
|
40370 |
|
40371 |
|
40372 |
|
40373 |
|
40374 |
|
40375 |
|
40376 |
|
40377 |
|
40378 |
|
40379 |
|
40380 |
|
40381 |
|
40382 |
|
40383 |
|
40384 |
|
40385 |
|
40386 |
|
40387 |
|
40388 |
|
40389 |
|
40390 |
|
40391 |
|
40392 |
|
40393 |
|
40394 |
|
40395 |
|
40396 |
|
40397 |
|
40398 |
|
40399 |
|
40400 |
|
40401 |
|
40402 |
|
40403 |
|
40404 |
|
40405 |
|
40406 |
|
40407 |
|
40408 |
|
40409 |
|
40410 |
|
40411 |
|
40412 |
|
40413 |
|
40414 |
|
40415 |
|
40416 |
|
40417 |
|
40418 |
|
40419 |
|
40420 |
|
40421 |
|
40422 |
|
40423 |
|
40424 |
|
40425 |
|
40426 |
|
40427 |
|
40428 |
|
40429 |
|
40430 |
|
40431 |
|
40432 |
|
40433 |
|
40434 |
|
40435 |
|
40436 |
|
40437 |
|
40438 |
|
40439 |
|
40440 |
|
40441 |
|
40442 |
|
40443 |
|
40444 |
|
40445 |
|
40446 |
|
40447 |
|
40448 |
|
40449 |
|
40450 |
|
40451 |
|
40452 |
|
40453 |
|
40454 |
|
40455 | function sort(itemsKey, additionalDependentKeys, sortDefinition) {
|
40456 | (true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @sort as a decorator directly, but it requires atleast an `itemsKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
40457 |
|
40458 | if (true
|
40459 |
|
40460 | ) {
|
40461 | var argumentsValid = false;
|
40462 |
|
40463 | if (arguments.length === 2) {
|
40464 | argumentsValid = typeof itemsKey === 'string' && (typeof additionalDependentKeys === 'string' || typeof additionalDependentKeys === 'function');
|
40465 | }
|
40466 |
|
40467 | if (arguments.length === 3) {
|
40468 | argumentsValid = typeof itemsKey === 'string' && Array.isArray(additionalDependentKeys) && typeof sortDefinition === 'function';
|
40469 | }
|
40470 |
|
40471 | (true && !(argumentsValid) && (0, _debug.assert)('`computed.sort` can either be used with an array of sort properties or with a sort function. If used with an array of sort properties, it must receive exactly two arguments: the key of the array to sort, and the key of the array of sort properties. If used with a sort function, it may receive up to three arguments: the key of the array to sort, an optional additional array of dependent keys for the computed property, and the sort function.', argumentsValid));
|
40472 | }
|
40473 |
|
40474 | if (sortDefinition === undefined && !Array.isArray(additionalDependentKeys)) {
|
40475 | sortDefinition = additionalDependentKeys;
|
40476 | additionalDependentKeys = [];
|
40477 | }
|
40478 |
|
40479 | if (typeof sortDefinition === 'function') {
|
40480 | return customSort(itemsKey, additionalDependentKeys, sortDefinition);
|
40481 | } else {
|
40482 | return propertySort(itemsKey, sortDefinition);
|
40483 | }
|
40484 | }
|
40485 |
|
40486 | function customSort(itemsKey, additionalDependentKeys, comparator) {
|
40487 | return arrayMacro(itemsKey, additionalDependentKeys, function (value) {
|
40488 | return value.slice().sort((x, y) => comparator.call(this, x, y));
|
40489 | });
|
40490 | }
|
40491 |
|
40492 |
|
40493 |
|
40494 | function propertySort(itemsKey, sortPropertiesKey) {
|
40495 | var cp = (0, _metal.autoComputed)(function (key) {
|
40496 | var sortProperties = (0, _metal.get)(this, sortPropertiesKey);
|
40497 | (true && !((0, _runtime.isArray)(sortProperties) && sortProperties.every(s => typeof s === 'string')) && (0, _debug.assert)(`The sort definition for '${key}' on ${this} must be a function or an array of strings`, (0, _runtime.isArray)(sortProperties) && sortProperties.every(s => typeof s === 'string')));
|
40498 | var itemsKeyIsAtThis = itemsKey === '@this';
|
40499 | var normalizedSortProperties = normalizeSortProperties(sortProperties);
|
40500 | var items = itemsKeyIsAtThis ? this : (0, _metal.get)(this, itemsKey);
|
40501 |
|
40502 | if (!(0, _runtime.isArray)(items)) {
|
40503 | return (0, _runtime.A)();
|
40504 | }
|
40505 |
|
40506 | if (normalizedSortProperties.length === 0) {
|
40507 | return (0, _runtime.A)(items.slice());
|
40508 | } else {
|
40509 | return sortByNormalizedSortProperties(items, normalizedSortProperties);
|
40510 | }
|
40511 | }).readOnly();
|
40512 | return cp;
|
40513 | }
|
40514 |
|
40515 | function normalizeSortProperties(sortProperties) {
|
40516 | return sortProperties.map(p => {
|
40517 | var [prop, direction] = p.split(':');
|
40518 | direction = direction || 'asc';
|
40519 | return [prop, direction];
|
40520 | });
|
40521 | }
|
40522 |
|
40523 | function sortByNormalizedSortProperties(items, normalizedSortProperties) {
|
40524 | return (0, _runtime.A)(items.slice().sort((itemA, itemB) => {
|
40525 | for (var i = 0; i < normalizedSortProperties.length; i++) {
|
40526 | var [prop, direction] = normalizedSortProperties[i];
|
40527 | var result = (0, _runtime.compare)((0, _metal.get)(itemA, prop), (0, _metal.get)(itemB, prop));
|
40528 |
|
40529 | if (result !== 0) {
|
40530 | return direction === 'desc' ? -1 * result : result;
|
40531 | }
|
40532 | }
|
40533 |
|
40534 | return 0;
|
40535 | }));
|
40536 | }
|
40537 | });
|
40538 | define("@ember/polyfills/index", ["exports", "@ember/deprecated-features", "@ember/polyfills/lib/merge", "@ember/polyfills/lib/assign", "@ember/polyfills/lib/weak_set"], function (_exports, _deprecatedFeatures, _merge, _assign, _weak_set) {
|
40539 | "use strict";
|
40540 |
|
40541 | Object.defineProperty(_exports, "__esModule", {
|
40542 | value: true
|
40543 | });
|
40544 | Object.defineProperty(_exports, "assign", {
|
40545 | enumerable: true,
|
40546 | get: function () {
|
40547 | return _assign.default;
|
40548 | }
|
40549 | });
|
40550 | Object.defineProperty(_exports, "assignPolyfill", {
|
40551 | enumerable: true,
|
40552 | get: function () {
|
40553 | return _assign.assign;
|
40554 | }
|
40555 | });
|
40556 | Object.defineProperty(_exports, "_WeakSet", {
|
40557 | enumerable: true,
|
40558 | get: function () {
|
40559 | return _weak_set.default;
|
40560 | }
|
40561 | });
|
40562 | _exports.merge = void 0;
|
40563 | var merge = _deprecatedFeatures.MERGE ? _merge.default : undefined;
|
40564 |
|
40565 | _exports.merge = merge;
|
40566 | });
|
40567 | define("@ember/polyfills/lib/assign", ["exports"], function (_exports) {
|
40568 | "use strict";
|
40569 |
|
40570 | Object.defineProperty(_exports, "__esModule", {
|
40571 | value: true
|
40572 | });
|
40573 | _exports.assign = assign;
|
40574 | _exports.default = void 0;
|
40575 |
|
40576 | |
40577 |
|
40578 |
|
40579 |
|
40580 | |
40581 |
|
40582 |
|
40583 |
|
40584 |
|
40585 |
|
40586 |
|
40587 |
|
40588 |
|
40589 |
|
40590 |
|
40591 |
|
40592 |
|
40593 |
|
40594 |
|
40595 |
|
40596 |
|
40597 |
|
40598 |
|
40599 |
|
40600 |
|
40601 | function assign(target) {
|
40602 | for (var i = 1; i < arguments.length; i++) {
|
40603 | var arg = arguments[i];
|
40604 |
|
40605 | if (!arg) {
|
40606 | continue;
|
40607 | }
|
40608 |
|
40609 | var updates = Object.keys(arg);
|
40610 |
|
40611 | for (var _i = 0; _i < updates.length; _i++) {
|
40612 | var prop = updates[_i];
|
40613 | target[prop] = arg[prop];
|
40614 | }
|
40615 | }
|
40616 |
|
40617 | return target;
|
40618 | }
|
40619 |
|
40620 |
|
40621 |
|
40622 |
|
40623 |
|
40624 | var {
|
40625 | assign: _assign
|
40626 | } = Object;
|
40627 |
|
40628 | var _default = _assign || assign;
|
40629 |
|
40630 | _exports.default = _default;
|
40631 | });
|
40632 | define("@ember/polyfills/lib/merge", ["exports", "@ember/debug"], function (_exports, _debug) {
|
40633 | "use strict";
|
40634 |
|
40635 | Object.defineProperty(_exports, "__esModule", {
|
40636 | value: true
|
40637 | });
|
40638 | _exports.default = merge;
|
40639 |
|
40640 | |
40641 |
|
40642 |
|
40643 |
|
40644 |
|
40645 |
|
40646 |
|
40647 |
|
40648 |
|
40649 |
|
40650 |
|
40651 |
|
40652 |
|
40653 |
|
40654 |
|
40655 |
|
40656 |
|
40657 |
|
40658 |
|
40659 |
|
40660 |
|
40661 | function merge(original, updates) {
|
40662 | (true && !(false) && (0, _debug.deprecate)('Use of `merge` has been deprecated. Please use `assign` instead.', false, {
|
40663 | id: 'ember-polyfills.deprecate-merge',
|
40664 | until: '4.0.0',
|
40665 | url: 'https://emberjs.com/deprecations/v3.x/#toc_ember-polyfills-deprecate-merge'
|
40666 | }));
|
40667 |
|
40668 | if (updates === null || typeof updates !== 'object') {
|
40669 | return original;
|
40670 | }
|
40671 |
|
40672 | var props = Object.keys(updates);
|
40673 | var prop;
|
40674 |
|
40675 | for (var i = 0; i < props.length; i++) {
|
40676 | prop = props[i];
|
40677 | original[prop] = updates[prop];
|
40678 | }
|
40679 |
|
40680 | return original;
|
40681 | }
|
40682 | });
|
40683 | define("@ember/polyfills/lib/weak_set", ["exports"], function (_exports) {
|
40684 | "use strict";
|
40685 |
|
40686 | Object.defineProperty(_exports, "__esModule", {
|
40687 | value: true
|
40688 | });
|
40689 | _exports.default = void 0;
|
40690 |
|
40691 |
|
40692 | var _default = typeof WeakSet === 'function' ? WeakSet : class WeakSetPolyFill {
|
40693 | constructor() {
|
40694 | this._map = new WeakMap();
|
40695 | }
|
40696 |
|
40697 | add(val) {
|
40698 | this._map.set(val, true);
|
40699 |
|
40700 | return this;
|
40701 | }
|
40702 |
|
40703 | delete(val) {
|
40704 | return this._map.delete(val);
|
40705 | }
|
40706 |
|
40707 | has(val) {
|
40708 | return this._map.has(val);
|
40709 | }
|
40710 |
|
40711 | };
|
40712 |
|
40713 | _exports.default = _default;
|
40714 | });
|
40715 | define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/error-handling", "@ember/-internals/metal", "backburner"], function (_exports, _debug, _errorHandling, _metal, _backburner) {
|
40716 | "use strict";
|
40717 |
|
40718 | Object.defineProperty(_exports, "__esModule", {
|
40719 | value: true
|
40720 | });
|
40721 | _exports.getCurrentRunLoop = getCurrentRunLoop;
|
40722 | _exports.run = run;
|
40723 | _exports.join = join;
|
40724 | _exports.begin = begin;
|
40725 | _exports.end = end;
|
40726 | _exports.schedule = schedule;
|
40727 | _exports.hasScheduledTimers = hasScheduledTimers;
|
40728 | _exports.cancelTimers = cancelTimers;
|
40729 | _exports.later = later;
|
40730 | _exports.once = once;
|
40731 | _exports.scheduleOnce = scheduleOnce;
|
40732 | _exports.next = next;
|
40733 | _exports.cancel = cancel;
|
40734 | _exports.debounce = debounce;
|
40735 | _exports.throttle = throttle;
|
40736 | _exports.bind = _exports._globalsRun = _exports.backburner = _exports.queues = _exports._rsvpErrorQueue = void 0;
|
40737 | var currentRunLoop = null;
|
40738 |
|
40739 | function getCurrentRunLoop() {
|
40740 | return currentRunLoop;
|
40741 | }
|
40742 |
|
40743 | function onBegin(current) {
|
40744 | currentRunLoop = current;
|
40745 | }
|
40746 |
|
40747 | function onEnd(current, next) {
|
40748 | currentRunLoop = next;
|
40749 | (0, _metal.flushAsyncObservers)();
|
40750 | }
|
40751 |
|
40752 | function flush(queueName, next) {
|
40753 | if (queueName === 'render' || queueName === _rsvpErrorQueue) {
|
40754 | (0, _metal.flushAsyncObservers)();
|
40755 | }
|
40756 |
|
40757 | next();
|
40758 | }
|
40759 |
|
40760 | var _rsvpErrorQueue = `${Math.random()}${Date.now()}`.replace('.', '');
|
40761 | |
40762 |
|
40763 |
|
40764 |
|
40765 |
|
40766 |
|
40767 |
|
40768 |
|
40769 |
|
40770 |
|
40771 |
|
40772 |
|
40773 |
|
40774 | _exports._rsvpErrorQueue = _rsvpErrorQueue;
|
40775 | var queues = ['actions',
|
40776 |
|
40777 | 'routerTransitions', 'render', 'afterRender', 'destroy',
|
40778 |
|
40779 | _rsvpErrorQueue];
|
40780 | _exports.queues = queues;
|
40781 | var backburner = new _backburner.default(queues, {
|
40782 | defaultQueue: 'actions',
|
40783 | onBegin,
|
40784 | onEnd,
|
40785 | onErrorTarget: _errorHandling.onErrorTarget,
|
40786 | onErrorMethod: 'onerror',
|
40787 | flush
|
40788 | });
|
40789 | |
40790 |
|
40791 |
|
40792 |
|
40793 |
|
40794 |
|
40795 |
|
40796 | |
40797 |
|
40798 |
|
40799 |
|
40800 |
|
40801 |
|
40802 |
|
40803 |
|
40804 |
|
40805 |
|
40806 |
|
40807 |
|
40808 |
|
40809 |
|
40810 |
|
40811 |
|
40812 |
|
40813 |
|
40814 |
|
40815 |
|
40816 |
|
40817 |
|
40818 |
|
40819 |
|
40820 |
|
40821 |
|
40822 |
|
40823 |
|
40824 |
|
40825 | _exports.backburner = backburner;
|
40826 |
|
40827 | function run() {
|
40828 | return backburner.run(...arguments);
|
40829 | }
|
40830 |
|
40831 |
|
40832 | var _globalsRun = run.bind(null);
|
40833 | |
40834 |
|
40835 |
|
40836 |
|
40837 |
|
40838 |
|
40839 |
|
40840 |
|
40841 |
|
40842 |
|
40843 |
|
40844 |
|
40845 |
|
40846 |
|
40847 |
|
40848 |
|
40849 |
|
40850 |
|
40851 |
|
40852 |
|
40853 |
|
40854 |
|
40855 |
|
40856 |
|
40857 |
|
40858 |
|
40859 |
|
40860 |
|
40861 |
|
40862 |
|
40863 |
|
40864 |
|
40865 |
|
40866 |
|
40867 |
|
40868 |
|
40869 |
|
40870 |
|
40871 |
|
40872 |
|
40873 |
|
40874 |
|
40875 |
|
40876 |
|
40877 |
|
40878 |
|
40879 | _exports._globalsRun = _globalsRun;
|
40880 |
|
40881 | function join() {
|
40882 | return backburner.join(...arguments);
|
40883 | }
|
40884 | |
40885 |
|
40886 |
|
40887 |
|
40888 |
|
40889 |
|
40890 |
|
40891 |
|
40892 |
|
40893 |
|
40894 |
|
40895 |
|
40896 |
|
40897 |
|
40898 |
|
40899 |
|
40900 |
|
40901 |
|
40902 |
|
40903 |
|
40904 |
|
40905 |
|
40906 |
|
40907 |
|
40908 |
|
40909 |
|
40910 |
|
40911 |
|
40912 |
|
40913 |
|
40914 |
|
40915 |
|
40916 |
|
40917 |
|
40918 |
|
40919 |
|
40920 |
|
40921 |
|
40922 |
|
40923 |
|
40924 |
|
40925 |
|
40926 |
|
40927 |
|
40928 |
|
40929 |
|
40930 |
|
40931 |
|
40932 |
|
40933 |
|
40934 |
|
40935 |
|
40936 |
|
40937 |
|
40938 |
|
40939 |
|
40940 |
|
40941 |
|
40942 |
|
40943 |
|
40944 |
|
40945 |
|
40946 |
|
40947 |
|
40948 | var bind = (...curried) => {
|
40949 | (true && !(function (methodOrTarget, methodOrArg) {
|
40950 |
|
40951 |
|
40952 | var length = arguments.length;
|
40953 |
|
40954 | if (length === 0) {
|
40955 | return false;
|
40956 | } else if (length === 1) {
|
40957 | return typeof methodOrTarget === 'function';
|
40958 | } else {
|
40959 | var type = typeof methodOrArg;
|
40960 | return type === 'function' ||
|
40961 | methodOrTarget !== null && type === 'string' && methodOrArg in methodOrTarget ||
|
40962 | typeof methodOrTarget === 'function'
|
40963 | ;
|
40964 | }
|
40965 | }(...curried)) && (0, _debug.assert)('could not find a suitable method to bind', function (methodOrTarget, methodOrArg) {
|
40966 | var length = arguments.length;
|
40967 |
|
40968 | if (length === 0) {
|
40969 | return false;
|
40970 | } else if (length === 1) {
|
40971 | return typeof methodOrTarget === 'function';
|
40972 | } else {
|
40973 | var type = typeof methodOrArg;
|
40974 | return type === 'function' || methodOrTarget !== null && type === 'string' && methodOrArg in methodOrTarget || typeof methodOrTarget === 'function';
|
40975 | }
|
40976 | }(...curried)));
|
40977 | return (...args) => join(...curried.concat(args));
|
40978 | };
|
40979 | |
40980 |
|
40981 |
|
40982 |
|
40983 |
|
40984 |
|
40985 |
|
40986 |
|
40987 |
|
40988 |
|
40989 |
|
40990 |
|
40991 |
|
40992 |
|
40993 |
|
40994 |
|
40995 |
|
40996 |
|
40997 |
|
40998 |
|
40999 |
|
41000 | _exports.bind = bind;
|
41001 |
|
41002 | function begin() {
|
41003 | backburner.begin();
|
41004 | }
|
41005 | |
41006 |
|
41007 |
|
41008 |
|
41009 |
|
41010 |
|
41011 |
|
41012 |
|
41013 |
|
41014 |
|
41015 |
|
41016 |
|
41017 |
|
41018 |
|
41019 |
|
41020 |
|
41021 |
|
41022 |
|
41023 |
|
41024 |
|
41025 |
|
41026 | function end() {
|
41027 | backburner.end();
|
41028 | }
|
41029 | |
41030 |
|
41031 |
|
41032 |
|
41033 |
|
41034 |
|
41035 |
|
41036 |
|
41037 |
|
41038 |
|
41039 |
|
41040 |
|
41041 |
|
41042 |
|
41043 |
|
41044 |
|
41045 |
|
41046 |
|
41047 |
|
41048 |
|
41049 |
|
41050 |
|
41051 |
|
41052 |
|
41053 |
|
41054 |
|
41055 |
|
41056 |
|
41057 |
|
41058 |
|
41059 |
|
41060 |
|
41061 |
|
41062 |
|
41063 |
|
41064 |
|
41065 |
|
41066 |
|
41067 |
|
41068 |
|
41069 |
|
41070 |
|
41071 |
|
41072 | function schedule()
|
41073 | /* queue, target, method */
|
41074 | {
|
41075 | return backburner.schedule(...arguments);
|
41076 | }
|
41077 |
|
41078 |
|
41079 | function hasScheduledTimers() {
|
41080 | return backburner.hasTimers();
|
41081 | }
|
41082 |
|
41083 |
|
41084 | function cancelTimers() {
|
41085 | backburner.cancelTimers();
|
41086 | }
|
41087 | |
41088 |
|
41089 |
|
41090 |
|
41091 |
|
41092 |
|
41093 |
|
41094 |
|
41095 |
|
41096 |
|
41097 |
|
41098 |
|
41099 |
|
41100 |
|
41101 |
|
41102 |
|
41103 |
|
41104 |
|
41105 |
|
41106 |
|
41107 |
|
41108 |
|
41109 |
|
41110 |
|
41111 |
|
41112 |
|
41113 |
|
41114 |
|
41115 |
|
41116 |
|
41117 |
|
41118 |
|
41119 | function later()
|
41120 | /*target, method*/
|
41121 | {
|
41122 | return backburner.later(...arguments);
|
41123 | }
|
41124 | |
41125 |
|
41126 |
|
41127 |
|
41128 |
|
41129 |
|
41130 |
|
41131 |
|
41132 |
|
41133 |
|
41134 |
|
41135 |
|
41136 |
|
41137 |
|
41138 |
|
41139 |
|
41140 |
|
41141 | function once(...args) {
|
41142 | args.unshift('actions');
|
41143 | return backburner.scheduleOnce(...args);
|
41144 | }
|
41145 | |
41146 |
|
41147 |
|
41148 |
|
41149 |
|
41150 |
|
41151 |
|
41152 |
|
41153 |
|
41154 |
|
41155 |
|
41156 |
|
41157 |
|
41158 |
|
41159 |
|
41160 |
|
41161 |
|
41162 |
|
41163 |
|
41164 |
|
41165 |
|
41166 |
|
41167 |
|
41168 |
|
41169 |
|
41170 |
|
41171 |
|
41172 |
|
41173 |
|
41174 |
|
41175 |
|
41176 |
|
41177 |
|
41178 |
|
41179 |
|
41180 |
|
41181 |
|
41182 |
|
41183 |
|
41184 |
|
41185 |
|
41186 |
|
41187 |
|
41188 |
|
41189 |
|
41190 |
|
41191 |
|
41192 |
|
41193 |
|
41194 |
|
41195 |
|
41196 |
|
41197 |
|
41198 |
|
41199 |
|
41200 |
|
41201 |
|
41202 |
|
41203 |
|
41204 |
|
41205 |
|
41206 |
|
41207 |
|
41208 |
|
41209 |
|
41210 |
|
41211 |
|
41212 |
|
41213 |
|
41214 |
|
41215 |
|
41216 |
|
41217 |
|
41218 |
|
41219 | function scheduleOnce()
|
41220 | /* queue, target, method*/
|
41221 | {
|
41222 | return backburner.scheduleOnce(...arguments);
|
41223 | }
|
41224 | |
41225 |
|
41226 |
|
41227 |
|
41228 |
|
41229 |
|
41230 |
|
41231 |
|
41232 |
|
41233 |
|
41234 |
|
41235 |
|
41236 |
|
41237 |
|
41238 |
|
41239 |
|
41240 |
|
41241 |
|
41242 |
|
41243 |
|
41244 |
|
41245 |
|
41246 |
|
41247 |
|
41248 |
|
41249 |
|
41250 |
|
41251 |
|
41252 |
|
41253 |
|
41254 |
|
41255 |
|
41256 |
|
41257 |
|
41258 |
|
41259 |
|
41260 |
|
41261 |
|
41262 |
|
41263 |
|
41264 |
|
41265 |
|
41266 |
|
41267 |
|
41268 |
|
41269 |
|
41270 |
|
41271 |
|
41272 |
|
41273 |
|
41274 |
|
41275 |
|
41276 |
|
41277 |
|
41278 |
|
41279 |
|
41280 |
|
41281 |
|
41282 |
|
41283 |
|
41284 |
|
41285 |
|
41286 |
|
41287 |
|
41288 |
|
41289 |
|
41290 |
|
41291 |
|
41292 |
|
41293 |
|
41294 |
|
41295 |
|
41296 | function next(...args) {
|
41297 | args.push(1);
|
41298 | return backburner.later(...args);
|
41299 | }
|
41300 | |
41301 |
|
41302 |
|
41303 |
|
41304 |
|
41305 |
|
41306 |
|
41307 |
|
41308 |
|
41309 |
|
41310 |
|
41311 |
|
41312 |
|
41313 |
|
41314 |
|
41315 |
|
41316 |
|
41317 |
|
41318 |
|
41319 |
|
41320 |
|
41321 |
|
41322 |
|
41323 |
|
41324 |
|
41325 |
|
41326 |
|
41327 |
|
41328 |
|
41329 |
|
41330 |
|
41331 |
|
41332 |
|
41333 |
|
41334 |
|
41335 |
|
41336 |
|
41337 |
|
41338 |
|
41339 |
|
41340 |
|
41341 |
|
41342 |
|
41343 |
|
41344 |
|
41345 |
|
41346 |
|
41347 |
|
41348 |
|
41349 |
|
41350 |
|
41351 |
|
41352 |
|
41353 |
|
41354 |
|
41355 |
|
41356 |
|
41357 |
|
41358 |
|
41359 |
|
41360 |
|
41361 |
|
41362 |
|
41363 |
|
41364 |
|
41365 |
|
41366 |
|
41367 |
|
41368 |
|
41369 | function cancel(timer) {
|
41370 | return backburner.cancel(timer);
|
41371 | }
|
41372 | |
41373 |
|
41374 |
|
41375 |
|
41376 |
|
41377 |
|
41378 |
|
41379 |
|
41380 |
|
41381 |
|
41382 |
|
41383 |
|
41384 |
|
41385 |
|
41386 |
|
41387 |
|
41388 |
|
41389 |
|
41390 |
|
41391 |
|
41392 |
|
41393 |
|
41394 |
|
41395 |
|
41396 |
|
41397 |
|
41398 |
|
41399 |
|
41400 |
|
41401 |
|
41402 |
|
41403 |
|
41404 |
|
41405 |
|
41406 |
|
41407 |
|
41408 |
|
41409 |
|
41410 |
|
41411 |
|
41412 |
|
41413 |
|
41414 |
|
41415 |
|
41416 |
|
41417 |
|
41418 |
|
41419 |
|
41420 |
|
41421 |
|
41422 |
|
41423 |
|
41424 |
|
41425 |
|
41426 |
|
41427 |
|
41428 |
|
41429 |
|
41430 |
|
41431 |
|
41432 |
|
41433 |
|
41434 |
|
41435 |
|
41436 |
|
41437 |
|
41438 |
|
41439 |
|
41440 |
|
41441 |
|
41442 |
|
41443 |
|
41444 |
|
41445 |
|
41446 |
|
41447 |
|
41448 | function debounce() {
|
41449 | return backburner.debounce(...arguments);
|
41450 | }
|
41451 | |
41452 |
|
41453 |
|
41454 |
|
41455 |
|
41456 |
|
41457 |
|
41458 |
|
41459 |
|
41460 |
|
41461 |
|
41462 |
|
41463 |
|
41464 |
|
41465 |
|
41466 |
|
41467 |
|
41468 |
|
41469 |
|
41470 |
|
41471 |
|
41472 |
|
41473 |
|
41474 |
|
41475 |
|
41476 |
|
41477 |
|
41478 |
|
41479 |
|
41480 |
|
41481 |
|
41482 |
|
41483 |
|
41484 |
|
41485 |
|
41486 |
|
41487 |
|
41488 |
|
41489 |
|
41490 |
|
41491 |
|
41492 |
|
41493 |
|
41494 |
|
41495 |
|
41496 | function throttle() {
|
41497 | return backburner.throttle(...arguments);
|
41498 | }
|
41499 | });
|
41500 | define("@ember/service/index", ["exports", "@ember/-internals/runtime", "@ember/-internals/metal"], function (_exports, _runtime, _metal) {
|
41501 | "use strict";
|
41502 |
|
41503 | Object.defineProperty(_exports, "__esModule", {
|
41504 | value: true
|
41505 | });
|
41506 | _exports.inject = inject;
|
41507 | _exports.default = void 0;
|
41508 |
|
41509 | |
41510 |
|
41511 |
|
41512 |
|
41513 |
|
41514 | |
41515 |
|
41516 |
|
41517 |
|
41518 |
|
41519 |
|
41520 |
|
41521 |
|
41522 |
|
41523 |
|
41524 |
|
41525 |
|
41526 |
|
41527 |
|
41528 |
|
41529 |
|
41530 |
|
41531 |
|
41532 |
|
41533 |
|
41534 |
|
41535 |
|
41536 |
|
41537 |
|
41538 |
|
41539 |
|
41540 |
|
41541 |
|
41542 |
|
41543 |
|
41544 |
|
41545 |
|
41546 |
|
41547 |
|
41548 |
|
41549 |
|
41550 |
|
41551 |
|
41552 |
|
41553 |
|
41554 |
|
41555 |
|
41556 |
|
41557 |
|
41558 |
|
41559 |
|
41560 |
|
41561 | function inject() {
|
41562 | return (0, _metal.inject)('service', ...arguments);
|
41563 | }
|
41564 | |
41565 |
|
41566 |
|
41567 |
|
41568 |
|
41569 |
|
41570 |
|
41571 |
|
41572 | var Service = _runtime.FrameworkObject.extend();
|
41573 |
|
41574 | Service.reopenClass({
|
41575 | isServiceFactory: true
|
41576 | });
|
41577 | var _default = Service;
|
41578 | _exports.default = _default;
|
41579 | });
|
41580 | define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "@ember/-internals/environment", "@ember/-internals/utils"], function (_exports, _string_registry, _environment, _utils) {
|
41581 | "use strict";
|
41582 |
|
41583 | Object.defineProperty(_exports, "__esModule", {
|
41584 | value: true
|
41585 | });
|
41586 | _exports.loc = loc;
|
41587 | _exports.w = w;
|
41588 | _exports.decamelize = decamelize;
|
41589 | _exports.dasherize = dasherize;
|
41590 | _exports.camelize = camelize;
|
41591 | _exports.classify = classify;
|
41592 | _exports.underscore = underscore;
|
41593 | _exports.capitalize = capitalize;
|
41594 | Object.defineProperty(_exports, "_getStrings", {
|
41595 | enumerable: true,
|
41596 | get: function () {
|
41597 | return _string_registry.getStrings;
|
41598 | }
|
41599 | });
|
41600 | Object.defineProperty(_exports, "_setStrings", {
|
41601 | enumerable: true,
|
41602 | get: function () {
|
41603 | return _string_registry.setStrings;
|
41604 | }
|
41605 | });
|
41606 |
|
41607 | |
41608 |
|
41609 |
|
41610 | var STRING_DASHERIZE_REGEXP = /[ _]/g;
|
41611 | var STRING_DASHERIZE_CACHE = new _utils.Cache(1000, key => decamelize(key).replace(STRING_DASHERIZE_REGEXP, '-'));
|
41612 | var STRING_CAMELIZE_REGEXP_1 = /(-|_|\.|\s)+(.)?/g;
|
41613 | var STRING_CAMELIZE_REGEXP_2 = /(^|\/)([A-Z])/g;
|
41614 | var CAMELIZE_CACHE = new _utils.Cache(1000, key => key.replace(STRING_CAMELIZE_REGEXP_1, (_match, _separator, chr) => chr ? chr.toUpperCase() : '').replace(STRING_CAMELIZE_REGEXP_2, (match
|
41615 |
|
41616 | ) => match.toLowerCase()));
|
41617 | var STRING_CLASSIFY_REGEXP_1 = /^(-|_)+(.)?/;
|
41618 | var STRING_CLASSIFY_REGEXP_2 = /(.)(-|_|\.|\s)+(.)?/g;
|
41619 | var STRING_CLASSIFY_REGEXP_3 = /(^|\/|\.)([a-z])/g;
|
41620 | var CLASSIFY_CACHE = new _utils.Cache(1000, str => {
|
41621 | var replace1 = (_match, _separator, chr) => chr ? `_${chr.toUpperCase()}` : '';
|
41622 |
|
41623 | var replace2 = (_match, initialChar, _separator, chr) => initialChar + (chr ? chr.toUpperCase() : '');
|
41624 |
|
41625 | var parts = str.split('/');
|
41626 |
|
41627 | for (var i = 0; i < parts.length; i++) {
|
41628 | parts[i] = parts[i].replace(STRING_CLASSIFY_REGEXP_1, replace1).replace(STRING_CLASSIFY_REGEXP_2, replace2);
|
41629 | }
|
41630 |
|
41631 | return parts.join('/').replace(STRING_CLASSIFY_REGEXP_3, (match
|
41632 |
|
41633 | ) => match.toUpperCase());
|
41634 | });
|
41635 | var STRING_UNDERSCORE_REGEXP_1 = /([a-z\d])([A-Z]+)/g;
|
41636 | var STRING_UNDERSCORE_REGEXP_2 = /-|\s+/g;
|
41637 | var UNDERSCORE_CACHE = new _utils.Cache(1000, str => str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase());
|
41638 | var STRING_CAPITALIZE_REGEXP = /(^|\/)([a-z\u00C0-\u024F])/g;
|
41639 | var CAPITALIZE_CACHE = new _utils.Cache(1000, str => str.replace(STRING_CAPITALIZE_REGEXP, (match
|
41640 |
|
41641 | ) => match.toUpperCase()));
|
41642 | var STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
|
41643 | var DECAMELIZE_CACHE = new _utils.Cache(1000, str => str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase());
|
41644 | |
41645 |
|
41646 |
|
41647 |
|
41648 |
|
41649 |
|
41650 |
|
41651 |
|
41652 |
|
41653 | function _fmt(str, formats) {
|
41654 |
|
41655 | var idx = 0;
|
41656 |
|
41657 | return str.replace(/%@([0-9]+)?/g, (_s, argIndex) => {
|
41658 | var i = argIndex ? parseInt(argIndex, 10) - 1 : idx++;
|
41659 | var r = i < formats.length ? formats[i] : undefined;
|
41660 | return typeof r === 'string' ? r : r === null ? '(null)' : r === undefined ? '' : String(r);
|
41661 | });
|
41662 | }
|
41663 | |
41664 |
|
41665 |
|
41666 |
|
41667 |
|
41668 |
|
41669 |
|
41670 |
|
41671 |
|
41672 |
|
41673 |
|
41674 |
|
41675 |
|
41676 |
|
41677 |
|
41678 |
|
41679 |
|
41680 |
|
41681 |
|
41682 |
|
41683 |
|
41684 |
|
41685 |
|
41686 |
|
41687 |
|
41688 |
|
41689 |
|
41690 |
|
41691 | function loc(str, formats) {
|
41692 | if (!Array.isArray(formats) || arguments.length > 2) {
|
41693 | formats = Array.prototype.slice.call(arguments, 1);
|
41694 | }
|
41695 |
|
41696 | str = (0, _string_registry.getString)(str) || str;
|
41697 | return _fmt(str, formats);
|
41698 | }
|
41699 | |
41700 |
|
41701 |
|
41702 |
|
41703 |
|
41704 |
|
41705 |
|
41706 |
|
41707 |
|
41708 |
|
41709 |
|
41710 |
|
41711 |
|
41712 |
|
41713 |
|
41714 |
|
41715 |
|
41716 |
|
41717 |
|
41718 |
|
41719 |
|
41720 |
|
41721 |
|
41722 |
|
41723 | function w(str) {
|
41724 | return str.split(/\s+/);
|
41725 | }
|
41726 | |
41727 |
|
41728 |
|
41729 |
|
41730 |
|
41731 |
|
41732 |
|
41733 |
|
41734 |
|
41735 |
|
41736 |
|
41737 |
|
41738 |
|
41739 |
|
41740 |
|
41741 |
|
41742 |
|
41743 |
|
41744 |
|
41745 | function decamelize(str) {
|
41746 | return DECAMELIZE_CACHE.get(str);
|
41747 | }
|
41748 | |
41749 |
|
41750 |
|
41751 |
|
41752 |
|
41753 |
|
41754 |
|
41755 |
|
41756 |
|
41757 |
|
41758 |
|
41759 |
|
41760 |
|
41761 |
|
41762 |
|
41763 |
|
41764 |
|
41765 |
|
41766 |
|
41767 |
|
41768 | function dasherize(str) {
|
41769 | return STRING_DASHERIZE_CACHE.get(str);
|
41770 | }
|
41771 | |
41772 |
|
41773 |
|
41774 |
|
41775 |
|
41776 |
|
41777 |
|
41778 |
|
41779 |
|
41780 |
|
41781 |
|
41782 |
|
41783 |
|
41784 |
|
41785 |
|
41786 |
|
41787 |
|
41788 |
|
41789 |
|
41790 |
|
41791 |
|
41792 | function camelize(str) {
|
41793 | return CAMELIZE_CACHE.get(str);
|
41794 | }
|
41795 | |
41796 |
|
41797 |
|
41798 |
|
41799 |
|
41800 |
|
41801 |
|
41802 |
|
41803 |
|
41804 |
|
41805 |
|
41806 |
|
41807 |
|
41808 |
|
41809 |
|
41810 |
|
41811 |
|
41812 |
|
41813 |
|
41814 |
|
41815 | function classify(str) {
|
41816 | return CLASSIFY_CACHE.get(str);
|
41817 | }
|
41818 | |
41819 |
|
41820 |
|
41821 |
|
41822 |
|
41823 |
|
41824 |
|
41825 |
|
41826 |
|
41827 |
|
41828 |
|
41829 |
|
41830 |
|
41831 |
|
41832 |
|
41833 |
|
41834 |
|
41835 |
|
41836 |
|
41837 |
|
41838 |
|
41839 | function underscore(str) {
|
41840 | return UNDERSCORE_CACHE.get(str);
|
41841 | }
|
41842 | |
41843 |
|
41844 |
|
41845 |
|
41846 |
|
41847 |
|
41848 |
|
41849 |
|
41850 |
|
41851 |
|
41852 |
|
41853 |
|
41854 |
|
41855 |
|
41856 |
|
41857 |
|
41858 |
|
41859 |
|
41860 |
|
41861 |
|
41862 | function capitalize(str) {
|
41863 | return CAPITALIZE_CACHE.get(str);
|
41864 | }
|
41865 |
|
41866 | if (_environment.ENV.EXTEND_PROTOTYPES.String) {
|
41867 | Object.defineProperties(String.prototype, {
|
41868 | |
41869 |
|
41870 |
|
41871 |
|
41872 |
|
41873 |
|
41874 |
|
41875 | w: {
|
41876 | configurable: true,
|
41877 | enumerable: false,
|
41878 | writeable: true,
|
41879 |
|
41880 | value() {
|
41881 | return w(this);
|
41882 | }
|
41883 |
|
41884 | },
|
41885 |
|
41886 | |
41887 |
|
41888 |
|
41889 |
|
41890 |
|
41891 |
|
41892 |
|
41893 | loc: {
|
41894 | configurable: true,
|
41895 | enumerable: false,
|
41896 | writeable: true,
|
41897 |
|
41898 | value(...args) {
|
41899 | return loc(this, args);
|
41900 | }
|
41901 |
|
41902 | },
|
41903 |
|
41904 | |
41905 |
|
41906 |
|
41907 |
|
41908 |
|
41909 |
|
41910 |
|
41911 | camelize: {
|
41912 | configurable: true,
|
41913 | enumerable: false,
|
41914 | writeable: true,
|
41915 |
|
41916 | value() {
|
41917 | return camelize(this);
|
41918 | }
|
41919 |
|
41920 | },
|
41921 |
|
41922 | |
41923 |
|
41924 |
|
41925 |
|
41926 |
|
41927 |
|
41928 |
|
41929 | decamelize: {
|
41930 | configurable: true,
|
41931 | enumerable: false,
|
41932 | writeable: true,
|
41933 |
|
41934 | value() {
|
41935 | return decamelize(this);
|
41936 | }
|
41937 |
|
41938 | },
|
41939 |
|
41940 | |
41941 |
|
41942 |
|
41943 |
|
41944 |
|
41945 |
|
41946 |
|
41947 | dasherize: {
|
41948 | configurable: true,
|
41949 | enumerable: false,
|
41950 | writeable: true,
|
41951 |
|
41952 | value() {
|
41953 | return dasherize(this);
|
41954 | }
|
41955 |
|
41956 | },
|
41957 |
|
41958 | |
41959 |
|
41960 |
|
41961 |
|
41962 |
|
41963 |
|
41964 |
|
41965 | underscore: {
|
41966 | configurable: true,
|
41967 | enumerable: false,
|
41968 | writeable: true,
|
41969 |
|
41970 | value() {
|
41971 | return underscore(this);
|
41972 | }
|
41973 |
|
41974 | },
|
41975 |
|
41976 | |
41977 |
|
41978 |
|
41979 |
|
41980 |
|
41981 |
|
41982 |
|
41983 | classify: {
|
41984 | configurable: true,
|
41985 | enumerable: false,
|
41986 | writeable: true,
|
41987 |
|
41988 | value() {
|
41989 | return classify(this);
|
41990 | }
|
41991 |
|
41992 | },
|
41993 |
|
41994 | |
41995 |
|
41996 |
|
41997 |
|
41998 |
|
41999 |
|
42000 |
|
42001 | capitalize: {
|
42002 | configurable: true,
|
42003 | enumerable: false,
|
42004 | writeable: true,
|
42005 |
|
42006 | value() {
|
42007 | return capitalize(this);
|
42008 | }
|
42009 |
|
42010 | }
|
42011 | });
|
42012 | }
|
42013 | });
|
42014 | define("@ember/string/lib/string_registry", ["exports"], function (_exports) {
|
42015 | "use strict";
|
42016 |
|
42017 | Object.defineProperty(_exports, "__esModule", {
|
42018 | value: true
|
42019 | });
|
42020 | _exports.setStrings = setStrings;
|
42021 | _exports.getStrings = getStrings;
|
42022 | _exports.getString = getString;
|
42023 |
|
42024 |
|
42025 |
|
42026 | var STRINGS = {};
|
42027 |
|
42028 | function setStrings(strings) {
|
42029 | STRINGS = strings;
|
42030 | }
|
42031 |
|
42032 | function getStrings() {
|
42033 | return STRINGS;
|
42034 | }
|
42035 |
|
42036 | function getString(name) {
|
42037 | return STRINGS[name];
|
42038 | }
|
42039 | });
|
42040 | define("@glimmer/encoder", ["exports"], function (_exports) {
|
42041 | "use strict";
|
42042 |
|
42043 | Object.defineProperty(_exports, "__esModule", {
|
42044 | value: true
|
42045 | });
|
42046 | _exports.InstructionEncoderImpl = void 0;
|
42047 |
|
42048 | class InstructionEncoderImpl {
|
42049 | constructor(buffer) {
|
42050 | this.buffer = buffer;
|
42051 | this.size = 0;
|
42052 | }
|
42053 |
|
42054 | encode(type, machine) {
|
42055 | if (type > 255
|
42056 |
|
42057 | ) {
|
42058 | throw new Error(`Opcode type over 8-bits. Got ${type}.`);
|
42059 | }
|
42060 |
|
42061 | var first = type | machine | arguments.length - 2 << 8
|
42062 |
|
42063 | ;
|
42064 | this.buffer.push(first);
|
42065 |
|
42066 | for (var i = 2; i < arguments.length; i++) {
|
42067 | var op = arguments[i];
|
42068 |
|
42069 | if (typeof op === 'number' && op > 2147483647
|
42070 |
|
42071 | ) {
|
42072 | throw new Error(`Operand over 32-bits. Got ${op}.`);
|
42073 | }
|
42074 |
|
42075 | this.buffer.push(op);
|
42076 | }
|
42077 |
|
42078 | this.size = this.buffer.length;
|
42079 | }
|
42080 |
|
42081 | patch(position, target) {
|
42082 | if (this.buffer[position + 1] === -1) {
|
42083 | this.buffer[position + 1] = target;
|
42084 | } else {
|
42085 | throw new Error('Trying to patch operand in populated slot instead of a reserved slot.');
|
42086 | }
|
42087 | }
|
42088 |
|
42089 | }
|
42090 |
|
42091 | _exports.InstructionEncoderImpl = InstructionEncoderImpl;
|
42092 | });
|
42093 | define("@glimmer/env", ["exports"], function (_exports) {
|
42094 | "use strict";
|
42095 |
|
42096 | Object.defineProperty(_exports, "__esModule", {
|
42097 | value: true
|
42098 | });
|
42099 | _exports.CI = _exports.DEBUG = void 0;
|
42100 | var DEBUG = false;
|
42101 | _exports.DEBUG = DEBUG;
|
42102 | var CI = false;
|
42103 | _exports.CI = CI;
|
42104 | });
|
42105 | define("@glimmer/low-level", ["exports"], function (_exports) {
|
42106 | "use strict";
|
42107 |
|
42108 | Object.defineProperty(_exports, "__esModule", {
|
42109 | value: true
|
42110 | });
|
42111 | _exports.Stack = _exports.Storage = void 0;
|
42112 |
|
42113 | class Storage {
|
42114 | constructor() {
|
42115 | this.array = [];
|
42116 | this.next = 0;
|
42117 | }
|
42118 |
|
42119 | add(element) {
|
42120 | var {
|
42121 | next: slot,
|
42122 | array
|
42123 | } = this;
|
42124 |
|
42125 | if (slot === array.length) {
|
42126 | this.next++;
|
42127 | } else {
|
42128 | var prev = array[slot];
|
42129 | this.next = prev;
|
42130 | }
|
42131 |
|
42132 | this.array[slot] = element;
|
42133 | return slot;
|
42134 | }
|
42135 |
|
42136 | deref(pointer) {
|
42137 | return this.array[pointer];
|
42138 | }
|
42139 |
|
42140 | drop(pointer) {
|
42141 | this.array[pointer] = this.next;
|
42142 | this.next = pointer;
|
42143 | }
|
42144 |
|
42145 | }
|
42146 |
|
42147 | _exports.Storage = Storage;
|
42148 |
|
42149 | class Stack {
|
42150 | constructor(vec = []) {
|
42151 | this.vec = vec;
|
42152 | }
|
42153 |
|
42154 | clone() {
|
42155 | return new Stack(this.vec.slice());
|
42156 | }
|
42157 |
|
42158 | sliceFrom(start) {
|
42159 | return new Stack(this.vec.slice(start));
|
42160 | }
|
42161 |
|
42162 | slice(start, end) {
|
42163 | return new Stack(this.vec.slice(start, end));
|
42164 | }
|
42165 |
|
42166 | copy(from, to) {
|
42167 | this.vec[to] = this.vec[from];
|
42168 | }
|
42169 |
|
42170 |
|
42171 | writeRaw(pos, value) {
|
42172 |
|
42173 | this.vec[pos] = value;
|
42174 | }
|
42175 |
|
42176 |
|
42177 | getRaw(pos) {
|
42178 | return this.vec[pos];
|
42179 | }
|
42180 |
|
42181 | reset() {
|
42182 | this.vec.length = 0;
|
42183 | }
|
42184 |
|
42185 | len() {
|
42186 | return this.vec.length;
|
42187 | }
|
42188 |
|
42189 | }
|
42190 |
|
42191 | _exports.Stack = Stack;
|
42192 | });
|
42193 | define("@glimmer/node", ["exports", "@glimmer/runtime", "@simple-dom/document"], function (_exports, _runtime, _document) {
|
42194 | "use strict";
|
42195 |
|
42196 | Object.defineProperty(_exports, "__esModule", {
|
42197 | value: true
|
42198 | });
|
42199 | _exports.serializeBuilder = serializeBuilder;
|
42200 | _exports.NodeDOMTreeConstruction = void 0;
|
42201 |
|
42202 | class NodeDOMTreeConstruction extends _runtime.DOMTreeConstruction {
|
42203 | constructor(doc) {
|
42204 | super(doc || (0, _document.default)());
|
42205 | }
|
42206 |
|
42207 |
|
42208 | setupUselessElement() {}
|
42209 |
|
42210 | insertHTMLBefore(parent, reference, html) {
|
42211 | var raw = this.document.createRawHTMLSection(html);
|
42212 | parent.insertBefore(raw, reference);
|
42213 | return new _runtime.ConcreteBounds(parent, raw, raw);
|
42214 | }
|
42215 |
|
42216 |
|
42217 | createElement(tag) {
|
42218 | return this.document.createElement(tag);
|
42219 | }
|
42220 |
|
42221 |
|
42222 | setAttribute(element, name, value) {
|
42223 | element.setAttribute(name, value);
|
42224 | }
|
42225 |
|
42226 | }
|
42227 |
|
42228 | _exports.NodeDOMTreeConstruction = NodeDOMTreeConstruction;
|
42229 | var TEXT_NODE = 3;
|
42230 | var NEEDS_EXTRA_CLOSE = new WeakMap();
|
42231 |
|
42232 | function currentNode(cursor) {
|
42233 | var {
|
42234 | element,
|
42235 | nextSibling
|
42236 | } = cursor;
|
42237 |
|
42238 | if (nextSibling === null) {
|
42239 | return element.lastChild;
|
42240 | } else {
|
42241 | return nextSibling.previousSibling;
|
42242 | }
|
42243 | }
|
42244 |
|
42245 | class SerializeBuilder extends _runtime.NewElementBuilder {
|
42246 | constructor() {
|
42247 | super(...arguments);
|
42248 | this.serializeBlockDepth = 0;
|
42249 | }
|
42250 |
|
42251 | __openBlock() {
|
42252 | var {
|
42253 | tagName
|
42254 | } = this.element;
|
42255 |
|
42256 | if (tagName !== 'TITLE' && tagName !== 'SCRIPT' && tagName !== 'STYLE') {
|
42257 | var depth = this.serializeBlockDepth++;
|
42258 |
|
42259 | this.__appendComment(`%+b:${depth}%`);
|
42260 | }
|
42261 |
|
42262 | super.__openBlock();
|
42263 | }
|
42264 |
|
42265 | __closeBlock() {
|
42266 | var {
|
42267 | tagName
|
42268 | } = this.element;
|
42269 |
|
42270 | super.__closeBlock();
|
42271 |
|
42272 | if (tagName !== 'TITLE' && tagName !== 'SCRIPT' && tagName !== 'STYLE') {
|
42273 | var depth = --this.serializeBlockDepth;
|
42274 |
|
42275 | this.__appendComment(`%-b:${depth}%`);
|
42276 | }
|
42277 | }
|
42278 |
|
42279 | __appendHTML(html) {
|
42280 | var {
|
42281 | tagName
|
42282 | } = this.element;
|
42283 |
|
42284 | if (tagName === 'TITLE' || tagName === 'SCRIPT' || tagName === 'STYLE') {
|
42285 | return super.__appendHTML(html);
|
42286 | }
|
42287 |
|
42288 |
|
42289 | var first = this.__appendComment('%glmr%');
|
42290 |
|
42291 | if (tagName === 'TABLE') {
|
42292 | var openIndex = html.indexOf('<');
|
42293 |
|
42294 | if (openIndex > -1) {
|
42295 | var tr = html.slice(openIndex + 1, openIndex + 3);
|
42296 |
|
42297 | if (tr === 'tr') {
|
42298 | html = `<tbody>${html}</tbody>`;
|
42299 | }
|
42300 | }
|
42301 | }
|
42302 |
|
42303 | if (html === '') {
|
42304 | this.__appendComment('% %');
|
42305 | } else {
|
42306 | super.__appendHTML(html);
|
42307 | }
|
42308 |
|
42309 | var last = this.__appendComment('%glmr%');
|
42310 |
|
42311 | return new _runtime.ConcreteBounds(this.element, first, last);
|
42312 | }
|
42313 |
|
42314 | __appendText(string) {
|
42315 | var {
|
42316 | tagName
|
42317 | } = this.element;
|
42318 | var current = currentNode(this);
|
42319 |
|
42320 | if (tagName === 'TITLE' || tagName === 'SCRIPT' || tagName === 'STYLE') {
|
42321 | return super.__appendText(string);
|
42322 | } else if (string === '') {
|
42323 | return this.__appendComment('% %');
|
42324 | } else if (current && current.nodeType === TEXT_NODE) {
|
42325 | this.__appendComment('%|%');
|
42326 | }
|
42327 |
|
42328 | return super.__appendText(string);
|
42329 | }
|
42330 |
|
42331 | closeElement() {
|
42332 | if (NEEDS_EXTRA_CLOSE.has(this.element)) {
|
42333 | NEEDS_EXTRA_CLOSE.delete(this.element);
|
42334 | super.closeElement();
|
42335 | }
|
42336 |
|
42337 | return super.closeElement();
|
42338 | }
|
42339 |
|
42340 | openElement(tag) {
|
42341 | if (tag === 'tr') {
|
42342 | if (this.element.tagName !== 'TBODY' && this.element.tagName !== 'THEAD' && this.element.tagName !== 'TFOOT') {
|
42343 | this.openElement('tbody');
|
42344 |
|
42345 |
|
42346 |
|
42347 |
|
42348 | NEEDS_EXTRA_CLOSE.set(this.constructing, true);
|
42349 | this.flushElement(null);
|
42350 | }
|
42351 | }
|
42352 |
|
42353 | return super.openElement(tag);
|
42354 | }
|
42355 |
|
42356 | pushRemoteElement(element, cursorId, insertBefore = null) {
|
42357 | var {
|
42358 | dom
|
42359 | } = this;
|
42360 | var script = dom.createElement('script');
|
42361 | script.setAttribute('glmr', cursorId);
|
42362 | dom.insertBefore(element, script, insertBefore);
|
42363 | return super.pushRemoteElement(element, cursorId, insertBefore);
|
42364 | }
|
42365 |
|
42366 | }
|
42367 |
|
42368 | function serializeBuilder(env, cursor) {
|
42369 | return SerializeBuilder.forInitialRender(env, cursor);
|
42370 | }
|
42371 | });
|
42372 | define("@glimmer/opcode-compiler", ["exports", "@glimmer/vm", "@glimmer/util", "@glimmer/program", "@glimmer/encoder"], function (_exports, _vm, _util, _program, _encoder) {
|
42373 | "use strict";
|
42374 |
|
42375 | Object.defineProperty(_exports, "__esModule", {
|
42376 | value: true
|
42377 | });
|
42378 | _exports.compileStatements = compileStatements;
|
42379 | _exports.compilable = compilable;
|
42380 | _exports.staticComponent = StaticComponent;
|
42381 | _exports.invokeStaticBlockWithStack = InvokeStaticBlockWithStack;
|
42382 | _exports.invokeStaticBlock = InvokeStaticBlock;
|
42383 | _exports.compileStd = compileStd;
|
42384 | _exports.meta = meta;
|
42385 | _exports.templateFactory = templateFactory;
|
42386 | _exports.Component = Component;
|
42387 | _exports.resolveLayoutForTag = resolveLayoutForTag;
|
42388 | _exports.syntaxCompilationContext = syntaxCompilationContext;
|
42389 | _exports.Context = Context;
|
42390 | _exports.JitContext = JitContext;
|
42391 | _exports.AotContext = AotContext;
|
42392 | _exports.templateCompilationContext = templateCompilationContext;
|
42393 | _exports.DefaultCompileTimeResolverDelegate = _exports.MINIMAL_CAPABILITIES = _exports.DEFAULT_CAPABILITIES = _exports.JitProgramCompilationContext = _exports.ProgramCompilationContext = _exports.EMPTY_BLOCKS = _exports.WrappedBuilder = _exports.PartialDefinitionImpl = _exports.StdLib = _exports.debugCompiler = _exports.NONE = _exports.UNHANDLED = _exports.MacrosImpl = void 0;
|
42394 |
|
42395 | function arr(value) {
|
42396 | return {
|
42397 | type: 'array',
|
42398 | value
|
42399 | };
|
42400 | }
|
42401 |
|
42402 | function strArray(value) {
|
42403 | return {
|
42404 | type: 'string-array',
|
42405 | value
|
42406 | };
|
42407 | }
|
42408 |
|
42409 | function serializable(value) {
|
42410 | return {
|
42411 | type: 'serializable',
|
42412 | value
|
42413 | };
|
42414 | }
|
42415 |
|
42416 | function templateMeta(value) {
|
42417 | return {
|
42418 | type: 'template-meta',
|
42419 | value
|
42420 | };
|
42421 | }
|
42422 |
|
42423 | function other(value) {
|
42424 | return {
|
42425 | type: 'other',
|
42426 | value
|
42427 | };
|
42428 | }
|
42429 |
|
42430 | function label(value) {
|
42431 | return {
|
42432 | type: 'label',
|
42433 | value
|
42434 | };
|
42435 | }
|
42436 |
|
42437 | function immediate(value) {
|
42438 | return {
|
42439 | type: 'immediate',
|
42440 | value
|
42441 | };
|
42442 | }
|
42443 |
|
42444 | function prim(value) {
|
42445 | return {
|
42446 | type: 'primitive',
|
42447 | value
|
42448 | };
|
42449 | }
|
42450 |
|
42451 | var DEFAULT_CAPABILITIES = {
|
42452 | dynamicLayout: true,
|
42453 | dynamicTag: true,
|
42454 | prepareArgs: true,
|
42455 | createArgs: true,
|
42456 | attributeHook: false,
|
42457 | elementHook: false,
|
42458 | dynamicScope: true,
|
42459 | createCaller: false,
|
42460 | updateHook: true,
|
42461 | createInstance: true,
|
42462 | wrapped: false,
|
42463 | willDestroy: false
|
42464 | };
|
42465 | _exports.DEFAULT_CAPABILITIES = DEFAULT_CAPABILITIES;
|
42466 | var MINIMAL_CAPABILITIES = {
|
42467 | dynamicLayout: false,
|
42468 | dynamicTag: false,
|
42469 | prepareArgs: false,
|
42470 | createArgs: false,
|
42471 | attributeHook: false,
|
42472 | elementHook: false,
|
42473 | dynamicScope: false,
|
42474 | createCaller: false,
|
42475 | updateHook: false,
|
42476 | createInstance: false,
|
42477 | wrapped: false,
|
42478 | willDestroy: false
|
42479 | };
|
42480 | _exports.MINIMAL_CAPABILITIES = MINIMAL_CAPABILITIES;
|
42481 |
|
42482 | class DefaultCompileTimeResolverDelegate {
|
42483 | constructor(inner) {
|
42484 | this.inner = inner;
|
42485 | }
|
42486 |
|
42487 | lookupHelper(name, referrer) {
|
42488 | if (this.inner.lookupHelper) {
|
42489 | var helper = this.inner.lookupHelper(name, referrer);
|
42490 |
|
42491 | if (helper === undefined) {
|
42492 | throw new Error(`Unexpected helper (${name} from ${JSON.stringify(referrer)}) (lookupHelper returned undefined)`);
|
42493 | }
|
42494 |
|
42495 | return helper;
|
42496 | } else {
|
42497 | throw new Error(`Can't compile global helper invocations without an implementation of lookupHelper`);
|
42498 | }
|
42499 | }
|
42500 |
|
42501 | lookupModifier(name, referrer) {
|
42502 | if (this.inner.lookupModifier) {
|
42503 | var modifier = this.inner.lookupModifier(name, referrer);
|
42504 |
|
42505 | if (modifier === undefined) {
|
42506 | throw new Error(`Unexpected modifier (${name} from ${JSON.stringify(referrer)}) (lookupModifier returned undefined)`);
|
42507 | }
|
42508 |
|
42509 | return modifier;
|
42510 | } else {
|
42511 | throw new Error(`Can't compile global modifier invocations without an implementation of lookupModifier`);
|
42512 | }
|
42513 | }
|
42514 |
|
42515 | lookupComponent(name, referrer) {
|
42516 | if (this.inner.lookupComponent) {
|
42517 | var component = this.inner.lookupComponent(name, referrer);
|
42518 |
|
42519 | if (component === undefined) {
|
42520 | throw new Error(`Unexpected component (${name} from ${JSON.stringify(referrer)}) (lookupComponent returned undefined)`);
|
42521 | }
|
42522 |
|
42523 | return component;
|
42524 | } else {
|
42525 | throw new Error(`Can't compile global component invocations without an implementation of lookupComponent`);
|
42526 | }
|
42527 | }
|
42528 |
|
42529 | lookupPartial(name, referrer) {
|
42530 | if (this.inner.lookupPartial) {
|
42531 | var partial = this.inner.lookupPartial(name, referrer);
|
42532 |
|
42533 | if (partial === undefined) {
|
42534 | throw new Error(`Unexpected partial (${name} from ${JSON.stringify(referrer)}) (lookupPartial returned undefined)`);
|
42535 | }
|
42536 |
|
42537 | return partial;
|
42538 | } else {
|
42539 | throw new Error(`Can't compile global partial invocations without an implementation of lookupPartial`);
|
42540 | }
|
42541 | }
|
42542 |
|
42543 |
|
42544 | resolve(handle) {
|
42545 | if (this.inner.resolve) {
|
42546 | return this.inner.resolve(handle);
|
42547 | } else {
|
42548 | throw new Error(`Compile-time debugging requires an implementation of resolve`);
|
42549 | }
|
42550 | }
|
42551 |
|
42552 | }
|
42553 |
|
42554 | _exports.DefaultCompileTimeResolverDelegate = DefaultCompileTimeResolverDelegate;
|
42555 |
|
42556 | function resolveLayoutForTag(tag, {
|
42557 | resolver,
|
42558 | meta: {
|
42559 | referrer
|
42560 | }
|
42561 | }) {
|
42562 | var component = resolver.lookupComponent(tag, referrer);
|
42563 | if (component === null) return component;
|
42564 | var {
|
42565 | handle,
|
42566 | compilable,
|
42567 | capabilities
|
42568 | } = component;
|
42569 | return {
|
42570 | handle,
|
42571 | compilable,
|
42572 | capabilities: capabilities || MINIMAL_CAPABILITIES
|
42573 | };
|
42574 | }
|
42575 | |
42576 |
|
42577 |
|
42578 |
|
42579 |
|
42580 |
|
42581 | function PushPrimitiveReference(value) {
|
42582 | return [PushPrimitive(value), op(31
|
42583 |
|
42584 | )];
|
42585 | }
|
42586 | |
42587 |
|
42588 |
|
42589 |
|
42590 |
|
42591 |
|
42592 |
|
42593 | function PushPrimitive(primitive) {
|
42594 | var p = typeof primitive === 'number' && (0, _util.isSmallInt)(primitive) ? immediate(primitive) : prim(primitive);
|
42595 | return op(30
|
42596 |
|
42597 | , p);
|
42598 | }
|
42599 | |
42600 |
|
42601 |
|
42602 |
|
42603 |
|
42604 |
|
42605 |
|
42606 |
|
42607 |
|
42608 | function Call({
|
42609 | handle,
|
42610 | params,
|
42611 | hash
|
42612 | }) {
|
42613 | return [op(0
|
42614 |
|
42615 | ), op('SimpleArgs', {
|
42616 | params,
|
42617 | hash,
|
42618 | atNames: false
|
42619 | }), op(16
|
42620 |
|
42621 | , handle), op(1
|
42622 |
|
42623 | ), op(36
|
42624 |
|
42625 | , _vm.$v0)];
|
42626 | }
|
42627 | |
42628 |
|
42629 |
|
42630 |
|
42631 |
|
42632 |
|
42633 |
|
42634 |
|
42635 |
|
42636 |
|
42637 | function DynamicScope(names, block) {
|
42638 | return [op(59
|
42639 |
|
42640 | ), op(58
|
42641 |
|
42642 | , strArray(names)), block(), op(60
|
42643 |
|
42644 | )];
|
42645 | }
|
42646 | |
42647 |
|
42648 |
|
42649 |
|
42650 |
|
42651 |
|
42652 |
|
42653 |
|
42654 | function YieldBlock(to, params) {
|
42655 | return [op('SimpleArgs', {
|
42656 | params,
|
42657 | hash: null,
|
42658 | atNames: true
|
42659 | }), op(24
|
42660 |
|
42661 | , to), op(25
|
42662 |
|
42663 | ), op('Option', op('JitCompileBlock')), op(64
|
42664 |
|
42665 | ), op(40
|
42666 |
|
42667 | ), op(1
|
42668 |
|
42669 | )];
|
42670 | }
|
42671 | |
42672 |
|
42673 |
|
42674 |
|
42675 |
|
42676 |
|
42677 |
|
42678 |
|
42679 | function PushYieldableBlock(block) {
|
42680 | return [PushSymbolTable(block && block.symbolTable), op(62
|
42681 |
|
42682 | ), op('PushCompilable', block)];
|
42683 | }
|
42684 | |
42685 |
|
42686 |
|
42687 |
|
42688 |
|
42689 |
|
42690 |
|
42691 | function InvokeStaticBlock(block) {
|
42692 | return [op(0
|
42693 |
|
42694 | ), op('PushCompilable', block), op('JitCompileBlock'), op(2
|
42695 |
|
42696 | ), op(1
|
42697 |
|
42698 | )];
|
42699 | }
|
42700 | |
42701 |
|
42702 |
|
42703 |
|
42704 |
|
42705 |
|
42706 |
|
42707 |
|
42708 |
|
42709 | function InvokeStaticBlockWithStack(block, callerCount) {
|
42710 | var {
|
42711 | parameters
|
42712 | } = block.symbolTable;
|
42713 | var calleeCount = parameters.length;
|
42714 | var count = Math.min(callerCount, calleeCount);
|
42715 |
|
42716 | if (count === 0) {
|
42717 | return InvokeStaticBlock(block);
|
42718 | }
|
42719 |
|
42720 | var out = [];
|
42721 | out.push(op(0
|
42722 |
|
42723 | ));
|
42724 |
|
42725 | if (count) {
|
42726 | out.push(op(39
|
42727 |
|
42728 | ));
|
42729 |
|
42730 | for (var i = 0; i < count; i++) {
|
42731 | out.push(op(33
|
42732 |
|
42733 | , _vm.$fp, callerCount - i));
|
42734 | out.push(op(19
|
42735 |
|
42736 | , parameters[i]));
|
42737 | }
|
42738 | }
|
42739 |
|
42740 | out.push(op('PushCompilable', block));
|
42741 | out.push(op('JitCompileBlock'));
|
42742 | out.push(op(2
|
42743 |
|
42744 | ));
|
42745 |
|
42746 | if (count) {
|
42747 | out.push(op(40
|
42748 |
|
42749 | ));
|
42750 | }
|
42751 |
|
42752 | out.push(op(1
|
42753 |
|
42754 | ));
|
42755 | return out;
|
42756 | }
|
42757 |
|
42758 | function PushSymbolTable(table) {
|
42759 | if (table) {
|
42760 | return op(63
|
42761 |
|
42762 | , serializable(table));
|
42763 | } else {
|
42764 | return PushPrimitive(null);
|
42765 | }
|
42766 | }
|
42767 |
|
42768 | function SwitchCases(callback) {
|
42769 |
|
42770 | var clauses = [];
|
42771 | var count = 0;
|
42772 |
|
42773 | function when(match, callback) {
|
42774 | clauses.push({
|
42775 | match,
|
42776 | callback,
|
42777 | label: `CLAUSE${count++}`
|
42778 | });
|
42779 | }
|
42780 |
|
42781 |
|
42782 | callback(when);
|
42783 |
|
42784 | var out = [op(69
|
42785 |
|
42786 | , 2), op(68
|
42787 |
|
42788 | ), op(32
|
42789 |
|
42790 | ), op('StartLabels')];
|
42791 |
|
42792 |
|
42793 | for (var clause of clauses.slice(0, -1)) {
|
42794 | out.push(op(67
|
42795 |
|
42796 | , label(clause.label), clause.match));
|
42797 | }
|
42798 |
|
42799 |
|
42800 |
|
42801 | for (var i = clauses.length - 1; i >= 0; i--) {
|
42802 | var _clause = clauses[i];
|
42803 | out.push(op('Label', _clause.label), op(34
|
42804 |
|
42805 | , 2), _clause.callback());
|
42806 |
|
42807 |
|
42808 | if (i !== 0) {
|
42809 | out.push(op(4
|
42810 |
|
42811 | , label('END')));
|
42812 | }
|
42813 | }
|
42814 |
|
42815 | out.push(op('Label', 'END'), op('StopLabels'), op(70
|
42816 |
|
42817 | ));
|
42818 | return out;
|
42819 | }
|
42820 | |
42821 |
|
42822 |
|
42823 |
|
42824 |
|
42825 |
|
42826 |
|
42827 |
|
42828 |
|
42829 |
|
42830 |
|
42831 |
|
42832 |
|
42833 |
|
42834 |
|
42835 |
|
42836 |
|
42837 |
|
42838 |
|
42839 |
|
42840 |
|
42841 |
|
42842 |
|
42843 |
|
42844 |
|
42845 |
|
42846 |
|
42847 |
|
42848 |
|
42849 |
|
42850 |
|
42851 |
|
42852 |
|
42853 |
|
42854 |
|
42855 |
|
42856 |
|
42857 |
|
42858 |
|
42859 |
|
42860 |
|
42861 |
|
42862 |
|
42863 |
|
42864 |
|
42865 |
|
42866 |
|
42867 |
|
42868 |
|
42869 |
|
42870 |
|
42871 |
|
42872 |
|
42873 |
|
42874 |
|
42875 |
|
42876 |
|
42877 |
|
42878 |
|
42879 |
|
42880 |
|
42881 |
|
42882 |
|
42883 | function Replayable({
|
42884 | args: args$$1,
|
42885 | body
|
42886 | }) {
|
42887 |
|
42888 |
|
42889 |
|
42890 | var {
|
42891 | count,
|
42892 | actions
|
42893 | } = args$$1();
|
42894 |
|
42895 |
|
42896 | return [op('StartLabels'), op(0
|
42897 |
|
42898 | ),
|
42899 |
|
42900 | op(6
|
42901 |
|
42902 | , label('ENDINITIAL')), actions,
|
42903 |
|
42904 |
|
42905 |
|
42906 |
|
42907 |
|
42908 |
|
42909 |
|
42910 |
|
42911 |
|
42912 | op(69
|
42913 |
|
42914 | , count),
|
42915 |
|
42916 |
|
42917 | body(),
|
42918 |
|
42919 |
|
42920 | op('Label', 'FINALLY'),
|
42921 | op(70
|
42922 |
|
42923 | ),
|
42924 |
|
42925 |
|
42926 | op(5
|
42927 |
|
42928 | ),
|
42929 |
|
42930 | op('Label', 'ENDINITIAL'), op(1
|
42931 |
|
42932 | ), op('StopLabels')];
|
42933 | }
|
42934 | |
42935 |
|
42936 |
|
42937 |
|
42938 |
|
42939 |
|
42940 |
|
42941 |
|
42942 |
|
42943 |
|
42944 |
|
42945 |
|
42946 |
|
42947 |
|
42948 |
|
42949 |
|
42950 |
|
42951 | function ReplayableIf({
|
42952 | args: args$$1,
|
42953 | ifTrue,
|
42954 | ifFalse
|
42955 | }) {
|
42956 | return Replayable({
|
42957 | args: args$$1,
|
42958 | body: () => {
|
42959 | var out = [
|
42960 | op(66
|
42961 |
|
42962 | , label('ELSE')),
|
42963 | ifTrue(),
|
42964 |
|
42965 |
|
42966 | op(4
|
42967 |
|
42968 | , label('FINALLY')), op('Label', 'ELSE')];
|
42969 |
|
42970 |
|
42971 |
|
42972 |
|
42973 | if (ifFalse) {
|
42974 | out.push(ifFalse());
|
42975 | }
|
42976 |
|
42977 | return out;
|
42978 | }
|
42979 | });
|
42980 | }
|
42981 |
|
42982 | function pushBuilderOp(context, op$$1) {
|
42983 | var {
|
42984 | encoder,
|
42985 | syntax: {
|
42986 | program: {
|
42987 | mode,
|
42988 | constants
|
42989 | }
|
42990 | }
|
42991 | } = context;
|
42992 |
|
42993 | switch (op$$1.op) {
|
42994 | case "Option"
|
42995 |
|
42996 | :
|
42997 | return concat(context, option$1(op$$1));
|
42998 |
|
42999 | case "Label"
|
43000 |
|
43001 | :
|
43002 | return encoder.label(op$$1.op1);
|
43003 |
|
43004 | case "StartLabels"
|
43005 |
|
43006 | :
|
43007 | return encoder.startLabels();
|
43008 |
|
43009 | case "StopLabels"
|
43010 |
|
43011 | :
|
43012 | return encoder.stopLabels();
|
43013 |
|
43014 | case "JitCompileBlock"
|
43015 |
|
43016 | :
|
43017 | return concat(context, jitCompileBlock(mode));
|
43018 |
|
43019 | case "GetComponentLayout"
|
43020 |
|
43021 | :
|
43022 | return encoder.push(constants, compileLayoutOpcode(mode), op$$1.op1);
|
43023 |
|
43024 | case "SetBlock"
|
43025 |
|
43026 | :
|
43027 | return encoder.push(constants, setBlock(mode), op$$1.op1);
|
43028 |
|
43029 | default:
|
43030 | return (0, _util.exhausted)(op$$1);
|
43031 | }
|
43032 | }
|
43033 |
|
43034 | function option$1(op$$1) {
|
43035 | var value = op$$1.op1;
|
43036 | return value === null ? NONE : value;
|
43037 | }
|
43038 |
|
43039 | function compileLayoutOpcode(mode) {
|
43040 | return mode === "aot"
|
43041 |
|
43042 | ? 94
|
43043 |
|
43044 | : 95
|
43045 |
|
43046 | ;
|
43047 | }
|
43048 |
|
43049 | function jitCompileBlock(mode) {
|
43050 | return mode === "jit"
|
43051 |
|
43052 | ? op(61
|
43053 |
|
43054 | ) : NONE;
|
43055 | }
|
43056 |
|
43057 | function setBlock(mode) {
|
43058 | return mode === "aot"
|
43059 |
|
43060 | ? 20
|
43061 |
|
43062 | : 21
|
43063 |
|
43064 | ;
|
43065 | }
|
43066 |
|
43067 | function pushCompileOp(context, action) {
|
43068 | concatStatements(context, compileOp(context, action));
|
43069 | }
|
43070 |
|
43071 | function compileOp(context, action) {
|
43072 | switch (action.op) {
|
43073 | case "CompileBlock"
|
43074 |
|
43075 | :
|
43076 | return CompileBlockOp(context, action);
|
43077 |
|
43078 | case "CompileInline"
|
43079 |
|
43080 | :
|
43081 | return CompileInlineOp(context, action);
|
43082 |
|
43083 | case "InvokeStatic"
|
43084 |
|
43085 | :
|
43086 | return InvokeStatic(context.syntax, action);
|
43087 |
|
43088 | case "Args"
|
43089 |
|
43090 | :
|
43091 | return CompileArgs(action.op1);
|
43092 |
|
43093 | case "PushCompilable"
|
43094 |
|
43095 | :
|
43096 | return PushCompilable(action.op1, context.syntax);
|
43097 |
|
43098 | case "DynamicComponent"
|
43099 |
|
43100 | :
|
43101 | return DynamicComponent(context, action);
|
43102 |
|
43103 | case "IfResolvedComponent"
|
43104 |
|
43105 | :
|
43106 | return IfResolvedComponent(context, action);
|
43107 |
|
43108 | default:
|
43109 | return (0, _util.exhausted)(action);
|
43110 | }
|
43111 | }
|
43112 |
|
43113 | function CompileBlockOp(context, op$$1) {
|
43114 | return compileBlock(op$$1.op1, context);
|
43115 | }
|
43116 |
|
43117 | function CompileInlineOp(context, op$$1) {
|
43118 | var {
|
43119 | inline,
|
43120 | ifUnhandled
|
43121 | } = op$$1.op1;
|
43122 | var returned = compileInline(inline, context);
|
43123 |
|
43124 | if (isHandled(returned)) {
|
43125 | return returned;
|
43126 | } else {
|
43127 | return ifUnhandled(inline);
|
43128 | }
|
43129 | }
|
43130 |
|
43131 | function InvokeStatic(context, action) {
|
43132 | var compilable$$1 = action.op1;
|
43133 |
|
43134 | if (context.program.mode === "aot"
|
43135 |
|
43136 | ) {
|
43137 | var handle = compilable$$1.compile(context);
|
43138 |
|
43139 | if (typeof handle !== 'number') {
|
43140 | return op('Error', {
|
43141 | problem: 'Invalid block',
|
43142 | start: 0,
|
43143 | end: 0
|
43144 | });
|
43145 | }
|
43146 |
|
43147 |
|
43148 |
|
43149 |
|
43150 |
|
43151 | if (handle === PLACEHOLDER_HANDLE) {
|
43152 | return op(3
|
43153 |
|
43154 | , () => compilable$$1.compile(context));
|
43155 | } else {
|
43156 | return op(3
|
43157 |
|
43158 | , handle);
|
43159 | }
|
43160 | } else {
|
43161 | return [op(29
|
43162 |
|
43163 | , other(action.op1)), op(61
|
43164 |
|
43165 | ), op(2
|
43166 |
|
43167 | )];
|
43168 | }
|
43169 | }
|
43170 |
|
43171 | function DynamicComponent(context, action) {
|
43172 | var {
|
43173 | definition,
|
43174 | attrs,
|
43175 | params,
|
43176 | args: args$$1,
|
43177 | blocks,
|
43178 | atNames
|
43179 | } = action.op1;
|
43180 | var attrsBlock = attrs && attrs.length > 0 ? compilableBlock(attrs, context.meta) : null;
|
43181 | var compiled = Array.isArray(blocks) || blocks === null ? namedBlocks(blocks, context.meta) : blocks;
|
43182 | return InvokeDynamicComponent(context.meta, {
|
43183 | definition,
|
43184 | attrs: attrsBlock,
|
43185 | params,
|
43186 | hash: args$$1,
|
43187 | atNames,
|
43188 | blocks: compiled
|
43189 | });
|
43190 | }
|
43191 |
|
43192 | function IfResolvedComponent(context, action) {
|
43193 | var {
|
43194 | name,
|
43195 | attrs,
|
43196 | blocks,
|
43197 | staticTemplate,
|
43198 | dynamicTemplate,
|
43199 | orElse
|
43200 | } = action.op1;
|
43201 | var component = resolveLayoutForTag(name, {
|
43202 | resolver: context.syntax.program.resolverDelegate,
|
43203 | meta: context.meta
|
43204 | });
|
43205 | var {
|
43206 | meta: meta$$1
|
43207 | } = context;
|
43208 |
|
43209 | if (component !== null) {
|
43210 | var {
|
43211 | handle,
|
43212 | capabilities,
|
43213 | compilable: compilable$$1
|
43214 | } = component;
|
43215 | var attrsBlock = compilableBlock(attrs, meta$$1);
|
43216 | var compilableBlocks = namedBlocks(blocks, meta$$1);
|
43217 |
|
43218 | if (compilable$$1 !== null) {
|
43219 | return staticTemplate(handle, capabilities, compilable$$1, {
|
43220 | attrs: attrsBlock,
|
43221 | blocks: compilableBlocks
|
43222 | });
|
43223 | } else {
|
43224 | return dynamicTemplate(handle, capabilities, {
|
43225 | attrs: attrsBlock,
|
43226 | blocks: compilableBlocks
|
43227 | });
|
43228 | }
|
43229 | } else if (orElse) {
|
43230 | return orElse();
|
43231 | } else {
|
43232 | throw new Error(`Compile Error: Cannot find component ${name}`);
|
43233 | }
|
43234 | }
|
43235 |
|
43236 | function PushCompilable(block, context) {
|
43237 | if (block === null) {
|
43238 | return PushPrimitive(null);
|
43239 | } else if (context.program.mode === "aot"
|
43240 |
|
43241 | ) {
|
43242 | var compiled = block.compile(context);
|
43243 |
|
43244 | if (typeof compiled !== 'number') {
|
43245 | return op('Error', {
|
43246 | problem: 'Compile Error (TODO: thread better)',
|
43247 | start: 0,
|
43248 | end: 0
|
43249 | });
|
43250 | }
|
43251 |
|
43252 | return PushPrimitive(compiled);
|
43253 | } else {
|
43254 | return op(29
|
43255 |
|
43256 | , other(block));
|
43257 | }
|
43258 | }
|
43259 |
|
43260 | function pushOp(encoder, constants, op) {
|
43261 | if (op.op3 !== undefined) {
|
43262 | encoder.push(constants, op.op, op.op1, op.op2, op.op3);
|
43263 | } else if (op.op2 !== undefined) {
|
43264 | encoder.push(constants, op.op, op.op1, op.op2);
|
43265 | } else if (op.op1 !== undefined) {
|
43266 | encoder.push(constants, op.op, op.op1);
|
43267 | } else {
|
43268 | encoder.push(constants, op.op);
|
43269 | }
|
43270 | }
|
43271 |
|
43272 | class Compilers {
|
43273 | constructor() {
|
43274 | this.names = {};
|
43275 | this.funcs = [];
|
43276 | }
|
43277 |
|
43278 | add(name, func) {
|
43279 | this.names[name] = this.funcs.push(func) - 1;
|
43280 | }
|
43281 |
|
43282 | compile(sexp, meta) {
|
43283 | var name = sexp[0];
|
43284 | var index = this.names[name];
|
43285 | var func = this.funcs[index];
|
43286 | return func(sexp, meta);
|
43287 | }
|
43288 |
|
43289 | }
|
43290 |
|
43291 | var EXPRESSIONS = new Compilers();
|
43292 | EXPRESSIONS.add(31
|
43293 |
|
43294 | , ([, parts]) => {
|
43295 | var out = [];
|
43296 |
|
43297 | for (var part of parts) {
|
43298 | out.push(op('Expr', part));
|
43299 | }
|
43300 |
|
43301 | out.push(op(28
|
43302 |
|
43303 | , parts.length));
|
43304 | return out;
|
43305 | });
|
43306 | EXPRESSIONS.add(30
|
43307 |
|
43308 | , ([, name, params, hash], meta) => {
|
43309 |
|
43310 | var start = 0;
|
43311 | var offset = 0;
|
43312 |
|
43313 | if (isComponent(name, meta)) {
|
43314 | if (!params || params.length === 0) {
|
43315 | return op('Error', {
|
43316 | problem: 'component helper requires at least one argument',
|
43317 | start: start,
|
43318 | end: start + offset
|
43319 | });
|
43320 | }
|
43321 |
|
43322 | var [definition, ...restArgs] = params;
|
43323 | return curryComponent({
|
43324 | definition,
|
43325 | params: restArgs,
|
43326 | hash,
|
43327 | atNames: false
|
43328 | }, meta.referrer);
|
43329 | }
|
43330 |
|
43331 | var nameOrError = expectString(name, meta, 'Expected call head to be a string');
|
43332 |
|
43333 | if (typeof nameOrError !== 'string') {
|
43334 | return nameOrError;
|
43335 | }
|
43336 |
|
43337 | return op('IfResolved', {
|
43338 | kind: "Helper"
|
43339 |
|
43340 | ,
|
43341 | name: nameOrError,
|
43342 | andThen: handle => Call({
|
43343 | handle,
|
43344 | params,
|
43345 | hash
|
43346 | }),
|
43347 | span: {
|
43348 | start,
|
43349 | end: start + offset
|
43350 | }
|
43351 | });
|
43352 | });
|
43353 |
|
43354 | function isGetContextualFree(opcode) {
|
43355 | return opcode[0] >= 34
|
43356 |
|
43357 | ;
|
43358 | }
|
43359 |
|
43360 | function isComponent(expr, meta) {
|
43361 | if (!Array.isArray(expr)) {
|
43362 | return false;
|
43363 | }
|
43364 |
|
43365 | if (isGetContextualFree(expr)) {
|
43366 | var head = expr[1];
|
43367 |
|
43368 | if (meta.upvars && meta.upvars[head] === 'component') {
|
43369 | return true;
|
43370 | } else {
|
43371 | return false;
|
43372 | }
|
43373 | }
|
43374 |
|
43375 | return false;
|
43376 | }
|
43377 |
|
43378 | EXPRESSIONS.add(32
|
43379 |
|
43380 | , ([, sym, path]) => withPath(op(22
|
43381 |
|
43382 | , sym), path));
|
43383 | EXPRESSIONS.add(33
|
43384 |
|
43385 | , ([, sym, path]) => withPath(op('ResolveFree', sym), path));
|
43386 | EXPRESSIONS.add(34
|
43387 |
|
43388 | , ([, sym, path]) => withPath(op('ResolveContextualFree', {
|
43389 | freeVar: sym,
|
43390 | context: 0
|
43391 |
|
43392 |
|
43393 | }), path));
|
43394 | EXPRESSIONS.add(35
|
43395 |
|
43396 | , ([, sym, path]) => withPath(op('ResolveContextualFree', {
|
43397 | freeVar: sym,
|
43398 | context: 1
|
43399 |
|
43400 |
|
43401 | }), path));
|
43402 | EXPRESSIONS.add(36
|
43403 |
|
43404 | , ([, sym, path]) => withPath(op('ResolveContextualFree', {
|
43405 | freeVar: sym,
|
43406 | context: 2
|
43407 |
|
43408 |
|
43409 | }), path));
|
43410 | EXPRESSIONS.add(37
|
43411 |
|
43412 | , ([, sym, path]) => withPath(op('ResolveContextualFree', {
|
43413 | freeVar: sym,
|
43414 | context: 3
|
43415 |
|
43416 |
|
43417 | }), path));
|
43418 | EXPRESSIONS.add(38
|
43419 |
|
43420 | , ([, sym, path]) => withPath(op('ResolveContextualFree', {
|
43421 | freeVar: sym,
|
43422 | context: 4
|
43423 |
|
43424 |
|
43425 | }), path));
|
43426 | EXPRESSIONS.add(39
|
43427 |
|
43428 | , ([, sym, path]) => withPath(op('ResolveContextualFree', {
|
43429 | freeVar: sym,
|
43430 | context: 5
|
43431 |
|
43432 |
|
43433 | }), path));
|
43434 |
|
43435 | function withPath(expr, path) {
|
43436 | if (path === undefined || path.length === 0) return expr;
|
43437 | if (!Array.isArray(expr)) expr = [expr];
|
43438 |
|
43439 | for (var i = 0; i < path.length; i++) {
|
43440 | expr.push(op(23
|
43441 |
|
43442 | , path[i]));
|
43443 | }
|
43444 |
|
43445 | return expr;
|
43446 | }
|
43447 |
|
43448 | EXPRESSIONS.add(29
|
43449 |
|
43450 | , () => PushPrimitiveReference(undefined));
|
43451 | EXPRESSIONS.add(27
|
43452 |
|
43453 | , ([, block]) => {
|
43454 | return [op('Expr', block), op(26
|
43455 |
|
43456 | )];
|
43457 | });
|
43458 | EXPRESSIONS.add(28
|
43459 |
|
43460 | , ([, block]) => [op('Expr', block), op(25
|
43461 |
|
43462 | ), op('JitCompileBlock'), op(27
|
43463 |
|
43464 | )]);
|
43465 |
|
43466 | function pushResolutionOp(encoder, context, operation, constants) {
|
43467 | switch (operation.op) {
|
43468 | case "SimpleArgs"
|
43469 |
|
43470 | :
|
43471 | concatExpressions(encoder, context, compileSimpleArgs(operation.op1.params, operation.op1.hash, operation.op1.atNames), constants);
|
43472 | break;
|
43473 |
|
43474 | case "Expr"
|
43475 |
|
43476 | :
|
43477 | concatExpressions(encoder, context, expr(operation.op1, context.meta), constants);
|
43478 | break;
|
43479 |
|
43480 | case "IfResolved"
|
43481 |
|
43482 | :
|
43483 | {
|
43484 | concatExpressions(encoder, context, ifResolved(context, operation), constants);
|
43485 | break;
|
43486 | }
|
43487 |
|
43488 | case "ResolveFree"
|
43489 |
|
43490 | :
|
43491 | {
|
43492 | throw new Error('Unimplemented HighLevelResolutionOpcode.ResolveFree');
|
43493 | }
|
43494 |
|
43495 | case "ResolveContextualFree"
|
43496 |
|
43497 | :
|
43498 | {
|
43499 | var {
|
43500 | freeVar,
|
43501 | context: expressionContext
|
43502 | } = operation.op1;
|
43503 |
|
43504 | if (context.meta.asPartial) {
|
43505 | var name = context.meta.upvars[freeVar];
|
43506 | concatExpressions(encoder, context, [op(105
|
43507 |
|
43508 | , name)], constants);
|
43509 | break;
|
43510 | }
|
43511 |
|
43512 | switch (expressionContext) {
|
43513 | case 1
|
43514 |
|
43515 | :
|
43516 | {
|
43517 |
|
43518 | var _name2 = context.meta.upvars[freeVar];
|
43519 | concatExpressions(encoder, context, [op(22
|
43520 |
|
43521 | , 0), op(23
|
43522 |
|
43523 | , _name2)], constants);
|
43524 | break;
|
43525 | }
|
43526 |
|
43527 | case 0
|
43528 |
|
43529 | :
|
43530 | {
|
43531 | var resolver = context.syntax.program.resolverDelegate;
|
43532 | var _name3 = context.meta.upvars[freeVar];
|
43533 | var resolvedHelper = resolver.lookupHelper(_name3, context.meta.referrer);
|
43534 | var expressions;
|
43535 |
|
43536 | if (resolvedHelper) {
|
43537 | expressions = Call({
|
43538 | handle: resolvedHelper,
|
43539 | params: null,
|
43540 | hash: null
|
43541 | });
|
43542 | } else {
|
43543 |
|
43544 | expressions = [op(22
|
43545 |
|
43546 | , 0), op(23
|
43547 |
|
43548 | , _name3)];
|
43549 | }
|
43550 |
|
43551 | concatExpressions(encoder, context, expressions, constants);
|
43552 | break;
|
43553 | }
|
43554 |
|
43555 | default:
|
43556 | throw new Error(`unimplemented: Can't evaluate expression in context ${expressionContext}`);
|
43557 | }
|
43558 |
|
43559 | break;
|
43560 | }
|
43561 |
|
43562 | default:
|
43563 | return (0, _util.exhausted)(operation);
|
43564 | }
|
43565 | }
|
43566 |
|
43567 | function expr(expression$$1, meta$$1) {
|
43568 | if (Array.isArray(expression$$1)) {
|
43569 | return EXPRESSIONS.compile(expression$$1, meta$$1);
|
43570 | } else {
|
43571 | return [PushPrimitive(expression$$1), op(31
|
43572 |
|
43573 | )];
|
43574 | }
|
43575 | }
|
43576 |
|
43577 | function compileSimpleArgs(params, hash, atNames) {
|
43578 | var out = [];
|
43579 | var {
|
43580 | count,
|
43581 | actions
|
43582 | } = CompilePositional(params);
|
43583 | out.push(actions);
|
43584 | var flags = count << 4;
|
43585 | if (atNames) flags |= 0b1000;
|
43586 | var names = _util.EMPTY_ARRAY;
|
43587 |
|
43588 | if (hash) {
|
43589 | names = hash[0];
|
43590 | var val = hash[1];
|
43591 |
|
43592 | for (var i = 0; i < val.length; i++) {
|
43593 | out.push(op('Expr', val[i]));
|
43594 | }
|
43595 | }
|
43596 |
|
43597 | out.push(op(84
|
43598 |
|
43599 | , strArray(names), strArray(_util.EMPTY_ARRAY), flags));
|
43600 | return out;
|
43601 | }
|
43602 |
|
43603 | function ifResolved(context, {
|
43604 | op1
|
43605 | }) {
|
43606 | var {
|
43607 | kind,
|
43608 | name,
|
43609 | andThen,
|
43610 | orElse,
|
43611 | span
|
43612 | } = op1;
|
43613 | var resolved = resolve(context.syntax.program.resolverDelegate, kind, name, context.meta.referrer);
|
43614 |
|
43615 | if (resolved !== null) {
|
43616 | return andThen(resolved);
|
43617 | } else if (orElse) {
|
43618 | return orElse();
|
43619 | } else {
|
43620 | return error(`Unexpected ${kind} ${name}`, span.start, span.end);
|
43621 | }
|
43622 | }
|
43623 |
|
43624 | function resolve(resolver, kind, name, referrer) {
|
43625 | switch (kind) {
|
43626 | case "Modifier"
|
43627 |
|
43628 | :
|
43629 | return resolver.lookupModifier(name, referrer);
|
43630 |
|
43631 | case "Helper"
|
43632 |
|
43633 | :
|
43634 | return resolver.lookupHelper(name, referrer);
|
43635 |
|
43636 | case "ComponentDefinition"
|
43637 |
|
43638 | :
|
43639 | {
|
43640 | var component = resolver.lookupComponent(name, referrer);
|
43641 | return component && component.handle;
|
43642 | }
|
43643 | }
|
43644 | }
|
43645 |
|
43646 | var NONE = {
|
43647 | 'no-action': true
|
43648 | };
|
43649 | _exports.NONE = NONE;
|
43650 | var UNHANDLED = {
|
43651 | 'not-handled': true
|
43652 | };
|
43653 | _exports.UNHANDLED = UNHANDLED;
|
43654 |
|
43655 | function isNoAction(actions) {
|
43656 | return actions && !!actions['no-action'];
|
43657 | }
|
43658 |
|
43659 | function isHandled(actions) {
|
43660 | return !actions || !actions['not-handled'];
|
43661 | }
|
43662 |
|
43663 | function concat(context, action) {
|
43664 | if (isNoAction(action)) {
|
43665 | return;
|
43666 | } else if (Array.isArray(action)) {
|
43667 | for (var item of action) {
|
43668 | concat(context, item);
|
43669 | }
|
43670 | } else if (action.type === 'Simple') {
|
43671 | pushBuilderOp(context, action);
|
43672 | } else {
|
43673 | pushOp(context.encoder, context.syntax.program.constants, action);
|
43674 | }
|
43675 | }
|
43676 |
|
43677 | function concatExpressions(encoder, context, action, constants) {
|
43678 | if (isNoAction(action)) {
|
43679 | return;
|
43680 | } else if (Array.isArray(action)) {
|
43681 | for (var item of action) {
|
43682 | concatExpressions(encoder, context, item, constants);
|
43683 | }
|
43684 | } else if (action.type === 'Number') {
|
43685 | pushOp(encoder, constants, action);
|
43686 | } else if (action.type === 'Resolution') {
|
43687 | pushResolutionOp(encoder, context, action, constants);
|
43688 | } else if (action.type === 'Simple') {
|
43689 | pushBuilderOp(context, action);
|
43690 | } else if (action.type === 'Error') {
|
43691 | encoder.error({
|
43692 | problem: action.op1.problem,
|
43693 | span: {
|
43694 | start: action.op1.start,
|
43695 | end: action.op1.end
|
43696 | }
|
43697 | });
|
43698 | } else {
|
43699 | throw (0, _util.assertNever)(action, 'unexpected action kind');
|
43700 | }
|
43701 | }
|
43702 |
|
43703 | function concatStatements(context, action) {
|
43704 | if (isNoAction(action)) {
|
43705 | return;
|
43706 | } else if (Array.isArray(action)) {
|
43707 | for (var item of action) {
|
43708 | concatStatements(context, item);
|
43709 | }
|
43710 | } else if (action.type === 'Number') {
|
43711 | pushOp(context.encoder, context.syntax.program.constants, action);
|
43712 | } else {
|
43713 | if (action.type === 'Compile') {
|
43714 | pushCompileOp(context, action);
|
43715 | } else if (action.type === 'Resolution') {
|
43716 | pushResolutionOp(context.encoder, context, action, context.syntax.program.constants);
|
43717 | } else if (action.type === 'Simple') {
|
43718 | pushBuilderOp(context, action);
|
43719 | } else if (action.type === 'Error') {} else {
|
43720 | throw (0, _util.assertNever)(action, `unexpected action type`);
|
43721 | }
|
43722 | }
|
43723 | }
|
43724 |
|
43725 | function populateBuiltins(blocks, inlines) {
|
43726 | blocks.add('if', (params, _hash, blocks) => {
|
43727 | if (!params || params.length !== 1) {
|
43728 | throw new Error(`SYNTAX ERROR: #if requires a single argument`);
|
43729 | }
|
43730 |
|
43731 | return ReplayableIf({
|
43732 | args() {
|
43733 | return {
|
43734 | count: 1,
|
43735 | actions: [op('Expr', params[0]), op(71
|
43736 |
|
43737 | )]
|
43738 | };
|
43739 | },
|
43740 |
|
43741 | ifTrue() {
|
43742 | return InvokeStaticBlock(blocks.get('default'));
|
43743 | },
|
43744 |
|
43745 | ifFalse() {
|
43746 | if (blocks.has('else')) {
|
43747 | return InvokeStaticBlock(blocks.get('else'));
|
43748 | } else {
|
43749 | return NONE;
|
43750 | }
|
43751 | }
|
43752 |
|
43753 | });
|
43754 | });
|
43755 | blocks.add('unless', (params, _hash, blocks) => {
|
43756 | if (!params || params.length !== 1) {
|
43757 | throw new Error(`SYNTAX ERROR: #unless requires a single argument`);
|
43758 | }
|
43759 |
|
43760 | return ReplayableIf({
|
43761 | args() {
|
43762 | return {
|
43763 | count: 1,
|
43764 | actions: [op('Expr', params[0]), op(71
|
43765 |
|
43766 | )]
|
43767 | };
|
43768 | },
|
43769 |
|
43770 | ifTrue() {
|
43771 | if (blocks.has('else')) {
|
43772 | return InvokeStaticBlock(blocks.get('else'));
|
43773 | } else {
|
43774 | return NONE;
|
43775 | }
|
43776 | },
|
43777 |
|
43778 | ifFalse() {
|
43779 | return InvokeStaticBlock(blocks.get('default'));
|
43780 | }
|
43781 |
|
43782 | });
|
43783 | });
|
43784 | blocks.add('with', (params, _hash, blocks) => {
|
43785 | if (!params || params.length !== 1) {
|
43786 | throw new Error(`SYNTAX ERROR: #with requires a single argument`);
|
43787 | }
|
43788 |
|
43789 | return ReplayableIf({
|
43790 | args() {
|
43791 | return {
|
43792 | count: 2,
|
43793 | actions: [op('Expr', params[0]), op(33
|
43794 |
|
43795 | , _vm.$sp, 0), op(71
|
43796 |
|
43797 | )]
|
43798 | };
|
43799 | },
|
43800 |
|
43801 | ifTrue() {
|
43802 | return InvokeStaticBlockWithStack(blocks.get('default'), 1);
|
43803 | },
|
43804 |
|
43805 | ifFalse() {
|
43806 | if (blocks.has('else')) {
|
43807 | return InvokeStaticBlock(blocks.get('else'));
|
43808 | } else {
|
43809 | return NONE;
|
43810 | }
|
43811 | }
|
43812 |
|
43813 | });
|
43814 | });
|
43815 | blocks.add('let', (params, _hash, blocks) => {
|
43816 | if (!params) {
|
43817 | return error('let requires arguments', 0, 0);
|
43818 | }
|
43819 |
|
43820 | var {
|
43821 | count,
|
43822 | actions
|
43823 | } = CompilePositional(params);
|
43824 | return [actions, InvokeStaticBlockWithStack(blocks.get('default'), count)];
|
43825 | });
|
43826 | blocks.add('each', (params, hash, blocks) => {
|
43827 | return Replayable({
|
43828 | args() {
|
43829 | var actions;
|
43830 |
|
43831 | if (hash && hash[0][0] === 'key') {
|
43832 | actions = [op('Expr', hash[1][0])];
|
43833 | } else {
|
43834 | actions = [PushPrimitiveReference(null)];
|
43835 | }
|
43836 |
|
43837 | actions.push(op('Expr', params[0]));
|
43838 | return {
|
43839 | count: 2,
|
43840 | actions
|
43841 | };
|
43842 | },
|
43843 |
|
43844 | body() {
|
43845 | var out = [op(74
|
43846 |
|
43847 | ), op(66
|
43848 |
|
43849 | , label('ELSE')), op(0
|
43850 |
|
43851 | ), op(33
|
43852 |
|
43853 | , _vm.$fp, 1), op(6
|
43854 |
|
43855 | , label('ITER')), op(72
|
43856 |
|
43857 | , label('BODY')), op('Label', 'ITER'), op(75
|
43858 |
|
43859 | , label('BREAK')), op('Label', 'BODY'), InvokeStaticBlockWithStack(blocks.get('default'), 2), op(34
|
43860 |
|
43861 | , 2), op(4
|
43862 |
|
43863 | , label('FINALLY')), op('Label', 'BREAK'), op(73
|
43864 |
|
43865 | ), op(1
|
43866 |
|
43867 | ), op(4
|
43868 |
|
43869 | , label('FINALLY')), op('Label', 'ELSE')];
|
43870 |
|
43871 | if (blocks.has('else')) {
|
43872 | out.push(InvokeStaticBlock(blocks.get('else')));
|
43873 | }
|
43874 |
|
43875 | return out;
|
43876 | }
|
43877 |
|
43878 | });
|
43879 | });
|
43880 | blocks.add('in-element', (params, hash, blocks) => {
|
43881 | if (!params || params.length !== 1) {
|
43882 | throw new Error(`SYNTAX ERROR: #in-element requires a single argument`);
|
43883 | }
|
43884 |
|
43885 | return ReplayableIf({
|
43886 | args() {
|
43887 | var [keys, values] = hash;
|
43888 | var actions = [];
|
43889 |
|
43890 | for (var i = 0; i < keys.length; i++) {
|
43891 | var key = keys[i];
|
43892 |
|
43893 | if (key === 'guid' || key === 'insertBefore') {
|
43894 | actions.push(op('Expr', values[i]));
|
43895 | } else {
|
43896 | throw new Error(`SYNTAX ERROR: #in-element does not take a \`${keys[0]}\` option`);
|
43897 | }
|
43898 | }
|
43899 |
|
43900 | actions.push(op('Expr', params[0]), op(33
|
43901 |
|
43902 | , _vm.$sp, 0));
|
43903 | return {
|
43904 | count: 4,
|
43905 | actions
|
43906 | };
|
43907 | },
|
43908 |
|
43909 | ifTrue() {
|
43910 | return [op(50
|
43911 |
|
43912 | ), InvokeStaticBlock(blocks.get('default')), op(56
|
43913 |
|
43914 | )];
|
43915 | }
|
43916 |
|
43917 | });
|
43918 | });
|
43919 | blocks.add('-with-dynamic-vars', (_params, hash, blocks) => {
|
43920 | if (hash) {
|
43921 | var [names, expressions] = hash;
|
43922 | var {
|
43923 | actions
|
43924 | } = CompilePositional(expressions);
|
43925 | return [actions, DynamicScope(names, () => {
|
43926 | return InvokeStaticBlock(blocks.get('default'));
|
43927 | })];
|
43928 | } else {
|
43929 | return InvokeStaticBlock(blocks.get('default'));
|
43930 | }
|
43931 | });
|
43932 | blocks.add('component', (_params, hash, blocks, context) => {
|
43933 | var tag = _params[0];
|
43934 |
|
43935 | if (typeof tag === 'string') {
|
43936 | var returned = StaticComponentHelper(context, _params[0], hash, blocks.get('default'));
|
43937 | if (isHandled(returned)) return returned;
|
43938 | }
|
43939 |
|
43940 | var [definition, ...params] = _params;
|
43941 | return op('DynamicComponent', {
|
43942 | definition,
|
43943 | attrs: null,
|
43944 | params,
|
43945 | args: hash,
|
43946 | atNames: false,
|
43947 | blocks
|
43948 | });
|
43949 | });
|
43950 | inlines.add('component', (_name, _params, hash, context) => {
|
43951 | var tag = _params && _params[0];
|
43952 |
|
43953 | if (typeof tag === 'string') {
|
43954 | var returned = StaticComponentHelper(context, tag, hash, null);
|
43955 | if (returned !== UNHANDLED) return returned;
|
43956 | }
|
43957 |
|
43958 | var [definition, ...params] = _params;
|
43959 | return InvokeDynamicComponent(context.meta, {
|
43960 | definition,
|
43961 | attrs: null,
|
43962 | params,
|
43963 | hash,
|
43964 | atNames: false,
|
43965 | blocks: EMPTY_BLOCKS
|
43966 | });
|
43967 | });
|
43968 | return {
|
43969 | blocks,
|
43970 | inlines
|
43971 | };
|
43972 | }
|
43973 |
|
43974 | class MacrosImpl {
|
43975 | constructor() {
|
43976 | var {
|
43977 | blocks,
|
43978 | inlines
|
43979 | } = populateBuiltins(new Blocks(), new Inlines());
|
43980 | this.blocks = blocks;
|
43981 | this.inlines = inlines;
|
43982 | }
|
43983 |
|
43984 | }
|
43985 |
|
43986 | _exports.MacrosImpl = MacrosImpl;
|
43987 |
|
43988 | class Blocks {
|
43989 | constructor() {
|
43990 | this.names = (0, _util.dict)();
|
43991 | this.funcs = [];
|
43992 | }
|
43993 |
|
43994 | add(name, func) {
|
43995 | this.funcs.push(func);
|
43996 | this.names[name] = this.funcs.length - 1;
|
43997 | }
|
43998 |
|
43999 | addMissing(func) {
|
44000 | this.missing = func;
|
44001 | }
|
44002 |
|
44003 | compile(name, params, hash, blocks, context) {
|
44004 | var index = this.names[name];
|
44005 | var macroContext = {
|
44006 | resolver: context.syntax.program.resolverDelegate,
|
44007 | meta: context.meta
|
44008 | };
|
44009 |
|
44010 | if (index === undefined) {
|
44011 | var func = this.missing;
|
44012 | var handled = func(name, params, hash, blocks, macroContext);
|
44013 | return handled;
|
44014 | } else {
|
44015 | var _func = this.funcs[index];
|
44016 | return _func(params, hash, blocks, macroContext);
|
44017 | }
|
44018 | }
|
44019 |
|
44020 | }
|
44021 |
|
44022 | class Inlines {
|
44023 | constructor() {
|
44024 | this.names = (0, _util.dict)();
|
44025 | this.funcs = [];
|
44026 | }
|
44027 |
|
44028 | add(name, func) {
|
44029 | this.funcs.push(func);
|
44030 | this.names[name] = this.funcs.length - 1;
|
44031 | }
|
44032 |
|
44033 | addMissing(func) {
|
44034 | this.missing = func;
|
44035 | }
|
44036 |
|
44037 | compile(sexp, context) {
|
44038 | var [, value] = sexp;
|
44039 |
|
44040 |
|
44041 |
|
44042 | if (!Array.isArray(value)) return UNHANDLED;
|
44043 | var name;
|
44044 | var params;
|
44045 | var hash;
|
44046 |
|
44047 | if (value[0] === 30
|
44048 |
|
44049 | ) {
|
44050 | var nameOrError = expectString(value[1], context.meta, 'Expected head of call to be a string');
|
44051 |
|
44052 | if (typeof nameOrError !== 'string') {
|
44053 | return nameOrError;
|
44054 | }
|
44055 |
|
44056 | name = nameOrError;
|
44057 | params = value[2];
|
44058 | hash = value[3];
|
44059 | } else if (isGet(value)) {
|
44060 | var pathName = simplePathName(value, context.meta);
|
44061 |
|
44062 | if (pathName === null) {
|
44063 | return UNHANDLED;
|
44064 | }
|
44065 |
|
44066 | name = pathName;
|
44067 | params = null;
|
44068 | hash = null;
|
44069 | } else {
|
44070 | return UNHANDLED;
|
44071 | }
|
44072 |
|
44073 | var index = this.names[name];
|
44074 | var macroContext = {
|
44075 | resolver: context.syntax.program.resolverDelegate,
|
44076 | meta: context.meta
|
44077 | };
|
44078 |
|
44079 | if (index === undefined && this.missing) {
|
44080 | var func = this.missing;
|
44081 | return func(name, params, hash, macroContext);
|
44082 | } else if (index !== undefined) {
|
44083 | var _func2 = this.funcs[index];
|
44084 | return _func2(name, params, hash, macroContext);
|
44085 | } else {
|
44086 | return UNHANDLED;
|
44087 | }
|
44088 | }
|
44089 |
|
44090 | }
|
44091 |
|
44092 | function syntaxCompilationContext(program, macros) {
|
44093 | return {
|
44094 | program,
|
44095 | macros
|
44096 | };
|
44097 | }
|
44098 |
|
44099 | function Context(resolver = {}, mode = "aot"
|
44100 | /* aot */
|
44101 | , macros = new MacrosImpl()) {
|
44102 | return {
|
44103 | program: new ProgramCompilationContext(new DefaultCompileTimeResolverDelegate(resolver), mode),
|
44104 | macros
|
44105 | };
|
44106 | }
|
44107 |
|
44108 | function JitContext(resolver = {}, macros = new MacrosImpl()) {
|
44109 | return {
|
44110 | program: new JitProgramCompilationContext(new DefaultCompileTimeResolverDelegate(resolver)),
|
44111 | macros
|
44112 | };
|
44113 | }
|
44114 |
|
44115 | function AotContext(resolver = {}, macros = new MacrosImpl()) {
|
44116 | return {
|
44117 | program: new ProgramCompilationContext(new DefaultCompileTimeResolverDelegate(resolver), "aot"
|
44118 |
|
44119 | ),
|
44120 | macros
|
44121 | };
|
44122 | }
|
44123 |
|
44124 | function templateCompilationContext(syntax, meta) {
|
44125 | var encoder = new EncoderImpl();
|
44126 | return {
|
44127 | syntax,
|
44128 | encoder,
|
44129 | meta
|
44130 | };
|
44131 | }
|
44132 |
|
44133 | var STATEMENTS = new Compilers();
|
44134 | var INFLATE_ATTR_TABLE = ['class', 'id', 'value', 'name', 'type', 'style', 'href'];
|
44135 | var INFLATE_TAG_TABLE = ['div', 'span', 'p', 'a'];
|
44136 |
|
44137 | function inflateTagName(tagName) {
|
44138 | return typeof tagName === 'string' ? tagName : INFLATE_TAG_TABLE[tagName];
|
44139 | }
|
44140 |
|
44141 | function inflateAttrName(attrName) {
|
44142 | return typeof attrName === 'string' ? attrName : INFLATE_ATTR_TABLE[attrName];
|
44143 | }
|
44144 |
|
44145 | STATEMENTS.add(3
|
44146 |
|
44147 | , sexp => op(42
|
44148 |
|
44149 | , sexp[1]));
|
44150 | STATEMENTS.add(13
|
44151 |
|
44152 | , () => op(55
|
44153 |
|
44154 | ));
|
44155 | STATEMENTS.add(12
|
44156 |
|
44157 | , () => op(54
|
44158 |
|
44159 | ));
|
44160 | STATEMENTS.add(4
|
44161 |
|
44162 | , (sexp, meta) => {
|
44163 | var [, name, params, hash] = sexp;
|
44164 | var stringName = expectString(name, meta, 'Expected modifier head to be a string');
|
44165 |
|
44166 | if (typeof stringName !== 'string') {
|
44167 | return stringName;
|
44168 | }
|
44169 |
|
44170 | return op('IfResolved', {
|
44171 | kind: "Modifier"
|
44172 |
|
44173 | ,
|
44174 | name: stringName,
|
44175 | andThen: handle => [op(0
|
44176 |
|
44177 | ), op('SimpleArgs', {
|
44178 | params,
|
44179 | hash,
|
44180 | atNames: false
|
44181 | }), op(57
|
44182 |
|
44183 | , handle), op(1
|
44184 |
|
44185 | )],
|
44186 | span: {
|
44187 | start: 0,
|
44188 | end: 0
|
44189 | }
|
44190 | });
|
44191 | });
|
44192 | STATEMENTS.add(14
|
44193 |
|
44194 | , ([, name, value, namespace]) => op(51
|
44195 |
|
44196 | , inflateAttrName(name), value, namespace !== null && namespace !== void 0 ? namespace : null));
|
44197 | STATEMENTS.add(24
|
44198 |
|
44199 | , ([, name, value, namespace]) => op(108
|
44200 |
|
44201 | , inflateAttrName(name), value, namespace !== null && namespace !== void 0 ? namespace : null));
|
44202 | STATEMENTS.add(15
|
44203 |
|
44204 | , ([, name, value, namespace]) => [op('Expr', value), op(52
|
44205 |
|
44206 | , inflateAttrName(name), false, namespace !== null && namespace !== void 0 ? namespace : null)]);
|
44207 | STATEMENTS.add(22
|
44208 |
|
44209 | , ([, name, value, namespace]) => [op('Expr', value), op(52
|
44210 |
|
44211 | , inflateAttrName(name), true, namespace !== null && namespace !== void 0 ? namespace : null)]);
|
44212 | STATEMENTS.add(16
|
44213 |
|
44214 | , ([, name, value, namespace]) => [op('Expr', value), op(53
|
44215 |
|
44216 | , inflateAttrName(name), false, namespace !== null && namespace !== void 0 ? namespace : null)]);
|
44217 | STATEMENTS.add(23
|
44218 |
|
44219 | , ([, name, value, namespace]) => [op('Expr', value), op(53
|
44220 |
|
44221 | , inflateAttrName(name), true, namespace !== null && namespace !== void 0 ? namespace : null)]);
|
44222 | STATEMENTS.add(10
|
44223 |
|
44224 | , ([, tag]) => {
|
44225 | return op(48
|
44226 |
|
44227 | , inflateTagName(tag));
|
44228 | });
|
44229 | STATEMENTS.add(11
|
44230 |
|
44231 | , ([, tag]) => {
|
44232 | return [op(91
|
44233 |
|
44234 | ), op(48
|
44235 |
|
44236 | , inflateTagName(tag))];
|
44237 | });
|
44238 | STATEMENTS.add(8
|
44239 |
|
44240 | , ([, tag, attrs, args$$1, blocks]) => {
|
44241 | if (typeof tag === 'string') {
|
44242 | return op('IfResolvedComponent', {
|
44243 | name: tag,
|
44244 | attrs,
|
44245 | blocks,
|
44246 | staticTemplate: (layoutHandle, capabilities, template, {
|
44247 | blocks,
|
44248 | attrs
|
44249 | }) => {
|
44250 | return [op(80
|
44251 |
|
44252 | , layoutHandle), InvokeStaticComponent({
|
44253 | capabilities,
|
44254 | layout: template,
|
44255 | attrs,
|
44256 | params: null,
|
44257 | hash: args$$1,
|
44258 | blocks
|
44259 | })];
|
44260 | },
|
44261 | dynamicTemplate: (layoutHandle, capabilities, {
|
44262 | attrs,
|
44263 | blocks
|
44264 | }) => {
|
44265 | return [op(80
|
44266 |
|
44267 | , layoutHandle), InvokeComponent({
|
44268 | capabilities,
|
44269 | attrs,
|
44270 | params: null,
|
44271 | hash: args$$1,
|
44272 | atNames: true,
|
44273 | blocks
|
44274 | })];
|
44275 | }
|
44276 | });
|
44277 | } else {
|
44278 | return op('DynamicComponent', {
|
44279 | definition: tag,
|
44280 | attrs,
|
44281 | params: null,
|
44282 | args: args$$1,
|
44283 | blocks,
|
44284 | atNames: true
|
44285 | });
|
44286 | }
|
44287 | });
|
44288 | STATEMENTS.add(19
|
44289 |
|
44290 | , ([, name, evalInfo], meta) => ReplayableIf({
|
44291 | args() {
|
44292 | return {
|
44293 | count: 2,
|
44294 | actions: [op('Expr', name), op(33
|
44295 |
|
44296 | , _vm.$sp, 0)]
|
44297 | };
|
44298 | },
|
44299 |
|
44300 | ifTrue() {
|
44301 | return [op(104
|
44302 |
|
44303 | , templateMeta(meta.referrer), strArray(meta.evalSymbols), arr(evalInfo)), op(40
|
44304 |
|
44305 | ), op(1
|
44306 |
|
44307 | )];
|
44308 | }
|
44309 |
|
44310 | }));
|
44311 | STATEMENTS.add(18
|
44312 |
|
44313 | , ([, to, params]) => YieldBlock(to, params));
|
44314 | STATEMENTS.add(17
|
44315 |
|
44316 | , ([, to]) => YieldBlock(to, _util.EMPTY_ARRAY));
|
44317 | STATEMENTS.add(26
|
44318 |
|
44319 | , ([, evalInfo], meta) => op(106
|
44320 |
|
44321 | , strArray(meta.evalSymbols), arr(evalInfo)));
|
44322 | STATEMENTS.add(1
|
44323 |
|
44324 | , sexp => {
|
44325 | var [, value] = sexp;
|
44326 | return op('CompileInline', {
|
44327 | inline: sexp,
|
44328 | ifUnhandled: () => [op(0
|
44329 |
|
44330 | ), op("Expr"
|
44331 |
|
44332 | , value), op(3
|
44333 |
|
44334 | , {
|
44335 | type: 'stdlib',
|
44336 | value: 'cautious-append'
|
44337 | }), op(1
|
44338 |
|
44339 | )]
|
44340 | });
|
44341 | });
|
44342 | STATEMENTS.add(2
|
44343 |
|
44344 | , sexp => {
|
44345 | var [, value] = sexp;
|
44346 |
|
44347 | if (typeof value === 'string') {
|
44348 | return op(41
|
44349 |
|
44350 | , value);
|
44351 | }
|
44352 |
|
44353 |
|
44354 |
|
44355 | return [op(0
|
44356 |
|
44357 | ), op("Expr"
|
44358 |
|
44359 | , value), op(3
|
44360 |
|
44361 | , {
|
44362 | type: 'stdlib',
|
44363 | value: 'trusting-append'
|
44364 | }), op(1
|
44365 |
|
44366 | )];
|
44367 | });
|
44368 | STATEMENTS.add(6
|
44369 |
|
44370 | , sexp => {
|
44371 | return op('CompileBlock', sexp);
|
44372 | });
|
44373 | var PLACEHOLDER_HANDLE = -1;
|
44374 |
|
44375 | class CompilableTemplateImpl {
|
44376 | constructor(statements, meta$$1, // Part of CompilableTemplate
|
44377 | symbolTable) {
|
44378 | this.statements = statements;
|
44379 | this.meta = meta$$1;
|
44380 | this.symbolTable = symbolTable;
|
44381 | this.compiled = null;
|
44382 | }
|
44383 |
|
44384 |
|
44385 | compile(context) {
|
44386 | return maybeCompile(this, context);
|
44387 | }
|
44388 |
|
44389 | }
|
44390 |
|
44391 | function compilable(layout) {
|
44392 | var block = layout.block;
|
44393 | return new CompilableTemplateImpl(block.statements, meta(layout), {
|
44394 | symbols: block.symbols,
|
44395 | hasEval: block.hasEval
|
44396 | });
|
44397 | }
|
44398 |
|
44399 | function maybeCompile(compilable, context) {
|
44400 | if (compilable.compiled !== null) return compilable.compiled;
|
44401 | compilable.compiled = PLACEHOLDER_HANDLE;
|
44402 | var {
|
44403 | statements,
|
44404 | meta: meta$$1
|
44405 | } = compilable;
|
44406 | var result = compileStatements(statements, meta$$1, context);
|
44407 | (0, _program.patchStdlibs)(context.program);
|
44408 | compilable.compiled = result;
|
44409 | return result;
|
44410 | }
|
44411 |
|
44412 | function compileStatements(statements, meta$$1, syntaxContext) {
|
44413 | var sCompiler = STATEMENTS;
|
44414 | var context = templateCompilationContext(syntaxContext, meta$$1);
|
44415 |
|
44416 | for (var i = 0; i < statements.length; i++) {
|
44417 | concatStatements(context, sCompiler.compile(statements[i], context.meta));
|
44418 | }
|
44419 |
|
44420 | var handle = context.encoder.commit(syntaxContext.program.heap, meta$$1.size);
|
44421 | return handle;
|
44422 | }
|
44423 |
|
44424 | function compilableBlock(overloadBlock, containing) {
|
44425 | var block = Array.isArray(overloadBlock) ? {
|
44426 | statements: overloadBlock,
|
44427 | parameters: _util.EMPTY_ARRAY
|
44428 | } : overloadBlock;
|
44429 | return new CompilableTemplateImpl(block.statements, containing, {
|
44430 | parameters: block.parameters
|
44431 | });
|
44432 | }
|
44433 |
|
44434 | class NamedBlocksImpl {
|
44435 | constructor(blocks) {
|
44436 | this.blocks = blocks;
|
44437 | this.names = blocks ? Object.keys(blocks) : [];
|
44438 | }
|
44439 |
|
44440 | get(name) {
|
44441 | if (!this.blocks) return null;
|
44442 | return this.blocks[name] || null;
|
44443 | }
|
44444 |
|
44445 | has(name) {
|
44446 | var {
|
44447 | blocks
|
44448 | } = this;
|
44449 | return blocks !== null && name in blocks;
|
44450 | }
|
44451 |
|
44452 | with(name, block) {
|
44453 | var {
|
44454 | blocks
|
44455 | } = this;
|
44456 |
|
44457 | if (blocks) {
|
44458 | return new NamedBlocksImpl((0, _util.assign)({}, blocks, {
|
44459 | [name]: block
|
44460 | }));
|
44461 | } else {
|
44462 | return new NamedBlocksImpl({
|
44463 | [name]: block
|
44464 | });
|
44465 | }
|
44466 | }
|
44467 |
|
44468 | get hasAny() {
|
44469 | return this.blocks !== null;
|
44470 | }
|
44471 |
|
44472 | }
|
44473 |
|
44474 | var EMPTY_BLOCKS = new NamedBlocksImpl(null);
|
44475 | _exports.EMPTY_BLOCKS = EMPTY_BLOCKS;
|
44476 |
|
44477 | function namedBlocks(blocks, meta) {
|
44478 | if (blocks === null) {
|
44479 | return EMPTY_BLOCKS;
|
44480 | }
|
44481 |
|
44482 | var out = (0, _util.dict)();
|
44483 | var [keys, values] = blocks;
|
44484 |
|
44485 | for (var i = 0; i < keys.length; i++) {
|
44486 | out[keys[i]] = compilableBlock(values[i], meta);
|
44487 | }
|
44488 |
|
44489 | return new NamedBlocksImpl(out);
|
44490 | }
|
44491 |
|
44492 | function expectString(expr, meta, desc) {
|
44493 | if (!meta.upvars) {
|
44494 | return error(`${desc}, but there were no free variables in the template`, 0, 0);
|
44495 | }
|
44496 |
|
44497 | if (!Array.isArray(expr)) {
|
44498 | throw new Error(`${desc}, got ${JSON.stringify(expr)}`);
|
44499 | }
|
44500 |
|
44501 | if (isGet(expr)) {
|
44502 | var name = simplePathName(expr, meta);
|
44503 | if (name !== null) return name;
|
44504 | }
|
44505 |
|
44506 | throw new Error(`${desc}, got ${JSON.stringify(expr)}`);
|
44507 | }
|
44508 |
|
44509 | function simplePathName(opcode, meta) {
|
44510 | if (opcode.length === 3 && opcode[2].length > 0) {
|
44511 | return null;
|
44512 | }
|
44513 |
|
44514 | if (isGetFree(opcode)) {
|
44515 | return meta.upvars[opcode[1]];
|
44516 | }
|
44517 |
|
44518 | return null;
|
44519 | }
|
44520 |
|
44521 | function isGet(opcode) {
|
44522 | return opcode.length >= 2 && opcode[0] >= 32
|
44523 |
|
44524 | ;
|
44525 | }
|
44526 |
|
44527 | function isGetFree(opcode) {
|
44528 | return opcode[0] >= 33
|
44529 |
|
44530 | ;
|
44531 | }
|
44532 |
|
44533 | function compileInline(sexp, context) {
|
44534 | return context.syntax.macros.inlines.compile(sexp, context);
|
44535 | }
|
44536 |
|
44537 | function compileBlock(block, context) {
|
44538 | var [, name, params, hash, named] = block;
|
44539 | var blocks = namedBlocks(named, context.meta);
|
44540 | var nameOrError = expectString(name, context.meta, 'Expected block head to be a string');
|
44541 |
|
44542 | if (typeof nameOrError !== 'string') {
|
44543 | return nameOrError;
|
44544 | }
|
44545 |
|
44546 | return context.syntax.macros.blocks.compile(nameOrError, params || [], hash, blocks, context);
|
44547 | }
|
44548 |
|
44549 | function commit(heap, scopeSize, buffer) {
|
44550 | var handle = heap.malloc();
|
44551 |
|
44552 | for (var i = 0; i < buffer.length; i++) {
|
44553 | var value = buffer[i];
|
44554 |
|
44555 | if (typeof value === 'function') {
|
44556 | heap.pushPlaceholder(value);
|
44557 | } else if (typeof value === 'object') {
|
44558 | heap.pushStdlib(value);
|
44559 | } else {
|
44560 | heap.push(value);
|
44561 | }
|
44562 | }
|
44563 |
|
44564 | heap.finishMalloc(handle, scopeSize);
|
44565 | return handle;
|
44566 | }
|
44567 |
|
44568 | var debugCompiler;
|
44569 | _exports.debugCompiler = debugCompiler;
|
44570 |
|
44571 | class LabelsImpl {
|
44572 | constructor() {
|
44573 | this.labels = (0, _util.dict)();
|
44574 | this.targets = [];
|
44575 | }
|
44576 |
|
44577 | label(name, index) {
|
44578 | this.labels[name] = index;
|
44579 | }
|
44580 |
|
44581 | target(at, target) {
|
44582 | this.targets.push({
|
44583 | at,
|
44584 | target
|
44585 | });
|
44586 | }
|
44587 |
|
44588 | patch(encoder) {
|
44589 | var {
|
44590 | targets,
|
44591 | labels
|
44592 | } = this;
|
44593 |
|
44594 | for (var i = 0; i < targets.length; i++) {
|
44595 | var {
|
44596 | at,
|
44597 | target
|
44598 | } = targets[i];
|
44599 | var address = labels[target] - at;
|
44600 | encoder.patch(at, address);
|
44601 | }
|
44602 | }
|
44603 |
|
44604 | }
|
44605 |
|
44606 | function error(problem, start, end) {
|
44607 | return op('Error', {
|
44608 | problem,
|
44609 | start,
|
44610 | end
|
44611 | });
|
44612 | }
|
44613 |
|
44614 | function op(name, op1, op2, op3) {
|
44615 | if (typeof name === 'number') {
|
44616 | if (op3 !== undefined) {
|
44617 | return {
|
44618 | type: 'Number',
|
44619 | op: name,
|
44620 | op1,
|
44621 | op2,
|
44622 | op3
|
44623 | };
|
44624 | } else if (op2 !== undefined) {
|
44625 | return {
|
44626 | type: 'Number',
|
44627 | op: name,
|
44628 | op1,
|
44629 | op2
|
44630 | };
|
44631 | } else if (op1 !== undefined) {
|
44632 | return {
|
44633 | type: 'Number',
|
44634 | op: name,
|
44635 | op1: op1
|
44636 | };
|
44637 | } else {
|
44638 | return {
|
44639 | type: 'Number',
|
44640 | op: name
|
44641 | };
|
44642 | }
|
44643 | } else {
|
44644 | var type;
|
44645 |
|
44646 | if (isCompileOpcode(name)) {
|
44647 | type = 'Compile';
|
44648 | } else if (isResolutionOpcode(name)) {
|
44649 | type = 'Resolution';
|
44650 | } else if (isSimpleOpcode(name)) {
|
44651 | type = 'Simple';
|
44652 | } else if (isErrorOpcode(name)) {
|
44653 | type = 'Error';
|
44654 | } else {
|
44655 | throw new Error(`Exhausted ${name}`);
|
44656 | }
|
44657 |
|
44658 | if (op1 === undefined) {
|
44659 | return {
|
44660 | type,
|
44661 | op: name,
|
44662 | op1: undefined
|
44663 | };
|
44664 | } else {
|
44665 | return {
|
44666 | type,
|
44667 | op: name,
|
44668 | op1
|
44669 | };
|
44670 | }
|
44671 | }
|
44672 | }
|
44673 |
|
44674 | class EncoderImpl {
|
44675 | constructor() {
|
44676 | this.labelsStack = new _util.Stack();
|
44677 | this.encoder = new _encoder.InstructionEncoderImpl([]);
|
44678 | this.errors = [];
|
44679 | }
|
44680 |
|
44681 | error(error) {
|
44682 | this.encoder.encode(30
|
44683 |
|
44684 | , 0);
|
44685 | this.errors.push(error);
|
44686 | }
|
44687 |
|
44688 | commit(heap, size) {
|
44689 | this.encoder.encode(5
|
44690 |
|
44691 | , 1024
|
44692 |
|
44693 | );
|
44694 | var handle = commit(heap, size, this.encoder.buffer);
|
44695 |
|
44696 | if (this.errors.length) {
|
44697 | return {
|
44698 | errors: this.errors,
|
44699 | handle
|
44700 | };
|
44701 | } else {
|
44702 | return handle;
|
44703 | }
|
44704 | }
|
44705 |
|
44706 | push(constants, name, ...args) {
|
44707 | if ((0, _vm.isMachineOp)(name)) {
|
44708 | var operands = args.map((operand, i) => this.operand(constants, operand, i));
|
44709 | return this.encoder.encode(name, 1024
|
44710 |
|
44711 | , ...operands);
|
44712 | } else {
|
44713 | var _operands = args.map((operand, i) => this.operand(constants, operand, i));
|
44714 |
|
44715 | return this.encoder.encode(name, 0, ..._operands);
|
44716 | }
|
44717 | }
|
44718 |
|
44719 | operand(constants, operand, index) {
|
44720 | if (operand && typeof operand === 'object' && operand.type === 'label') {
|
44721 | this.currentLabels.target(this.encoder.size + index, operand.value);
|
44722 | return -1;
|
44723 | }
|
44724 |
|
44725 | return constant(constants, operand);
|
44726 | }
|
44727 |
|
44728 | get currentLabels() {
|
44729 | return this.labelsStack.current;
|
44730 | }
|
44731 |
|
44732 | label(name) {
|
44733 | this.currentLabels.label(name, this.encoder.size);
|
44734 | }
|
44735 |
|
44736 | startLabels() {
|
44737 | this.labelsStack.push(new LabelsImpl());
|
44738 | }
|
44739 |
|
44740 | stopLabels() {
|
44741 | var label = this.labelsStack.pop();
|
44742 | label.patch(this.encoder);
|
44743 | }
|
44744 |
|
44745 | }
|
44746 |
|
44747 | function constant(constants, operand) {
|
44748 | if (typeof operand === 'number' || typeof operand === 'function') {
|
44749 | return operand;
|
44750 | }
|
44751 |
|
44752 | if (typeof operand === 'boolean') {
|
44753 | return operand === true ? 1 : 0;
|
44754 | }
|
44755 |
|
44756 | if (typeof operand === 'string') {
|
44757 | return constants.value(operand);
|
44758 | }
|
44759 |
|
44760 | if (operand === null) {
|
44761 | return 0;
|
44762 | }
|
44763 |
|
44764 | switch (operand.type) {
|
44765 | case 'string-array':
|
44766 | return constants.array(operand.value);
|
44767 |
|
44768 | case 'serializable':
|
44769 | return constants.serializable(operand.value);
|
44770 |
|
44771 | case 'stdlib':
|
44772 | return operand;
|
44773 |
|
44774 | case 'immediate':
|
44775 | return (0, _util.encodeImmediate)(operand.value);
|
44776 |
|
44777 | case 'primitive':
|
44778 | case 'template-meta':
|
44779 | case 'array':
|
44780 | case 'other':
|
44781 | return (0, _util.encodeHandle)(constants.value(operand.value));
|
44782 |
|
44783 | case 'lookup':
|
44784 | throw (0, _util.unreachable)('lookup not reachable');
|
44785 |
|
44786 | default:
|
44787 | return (0, _util.exhausted)(operand);
|
44788 | }
|
44789 | }
|
44790 |
|
44791 | function isSimpleOpcode(op) {
|
44792 | return op === 'Label' || op === 'Option' || op === 'GetComponentLayout' || op === 'StartLabels' || op === 'StopLabels' || op === 'SimpleArgs' || op === 'JitCompileBlock' || op === 'SetBlock';
|
44793 | }
|
44794 |
|
44795 | function isCompileOpcode(op) {
|
44796 | return op === 'CompileInline' || op === 'CompileBlock' || op === 'InvokeStatic' || op === 'PushCompilable' || op === 'Args' || op === 'IfResolvedComponent' || op === 'DynamicComponent';
|
44797 | }
|
44798 |
|
44799 | function isResolutionOpcode(op) {
|
44800 | return op === 'IfResolved' || op === 'Expr' || op === 'SimpleArgs' || op === 'ResolveFree' || op === 'ResolveContextualFree';
|
44801 | }
|
44802 |
|
44803 | function isErrorOpcode(op) {
|
44804 | return op === 'Error';
|
44805 | }
|
44806 | |
44807 |
|
44808 |
|
44809 |
|
44810 |
|
44811 |
|
44812 |
|
44813 |
|
44814 |
|
44815 |
|
44816 | function CompileArgs({
|
44817 | params,
|
44818 | hash,
|
44819 | blocks,
|
44820 | atNames
|
44821 | }) {
|
44822 | var out = [];
|
44823 | var blockNames = blocks.names;
|
44824 |
|
44825 | for (var i = 0; i < blockNames.length; i++) {
|
44826 | out.push(PushYieldableBlock(blocks.get(blockNames[i])));
|
44827 | }
|
44828 |
|
44829 | var {
|
44830 | count,
|
44831 | actions
|
44832 | } = CompilePositional(params);
|
44833 | out.push(actions);
|
44834 | var flags = count << 4;
|
44835 | if (atNames) flags |= 0b1000;
|
44836 |
|
44837 | if (blocks) {
|
44838 | flags |= 0b111;
|
44839 | }
|
44840 |
|
44841 | var names = _util.EMPTY_ARRAY;
|
44842 |
|
44843 | if (hash) {
|
44844 | names = hash[0];
|
44845 | var val = hash[1];
|
44846 |
|
44847 | for (var _i = 0; _i < val.length; _i++) {
|
44848 | out.push(op('Expr', val[_i]));
|
44849 | }
|
44850 | }
|
44851 |
|
44852 | out.push(op(84
|
44853 |
|
44854 | , strArray(names), strArray(blockNames), flags));
|
44855 | return out;
|
44856 | }
|
44857 | |
44858 |
|
44859 |
|
44860 |
|
44861 |
|
44862 |
|
44863 |
|
44864 |
|
44865 | function CompilePositional(params) {
|
44866 | if (!params) return {
|
44867 | count: 0,
|
44868 | actions: NONE
|
44869 | };
|
44870 | var actions = [];
|
44871 |
|
44872 | for (var i = 0; i < params.length; i++) {
|
44873 | actions.push(op('Expr', params[i]));
|
44874 | }
|
44875 |
|
44876 | return {
|
44877 | count: params.length,
|
44878 | actions
|
44879 | };
|
44880 | }
|
44881 |
|
44882 | function meta(layout) {
|
44883 | return {
|
44884 | asPartial: layout.asPartial || false,
|
44885 | evalSymbols: evalSymbols(layout),
|
44886 | upvars: layout.block.upvars,
|
44887 | referrer: layout.referrer,
|
44888 | size: layout.block.symbols.length
|
44889 | };
|
44890 | }
|
44891 |
|
44892 | function evalSymbols(layout) {
|
44893 | var {
|
44894 | block
|
44895 | } = layout;
|
44896 | return block.hasEval ? block.symbols : null;
|
44897 | }
|
44898 |
|
44899 | var ATTRS_BLOCK = '&attrs';
|
44900 |
|
44901 | function StaticComponentHelper(context, tag, hash, template) {
|
44902 | var component = resolveLayoutForTag(tag, context);
|
44903 |
|
44904 | if (component !== null) {
|
44905 | var {
|
44906 | compilable: compilable$$1,
|
44907 | handle,
|
44908 | capabilities
|
44909 | } = component;
|
44910 |
|
44911 | if (compilable$$1) {
|
44912 | if (hash) {
|
44913 | for (var i = 0; i < hash.length; i = i + 2) {
|
44914 | hash[i][0] = `@${hash[i][0]}`;
|
44915 | }
|
44916 | }
|
44917 |
|
44918 | var out = [op(80
|
44919 |
|
44920 | , handle)];
|
44921 | out.push(InvokeStaticComponent({
|
44922 | capabilities,
|
44923 | layout: compilable$$1,
|
44924 | attrs: null,
|
44925 | params: null,
|
44926 | hash,
|
44927 | blocks: new NamedBlocksImpl({
|
44928 | default: template
|
44929 | })
|
44930 | }));
|
44931 | return out;
|
44932 | }
|
44933 | }
|
44934 |
|
44935 | return UNHANDLED;
|
44936 | }
|
44937 |
|
44938 | function InvokeStaticComponent({
|
44939 | capabilities,
|
44940 | layout,
|
44941 | attrs,
|
44942 | params,
|
44943 | hash,
|
44944 | blocks
|
44945 | }) {
|
44946 | var {
|
44947 | symbolTable
|
44948 | } = layout;
|
44949 | var bailOut = symbolTable.hasEval || capabilities.prepareArgs;
|
44950 |
|
44951 | if (bailOut) {
|
44952 | return InvokeComponent({
|
44953 | capabilities,
|
44954 | attrs,
|
44955 | params,
|
44956 | hash,
|
44957 | atNames: true,
|
44958 | blocks,
|
44959 | layout
|
44960 | });
|
44961 | }
|
44962 |
|
44963 | var out = [op(36
|
44964 |
|
44965 | , _vm.$s0), op(33
|
44966 |
|
44967 | , _vm.$sp, 1), op(35
|
44968 |
|
44969 | , _vm.$s0)];
|
44970 | var {
|
44971 | symbols
|
44972 | } = symbolTable;
|
44973 |
|
44974 | if (capabilities.createArgs) {
|
44975 | out.push(op(0
|
44976 |
|
44977 | ), op('SimpleArgs', {
|
44978 | params,
|
44979 | hash,
|
44980 | atNames: true
|
44981 | }));
|
44982 | }
|
44983 |
|
44984 | out.push(op(100
|
44985 |
|
44986 | ));
|
44987 |
|
44988 | if (capabilities.dynamicScope) {
|
44989 | out.push(op(59
|
44990 |
|
44991 | ));
|
44992 | }
|
44993 |
|
44994 | if (capabilities.createInstance) {
|
44995 | out.push(op(89
|
44996 |
|
44997 | , blocks.has('default') | 0, _vm.$s0));
|
44998 | }
|
44999 |
|
45000 | if (capabilities.createArgs) {
|
45001 | out.push(op(1
|
45002 |
|
45003 | ));
|
45004 | }
|
45005 |
|
45006 | out.push(op(0
|
45007 |
|
45008 | ), op(90
|
45009 |
|
45010 | , _vm.$s0));
|
45011 | var bindings = [];
|
45012 | out.push(op(92
|
45013 |
|
45014 | , _vm.$s0));
|
45015 | bindings.push({
|
45016 | symbol: 0,
|
45017 | isBlock: false
|
45018 | });
|
45019 |
|
45020 | for (var i = 0; i < symbols.length; i++) {
|
45021 | var symbol = symbols[i];
|
45022 |
|
45023 | switch (symbol.charAt(0)) {
|
45024 | case '&':
|
45025 | var callerBlock = void 0;
|
45026 |
|
45027 | if (symbol === ATTRS_BLOCK) {
|
45028 | callerBlock = attrs;
|
45029 | } else {
|
45030 | callerBlock = blocks.get(symbol.slice(1));
|
45031 | }
|
45032 |
|
45033 | if (callerBlock) {
|
45034 | out.push(PushYieldableBlock(callerBlock));
|
45035 | bindings.push({
|
45036 | symbol: i + 1,
|
45037 | isBlock: true
|
45038 | });
|
45039 | } else {
|
45040 | out.push(PushYieldableBlock(null));
|
45041 | bindings.push({
|
45042 | symbol: i + 1,
|
45043 | isBlock: true
|
45044 | });
|
45045 | }
|
45046 |
|
45047 | break;
|
45048 |
|
45049 | case '@':
|
45050 | if (!hash) {
|
45051 | break;
|
45052 | }
|
45053 |
|
45054 | var [keys, values] = hash;
|
45055 | var lookupName = symbol;
|
45056 | var index = keys.indexOf(lookupName);
|
45057 |
|
45058 | if (index !== -1) {
|
45059 | out.push(op('Expr', values[index]));
|
45060 | bindings.push({
|
45061 | symbol: i + 1,
|
45062 | isBlock: false
|
45063 | });
|
45064 | }
|
45065 |
|
45066 | break;
|
45067 | }
|
45068 | }
|
45069 |
|
45070 | out.push(op(37
|
45071 |
|
45072 | , symbols.length + 1, Object.keys(blocks).length > 0 ? 1 : 0));
|
45073 |
|
45074 | for (var _i2 = bindings.length - 1; _i2 >= 0; _i2--) {
|
45075 | var {
|
45076 | symbol: _symbol,
|
45077 | isBlock
|
45078 | } = bindings[_i2];
|
45079 |
|
45080 | if (isBlock) {
|
45081 | out.push(op('SetBlock', _symbol));
|
45082 | } else {
|
45083 | out.push(op(19
|
45084 |
|
45085 | , _symbol));
|
45086 | }
|
45087 | }
|
45088 |
|
45089 | out.push(op('InvokeStatic', layout));
|
45090 |
|
45091 | if (capabilities.createInstance) {
|
45092 | out.push(op(103
|
45093 |
|
45094 | , _vm.$s0));
|
45095 | }
|
45096 |
|
45097 | out.push(op(1
|
45098 |
|
45099 | ), op(40
|
45100 |
|
45101 | ));
|
45102 |
|
45103 | if (capabilities.dynamicScope) {
|
45104 | out.push(op(60
|
45105 |
|
45106 | ));
|
45107 | }
|
45108 |
|
45109 | out.push(op(101
|
45110 |
|
45111 | ), op(35
|
45112 |
|
45113 | , _vm.$s0));
|
45114 | return out;
|
45115 | }
|
45116 |
|
45117 | function InvokeDynamicComponent(meta$$1, {
|
45118 | definition,
|
45119 | attrs,
|
45120 | params,
|
45121 | hash,
|
45122 | atNames,
|
45123 | blocks
|
45124 | }) {
|
45125 | return Replayable({
|
45126 | args: () => {
|
45127 | return {
|
45128 | count: 2,
|
45129 | actions: [op('Expr', definition), op(33
|
45130 |
|
45131 | , _vm.$sp, 0)]
|
45132 | };
|
45133 | },
|
45134 | body: () => {
|
45135 | return [op(66
|
45136 |
|
45137 | , label('ELSE')), op(83
|
45138 |
|
45139 | , templateMeta(meta$$1.referrer)), op(81
|
45140 |
|
45141 | ), InvokeComponent({
|
45142 | capabilities: true,
|
45143 | attrs,
|
45144 | params,
|
45145 | hash,
|
45146 | atNames,
|
45147 | blocks
|
45148 | }), op('Label', 'ELSE')];
|
45149 | }
|
45150 | });
|
45151 | }
|
45152 |
|
45153 | function WrappedComponent(layout, attrsBlockNumber) {
|
45154 | return [op('StartLabels'), WithSavedRegister(_vm.$s1, () => [op(93
|
45155 |
|
45156 | , _vm.$s0), op(31
|
45157 |
|
45158 | ), op(33
|
45159 |
|
45160 | , _vm.$sp, 0)]), op(66
|
45161 |
|
45162 | , label('BODY')), op(36
|
45163 |
|
45164 | , _vm.$s1), op(91
|
45165 |
|
45166 | ), op(49
|
45167 |
|
45168 | ), op(102
|
45169 |
|
45170 | , _vm.$s0), YieldBlock(attrsBlockNumber, _util.EMPTY_ARRAY), op(54
|
45171 |
|
45172 | ), op('Label', 'BODY'), InvokeStaticBlock(blockForLayout(layout)), op(36
|
45173 |
|
45174 | , _vm.$s1), op(66
|
45175 |
|
45176 | , label('END')), op(55
|
45177 |
|
45178 | ), op('Label', 'END'), op(35
|
45179 |
|
45180 | , _vm.$s1), op('StopLabels')];
|
45181 | }
|
45182 |
|
45183 | function StaticComponent(component, args$$1) {
|
45184 | var [params, hash, blocks] = args$$1;
|
45185 | if (component === null) return NONE;
|
45186 | var {
|
45187 | compilable: compilable$$1,
|
45188 | capabilities,
|
45189 | handle
|
45190 | } = component;
|
45191 |
|
45192 | if (compilable$$1) {
|
45193 | return [op(80
|
45194 |
|
45195 | , handle), InvokeStaticComponent({
|
45196 | capabilities: capabilities || MINIMAL_CAPABILITIES,
|
45197 | layout: compilable$$1,
|
45198 | attrs: null,
|
45199 | params,
|
45200 | hash,
|
45201 | blocks
|
45202 | })];
|
45203 | } else {
|
45204 | return [op(80
|
45205 |
|
45206 | , handle), InvokeComponent({
|
45207 | capabilities: capabilities || MINIMAL_CAPABILITIES,
|
45208 | attrs: null,
|
45209 | params,
|
45210 | hash,
|
45211 | atNames: true,
|
45212 | blocks
|
45213 | })];
|
45214 | }
|
45215 | }
|
45216 |
|
45217 | function InvokeComponent({
|
45218 | capabilities,
|
45219 | attrs,
|
45220 | params,
|
45221 | hash,
|
45222 | atNames,
|
45223 | blocks: namedBlocks$$1,
|
45224 | layout
|
45225 | }) {
|
45226 | var bindableBlocks = !!namedBlocks$$1;
|
45227 | var bindableAtNames = capabilities === true || capabilities.prepareArgs || !!(hash && hash[0].length !== 0);
|
45228 | var blocks = namedBlocks$$1.with('attrs', attrs);
|
45229 | return [op(36
|
45230 |
|
45231 | , _vm.$s0), op(33
|
45232 |
|
45233 | , _vm.$sp, 1), op(35
|
45234 |
|
45235 | , _vm.$s0), op(0
|
45236 |
|
45237 | ), op('Args', {
|
45238 | params,
|
45239 | hash,
|
45240 | blocks,
|
45241 | atNames
|
45242 | }), op(87
|
45243 |
|
45244 | , _vm.$s0), invokePreparedComponent(blocks.has('default'), bindableBlocks, bindableAtNames, () => {
|
45245 | var out;
|
45246 |
|
45247 | if (layout) {
|
45248 | out = [PushSymbolTable(layout.symbolTable), op('PushCompilable', layout), op('JitCompileBlock')];
|
45249 | } else {
|
45250 | out = [op('GetComponentLayout', _vm.$s0)];
|
45251 | }
|
45252 |
|
45253 | out.push(op(98
|
45254 |
|
45255 | , _vm.$s0));
|
45256 | return out;
|
45257 | }), op(35
|
45258 |
|
45259 | , _vm.$s0)];
|
45260 | }
|
45261 |
|
45262 | function invokePreparedComponent(hasBlock, bindableBlocks, bindableAtNames, populateLayout = null) {
|
45263 | var out = [op(100
|
45264 |
|
45265 | ), op(59
|
45266 |
|
45267 | ), op(89
|
45268 |
|
45269 | , hasBlock | 0, _vm.$s0)];
|
45270 |
|
45271 |
|
45272 |
|
45273 |
|
45274 | if (populateLayout) {
|
45275 | out.push(populateLayout());
|
45276 | }
|
45277 |
|
45278 | out.push(op(90
|
45279 |
|
45280 | , _vm.$s0), op(92
|
45281 |
|
45282 | , _vm.$s0), op(38
|
45283 |
|
45284 | , _vm.$s0), op(19
|
45285 |
|
45286 | , 0), op(97
|
45287 |
|
45288 | , _vm.$s0), bindableAtNames ? op(17
|
45289 |
|
45290 | , _vm.$s0) : NONE, bindableBlocks ? op(18
|
45291 |
|
45292 | , _vm.$s0) : NONE, op(34
|
45293 |
|
45294 | , 1), op(99
|
45295 |
|
45296 | , _vm.$s0), op(103
|
45297 |
|
45298 | , _vm.$s0), op(1
|
45299 |
|
45300 | ), op(40
|
45301 |
|
45302 | ), op(60
|
45303 |
|
45304 | ), op(101
|
45305 |
|
45306 | ));
|
45307 | return out;
|
45308 | }
|
45309 |
|
45310 | function InvokeBareComponent() {
|
45311 | return [op(36
|
45312 |
|
45313 | , _vm.$s0), op(33
|
45314 |
|
45315 | , _vm.$sp, 1), op(35
|
45316 |
|
45317 | , _vm.$s0), op(0
|
45318 |
|
45319 | ), op(85
|
45320 |
|
45321 | ), op(87
|
45322 |
|
45323 | , _vm.$s0), invokePreparedComponent(false, false, true, () => [op('GetComponentLayout', _vm.$s0), op(98
|
45324 |
|
45325 | , _vm.$s0)]), op(35
|
45326 |
|
45327 | , _vm.$s0)];
|
45328 | }
|
45329 |
|
45330 | function curryComponent({
|
45331 | definition,
|
45332 | params,
|
45333 | hash,
|
45334 | atNames
|
45335 | }, referrer) {
|
45336 | return [op(0
|
45337 |
|
45338 | ), op('SimpleArgs', {
|
45339 | params,
|
45340 | hash,
|
45341 | atNames
|
45342 | }), op(88
|
45343 |
|
45344 | ), op('Expr', definition), op(79
|
45345 |
|
45346 | , templateMeta(referrer)), op(1
|
45347 |
|
45348 | ), op(36
|
45349 |
|
45350 | , _vm.$v0)];
|
45351 | }
|
45352 |
|
45353 | function blockForLayout(layout) {
|
45354 | return compilableBlock(layout.block.statements, meta(layout));
|
45355 | }
|
45356 |
|
45357 | function WithSavedRegister(register, block) {
|
45358 | return [op(36
|
45359 |
|
45360 | , register), block(), op(35
|
45361 |
|
45362 | , register)];
|
45363 | }
|
45364 |
|
45365 | class StdLib {
|
45366 | constructor(main, trustingGuardedAppend, cautiousGuardedAppend) {
|
45367 | this.main = main;
|
45368 | this.trustingGuardedAppend = trustingGuardedAppend;
|
45369 | this.cautiousGuardedAppend = cautiousGuardedAppend;
|
45370 | }
|
45371 |
|
45372 | get 'trusting-append'() {
|
45373 | return this.trustingGuardedAppend;
|
45374 | }
|
45375 |
|
45376 | get 'cautious-append'() {
|
45377 | return this.cautiousGuardedAppend;
|
45378 | }
|
45379 |
|
45380 | getAppend(trusting) {
|
45381 | return trusting ? this.trustingGuardedAppend : this.cautiousGuardedAppend;
|
45382 | }
|
45383 |
|
45384 | }
|
45385 |
|
45386 | _exports.StdLib = StdLib;
|
45387 |
|
45388 | function main() {
|
45389 | return [op(76
|
45390 |
|
45391 | , _vm.$s0), invokePreparedComponent(false, false, true)];
|
45392 | }
|
45393 | |
45394 |
|
45395 |
|
45396 |
|
45397 |
|
45398 |
|
45399 |
|
45400 |
|
45401 |
|
45402 |
|
45403 | function StdAppend(trusting) {
|
45404 | return [op(78
|
45405 |
|
45406 | ), SwitchCases(when => {
|
45407 | when(1
|
45408 |
|
45409 | , () => {
|
45410 | if (trusting) {
|
45411 | return [op(68
|
45412 |
|
45413 | ), op(43
|
45414 |
|
45415 | )];
|
45416 | } else {
|
45417 | return op(47
|
45418 |
|
45419 | );
|
45420 | }
|
45421 | });
|
45422 | when(0
|
45423 |
|
45424 | , () => [op(82
|
45425 |
|
45426 | ), op(81
|
45427 |
|
45428 | ), InvokeBareComponent()]);
|
45429 | when(3
|
45430 |
|
45431 | , () => [op(68
|
45432 |
|
45433 | ), op(44
|
45434 |
|
45435 | )]);
|
45436 | when(4
|
45437 |
|
45438 | , () => [op(68
|
45439 |
|
45440 | ), op(45
|
45441 |
|
45442 | )]);
|
45443 | when(5
|
45444 |
|
45445 | , () => [op(68
|
45446 |
|
45447 | ), op(46
|
45448 |
|
45449 | )]);
|
45450 | })];
|
45451 | }
|
45452 |
|
45453 | function compileStd(context) {
|
45454 | var mainHandle = build(context, main);
|
45455 | var trustingGuardedAppend = build(context, () => StdAppend(true));
|
45456 | var cautiousGuardedAppend = build(context, () => StdAppend(false));
|
45457 | return new StdLib(mainHandle, trustingGuardedAppend, cautiousGuardedAppend);
|
45458 | }
|
45459 |
|
45460 | var STDLIB_META = {
|
45461 | asPartial: false,
|
45462 | evalSymbols: null,
|
45463 | upvars: null,
|
45464 |
|
45465 | referrer: {},
|
45466 | size: 0
|
45467 | };
|
45468 |
|
45469 | function build(program, callback) {
|
45470 | var encoder = new EncoderImpl();
|
45471 | var macros = new MacrosImpl();
|
45472 | var stdContext = {
|
45473 | encoder,
|
45474 | meta: STDLIB_META,
|
45475 | syntax: {
|
45476 | macros,
|
45477 | program
|
45478 | }
|
45479 | };
|
45480 | concat(stdContext, callback());
|
45481 | var result = encoder.commit(program.heap, 0);
|
45482 |
|
45483 | if (typeof result !== 'number') {
|
45484 |
|
45485 | throw new Error(`Unexpected errors compiling std`);
|
45486 | } else {
|
45487 | return result;
|
45488 | }
|
45489 | }
|
45490 |
|
45491 | class ProgramCompilationContext {
|
45492 | constructor(delegate, mode) {
|
45493 | this.mode = mode;
|
45494 | this.constants = new _program.WriteOnlyConstants();
|
45495 | this.heap = new _program.HeapImpl();
|
45496 | this.resolverDelegate = delegate;
|
45497 | this.stdlib = compileStd(this);
|
45498 | }
|
45499 |
|
45500 | }
|
45501 |
|
45502 | _exports.ProgramCompilationContext = ProgramCompilationContext;
|
45503 |
|
45504 | class JitProgramCompilationContext {
|
45505 | constructor(delegate) {
|
45506 | this.constants = new _program.JitConstants();
|
45507 | this.heap = new _program.HeapImpl();
|
45508 | this.mode = "jit"
|
45509 |
|
45510 | ;
|
45511 | this.resolverDelegate = delegate;
|
45512 | this.stdlib = compileStd(this);
|
45513 | }
|
45514 |
|
45515 | }
|
45516 |
|
45517 | _exports.JitProgramCompilationContext = JitProgramCompilationContext;
|
45518 |
|
45519 | class PartialDefinitionImpl {
|
45520 | constructor(name, // for debugging
|
45521 | template) {
|
45522 | this.name = name;
|
45523 | this.template = template;
|
45524 | }
|
45525 |
|
45526 | getPartial(context) {
|
45527 | var partial = (0, _util.unwrapTemplate)(this.template).asPartial();
|
45528 | var handle = partial.compile(context);
|
45529 | return {
|
45530 | symbolTable: partial.symbolTable,
|
45531 | handle
|
45532 | };
|
45533 | }
|
45534 |
|
45535 | }
|
45536 |
|
45537 | _exports.PartialDefinitionImpl = PartialDefinitionImpl;
|
45538 |
|
45539 | class WrappedBuilder {
|
45540 | constructor(layout) {
|
45541 | this.layout = layout;
|
45542 | this.compiled = null;
|
45543 | var {
|
45544 | block
|
45545 | } = layout;
|
45546 | var symbols = block.symbols.slice();
|
45547 |
|
45548 | var attrsBlockIndex = symbols.indexOf(ATTRS_BLOCK);
|
45549 |
|
45550 | if (attrsBlockIndex === -1) {
|
45551 | this.attrsBlockNumber = symbols.push(ATTRS_BLOCK);
|
45552 | } else {
|
45553 | this.attrsBlockNumber = attrsBlockIndex + 1;
|
45554 | }
|
45555 |
|
45556 | this.symbolTable = {
|
45557 | hasEval: block.hasEval,
|
45558 | symbols
|
45559 | };
|
45560 | }
|
45561 |
|
45562 | compile(syntax) {
|
45563 | if (this.compiled !== null) return this.compiled;
|
45564 | var m = meta(this.layout);
|
45565 | var context = templateCompilationContext(syntax, m);
|
45566 | var actions = WrappedComponent(this.layout, this.attrsBlockNumber);
|
45567 | concatStatements(context, actions);
|
45568 | var handle = context.encoder.commit(context.syntax.program.heap, m.size);
|
45569 |
|
45570 | if (typeof handle !== 'number') {
|
45571 | return handle;
|
45572 | }
|
45573 |
|
45574 | this.compiled = handle;
|
45575 | (0, _program.patchStdlibs)(context.syntax.program);
|
45576 | return handle;
|
45577 | }
|
45578 |
|
45579 | }
|
45580 |
|
45581 | _exports.WrappedBuilder = WrappedBuilder;
|
45582 | var clientId = 0;
|
45583 |
|
45584 | function templateFactory({
|
45585 | id: templateId,
|
45586 | meta,
|
45587 | block
|
45588 | }) {
|
45589 | var parsedBlock;
|
45590 | var id = templateId || `client-${clientId++}`;
|
45591 |
|
45592 | var create = envMeta => {
|
45593 | var newMeta = envMeta ? (0, _util.assign)({}, envMeta, meta) : meta;
|
45594 |
|
45595 | if (!parsedBlock) {
|
45596 | parsedBlock = JSON.parse(block);
|
45597 | }
|
45598 |
|
45599 | return new TemplateImpl({
|
45600 | id,
|
45601 | block: parsedBlock,
|
45602 | referrer: newMeta
|
45603 | });
|
45604 | };
|
45605 |
|
45606 | return {
|
45607 | id,
|
45608 | meta,
|
45609 | create
|
45610 | };
|
45611 | }
|
45612 |
|
45613 | class TemplateImpl {
|
45614 | constructor(parsedLayout) {
|
45615 | this.parsedLayout = parsedLayout;
|
45616 | this.result = 'ok';
|
45617 | this.layout = null;
|
45618 | this.partial = null;
|
45619 | this.wrappedLayout = null;
|
45620 | var {
|
45621 | block
|
45622 | } = parsedLayout;
|
45623 | this.symbols = block.symbols;
|
45624 | this.hasEval = block.hasEval;
|
45625 | this.referrer = parsedLayout.referrer;
|
45626 | this.id = parsedLayout.id || `client-${clientId++}`;
|
45627 | }
|
45628 |
|
45629 | asLayout() {
|
45630 | if (this.layout) return this.layout;
|
45631 | return this.layout = compilable((0, _util.assign)({}, this.parsedLayout, {
|
45632 | asPartial: false
|
45633 | }));
|
45634 | }
|
45635 |
|
45636 | asPartial() {
|
45637 | if (this.partial) return this.partial;
|
45638 | return this.layout = compilable((0, _util.assign)({}, this.parsedLayout, {
|
45639 | asPartial: true
|
45640 | }));
|
45641 | }
|
45642 |
|
45643 | asWrappedLayout() {
|
45644 | if (this.wrappedLayout) return this.wrappedLayout;
|
45645 | return this.wrappedLayout = new WrappedBuilder((0, _util.assign)({}, this.parsedLayout, {
|
45646 | asPartial: false
|
45647 | }));
|
45648 | }
|
45649 |
|
45650 | }
|
45651 |
|
45652 | function Component(serialized, envMeta) {
|
45653 | var parsed = JSON.parse(serialized);
|
45654 | var factory = templateFactory(parsed);
|
45655 | var template = (0, _util.unwrapTemplate)(factory.create(envMeta));
|
45656 | return template.asLayout();
|
45657 | }
|
45658 | });
|
45659 | define("@glimmer/program", ["exports", "@glimmer/util"], function (_exports, _util) {
|
45660 | "use strict";
|
45661 |
|
45662 | Object.defineProperty(_exports, "__esModule", {
|
45663 | value: true
|
45664 | });
|
45665 | _exports.hydrateHeap = hydrateHeap;
|
45666 | _exports.hydrateProgram = hydrateProgram;
|
45667 | _exports.patchStdlibs = patchStdlibs;
|
45668 | _exports.programArtifacts = programArtifacts;
|
45669 | _exports.artifacts = artifacts;
|
45670 | _exports.RuntimeOpImpl = _exports.RuntimeProgramImpl = _exports.HeapImpl = _exports.RuntimeHeapImpl = _exports.JitConstants = _exports.RuntimeConstantsImpl = _exports.WriteOnlyConstants = void 0;
|
45671 | var WELL_KNOWN_EMPTY_ARRAY = Object.freeze([]);
|
45672 | var STARTER_CONSTANTS = (0, _util.constants)(WELL_KNOWN_EMPTY_ARRAY);
|
45673 | var WELL_KNOWN_EMPTY_ARRAY_POSITION = STARTER_CONSTANTS.indexOf(WELL_KNOWN_EMPTY_ARRAY);
|
45674 |
|
45675 | class WriteOnlyConstants {
|
45676 | constructor() {
|
45677 |
|
45678 | this.values = STARTER_CONSTANTS.slice();
|
45679 | this.indexMap = new Map(this.values.map((value, index) => [value, index]));
|
45680 | }
|
45681 |
|
45682 | value(value) {
|
45683 | var indexMap = this.indexMap;
|
45684 | var index = indexMap.get(value);
|
45685 |
|
45686 | if (index === undefined) {
|
45687 | index = this.values.push(value) - 1;
|
45688 | indexMap.set(value, index);
|
45689 | }
|
45690 |
|
45691 | return index;
|
45692 | }
|
45693 |
|
45694 | array(values) {
|
45695 | if (values.length === 0) {
|
45696 | return WELL_KNOWN_EMPTY_ARRAY_POSITION;
|
45697 | }
|
45698 |
|
45699 | var handles = new Array(values.length);
|
45700 |
|
45701 | for (var i = 0; i < values.length; i++) {
|
45702 | handles[i] = this.value(values[i]);
|
45703 | }
|
45704 |
|
45705 | return this.value(handles);
|
45706 | }
|
45707 |
|
45708 | serializable(value) {
|
45709 | var str = JSON.stringify(value);
|
45710 | return this.value(str);
|
45711 | }
|
45712 |
|
45713 | toPool() {
|
45714 | return this.values;
|
45715 | }
|
45716 |
|
45717 | }
|
45718 |
|
45719 | _exports.WriteOnlyConstants = WriteOnlyConstants;
|
45720 |
|
45721 | class RuntimeConstantsImpl {
|
45722 | constructor(pool) {
|
45723 | this.values = pool;
|
45724 | }
|
45725 |
|
45726 | getValue(handle) {
|
45727 | return this.values[handle];
|
45728 | }
|
45729 |
|
45730 | getArray(value) {
|
45731 | var handles = this.getValue(value);
|
45732 | var reified = new Array(handles.length);
|
45733 |
|
45734 | for (var i = 0; i < handles.length; i++) {
|
45735 | var n = handles[i];
|
45736 | reified[i] = this.getValue(n);
|
45737 | }
|
45738 |
|
45739 | return reified;
|
45740 | }
|
45741 |
|
45742 | getSerializable(s) {
|
45743 | return JSON.parse(this.values[s]);
|
45744 | }
|
45745 |
|
45746 | }
|
45747 |
|
45748 | _exports.RuntimeConstantsImpl = RuntimeConstantsImpl;
|
45749 |
|
45750 | class JitConstants extends WriteOnlyConstants {
|
45751 | constructor() {
|
45752 | super(...arguments);
|
45753 | this.reifiedArrs = {
|
45754 | [WELL_KNOWN_EMPTY_ARRAY_POSITION]: WELL_KNOWN_EMPTY_ARRAY
|
45755 | };
|
45756 | }
|
45757 |
|
45758 | templateMeta(meta) {
|
45759 | return this.value(meta);
|
45760 | }
|
45761 |
|
45762 | getValue(index) {
|
45763 | return this.values[index];
|
45764 | }
|
45765 |
|
45766 | getArray(index) {
|
45767 | var reifiedArrs = this.reifiedArrs;
|
45768 | var reified = reifiedArrs[index];
|
45769 |
|
45770 | if (reified === undefined) {
|
45771 | var names = this.getValue(index);
|
45772 | reified = new Array(names.length);
|
45773 |
|
45774 | for (var i = 0; i < names.length; i++) {
|
45775 | reified[i] = this.getValue(names[i]);
|
45776 | }
|
45777 |
|
45778 | reifiedArrs[index] = reified;
|
45779 | }
|
45780 |
|
45781 | return reified;
|
45782 | }
|
45783 |
|
45784 | getSerializable(s) {
|
45785 | return JSON.parse(this.getValue(s));
|
45786 | }
|
45787 |
|
45788 | }
|
45789 |
|
45790 | _exports.JitConstants = JitConstants;
|
45791 |
|
45792 | class RuntimeOpImpl {
|
45793 | constructor(heap) {
|
45794 | this.heap = heap;
|
45795 | this.offset = 0;
|
45796 | }
|
45797 |
|
45798 | get size() {
|
45799 | var rawType = this.heap.getbyaddr(this.offset);
|
45800 | return ((rawType & 768
|
45801 |
|
45802 | ) >> 8
|
45803 |
|
45804 | ) + 1;
|
45805 | }
|
45806 |
|
45807 | get isMachine() {
|
45808 | var rawType = this.heap.getbyaddr(this.offset);
|
45809 | return rawType & 1024
|
45810 |
|
45811 | ? 1 : 0;
|
45812 | }
|
45813 |
|
45814 | get type() {
|
45815 | return this.heap.getbyaddr(this.offset) & 255
|
45816 |
|
45817 | ;
|
45818 | }
|
45819 |
|
45820 | get op1() {
|
45821 | return this.heap.getbyaddr(this.offset + 1);
|
45822 | }
|
45823 |
|
45824 | get op2() {
|
45825 | return this.heap.getbyaddr(this.offset + 2);
|
45826 | }
|
45827 |
|
45828 | get op3() {
|
45829 | return this.heap.getbyaddr(this.offset + 3);
|
45830 | }
|
45831 |
|
45832 | }
|
45833 |
|
45834 | _exports.RuntimeOpImpl = RuntimeOpImpl;
|
45835 |
|
45836 | function encodeTableInfo(scopeSize, state) {
|
45837 | return state | scopeSize << 2;
|
45838 | }
|
45839 |
|
45840 | function changeState(info, newState) {
|
45841 | return info | newState << 30;
|
45842 | }
|
45843 |
|
45844 | var PAGE_SIZE = 0x100000;
|
45845 |
|
45846 | class RuntimeHeapImpl {
|
45847 | constructor(serializedHeap) {
|
45848 | var {
|
45849 | buffer,
|
45850 | table
|
45851 | } = serializedHeap;
|
45852 | this.heap = new Int32Array(buffer);
|
45853 | this.table = table;
|
45854 | }
|
45855 |
|
45856 |
|
45857 |
|
45858 |
|
45859 | getaddr(handle) {
|
45860 | return this.table[handle];
|
45861 | }
|
45862 |
|
45863 | getbyaddr(address) {
|
45864 | return this.heap[address];
|
45865 | }
|
45866 |
|
45867 | sizeof(handle) {
|
45868 | return sizeof(this.table, handle);
|
45869 | }
|
45870 |
|
45871 | scopesizeof(handle) {
|
45872 | return scopesizeof(this.table, handle);
|
45873 | }
|
45874 |
|
45875 | }
|
45876 |
|
45877 | _exports.RuntimeHeapImpl = RuntimeHeapImpl;
|
45878 |
|
45879 | function hydrateHeap(serializedHeap) {
|
45880 | return new RuntimeHeapImpl(serializedHeap);
|
45881 | }
|
45882 | |
45883 |
|
45884 |
|
45885 |
|
45886 |
|
45887 |
|
45888 |
|
45889 |
|
45890 |
|
45891 |
|
45892 |
|
45893 |
|
45894 |
|
45895 |
|
45896 |
|
45897 |
|
45898 |
|
45899 |
|
45900 |
|
45901 |
|
45902 |
|
45903 |
|
45904 | class HeapImpl {
|
45905 | constructor() {
|
45906 | this.placeholders = [];
|
45907 | this.stdlibs = [];
|
45908 | this.offset = 0;
|
45909 | this.handle = 0;
|
45910 | this.capacity = PAGE_SIZE;
|
45911 | this.heap = new Int32Array(PAGE_SIZE);
|
45912 | this.table = [];
|
45913 | }
|
45914 |
|
45915 | push(item) {
|
45916 | this.sizeCheck();
|
45917 | this.heap[this.offset++] = item;
|
45918 | }
|
45919 |
|
45920 | sizeCheck() {
|
45921 | if (this.capacity === 0) {
|
45922 | var heap = slice(this.heap, 0, this.offset);
|
45923 | this.heap = new Int32Array(heap.length + PAGE_SIZE);
|
45924 | this.heap.set(heap, 0);
|
45925 | this.capacity = PAGE_SIZE;
|
45926 | }
|
45927 |
|
45928 | this.capacity--;
|
45929 | }
|
45930 |
|
45931 | getbyaddr(address) {
|
45932 | return this.heap[address];
|
45933 | }
|
45934 |
|
45935 | setbyaddr(address, value) {
|
45936 | this.heap[address] = value;
|
45937 | }
|
45938 |
|
45939 | malloc() {
|
45940 |
|
45941 | this.table.push(this.offset, 0, 0);
|
45942 | var handle = this.handle;
|
45943 | this.handle += 3
|
45944 |
|
45945 | ;
|
45946 | return handle;
|
45947 | }
|
45948 |
|
45949 | finishMalloc(handle, scopeSize) {
|
45950 | this.table[handle + 1
|
45951 |
|
45952 | ] = encodeTableInfo(scopeSize, 0
|
45953 |
|
45954 | );
|
45955 | }
|
45956 |
|
45957 | size() {
|
45958 | return this.offset;
|
45959 | }
|
45960 |
|
45961 |
|
45962 |
|
45963 |
|
45964 | getaddr(handle) {
|
45965 | return this.table[handle];
|
45966 | }
|
45967 |
|
45968 | gethandle(address) {
|
45969 | this.table.push(address, encodeTableInfo(0, 3
|
45970 |
|
45971 | ), 0);
|
45972 | var handle = this.handle;
|
45973 | this.handle += 3
|
45974 |
|
45975 | ;
|
45976 | return handle;
|
45977 | }
|
45978 |
|
45979 | sizeof(handle) {
|
45980 | return sizeof(this.table, handle);
|
45981 | }
|
45982 |
|
45983 | scopesizeof(handle) {
|
45984 | return scopesizeof(this.table, handle);
|
45985 | }
|
45986 |
|
45987 | free(handle) {
|
45988 | var info = this.table[handle + 1
|
45989 |
|
45990 | ];
|
45991 | this.table[handle + 1
|
45992 |
|
45993 | ] = changeState(info, 1
|
45994 |
|
45995 | );
|
45996 | }
|
45997 | |
45998 |
|
45999 |
|
46000 |
|
46001 |
|
46002 |
|
46003 |
|
46004 |
|
46005 |
|
46006 | compact() {
|
46007 | var compactedSize = 0;
|
46008 | var {
|
46009 | table,
|
46010 | table: {
|
46011 | length
|
46012 | },
|
46013 | heap
|
46014 | } = this;
|
46015 |
|
46016 | for (var i = 0; i < length; i += 3
|
46017 |
|
46018 | ) {
|
46019 | var offset = table[i];
|
46020 | var info = table[i + 1
|
46021 |
|
46022 | ];
|
46023 |
|
46024 | var size = info & Size.SIZE_MASK;
|
46025 | var state = info & 3
|
46026 |
|
46027 | >> 30;
|
46028 |
|
46029 | if (state === 2
|
46030 |
|
46031 | ) {
|
46032 | continue;
|
46033 | } else if (state === 1
|
46034 |
|
46035 | ) {
|
46036 |
|
46037 |
|
46038 |
|
46039 | table[i + 1
|
46040 |
|
46041 | ] = changeState(info, 2
|
46042 |
|
46043 | );
|
46044 | compactedSize += size;
|
46045 | } else if (state === 0
|
46046 |
|
46047 | ) {
|
46048 | for (var j = offset; j <= i + size; j++) {
|
46049 | heap[j - compactedSize] = heap[j];
|
46050 | }
|
46051 |
|
46052 | table[i] = offset - compactedSize;
|
46053 | } else if (state === 3
|
46054 |
|
46055 | ) {
|
46056 | table[i] = offset - compactedSize;
|
46057 | }
|
46058 | }
|
46059 |
|
46060 | this.offset = this.offset - compactedSize;
|
46061 | }
|
46062 |
|
46063 | pushPlaceholder(valueFunc) {
|
46064 | this.sizeCheck();
|
46065 | var address = this.offset++;
|
46066 | this.heap[address] = 2147483647
|
46067 |
|
46068 | ;
|
46069 | this.placeholders.push([address, valueFunc]);
|
46070 | }
|
46071 |
|
46072 | pushStdlib(operand) {
|
46073 | this.sizeCheck();
|
46074 | var address = this.offset++;
|
46075 | this.heap[address] = 2147483647
|
46076 |
|
46077 | ;
|
46078 | this.stdlibs.push([address, operand]);
|
46079 | }
|
46080 |
|
46081 | patchPlaceholders() {
|
46082 | var {
|
46083 | placeholders
|
46084 | } = this;
|
46085 |
|
46086 | for (var i = 0; i < placeholders.length; i++) {
|
46087 | var [address, getValue] = placeholders[i];
|
46088 | this.setbyaddr(address, getValue());
|
46089 | }
|
46090 | }
|
46091 |
|
46092 | patchStdlibs(stdlib) {
|
46093 | var {
|
46094 | stdlibs
|
46095 | } = this;
|
46096 |
|
46097 | for (var i = 0; i < stdlibs.length; i++) {
|
46098 | var [address, {
|
46099 | value
|
46100 | }] = stdlibs[i];
|
46101 | this.setbyaddr(address, stdlib[value]);
|
46102 | }
|
46103 |
|
46104 | this.stdlibs = [];
|
46105 | }
|
46106 |
|
46107 | capture(stdlib, offset = this.offset) {
|
46108 | this.patchPlaceholders();
|
46109 | this.patchStdlibs(stdlib);
|
46110 |
|
46111 | var buffer = slice(this.heap, 0, offset).buffer;
|
46112 | return {
|
46113 | handle: this.handle,
|
46114 | table: this.table,
|
46115 | buffer: buffer
|
46116 | };
|
46117 | }
|
46118 |
|
46119 | }
|
46120 |
|
46121 | _exports.HeapImpl = HeapImpl;
|
46122 |
|
46123 | class RuntimeProgramImpl {
|
46124 | constructor(constants$$1, heap) {
|
46125 | this.constants = constants$$1;
|
46126 | this.heap = heap;
|
46127 | this._opcode = new RuntimeOpImpl(this.heap);
|
46128 | }
|
46129 |
|
46130 | static hydrate(artifacts) {
|
46131 | var heap = new RuntimeHeapImpl(artifacts.heap);
|
46132 | var constants$$1 = new RuntimeConstantsImpl(artifacts.constants);
|
46133 | return new RuntimeProgramImpl(constants$$1, heap);
|
46134 | }
|
46135 |
|
46136 | opcode(offset) {
|
46137 | this._opcode.offset = offset;
|
46138 | return this._opcode;
|
46139 | }
|
46140 |
|
46141 | }
|
46142 |
|
46143 | _exports.RuntimeProgramImpl = RuntimeProgramImpl;
|
46144 |
|
46145 | function hydrateProgram(artifacts) {
|
46146 | var heap = new RuntimeHeapImpl(artifacts.heap);
|
46147 | var constants$$1 = new RuntimeConstantsImpl(artifacts.constants);
|
46148 | return new RuntimeProgramImpl(constants$$1, heap);
|
46149 | }
|
46150 |
|
46151 | function slice(arr, start, end) {
|
46152 | if (arr.slice !== undefined) {
|
46153 | return arr.slice(start, end);
|
46154 | }
|
46155 |
|
46156 | var ret = new Int32Array(end);
|
46157 |
|
46158 | for (; start < end; start++) {
|
46159 | ret[start] = arr[start];
|
46160 | }
|
46161 |
|
46162 | return ret;
|
46163 | }
|
46164 |
|
46165 | function sizeof(table, handle) {
|
46166 | {
|
46167 | return -1;
|
46168 | }
|
46169 | }
|
46170 |
|
46171 | function scopesizeof(table, handle) {
|
46172 | var info = table[handle + 1
|
46173 |
|
46174 | ];
|
46175 | return info >> 2;
|
46176 | }
|
46177 |
|
46178 | function patchStdlibs(program) {
|
46179 | program.heap.patchStdlibs(program.stdlib);
|
46180 | }
|
46181 |
|
46182 | function programArtifacts(program) {
|
46183 | var heap = program.heap.capture(program.stdlib);
|
46184 | var constants$$1 = program.constants.toPool();
|
46185 | return {
|
46186 | heap,
|
46187 | constants: constants$$1
|
46188 | };
|
46189 | }
|
46190 |
|
46191 | function artifacts(syntax) {
|
46192 | return programArtifacts(syntax.program);
|
46193 | }
|
46194 | });
|
46195 | define("@glimmer/reference", ["exports", "@glimmer/util", "@glimmer/validator"], function (_exports, _util, _validator) {
|
46196 | "use strict";
|
46197 |
|
46198 | Object.defineProperty(_exports, "__esModule", {
|
46199 | value: true
|
46200 | });
|
46201 | _exports.isModified = isModified;
|
46202 | _exports.IterationItemReference = _exports.PropertyReference = _exports.HelperRootReference = _exports.ComponentRootReference = _exports.RootReference = _exports.UPDATE_REFERENCED_VALUE = _exports.IterableReference = _exports.ConstReference = _exports.ReferenceCache = _exports.CachedReference = void 0;
|
46203 |
|
46204 | class CachedReference {
|
46205 | constructor() {
|
46206 | this.lastRevision = null;
|
46207 | this.lastValue = null;
|
46208 | }
|
46209 |
|
46210 | value() {
|
46211 | var {
|
46212 | tag,
|
46213 | lastRevision,
|
46214 | lastValue
|
46215 | } = this;
|
46216 |
|
46217 | if (lastRevision === null || !(0, _validator.validateTag)(tag, lastRevision)) {
|
46218 | lastValue = this.lastValue = this.compute();
|
46219 | this.lastRevision = (0, _validator.valueForTag)(tag);
|
46220 | }
|
46221 |
|
46222 | return lastValue;
|
46223 | }
|
46224 |
|
46225 | invalidate() {
|
46226 | this.lastRevision = null;
|
46227 | }
|
46228 |
|
46229 | }
|
46230 |
|
46231 |
|
46232 | _exports.CachedReference = CachedReference;
|
46233 |
|
46234 | class ReferenceCache {
|
46235 | constructor(reference) {
|
46236 | this.lastValue = null;
|
46237 | this.lastRevision = null;
|
46238 | this.initialized = false;
|
46239 | this.tag = reference.tag;
|
46240 | this.reference = reference;
|
46241 | }
|
46242 |
|
46243 | peek() {
|
46244 | if (!this.initialized) {
|
46245 | return this.initialize();
|
46246 | }
|
46247 |
|
46248 | return this.lastValue;
|
46249 | }
|
46250 |
|
46251 | revalidate() {
|
46252 | if (!this.initialized) {
|
46253 | return this.initialize();
|
46254 | }
|
46255 |
|
46256 | var {
|
46257 | reference,
|
46258 | lastRevision
|
46259 | } = this;
|
46260 | var tag = reference.tag;
|
46261 | if ((0, _validator.validateTag)(tag, lastRevision)) return NOT_MODIFIED;
|
46262 | var {
|
46263 | lastValue
|
46264 | } = this;
|
46265 | var currentValue = reference.value();
|
46266 | this.lastRevision = (0, _validator.valueForTag)(tag);
|
46267 | if (currentValue === lastValue) return NOT_MODIFIED;
|
46268 | this.lastValue = currentValue;
|
46269 | return currentValue;
|
46270 | }
|
46271 |
|
46272 | initialize() {
|
46273 | var {
|
46274 | reference
|
46275 | } = this;
|
46276 | var currentValue = this.lastValue = reference.value();
|
46277 | this.lastRevision = (0, _validator.valueForTag)(reference.tag);
|
46278 | this.initialized = true;
|
46279 | return currentValue;
|
46280 | }
|
46281 |
|
46282 | }
|
46283 |
|
46284 | _exports.ReferenceCache = ReferenceCache;
|
46285 | var NOT_MODIFIED = (0, _util.symbol)('NOT_MODIFIED');
|
46286 |
|
46287 | function isModified(value) {
|
46288 | return value !== NOT_MODIFIED;
|
46289 | }
|
46290 |
|
46291 | class PrimitiveReference {
|
46292 | constructor(inner) {
|
46293 | this.inner = inner;
|
46294 | this.tag = _validator.CONSTANT_TAG;
|
46295 | }
|
46296 |
|
46297 | value() {
|
46298 | return this.inner;
|
46299 | }
|
46300 |
|
46301 | get(_key) {
|
46302 | return UNDEFINED_REFERENCE;
|
46303 | }
|
46304 |
|
46305 | }
|
46306 |
|
46307 | var UNDEFINED_REFERENCE = new PrimitiveReference(undefined);
|
46308 |
|
46309 | class ConstReference {
|
46310 | constructor(inner) {
|
46311 | this.inner = inner;
|
46312 | this.tag = _validator.CONSTANT_TAG;
|
46313 | }
|
46314 |
|
46315 | value() {
|
46316 | return this.inner;
|
46317 | }
|
46318 |
|
46319 | get(_key) {
|
46320 | return UNDEFINED_REFERENCE;
|
46321 | }
|
46322 |
|
46323 | }
|
46324 |
|
46325 | _exports.ConstReference = ConstReference;
|
46326 | var UPDATE_REFERENCED_VALUE = (0, _util.symbol)('UPDATE_REFERENCED_VALUE');
|
46327 | |
46328 |
|
46329 |
|
46330 |
|
46331 |
|
46332 |
|
46333 |
|
46334 |
|
46335 |
|
46336 |
|
46337 |
|
46338 |
|
46339 |
|
46340 | _exports.UPDATE_REFERENCED_VALUE = UPDATE_REFERENCED_VALUE;
|
46341 |
|
46342 | class RootReference {
|
46343 | constructor(env) {
|
46344 | this.env = env;
|
46345 | this.children = (0, _util.dict)();
|
46346 | this.tag = _validator.CONSTANT_TAG;
|
46347 | }
|
46348 |
|
46349 | get(key) {
|
46350 |
|
46351 |
|
46352 |
|
46353 | if (true
|
46354 |
|
46355 | ) {
|
46356 |
|
46357 |
|
46358 |
|
46359 |
|
46360 |
|
46361 |
|
46362 |
|
46363 |
|
46364 |
|
46365 | if (!this.didSetupDebugContext) {
|
46366 | this.didSetupDebugContext = true;
|
46367 | this.env.setTemplatePathDebugContext(this, this.debugLogName || 'this', null);
|
46368 | }
|
46369 |
|
46370 | return new PropertyReference(this, key, this.env);
|
46371 | } else {
|
46372 | var ref = this.children[key];
|
46373 |
|
46374 | if (ref === undefined) {
|
46375 | ref = this.children[key] = new PropertyReference(this, key, this.env);
|
46376 | }
|
46377 |
|
46378 | return ref;
|
46379 | }
|
46380 | }
|
46381 |
|
46382 | }
|
46383 |
|
46384 | _exports.RootReference = RootReference;
|
46385 |
|
46386 | class ComponentRootReference extends RootReference {
|
46387 | constructor(inner, env) {
|
46388 | super(env);
|
46389 | this.inner = inner;
|
46390 | }
|
46391 |
|
46392 | value() {
|
46393 | return this.inner;
|
46394 | }
|
46395 |
|
46396 | }
|
46397 |
|
46398 | _exports.ComponentRootReference = ComponentRootReference;
|
46399 |
|
46400 | class HelperRootReference extends RootReference {
|
46401 | constructor(fn, args, env, debugName) {
|
46402 | super(env);
|
46403 | this.fn = fn;
|
46404 | this.args = args;
|
46405 | this.computeRevision = null;
|
46406 | this.computeTag = null;
|
46407 |
|
46408 | if (true
|
46409 |
|
46410 | ) {
|
46411 | var name = debugName || fn.name;
|
46412 | env.setTemplatePathDebugContext(this, `(result of a \`${name}\` helper)`, null);
|
46413 | this.didSetupDebugContext = true;
|
46414 | }
|
46415 |
|
46416 | if ((0, _validator.isConstTagged)(args)) {
|
46417 | this.compute();
|
46418 | }
|
46419 |
|
46420 | var {
|
46421 | tag,
|
46422 | computeTag
|
46423 | } = this;
|
46424 |
|
46425 | if (computeTag !== null && (0, _validator.isConstTag)(computeTag)) {
|
46426 |
|
46427 |
|
46428 | tag = this.tag = _validator.CONSTANT_TAG;
|
46429 | this.computeRevision = (0, _validator.valueForTag)(tag);
|
46430 | } else {
|
46431 | var valueTag = this.valueTag = (0, _validator.createUpdatableTag)();
|
46432 | tag = this.tag = (0, _validator.combine)([args.tag, valueTag]);
|
46433 |
|
46434 | if (computeTag !== null) {
|
46435 |
|
46436 | (0, _validator.updateTag)(valueTag, computeTag);
|
46437 | this.computeRevision = (0, _validator.valueForTag)(tag);
|
46438 | }
|
46439 | }
|
46440 | }
|
46441 |
|
46442 | compute() {
|
46443 | this.computeTag = (0, _validator.track)(() => {
|
46444 | this.computeValue = this.fn(this.args);
|
46445 | }, true
|
46446 |
|
46447 | && this.env.getTemplatePathDebugContext(this));
|
46448 | }
|
46449 |
|
46450 | value() {
|
46451 | var {
|
46452 | tag,
|
46453 | computeRevision
|
46454 | } = this;
|
46455 |
|
46456 | if (computeRevision === null || !(0, _validator.validateTag)(tag, computeRevision)) {
|
46457 | this.compute();
|
46458 | (0, _validator.updateTag)(this.valueTag, this.computeTag);
|
46459 | this.computeRevision = (0, _validator.valueForTag)(tag);
|
46460 | }
|
46461 |
|
46462 | return this.computeValue;
|
46463 | }
|
46464 |
|
46465 | }
|
46466 | |
46467 |
|
46468 |
|
46469 |
|
46470 |
|
46471 |
|
46472 |
|
46473 |
|
46474 |
|
46475 |
|
46476 | _exports.HelperRootReference = HelperRootReference;
|
46477 |
|
46478 | class PropertyReference {
|
46479 | constructor(parentReference, propertyKey, env) {
|
46480 | this.parentReference = parentReference;
|
46481 | this.propertyKey = propertyKey;
|
46482 | this.env = env;
|
46483 | this.children = (0, _util.dict)();
|
46484 | this.lastRevision = null;
|
46485 |
|
46486 | if (true
|
46487 |
|
46488 | ) {
|
46489 | env.setTemplatePathDebugContext(this, propertyKey, parentReference);
|
46490 | }
|
46491 |
|
46492 | var valueTag = this.valueTag = (0, _validator.createUpdatableTag)();
|
46493 | var parentReferenceTag = parentReference.tag;
|
46494 | this.tag = (0, _validator.combine)([parentReferenceTag, valueTag]);
|
46495 | }
|
46496 |
|
46497 | value() {
|
46498 | var {
|
46499 | tag,
|
46500 | lastRevision,
|
46501 | lastValue,
|
46502 | parentReference,
|
46503 | valueTag,
|
46504 | propertyKey
|
46505 | } = this;
|
46506 |
|
46507 | if (lastRevision === null || !(0, _validator.validateTag)(tag, lastRevision)) {
|
46508 | var parentValue = parentReference.value();
|
46509 |
|
46510 | if ((0, _util.isDict)(parentValue)) {
|
46511 | var combined = (0, _validator.track)(() => {
|
46512 | lastValue = this.env.getPath(parentValue, propertyKey);
|
46513 | }, true
|
46514 |
|
46515 | && this.env.getTemplatePathDebugContext(this));
|
46516 | (0, _validator.updateTag)(valueTag, combined);
|
46517 | } else {
|
46518 | lastValue = undefined;
|
46519 | }
|
46520 |
|
46521 | this.lastValue = lastValue;
|
46522 | this.lastRevision = (0, _validator.valueForTag)(tag);
|
46523 | }
|
46524 |
|
46525 | return lastValue;
|
46526 | }
|
46527 |
|
46528 | get(key) {
|
46529 |
|
46530 |
|
46531 |
|
46532 | if (true
|
46533 |
|
46534 | ) {
|
46535 | return new PropertyReference(this, key, this.env);
|
46536 | } else {
|
46537 | var ref = this.children[key];
|
46538 |
|
46539 | if (ref === undefined) {
|
46540 | ref = this.children[key] = new PropertyReference(this, key, this.env);
|
46541 | }
|
46542 |
|
46543 | return ref;
|
46544 | }
|
46545 | }
|
46546 |
|
46547 | [UPDATE_REFERENCED_VALUE](value) {
|
46548 | var {
|
46549 | parentReference,
|
46550 | propertyKey
|
46551 | } = this;
|
46552 | var parentValue = parentReference.value();
|
46553 | this.env.setPath(parentValue, propertyKey, value);
|
46554 | }
|
46555 |
|
46556 | }
|
46557 |
|
46558 | |
46559 |
|
46560 |
|
46561 |
|
46562 |
|
46563 |
|
46564 |
|
46565 |
|
46566 |
|
46567 |
|
46568 |
|
46569 |
|
46570 |
|
46571 |
|
46572 |
|
46573 |
|
46574 |
|
46575 | _exports.PropertyReference = PropertyReference;
|
46576 |
|
46577 | class IterationItemReference {
|
46578 | constructor(parentReference, itemValue, itemKey, env) {
|
46579 | this.parentReference = parentReference;
|
46580 | this.itemValue = itemValue;
|
46581 | this.env = env;
|
46582 | this.tag = (0, _validator.createUpdatableTag)();
|
46583 | this.children = (0, _util.dict)();
|
46584 |
|
46585 | if (true
|
46586 |
|
46587 | ) {
|
46588 | env.setTemplatePathDebugContext(this, (0, _util.debugToString)(itemKey), parentReference);
|
46589 | }
|
46590 | }
|
46591 |
|
46592 | value() {
|
46593 | return this.itemValue;
|
46594 | }
|
46595 |
|
46596 | update(value) {
|
46597 | var {
|
46598 | itemValue
|
46599 | } = this;
|
46600 |
|
46601 | if (value !== itemValue) {
|
46602 | (0, _validator.dirtyTag)(this.tag);
|
46603 | this.itemValue = value;
|
46604 | }
|
46605 | }
|
46606 |
|
46607 | get(key) {
|
46608 |
|
46609 |
|
46610 |
|
46611 | if (true
|
46612 |
|
46613 | ) {
|
46614 | return new PropertyReference(this, key, this.env);
|
46615 | } else {
|
46616 | var ref = this.children[key];
|
46617 |
|
46618 | if (ref === undefined) {
|
46619 | ref = this.children[key] = new PropertyReference(this, key, this.env);
|
46620 | }
|
46621 |
|
46622 | return ref;
|
46623 | }
|
46624 | }
|
46625 |
|
46626 | }
|
46627 |
|
46628 | _exports.IterationItemReference = IterationItemReference;
|
46629 | var NULL_IDENTITY = {};
|
46630 |
|
46631 | var KEY = (_, index) => index;
|
46632 |
|
46633 | var INDEX = (_, index) => String(index);
|
46634 |
|
46635 | var IDENTITY = item => {
|
46636 | if (item === null) {
|
46637 |
|
46638 |
|
46639 | return NULL_IDENTITY;
|
46640 | }
|
46641 |
|
46642 | return item;
|
46643 | };
|
46644 |
|
46645 | function keyForPath(path, getPath) {
|
46646 | if (true
|
46647 |
|
46648 | && path[0] === '@') {
|
46649 | throw new Error(`invalid keypath: '${path}', valid keys: @index, @identity, or a path`);
|
46650 | }
|
46651 |
|
46652 | return uniqueKeyFor(item => getPath(item, path));
|
46653 | }
|
46654 |
|
46655 | function makeKeyFor(key, getPath) {
|
46656 | switch (key) {
|
46657 | case '@key':
|
46658 | return uniqueKeyFor(KEY);
|
46659 |
|
46660 | case '@index':
|
46661 | return uniqueKeyFor(INDEX);
|
46662 |
|
46663 | case '@identity':
|
46664 | return uniqueKeyFor(IDENTITY);
|
46665 |
|
46666 | default:
|
46667 | return keyForPath(key, getPath);
|
46668 | }
|
46669 | }
|
46670 |
|
46671 | class WeakMapWithPrimitives {
|
46672 | get weakMap() {
|
46673 | if (this._weakMap === undefined) {
|
46674 | this._weakMap = new WeakMap();
|
46675 | }
|
46676 |
|
46677 | return this._weakMap;
|
46678 | }
|
46679 |
|
46680 | get primitiveMap() {
|
46681 | if (this._primitiveMap === undefined) {
|
46682 | this._primitiveMap = new Map();
|
46683 | }
|
46684 |
|
46685 | return this._primitiveMap;
|
46686 | }
|
46687 |
|
46688 | set(key, value) {
|
46689 | if ((0, _util.isObject)(key) || typeof key === 'function') {
|
46690 | this.weakMap.set(key, value);
|
46691 | } else {
|
46692 | this.primitiveMap.set(key, value);
|
46693 | }
|
46694 | }
|
46695 |
|
46696 | get(key) {
|
46697 | if ((0, _util.isObject)(key) || typeof key === 'function') {
|
46698 | return this.weakMap.get(key);
|
46699 | } else {
|
46700 | return this.primitiveMap.get(key);
|
46701 | }
|
46702 | }
|
46703 |
|
46704 | }
|
46705 |
|
46706 | var IDENTITIES = new WeakMapWithPrimitives();
|
46707 |
|
46708 | function identityForNthOccurence(value, count) {
|
46709 | var identities = IDENTITIES.get(value);
|
46710 |
|
46711 | if (identities === undefined) {
|
46712 | identities = [];
|
46713 | IDENTITIES.set(value, identities);
|
46714 | }
|
46715 |
|
46716 | var identity = identities[count];
|
46717 |
|
46718 | if (identity === undefined) {
|
46719 | identity = {
|
46720 | value,
|
46721 | count
|
46722 | };
|
46723 | identities[count] = identity;
|
46724 | }
|
46725 |
|
46726 | return identity;
|
46727 | }
|
46728 | |
46729 |
|
46730 |
|
46731 |
|
46732 |
|
46733 |
|
46734 |
|
46735 |
|
46736 |
|
46737 |
|
46738 |
|
46739 |
|
46740 |
|
46741 |
|
46742 |
|
46743 |
|
46744 |
|
46745 | function uniqueKeyFor(keyFor) {
|
46746 | var seen = new WeakMapWithPrimitives();
|
46747 | return (value, memo) => {
|
46748 | var key = keyFor(value, memo);
|
46749 | var count = seen.get(key) || 0;
|
46750 | seen.set(key, count + 1);
|
46751 |
|
46752 | if (count === 0) {
|
46753 | return key;
|
46754 | }
|
46755 |
|
46756 | return identityForNthOccurence(key, count);
|
46757 | };
|
46758 | }
|
46759 |
|
46760 | class IterableReference {
|
46761 | constructor(parentRef, key, env) {
|
46762 | this.parentRef = parentRef;
|
46763 | this.key = key;
|
46764 | this.env = env;
|
46765 | this.iterator = null;
|
46766 | this.tag = parentRef.tag;
|
46767 | }
|
46768 |
|
46769 | value() {
|
46770 | return !this.isEmpty();
|
46771 | }
|
46772 |
|
46773 | isEmpty() {
|
46774 | var iterator = this.iterator = this.createIterator();
|
46775 | return iterator.isEmpty();
|
46776 | }
|
46777 |
|
46778 | next() {
|
46779 | var iterator = this.iterator;
|
46780 | var item = iterator.next();
|
46781 |
|
46782 | if (item === null) {
|
46783 | this.iterator = null;
|
46784 | }
|
46785 |
|
46786 | return item;
|
46787 | }
|
46788 |
|
46789 | createIterator() {
|
46790 | var {
|
46791 | parentRef,
|
46792 | key,
|
46793 | env
|
46794 | } = this;
|
46795 | var iterable = parentRef.value();
|
46796 | var keyFor = makeKeyFor(key, env.getPath);
|
46797 |
|
46798 | if (Array.isArray(iterable)) {
|
46799 | return new ArrayIterator(iterable, keyFor);
|
46800 | }
|
46801 |
|
46802 | var maybeIterator = env.toIterator(iterable);
|
46803 |
|
46804 | if (maybeIterator === null) {
|
46805 | return new ArrayIterator(_util.EMPTY_ARRAY, () => null);
|
46806 | }
|
46807 |
|
46808 | return new IteratorWrapper(maybeIterator, keyFor);
|
46809 | }
|
46810 |
|
46811 | childRefFor(key, value) {
|
46812 | var {
|
46813 | parentRef,
|
46814 | env
|
46815 | } = this;
|
46816 | return new IterationItemReference(parentRef, value, true
|
46817 |
|
46818 | ? `(key: ${(0, _util.debugToString)(key)}` : '', env);
|
46819 | }
|
46820 |
|
46821 | }
|
46822 |
|
46823 | _exports.IterableReference = IterableReference;
|
46824 |
|
46825 | class IteratorWrapper {
|
46826 | constructor(inner, keyFor) {
|
46827 | this.inner = inner;
|
46828 | this.keyFor = keyFor;
|
46829 | }
|
46830 |
|
46831 | isEmpty() {
|
46832 | return this.inner.isEmpty();
|
46833 | }
|
46834 |
|
46835 | next() {
|
46836 | var nextValue = this.inner.next();
|
46837 |
|
46838 | if (nextValue !== null) {
|
46839 | nextValue.key = this.keyFor(nextValue.value, nextValue.memo);
|
46840 | }
|
46841 |
|
46842 | return nextValue;
|
46843 | }
|
46844 |
|
46845 | }
|
46846 |
|
46847 | class ArrayIterator {
|
46848 | constructor(iterator, keyFor) {
|
46849 | this.iterator = iterator;
|
46850 | this.keyFor = keyFor;
|
46851 | this.pos = 0;
|
46852 |
|
46853 | if (iterator.length === 0) {
|
46854 | this.current = {
|
46855 | kind: 'empty'
|
46856 | };
|
46857 | } else {
|
46858 | this.current = {
|
46859 | kind: 'first',
|
46860 | value: iterator[this.pos]
|
46861 | };
|
46862 | }
|
46863 | }
|
46864 |
|
46865 | isEmpty() {
|
46866 | return this.current.kind === 'empty';
|
46867 | }
|
46868 |
|
46869 | next() {
|
46870 | var value;
|
46871 | var current = this.current;
|
46872 |
|
46873 | if (current.kind === 'first') {
|
46874 | this.current = {
|
46875 | kind: 'progress'
|
46876 | };
|
46877 | value = current.value;
|
46878 | } else if (this.pos >= this.iterator.length - 1) {
|
46879 | return null;
|
46880 | } else {
|
46881 | value = this.iterator[++this.pos];
|
46882 | }
|
46883 |
|
46884 | var {
|
46885 | keyFor
|
46886 | } = this;
|
46887 | var key = keyFor(value, this.pos);
|
46888 | var memo = this.pos;
|
46889 | return {
|
46890 | key,
|
46891 | value,
|
46892 | memo
|
46893 | };
|
46894 | }
|
46895 |
|
46896 | }
|
46897 | });
|
46898 | define("@glimmer/runtime", ["exports", "@glimmer/util", "@glimmer/reference", "@glimmer/validator", "@glimmer/program", "@glimmer/vm", "@glimmer/low-level"], function (_exports, _util, _reference, _validator, _program, _vm2, _lowLevel) {
|
46899 | "use strict";
|
46900 |
|
46901 | Object.defineProperty(_exports, "__esModule", {
|
46902 | value: true
|
46903 | });
|
46904 | _exports.clear = clear;
|
46905 | _exports.capabilityFlagsFrom = capabilityFlagsFrom;
|
46906 | _exports.hasCapability = hasCapability;
|
46907 | _exports.resetDebuggerCallback = resetDebuggerCallback;
|
46908 | _exports.setDebuggerCallback = setDebuggerCallback;
|
46909 | _exports.curry = curry;
|
46910 | _exports.isCurriedComponentDefinition = isCurriedComponentDefinition;
|
46911 | _exports.isWhitespace = isWhitespace;
|
46912 | _exports.normalizeProperty = normalizeProperty;
|
46913 | _exports.AotRuntime = AotRuntime;
|
46914 | _exports.JitRuntime = JitRuntime;
|
46915 | _exports.inTransaction = inTransaction;
|
46916 | _exports.getDynamicVar = getDynamicVar;
|
46917 | _exports.renderAot = renderAot;
|
46918 | _exports.renderAotComponent = renderAotComponent;
|
46919 | _exports.renderAotMain = renderAotMain;
|
46920 | _exports.renderJitComponent = renderJitComponent;
|
46921 | _exports.renderJitMain = renderJitMain;
|
46922 | _exports.renderSync = renderSync;
|
46923 | _exports.dynamicAttribute = dynamicAttribute;
|
46924 | _exports.clientBuilder = clientBuilder;
|
46925 | _exports.isSerializationFirstNode = isSerializationFirstNode;
|
46926 | _exports.rehydrationBuilder = rehydrationBuilder;
|
46927 | _exports.destroy = destroy;
|
46928 | _exports.registerDestructor = registerDestructor;
|
46929 | _exports.unregisterDestructor = unregisterDestructor;
|
46930 | _exports.associateDestroyableChild = associateDestroyableChild;
|
46931 | _exports.isDestroying = isDestroying;
|
46932 | _exports.isDestroyed = isDestroyed;
|
46933 | _exports.setScheduleDestroy = setScheduleDestroy;
|
46934 | _exports.setScheduleDestroyed = setScheduleDestroyed;
|
46935 | _exports._destroyChildren = destroyChildren;
|
46936 | _exports.TEMPLATE_ONLY_COMPONENT = _exports.SimpleComponentManager = _exports._scheduleDestroyed = _exports._scheduleDestroy = _exports.assertDestroyablesDestroyed = _exports.enableDestroyableTracking = _exports.SERIALIZATION_FIRST_NODE_STRING = _exports.RehydrateBuilder = _exports.RemoteLiveBlock = _exports.UpdatableBlockImpl = _exports.NewElementBuilder = _exports.SimpleDynamicAttribute = _exports.DynamicAttribute = _exports.CapturedPositionalArgumentsImpl = _exports.CapturedNamedArgumentsImpl = _exports.CapturedArgumentsImpl = _exports.EMPTY_ARGS = _exports.LowLevelVM = _exports.UpdatingVM = _exports.UNDEFINED_REFERENCE = _exports.PrimitiveReference = _exports.NULL_REFERENCE = _exports.ConditionalReference = _exports.ScopeImpl = _exports.EnvironmentImpl = _exports.DefaultDynamicScope = _exports.DOMTreeConstruction = _exports.IDOMChanges = _exports.DOMChanges = _exports.MINIMAL_CAPABILITIES = _exports.DEFAULT_CAPABILITIES = _exports.CurriedComponentDefinition = _exports.CursorImpl = _exports.ConcreteBounds = void 0;
|
46937 |
|
46938 |
|
46939 | var INNER_VM = (0, _util.symbol)('INNER_VM');
|
46940 | var DESTROYABLE_STACK = (0, _util.symbol)('DESTROYABLE_STACK');
|
46941 | var STACKS = (0, _util.symbol)('STACKS');
|
46942 | var REGISTERS = (0, _util.symbol)('REGISTERS');
|
46943 | var HEAP = (0, _util.symbol)('HEAP');
|
46944 | var CONSTANTS = (0, _util.symbol)('CONSTANTS');
|
46945 | var ARGS = (0, _util.symbol)('ARGS');
|
46946 | var PC = (0, _util.symbol)('PC');
|
46947 |
|
46948 | class CursorImpl {
|
46949 | constructor(element, nextSibling) {
|
46950 | this.element = element;
|
46951 | this.nextSibling = nextSibling;
|
46952 | }
|
46953 |
|
46954 | }
|
46955 |
|
46956 | _exports.CursorImpl = CursorImpl;
|
46957 |
|
46958 | class ConcreteBounds {
|
46959 | constructor(parentNode, first, last) {
|
46960 | this.parentNode = parentNode;
|
46961 | this.first = first;
|
46962 | this.last = last;
|
46963 | }
|
46964 |
|
46965 | parentElement() {
|
46966 | return this.parentNode;
|
46967 | }
|
46968 |
|
46969 | firstNode() {
|
46970 | return this.first;
|
46971 | }
|
46972 |
|
46973 | lastNode() {
|
46974 | return this.last;
|
46975 | }
|
46976 |
|
46977 | }
|
46978 |
|
46979 | _exports.ConcreteBounds = ConcreteBounds;
|
46980 |
|
46981 | class SingleNodeBounds {
|
46982 | constructor(parentNode, node) {
|
46983 | this.parentNode = parentNode;
|
46984 | this.node = node;
|
46985 | }
|
46986 |
|
46987 | parentElement() {
|
46988 | return this.parentNode;
|
46989 | }
|
46990 |
|
46991 | firstNode() {
|
46992 | return this.node;
|
46993 | }
|
46994 |
|
46995 | lastNode() {
|
46996 | return this.node;
|
46997 | }
|
46998 |
|
46999 | }
|
47000 |
|
47001 | function move(bounds, reference) {
|
47002 | var parent = bounds.parentElement();
|
47003 | var first = bounds.firstNode();
|
47004 | var last = bounds.lastNode();
|
47005 | var current = first;
|
47006 |
|
47007 | while (true) {
|
47008 | var next = current.nextSibling;
|
47009 | parent.insertBefore(current, reference);
|
47010 |
|
47011 | if (current === last) {
|
47012 | return next;
|
47013 | }
|
47014 |
|
47015 | current = next;
|
47016 | }
|
47017 | }
|
47018 |
|
47019 | function clear(bounds) {
|
47020 | var parent = bounds.parentElement();
|
47021 | var first = bounds.firstNode();
|
47022 | var last = bounds.lastNode();
|
47023 | var current = first;
|
47024 |
|
47025 | while (true) {
|
47026 | var next = current.nextSibling;
|
47027 | parent.removeChild(current);
|
47028 |
|
47029 | if (current === last) {
|
47030 | return next;
|
47031 | }
|
47032 |
|
47033 | current = next;
|
47034 | }
|
47035 | }
|
47036 |
|
47037 | var DESTROYABLE_META = new WeakMap();
|
47038 |
|
47039 | function push(collection, newItem) {
|
47040 | if (collection === null) {
|
47041 | return newItem;
|
47042 | } else if (Array.isArray(collection)) {
|
47043 | collection.push(newItem);
|
47044 | return collection;
|
47045 | } else {
|
47046 | return [collection, newItem];
|
47047 | }
|
47048 | }
|
47049 |
|
47050 | function iterate(collection, fn) {
|
47051 | if (Array.isArray(collection)) {
|
47052 | for (var i = 0; i < collection.length; i++) {
|
47053 | fn(collection[i]);
|
47054 | }
|
47055 | } else if (collection !== null) {
|
47056 | fn(collection);
|
47057 | }
|
47058 | }
|
47059 |
|
47060 | function remove(collection, item, message) {
|
47061 | if (true
|
47062 |
|
47063 | ) {
|
47064 | var collectionIsItem = collection === item;
|
47065 | var collectionContainsItem = Array.isArray(collection) && collection.indexOf(item) !== -1;
|
47066 |
|
47067 | if (!collectionIsItem && !collectionContainsItem) {
|
47068 | throw new Error(String(message));
|
47069 | }
|
47070 | }
|
47071 |
|
47072 | if (Array.isArray(collection) && collection.length > 1) {
|
47073 | var index = collection.indexOf(item);
|
47074 | collection.splice(index, 1);
|
47075 | return collection;
|
47076 | } else {
|
47077 | return null;
|
47078 | }
|
47079 | }
|
47080 |
|
47081 | function getDestroyableMeta(destroyable) {
|
47082 | var meta = DESTROYABLE_META.get(destroyable);
|
47083 |
|
47084 | if (meta === undefined) {
|
47085 | meta = {
|
47086 | parents: null,
|
47087 | children: null,
|
47088 | eagerDestructors: null,
|
47089 | destructors: null,
|
47090 | state: 0
|
47091 |
|
47092 |
|
47093 | };
|
47094 |
|
47095 | if (true
|
47096 |
|
47097 | ) {
|
47098 | meta.source = destroyable;
|
47099 | }
|
47100 |
|
47101 | DESTROYABLE_META.set(destroyable, meta);
|
47102 | }
|
47103 |
|
47104 | return meta;
|
47105 | }
|
47106 |
|
47107 | function associateDestroyableChild(parent, child) {
|
47108 | if (true
|
47109 |
|
47110 | && isDestroying(parent)) {
|
47111 | throw new Error('Attempted to associate a destroyable child with an object that is already destroying or destroyed');
|
47112 | }
|
47113 |
|
47114 | var parentMeta = getDestroyableMeta(parent);
|
47115 | var childMeta = getDestroyableMeta(child);
|
47116 | parentMeta.children = push(parentMeta.children, child);
|
47117 | childMeta.parents = push(childMeta.parents, parent);
|
47118 | return child;
|
47119 | }
|
47120 |
|
47121 | function registerDestructor(destroyable, destructor, eager = false) {
|
47122 | if (true
|
47123 |
|
47124 | && isDestroying(destroyable)) {
|
47125 | throw new Error('Attempted to register a destructor with an object that is already destroying or destroyed');
|
47126 | }
|
47127 |
|
47128 | var meta = getDestroyableMeta(destroyable);
|
47129 | var destructorsKey = eager === true ? 'eagerDestructors' : 'destructors';
|
47130 | meta[destructorsKey] = push(meta[destructorsKey], destructor);
|
47131 | return destructor;
|
47132 | }
|
47133 |
|
47134 | function unregisterDestructor(destroyable, destructor, eager = false) {
|
47135 | if (true
|
47136 |
|
47137 | && isDestroying(destroyable)) {
|
47138 | throw new Error('Attempted to unregister a destructor with an object that is already destroying or destroyed');
|
47139 | }
|
47140 |
|
47141 | var meta = getDestroyableMeta(destroyable);
|
47142 | var destructorsKey = eager === true ? 'eagerDestructors' : 'destructors';
|
47143 | meta[destructorsKey] = remove(meta[destructorsKey], destructor, true
|
47144 |
|
47145 | && 'attempted to remove a destructor that was not registered with the destroyable');
|
47146 | }
|
47147 |
|
47148 |
|
47149 | var scheduleDestroy = true
|
47150 |
|
47151 | ? () => {
|
47152 | throw new Error('Must provide a scheduleDestroy method');
|
47153 | } : () => {};
|
47154 | _exports._scheduleDestroy = scheduleDestroy;
|
47155 | var scheduleDestroyed = true
|
47156 |
|
47157 | ? () => {
|
47158 | throw new Error('Must provide a scheduleDestroyed method');
|
47159 | } : () => {};
|
47160 | _exports._scheduleDestroyed = scheduleDestroyed;
|
47161 |
|
47162 | function destroy(destroyable) {
|
47163 | var meta = getDestroyableMeta(destroyable);
|
47164 | if (meta.state >= 1
|
47165 |
|
47166 | ) return;
|
47167 | var {
|
47168 | parents,
|
47169 | children,
|
47170 | eagerDestructors,
|
47171 | destructors
|
47172 | } = meta;
|
47173 | meta.state = 1
|
47174 |
|
47175 | ;
|
47176 | iterate(children, destroy);
|
47177 | iterate(eagerDestructors, destructor => destructor(destroyable));
|
47178 | iterate(destructors, destructor => scheduleDestroy(destroyable, destructor));
|
47179 | scheduleDestroyed(() => {
|
47180 | iterate(parents, parent => removeChildFromParent(destroyable, parent));
|
47181 | meta.state = 2
|
47182 |
|
47183 | ;
|
47184 | });
|
47185 | }
|
47186 |
|
47187 | function removeChildFromParent(child, parent) {
|
47188 | var parentMeta = getDestroyableMeta(parent);
|
47189 |
|
47190 | if (parentMeta.state === 0
|
47191 |
|
47192 | ) {
|
47193 | parentMeta.children = remove(parentMeta.children, child, true
|
47194 |
|
47195 | && "attempted to remove child from parent, but the parent's children did not contain the child. This is likely a bug with destructors.");
|
47196 | }
|
47197 | }
|
47198 |
|
47199 | function destroyChildren(destroyable) {
|
47200 | var {
|
47201 | children
|
47202 | } = getDestroyableMeta(destroyable);
|
47203 | iterate(children, destroy);
|
47204 | }
|
47205 |
|
47206 | function setScheduleDestroy(fn) {
|
47207 | _exports._scheduleDestroy = scheduleDestroy = fn;
|
47208 | }
|
47209 |
|
47210 | function setScheduleDestroyed(fn) {
|
47211 | _exports._scheduleDestroyed = scheduleDestroyed = fn;
|
47212 | }
|
47213 |
|
47214 | function isDestroying(destroyable) {
|
47215 | var meta = DESTROYABLE_META.get(destroyable);
|
47216 | return meta === undefined ? false : meta.state >= 1
|
47217 |
|
47218 | ;
|
47219 | }
|
47220 |
|
47221 | function isDestroyed(destroyable) {
|
47222 | var meta = DESTROYABLE_META.get(destroyable);
|
47223 | return meta === undefined ? false : meta.state >= 2
|
47224 |
|
47225 | ;
|
47226 | }
|
47227 |
|
47228 |
|
47229 | var enableDestroyableTracking;
|
47230 | _exports.enableDestroyableTracking = enableDestroyableTracking;
|
47231 | var assertDestroyablesDestroyed;
|
47232 | _exports.assertDestroyablesDestroyed = assertDestroyablesDestroyed;
|
47233 |
|
47234 | if (true
|
47235 |
|
47236 | ) {
|
47237 | var isTesting = false;
|
47238 |
|
47239 | _exports.enableDestroyableTracking = enableDestroyableTracking = () => {
|
47240 | if (isTesting) {
|
47241 | throw new Error('Attempted to start destroyable testing, but you did not end the previous destroyable test. Did you forget to call `assertDestroyablesDestroyed()`');
|
47242 | }
|
47243 |
|
47244 | isTesting = true;
|
47245 | DESTROYABLE_META = new Map();
|
47246 | };
|
47247 |
|
47248 | _exports.assertDestroyablesDestroyed = assertDestroyablesDestroyed = () => {
|
47249 | if (!isTesting) {
|
47250 | throw new Error('Attempted to assert destroyables destroyed, but you did not start a destroyable test. Did you forget to call `enableDestroyableTracking()`');
|
47251 | }
|
47252 |
|
47253 | isTesting = false;
|
47254 | var map = DESTROYABLE_META;
|
47255 | DESTROYABLE_META = new WeakMap();
|
47256 | var undestroyed = [];
|
47257 | map.forEach(meta => {
|
47258 | if (meta.state !== 2
|
47259 |
|
47260 | ) {
|
47261 | undestroyed.push(meta.source);
|
47262 | }
|
47263 | });
|
47264 |
|
47265 | if (undestroyed.length > 0) {
|
47266 | var objectsToString = undestroyed.map(_util.debugToString).join('\n ');
|
47267 | var error = new Error(`Some destroyables were not destroyed during this test:\n ${objectsToString}`);
|
47268 | error.destroyables = undestroyed;
|
47269 | throw error;
|
47270 | }
|
47271 | };
|
47272 | }
|
47273 |
|
47274 | var _a;
|
47275 |
|
47276 | class First {
|
47277 | constructor(node) {
|
47278 | this.node = node;
|
47279 | }
|
47280 |
|
47281 | firstNode() {
|
47282 | return this.node;
|
47283 | }
|
47284 |
|
47285 | }
|
47286 |
|
47287 | class Last {
|
47288 | constructor(node) {
|
47289 | this.node = node;
|
47290 | }
|
47291 |
|
47292 | lastNode() {
|
47293 | return this.node;
|
47294 | }
|
47295 |
|
47296 | }
|
47297 |
|
47298 | var CURSOR_STACK = (0, _util.symbol)('CURSOR_STACK');
|
47299 |
|
47300 | class NewElementBuilder {
|
47301 | constructor(env, parentNode, nextSibling) {
|
47302 | this.constructing = null;
|
47303 | this.operations = null;
|
47304 | this[_a] = new _util.Stack();
|
47305 | this.modifierStack = new _util.Stack();
|
47306 | this.blockStack = new _util.Stack();
|
47307 | this.pushElement(parentNode, nextSibling);
|
47308 | this.env = env;
|
47309 | this.dom = env.getAppendOperations();
|
47310 | this.updateOperations = env.getDOM();
|
47311 | }
|
47312 |
|
47313 | static forInitialRender(env, cursor) {
|
47314 | return new this(env, cursor.element, cursor.nextSibling).initialize();
|
47315 | }
|
47316 |
|
47317 | static resume(env, block) {
|
47318 | var parentNode = block.parentElement();
|
47319 | var nextSibling = block.reset(env);
|
47320 | var stack = new this(env, parentNode, nextSibling).initialize();
|
47321 | stack.pushLiveBlock(block);
|
47322 | return stack;
|
47323 | }
|
47324 |
|
47325 | initialize() {
|
47326 | this.pushSimpleBlock();
|
47327 | return this;
|
47328 | }
|
47329 |
|
47330 | debugBlocks() {
|
47331 | return this.blockStack.toArray();
|
47332 | }
|
47333 |
|
47334 | get element() {
|
47335 | return this[CURSOR_STACK].current.element;
|
47336 | }
|
47337 |
|
47338 | get nextSibling() {
|
47339 | return this[CURSOR_STACK].current.nextSibling;
|
47340 | }
|
47341 |
|
47342 | get hasBlocks() {
|
47343 | return this.blockStack.size > 0;
|
47344 | }
|
47345 |
|
47346 | block() {
|
47347 | return this.blockStack.current;
|
47348 | }
|
47349 |
|
47350 | popElement() {
|
47351 | this[CURSOR_STACK].pop();
|
47352 | this[CURSOR_STACK].current;
|
47353 | }
|
47354 |
|
47355 | pushSimpleBlock() {
|
47356 | return this.pushLiveBlock(new SimpleLiveBlock(this.element));
|
47357 | }
|
47358 |
|
47359 | pushUpdatableBlock() {
|
47360 | return this.pushLiveBlock(new UpdatableBlockImpl(this.element));
|
47361 | }
|
47362 |
|
47363 | pushBlockList(list) {
|
47364 | return this.pushLiveBlock(new LiveBlockList(this.element, list));
|
47365 | }
|
47366 |
|
47367 | pushLiveBlock(block, isRemote = false) {
|
47368 | var current = this.blockStack.current;
|
47369 |
|
47370 | if (current !== null) {
|
47371 | if (!isRemote) {
|
47372 | current.didAppendBounds(block);
|
47373 | }
|
47374 | }
|
47375 |
|
47376 | this.__openBlock();
|
47377 |
|
47378 | this.blockStack.push(block);
|
47379 | return block;
|
47380 | }
|
47381 |
|
47382 | popBlock() {
|
47383 | this.block().finalize(this);
|
47384 |
|
47385 | this.__closeBlock();
|
47386 |
|
47387 | return this.blockStack.pop();
|
47388 | }
|
47389 |
|
47390 | __openBlock() {}
|
47391 |
|
47392 | __closeBlock() {}
|
47393 |
|
47394 |
|
47395 | openElement(tag) {
|
47396 | var element = this.__openElement(tag);
|
47397 |
|
47398 | this.constructing = element;
|
47399 | return element;
|
47400 | }
|
47401 |
|
47402 | __openElement(tag) {
|
47403 | return this.dom.createElement(tag, this.element);
|
47404 | }
|
47405 |
|
47406 | flushElement(modifiers) {
|
47407 | var parent = this.element;
|
47408 | var element = this.constructing;
|
47409 |
|
47410 | this.__flushElement(parent, element);
|
47411 |
|
47412 | this.constructing = null;
|
47413 | this.operations = null;
|
47414 | this.pushModifiers(modifiers);
|
47415 | this.pushElement(element, null);
|
47416 | this.didOpenElement(element);
|
47417 | }
|
47418 |
|
47419 | __flushElement(parent, constructing) {
|
47420 | this.dom.insertBefore(parent, constructing, this.nextSibling);
|
47421 | }
|
47422 |
|
47423 | closeElement() {
|
47424 | this.willCloseElement();
|
47425 | this.popElement();
|
47426 | return this.popModifiers();
|
47427 | }
|
47428 |
|
47429 | pushRemoteElement(element, guid, insertBefore) {
|
47430 | return this.__pushRemoteElement(element, guid, insertBefore);
|
47431 | }
|
47432 |
|
47433 | __pushRemoteElement(element, _guid, insertBefore) {
|
47434 | this.pushElement(element, insertBefore);
|
47435 |
|
47436 | if (insertBefore === undefined) {
|
47437 | while (element.lastChild) {
|
47438 | element.removeChild(element.lastChild);
|
47439 | }
|
47440 | }
|
47441 |
|
47442 | var block = new RemoteLiveBlock(element);
|
47443 | return this.pushLiveBlock(block, true);
|
47444 | }
|
47445 |
|
47446 | popRemoteElement() {
|
47447 | this.popBlock();
|
47448 | this.popElement();
|
47449 | }
|
47450 |
|
47451 | pushElement(element, nextSibling = null) {
|
47452 | this[CURSOR_STACK].push(new CursorImpl(element, nextSibling));
|
47453 | }
|
47454 |
|
47455 | pushModifiers(modifiers) {
|
47456 | this.modifierStack.push(modifiers);
|
47457 | }
|
47458 |
|
47459 | popModifiers() {
|
47460 | return this.modifierStack.pop();
|
47461 | }
|
47462 |
|
47463 | didAppendBounds(bounds) {
|
47464 | this.block().didAppendBounds(bounds);
|
47465 | return bounds;
|
47466 | }
|
47467 |
|
47468 | didAppendNode(node) {
|
47469 | this.block().didAppendNode(node);
|
47470 | return node;
|
47471 | }
|
47472 |
|
47473 | didOpenElement(element) {
|
47474 | this.block().openElement(element);
|
47475 | return element;
|
47476 | }
|
47477 |
|
47478 | willCloseElement() {
|
47479 | this.block().closeElement();
|
47480 | }
|
47481 |
|
47482 | appendText(string) {
|
47483 | return this.didAppendNode(this.__appendText(string));
|
47484 | }
|
47485 |
|
47486 | __appendText(text) {
|
47487 | var {
|
47488 | dom,
|
47489 | element,
|
47490 | nextSibling
|
47491 | } = this;
|
47492 | var node = dom.createTextNode(text);
|
47493 | dom.insertBefore(element, node, nextSibling);
|
47494 | return node;
|
47495 | }
|
47496 |
|
47497 | __appendNode(node) {
|
47498 | this.dom.insertBefore(this.element, node, this.nextSibling);
|
47499 | return node;
|
47500 | }
|
47501 |
|
47502 | __appendFragment(fragment) {
|
47503 | var first = fragment.firstChild;
|
47504 |
|
47505 | if (first) {
|
47506 | var ret = new ConcreteBounds(this.element, first, fragment.lastChild);
|
47507 | this.dom.insertBefore(this.element, fragment, this.nextSibling);
|
47508 | return ret;
|
47509 | } else {
|
47510 | return new SingleNodeBounds(this.element, this.__appendComment(''));
|
47511 | }
|
47512 | }
|
47513 |
|
47514 | __appendHTML(html) {
|
47515 | return this.dom.insertHTMLBefore(this.element, this.nextSibling, html);
|
47516 | }
|
47517 |
|
47518 | appendDynamicHTML(value) {
|
47519 | var bounds = this.trustedContent(value);
|
47520 | this.didAppendBounds(bounds);
|
47521 | }
|
47522 |
|
47523 | appendDynamicText(value) {
|
47524 | var node = this.untrustedContent(value);
|
47525 | this.didAppendNode(node);
|
47526 | return node;
|
47527 | }
|
47528 |
|
47529 | appendDynamicFragment(value) {
|
47530 | var bounds = this.__appendFragment(value);
|
47531 |
|
47532 | this.didAppendBounds(bounds);
|
47533 | }
|
47534 |
|
47535 | appendDynamicNode(value) {
|
47536 | var node = this.__appendNode(value);
|
47537 |
|
47538 | var bounds = new SingleNodeBounds(this.element, node);
|
47539 | this.didAppendBounds(bounds);
|
47540 | }
|
47541 |
|
47542 | trustedContent(value) {
|
47543 | return this.__appendHTML(value);
|
47544 | }
|
47545 |
|
47546 | untrustedContent(value) {
|
47547 | return this.__appendText(value);
|
47548 | }
|
47549 |
|
47550 | appendComment(string) {
|
47551 | return this.didAppendNode(this.__appendComment(string));
|
47552 | }
|
47553 |
|
47554 | __appendComment(string) {
|
47555 | var {
|
47556 | dom,
|
47557 | element,
|
47558 | nextSibling
|
47559 | } = this;
|
47560 | var node = dom.createComment(string);
|
47561 | dom.insertBefore(element, node, nextSibling);
|
47562 | return node;
|
47563 | }
|
47564 |
|
47565 | __setAttribute(name, value, namespace) {
|
47566 | this.dom.setAttribute(this.constructing, name, value, namespace);
|
47567 | }
|
47568 |
|
47569 | __setProperty(name, value) {
|
47570 | this.constructing[name] = value;
|
47571 | }
|
47572 |
|
47573 | setStaticAttribute(name, value, namespace) {
|
47574 | this.__setAttribute(name, value, namespace);
|
47575 | }
|
47576 |
|
47577 | setDynamicAttribute(name, value, trusting, namespace) {
|
47578 | var element = this.constructing;
|
47579 | var attribute = this.env.attributeFor(element, name, trusting, namespace);
|
47580 | attribute.set(this, value, this.env);
|
47581 | return attribute;
|
47582 | }
|
47583 |
|
47584 | }
|
47585 |
|
47586 | _exports.NewElementBuilder = NewElementBuilder;
|
47587 | _a = CURSOR_STACK;
|
47588 |
|
47589 | class SimpleLiveBlock {
|
47590 | constructor(parent) {
|
47591 | this.parent = parent;
|
47592 | this.first = null;
|
47593 | this.last = null;
|
47594 | this.nesting = 0;
|
47595 | }
|
47596 |
|
47597 | parentElement() {
|
47598 | return this.parent;
|
47599 | }
|
47600 |
|
47601 | firstNode() {
|
47602 | var first = this.first;
|
47603 | return first.firstNode();
|
47604 | }
|
47605 |
|
47606 | lastNode() {
|
47607 | var last = this.last;
|
47608 | return last.lastNode();
|
47609 | }
|
47610 |
|
47611 | openElement(element) {
|
47612 | this.didAppendNode(element);
|
47613 | this.nesting++;
|
47614 | }
|
47615 |
|
47616 | closeElement() {
|
47617 | this.nesting--;
|
47618 | }
|
47619 |
|
47620 | didAppendNode(node) {
|
47621 | if (this.nesting !== 0) return;
|
47622 |
|
47623 | if (!this.first) {
|
47624 | this.first = new First(node);
|
47625 | }
|
47626 |
|
47627 | this.last = new Last(node);
|
47628 | }
|
47629 |
|
47630 | didAppendBounds(bounds) {
|
47631 | if (this.nesting !== 0) return;
|
47632 |
|
47633 | if (!this.first) {
|
47634 | this.first = bounds;
|
47635 | }
|
47636 |
|
47637 | this.last = bounds;
|
47638 | }
|
47639 |
|
47640 | finalize(stack) {
|
47641 | if (this.first === null) {
|
47642 | stack.appendComment('');
|
47643 | }
|
47644 | }
|
47645 |
|
47646 | }
|
47647 |
|
47648 | class RemoteLiveBlock extends SimpleLiveBlock {
|
47649 | constructor(parent) {
|
47650 | super(parent);
|
47651 | registerDestructor(this, () => {
|
47652 |
|
47653 |
|
47654 |
|
47655 |
|
47656 |
|
47657 |
|
47658 |
|
47659 |
|
47660 |
|
47661 |
|
47662 |
|
47663 |
|
47664 |
|
47665 |
|
47666 |
|
47667 |
|
47668 |
|
47669 |
|
47670 |
|
47671 |
|
47672 |
|
47673 |
|
47674 |
|
47675 |
|
47676 | if (this.parentElement() === this.firstNode().parentNode) {
|
47677 | clear(this);
|
47678 | }
|
47679 | });
|
47680 | }
|
47681 |
|
47682 | }
|
47683 |
|
47684 | _exports.RemoteLiveBlock = RemoteLiveBlock;
|
47685 |
|
47686 | class UpdatableBlockImpl extends SimpleLiveBlock {
|
47687 | reset() {
|
47688 | destroy(this);
|
47689 | var nextSibling = clear(this);
|
47690 | this.first = null;
|
47691 | this.last = null;
|
47692 | this.nesting = 0;
|
47693 | return nextSibling;
|
47694 | }
|
47695 |
|
47696 | }
|
47697 |
|
47698 |
|
47699 | _exports.UpdatableBlockImpl = UpdatableBlockImpl;
|
47700 |
|
47701 | class LiveBlockList {
|
47702 | constructor(parent, boundList) {
|
47703 | this.parent = parent;
|
47704 | this.boundList = boundList;
|
47705 | this.parent = parent;
|
47706 | this.boundList = boundList;
|
47707 | }
|
47708 |
|
47709 | parentElement() {
|
47710 | return this.parent;
|
47711 | }
|
47712 |
|
47713 | firstNode() {
|
47714 | var head = this.boundList[0];
|
47715 | return head.firstNode();
|
47716 | }
|
47717 |
|
47718 | lastNode() {
|
47719 | var boundList = this.boundList;
|
47720 | var tail = boundList[boundList.length - 1];
|
47721 | return tail.lastNode();
|
47722 | }
|
47723 |
|
47724 | openElement(_element) {}
|
47725 |
|
47726 | closeElement() {}
|
47727 |
|
47728 | didAppendNode(_node) {}
|
47729 |
|
47730 | didAppendBounds(_bounds) {}
|
47731 |
|
47732 | finalize(_stack) {}
|
47733 |
|
47734 | }
|
47735 |
|
47736 | function clientBuilder(env, cursor) {
|
47737 | return NewElementBuilder.forInitialRender(env, cursor);
|
47738 | }
|
47739 |
|
47740 |
|
47741 | var SVG_INTEGRATION_POINTS = {
|
47742 | foreignObject: 1,
|
47743 | desc: 1,
|
47744 | title: 1
|
47745 | };
|
47746 |
|
47747 |
|
47748 |
|
47749 |
|
47750 |
|
47751 | var BLACKLIST_TABLE = Object.create(null);
|
47752 |
|
47753 | class DOMOperations {
|
47754 | constructor(document) {
|
47755 | this.document = document;
|
47756 | this.setupUselessElement();
|
47757 | }
|
47758 |
|
47759 |
|
47760 |
|
47761 | setupUselessElement() {
|
47762 | this.uselessElement = this.document.createElement('div');
|
47763 | }
|
47764 |
|
47765 | createElement(tag, context) {
|
47766 | var isElementInSVGNamespace, isHTMLIntegrationPoint;
|
47767 |
|
47768 | if (context) {
|
47769 | isElementInSVGNamespace = context.namespaceURI === "http://www.w3.org/2000/svg"
|
47770 |
|
47771 | || tag === 'svg';
|
47772 | isHTMLIntegrationPoint = !!SVG_INTEGRATION_POINTS[context.tagName];
|
47773 | } else {
|
47774 | isElementInSVGNamespace = tag === 'svg';
|
47775 | isHTMLIntegrationPoint = false;
|
47776 | }
|
47777 |
|
47778 | if (isElementInSVGNamespace && !isHTMLIntegrationPoint) {
|
47779 |
|
47780 |
|
47781 |
|
47782 | if (BLACKLIST_TABLE[tag]) {
|
47783 | throw new Error(`Cannot create a ${tag} inside an SVG context`);
|
47784 | }
|
47785 |
|
47786 | return this.document.createElementNS("http://www.w3.org/2000/svg"
|
47787 |
|
47788 | , tag);
|
47789 | } else {
|
47790 | return this.document.createElement(tag);
|
47791 | }
|
47792 | }
|
47793 |
|
47794 | insertBefore(parent, node, reference) {
|
47795 | parent.insertBefore(node, reference);
|
47796 | }
|
47797 |
|
47798 | insertHTMLBefore(parent, nextSibling, html) {
|
47799 | if (html === '') {
|
47800 | var comment = this.createComment('');
|
47801 | parent.insertBefore(comment, nextSibling);
|
47802 | return new ConcreteBounds(parent, comment, comment);
|
47803 | }
|
47804 |
|
47805 | var prev = nextSibling ? nextSibling.previousSibling : parent.lastChild;
|
47806 | var last;
|
47807 |
|
47808 | if (nextSibling === null) {
|
47809 | parent.insertAdjacentHTML("beforeend"
|
47810 |
|
47811 | , html);
|
47812 | last = parent.lastChild;
|
47813 | } else if (nextSibling instanceof HTMLElement) {
|
47814 | nextSibling.insertAdjacentHTML('beforebegin', html);
|
47815 | last = nextSibling.previousSibling;
|
47816 | } else {
|
47817 |
|
47818 |
|
47819 |
|
47820 |
|
47821 |
|
47822 | var {
|
47823 | uselessElement
|
47824 | } = this;
|
47825 | parent.insertBefore(uselessElement, nextSibling);
|
47826 | uselessElement.insertAdjacentHTML("beforebegin"
|
47827 |
|
47828 | , html);
|
47829 | last = uselessElement.previousSibling;
|
47830 | parent.removeChild(uselessElement);
|
47831 | }
|
47832 |
|
47833 | var first = prev ? prev.nextSibling : parent.firstChild;
|
47834 | return new ConcreteBounds(parent, first, last);
|
47835 | }
|
47836 |
|
47837 | createTextNode(text) {
|
47838 | return this.document.createTextNode(text);
|
47839 | }
|
47840 |
|
47841 | createComment(data) {
|
47842 | return this.document.createComment(data);
|
47843 | }
|
47844 |
|
47845 | }
|
47846 |
|
47847 | function moveNodesBefore(source, target, nextSibling) {
|
47848 | var first = source.firstChild;
|
47849 | var last = first;
|
47850 | var current = first;
|
47851 |
|
47852 | while (current) {
|
47853 | var next = current.nextSibling;
|
47854 | target.insertBefore(current, nextSibling);
|
47855 | last = current;
|
47856 | current = next;
|
47857 | }
|
47858 |
|
47859 | return new ConcreteBounds(target, first, last);
|
47860 | }
|
47861 |
|
47862 | var SVG_NAMESPACE = "http://www.w3.org/2000/svg"
|
47863 |
|
47864 | ;
|
47865 |
|
47866 |
|
47867 |
|
47868 |
|
47869 |
|
47870 |
|
47871 |
|
47872 |
|
47873 |
|
47874 |
|
47875 |
|
47876 | function applySVGInnerHTMLFix(document, DOMClass, svgNamespace) {
|
47877 | if (!document) return DOMClass;
|
47878 |
|
47879 | if (!shouldApplyFix(document, svgNamespace)) {
|
47880 | return DOMClass;
|
47881 | }
|
47882 |
|
47883 | var div = document.createElement('div');
|
47884 | return class DOMChangesWithSVGInnerHTMLFix extends DOMClass {
|
47885 | insertHTMLBefore(parent, nextSibling, html) {
|
47886 | if (html === '') {
|
47887 | return super.insertHTMLBefore(parent, nextSibling, html);
|
47888 | }
|
47889 |
|
47890 | if (parent.namespaceURI !== svgNamespace) {
|
47891 | return super.insertHTMLBefore(parent, nextSibling, html);
|
47892 | }
|
47893 |
|
47894 | return fixSVG(parent, div, html, nextSibling);
|
47895 | }
|
47896 |
|
47897 | };
|
47898 | }
|
47899 |
|
47900 | function fixSVG(parent, div, html, reference) {
|
47901 | var source;
|
47902 |
|
47903 |
|
47904 | if (parent.tagName.toUpperCase() === 'FOREIGNOBJECT') {
|
47905 |
|
47906 |
|
47907 | var wrappedHtml = '<svg><foreignObject>' + html + '</foreignObject></svg>';
|
47908 | (0, _util.clearElement)(div);
|
47909 | div.insertAdjacentHTML("afterbegin"
|
47910 |
|
47911 | , wrappedHtml);
|
47912 | source = div.firstChild.firstChild;
|
47913 | } else {
|
47914 |
|
47915 |
|
47916 | var _wrappedHtml = '<svg>' + html + '</svg>';
|
47917 |
|
47918 | (0, _util.clearElement)(div);
|
47919 | div.insertAdjacentHTML("afterbegin"
|
47920 |
|
47921 | , _wrappedHtml);
|
47922 | source = div.firstChild;
|
47923 | }
|
47924 |
|
47925 | return moveNodesBefore(source, parent, reference);
|
47926 | }
|
47927 |
|
47928 | function shouldApplyFix(document, svgNamespace) {
|
47929 | var svg = document.createElementNS(svgNamespace, 'svg');
|
47930 |
|
47931 | try {
|
47932 | svg.insertAdjacentHTML("beforeend"
|
47933 |
|
47934 | , '<circle></circle>');
|
47935 | } catch (e) {
|
47936 |
|
47937 | } finally {
|
47938 |
|
47939 | if (svg.childNodes.length === 1 && svg.firstChild.namespaceURI === SVG_NAMESPACE) {
|
47940 |
|
47941 | return false;
|
47942 | }
|
47943 |
|
47944 | return true;
|
47945 | }
|
47946 | }
|
47947 |
|
47948 |
|
47949 |
|
47950 |
|
47951 |
|
47952 |
|
47953 |
|
47954 |
|
47955 |
|
47956 |
|
47957 |
|
47958 |
|
47959 |
|
47960 | function applyTextNodeMergingFix(document, DOMClass) {
|
47961 | if (!document) return DOMClass;
|
47962 |
|
47963 | if (!shouldApplyFix$1(document)) {
|
47964 | return DOMClass;
|
47965 | }
|
47966 |
|
47967 | return class DOMChangesWithTextNodeMergingFix extends DOMClass {
|
47968 | constructor(document) {
|
47969 | super(document);
|
47970 | this.uselessComment = document.createComment('');
|
47971 | }
|
47972 |
|
47973 | insertHTMLBefore(parent, nextSibling, html) {
|
47974 | if (html === '') {
|
47975 | return super.insertHTMLBefore(parent, nextSibling, html);
|
47976 | }
|
47977 |
|
47978 | var didSetUselessComment = false;
|
47979 | var nextPrevious = nextSibling ? nextSibling.previousSibling : parent.lastChild;
|
47980 |
|
47981 | if (nextPrevious && nextPrevious instanceof Text) {
|
47982 | didSetUselessComment = true;
|
47983 | parent.insertBefore(this.uselessComment, nextSibling);
|
47984 | }
|
47985 |
|
47986 | var bounds = super.insertHTMLBefore(parent, nextSibling, html);
|
47987 |
|
47988 | if (didSetUselessComment) {
|
47989 | parent.removeChild(this.uselessComment);
|
47990 | }
|
47991 |
|
47992 | return bounds;
|
47993 | }
|
47994 |
|
47995 | };
|
47996 | }
|
47997 |
|
47998 | function shouldApplyFix$1(document) {
|
47999 | var mergingTextDiv = document.createElement('div');
|
48000 | mergingTextDiv.appendChild(document.createTextNode('first'));
|
48001 | mergingTextDiv.insertAdjacentHTML("beforeend"
|
48002 |
|
48003 | , 'second');
|
48004 |
|
48005 | if (mergingTextDiv.childNodes.length === 2) {
|
48006 |
|
48007 | return false;
|
48008 | }
|
48009 |
|
48010 | return true;
|
48011 | }
|
48012 |
|
48013 | ['b', 'big', 'blockquote', 'body', 'br', 'center', 'code', 'dd', 'div', 'dl', 'dt', 'em', 'embed', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', 'i', 'img', 'li', 'listing', 'main', 'meta', 'nobr', 'ol', 'p', 'pre', 'ruby', 's', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'table', 'tt', 'u', 'ul', 'var'].forEach(tag => BLACKLIST_TABLE[tag] = 1);
|
48014 | var WHITESPACE = /[\t-\r \xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/;
|
48015 | var doc = typeof document === 'undefined' ? null : document;
|
48016 |
|
48017 | function isWhitespace(string) {
|
48018 | return WHITESPACE.test(string);
|
48019 | }
|
48020 |
|
48021 | var DOM;
|
48022 |
|
48023 | (function (DOM) {
|
48024 | class TreeConstruction extends DOMOperations {
|
48025 | createElementNS(namespace, tag) {
|
48026 | return this.document.createElementNS(namespace, tag);
|
48027 | }
|
48028 |
|
48029 | setAttribute(element, name, value, namespace = null) {
|
48030 | if (namespace) {
|
48031 | element.setAttributeNS(namespace, name, value);
|
48032 | } else {
|
48033 | element.setAttribute(name, value);
|
48034 | }
|
48035 | }
|
48036 |
|
48037 | }
|
48038 |
|
48039 | DOM.TreeConstruction = TreeConstruction;
|
48040 | var appliedTreeContruction = TreeConstruction;
|
48041 | appliedTreeContruction = applyTextNodeMergingFix(doc, appliedTreeContruction);
|
48042 | appliedTreeContruction = applySVGInnerHTMLFix(doc, appliedTreeContruction, "http://www.w3.org/2000/svg"
|
48043 |
|
48044 | );
|
48045 | DOM.DOMTreeConstruction = appliedTreeContruction;
|
48046 | })(DOM || (DOM = {}));
|
48047 |
|
48048 | class DOMChangesImpl extends DOMOperations {
|
48049 | constructor(document) {
|
48050 | super(document);
|
48051 | this.document = document;
|
48052 | this.namespace = null;
|
48053 | }
|
48054 |
|
48055 | setAttribute(element, name, value) {
|
48056 | element.setAttribute(name, value);
|
48057 | }
|
48058 |
|
48059 | removeAttribute(element, name) {
|
48060 | element.removeAttribute(name);
|
48061 | }
|
48062 |
|
48063 | insertAfter(element, node, reference) {
|
48064 | this.insertBefore(element, node, reference.nextSibling);
|
48065 | }
|
48066 |
|
48067 | }
|
48068 |
|
48069 | _exports.IDOMChanges = DOMChangesImpl;
|
48070 | var helper = DOMChangesImpl;
|
48071 | helper = applyTextNodeMergingFix(doc, helper);
|
48072 | helper = applySVGInnerHTMLFix(doc, helper, "http://www.w3.org/2000/svg"
|
48073 |
|
48074 | );
|
48075 | var helper$1 = helper;
|
48076 | _exports.DOMChanges = helper$1;
|
48077 | var DOMTreeConstruction = DOM.DOMTreeConstruction;
|
48078 | _exports.DOMTreeConstruction = DOMTreeConstruction;
|
48079 |
|
48080 | class PrimitiveReference extends _reference.ConstReference {
|
48081 | static create(value) {
|
48082 | if (value === undefined) {
|
48083 | return UNDEFINED_REFERENCE;
|
48084 | } else if (value === null) {
|
48085 | return NULL_REFERENCE;
|
48086 | } else if (value === true) {
|
48087 | return TRUE_REFERENCE;
|
48088 | } else if (value === false) {
|
48089 | return FALSE_REFERENCE;
|
48090 | } else if (typeof value === 'number') {
|
48091 | return new ValueReference(value);
|
48092 | } else {
|
48093 | return new StringReference(value);
|
48094 | }
|
48095 | }
|
48096 |
|
48097 | constructor(value) {
|
48098 | super(value);
|
48099 | }
|
48100 |
|
48101 | get(_key) {
|
48102 | return UNDEFINED_REFERENCE;
|
48103 | }
|
48104 |
|
48105 | }
|
48106 |
|
48107 | _exports.PrimitiveReference = PrimitiveReference;
|
48108 |
|
48109 | class StringReference extends PrimitiveReference {
|
48110 | constructor() {
|
48111 | super(...arguments);
|
48112 | this.lengthReference = null;
|
48113 | }
|
48114 |
|
48115 | get(key) {
|
48116 | if (key === 'length') {
|
48117 | var {
|
48118 | lengthReference
|
48119 | } = this;
|
48120 |
|
48121 | if (lengthReference === null) {
|
48122 | lengthReference = this.lengthReference = new ValueReference(this.inner.length);
|
48123 | }
|
48124 |
|
48125 | return lengthReference;
|
48126 | } else {
|
48127 | return super.get(key);
|
48128 | }
|
48129 | }
|
48130 |
|
48131 | }
|
48132 |
|
48133 | class ValueReference extends PrimitiveReference {
|
48134 | constructor(value) {
|
48135 | super(value);
|
48136 | }
|
48137 |
|
48138 | }
|
48139 |
|
48140 | var UNDEFINED_REFERENCE = new ValueReference(undefined);
|
48141 | _exports.UNDEFINED_REFERENCE = UNDEFINED_REFERENCE;
|
48142 | var NULL_REFERENCE = new ValueReference(null);
|
48143 | _exports.NULL_REFERENCE = NULL_REFERENCE;
|
48144 | var TRUE_REFERENCE = new ValueReference(true);
|
48145 | var FALSE_REFERENCE = new ValueReference(false);
|
48146 |
|
48147 | class ConditionalReference {
|
48148 | constructor(inner, toBool = defaultToBool) {
|
48149 | this.inner = inner;
|
48150 | this.toBool = toBool;
|
48151 | this._tag = (0, _validator.createUpdatableTag)();
|
48152 | this.tag = (0, _validator.combine)([inner.tag, this._tag]);
|
48153 | }
|
48154 |
|
48155 | value() {
|
48156 | var ret;
|
48157 | var {
|
48158 | toBool,
|
48159 | inner
|
48160 | } = this;
|
48161 | var tag = (0, _validator.track)(() => ret = toBool(inner.value()));
|
48162 | (0, _validator.updateTag)(this._tag, tag);
|
48163 | return ret;
|
48164 | }
|
48165 |
|
48166 | }
|
48167 |
|
48168 | _exports.ConditionalReference = ConditionalReference;
|
48169 |
|
48170 | function defaultToBool(value) {
|
48171 | return !!value;
|
48172 | }
|
48173 |
|
48174 | function normalizeStringValue(value) {
|
48175 | if (isEmpty(value)) {
|
48176 | return '';
|
48177 | }
|
48178 |
|
48179 | return String(value);
|
48180 | }
|
48181 |
|
48182 | function shouldCoerce(value) {
|
48183 | return isString(value) || isEmpty(value) || typeof value === 'boolean' || typeof value === 'number';
|
48184 | }
|
48185 |
|
48186 | function isEmpty(value) {
|
48187 | return value === null || value === undefined || typeof value.toString !== 'function';
|
48188 | }
|
48189 |
|
48190 | function isSafeString(value) {
|
48191 | return typeof value === 'object' && value !== null && typeof value.toHTML === 'function';
|
48192 | }
|
48193 |
|
48194 | function isNode(value) {
|
48195 | return typeof value === 'object' && value !== null && typeof value.nodeType === 'number';
|
48196 | }
|
48197 |
|
48198 | function isFragment(value) {
|
48199 | return isNode(value) && value.nodeType === 11;
|
48200 | }
|
48201 |
|
48202 | function isString(value) {
|
48203 | return typeof value === 'string';
|
48204 | }
|
48205 | |
48206 |
|
48207 |
|
48208 |
|
48209 |
|
48210 |
|
48211 |
|
48212 |
|
48213 | function normalizeProperty(element, slotName) {
|
48214 | var type, normalized;
|
48215 |
|
48216 | if (slotName in element) {
|
48217 | normalized = slotName;
|
48218 | type = 'prop';
|
48219 | } else {
|
48220 | var lower = slotName.toLowerCase();
|
48221 |
|
48222 | if (lower in element) {
|
48223 | type = 'prop';
|
48224 | normalized = lower;
|
48225 | } else {
|
48226 | type = 'attr';
|
48227 | normalized = slotName;
|
48228 | }
|
48229 | }
|
48230 |
|
48231 | if (type === 'prop' && (normalized.toLowerCase() === 'style' || preferAttr(element.tagName, normalized))) {
|
48232 | type = 'attr';
|
48233 | }
|
48234 |
|
48235 | return {
|
48236 | normalized,
|
48237 | type
|
48238 | };
|
48239 | }
|
48240 |
|
48241 |
|
48242 |
|
48243 | var ATTR_OVERRIDES = {
|
48244 | INPUT: {
|
48245 | form: true,
|
48246 |
|
48247 |
|
48248 |
|
48249 | autocorrect: true,
|
48250 |
|
48251 |
|
48252 | list: true
|
48253 | },
|
48254 |
|
48255 |
|
48256 | SELECT: {
|
48257 | form: true
|
48258 | },
|
48259 | OPTION: {
|
48260 | form: true
|
48261 | },
|
48262 | TEXTAREA: {
|
48263 | form: true
|
48264 | },
|
48265 | LABEL: {
|
48266 | form: true
|
48267 | },
|
48268 | FIELDSET: {
|
48269 | form: true
|
48270 | },
|
48271 | LEGEND: {
|
48272 | form: true
|
48273 | },
|
48274 | OBJECT: {
|
48275 | form: true
|
48276 | },
|
48277 | BUTTON: {
|
48278 | form: true
|
48279 | }
|
48280 | };
|
48281 |
|
48282 | function preferAttr(tagName, propName) {
|
48283 | var tag = ATTR_OVERRIDES[tagName.toUpperCase()];
|
48284 | return tag && tag[propName.toLowerCase()] || false;
|
48285 | }
|
48286 |
|
48287 | var badProtocols = ['javascript:', 'vbscript:'];
|
48288 | var badTags = ['A', 'BODY', 'LINK', 'IMG', 'IFRAME', 'BASE', 'FORM'];
|
48289 | var badTagsForDataURI = ['EMBED'];
|
48290 | var badAttributes = ['href', 'src', 'background', 'action'];
|
48291 | var badAttributesForDataURI = ['src'];
|
48292 |
|
48293 | function has(array, item) {
|
48294 | return array.indexOf(item) !== -1;
|
48295 | }
|
48296 |
|
48297 | function checkURI(tagName, attribute) {
|
48298 | return (tagName === null || has(badTags, tagName)) && has(badAttributes, attribute);
|
48299 | }
|
48300 |
|
48301 | function checkDataURI(tagName, attribute) {
|
48302 | if (tagName === null) return false;
|
48303 | return has(badTagsForDataURI, tagName) && has(badAttributesForDataURI, attribute);
|
48304 | }
|
48305 |
|
48306 | function requiresSanitization(tagName, attribute) {
|
48307 | return checkURI(tagName, attribute) || checkDataURI(tagName, attribute);
|
48308 | }
|
48309 |
|
48310 | function sanitizeAttributeValue(env, element, attribute, value) {
|
48311 | var tagName = null;
|
48312 |
|
48313 | if (value === null || value === undefined) {
|
48314 | return value;
|
48315 | }
|
48316 |
|
48317 | if (isSafeString(value)) {
|
48318 | return value.toHTML();
|
48319 | }
|
48320 |
|
48321 | if (!element) {
|
48322 | tagName = null;
|
48323 | } else {
|
48324 | tagName = element.tagName.toUpperCase();
|
48325 | }
|
48326 |
|
48327 | var str = normalizeStringValue(value);
|
48328 |
|
48329 | if (checkURI(tagName, attribute)) {
|
48330 | var protocol = env.protocolForURL(str);
|
48331 |
|
48332 | if (has(badProtocols, protocol)) {
|
48333 | return `unsafe:${str}`;
|
48334 | }
|
48335 | }
|
48336 |
|
48337 | if (checkDataURI(tagName, attribute)) {
|
48338 | return `unsafe:${str}`;
|
48339 | }
|
48340 |
|
48341 | return str;
|
48342 | }
|
48343 |
|
48344 | function dynamicAttribute(element, attr, namespace) {
|
48345 | var {
|
48346 | tagName,
|
48347 | namespaceURI
|
48348 | } = element;
|
48349 | var attribute = {
|
48350 | element,
|
48351 | name: attr,
|
48352 | namespace
|
48353 | };
|
48354 |
|
48355 | if (namespaceURI === "http://www.w3.org/2000/svg"
|
48356 |
|
48357 | ) {
|
48358 | return buildDynamicAttribute(tagName, attr, attribute);
|
48359 | }
|
48360 |
|
48361 | var {
|
48362 | type,
|
48363 | normalized
|
48364 | } = normalizeProperty(element, attr);
|
48365 |
|
48366 | if (type === 'attr') {
|
48367 | return buildDynamicAttribute(tagName, normalized, attribute);
|
48368 | } else {
|
48369 | return buildDynamicProperty(tagName, normalized, attribute);
|
48370 | }
|
48371 | }
|
48372 |
|
48373 | function buildDynamicAttribute(tagName, name, attribute) {
|
48374 | if (requiresSanitization(tagName, name)) {
|
48375 | return new SafeDynamicAttribute(attribute);
|
48376 | } else {
|
48377 | return new SimpleDynamicAttribute(attribute);
|
48378 | }
|
48379 | }
|
48380 |
|
48381 | function buildDynamicProperty(tagName, name, attribute) {
|
48382 | if (requiresSanitization(tagName, name)) {
|
48383 | return new SafeDynamicProperty(name, attribute);
|
48384 | }
|
48385 |
|
48386 | if (isUserInputValue(tagName, name)) {
|
48387 | return new InputValueDynamicAttribute(name, attribute);
|
48388 | }
|
48389 |
|
48390 | if (isOptionSelected(tagName, name)) {
|
48391 | return new OptionSelectedDynamicAttribute(name, attribute);
|
48392 | }
|
48393 |
|
48394 | return new DefaultDynamicProperty(name, attribute);
|
48395 | }
|
48396 |
|
48397 | class DynamicAttribute {
|
48398 | constructor(attribute) {
|
48399 | this.attribute = attribute;
|
48400 | }
|
48401 |
|
48402 | }
|
48403 |
|
48404 | _exports.DynamicAttribute = DynamicAttribute;
|
48405 |
|
48406 | class SimpleDynamicAttribute extends DynamicAttribute {
|
48407 | set(dom, value, _env) {
|
48408 | var normalizedValue = normalizeValue(value);
|
48409 |
|
48410 | if (normalizedValue !== null) {
|
48411 | var {
|
48412 | name: _name2,
|
48413 | namespace
|
48414 | } = this.attribute;
|
48415 |
|
48416 | dom.__setAttribute(_name2, normalizedValue, namespace);
|
48417 | }
|
48418 | }
|
48419 |
|
48420 | update(value, _env) {
|
48421 | var normalizedValue = normalizeValue(value);
|
48422 | var {
|
48423 | element,
|
48424 | name
|
48425 | } = this.attribute;
|
48426 |
|
48427 | if (normalizedValue === null) {
|
48428 | element.removeAttribute(name);
|
48429 | } else {
|
48430 | element.setAttribute(name, normalizedValue);
|
48431 | }
|
48432 | }
|
48433 |
|
48434 | }
|
48435 |
|
48436 | _exports.SimpleDynamicAttribute = SimpleDynamicAttribute;
|
48437 |
|
48438 | class DefaultDynamicProperty extends DynamicAttribute {
|
48439 | constructor(normalizedName, attribute) {
|
48440 | super(attribute);
|
48441 | this.normalizedName = normalizedName;
|
48442 | }
|
48443 |
|
48444 | set(dom, value, _env) {
|
48445 | if (value !== null && value !== undefined) {
|
48446 | this.value = value;
|
48447 |
|
48448 | dom.__setProperty(this.normalizedName, value);
|
48449 | }
|
48450 | }
|
48451 |
|
48452 | update(value, _env) {
|
48453 | var {
|
48454 | element
|
48455 | } = this.attribute;
|
48456 |
|
48457 | if (this.value !== value) {
|
48458 | element[this.normalizedName] = this.value = value;
|
48459 |
|
48460 | if (value === null || value === undefined) {
|
48461 | this.removeAttribute();
|
48462 | }
|
48463 | }
|
48464 | }
|
48465 |
|
48466 | removeAttribute() {
|
48467 |
|
48468 |
|
48469 | var {
|
48470 | element,
|
48471 | namespace
|
48472 | } = this.attribute;
|
48473 |
|
48474 | if (namespace) {
|
48475 | element.removeAttributeNS(namespace, this.normalizedName);
|
48476 | } else {
|
48477 | element.removeAttribute(this.normalizedName);
|
48478 | }
|
48479 | }
|
48480 |
|
48481 | }
|
48482 |
|
48483 | class SafeDynamicProperty extends DefaultDynamicProperty {
|
48484 | set(dom, value, env) {
|
48485 | var {
|
48486 | element,
|
48487 | name
|
48488 | } = this.attribute;
|
48489 | var sanitized = sanitizeAttributeValue(env, element, name, value);
|
48490 | super.set(dom, sanitized, env);
|
48491 | }
|
48492 |
|
48493 | update(value, env) {
|
48494 | var {
|
48495 | element,
|
48496 | name
|
48497 | } = this.attribute;
|
48498 | var sanitized = sanitizeAttributeValue(env, element, name, value);
|
48499 | super.update(sanitized, env);
|
48500 | }
|
48501 |
|
48502 | }
|
48503 |
|
48504 | class SafeDynamicAttribute extends SimpleDynamicAttribute {
|
48505 | set(dom, value, env) {
|
48506 | var {
|
48507 | element,
|
48508 | name
|
48509 | } = this.attribute;
|
48510 | var sanitized = sanitizeAttributeValue(env, element, name, value);
|
48511 | super.set(dom, sanitized, env);
|
48512 | }
|
48513 |
|
48514 | update(value, env) {
|
48515 | var {
|
48516 | element,
|
48517 | name
|
48518 | } = this.attribute;
|
48519 | var sanitized = sanitizeAttributeValue(env, element, name, value);
|
48520 | super.update(sanitized, env);
|
48521 | }
|
48522 |
|
48523 | }
|
48524 |
|
48525 | class InputValueDynamicAttribute extends DefaultDynamicProperty {
|
48526 | set(dom, value) {
|
48527 | dom.__setProperty('value', normalizeStringValue(value));
|
48528 | }
|
48529 |
|
48530 | update(value) {
|
48531 | var input = this.attribute.element;
|
48532 | var currentValue = input.value;
|
48533 | var normalizedValue = normalizeStringValue(value);
|
48534 |
|
48535 | if (currentValue !== normalizedValue) {
|
48536 | input.value = normalizedValue;
|
48537 | }
|
48538 | }
|
48539 |
|
48540 | }
|
48541 |
|
48542 | class OptionSelectedDynamicAttribute extends DefaultDynamicProperty {
|
48543 | set(dom, value) {
|
48544 | if (value !== null && value !== undefined && value !== false) {
|
48545 | dom.__setProperty('selected', true);
|
48546 | }
|
48547 | }
|
48548 |
|
48549 | update(value) {
|
48550 | var option = this.attribute.element;
|
48551 |
|
48552 | if (value) {
|
48553 | option.selected = true;
|
48554 | } else {
|
48555 | option.selected = false;
|
48556 | }
|
48557 | }
|
48558 |
|
48559 | }
|
48560 |
|
48561 | function isOptionSelected(tagName, attribute) {
|
48562 | return tagName === 'OPTION' && attribute === 'selected';
|
48563 | }
|
48564 |
|
48565 | function isUserInputValue(tagName, attribute) {
|
48566 | return (tagName === 'INPUT' || tagName === 'TEXTAREA') && attribute === 'value';
|
48567 | }
|
48568 |
|
48569 | function normalizeValue(value) {
|
48570 | if (value === false || value === undefined || value === null || typeof value.toString === 'undefined') {
|
48571 | return null;
|
48572 | }
|
48573 |
|
48574 | if (value === true) {
|
48575 | return '';
|
48576 | }
|
48577 |
|
48578 |
|
48579 | if (typeof value === 'function') {
|
48580 | return null;
|
48581 | }
|
48582 |
|
48583 | return String(value);
|
48584 | }
|
48585 |
|
48586 | var _a$1;
|
48587 |
|
48588 | class ScopeImpl {
|
48589 | constructor( // the 0th slot is `self`
|
48590 | slots, callerScope, // named arguments and blocks passed to a layout that uses eval
|
48591 | evalScope, // locals in scope when the partial was invoked
|
48592 | partialMap) {
|
48593 | this.slots = slots;
|
48594 | this.callerScope = callerScope;
|
48595 | this.evalScope = evalScope;
|
48596 | this.partialMap = partialMap;
|
48597 | }
|
48598 |
|
48599 | static root(self, size = 0) {
|
48600 | var refs = new Array(size + 1);
|
48601 |
|
48602 | for (var i = 0; i <= size; i++) {
|
48603 | refs[i] = UNDEFINED_REFERENCE;
|
48604 | }
|
48605 |
|
48606 | return new ScopeImpl(refs, null, null, null).init({
|
48607 | self
|
48608 | });
|
48609 | }
|
48610 |
|
48611 | static sized(size = 0) {
|
48612 | var refs = new Array(size + 1);
|
48613 |
|
48614 | for (var i = 0; i <= size; i++) {
|
48615 | refs[i] = UNDEFINED_REFERENCE;
|
48616 | }
|
48617 |
|
48618 | return new ScopeImpl(refs, null, null, null);
|
48619 | }
|
48620 |
|
48621 | init({
|
48622 | self
|
48623 | }) {
|
48624 | this.slots[0] = self;
|
48625 | return this;
|
48626 | }
|
48627 |
|
48628 | getSelf() {
|
48629 | return this.get(0);
|
48630 | }
|
48631 |
|
48632 | getSymbol(symbol$$1) {
|
48633 | return this.get(symbol$$1);
|
48634 | }
|
48635 |
|
48636 | getBlock(symbol$$1) {
|
48637 | var block = this.get(symbol$$1);
|
48638 | return block === UNDEFINED_REFERENCE ? null : block;
|
48639 | }
|
48640 |
|
48641 | getEvalScope() {
|
48642 | return this.evalScope;
|
48643 | }
|
48644 |
|
48645 | getPartialMap() {
|
48646 | return this.partialMap;
|
48647 | }
|
48648 |
|
48649 | bind(symbol$$1, value) {
|
48650 | this.set(symbol$$1, value);
|
48651 | }
|
48652 |
|
48653 | bindSelf(self) {
|
48654 | this.set(0, self);
|
48655 | }
|
48656 |
|
48657 | bindSymbol(symbol$$1, value) {
|
48658 | this.set(symbol$$1, value);
|
48659 | }
|
48660 |
|
48661 | bindBlock(symbol$$1, value) {
|
48662 | this.set(symbol$$1, value);
|
48663 | }
|
48664 |
|
48665 | bindEvalScope(map) {
|
48666 | this.evalScope = map;
|
48667 | }
|
48668 |
|
48669 | bindPartialMap(map) {
|
48670 | this.partialMap = map;
|
48671 | }
|
48672 |
|
48673 | bindCallerScope(scope) {
|
48674 | this.callerScope = scope;
|
48675 | }
|
48676 |
|
48677 | getCallerScope() {
|
48678 | return this.callerScope;
|
48679 | }
|
48680 |
|
48681 | child() {
|
48682 | return new ScopeImpl(this.slots.slice(), this.callerScope, this.evalScope, this.partialMap);
|
48683 | }
|
48684 |
|
48685 | get(index) {
|
48686 | if (index >= this.slots.length) {
|
48687 | throw new RangeError(`BUG: cannot get $${index} from scope; length=${this.slots.length}`);
|
48688 | }
|
48689 |
|
48690 | return this.slots[index];
|
48691 | }
|
48692 |
|
48693 | set(index, value) {
|
48694 | if (index >= this.slots.length) {
|
48695 | throw new RangeError(`BUG: cannot get $${index} from scope; length=${this.slots.length}`);
|
48696 | }
|
48697 |
|
48698 | this.slots[index] = value;
|
48699 | }
|
48700 |
|
48701 | }
|
48702 |
|
48703 | _exports.ScopeImpl = ScopeImpl;
|
48704 | var TRANSACTION = (0, _util.symbol)('TRANSACTION');
|
48705 |
|
48706 | class TransactionImpl {
|
48707 | constructor() {
|
48708 | this.scheduledInstallManagers = [];
|
48709 | this.scheduledInstallModifiers = [];
|
48710 | this.scheduledUpdateModifierManagers = [];
|
48711 | this.scheduledUpdateModifiers = [];
|
48712 | this.createdComponents = [];
|
48713 | this.createdManagers = [];
|
48714 | this.updatedComponents = [];
|
48715 | this.updatedManagers = [];
|
48716 | }
|
48717 |
|
48718 | didCreate(component, manager) {
|
48719 | this.createdComponents.push(component);
|
48720 | this.createdManagers.push(manager);
|
48721 | }
|
48722 |
|
48723 | didUpdate(component, manager) {
|
48724 | this.updatedComponents.push(component);
|
48725 | this.updatedManagers.push(manager);
|
48726 | }
|
48727 |
|
48728 | scheduleInstallModifier(modifier, manager) {
|
48729 | this.scheduledInstallModifiers.push(modifier);
|
48730 | this.scheduledInstallManagers.push(manager);
|
48731 | }
|
48732 |
|
48733 | scheduleUpdateModifier(modifier, manager) {
|
48734 | this.scheduledUpdateModifiers.push(modifier);
|
48735 | this.scheduledUpdateModifierManagers.push(manager);
|
48736 | }
|
48737 |
|
48738 | commit() {
|
48739 | var {
|
48740 | createdComponents,
|
48741 | createdManagers
|
48742 | } = this;
|
48743 |
|
48744 | for (var i = 0; i < createdComponents.length; i++) {
|
48745 | var component = createdComponents[i];
|
48746 | var manager = createdManagers[i];
|
48747 | manager.didCreate(component);
|
48748 | }
|
48749 |
|
48750 | var {
|
48751 | updatedComponents,
|
48752 | updatedManagers
|
48753 | } = this;
|
48754 |
|
48755 | for (var _i = 0; _i < updatedComponents.length; _i++) {
|
48756 | var _component = updatedComponents[_i];
|
48757 | var _manager2 = updatedManagers[_i];
|
48758 |
|
48759 | _manager2.didUpdate(_component);
|
48760 | }
|
48761 |
|
48762 | var {
|
48763 | scheduledInstallManagers,
|
48764 | scheduledInstallModifiers
|
48765 | } = this;
|
48766 |
|
48767 | for (var _i2 = 0; _i2 < scheduledInstallManagers.length; _i2++) {
|
48768 | var modifier = scheduledInstallModifiers[_i2];
|
48769 | var _manager3 = scheduledInstallManagers[_i2];
|
48770 |
|
48771 | _manager3.install(modifier);
|
48772 | }
|
48773 |
|
48774 | var {
|
48775 | scheduledUpdateModifierManagers,
|
48776 | scheduledUpdateModifiers
|
48777 | } = this;
|
48778 |
|
48779 | for (var _i3 = 0; _i3 < scheduledUpdateModifierManagers.length; _i3++) {
|
48780 | var _modifier = scheduledUpdateModifiers[_i3];
|
48781 | var _manager4 = scheduledUpdateModifierManagers[_i3];
|
48782 |
|
48783 | _manager4.update(_modifier);
|
48784 | }
|
48785 | }
|
48786 |
|
48787 | }
|
48788 |
|
48789 | function defaultDelegateFn(delegateFn, delegateDefault) {
|
48790 | var defaultFn = delegateFn !== undefined ? delegateFn : delegateDefault;
|
48791 |
|
48792 | if (true
|
48793 |
|
48794 | ) {
|
48795 |
|
48796 |
|
48797 | return defaultFn.bind(null);
|
48798 | }
|
48799 |
|
48800 | return defaultFn;
|
48801 | }
|
48802 |
|
48803 | class EnvironmentImpl {
|
48804 | constructor(options, delegate) {
|
48805 | this.delegate = delegate;
|
48806 | this[_a$1] = null;
|
48807 |
|
48808 | this.extra = this.delegate.extra;
|
48809 | this.isInteractive = typeof this.delegate.isInteractive === 'boolean' ? this.delegate.isInteractive : true;
|
48810 | this.protocolForURL = defaultDelegateFn(this.delegate.protocolForURL, defaultGetProtocolForURL);
|
48811 | this.attributeFor = defaultDelegateFn(this.delegate.attributeFor, defaultAttributeFor);
|
48812 | this.getProp = defaultDelegateFn(this.delegate.getProp, defaultGetProp);
|
48813 | this.getPath = defaultDelegateFn(this.delegate.getPath, defaultGetProp);
|
48814 | this.setPath = defaultDelegateFn(this.delegate.setPath, defaultSetPath);
|
48815 | this.toBool = defaultDelegateFn(this.delegate.toBool, defaultToBool$1);
|
48816 | this.toIterator = defaultDelegateFn(this.delegate.toIterator, defaultToIterator);
|
48817 |
|
48818 | if (options.appendOperations) {
|
48819 | this.appendOperations = options.appendOperations;
|
48820 | this.updateOperations = options.updateOperations;
|
48821 | } else if (options.document) {
|
48822 | this.appendOperations = new DOMTreeConstruction(options.document);
|
48823 | this.updateOperations = new DOMChangesImpl(options.document);
|
48824 | } else if (true
|
48825 |
|
48826 | ) {
|
48827 | throw new Error('you must pass document or appendOperations to a new runtime');
|
48828 | }
|
48829 | }
|
48830 |
|
48831 | getTemplatePathDebugContext(ref) {
|
48832 | if (this.delegate.getTemplatePathDebugContext !== undefined) {
|
48833 | return this.delegate.getTemplatePathDebugContext(ref);
|
48834 | }
|
48835 |
|
48836 | return '';
|
48837 | }
|
48838 |
|
48839 | setTemplatePathDebugContext(ref, desc, parentRef) {
|
48840 | if (this.delegate.setTemplatePathDebugContext !== undefined) {
|
48841 | this.delegate.setTemplatePathDebugContext(ref, desc, parentRef);
|
48842 | }
|
48843 | }
|
48844 |
|
48845 | toConditionalReference(input) {
|
48846 | return new ConditionalReference(input, this.delegate.toBool);
|
48847 | }
|
48848 |
|
48849 | getAppendOperations() {
|
48850 | return this.appendOperations;
|
48851 | }
|
48852 |
|
48853 | getDOM() {
|
48854 | return this.updateOperations;
|
48855 | }
|
48856 |
|
48857 | begin() {
|
48858 | if (this.delegate.onTransactionBegin !== undefined) {
|
48859 | this.delegate.onTransactionBegin();
|
48860 | }
|
48861 |
|
48862 | this[TRANSACTION] = new TransactionImpl();
|
48863 | }
|
48864 |
|
48865 | get transaction() {
|
48866 | return this[TRANSACTION];
|
48867 | }
|
48868 |
|
48869 | didCreate(component, manager) {
|
48870 | this.transaction.didCreate(component, manager);
|
48871 | }
|
48872 |
|
48873 | didUpdate(component, manager) {
|
48874 | this.transaction.didUpdate(component, manager);
|
48875 | }
|
48876 |
|
48877 | scheduleInstallModifier(modifier, manager) {
|
48878 | if (this.isInteractive) {
|
48879 | this.transaction.scheduleInstallModifier(modifier, manager);
|
48880 | }
|
48881 | }
|
48882 |
|
48883 | scheduleUpdateModifier(modifier, manager) {
|
48884 | if (this.isInteractive) {
|
48885 | this.transaction.scheduleUpdateModifier(modifier, manager);
|
48886 | }
|
48887 | }
|
48888 |
|
48889 | commit() {
|
48890 | var transaction = this.transaction;
|
48891 | this[TRANSACTION] = null;
|
48892 | transaction.commit();
|
48893 |
|
48894 | if (this.delegate.onTransactionCommit !== undefined) {
|
48895 | this.delegate.onTransactionCommit();
|
48896 | }
|
48897 | }
|
48898 |
|
48899 | }
|
48900 |
|
48901 | _exports.EnvironmentImpl = EnvironmentImpl;
|
48902 | _a$1 = TRANSACTION;
|
48903 |
|
48904 | function defaultGetProtocolForURL(url) {
|
48905 | if (typeof URL === 'object' || typeof URL === 'undefined') {
|
48906 | return legacyProtocolForURL(url);
|
48907 | } else if (typeof document !== 'undefined') {
|
48908 | return new URL(url, document.baseURI).protocol;
|
48909 | } else {
|
48910 | return new URL(url, 'https://www.example.com').protocol;
|
48911 | }
|
48912 | }
|
48913 |
|
48914 | function defaultAttributeFor(element, attr, _isTrusting, namespace) {
|
48915 | return dynamicAttribute(element, attr, namespace);
|
48916 | }
|
48917 |
|
48918 | function defaultGetProp(obj, key) {
|
48919 | return obj[key];
|
48920 | }
|
48921 |
|
48922 | function defaultSetPath(obj, key, value) {
|
48923 | return obj[key] = value;
|
48924 | }
|
48925 |
|
48926 | function defaultToBool$1(value) {
|
48927 | return Boolean(value);
|
48928 | }
|
48929 |
|
48930 | function defaultToIterator(value) {
|
48931 | if (value && value[Symbol.iterator]) {
|
48932 | return value[Symbol.iterator]();
|
48933 | }
|
48934 |
|
48935 | return null;
|
48936 | }
|
48937 |
|
48938 | function legacyProtocolForURL(url) {
|
48939 | if (typeof window === 'undefined') {
|
48940 | var match = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i.exec(url);
|
48941 | return match && match[1] ? match[1].toLowerCase() : '';
|
48942 | }
|
48943 |
|
48944 | var anchor = window.document.createElement('a');
|
48945 | anchor.href = url;
|
48946 | return anchor.protocol;
|
48947 | }
|
48948 |
|
48949 | class DefaultRuntimeResolver {
|
48950 | constructor(inner) {
|
48951 | this.inner = inner;
|
48952 | }
|
48953 |
|
48954 | lookupComponent(name, referrer) {
|
48955 | if (this.inner.lookupComponent) {
|
48956 | var component = this.inner.lookupComponent(name, referrer);
|
48957 |
|
48958 | if (component === undefined) {
|
48959 | throw new Error(`Unexpected component ${name} (from ${referrer}) (lookupComponent returned undefined)`);
|
48960 | }
|
48961 |
|
48962 | return component;
|
48963 | } else {
|
48964 | throw new Error('lookupComponent not implemented on RuntimeResolver.');
|
48965 | }
|
48966 | }
|
48967 |
|
48968 | lookupPartial(name, referrer) {
|
48969 | if (this.inner.lookupPartial) {
|
48970 | var partial = this.inner.lookupPartial(name, referrer);
|
48971 |
|
48972 | if (partial === undefined) {
|
48973 | throw new Error(`Unexpected partial ${name} (from ${referrer}) (lookupPartial returned undefined)`);
|
48974 | }
|
48975 |
|
48976 | return partial;
|
48977 | } else {
|
48978 | throw new Error('lookupPartial not implemented on RuntimeResolver.');
|
48979 | }
|
48980 | }
|
48981 |
|
48982 | resolve(handle) {
|
48983 | if (this.inner.resolve) {
|
48984 | var resolved = this.inner.resolve(handle);
|
48985 |
|
48986 | if (resolved === undefined) {
|
48987 | throw new Error(`Unexpected handle ${handle} (resolve returned undefined)`);
|
48988 | }
|
48989 |
|
48990 | return resolved;
|
48991 | } else {
|
48992 | throw new Error('resolve not implemented on RuntimeResolver.');
|
48993 | }
|
48994 | }
|
48995 |
|
48996 | compilable(locator) {
|
48997 | if (this.inner.compilable) {
|
48998 | var resolved = this.inner.compilable(locator);
|
48999 |
|
49000 | if (resolved === undefined) {
|
49001 | throw new Error(`Unable to compile ${name} (compilable returned undefined)`);
|
49002 | }
|
49003 |
|
49004 | return resolved;
|
49005 | } else {
|
49006 | throw new Error('compilable not implemented on RuntimeResolver.');
|
49007 | }
|
49008 | }
|
49009 |
|
49010 | getInvocation(locator) {
|
49011 | if (this.inner.getInvocation) {
|
49012 | var invocation = this.inner.getInvocation(locator);
|
49013 |
|
49014 | if (invocation === undefined) {
|
49015 | throw new Error(`Unable to get invocation for ${JSON.stringify(locator)} (getInvocation returned undefined)`);
|
49016 | }
|
49017 |
|
49018 | return invocation;
|
49019 | } else {
|
49020 | throw new Error('getInvocation not implemented on RuntimeResolver.');
|
49021 | }
|
49022 | }
|
49023 |
|
49024 | }
|
49025 |
|
49026 | function AotRuntime(options, program, resolver = {}, delegate = {}) {
|
49027 | var env = new EnvironmentImpl(options, delegate);
|
49028 | return {
|
49029 | env,
|
49030 | resolver: new DefaultRuntimeResolver(resolver),
|
49031 | program: _program.RuntimeProgramImpl.hydrate(program)
|
49032 | };
|
49033 | }
|
49034 |
|
49035 | function JitRuntime(options, delegate = {}, context, resolver = {}) {
|
49036 | return {
|
49037 | env: new EnvironmentImpl(options, delegate),
|
49038 | program: new _program.RuntimeProgramImpl(context.program.constants, context.program.heap),
|
49039 | resolver: new DefaultRuntimeResolver(resolver)
|
49040 | };
|
49041 | }
|
49042 |
|
49043 | function inTransaction(env, cb) {
|
49044 | if (!env[TRANSACTION]) {
|
49045 | env.begin();
|
49046 |
|
49047 | try {
|
49048 | cb();
|
49049 | } finally {
|
49050 | env.commit();
|
49051 | }
|
49052 | } else {
|
49053 | cb();
|
49054 | }
|
49055 | }
|
49056 |
|
49057 | class AppendOpcodes {
|
49058 | constructor() {
|
49059 | this.evaluateOpcode = (0, _util.fillNulls)(107
|
49060 |
|
49061 | ).slice();
|
49062 | }
|
49063 |
|
49064 | add(name, evaluate, kind = 'syscall') {
|
49065 | this.evaluateOpcode[name] = {
|
49066 | syscall: kind !== 'machine',
|
49067 | evaluate
|
49068 | };
|
49069 | }
|
49070 |
|
49071 | debugBefore(vm, opcode) {
|
49072 | var params = undefined;
|
49073 | var opName = undefined;
|
49074 | var sp;
|
49075 | return {
|
49076 | sp: sp,
|
49077 | pc: vm.fetchValue(_vm2.$pc),
|
49078 | name: opName,
|
49079 | params,
|
49080 | type: opcode.type,
|
49081 | isMachine: opcode.isMachine,
|
49082 | size: opcode.size,
|
49083 | state: undefined
|
49084 | };
|
49085 | }
|
49086 |
|
49087 | debugAfter(vm, pre) {}
|
49088 |
|
49089 | evaluate(vm, opcode, type) {
|
49090 | var operation = this.evaluateOpcode[type];
|
49091 |
|
49092 | if (operation.syscall) {
|
49093 | operation.evaluate(vm, opcode);
|
49094 | } else {
|
49095 | operation.evaluate(vm[INNER_VM], opcode);
|
49096 | }
|
49097 | }
|
49098 |
|
49099 | }
|
49100 |
|
49101 | var APPEND_OPCODES = new AppendOpcodes();
|
49102 |
|
49103 | class AbstractOpcode {
|
49104 | constructor() {
|
49105 | (0, _util.initializeGuid)(this);
|
49106 | }
|
49107 |
|
49108 | }
|
49109 |
|
49110 | class UpdatingOpcode extends AbstractOpcode {}
|
49111 | |
49112 |
|
49113 |
|
49114 |
|
49115 |
|
49116 |
|
49117 |
|
49118 |
|
49119 |
|
49120 | function combineTagged(tagged) {
|
49121 | var optimized = [];
|
49122 |
|
49123 | for (var i = 0; i < tagged.length; i++) {
|
49124 | var tag = tagged[i].tag;
|
49125 | if (tag === _validator.CONSTANT_TAG) continue;
|
49126 | optimized.push(tag);
|
49127 | }
|
49128 |
|
49129 | return (0, _validator.createCombinatorTag)(optimized);
|
49130 | }
|
49131 |
|
49132 | function combineFromIndex(tagged, startIndex) {
|
49133 | var optimized = [];
|
49134 |
|
49135 | for (var i = startIndex; i < tagged.length; i++) {
|
49136 | var tag = tagged[i].tag;
|
49137 | if (tag === _validator.CONSTANT_TAG) continue;
|
49138 | optimized.push(tag);
|
49139 | }
|
49140 |
|
49141 | return (0, _validator.createCombinatorTag)(optimized);
|
49142 | }
|
49143 |
|
49144 | class ConcatReference extends _reference.CachedReference {
|
49145 | constructor(parts) {
|
49146 | super();
|
49147 | this.parts = parts;
|
49148 | this.tag = combineTagged(parts);
|
49149 | }
|
49150 |
|
49151 | compute() {
|
49152 | var parts = new Array();
|
49153 |
|
49154 | for (var i = 0; i < this.parts.length; i++) {
|
49155 | var value = this.parts[i].value();
|
49156 |
|
49157 | if (value !== null && value !== undefined) {
|
49158 | parts[i] = castToString(value);
|
49159 | }
|
49160 | }
|
49161 |
|
49162 | if (parts.length > 0) {
|
49163 | return parts.join('');
|
49164 | }
|
49165 |
|
49166 | return null;
|
49167 | }
|
49168 |
|
49169 | }
|
49170 |
|
49171 | function castToString(value) {
|
49172 | if (typeof value.toString !== 'function') {
|
49173 | return '';
|
49174 | }
|
49175 |
|
49176 | return String(value);
|
49177 | }
|
49178 |
|
49179 | APPEND_OPCODES.add(16
|
49180 |
|
49181 | , (vm, {
|
49182 | op1: handle
|
49183 | }) => {
|
49184 | var stack = vm.stack;
|
49185 | var helper = vm.runtime.resolver.resolve(handle);
|
49186 | var args = stack.popJs();
|
49187 | var value = helper(args, vm);
|
49188 | vm.loadValue(_vm2.$v0, value);
|
49189 | });
|
49190 | APPEND_OPCODES.add(22
|
49191 |
|
49192 | , (vm, {
|
49193 | op1: symbol$$1
|
49194 | }) => {
|
49195 | var expr = vm.referenceForSymbol(symbol$$1);
|
49196 | vm.stack.pushJs(expr);
|
49197 | });
|
49198 | APPEND_OPCODES.add(19
|
49199 |
|
49200 | , (vm, {
|
49201 | op1: symbol$$1
|
49202 | }) => {
|
49203 | var expr = vm.stack.pop();
|
49204 | vm.scope().bindSymbol(symbol$$1, expr);
|
49205 | });
|
49206 | APPEND_OPCODES.add(21
|
49207 |
|
49208 | , (vm, {
|
49209 | op1: symbol$$1
|
49210 | }) => {
|
49211 | var handle = vm.stack.popJs();
|
49212 | var scope = vm.stack.popJs();
|
49213 | var table = vm.stack.popJs();
|
49214 | var block = table ? [handle, scope, table] : null;
|
49215 | vm.scope().bindBlock(symbol$$1, block);
|
49216 | }, 'jit');
|
49217 | APPEND_OPCODES.add(20
|
49218 |
|
49219 | , (vm, {
|
49220 | op1: symbol$$1
|
49221 | }) => {
|
49222 |
|
49223 | var handle = true
|
49224 |
|
49225 | ? vm.stack.pop() : vm.stack.popSmallInt();
|
49226 | var scope = vm.stack.popJs();
|
49227 | var table = vm.stack.popJs();
|
49228 | var block = table ? [handle, scope, table] : null;
|
49229 | vm.scope().bindBlock(symbol$$1, block);
|
49230 | });
|
49231 | APPEND_OPCODES.add(105
|
49232 |
|
49233 | , (vm, {
|
49234 | op1: _name
|
49235 | }) => {
|
49236 | var name = vm[CONSTANTS].getValue(_name);
|
49237 | var locals = vm.scope().getPartialMap();
|
49238 | var ref = locals[name];
|
49239 |
|
49240 | if (ref === undefined) {
|
49241 | ref = vm.getSelf().get(name);
|
49242 | }
|
49243 |
|
49244 | vm.stack.pushJs(ref);
|
49245 | });
|
49246 | APPEND_OPCODES.add(37
|
49247 |
|
49248 | , (vm, {
|
49249 | op1: symbols
|
49250 | }) => {
|
49251 | vm.pushRootScope(symbols);
|
49252 | });
|
49253 | APPEND_OPCODES.add(23
|
49254 |
|
49255 | , (vm, {
|
49256 | op1: _key
|
49257 | }) => {
|
49258 | var key = vm[CONSTANTS].getValue(_key);
|
49259 | var expr = vm.stack.popJs();
|
49260 | vm.stack.pushJs(expr.get(key));
|
49261 | });
|
49262 | APPEND_OPCODES.add(24
|
49263 |
|
49264 | , (vm, {
|
49265 | op1: _block
|
49266 | }) => {
|
49267 | var {
|
49268 | stack
|
49269 | } = vm;
|
49270 | var block = vm.scope().getBlock(_block);
|
49271 |
|
49272 | if (block === null) {
|
49273 | stack.pushNull();
|
49274 | } else {
|
49275 | stack.pushJs(block);
|
49276 | }
|
49277 | });
|
49278 | APPEND_OPCODES.add(25
|
49279 |
|
49280 | , vm => {
|
49281 | var {
|
49282 | stack
|
49283 | } = vm;
|
49284 | var block = stack.popJs();
|
49285 |
|
49286 | if (block && !isUndefinedReference(block)) {
|
49287 | var [handleOrCompilable, scope, table] = block;
|
49288 | stack.pushJs(table);
|
49289 | stack.pushJs(scope);
|
49290 |
|
49291 | if (typeof handleOrCompilable === 'number') {
|
49292 | stack.pushSmallInt(handleOrCompilable);
|
49293 | } else {
|
49294 | stack.pushJs(handleOrCompilable);
|
49295 | }
|
49296 | } else {
|
49297 | stack.pushNull();
|
49298 | stack.pushNull();
|
49299 | stack.pushNull();
|
49300 | }
|
49301 | });
|
49302 |
|
49303 | function isUndefinedReference(input) {
|
49304 | return input === UNDEFINED_REFERENCE;
|
49305 | }
|
49306 |
|
49307 | APPEND_OPCODES.add(26
|
49308 |
|
49309 | , vm => {
|
49310 | var {
|
49311 | stack
|
49312 | } = vm;
|
49313 | var block = stack.pop();
|
49314 |
|
49315 | if (block && !isUndefinedReference(block)) {
|
49316 | stack.pushJs(TRUE_REFERENCE);
|
49317 | } else {
|
49318 | stack.pushJs(FALSE_REFERENCE);
|
49319 | }
|
49320 | });
|
49321 | APPEND_OPCODES.add(27
|
49322 |
|
49323 | , vm => {
|
49324 |
|
49325 | var block = vm.stack.pop();
|
49326 | var scope = vm.stack.popJs();
|
49327 | var table = vm.stack.popJs();
|
49328 | var hasBlockParams = table && table.parameters.length;
|
49329 | vm.stack.pushJs(hasBlockParams ? TRUE_REFERENCE : FALSE_REFERENCE);
|
49330 | });
|
49331 | APPEND_OPCODES.add(28
|
49332 |
|
49333 | , (vm, {
|
49334 | op1: count
|
49335 | }) => {
|
49336 | var out = new Array(count);
|
49337 |
|
49338 | for (var i = count; i > 0; i--) {
|
49339 | var offset = i - 1;
|
49340 | out[offset] = vm.stack.pop();
|
49341 | }
|
49342 |
|
49343 | vm.stack.pushJs(new ConcatReference(out));
|
49344 | });
|
49345 | |
49346 |
|
49347 |
|
49348 |
|
49349 | function capabilityFlagsFrom(capabilities) {
|
49350 | return 0 | (capabilities.dynamicLayout ? 1
|
49351 |
|
49352 | : 0) | (capabilities.dynamicTag ? 2
|
49353 |
|
49354 | : 0) | (capabilities.prepareArgs ? 4
|
49355 |
|
49356 | : 0) | (capabilities.createArgs ? 8
|
49357 |
|
49358 | : 0) | (capabilities.attributeHook ? 16
|
49359 |
|
49360 | : 0) | (capabilities.elementHook ? 32
|
49361 |
|
49362 | : 0) | (capabilities.dynamicScope ? 64
|
49363 |
|
49364 | : 0) | (capabilities.createCaller ? 128
|
49365 |
|
49366 | : 0) | (capabilities.updateHook ? 256
|
49367 |
|
49368 | : 0) | (capabilities.createInstance ? 512
|
49369 |
|
49370 | : 0) | (capabilities.wrapped ? 1024
|
49371 |
|
49372 | : 0) | (capabilities.willDestroy ? 2048
|
49373 |
|
49374 | : 0);
|
49375 | }
|
49376 |
|
49377 | function managerHasCapability(_manager, capabilities, capability) {
|
49378 | return !!(capabilities & capability);
|
49379 | }
|
49380 |
|
49381 | function hasCapability(capabilities, capability) {
|
49382 | return !!(capabilities & capability);
|
49383 | }
|
49384 |
|
49385 | var _a$2;
|
49386 |
|
49387 | var CURRIED_COMPONENT_DEFINITION_BRAND = (0, _util.symbol)('CURRIED COMPONENT DEFINITION');
|
49388 |
|
49389 | function isCurriedComponentDefinition(definition) {
|
49390 | return !!(definition && definition[CURRIED_COMPONENT_DEFINITION_BRAND]);
|
49391 | }
|
49392 |
|
49393 | function isComponentDefinition(definition) {
|
49394 | return !!(definition && definition[CURRIED_COMPONENT_DEFINITION_BRAND]);
|
49395 | }
|
49396 |
|
49397 | class CurriedComponentDefinition {
|
49398 |
|
49399 | constructor(inner, args) {
|
49400 | this.inner = inner;
|
49401 | this.args = args;
|
49402 | this[_a$2] = true;
|
49403 | }
|
49404 |
|
49405 | unwrap(args) {
|
49406 | args.realloc(this.offset);
|
49407 | var definition = this;
|
49408 |
|
49409 | while (true) {
|
49410 | var {
|
49411 | args: curriedArgs,
|
49412 | inner
|
49413 | } = definition;
|
49414 |
|
49415 | if (curriedArgs) {
|
49416 | args.positional.prepend(curriedArgs.positional);
|
49417 | args.named.merge(curriedArgs.named);
|
49418 | }
|
49419 |
|
49420 | if (!isCurriedComponentDefinition(inner)) {
|
49421 | return inner;
|
49422 | }
|
49423 |
|
49424 | definition = inner;
|
49425 | }
|
49426 | }
|
49427 |
|
49428 |
|
49429 |
|
49430 | get offset() {
|
49431 | var {
|
49432 | inner,
|
49433 | args
|
49434 | } = this;
|
49435 | var length = args ? args.positional.length : 0;
|
49436 | return isCurriedComponentDefinition(inner) ? length + inner.offset : length;
|
49437 | }
|
49438 |
|
49439 | }
|
49440 |
|
49441 | _exports.CurriedComponentDefinition = CurriedComponentDefinition;
|
49442 | _a$2 = CURRIED_COMPONENT_DEFINITION_BRAND;
|
49443 |
|
49444 | function curry(spec, args = null) {
|
49445 | return new CurriedComponentDefinition(spec, args);
|
49446 | }
|
49447 |
|
49448 | function resolveComponent(resolver, name, meta) {
|
49449 | var definition = resolver.lookupComponent(name, meta);
|
49450 | return definition;
|
49451 | }
|
49452 |
|
49453 | class ClassListReference {
|
49454 | constructor(list) {
|
49455 | this.list = list;
|
49456 | this.tag = combineTagged(list);
|
49457 | this.list = list;
|
49458 | }
|
49459 |
|
49460 | value() {
|
49461 | var ret = [];
|
49462 | var {
|
49463 | list
|
49464 | } = this;
|
49465 |
|
49466 | for (var i = 0; i < list.length; i++) {
|
49467 | var value = normalizeStringValue(list[i].value());
|
49468 | if (value) ret.push(value);
|
49469 | }
|
49470 |
|
49471 | return ret.length === 0 ? null : ret.join(' ');
|
49472 | }
|
49473 |
|
49474 | }
|
49475 |
|
49476 | class CurryComponentReference {
|
49477 | constructor(inner, resolver, meta, args) {
|
49478 | this.inner = inner;
|
49479 | this.resolver = resolver;
|
49480 | this.meta = meta;
|
49481 | this.args = args;
|
49482 | this.tag = inner.tag;
|
49483 | this.lastValue = null;
|
49484 | this.lastDefinition = null;
|
49485 | }
|
49486 |
|
49487 | value() {
|
49488 | var {
|
49489 | inner,
|
49490 | lastValue
|
49491 | } = this;
|
49492 | var value = inner.value();
|
49493 |
|
49494 | if (value === lastValue) {
|
49495 | return this.lastDefinition;
|
49496 | }
|
49497 |
|
49498 | var definition = null;
|
49499 |
|
49500 | if (isCurriedComponentDefinition(value)) {
|
49501 | definition = value;
|
49502 | } else if (typeof value === 'string' && value) {
|
49503 | var {
|
49504 | resolver,
|
49505 | meta
|
49506 | } = this;
|
49507 | definition = resolveComponent(resolver, value, meta);
|
49508 | }
|
49509 |
|
49510 | definition = this.curry(definition);
|
49511 | this.lastValue = value;
|
49512 | this.lastDefinition = definition;
|
49513 | return definition;
|
49514 | }
|
49515 |
|
49516 | get() {
|
49517 | return UNDEFINED_REFERENCE;
|
49518 | }
|
49519 |
|
49520 | curry(definition) {
|
49521 | var {
|
49522 | args
|
49523 | } = this;
|
49524 |
|
49525 | if (!args && isCurriedComponentDefinition(definition)) {
|
49526 | return definition;
|
49527 | } else if (!definition) {
|
49528 | return null;
|
49529 | } else {
|
49530 | return new CurriedComponentDefinition(definition, args);
|
49531 | }
|
49532 | }
|
49533 |
|
49534 | }
|
49535 |
|
49536 | class DynamicTextContent extends UpdatingOpcode {
|
49537 | constructor(node, reference, lastValue) {
|
49538 | super();
|
49539 | this.node = node;
|
49540 | this.reference = reference;
|
49541 | this.lastValue = lastValue;
|
49542 | this.type = 'dynamic-text';
|
49543 | this.tag = reference.tag;
|
49544 | this.lastRevision = (0, _validator.valueForTag)(this.tag);
|
49545 | }
|
49546 |
|
49547 | evaluate() {
|
49548 | var {
|
49549 | reference,
|
49550 | tag
|
49551 | } = this;
|
49552 |
|
49553 | if (!(0, _validator.validateTag)(tag, this.lastRevision)) {
|
49554 | this.lastRevision = (0, _validator.valueForTag)(tag);
|
49555 | this.update(reference.value());
|
49556 | }
|
49557 | }
|
49558 |
|
49559 | update(value) {
|
49560 | var {
|
49561 | lastValue
|
49562 | } = this;
|
49563 | if (value === lastValue) return;
|
49564 | var normalized;
|
49565 |
|
49566 | if (isEmpty(value)) {
|
49567 | normalized = '';
|
49568 | } else if (isString(value)) {
|
49569 | normalized = value;
|
49570 | } else {
|
49571 | normalized = String(value);
|
49572 | }
|
49573 |
|
49574 | if (normalized !== lastValue) {
|
49575 | var textNode = this.node;
|
49576 | textNode.nodeValue = this.lastValue = normalized;
|
49577 | }
|
49578 | }
|
49579 |
|
49580 | }
|
49581 |
|
49582 | class ContentTypeReference {
|
49583 | constructor(inner) {
|
49584 | this.inner = inner;
|
49585 | this.tag = inner.tag;
|
49586 | }
|
49587 |
|
49588 | value() {
|
49589 | var value = this.inner.value();
|
49590 |
|
49591 | if (shouldCoerce(value)) {
|
49592 | return 1
|
49593 |
|
49594 | ;
|
49595 | } else if (isComponentDefinition(value)) {
|
49596 | return 0
|
49597 |
|
49598 | ;
|
49599 | } else if (isSafeString(value)) {
|
49600 | return 3
|
49601 |
|
49602 | ;
|
49603 | } else if (isFragment(value)) {
|
49604 | return 4
|
49605 |
|
49606 | ;
|
49607 | } else if (isNode(value)) {
|
49608 | return 5
|
49609 |
|
49610 | ;
|
49611 | } else {
|
49612 | return 1
|
49613 |
|
49614 | ;
|
49615 | }
|
49616 | }
|
49617 |
|
49618 | }
|
49619 |
|
49620 | APPEND_OPCODES.add(43
|
49621 |
|
49622 | , vm => {
|
49623 | var reference = vm.stack.popJs();
|
49624 | var rawValue = reference.value();
|
49625 | var value = isEmpty(rawValue) ? '' : String(rawValue);
|
49626 | vm.elements().appendDynamicHTML(value);
|
49627 | });
|
49628 | APPEND_OPCODES.add(44
|
49629 |
|
49630 | , vm => {
|
49631 | var reference = vm.stack.popJs();
|
49632 | var rawValue = reference.value().toHTML();
|
49633 | var value = isEmpty(rawValue) ? '' : rawValue;
|
49634 | vm.elements().appendDynamicHTML(value);
|
49635 | });
|
49636 | APPEND_OPCODES.add(47
|
49637 |
|
49638 | , vm => {
|
49639 | var reference = vm.stack.popJs();
|
49640 | var rawValue = reference.value();
|
49641 | var value = isEmpty(rawValue) ? '' : String(rawValue);
|
49642 | var node = vm.elements().appendDynamicText(value);
|
49643 |
|
49644 | if (!(0, _validator.isConstTagged)(reference)) {
|
49645 | vm.updateWith(new DynamicTextContent(node, reference, value));
|
49646 | }
|
49647 | });
|
49648 | APPEND_OPCODES.add(45
|
49649 |
|
49650 | , vm => {
|
49651 | var reference = vm.stack.popJs();
|
49652 | var value = reference.value();
|
49653 | vm.elements().appendDynamicFragment(value);
|
49654 | });
|
49655 | APPEND_OPCODES.add(46
|
49656 |
|
49657 | , vm => {
|
49658 | var reference = vm.stack.popJs();
|
49659 | var value = reference.value();
|
49660 | vm.elements().appendDynamicNode(value);
|
49661 | });
|
49662 | APPEND_OPCODES.add(39
|
49663 |
|
49664 | , vm => vm.pushChildScope());
|
49665 | APPEND_OPCODES.add(40
|
49666 |
|
49667 | , vm => vm.popScope());
|
49668 | APPEND_OPCODES.add(59
|
49669 |
|
49670 | , vm => vm.pushDynamicScope());
|
49671 | APPEND_OPCODES.add(60
|
49672 |
|
49673 | , vm => vm.popDynamicScope());
|
49674 | APPEND_OPCODES.add(29
|
49675 |
|
49676 | , (vm, {
|
49677 | op1: other
|
49678 | }) => {
|
49679 | vm.stack.pushJs(vm[CONSTANTS].getValue((0, _util.decodeHandle)(other)));
|
49680 | });
|
49681 | APPEND_OPCODES.add(30
|
49682 |
|
49683 | , (vm, {
|
49684 | op1: primitive
|
49685 | }) => {
|
49686 | var stack = vm.stack;
|
49687 |
|
49688 | if ((0, _util.isNonPrimitiveHandle)(primitive)) {
|
49689 |
|
49690 | var value = vm[CONSTANTS].getValue((0, _util.decodeHandle)(primitive));
|
49691 | stack.pushJs(value);
|
49692 | } else {
|
49693 |
|
49694 | stack.pushRaw(primitive);
|
49695 | }
|
49696 | });
|
49697 | APPEND_OPCODES.add(31
|
49698 |
|
49699 | , vm => {
|
49700 | var stack = vm.stack;
|
49701 | stack.pushJs(PrimitiveReference.create(stack.pop()));
|
49702 | });
|
49703 | APPEND_OPCODES.add(32
|
49704 |
|
49705 | , vm => {
|
49706 | var stack = vm.stack;
|
49707 | stack.pushSmallInt(stack.peekJs().value());
|
49708 | });
|
49709 | APPEND_OPCODES.add(33
|
49710 |
|
49711 | , (vm, {
|
49712 | op1: register,
|
49713 | op2: offset
|
49714 | }) => {
|
49715 | var position = vm.fetchValue(register) - offset;
|
49716 | vm.stack.dup(position);
|
49717 | });
|
49718 | APPEND_OPCODES.add(34
|
49719 |
|
49720 | , (vm, {
|
49721 | op1: count
|
49722 | }) => {
|
49723 | vm.stack.pop(count);
|
49724 | });
|
49725 | APPEND_OPCODES.add(35
|
49726 |
|
49727 | , (vm, {
|
49728 | op1: register
|
49729 | }) => {
|
49730 | vm.load(register);
|
49731 | });
|
49732 | APPEND_OPCODES.add(36
|
49733 |
|
49734 | , (vm, {
|
49735 | op1: register
|
49736 | }) => {
|
49737 | vm.fetch(register);
|
49738 | });
|
49739 | APPEND_OPCODES.add(58
|
49740 |
|
49741 | , (vm, {
|
49742 | op1: _names
|
49743 | }) => {
|
49744 | var names = vm[CONSTANTS].getArray(_names);
|
49745 | vm.bindDynamicScope(names);
|
49746 | });
|
49747 | APPEND_OPCODES.add(69
|
49748 |
|
49749 | , (vm, {
|
49750 | op1: args
|
49751 | }) => {
|
49752 | vm.enter(args);
|
49753 | });
|
49754 | APPEND_OPCODES.add(70
|
49755 |
|
49756 | , vm => {
|
49757 | vm.exit();
|
49758 | });
|
49759 | APPEND_OPCODES.add(63
|
49760 |
|
49761 | , (vm, {
|
49762 | op1: _table
|
49763 | }) => {
|
49764 | var stack = vm.stack;
|
49765 | stack.pushJs(vm[CONSTANTS].getSerializable(_table));
|
49766 | });
|
49767 | APPEND_OPCODES.add(62
|
49768 |
|
49769 | , vm => {
|
49770 | var stack = vm.stack;
|
49771 | stack.pushJs(vm.scope());
|
49772 | });
|
49773 | APPEND_OPCODES.add(61
|
49774 |
|
49775 | , vm => {
|
49776 | var stack = vm.stack;
|
49777 | var block = stack.pop();
|
49778 |
|
49779 | if (block) {
|
49780 | stack.pushSmallInt(vm.compile(block));
|
49781 | } else {
|
49782 | stack.pushNull();
|
49783 | }
|
49784 | }, 'jit');
|
49785 | APPEND_OPCODES.add(64
|
49786 |
|
49787 | , vm => {
|
49788 | var {
|
49789 | stack
|
49790 | } = vm;
|
49791 | var handle = stack.pop();
|
49792 | var scope = stack.popJs();
|
49793 | var table = stack.popJs();
|
49794 | var args = stack.pop();
|
49795 |
|
49796 | if (table === null) {
|
49797 |
|
49798 | vm.pushFrame();
|
49799 | vm.pushScope(scope);
|
49800 |
|
49801 | return;
|
49802 | }
|
49803 |
|
49804 | var invokingScope = scope;
|
49805 |
|
49806 | {
|
49807 | var locals = table.parameters;
|
49808 | var localsCount = locals.length;
|
49809 |
|
49810 | if (localsCount > 0) {
|
49811 | invokingScope = invokingScope.child();
|
49812 |
|
49813 | for (var i = 0; i < localsCount; i++) {
|
49814 | invokingScope.bindSymbol(locals[i], args.at(i));
|
49815 | }
|
49816 | }
|
49817 | }
|
49818 | vm.pushFrame();
|
49819 | vm.pushScope(invokingScope);
|
49820 | vm.call(handle);
|
49821 | });
|
49822 | APPEND_OPCODES.add(65
|
49823 |
|
49824 | , (vm, {
|
49825 | op1: target
|
49826 | }) => {
|
49827 | var reference = vm.stack.popJs();
|
49828 |
|
49829 | if ((0, _validator.isConstTagged)(reference)) {
|
49830 | if (reference.value()) {
|
49831 | vm.goto(target);
|
49832 | }
|
49833 | } else {
|
49834 | var cache = new _reference.ReferenceCache(reference);
|
49835 |
|
49836 | if (cache.peek()) {
|
49837 | vm.goto(target);
|
49838 | }
|
49839 |
|
49840 | vm.updateWith(new Assert(cache));
|
49841 | }
|
49842 | });
|
49843 | APPEND_OPCODES.add(66
|
49844 |
|
49845 | , (vm, {
|
49846 | op1: target
|
49847 | }) => {
|
49848 | var reference = vm.stack.popJs();
|
49849 |
|
49850 | if ((0, _validator.isConstTagged)(reference)) {
|
49851 | if (!reference.value()) {
|
49852 | vm.goto(target);
|
49853 | }
|
49854 | } else {
|
49855 | var cache = new _reference.ReferenceCache(reference);
|
49856 |
|
49857 | if (!cache.peek()) {
|
49858 | vm.goto(target);
|
49859 | }
|
49860 |
|
49861 | vm.updateWith(new Assert(cache));
|
49862 | }
|
49863 | });
|
49864 | APPEND_OPCODES.add(67
|
49865 |
|
49866 | , (vm, {
|
49867 | op1: target,
|
49868 | op2: comparison
|
49869 | }) => {
|
49870 | var other = vm.stack.peekSmallInt();
|
49871 |
|
49872 | if (other === comparison) {
|
49873 | vm.goto(target);
|
49874 | }
|
49875 | });
|
49876 | APPEND_OPCODES.add(68
|
49877 |
|
49878 | , vm => {
|
49879 | var reference = vm.stack.peekJs();
|
49880 |
|
49881 | if (!(0, _validator.isConstTagged)(reference)) {
|
49882 | vm.updateWith(Assert.initialize(new _reference.ReferenceCache(reference)));
|
49883 | }
|
49884 | });
|
49885 | APPEND_OPCODES.add(71
|
49886 |
|
49887 | , vm => {
|
49888 | var {
|
49889 | env,
|
49890 | stack
|
49891 | } = vm;
|
49892 | stack.pushJs(env.toConditionalReference(stack.popJs()));
|
49893 | });
|
49894 |
|
49895 | class Assert extends UpdatingOpcode {
|
49896 | constructor(cache) {
|
49897 | super();
|
49898 | this.type = 'assert';
|
49899 | this.tag = cache.tag;
|
49900 | this.cache = cache;
|
49901 | }
|
49902 |
|
49903 | static initialize(cache) {
|
49904 | var assert = new Assert(cache);
|
49905 | cache.peek();
|
49906 | return assert;
|
49907 | }
|
49908 |
|
49909 | evaluate(vm) {
|
49910 | var {
|
49911 | cache
|
49912 | } = this;
|
49913 |
|
49914 | if ((0, _reference.isModified)(cache.revalidate())) {
|
49915 | vm.throw();
|
49916 | }
|
49917 | }
|
49918 |
|
49919 | }
|
49920 |
|
49921 | class JumpIfNotModifiedOpcode extends UpdatingOpcode {
|
49922 | constructor(index) {
|
49923 | super();
|
49924 | this.index = index;
|
49925 | this.type = 'jump-if-not-modified';
|
49926 | this.tag = _validator.CONSTANT_TAG;
|
49927 | this.lastRevision = _validator.INITIAL;
|
49928 | }
|
49929 |
|
49930 | finalize(tag, target) {
|
49931 | this.tag = tag;
|
49932 | this.target = target;
|
49933 | }
|
49934 |
|
49935 | evaluate(vm) {
|
49936 | var {
|
49937 | tag,
|
49938 | target,
|
49939 | lastRevision
|
49940 | } = this;
|
49941 |
|
49942 | if (!vm.alwaysRevalidate && (0, _validator.validateTag)(tag, lastRevision)) {
|
49943 | vm.goto(target);
|
49944 | }
|
49945 | }
|
49946 |
|
49947 | didModify() {
|
49948 | this.lastRevision = (0, _validator.valueForTag)(this.tag);
|
49949 | }
|
49950 |
|
49951 | }
|
49952 |
|
49953 | class DidModifyOpcode extends UpdatingOpcode {
|
49954 | constructor(target) {
|
49955 | super();
|
49956 | this.target = target;
|
49957 | this.type = 'did-modify';
|
49958 | this.tag = _validator.CONSTANT_TAG;
|
49959 | }
|
49960 |
|
49961 | evaluate() {
|
49962 | this.target.didModify();
|
49963 | }
|
49964 |
|
49965 | }
|
49966 |
|
49967 | APPEND_OPCODES.add(41
|
49968 |
|
49969 | , (vm, {
|
49970 | op1: text
|
49971 | }) => {
|
49972 | vm.elements().appendText(vm[CONSTANTS].getValue(text));
|
49973 | });
|
49974 | APPEND_OPCODES.add(42
|
49975 |
|
49976 | , (vm, {
|
49977 | op1: text
|
49978 | }) => {
|
49979 | vm.elements().appendComment(vm[CONSTANTS].getValue(text));
|
49980 | });
|
49981 | APPEND_OPCODES.add(48
|
49982 |
|
49983 | , (vm, {
|
49984 | op1: tag
|
49985 | }) => {
|
49986 | vm.elements().openElement(vm[CONSTANTS].getValue(tag));
|
49987 | });
|
49988 | APPEND_OPCODES.add(49
|
49989 |
|
49990 | , vm => {
|
49991 | var tagName = vm.stack.popJs().value();
|
49992 | vm.elements().openElement(tagName);
|
49993 | });
|
49994 | APPEND_OPCODES.add(50
|
49995 |
|
49996 | , vm => {
|
49997 | var elementRef = vm.stack.popJs();
|
49998 | var insertBeforeRef = vm.stack.popJs();
|
49999 | var guidRef = vm.stack.popJs();
|
50000 | var element;
|
50001 | var insertBefore;
|
50002 | var guid = guidRef.value();
|
50003 |
|
50004 | if ((0, _validator.isConstTagged)(elementRef)) {
|
50005 | element = elementRef.value();
|
50006 | } else {
|
50007 | var cache = new _reference.ReferenceCache(elementRef);
|
50008 | element = cache.peek();
|
50009 | vm.updateWith(new Assert(cache));
|
50010 | }
|
50011 |
|
50012 | if (insertBeforeRef.value() !== undefined) {
|
50013 | if ((0, _validator.isConstTagged)(insertBeforeRef)) {
|
50014 | insertBefore = insertBeforeRef.value();
|
50015 | } else {
|
50016 | var _cache = new _reference.ReferenceCache(insertBeforeRef);
|
50017 |
|
50018 | insertBefore = _cache.peek();
|
50019 | vm.updateWith(new Assert(_cache));
|
50020 | }
|
50021 | }
|
50022 |
|
50023 | var block = vm.elements().pushRemoteElement(element, guid, insertBefore);
|
50024 | if (block) vm.associateDestroyable(block);
|
50025 | });
|
50026 | APPEND_OPCODES.add(56
|
50027 |
|
50028 | , vm => {
|
50029 | vm.elements().popRemoteElement();
|
50030 | });
|
50031 | APPEND_OPCODES.add(54
|
50032 |
|
50033 | , vm => {
|
50034 | var operations = vm.fetchValue(_vm2.$t0);
|
50035 | var modifiers = null;
|
50036 |
|
50037 | if (operations) {
|
50038 | modifiers = operations.flush(vm);
|
50039 | vm.loadValue(_vm2.$t0, null);
|
50040 | }
|
50041 |
|
50042 | vm.elements().flushElement(modifiers);
|
50043 | });
|
50044 | APPEND_OPCODES.add(55
|
50045 |
|
50046 | , vm => {
|
50047 | var modifiers = vm.elements().closeElement();
|
50048 |
|
50049 | if (modifiers) {
|
50050 | modifiers.forEach(([manager, modifier]) => {
|
50051 | vm.env.scheduleInstallModifier(modifier, manager);
|
50052 | var d = manager.getDestroyable(modifier);
|
50053 |
|
50054 | if (d) {
|
50055 | vm.associateDestroyable(d);
|
50056 | }
|
50057 | });
|
50058 | }
|
50059 | });
|
50060 | APPEND_OPCODES.add(57
|
50061 |
|
50062 | , (vm, {
|
50063 | op1: handle
|
50064 | }) => {
|
50065 | var {
|
50066 | manager,
|
50067 | state
|
50068 | } = vm.runtime.resolver.resolve(handle);
|
50069 | var stack = vm.stack;
|
50070 | var args = stack.popJs();
|
50071 | var {
|
50072 | constructing,
|
50073 | updateOperations
|
50074 | } = vm.elements();
|
50075 | var dynamicScope = vm.dynamicScope();
|
50076 | var modifier = manager.create(constructing, state, args, dynamicScope, updateOperations);
|
50077 | var operations = vm.fetchValue(_vm2.$t0);
|
50078 | operations.addModifier(manager, modifier);
|
50079 | var tag = manager.getTag(modifier);
|
50080 |
|
50081 | if (!(0, _validator.isConstTag)(tag)) {
|
50082 | vm.updateWith(new UpdateModifierOpcode(tag, manager, modifier));
|
50083 | }
|
50084 | });
|
50085 |
|
50086 | class UpdateModifierOpcode extends UpdatingOpcode {
|
50087 | constructor(tag, manager, modifier) {
|
50088 | super();
|
50089 | this.tag = tag;
|
50090 | this.manager = manager;
|
50091 | this.modifier = modifier;
|
50092 | this.type = 'update-modifier';
|
50093 | this.lastUpdated = (0, _validator.valueForTag)(tag);
|
50094 | }
|
50095 |
|
50096 | evaluate(vm) {
|
50097 | var {
|
50098 | manager,
|
50099 | modifier,
|
50100 | tag,
|
50101 | lastUpdated
|
50102 | } = this;
|
50103 |
|
50104 | if (!(0, _validator.validateTag)(tag, lastUpdated)) {
|
50105 | vm.env.scheduleUpdateModifier(modifier, manager);
|
50106 | this.lastUpdated = (0, _validator.valueForTag)(tag);
|
50107 | }
|
50108 | }
|
50109 |
|
50110 | }
|
50111 |
|
50112 | APPEND_OPCODES.add(51
|
50113 |
|
50114 | , (vm, {
|
50115 | op1: _name,
|
50116 | op2: _value,
|
50117 | op3: _namespace
|
50118 | }) => {
|
50119 | var name = vm[CONSTANTS].getValue(_name);
|
50120 | var value = vm[CONSTANTS].getValue(_value);
|
50121 | var namespace = _namespace ? vm[CONSTANTS].getValue(_namespace) : null;
|
50122 | vm.elements().setStaticAttribute(name, value, namespace);
|
50123 | });
|
50124 | APPEND_OPCODES.add(52
|
50125 |
|
50126 | , (vm, {
|
50127 | op1: _name,
|
50128 | op2: trusting,
|
50129 | op3: _namespace
|
50130 | }) => {
|
50131 | var name = vm[CONSTANTS].getValue(_name);
|
50132 | var reference = vm.stack.popJs();
|
50133 | var value = reference.value();
|
50134 | var namespace = _namespace ? vm[CONSTANTS].getValue(_namespace) : null;
|
50135 | var attribute = vm.elements().setDynamicAttribute(name, value, !!trusting, namespace);
|
50136 |
|
50137 | if (!(0, _validator.isConstTagged)(reference)) {
|
50138 | vm.updateWith(new UpdateDynamicAttributeOpcode(reference, attribute));
|
50139 | }
|
50140 | });
|
50141 |
|
50142 | class UpdateDynamicAttributeOpcode extends UpdatingOpcode {
|
50143 | constructor(reference, attribute) {
|
50144 | super();
|
50145 | this.reference = reference;
|
50146 | this.attribute = attribute;
|
50147 | this.type = 'patch-element';
|
50148 | var {
|
50149 | tag
|
50150 | } = reference;
|
50151 | this.tag = tag;
|
50152 | this.lastRevision = (0, _validator.valueForTag)(tag);
|
50153 | }
|
50154 |
|
50155 | evaluate(vm) {
|
50156 | var {
|
50157 | attribute,
|
50158 | reference,
|
50159 | tag
|
50160 | } = this;
|
50161 |
|
50162 | if (!(0, _validator.validateTag)(tag, this.lastRevision)) {
|
50163 | attribute.update(reference.value(), vm.env);
|
50164 | this.lastRevision = (0, _validator.valueForTag)(tag);
|
50165 | }
|
50166 | }
|
50167 |
|
50168 | }
|
50169 | |
50170 |
|
50171 |
|
50172 |
|
50173 |
|
50174 |
|
50175 |
|
50176 |
|
50177 |
|
50178 |
|
50179 |
|
50180 | var COMPONENT_INSTANCE = (0, _util.symbol)('COMPONENT_INSTANCE');
|
50181 | APPEND_OPCODES.add(77
|
50182 |
|
50183 | , vm => {
|
50184 | var stack = vm.stack;
|
50185 | var ref = stack.popJs();
|
50186 | stack.pushJs(new ConditionalReference(ref, isCurriedComponentDefinition));
|
50187 | });
|
50188 | APPEND_OPCODES.add(78
|
50189 |
|
50190 | , vm => {
|
50191 | var stack = vm.stack;
|
50192 | var ref = stack.peekJs();
|
50193 | stack.pushJs(new ContentTypeReference(ref));
|
50194 | });
|
50195 | APPEND_OPCODES.add(79
|
50196 |
|
50197 | , (vm, {
|
50198 | op1: _meta
|
50199 | }) => {
|
50200 | var stack = vm.stack;
|
50201 | var definition = stack.popJs();
|
50202 | var capturedArgs = stack.popJs();
|
50203 | var meta = vm[CONSTANTS].getValue((0, _util.decodeHandle)(_meta));
|
50204 | var resolver = vm.runtime.resolver;
|
50205 | vm.loadValue(_vm2.$v0, new CurryComponentReference(definition, resolver, meta, capturedArgs));
|
50206 | });
|
50207 | APPEND_OPCODES.add(80
|
50208 |
|
50209 | , (vm, {
|
50210 | op1: handle
|
50211 | }) => {
|
50212 | var definition = vm.runtime.resolver.resolve(handle);
|
50213 | var {
|
50214 | manager
|
50215 | } = definition;
|
50216 | var capabilities = capabilityFlagsFrom(manager.getCapabilities(definition.state));
|
50217 | var instance = {
|
50218 | [COMPONENT_INSTANCE]: true,
|
50219 | definition,
|
50220 | manager,
|
50221 | capabilities,
|
50222 | state: null,
|
50223 | handle: null,
|
50224 | table: null,
|
50225 | lookup: null
|
50226 | };
|
50227 | vm.stack.pushJs(instance);
|
50228 | });
|
50229 | APPEND_OPCODES.add(83
|
50230 |
|
50231 | , (vm, {
|
50232 | op1: _meta
|
50233 | }) => {
|
50234 | var stack = vm.stack;
|
50235 | var component = stack.popJs().value();
|
50236 | var meta = vm[CONSTANTS].getValue((0, _util.decodeHandle)(_meta));
|
50237 | vm.loadValue(_vm2.$t1, null);
|
50238 |
|
50239 | var definition;
|
50240 |
|
50241 | if (typeof component === 'string') {
|
50242 | var resolvedDefinition = resolveComponent(vm.runtime.resolver, component, meta);
|
50243 | definition = resolvedDefinition;
|
50244 | } else if (isCurriedComponentDefinition(component)) {
|
50245 | definition = component;
|
50246 | } else {
|
50247 | throw (0, _util.unreachable)();
|
50248 | }
|
50249 |
|
50250 | stack.pushJs(definition);
|
50251 | });
|
50252 | APPEND_OPCODES.add(81
|
50253 |
|
50254 | , vm => {
|
50255 | var {
|
50256 | stack
|
50257 | } = vm;
|
50258 | var definition = stack.pop();
|
50259 | var capabilities, manager;
|
50260 |
|
50261 | if (isCurriedComponentDefinition(definition)) {
|
50262 | manager = capabilities = null;
|
50263 | } else {
|
50264 | manager = definition.manager;
|
50265 | capabilities = capabilityFlagsFrom(manager.getCapabilities(definition.state));
|
50266 | }
|
50267 |
|
50268 | stack.pushJs({
|
50269 | definition,
|
50270 | capabilities,
|
50271 | manager,
|
50272 | state: null,
|
50273 | handle: null,
|
50274 | table: null
|
50275 | });
|
50276 | });
|
50277 | APPEND_OPCODES.add(82
|
50278 |
|
50279 | , vm => {
|
50280 | var stack = vm.stack;
|
50281 | var component = stack.popJs().value();
|
50282 | var definition;
|
50283 |
|
50284 | if (isCurriedComponentDefinition(component)) {
|
50285 | definition = component;
|
50286 | } else {
|
50287 | throw (0, _util.unreachable)();
|
50288 | }
|
50289 |
|
50290 | stack.pushJs(definition);
|
50291 | });
|
50292 | APPEND_OPCODES.add(84
|
50293 |
|
50294 | , (vm, {
|
50295 | op1: _names,
|
50296 | op2: _blockNames,
|
50297 | op3: flags
|
50298 | }) => {
|
50299 | var stack = vm.stack;
|
50300 | var names = vm[CONSTANTS].getArray(_names);
|
50301 | var positionalCount = flags >> 4;
|
50302 | var atNames = flags & 0b1000;
|
50303 | var blockNames = flags & 0b0111 ? vm[CONSTANTS].getArray(_blockNames) : _util.EMPTY_ARRAY;
|
50304 | vm[ARGS].setup(stack, names, blockNames, positionalCount, !!atNames);
|
50305 | stack.pushJs(vm[ARGS]);
|
50306 | });
|
50307 | APPEND_OPCODES.add(85
|
50308 |
|
50309 | , vm => {
|
50310 | var {
|
50311 | stack
|
50312 | } = vm;
|
50313 | stack.pushJs(vm[ARGS].empty(stack));
|
50314 | });
|
50315 | APPEND_OPCODES.add(88
|
50316 |
|
50317 | , vm => {
|
50318 | var stack = vm.stack;
|
50319 | var args = stack.popJs();
|
50320 | var capturedArgs = args.capture();
|
50321 | stack.pushJs(capturedArgs);
|
50322 | });
|
50323 | APPEND_OPCODES.add(87
|
50324 |
|
50325 | , (vm, {
|
50326 | op1: _state
|
50327 | }) => {
|
50328 | var stack = vm.stack;
|
50329 | var instance = vm.fetchValue(_state);
|
50330 | var args = stack.popJs();
|
50331 | var {
|
50332 | definition
|
50333 | } = instance;
|
50334 |
|
50335 | if (isCurriedComponentDefinition(definition)) {
|
50336 | definition = resolveCurriedComponentDefinition(instance, definition, args);
|
50337 | }
|
50338 |
|
50339 | var {
|
50340 | manager,
|
50341 | state
|
50342 | } = definition;
|
50343 | var capabilities = instance.capabilities;
|
50344 |
|
50345 | if (!managerHasCapability(manager, capabilities, 4
|
50346 |
|
50347 | )) {
|
50348 | stack.pushJs(args);
|
50349 | return;
|
50350 | }
|
50351 |
|
50352 | var blocks = args.blocks.values;
|
50353 | var blockNames = args.blocks.names;
|
50354 | var preparedArgs = manager.prepareArgs(state, args);
|
50355 |
|
50356 | if (preparedArgs) {
|
50357 | args.clear();
|
50358 |
|
50359 | for (var i = 0; i < blocks.length; i++) {
|
50360 | var block = blocks[i];
|
50361 |
|
50362 | if (typeof block === 'number') {
|
50363 | stack.pushSmallInt(block);
|
50364 | } else {
|
50365 | stack.pushJs(block);
|
50366 | }
|
50367 | }
|
50368 |
|
50369 | var {
|
50370 | positional,
|
50371 | named
|
50372 | } = preparedArgs;
|
50373 | var positionalCount = positional.length;
|
50374 |
|
50375 | for (var _i4 = 0; _i4 < positionalCount; _i4++) {
|
50376 | stack.pushJs(positional[_i4]);
|
50377 | }
|
50378 |
|
50379 | var names = Object.keys(named);
|
50380 |
|
50381 | for (var _i5 = 0; _i5 < names.length; _i5++) {
|
50382 | stack.pushJs(named[names[_i5]]);
|
50383 | }
|
50384 |
|
50385 | args.setup(stack, names, blockNames, positionalCount, false);
|
50386 | }
|
50387 |
|
50388 | stack.pushJs(args);
|
50389 | });
|
50390 |
|
50391 | function resolveCurriedComponentDefinition(instance, definition, args) {
|
50392 | var unwrappedDefinition = instance.definition = definition.unwrap(args);
|
50393 | var {
|
50394 | manager,
|
50395 | state
|
50396 | } = unwrappedDefinition;
|
50397 | instance.manager = manager;
|
50398 | instance.capabilities = capabilityFlagsFrom(manager.getCapabilities(state));
|
50399 | return unwrappedDefinition;
|
50400 | }
|
50401 |
|
50402 | APPEND_OPCODES.add(89
|
50403 |
|
50404 | , (vm, {
|
50405 | op1: flags,
|
50406 | op2: _state
|
50407 | }) => {
|
50408 | var instance = vm.fetchValue(_state);
|
50409 | var {
|
50410 | definition,
|
50411 | manager
|
50412 | } = instance;
|
50413 | var capabilities = instance.capabilities = capabilityFlagsFrom(manager.getCapabilities(definition.state));
|
50414 |
|
50415 | if (!managerHasCapability(manager, capabilities, 512
|
50416 |
|
50417 | )) {
|
50418 | throw new Error(`BUG`);
|
50419 | }
|
50420 |
|
50421 | var dynamicScope = null;
|
50422 |
|
50423 | if (managerHasCapability(manager, capabilities, 64
|
50424 |
|
50425 | )) {
|
50426 | dynamicScope = vm.dynamicScope();
|
50427 | }
|
50428 |
|
50429 | var hasDefaultBlock = flags & 1;
|
50430 | var args = null;
|
50431 |
|
50432 | if (managerHasCapability(manager, capabilities, 8
|
50433 |
|
50434 | )) {
|
50435 | args = vm.stack.peekJs();
|
50436 | }
|
50437 |
|
50438 | var self = null;
|
50439 |
|
50440 | if (managerHasCapability(manager, capabilities, 128
|
50441 |
|
50442 | )) {
|
50443 | self = vm.getSelf();
|
50444 | }
|
50445 |
|
50446 | var state = manager.create(vm.env, definition.state, args, dynamicScope, self, !!hasDefaultBlock);
|
50447 |
|
50448 |
|
50449 | instance.state = state;
|
50450 | var tag = manager.getTag(state);
|
50451 |
|
50452 | if (managerHasCapability(manager, capabilities, 256
|
50453 |
|
50454 | ) && !(0, _validator.isConstTag)(tag)) {
|
50455 | vm.updateWith(new UpdateComponentOpcode(tag, state, manager, dynamicScope));
|
50456 | }
|
50457 | });
|
50458 | APPEND_OPCODES.add(90
|
50459 |
|
50460 | , (vm, {
|
50461 | op1: _state
|
50462 | }) => {
|
50463 | var {
|
50464 | manager,
|
50465 | state,
|
50466 | capabilities
|
50467 | } = vm.fetchValue(_state);
|
50468 | var d = manager.getDestroyable(state);
|
50469 |
|
50470 | if (true
|
50471 |
|
50472 | && !hasCapability(capabilities, 2048
|
50473 |
|
50474 | ) && d !== null && typeof 'willDestroy' in d) {
|
50475 | throw new Error('BUG: Destructor has willDestroy, but the willDestroy capability was not enabled for this component. Pre-destruction hooks must be explicitly opted into');
|
50476 | }
|
50477 |
|
50478 | if (d) vm.associateDestroyable(d);
|
50479 | });
|
50480 | APPEND_OPCODES.add(100
|
50481 |
|
50482 | , vm => {
|
50483 | vm.beginCacheGroup();
|
50484 | vm.elements().pushSimpleBlock();
|
50485 | });
|
50486 | APPEND_OPCODES.add(91
|
50487 |
|
50488 | , vm => {
|
50489 | vm.loadValue(_vm2.$t0, new ComponentElementOperations());
|
50490 | });
|
50491 | APPEND_OPCODES.add(53
|
50492 |
|
50493 | , (vm, {
|
50494 | op1: _name,
|
50495 | op2: trusting,
|
50496 | op3: _namespace
|
50497 | }) => {
|
50498 | var name = vm[CONSTANTS].getValue(_name);
|
50499 | var reference = vm.stack.popJs();
|
50500 | var namespace = _namespace ? vm[CONSTANTS].getValue(_namespace) : null;
|
50501 | vm.fetchValue(_vm2.$t0).setAttribute(name, reference, !!trusting, namespace);
|
50502 | });
|
50503 | APPEND_OPCODES.add(108
|
50504 |
|
50505 | , (vm, {
|
50506 | op1: _name,
|
50507 | op2: _value,
|
50508 | op3: _namespace
|
50509 | }) => {
|
50510 | var name = vm[CONSTANTS].getValue(_name);
|
50511 | var value = vm[CONSTANTS].getValue(_value);
|
50512 | var namespace = _namespace ? vm[CONSTANTS].getValue(_namespace) : null;
|
50513 | vm.fetchValue(_vm2.$t0).setStaticAttribute(name, value, namespace);
|
50514 | });
|
50515 |
|
50516 | class ComponentElementOperations {
|
50517 | constructor() {
|
50518 | this.attributes = (0, _util.dict)();
|
50519 | this.classes = [];
|
50520 | this.modifiers = [];
|
50521 | }
|
50522 |
|
50523 | setAttribute(name, value, trusting, namespace) {
|
50524 | var deferred = {
|
50525 | value,
|
50526 | namespace,
|
50527 | trusting
|
50528 | };
|
50529 |
|
50530 | if (name === 'class') {
|
50531 | this.classes.push(value);
|
50532 | }
|
50533 |
|
50534 | this.attributes[name] = deferred;
|
50535 | }
|
50536 |
|
50537 | setStaticAttribute(name, value, namespace) {
|
50538 | var deferred = {
|
50539 | value,
|
50540 | namespace
|
50541 | };
|
50542 |
|
50543 | if (name === 'class') {
|
50544 | this.classes.push(value);
|
50545 | }
|
50546 |
|
50547 | this.attributes[name] = deferred;
|
50548 | }
|
50549 |
|
50550 | addModifier(manager, state) {
|
50551 | this.modifiers.push([manager, state]);
|
50552 | }
|
50553 |
|
50554 | flush(vm) {
|
50555 | var type;
|
50556 | var attributes = this.attributes;
|
50557 |
|
50558 | for (var _name3 in this.attributes) {
|
50559 | if (_name3 === 'type') {
|
50560 | type = attributes[_name3];
|
50561 | continue;
|
50562 | }
|
50563 |
|
50564 | var attr = this.attributes[_name3];
|
50565 |
|
50566 | if (_name3 === 'class') {
|
50567 | setDeferredAttr(vm, 'class', mergeClasses(this.classes), attr.namespace, attr.trusting);
|
50568 | } else {
|
50569 | setDeferredAttr(vm, _name3, attr.value, attr.namespace, attr.trusting);
|
50570 | }
|
50571 | }
|
50572 |
|
50573 | if (type !== undefined) {
|
50574 | setDeferredAttr(vm, 'type', type.value, type.namespace, type.trusting);
|
50575 | }
|
50576 |
|
50577 | return this.modifiers;
|
50578 | }
|
50579 |
|
50580 | }
|
50581 |
|
50582 | function mergeClasses(classes) {
|
50583 | if (classes.length === 0) {
|
50584 | return '';
|
50585 | }
|
50586 |
|
50587 | if (classes.length === 1) {
|
50588 | return classes[0];
|
50589 | }
|
50590 |
|
50591 | if (allStringClasses(classes)) {
|
50592 | return classes.join(' ');
|
50593 | }
|
50594 |
|
50595 | return makeClassList(classes);
|
50596 | }
|
50597 |
|
50598 | function makeClassList(classes) {
|
50599 | for (var i = 0; i < classes.length; i++) {
|
50600 | var value = classes[i];
|
50601 |
|
50602 | if (typeof value === 'string') {
|
50603 | classes[i] = PrimitiveReference.create(value);
|
50604 | }
|
50605 | }
|
50606 |
|
50607 | return new ClassListReference(classes);
|
50608 | }
|
50609 |
|
50610 | function allStringClasses(classes) {
|
50611 | for (var i = 0; i < classes.length; i++) {
|
50612 | if (typeof classes[i] !== 'string') {
|
50613 | return false;
|
50614 | }
|
50615 | }
|
50616 |
|
50617 | return true;
|
50618 | }
|
50619 |
|
50620 | function setDeferredAttr(vm, name, value, namespace, trusting = false) {
|
50621 | if (typeof value === 'string') {
|
50622 | vm.elements().setStaticAttribute(name, value, namespace);
|
50623 | } else {
|
50624 | var attribute = vm.elements().setDynamicAttribute(name, value.value(), trusting, namespace);
|
50625 |
|
50626 | if (!(0, _validator.isConstTagged)(value)) {
|
50627 | vm.updateWith(new UpdateDynamicAttributeOpcode(value, attribute));
|
50628 | }
|
50629 | }
|
50630 | }
|
50631 |
|
50632 | APPEND_OPCODES.add(102
|
50633 |
|
50634 | , (vm, {
|
50635 | op1: _state
|
50636 | }) => {
|
50637 | var {
|
50638 | definition,
|
50639 | state
|
50640 | } = vm.fetchValue(_state);
|
50641 | var {
|
50642 | manager
|
50643 | } = definition;
|
50644 | var operations = vm.fetchValue(_vm2.$t0);
|
50645 | manager.didCreateElement(state, vm.elements().constructing, operations);
|
50646 | });
|
50647 | APPEND_OPCODES.add(92
|
50648 |
|
50649 | , (vm, {
|
50650 | op1: _state
|
50651 | }) => {
|
50652 | var {
|
50653 | definition,
|
50654 | state
|
50655 | } = vm.fetchValue(_state);
|
50656 | var {
|
50657 | manager
|
50658 | } = definition;
|
50659 | vm.stack.pushJs(manager.getSelf(state));
|
50660 | });
|
50661 | APPEND_OPCODES.add(93
|
50662 |
|
50663 | , (vm, {
|
50664 | op1: _state
|
50665 | }) => {
|
50666 | var {
|
50667 | definition,
|
50668 | state
|
50669 | } = vm.fetchValue(_state);
|
50670 | var {
|
50671 | manager
|
50672 | } = definition;
|
50673 | var tagName = manager.getTagName(state);
|
50674 |
|
50675 | vm.stack.pushJs(tagName);
|
50676 | });
|
50677 |
|
50678 | APPEND_OPCODES.add(95
|
50679 |
|
50680 | , (vm, {
|
50681 | op1: _state
|
50682 | }) => {
|
50683 | var instance = vm.fetchValue(_state);
|
50684 | var manager = instance.manager;
|
50685 | var {
|
50686 | definition
|
50687 | } = instance;
|
50688 | var {
|
50689 | stack
|
50690 | } = vm;
|
50691 | var {
|
50692 | capabilities
|
50693 | } = instance;
|
50694 |
|
50695 | var layout;
|
50696 |
|
50697 | if (hasStaticLayoutCapability(capabilities, manager)) {
|
50698 | layout = manager.getJitStaticLayout(definition.state, vm.runtime.resolver);
|
50699 | } else if (hasDynamicLayoutCapability(capabilities, manager)) {
|
50700 | var template = (0, _util.unwrapTemplate)(manager.getJitDynamicLayout(instance.state, vm.runtime.resolver));
|
50701 |
|
50702 | if (hasCapability(capabilities, 1024
|
50703 |
|
50704 | )) {
|
50705 | layout = template.asWrappedLayout();
|
50706 | } else {
|
50707 | layout = template.asLayout();
|
50708 | }
|
50709 | } else {
|
50710 | throw (0, _util.unreachable)();
|
50711 | }
|
50712 |
|
50713 | var handle = layout.compile(vm.context);
|
50714 | stack.pushJs(layout.symbolTable);
|
50715 |
|
50716 | if (true
|
50717 |
|
50718 | && (0, _util.isErrHandle)(handle)) {
|
50719 | stack.pushJs(handle);
|
50720 | } else {
|
50721 | stack.pushSmallInt(handle);
|
50722 | }
|
50723 | }, 'jit');
|
50724 |
|
50725 | APPEND_OPCODES.add(94
|
50726 |
|
50727 | , (vm, {
|
50728 | op1: _state
|
50729 | }) => {
|
50730 | var instance = vm.fetchValue(_state);
|
50731 | var {
|
50732 | manager,
|
50733 | definition
|
50734 | } = instance;
|
50735 | var {
|
50736 | stack
|
50737 | } = vm;
|
50738 | var {
|
50739 | state: instanceState,
|
50740 | capabilities
|
50741 | } = instance;
|
50742 | var {
|
50743 | state: definitionState
|
50744 | } = definition;
|
50745 | var invoke;
|
50746 |
|
50747 | if (hasStaticLayoutCapability(capabilities, manager)) {
|
50748 | invoke = manager.getAotStaticLayout(definitionState, vm.runtime.resolver);
|
50749 | } else if (hasDynamicLayoutCapability(capabilities, manager)) {
|
50750 | invoke = manager.getAotDynamicLayout(instanceState, vm.runtime.resolver);
|
50751 | } else {
|
50752 | throw (0, _util.unreachable)();
|
50753 | }
|
50754 |
|
50755 | stack.pushJs(invoke.symbolTable);
|
50756 |
|
50757 | if (true
|
50758 |
|
50759 | && (0, _util.isErrHandle)(invoke.handle)) {
|
50760 | stack.pushJs(invoke.handle);
|
50761 | } else {
|
50762 | stack.pushSmallInt(invoke.handle);
|
50763 | }
|
50764 | });
|
50765 |
|
50766 | function hasStaticLayoutCapability(capabilities, _manager) {
|
50767 | return managerHasCapability(_manager, capabilities, 1
|
50768 |
|
50769 | ) === false;
|
50770 | }
|
50771 |
|
50772 | function hasDynamicLayoutCapability(capabilities, _manager) {
|
50773 | return managerHasCapability(_manager, capabilities, 1
|
50774 |
|
50775 | ) === true;
|
50776 | }
|
50777 |
|
50778 | APPEND_OPCODES.add(76
|
50779 |
|
50780 | , (vm, {
|
50781 | op1: register
|
50782 | }) => {
|
50783 | var definition = vm.stack.popJs();
|
50784 | var invocation = vm.stack.popJs();
|
50785 | var {
|
50786 | manager
|
50787 | } = definition;
|
50788 | var capabilities = capabilityFlagsFrom(manager.getCapabilities(definition.state));
|
50789 | var state = {
|
50790 | [COMPONENT_INSTANCE]: true,
|
50791 | definition,
|
50792 | manager,
|
50793 | capabilities,
|
50794 | state: null,
|
50795 | handle: invocation.handle,
|
50796 | table: invocation.symbolTable,
|
50797 | lookup: null
|
50798 | };
|
50799 | vm.loadValue(register, state);
|
50800 | });
|
50801 | APPEND_OPCODES.add(98
|
50802 |
|
50803 | , (vm, {
|
50804 | op1: _state
|
50805 | }) => {
|
50806 | var {
|
50807 | stack
|
50808 | } = vm;
|
50809 |
|
50810 | var handle = true
|
50811 |
|
50812 | ? stack.pop() : stack.popSmallInt();
|
50813 | var table = stack.popJs();
|
50814 | var state = vm.fetchValue(_state);
|
50815 | state.handle = handle;
|
50816 | state.table = table;
|
50817 | });
|
50818 | APPEND_OPCODES.add(38
|
50819 |
|
50820 | , (vm, {
|
50821 | op1: _state
|
50822 | }) => {
|
50823 | var {
|
50824 | symbols
|
50825 | } = vm.fetchValue(_state).table;
|
50826 | vm.pushRootScope(symbols.length + 1);
|
50827 | });
|
50828 | APPEND_OPCODES.add(97
|
50829 |
|
50830 | , (vm, {
|
50831 | op1: _state
|
50832 | }) => {
|
50833 | var state = vm.fetchValue(_state);
|
50834 |
|
50835 | if (state.table.hasEval) {
|
50836 | var lookup = state.lookup = (0, _util.dict)();
|
50837 | vm.scope().bindEvalScope(lookup);
|
50838 | }
|
50839 | });
|
50840 | APPEND_OPCODES.add(17
|
50841 |
|
50842 | , (vm, {
|
50843 | op1: _state
|
50844 | }) => {
|
50845 | var state = vm.fetchValue(_state);
|
50846 | var scope = vm.scope();
|
50847 | var args = vm.stack.peekJs();
|
50848 | var callerNames = args.named.atNames;
|
50849 |
|
50850 | for (var i = callerNames.length - 1; i >= 0; i--) {
|
50851 | var atName = callerNames[i];
|
50852 | var symbol$$1 = state.table.symbols.indexOf(callerNames[i]);
|
50853 | var value = args.named.get(atName, true);
|
50854 | if (symbol$$1 !== -1) scope.bindSymbol(symbol$$1 + 1, value);
|
50855 | if (state.lookup) state.lookup[atName] = value;
|
50856 | }
|
50857 | });
|
50858 |
|
50859 | function bindBlock(symbolName, blockName, state, blocks, vm) {
|
50860 | var symbol$$1 = state.table.symbols.indexOf(symbolName);
|
50861 | var block = blocks.get(blockName);
|
50862 | if (symbol$$1 !== -1) vm.scope().bindBlock(symbol$$1 + 1, block);
|
50863 | if (state.lookup) state.lookup[symbolName] = block;
|
50864 | }
|
50865 |
|
50866 | APPEND_OPCODES.add(18
|
50867 |
|
50868 | , (vm, {
|
50869 | op1: _state
|
50870 | }) => {
|
50871 | var state = vm.fetchValue(_state);
|
50872 | var {
|
50873 | blocks
|
50874 | } = vm.stack.peekJs();
|
50875 |
|
50876 | for (var i = 0; i < blocks.names.length; i++) {
|
50877 | bindBlock(blocks.symbolNames[i], blocks.names[i], state, blocks, vm);
|
50878 | }
|
50879 | });
|
50880 |
|
50881 | APPEND_OPCODES.add(99
|
50882 |
|
50883 | , (vm, {
|
50884 | op1: _state
|
50885 | }) => {
|
50886 | var state = vm.fetchValue(_state);
|
50887 | vm.call(state.handle);
|
50888 | });
|
50889 | APPEND_OPCODES.add(103
|
50890 |
|
50891 | , (vm, {
|
50892 | op1: _state
|
50893 | }) => {
|
50894 | var {
|
50895 | manager,
|
50896 | state,
|
50897 | capabilities
|
50898 | } = vm.fetchValue(_state);
|
50899 | var bounds = vm.elements().popBlock();
|
50900 |
|
50901 | if (!managerHasCapability(manager, capabilities, 512
|
50902 |
|
50903 | )) {
|
50904 | throw new Error(`BUG`);
|
50905 | }
|
50906 |
|
50907 | var mgr = manager;
|
50908 | mgr.didRenderLayout(state, bounds);
|
50909 | vm.env.didCreate(state, manager);
|
50910 | vm.updateWith(new DidUpdateLayoutOpcode(manager, state, bounds));
|
50911 | });
|
50912 | APPEND_OPCODES.add(101
|
50913 |
|
50914 | , vm => {
|
50915 | vm.commitCacheGroup();
|
50916 | });
|
50917 |
|
50918 | class UpdateComponentOpcode extends UpdatingOpcode {
|
50919 | constructor(tag, component, manager, dynamicScope) {
|
50920 | super();
|
50921 | this.tag = tag;
|
50922 | this.component = component;
|
50923 | this.manager = manager;
|
50924 | this.dynamicScope = dynamicScope;
|
50925 | this.type = 'update-component';
|
50926 | }
|
50927 |
|
50928 | evaluate(_vm) {
|
50929 | var {
|
50930 | component,
|
50931 | manager,
|
50932 | dynamicScope
|
50933 | } = this;
|
50934 | manager.update(component, dynamicScope);
|
50935 | }
|
50936 |
|
50937 | }
|
50938 |
|
50939 | class DidUpdateLayoutOpcode extends UpdatingOpcode {
|
50940 | constructor(manager, component, bounds) {
|
50941 | super();
|
50942 | this.manager = manager;
|
50943 | this.component = component;
|
50944 | this.bounds = bounds;
|
50945 | this.type = 'did-update-layout';
|
50946 | this.tag = _validator.CONSTANT_TAG;
|
50947 | }
|
50948 |
|
50949 | evaluate(vm) {
|
50950 | var {
|
50951 | manager,
|
50952 | component,
|
50953 | bounds
|
50954 | } = this;
|
50955 | manager.didUpdateLayout(component, bounds);
|
50956 | vm.env.didUpdate(component, manager);
|
50957 | }
|
50958 |
|
50959 | }
|
50960 |
|
50961 | function debugCallback(context, get) {
|
50962 | console.info('Use `context`, and `get(<path>)` to debug this template.');
|
50963 |
|
50964 |
|
50965 | context === get('this'); // eslint-disable-next-line no-debugger
|
50966 |
|
50967 | debugger;
|
50968 | }
|
50969 |
|
50970 | var callback = debugCallback; // For testing purposes
|
50971 |
|
50972 | function setDebuggerCallback(cb) {
|
50973 | callback = cb;
|
50974 | }
|
50975 |
|
50976 | function resetDebuggerCallback() {
|
50977 | callback = debugCallback;
|
50978 | }
|
50979 |
|
50980 | class ScopeInspector {
|
50981 | constructor(scope, symbols, evalInfo) {
|
50982 | this.scope = scope;
|
50983 | this.locals = (0, _util.dict)();
|
50984 |
|
50985 | for (var i = 0; i < evalInfo.length; i++) {
|
50986 | var slot = evalInfo[i];
|
50987 | var _name4 = symbols[slot - 1];
|
50988 | var ref = scope.getSymbol(slot);
|
50989 | this.locals[_name4] = ref;
|
50990 | }
|
50991 | }
|
50992 |
|
50993 | get(path) {
|
50994 | var {
|
50995 | scope,
|
50996 | locals
|
50997 | } = this;
|
50998 | var parts = path.split('.');
|
50999 | var [head, ...tail] = path.split('.');
|
51000 | var evalScope = scope.getEvalScope();
|
51001 | var ref;
|
51002 |
|
51003 | if (head === 'this') {
|
51004 | ref = scope.getSelf();
|
51005 | } else if (locals[head]) {
|
51006 | ref = locals[head];
|
51007 | } else if (head.indexOf('@') === 0 && evalScope[head]) {
|
51008 | ref = evalScope[head];
|
51009 | } else {
|
51010 | ref = this.scope.getSelf();
|
51011 | tail = parts;
|
51012 | }
|
51013 |
|
51014 | return tail.reduce((r, part) => r.get(part), ref);
|
51015 | }
|
51016 |
|
51017 | }
|
51018 |
|
51019 | APPEND_OPCODES.add(106
|
51020 |
|
51021 | , (vm, {
|
51022 | op1: _symbols,
|
51023 | op2: _evalInfo
|
51024 | }) => {
|
51025 | var symbols = vm[CONSTANTS].getArray(_symbols);
|
51026 | var evalInfo = vm[CONSTANTS].getValue((0, _util.decodeHandle)(_evalInfo));
|
51027 | var inspector = new ScopeInspector(vm.scope(), symbols, evalInfo);
|
51028 | callback(vm.getSelf().value(), path => inspector.get(path).value());
|
51029 | });
|
51030 | APPEND_OPCODES.add(104
|
51031 |
|
51032 | , (vm, {
|
51033 | op1: _meta,
|
51034 | op2: _symbols,
|
51035 | op3: _evalInfo
|
51036 | }) => {
|
51037 | var {
|
51038 | [CONSTANTS]: constants$$1,
|
51039 | stack
|
51040 | } = vm;
|
51041 | var name = stack.popJs().value();
|
51042 | var meta = constants$$1.getValue((0, _util.decodeHandle)(_meta));
|
51043 | var outerSymbols = constants$$1.getArray(_symbols);
|
51044 | var evalInfo = constants$$1.getValue((0, _util.decodeHandle)(_evalInfo));
|
51045 | var handle = vm.runtime.resolver.lookupPartial(name, meta);
|
51046 | var definition = vm.runtime.resolver.resolve(handle);
|
51047 | var {
|
51048 | symbolTable,
|
51049 | handle: vmHandle
|
51050 | } = definition.getPartial(vm.context);
|
51051 | {
|
51052 | var partialSymbols = symbolTable.symbols;
|
51053 | var outerScope = vm.scope();
|
51054 | var partialScope = vm.pushRootScope(partialSymbols.length);
|
51055 | var evalScope = outerScope.getEvalScope();
|
51056 | partialScope.bindEvalScope(evalScope);
|
51057 | partialScope.bindSelf(outerScope.getSelf());
|
51058 | var locals = Object.create(outerScope.getPartialMap());
|
51059 |
|
51060 | for (var i = 0; i < evalInfo.length; i++) {
|
51061 | var slot = evalInfo[i];
|
51062 | var _name5 = outerSymbols[slot - 1];
|
51063 | var ref = outerScope.getSymbol(slot);
|
51064 | locals[_name5] = ref;
|
51065 | }
|
51066 |
|
51067 | if (evalScope) {
|
51068 | for (var _i6 = 0; _i6 < partialSymbols.length; _i6++) {
|
51069 | var _name6 = partialSymbols[_i6];
|
51070 | var symbol$$1 = _i6 + 1;
|
51071 | var value = evalScope[_name6];
|
51072 | if (value !== undefined) partialScope.bind(symbol$$1, value);
|
51073 | }
|
51074 | }
|
51075 |
|
51076 | partialScope.bindPartialMap(locals);
|
51077 | vm.pushFrame();
|
51078 |
|
51079 | vm.call((0, _util.unwrapHandle)(vmHandle));
|
51080 | }
|
51081 | }, 'jit');
|
51082 | APPEND_OPCODES.add(74
|
51083 |
|
51084 | , vm => {
|
51085 | var stack = vm.stack;
|
51086 | var listRef = stack.popJs();
|
51087 | var keyRef = stack.popJs();
|
51088 | var keyValue = keyRef.value();
|
51089 | var key = keyValue === null ? '@identity' : String(keyValue);
|
51090 | var iterableRef = new _reference.IterableReference(listRef, key, vm.env);
|
51091 |
|
51092 | stack.pushJs(iterableRef);
|
51093 |
|
51094 |
|
51095 |
|
51096 | stack.pushJs(iterableRef);
|
51097 | });
|
51098 | APPEND_OPCODES.add(72
|
51099 |
|
51100 | , (vm, {
|
51101 | op1: relativeStart
|
51102 | }) => {
|
51103 | vm.enterList(relativeStart);
|
51104 | });
|
51105 | APPEND_OPCODES.add(73
|
51106 |
|
51107 | , vm => {
|
51108 | vm.exitList();
|
51109 | });
|
51110 | APPEND_OPCODES.add(75
|
51111 |
|
51112 | , (vm, {
|
51113 | op1: breaks
|
51114 | }) => {
|
51115 | var stack = vm.stack;
|
51116 | var iterable = stack.peekJs();
|
51117 | var item = iterable.next();
|
51118 |
|
51119 | if (item) {
|
51120 | var opcode = vm.enterItem(iterable, item);
|
51121 | vm.registerItem(opcode);
|
51122 | } else {
|
51123 | vm.goto(breaks);
|
51124 | }
|
51125 | });
|
51126 |
|
51127 |
|
51128 | var DEFAULT_CAPABILITIES = {
|
51129 | dynamicLayout: true,
|
51130 | dynamicTag: true,
|
51131 | prepareArgs: true,
|
51132 | createArgs: true,
|
51133 | attributeHook: false,
|
51134 | elementHook: false,
|
51135 | dynamicScope: true,
|
51136 | createCaller: false,
|
51137 | updateHook: true,
|
51138 | createInstance: true,
|
51139 | wrapped: false,
|
51140 | willDestroy: false
|
51141 | };
|
51142 | _exports.DEFAULT_CAPABILITIES = DEFAULT_CAPABILITIES;
|
51143 | var MINIMAL_CAPABILITIES = {
|
51144 | dynamicLayout: false,
|
51145 | dynamicTag: false,
|
51146 | prepareArgs: false,
|
51147 | createArgs: false,
|
51148 | attributeHook: false,
|
51149 | elementHook: false,
|
51150 | dynamicScope: false,
|
51151 | createCaller: false,
|
51152 | updateHook: false,
|
51153 | createInstance: false,
|
51154 | wrapped: false,
|
51155 | willDestroy: false
|
51156 | };
|
51157 | _exports.MINIMAL_CAPABILITIES = MINIMAL_CAPABILITIES;
|
51158 |
|
51159 | class SimpleComponentManager {
|
51160 | getCapabilities(_state) {
|
51161 | return MINIMAL_CAPABILITIES;
|
51162 | }
|
51163 |
|
51164 | prepareArgs(_state, _args) {
|
51165 | throw new Error(`Unimplemented prepareArgs in SimpleComponentManager`);
|
51166 | }
|
51167 |
|
51168 | create(_env, _state, _args, _dynamicScope, _caller, _hasDefaultBlock) {
|
51169 | throw new Error(`Unimplemented create in SimpleComponentManager`);
|
51170 | }
|
51171 |
|
51172 | getSelf(_state) {
|
51173 | return UNDEFINED_REFERENCE;
|
51174 | }
|
51175 |
|
51176 | getTag(_state) {
|
51177 | throw new Error(`Unimplemented getTag in SimpleComponentManager`);
|
51178 | }
|
51179 |
|
51180 | didRenderLayout(_state, _bounds) {
|
51181 | throw new Error(`Unimplemented didRenderLayout in SimpleComponentManager`);
|
51182 | }
|
51183 |
|
51184 | didCreate(_state) {
|
51185 | throw new Error(`Unimplemented didCreate in SimpleComponentManager`);
|
51186 | }
|
51187 |
|
51188 | update(_state, _dynamicScope) {
|
51189 | throw new Error(`Unimplemented update in SimpleComponentManager`);
|
51190 | }
|
51191 |
|
51192 | didUpdateLayout(_state, _bounds) {
|
51193 | throw new Error(`Unimplemented didUpdateLayout in SimpleComponentManager`);
|
51194 | }
|
51195 |
|
51196 | didUpdate(_state) {
|
51197 | throw new Error(`Unimplemented didUpdate in SimpleComponentManager`);
|
51198 | }
|
51199 |
|
51200 | getDestroyable(_state) {
|
51201 | return null;
|
51202 | }
|
51203 |
|
51204 | }
|
51205 |
|
51206 | _exports.SimpleComponentManager = SimpleComponentManager;
|
51207 | var TEMPLATE_ONLY_COMPONENT = {
|
51208 | state: null,
|
51209 | manager: new SimpleComponentManager()
|
51210 | };
|
51211 | _exports.TEMPLATE_ONLY_COMPONENT = TEMPLATE_ONLY_COMPONENT;
|
51212 |
|
51213 | class DefaultDynamicScope {
|
51214 | constructor(bucket) {
|
51215 | if (bucket) {
|
51216 | this.bucket = (0, _util.assign)({}, bucket);
|
51217 | } else {
|
51218 | this.bucket = {};
|
51219 | }
|
51220 | }
|
51221 |
|
51222 | get(key) {
|
51223 | return this.bucket[key];
|
51224 | }
|
51225 |
|
51226 | set(key, reference) {
|
51227 | return this.bucket[key] = reference;
|
51228 | }
|
51229 |
|
51230 | child() {
|
51231 | return new DefaultDynamicScope(this.bucket);
|
51232 | }
|
51233 |
|
51234 | }
|
51235 |
|
51236 | _exports.DefaultDynamicScope = DefaultDynamicScope;
|
51237 |
|
51238 | class DynamicVarReference {
|
51239 | constructor(scope, nameRef) {
|
51240 | this.scope = scope;
|
51241 | this.nameRef = nameRef;
|
51242 | var varTag = this.varTag = (0, _validator.createUpdatableTag)();
|
51243 | this.tag = (0, _validator.combine)([nameRef.tag, varTag]);
|
51244 | }
|
51245 |
|
51246 | value() {
|
51247 | return this.getVar().value();
|
51248 | }
|
51249 |
|
51250 | get(key) {
|
51251 | return this.getVar().get(key);
|
51252 | }
|
51253 |
|
51254 | getVar() {
|
51255 | var name = String(this.nameRef.value());
|
51256 | var ref = this.scope.get(name);
|
51257 | (0, _validator.updateTag)(this.varTag, ref.tag);
|
51258 | return ref;
|
51259 | }
|
51260 |
|
51261 | }
|
51262 |
|
51263 | function getDynamicVar(args, vm) {
|
51264 | var scope = vm.dynamicScope();
|
51265 | var nameRef = args.positional.at(0);
|
51266 | return new DynamicVarReference(scope, nameRef);
|
51267 | }
|
51268 | |
51269 |
|
51270 |
|
51271 |
|
51272 |
|
51273 |
|
51274 |
|
51275 |
|
51276 |
|
51277 | class VMArgumentsImpl {
|
51278 | constructor() {
|
51279 | this.stack = null;
|
51280 | this.positional = new PositionalArgumentsImpl();
|
51281 | this.named = new NamedArgumentsImpl();
|
51282 | this.blocks = new BlockArgumentsImpl();
|
51283 | }
|
51284 |
|
51285 | empty(stack) {
|
51286 | var base = stack[REGISTERS][_vm2.$sp] + 1;
|
51287 | this.named.empty(stack, base);
|
51288 | this.positional.empty(stack, base);
|
51289 | this.blocks.empty(stack, base);
|
51290 | return this;
|
51291 | }
|
51292 |
|
51293 | setup(stack, names, blockNames, positionalCount, atNames) {
|
51294 | this.stack = stack;
|
51295 | |
51296 |
|
51297 |
|
51298 |
|
51299 |
|
51300 |
|
51301 |
|
51302 |
|
51303 | var named = this.named;
|
51304 | var namedCount = names.length;
|
51305 | var namedBase = stack[REGISTERS][_vm2.$sp] - namedCount + 1;
|
51306 | named.setup(stack, namedBase, namedCount, names, atNames);
|
51307 | var positional = this.positional;
|
51308 | var positionalBase = namedBase - positionalCount;
|
51309 | positional.setup(stack, positionalBase, positionalCount);
|
51310 | var blocks = this.blocks;
|
51311 | var blocksCount = blockNames.length;
|
51312 | var blocksBase = positionalBase - blocksCount * 3;
|
51313 | blocks.setup(stack, blocksBase, blocksCount, blockNames);
|
51314 | }
|
51315 |
|
51316 | get tag() {
|
51317 | return combineTagged([this.positional, this.named]);
|
51318 | }
|
51319 |
|
51320 | get base() {
|
51321 | return this.blocks.base;
|
51322 | }
|
51323 |
|
51324 | get length() {
|
51325 | return this.positional.length + this.named.length + this.blocks.length * 3;
|
51326 | }
|
51327 |
|
51328 | at(pos) {
|
51329 | return this.positional.at(pos);
|
51330 | }
|
51331 |
|
51332 | realloc(offset) {
|
51333 | var {
|
51334 | stack
|
51335 | } = this;
|
51336 |
|
51337 | if (offset > 0 && stack !== null) {
|
51338 | var {
|
51339 | positional,
|
51340 | named
|
51341 | } = this;
|
51342 | var newBase = positional.base + offset;
|
51343 | var length = positional.length + named.length;
|
51344 |
|
51345 | for (var i = length - 1; i >= 0; i--) {
|
51346 | stack.copy(i + positional.base, i + newBase);
|
51347 | }
|
51348 |
|
51349 | positional.base += offset;
|
51350 | named.base += offset;
|
51351 | stack[REGISTERS][_vm2.$sp] += offset;
|
51352 | }
|
51353 | }
|
51354 |
|
51355 | capture() {
|
51356 | var positional = this.positional.length === 0 ? EMPTY_POSITIONAL : this.positional.capture();
|
51357 | var named = this.named.length === 0 ? EMPTY_NAMED : this.named.capture();
|
51358 | return new CapturedArgumentsImpl(this.tag, positional, named, this.length);
|
51359 | }
|
51360 |
|
51361 | clear() {
|
51362 | var {
|
51363 | stack,
|
51364 | length
|
51365 | } = this;
|
51366 | if (length > 0 && stack !== null) stack.pop(length);
|
51367 | }
|
51368 |
|
51369 | }
|
51370 |
|
51371 | class PositionalArgumentsImpl {
|
51372 | constructor() {
|
51373 | this.base = 0;
|
51374 | this.length = 0;
|
51375 | this.stack = null;
|
51376 | this._tag = null;
|
51377 | this._references = null;
|
51378 | }
|
51379 |
|
51380 | empty(stack, base) {
|
51381 | this.stack = stack;
|
51382 | this.base = base;
|
51383 | this.length = 0;
|
51384 | this._tag = _validator.CONSTANT_TAG;
|
51385 | this._references = _util.EMPTY_ARRAY;
|
51386 | }
|
51387 |
|
51388 | setup(stack, base, length) {
|
51389 | this.stack = stack;
|
51390 | this.base = base;
|
51391 | this.length = length;
|
51392 |
|
51393 | if (length === 0) {
|
51394 | this._tag = _validator.CONSTANT_TAG;
|
51395 | this._references = _util.EMPTY_ARRAY;
|
51396 | } else {
|
51397 | this._tag = null;
|
51398 | this._references = null;
|
51399 | }
|
51400 | }
|
51401 |
|
51402 | get tag() {
|
51403 | var tag = this._tag;
|
51404 |
|
51405 | if (!tag) {
|
51406 | tag = this._tag = combineTagged(this.references);
|
51407 | }
|
51408 |
|
51409 | return tag;
|
51410 | }
|
51411 |
|
51412 | at(position) {
|
51413 | var {
|
51414 | base,
|
51415 | length,
|
51416 | stack
|
51417 | } = this;
|
51418 |
|
51419 | if (position < 0 || position >= length) {
|
51420 | return UNDEFINED_REFERENCE;
|
51421 | }
|
51422 |
|
51423 | return stack.get(position, base);
|
51424 | }
|
51425 |
|
51426 | capture() {
|
51427 | return new CapturedPositionalArgumentsImpl(this.tag, this.references);
|
51428 | }
|
51429 |
|
51430 | prepend(other) {
|
51431 | var additions = other.length;
|
51432 |
|
51433 | if (additions > 0) {
|
51434 | var {
|
51435 | base,
|
51436 | length,
|
51437 | stack
|
51438 | } = this;
|
51439 | this.base = base = base - additions;
|
51440 | this.length = length + additions;
|
51441 |
|
51442 | for (var i = 0; i < additions; i++) {
|
51443 | stack.set(other.at(i), i, base);
|
51444 | }
|
51445 |
|
51446 | this._tag = null;
|
51447 | this._references = null;
|
51448 | }
|
51449 | }
|
51450 |
|
51451 | get references() {
|
51452 | var references = this._references;
|
51453 |
|
51454 | if (!references) {
|
51455 | var {
|
51456 | stack,
|
51457 | base,
|
51458 | length
|
51459 | } = this;
|
51460 | references = this._references = stack.slice(base, base + length);
|
51461 | }
|
51462 |
|
51463 | return references;
|
51464 | }
|
51465 |
|
51466 | }
|
51467 |
|
51468 | class CapturedPositionalArgumentsImpl {
|
51469 | constructor(tag, references, length = references.length) {
|
51470 | this.tag = tag;
|
51471 | this.references = references;
|
51472 | this.length = length;
|
51473 | }
|
51474 |
|
51475 | static empty() {
|
51476 | return new CapturedPositionalArgumentsImpl(_validator.CONSTANT_TAG, _util.EMPTY_ARRAY, 0);
|
51477 | }
|
51478 |
|
51479 | at(position) {
|
51480 | return this.references[position];
|
51481 | }
|
51482 |
|
51483 | value() {
|
51484 | return this.references.map(this.valueOf);
|
51485 | }
|
51486 |
|
51487 | get(name) {
|
51488 | var {
|
51489 | references,
|
51490 | length
|
51491 | } = this;
|
51492 |
|
51493 | if (name === 'length') {
|
51494 | return PrimitiveReference.create(length);
|
51495 | } else {
|
51496 | var idx = parseInt(name, 10);
|
51497 |
|
51498 | if (idx < 0 || idx >= length) {
|
51499 | return UNDEFINED_REFERENCE;
|
51500 | } else {
|
51501 | return references[idx];
|
51502 | }
|
51503 | }
|
51504 | }
|
51505 |
|
51506 | valueOf(reference) {
|
51507 | return reference.value();
|
51508 | }
|
51509 |
|
51510 | }
|
51511 |
|
51512 | _exports.CapturedPositionalArgumentsImpl = CapturedPositionalArgumentsImpl;
|
51513 |
|
51514 | class NamedArgumentsImpl {
|
51515 | constructor() {
|
51516 | this.base = 0;
|
51517 | this.length = 0;
|
51518 | this._references = null;
|
51519 | this._names = _util.EMPTY_ARRAY;
|
51520 | this._atNames = _util.EMPTY_ARRAY;
|
51521 | }
|
51522 |
|
51523 | empty(stack, base) {
|
51524 | this.stack = stack;
|
51525 | this.base = base;
|
51526 | this.length = 0;
|
51527 | this._references = _util.EMPTY_ARRAY;
|
51528 | this._names = _util.EMPTY_ARRAY;
|
51529 | this._atNames = _util.EMPTY_ARRAY;
|
51530 | }
|
51531 |
|
51532 | setup(stack, base, length, names, atNames) {
|
51533 | this.stack = stack;
|
51534 | this.base = base;
|
51535 | this.length = length;
|
51536 |
|
51537 | if (length === 0) {
|
51538 | this._references = _util.EMPTY_ARRAY;
|
51539 | this._names = _util.EMPTY_ARRAY;
|
51540 | this._atNames = _util.EMPTY_ARRAY;
|
51541 | } else {
|
51542 | this._references = null;
|
51543 |
|
51544 | if (atNames) {
|
51545 | this._names = null;
|
51546 | this._atNames = names;
|
51547 | } else {
|
51548 | this._names = names;
|
51549 | this._atNames = null;
|
51550 | }
|
51551 | }
|
51552 | }
|
51553 |
|
51554 | get tag() {
|
51555 | return combineTagged(this.references);
|
51556 | }
|
51557 |
|
51558 | get names() {
|
51559 | var names = this._names;
|
51560 |
|
51561 | if (!names) {
|
51562 | names = this._names = this._atNames.map(this.toSyntheticName);
|
51563 | }
|
51564 |
|
51565 | return names;
|
51566 | }
|
51567 |
|
51568 | get atNames() {
|
51569 | var atNames = this._atNames;
|
51570 |
|
51571 | if (!atNames) {
|
51572 | atNames = this._atNames = this._names.map(this.toAtName);
|
51573 | }
|
51574 |
|
51575 | return atNames;
|
51576 | }
|
51577 |
|
51578 | has(name) {
|
51579 | return this.names.indexOf(name) !== -1;
|
51580 | }
|
51581 |
|
51582 | get(name, atNames = false) {
|
51583 | var {
|
51584 | base,
|
51585 | stack
|
51586 | } = this;
|
51587 | var names = atNames ? this.atNames : this.names;
|
51588 | var idx = names.indexOf(name);
|
51589 |
|
51590 | if (idx === -1) {
|
51591 | return UNDEFINED_REFERENCE;
|
51592 | }
|
51593 |
|
51594 | return stack.get(idx, base);
|
51595 | }
|
51596 |
|
51597 | capture() {
|
51598 | return new CapturedNamedArgumentsImpl(this.tag, this.names, this.references);
|
51599 | }
|
51600 |
|
51601 | merge(other) {
|
51602 | var {
|
51603 | length: extras
|
51604 | } = other;
|
51605 |
|
51606 | if (extras > 0) {
|
51607 | var {
|
51608 | names,
|
51609 | length,
|
51610 | stack
|
51611 | } = this;
|
51612 | var {
|
51613 | names: extraNames
|
51614 | } = other;
|
51615 | var newNames = names.slice();
|
51616 |
|
51617 | for (var i = 0; i < extras; i++) {
|
51618 | var _name7 = extraNames[i];
|
51619 | var idx = newNames.indexOf(_name7);
|
51620 |
|
51621 | if (idx === -1) {
|
51622 | length = newNames.push(_name7);
|
51623 | stack.pushJs(other.references[i]);
|
51624 | }
|
51625 | }
|
51626 |
|
51627 | this.length = length;
|
51628 | this._references = null;
|
51629 | this._names = newNames;
|
51630 | this._atNames = null;
|
51631 | }
|
51632 | }
|
51633 |
|
51634 | get references() {
|
51635 | var references = this._references;
|
51636 |
|
51637 | if (!references) {
|
51638 | var {
|
51639 | base,
|
51640 | length,
|
51641 | stack
|
51642 | } = this;
|
51643 | references = this._references = stack.slice(base, base + length);
|
51644 | }
|
51645 |
|
51646 | return references;
|
51647 | }
|
51648 |
|
51649 | toSyntheticName(name) {
|
51650 | return name.slice(1);
|
51651 | }
|
51652 |
|
51653 | toAtName(name) {
|
51654 | return `@${name}`;
|
51655 | }
|
51656 |
|
51657 | }
|
51658 |
|
51659 | class CapturedNamedArgumentsImpl {
|
51660 | constructor(tag, names, references) {
|
51661 | this.tag = tag;
|
51662 | this.names = names;
|
51663 | this.references = references;
|
51664 | this.length = names.length;
|
51665 | this._map = null;
|
51666 | }
|
51667 |
|
51668 | get map() {
|
51669 | var map = this._map;
|
51670 |
|
51671 | if (!map) {
|
51672 | var {
|
51673 | names,
|
51674 | references
|
51675 | } = this;
|
51676 | map = this._map = (0, _util.dict)();
|
51677 |
|
51678 | for (var i = 0; i < names.length; i++) {
|
51679 | var _name8 = names[i];
|
51680 | map[_name8] = references[i];
|
51681 | }
|
51682 | }
|
51683 |
|
51684 | return map;
|
51685 | }
|
51686 |
|
51687 | has(name) {
|
51688 | return this.names.indexOf(name) !== -1;
|
51689 | }
|
51690 |
|
51691 | get(name) {
|
51692 | var {
|
51693 | names,
|
51694 | references
|
51695 | } = this;
|
51696 | var idx = names.indexOf(name);
|
51697 |
|
51698 | if (idx === -1) {
|
51699 | return UNDEFINED_REFERENCE;
|
51700 | } else {
|
51701 | return references[idx];
|
51702 | }
|
51703 | }
|
51704 |
|
51705 | value() {
|
51706 | var {
|
51707 | names,
|
51708 | references
|
51709 | } = this;
|
51710 | var out = (0, _util.dict)();
|
51711 |
|
51712 | for (var i = 0; i < names.length; i++) {
|
51713 | var _name9 = names[i];
|
51714 | out[_name9] = references[i].value();
|
51715 | }
|
51716 |
|
51717 | return out;
|
51718 | }
|
51719 |
|
51720 | }
|
51721 |
|
51722 | _exports.CapturedNamedArgumentsImpl = CapturedNamedArgumentsImpl;
|
51723 |
|
51724 | function toSymbolName(name) {
|
51725 | return `&${name}`;
|
51726 | }
|
51727 |
|
51728 | class BlockArgumentsImpl {
|
51729 | constructor() {
|
51730 | this.internalValues = null;
|
51731 | this._symbolNames = null;
|
51732 | this.internalTag = null;
|
51733 | this.names = _util.EMPTY_ARRAY;
|
51734 | this.length = 0;
|
51735 | this.base = 0;
|
51736 | }
|
51737 |
|
51738 | empty(stack, base) {
|
51739 | this.stack = stack;
|
51740 | this.names = _util.EMPTY_ARRAY;
|
51741 | this.base = base;
|
51742 | this.length = 0;
|
51743 | this._symbolNames = null;
|
51744 | this.internalTag = _validator.CONSTANT_TAG;
|
51745 | this.internalValues = _util.EMPTY_ARRAY;
|
51746 | }
|
51747 |
|
51748 | setup(stack, base, length, names) {
|
51749 | this.stack = stack;
|
51750 | this.names = names;
|
51751 | this.base = base;
|
51752 | this.length = length;
|
51753 | this._symbolNames = null;
|
51754 |
|
51755 | if (length === 0) {
|
51756 | this.internalTag = _validator.CONSTANT_TAG;
|
51757 | this.internalValues = _util.EMPTY_ARRAY;
|
51758 | } else {
|
51759 | this.internalTag = null;
|
51760 | this.internalValues = null;
|
51761 | }
|
51762 | }
|
51763 |
|
51764 | get values() {
|
51765 | var values = this.internalValues;
|
51766 |
|
51767 | if (!values) {
|
51768 | var {
|
51769 | base,
|
51770 | length,
|
51771 | stack
|
51772 | } = this;
|
51773 | values = this.internalValues = stack.slice(base, base + length * 3);
|
51774 | }
|
51775 |
|
51776 | return values;
|
51777 | }
|
51778 |
|
51779 | has(name) {
|
51780 | return this.names.indexOf(name) !== -1;
|
51781 | }
|
51782 |
|
51783 | get(name) {
|
51784 | var idx = this.names.indexOf(name);
|
51785 |
|
51786 | if (idx === -1) {
|
51787 | return null;
|
51788 | }
|
51789 |
|
51790 | var {
|
51791 | base,
|
51792 | stack
|
51793 | } = this;
|
51794 | var table = stack.get(idx * 3, base);
|
51795 | var scope = stack.get(idx * 3 + 1, base);
|
51796 | var handle = stack.get(idx * 3 + 2, base);
|
51797 | return handle === null ? null : [handle, scope, table];
|
51798 | }
|
51799 |
|
51800 | capture() {
|
51801 | return new CapturedBlockArgumentsImpl(this.names, this.values);
|
51802 | }
|
51803 |
|
51804 | get symbolNames() {
|
51805 | var symbolNames = this._symbolNames;
|
51806 |
|
51807 | if (symbolNames === null) {
|
51808 | symbolNames = this._symbolNames = this.names.map(toSymbolName);
|
51809 | }
|
51810 |
|
51811 | return symbolNames;
|
51812 | }
|
51813 |
|
51814 | }
|
51815 |
|
51816 | class CapturedBlockArgumentsImpl {
|
51817 | constructor(names, values) {
|
51818 | this.names = names;
|
51819 | this.values = values;
|
51820 | this.length = names.length;
|
51821 | }
|
51822 |
|
51823 | has(name) {
|
51824 | return this.names.indexOf(name) !== -1;
|
51825 | }
|
51826 |
|
51827 | get(name) {
|
51828 | var idx = this.names.indexOf(name);
|
51829 | if (idx === -1) return null;
|
51830 | return [this.values[idx * 3 + 2], this.values[idx * 3 + 1], this.values[idx * 3]];
|
51831 | }
|
51832 |
|
51833 | }
|
51834 |
|
51835 | class CapturedArgumentsImpl {
|
51836 | constructor(tag, positional, named, length) {
|
51837 | this.tag = tag;
|
51838 | this.positional = positional;
|
51839 | this.named = named;
|
51840 | this.length = length;
|
51841 | }
|
51842 |
|
51843 | value() {
|
51844 | return {
|
51845 | named: this.named.value(),
|
51846 | positional: this.positional.value()
|
51847 | };
|
51848 | }
|
51849 |
|
51850 | }
|
51851 |
|
51852 | _exports.CapturedArgumentsImpl = CapturedArgumentsImpl;
|
51853 | var EMPTY_NAMED = new CapturedNamedArgumentsImpl(_validator.CONSTANT_TAG, _util.EMPTY_ARRAY, _util.EMPTY_ARRAY);
|
51854 | var EMPTY_POSITIONAL = new CapturedPositionalArgumentsImpl(_validator.CONSTANT_TAG, _util.EMPTY_ARRAY);
|
51855 | var EMPTY_ARGS = new CapturedArgumentsImpl(_validator.CONSTANT_TAG, EMPTY_POSITIONAL, EMPTY_NAMED, 0);
|
51856 | _exports.EMPTY_ARGS = EMPTY_ARGS;
|
51857 |
|
51858 | function initializeRegistersWithSP(sp) {
|
51859 | return [0, -1, sp, 0];
|
51860 | }
|
51861 |
|
51862 | class LowLevelVM {
|
51863 | constructor(stack, heap, program, externs, registers) {
|
51864 | this.stack = stack;
|
51865 | this.heap = heap;
|
51866 | this.program = program;
|
51867 | this.externs = externs;
|
51868 | this.registers = registers;
|
51869 | this.currentOpSize = 0;
|
51870 | }
|
51871 |
|
51872 | fetchRegister(register) {
|
51873 | return this.registers[register];
|
51874 | }
|
51875 |
|
51876 | loadRegister(register, value) {
|
51877 | this.registers[register] = value;
|
51878 | }
|
51879 |
|
51880 | setPc(pc) {
|
51881 | this.registers[_vm2.$pc] = pc;
|
51882 | }
|
51883 |
|
51884 |
|
51885 | pushFrame() {
|
51886 | this.stack.pushSmallInt(this.registers[_vm2.$ra]);
|
51887 | this.stack.pushSmallInt(this.registers[_vm2.$fp]);
|
51888 | this.registers[_vm2.$fp] = this.registers[_vm2.$sp] - 1;
|
51889 | }
|
51890 |
|
51891 |
|
51892 | popFrame() {
|
51893 | this.registers[_vm2.$sp] = this.registers[_vm2.$fp] - 1;
|
51894 | this.registers[_vm2.$ra] = this.stack.get(0);
|
51895 | this.registers[_vm2.$fp] = this.stack.get(1);
|
51896 | }
|
51897 |
|
51898 | pushSmallFrame() {
|
51899 | this.stack.pushSmallInt(this.registers[_vm2.$ra]);
|
51900 | }
|
51901 |
|
51902 | popSmallFrame() {
|
51903 | this.registers[_vm2.$ra] = this.stack.popSmallInt();
|
51904 | }
|
51905 |
|
51906 |
|
51907 | goto(offset) {
|
51908 | this.setPc(this.target(offset));
|
51909 | }
|
51910 |
|
51911 | target(offset) {
|
51912 | return this.registers[_vm2.$pc] + offset - this.currentOpSize;
|
51913 | }
|
51914 |
|
51915 |
|
51916 | call(handle) {
|
51917 | this.registers[_vm2.$ra] = this.registers[_vm2.$pc];
|
51918 | this.setPc(this.heap.getaddr(handle));
|
51919 | }
|
51920 |
|
51921 |
|
51922 | returnTo(offset) {
|
51923 | this.registers[_vm2.$ra] = this.target(offset);
|
51924 | }
|
51925 |
|
51926 |
|
51927 | return() {
|
51928 | this.setPc(this.registers[_vm2.$ra]);
|
51929 | }
|
51930 |
|
51931 | nextStatement() {
|
51932 | var {
|
51933 | registers,
|
51934 | program
|
51935 | } = this;
|
51936 | var pc = registers[_vm2.$pc];
|
51937 |
|
51938 | if (pc === -1) {
|
51939 | return null;
|
51940 | }
|
51941 |
|
51942 |
|
51943 |
|
51944 |
|
51945 |
|
51946 |
|
51947 | var opcode = program.opcode(pc);
|
51948 | var operationSize = this.currentOpSize = opcode.size;
|
51949 | this.registers[_vm2.$pc] += operationSize;
|
51950 | return opcode;
|
51951 | }
|
51952 |
|
51953 | evaluateOuter(opcode, vm) {
|
51954 | {
|
51955 | this.evaluateInner(opcode, vm);
|
51956 | }
|
51957 | }
|
51958 |
|
51959 | evaluateInner(opcode, vm) {
|
51960 | if (opcode.isMachine) {
|
51961 | this.evaluateMachine(opcode);
|
51962 | } else {
|
51963 | this.evaluateSyscall(opcode, vm);
|
51964 | }
|
51965 | }
|
51966 |
|
51967 | evaluateMachine(opcode) {
|
51968 | switch (opcode.type) {
|
51969 | case 0
|
51970 |
|
51971 | :
|
51972 | return this.pushFrame();
|
51973 |
|
51974 | case 1
|
51975 |
|
51976 | :
|
51977 | return this.popFrame();
|
51978 |
|
51979 | case 3
|
51980 |
|
51981 | :
|
51982 | return this.call(opcode.op1);
|
51983 |
|
51984 | case 2
|
51985 |
|
51986 | :
|
51987 | return this.call(this.stack.popSmallInt());
|
51988 |
|
51989 | case 4
|
51990 |
|
51991 | :
|
51992 | return this.goto(opcode.op1);
|
51993 |
|
51994 | case 5
|
51995 |
|
51996 | :
|
51997 | return this.return();
|
51998 |
|
51999 | case 6
|
52000 |
|
52001 | :
|
52002 | return this.returnTo(opcode.op1);
|
52003 | }
|
52004 | }
|
52005 |
|
52006 | evaluateSyscall(opcode, vm) {
|
52007 | APPEND_OPCODES.evaluate(vm, opcode, opcode.type);
|
52008 | }
|
52009 |
|
52010 | }
|
52011 |
|
52012 | class UpdatingVM {
|
52013 | constructor(env, {
|
52014 | alwaysRevalidate = false
|
52015 | }) {
|
52016 | this.frameStack = new _util.Stack();
|
52017 | this.env = env;
|
52018 | this.dom = env.getDOM();
|
52019 | this.alwaysRevalidate = alwaysRevalidate;
|
52020 | }
|
52021 |
|
52022 | execute(opcodes, handler) {
|
52023 | var {
|
52024 | frameStack
|
52025 | } = this;
|
52026 | this.try(opcodes, handler);
|
52027 |
|
52028 | while (true) {
|
52029 | if (frameStack.isEmpty()) break;
|
52030 | var opcode = this.frame.nextStatement();
|
52031 |
|
52032 | if (opcode === undefined) {
|
52033 | frameStack.pop();
|
52034 | continue;
|
52035 | }
|
52036 |
|
52037 | opcode.evaluate(this);
|
52038 | }
|
52039 | }
|
52040 |
|
52041 | get frame() {
|
52042 | return this.frameStack.current;
|
52043 | }
|
52044 |
|
52045 | goto(index) {
|
52046 | this.frame.goto(index);
|
52047 | }
|
52048 |
|
52049 | try(ops, handler) {
|
52050 | this.frameStack.push(new UpdatingVMFrame(ops, handler));
|
52051 | }
|
52052 |
|
52053 | throw() {
|
52054 | this.frame.handleException();
|
52055 | this.frameStack.pop();
|
52056 | }
|
52057 |
|
52058 | }
|
52059 |
|
52060 | _exports.UpdatingVM = UpdatingVM;
|
52061 |
|
52062 | class ResumableVMStateImpl {
|
52063 | constructor(state, resumeCallback) {
|
52064 | this.state = state;
|
52065 | this.resumeCallback = resumeCallback;
|
52066 | }
|
52067 |
|
52068 | resume(runtime, builder) {
|
52069 | return this.resumeCallback(runtime, this.state, builder);
|
52070 | }
|
52071 |
|
52072 | }
|
52073 |
|
52074 | class BlockOpcode extends UpdatingOpcode {
|
52075 | constructor(state, runtime, bounds, children) {
|
52076 | super();
|
52077 | this.state = state;
|
52078 | this.runtime = runtime;
|
52079 | this.type = 'block';
|
52080 | this.children = children;
|
52081 | this.bounds = bounds;
|
52082 | }
|
52083 |
|
52084 | parentElement() {
|
52085 | return this.bounds.parentElement();
|
52086 | }
|
52087 |
|
52088 | firstNode() {
|
52089 | return this.bounds.firstNode();
|
52090 | }
|
52091 |
|
52092 | lastNode() {
|
52093 | return this.bounds.lastNode();
|
52094 | }
|
52095 |
|
52096 | evaluate(vm) {
|
52097 | vm.try(this.children, null);
|
52098 | }
|
52099 |
|
52100 | }
|
52101 |
|
52102 | class TryOpcode extends BlockOpcode {
|
52103 | constructor(state, runtime, bounds, children) {
|
52104 | super(state, runtime, bounds, children);
|
52105 | this.type = 'try';
|
52106 | this.tag = this._tag = (0, _validator.createUpdatableTag)();
|
52107 | }
|
52108 |
|
52109 | didInitializeChildren() {
|
52110 | (0, _validator.updateTag)(this._tag, combineTagged(this.children));
|
52111 | }
|
52112 |
|
52113 | evaluate(vm) {
|
52114 | vm.try(this.children, this);
|
52115 | }
|
52116 |
|
52117 | handleException() {
|
52118 | var {
|
52119 | state,
|
52120 | bounds,
|
52121 | runtime
|
52122 | } = this;
|
52123 | destroyChildren(this);
|
52124 | var elementStack = NewElementBuilder.resume(runtime.env, bounds);
|
52125 | var vm = state.resume(runtime, elementStack);
|
52126 | var updating = [];
|
52127 | var children = this.children = [];
|
52128 | var result = vm.execute(vm => {
|
52129 | vm.pushUpdating(updating);
|
52130 | vm.updateWith(this);
|
52131 | vm.pushUpdating(children);
|
52132 | });
|
52133 | associateDestroyableChild(this, result.drop);
|
52134 | }
|
52135 |
|
52136 | }
|
52137 |
|
52138 | class ListItemOpcode extends TryOpcode {
|
52139 | constructor(state, runtime, bounds, key, memo, value) {
|
52140 | super(state, runtime, bounds, []);
|
52141 | this.key = key;
|
52142 | this.memo = memo;
|
52143 | this.value = value;
|
52144 | this.retained = false;
|
52145 | this.index = -1;
|
52146 | }
|
52147 |
|
52148 | updateReferences(item) {
|
52149 | this.retained = true;
|
52150 | this.value.update(item.value);
|
52151 | this.memo.update(item.memo);
|
52152 | }
|
52153 |
|
52154 | shouldRemove() {
|
52155 | return !this.retained;
|
52156 | }
|
52157 |
|
52158 | reset() {
|
52159 | this.retained = false;
|
52160 | }
|
52161 |
|
52162 | }
|
52163 |
|
52164 | class ListBlockOpcode extends BlockOpcode {
|
52165 | constructor(state, runtime, bounds, children, iterableRef) {
|
52166 | super(state, runtime, bounds, children);
|
52167 | this.iterableRef = iterableRef;
|
52168 | this.type = 'list-block';
|
52169 | this.lastIterated = _validator.INITIAL;
|
52170 | this.opcodeMap = new Map();
|
52171 | this.marker = null;
|
52172 |
|
52173 | var _tag = this._tag = (0, _validator.createUpdatableTag)();
|
52174 |
|
52175 | this.tag = (0, _validator.combine)([iterableRef.tag, _tag]);
|
52176 | }
|
52177 |
|
52178 | initializeChild(opcode) {
|
52179 | opcode.index = this.children.length - 1;
|
52180 | this.opcodeMap.set(opcode.key, opcode);
|
52181 | }
|
52182 |
|
52183 | didInitializeChildren() {
|
52184 | this.lastIterated = (0, _validator.valueForTag)(this.tag);
|
52185 | (0, _validator.updateTag)(this._tag, combineTagged(this.children));
|
52186 | }
|
52187 |
|
52188 | evaluate(vm) {
|
52189 | var {
|
52190 | iterableRef,
|
52191 | lastIterated
|
52192 | } = this;
|
52193 |
|
52194 | if (!(0, _validator.validateTag)(iterableRef.tag, lastIterated)) {
|
52195 | var {
|
52196 | bounds
|
52197 | } = this;
|
52198 | var {
|
52199 | dom
|
52200 | } = vm;
|
52201 | var marker = this.marker = dom.createComment('');
|
52202 | dom.insertAfter(bounds.parentElement(), marker, bounds.lastNode());
|
52203 | var didChange = this.sync();
|
52204 | this.parentElement().removeChild(marker);
|
52205 | this.marker = null;
|
52206 |
|
52207 | if (didChange) {
|
52208 | (0, _validator.updateTag)(this._tag, combineTagged(this.children));
|
52209 | }
|
52210 |
|
52211 | this.lastIterated = (0, _validator.valueForTag)(this.iterableRef.tag);
|
52212 | }
|
52213 |
|
52214 |
|
52215 | super.evaluate(vm);
|
52216 | }
|
52217 |
|
52218 | sync() {
|
52219 | var {
|
52220 | iterableRef,
|
52221 | opcodeMap: itemMap,
|
52222 | children
|
52223 | } = this;
|
52224 | var currentOpcodeIndex = 0;
|
52225 | var seenIndex = 0;
|
52226 | var didChange = false;
|
52227 | this.children = this.bounds.boundList = [];
|
52228 |
|
52229 | while (true) {
|
52230 | var item = iterableRef.next();
|
52231 | if (item === null) break;
|
52232 | var opcode = children[currentOpcodeIndex];
|
52233 | var {
|
52234 | key
|
52235 | } = item;
|
52236 |
|
52237 |
|
52238 | while (opcode !== undefined && opcode.retained === true) {
|
52239 | opcode = children[++currentOpcodeIndex];
|
52240 | }
|
52241 |
|
52242 | if (opcode !== undefined && opcode.key === key) {
|
52243 | this.retainItem(opcode, item);
|
52244 | currentOpcodeIndex++;
|
52245 | } else if (itemMap.has(key)) {
|
52246 | var itemOpcode = itemMap.get(key);
|
52247 |
|
52248 | if (itemOpcode.index < seenIndex) {
|
52249 | this.moveItem(itemOpcode, item, opcode);
|
52250 | } else {
|
52251 |
|
52252 |
|
52253 |
|
52254 | seenIndex = itemOpcode.index;
|
52255 | var seenUnretained = false;
|
52256 |
|
52257 |
|
52258 |
|
52259 | for (var i = currentOpcodeIndex + 1; i < seenIndex; i++) {
|
52260 | if (children[i].retained === false) {
|
52261 | seenUnretained = true;
|
52262 | break;
|
52263 | }
|
52264 | }
|
52265 |
|
52266 |
|
52267 |
|
52268 |
|
52269 | if (seenUnretained === false) {
|
52270 | this.retainItem(itemOpcode, item);
|
52271 | currentOpcodeIndex = seenIndex + 1;
|
52272 | } else {
|
52273 | this.moveItem(itemOpcode, item, opcode);
|
52274 | currentOpcodeIndex++;
|
52275 | }
|
52276 | }
|
52277 | } else {
|
52278 | didChange = true;
|
52279 | this.insertItem(item, opcode);
|
52280 | }
|
52281 | }
|
52282 |
|
52283 | for (var _i7 = 0; _i7 < children.length; _i7++) {
|
52284 | var _opcode = children[_i7];
|
52285 |
|
52286 | if (_opcode.retained === false) {
|
52287 | didChange = true;
|
52288 | this.deleteItem(_opcode);
|
52289 | } else {
|
52290 | _opcode.reset();
|
52291 | }
|
52292 | }
|
52293 |
|
52294 | return didChange;
|
52295 | }
|
52296 |
|
52297 | retainItem(opcode, item) {
|
52298 | var {
|
52299 | children
|
52300 | } = this;
|
52301 | opcode.memo.update(item.memo);
|
52302 | opcode.value.update(item.value);
|
52303 | opcode.retained = true;
|
52304 | opcode.index = children.length;
|
52305 | children.push(opcode);
|
52306 | }
|
52307 |
|
52308 | insertItem(item, before) {
|
52309 | var {
|
52310 | opcodeMap,
|
52311 | bounds,
|
52312 | state,
|
52313 | runtime,
|
52314 | iterableRef,
|
52315 | children
|
52316 | } = this;
|
52317 | var {
|
52318 | key
|
52319 | } = item;
|
52320 | var nextSibling = before === undefined ? this.marker : before.firstNode();
|
52321 | var elementStack = NewElementBuilder.forInitialRender(runtime.env, {
|
52322 | element: bounds.parentElement(),
|
52323 | nextSibling
|
52324 | });
|
52325 | var vm = state.resume(runtime, elementStack);
|
52326 | vm.execute(vm => {
|
52327 | vm.pushUpdating();
|
52328 | var opcode = vm.enterItem(iterableRef, item);
|
52329 | opcode.index = children.length;
|
52330 | children.push(opcode);
|
52331 | opcodeMap.set(key, opcode);
|
52332 | associateDestroyableChild(this, opcode);
|
52333 | });
|
52334 | }
|
52335 |
|
52336 | moveItem(opcode, item, before) {
|
52337 | var {
|
52338 | children
|
52339 | } = this;
|
52340 | opcode.memo.update(item.memo);
|
52341 | opcode.value.update(item.value);
|
52342 | opcode.retained = true;
|
52343 | var currentSibling, nextSibling;
|
52344 |
|
52345 | if (before === undefined) {
|
52346 | move(opcode, this.marker);
|
52347 | } else {
|
52348 | currentSibling = opcode.lastNode().nextSibling;
|
52349 | nextSibling = before.firstNode();
|
52350 |
|
52351 |
|
52352 |
|
52353 |
|
52354 | if (currentSibling !== nextSibling) {
|
52355 | move(opcode, nextSibling);
|
52356 | }
|
52357 | }
|
52358 |
|
52359 | opcode.index = children.length;
|
52360 | children.push(opcode);
|
52361 | }
|
52362 |
|
52363 | deleteItem(opcode) {
|
52364 | destroy(opcode);
|
52365 | clear(opcode);
|
52366 | this.opcodeMap.delete(opcode.key);
|
52367 | }
|
52368 |
|
52369 | }
|
52370 |
|
52371 | class UpdatingVMFrame {
|
52372 | constructor(ops, exceptionHandler) {
|
52373 | this.ops = ops;
|
52374 | this.exceptionHandler = exceptionHandler;
|
52375 | this.current = 0;
|
52376 | }
|
52377 |
|
52378 | goto(index) {
|
52379 | this.current = index;
|
52380 | }
|
52381 |
|
52382 | nextStatement() {
|
52383 | return this.ops[this.current++];
|
52384 | }
|
52385 |
|
52386 | handleException() {
|
52387 | if (this.exceptionHandler) {
|
52388 | this.exceptionHandler.handleException();
|
52389 | }
|
52390 | }
|
52391 |
|
52392 | }
|
52393 |
|
52394 | class RenderResultImpl {
|
52395 | constructor(env, updating, bounds, drop) {
|
52396 | this.env = env;
|
52397 | this.updating = updating;
|
52398 | this.bounds = bounds;
|
52399 | this.drop = drop;
|
52400 | associateDestroyableChild(this, drop);
|
52401 | registerDestructor(this, () => clear(this.bounds));
|
52402 | }
|
52403 |
|
52404 | rerender({
|
52405 | alwaysRevalidate = false
|
52406 | } = {
|
52407 | alwaysRevalidate: false
|
52408 | }) {
|
52409 | var {
|
52410 | env,
|
52411 | updating
|
52412 | } = this;
|
52413 | var vm = new UpdatingVM(env, {
|
52414 | alwaysRevalidate
|
52415 | });
|
52416 | vm.execute(updating, this);
|
52417 | }
|
52418 |
|
52419 | parentElement() {
|
52420 | return this.bounds.parentElement();
|
52421 | }
|
52422 |
|
52423 | firstNode() {
|
52424 | return this.bounds.firstNode();
|
52425 | }
|
52426 |
|
52427 | lastNode() {
|
52428 | return this.bounds.lastNode();
|
52429 | }
|
52430 |
|
52431 | handleException() {
|
52432 | throw 'this should never happen';
|
52433 | }
|
52434 |
|
52435 | }
|
52436 |
|
52437 | class InnerStack {
|
52438 | constructor(inner = new _lowLevel.Stack(), js) {
|
52439 | this.inner = inner;
|
52440 | this.js = (0, _util.constants)();
|
52441 |
|
52442 | if (js !== undefined) {
|
52443 | this.js = this.js.concat(js);
|
52444 | }
|
52445 | }
|
52446 |
|
52447 | slice(start, end) {
|
52448 | var out = [];
|
52449 |
|
52450 | if (start === -1) {
|
52451 | return out;
|
52452 | }
|
52453 |
|
52454 | for (var i = start; i < end; i++) {
|
52455 | out.push(this.get(i));
|
52456 | }
|
52457 |
|
52458 | return out;
|
52459 | }
|
52460 |
|
52461 | copy(from, to) {
|
52462 | this.inner.copy(from, to);
|
52463 | }
|
52464 |
|
52465 | writeJs(pos, value) {
|
52466 | var idx = this.js.length;
|
52467 | this.js.push(value);
|
52468 | this.inner.writeRaw(pos, (0, _util.encodeHandle)(idx));
|
52469 | }
|
52470 |
|
52471 | writeSmallInt(pos, value) {
|
52472 | this.inner.writeRaw(pos, (0, _util.encodeImmediate)(value));
|
52473 | }
|
52474 |
|
52475 | writeTrue(pos) {
|
52476 | this.inner.writeRaw(pos, 1
|
52477 |
|
52478 | );
|
52479 | }
|
52480 |
|
52481 | writeFalse(pos) {
|
52482 | this.inner.writeRaw(pos, 0
|
52483 |
|
52484 | );
|
52485 | }
|
52486 |
|
52487 | writeNull(pos) {
|
52488 | this.inner.writeRaw(pos, 2
|
52489 |
|
52490 | );
|
52491 | }
|
52492 |
|
52493 | writeUndefined(pos) {
|
52494 | this.inner.writeRaw(pos, 3
|
52495 |
|
52496 | );
|
52497 | }
|
52498 |
|
52499 | writeRaw(pos, value) {
|
52500 | this.inner.writeRaw(pos, value);
|
52501 | }
|
52502 |
|
52503 | getJs(pos) {
|
52504 | var value = this.inner.getRaw(pos);
|
52505 | return this.js[(0, _util.decodeHandle)(value)];
|
52506 | }
|
52507 |
|
52508 | getSmallInt(pos) {
|
52509 | var value = this.inner.getRaw(pos);
|
52510 | return (0, _util.decodeImmediate)(value);
|
52511 | }
|
52512 |
|
52513 | get(pos) {
|
52514 | var value = this.inner.getRaw(pos) | 0;
|
52515 |
|
52516 | if ((0, _util.isHandle)(value)) {
|
52517 | return this.js[(0, _util.decodeHandle)(value)];
|
52518 | } else {
|
52519 | return (0, _util.decodeImmediate)(value);
|
52520 | }
|
52521 | }
|
52522 |
|
52523 | reset() {
|
52524 | this.inner.reset();
|
52525 | this.js.length = 0;
|
52526 | }
|
52527 |
|
52528 | get length() {
|
52529 | return this.inner.len();
|
52530 | }
|
52531 |
|
52532 | }
|
52533 |
|
52534 | class EvaluationStackImpl {
|
52535 |
|
52536 | constructor(stack, registers) {
|
52537 | this.stack = stack;
|
52538 | this[REGISTERS] = registers;
|
52539 | }
|
52540 |
|
52541 | static restore(snapshot) {
|
52542 | var stack = new InnerStack();
|
52543 |
|
52544 | for (var i = 0; i < snapshot.length; i++) {
|
52545 | var value = snapshot[i];
|
52546 |
|
52547 | if (typeof value === 'number' && (0, _util.isSmallInt)(value)) {
|
52548 | stack.writeRaw(i, (0, _util.encodeImmediate)(value));
|
52549 | } else if (value === true) {
|
52550 | stack.writeTrue(i);
|
52551 | } else if (value === false) {
|
52552 | stack.writeFalse(i);
|
52553 | } else if (value === null) {
|
52554 | stack.writeNull(i);
|
52555 | } else if (value === undefined) {
|
52556 | stack.writeUndefined(i);
|
52557 | } else {
|
52558 | stack.writeJs(i, value);
|
52559 | }
|
52560 | }
|
52561 |
|
52562 | return new this(stack, initializeRegistersWithSP(snapshot.length - 1));
|
52563 | }
|
52564 |
|
52565 | pushJs(value) {
|
52566 | this.stack.writeJs(++this[REGISTERS][_vm2.$sp], value);
|
52567 | }
|
52568 |
|
52569 | pushSmallInt(value) {
|
52570 | this.stack.writeSmallInt(++this[REGISTERS][_vm2.$sp], value);
|
52571 | }
|
52572 |
|
52573 | pushTrue() {
|
52574 | this.stack.writeTrue(++this[REGISTERS][_vm2.$sp]);
|
52575 | }
|
52576 |
|
52577 | pushFalse() {
|
52578 | this.stack.writeFalse(++this[REGISTERS][_vm2.$sp]);
|
52579 | }
|
52580 |
|
52581 | pushNull() {
|
52582 | this.stack.writeNull(++this[REGISTERS][_vm2.$sp]);
|
52583 | }
|
52584 |
|
52585 | pushUndefined() {
|
52586 | this.stack.writeUndefined(++this[REGISTERS][_vm2.$sp]);
|
52587 | }
|
52588 |
|
52589 | pushRaw(value) {
|
52590 | this.stack.writeRaw(++this[REGISTERS][_vm2.$sp], value);
|
52591 | }
|
52592 |
|
52593 | dup(position = this[REGISTERS][_vm2.$sp]) {
|
52594 | this.stack.copy(position, ++this[REGISTERS][_vm2.$sp]);
|
52595 | }
|
52596 |
|
52597 | copy(from, to) {
|
52598 | this.stack.copy(from, to);
|
52599 | }
|
52600 |
|
52601 | popJs(n = 1) {
|
52602 | var top = this.stack.getJs(this[REGISTERS][_vm2.$sp]);
|
52603 | this[REGISTERS][_vm2.$sp] -= n;
|
52604 | return top;
|
52605 | }
|
52606 |
|
52607 | popSmallInt(n = 1) {
|
52608 | var top = this.stack.getSmallInt(this[REGISTERS][_vm2.$sp]);
|
52609 | this[REGISTERS][_vm2.$sp] -= n;
|
52610 | return top;
|
52611 | }
|
52612 |
|
52613 | pop(n = 1) {
|
52614 | var top = this.stack.get(this[REGISTERS][_vm2.$sp]);
|
52615 | this[REGISTERS][_vm2.$sp] -= n;
|
52616 | return top;
|
52617 | }
|
52618 |
|
52619 | peekJs(offset = 0) {
|
52620 | return this.stack.getJs(this[REGISTERS][_vm2.$sp] - offset);
|
52621 | }
|
52622 |
|
52623 | peekSmallInt(offset = 0) {
|
52624 | return this.stack.getSmallInt(this[REGISTERS][_vm2.$sp] - offset);
|
52625 | }
|
52626 |
|
52627 | peek(offset = 0) {
|
52628 | return this.stack.get(this[REGISTERS][_vm2.$sp] - offset);
|
52629 | }
|
52630 |
|
52631 | get(offset, base = this[REGISTERS][_vm2.$fp]) {
|
52632 | return this.stack.get(base + offset);
|
52633 | }
|
52634 |
|
52635 | set(value, offset, base = this[REGISTERS][_vm2.$fp]) {
|
52636 | this.stack.writeJs(base + offset, value);
|
52637 | }
|
52638 |
|
52639 | slice(start, end) {
|
52640 | return this.stack.slice(start, end);
|
52641 | }
|
52642 |
|
52643 | capture(items) {
|
52644 | var end = this[REGISTERS][_vm2.$sp] + 1;
|
52645 | var start = end - items;
|
52646 | return this.stack.slice(start, end);
|
52647 | }
|
52648 |
|
52649 | reset() {
|
52650 | this.stack.reset();
|
52651 | }
|
52652 |
|
52653 | toArray() {
|
52654 | console.log(this[REGISTERS]);
|
52655 | return this.stack.slice(this[REGISTERS][_vm2.$fp], this[REGISTERS][_vm2.$sp] + 1);
|
52656 | }
|
52657 |
|
52658 | }
|
52659 |
|
52660 | var _a$3, _b;
|
52661 |
|
52662 | class Stacks {
|
52663 | constructor() {
|
52664 | this.scope = new _util.Stack();
|
52665 | this.dynamicScope = new _util.Stack();
|
52666 | this.updating = new _util.Stack();
|
52667 | this.cache = new _util.Stack();
|
52668 | this.list = new _util.Stack();
|
52669 | }
|
52670 |
|
52671 | }
|
52672 |
|
52673 | class VM {
|
52674 | |
52675 |
|
52676 |
|
52677 | constructor(runtime, {
|
52678 | pc,
|
52679 | scope,
|
52680 | dynamicScope,
|
52681 | stack
|
52682 | }, elementStack) {
|
52683 | this.runtime = runtime;
|
52684 | this.elementStack = elementStack;
|
52685 | this[_a$3] = new Stacks();
|
52686 | this[_b] = new _util.Stack();
|
52687 | this.s0 = null;
|
52688 | this.s1 = null;
|
52689 | this.t0 = null;
|
52690 | this.t1 = null;
|
52691 | this.v0 = null;
|
52692 | var evalStack = EvaluationStackImpl.restore(stack);
|
52693 | evalStack[REGISTERS][_vm2.$pc] = pc;
|
52694 | evalStack[REGISTERS][_vm2.$sp] = stack.length - 1;
|
52695 | evalStack[REGISTERS][_vm2.$fp] = -1;
|
52696 | this[HEAP] = this.program.heap;
|
52697 | this[CONSTANTS] = this.program.constants;
|
52698 | this.elementStack = elementStack;
|
52699 | this[STACKS].scope.push(scope);
|
52700 | this[STACKS].dynamicScope.push(dynamicScope);
|
52701 | this[ARGS] = new VMArgumentsImpl();
|
52702 | this[INNER_VM] = new LowLevelVM(evalStack, this[HEAP], runtime.program, {
|
52703 | debugBefore: opcode => {
|
52704 | return APPEND_OPCODES.debugBefore(this, opcode);
|
52705 | },
|
52706 | debugAfter: state => {
|
52707 | APPEND_OPCODES.debugAfter(this, state);
|
52708 | }
|
52709 | }, evalStack[REGISTERS]);
|
52710 | this.destructor = {};
|
52711 | this[DESTROYABLE_STACK].push(this.destructor);
|
52712 | }
|
52713 |
|
52714 | get stack() {
|
52715 | return this[INNER_VM].stack;
|
52716 | }
|
52717 |
|
52718 |
|
52719 |
|
52720 | get pc() {
|
52721 | return this[INNER_VM].fetchRegister(_vm2.$pc);
|
52722 | }
|
52723 |
|
52724 |
|
52725 | fetch(register) {
|
52726 | var value = this.fetchValue(register);
|
52727 | this.stack.pushJs(value);
|
52728 | }
|
52729 |
|
52730 |
|
52731 | load(register) {
|
52732 | var value = this.stack.pop();
|
52733 | this.loadValue(register, value);
|
52734 | }
|
52735 |
|
52736 | fetchValue(register) {
|
52737 | if ((0, _vm2.isLowLevelRegister)(register)) {
|
52738 | return this[INNER_VM].fetchRegister(register);
|
52739 | }
|
52740 |
|
52741 | switch (register) {
|
52742 | case _vm2.$s0:
|
52743 | return this.s0;
|
52744 |
|
52745 | case _vm2.$s1:
|
52746 | return this.s1;
|
52747 |
|
52748 | case _vm2.$t0:
|
52749 | return this.t0;
|
52750 |
|
52751 | case _vm2.$t1:
|
52752 | return this.t1;
|
52753 |
|
52754 | case _vm2.$v0:
|
52755 | return this.v0;
|
52756 | }
|
52757 | }
|
52758 |
|
52759 |
|
52760 | loadValue(register, value) {
|
52761 | if ((0, _vm2.isLowLevelRegister)(register)) {
|
52762 | this[INNER_VM].loadRegister(register, value);
|
52763 | }
|
52764 |
|
52765 | switch (register) {
|
52766 | case _vm2.$s0:
|
52767 | this.s0 = value;
|
52768 | break;
|
52769 |
|
52770 | case _vm2.$s1:
|
52771 | this.s1 = value;
|
52772 | break;
|
52773 |
|
52774 | case _vm2.$t0:
|
52775 | this.t0 = value;
|
52776 | break;
|
52777 |
|
52778 | case _vm2.$t1:
|
52779 | this.t1 = value;
|
52780 | break;
|
52781 |
|
52782 | case _vm2.$v0:
|
52783 | this.v0 = value;
|
52784 | break;
|
52785 | }
|
52786 | }
|
52787 | |
52788 |
|
52789 |
|
52790 |
|
52791 |
|
52792 |
|
52793 | pushFrame() {
|
52794 | this[INNER_VM].pushFrame();
|
52795 | }
|
52796 |
|
52797 |
|
52798 | popFrame() {
|
52799 | this[INNER_VM].popFrame();
|
52800 | }
|
52801 |
|
52802 |
|
52803 | goto(offset) {
|
52804 | this[INNER_VM].goto(offset);
|
52805 | }
|
52806 |
|
52807 |
|
52808 | call(handle) {
|
52809 | this[INNER_VM].call(handle);
|
52810 | }
|
52811 |
|
52812 |
|
52813 | returnTo(offset) {
|
52814 | this[INNER_VM].returnTo(offset);
|
52815 | }
|
52816 |
|
52817 |
|
52818 | return() {
|
52819 | this[INNER_VM].return();
|
52820 | }
|
52821 |
|
52822 | get program() {
|
52823 | return this.runtime.program;
|
52824 | }
|
52825 |
|
52826 | get env() {
|
52827 | return this.runtime.env;
|
52828 | }
|
52829 |
|
52830 | captureState(args, pc = this[INNER_VM].fetchRegister(_vm2.$pc)) {
|
52831 | return {
|
52832 | pc,
|
52833 | dynamicScope: this.dynamicScope(),
|
52834 | scope: this.scope(),
|
52835 | stack: this.stack.capture(args)
|
52836 | };
|
52837 | }
|
52838 |
|
52839 | beginCacheGroup() {
|
52840 | var opcodes = this.updating();
|
52841 | var guard = new JumpIfNotModifiedOpcode(opcodes.length);
|
52842 | opcodes.push(guard);
|
52843 | this[STACKS].cache.push(guard);
|
52844 | }
|
52845 |
|
52846 | commitCacheGroup() {
|
52847 | var opcodes = this.updating();
|
52848 | var guard = this[STACKS].cache.pop();
|
52849 | var startIndex = guard.index;
|
52850 | var tag = combineFromIndex(opcodes, startIndex);
|
52851 | opcodes.push(new DidModifyOpcode(guard));
|
52852 | guard.finalize(tag, opcodes.length);
|
52853 | }
|
52854 |
|
52855 | enter(args) {
|
52856 | var updating = [];
|
52857 | var state = this.capture(args);
|
52858 | var block = this.elements().pushUpdatableBlock();
|
52859 | var tryOpcode = new TryOpcode(state, this.runtime, block, updating);
|
52860 | this.didEnter(tryOpcode);
|
52861 | }
|
52862 |
|
52863 | enterItem(iterableRef, {
|
52864 | key,
|
52865 | value,
|
52866 | memo
|
52867 | }) {
|
52868 | var {
|
52869 | stack
|
52870 | } = this;
|
52871 | var valueRef = iterableRef.childRefFor(key, value);
|
52872 | var memoRef = iterableRef.childRefFor(key, memo);
|
52873 | stack.pushJs(valueRef);
|
52874 | stack.pushJs(memoRef);
|
52875 | var state = this.capture(2);
|
52876 | var block = this.elements().pushUpdatableBlock();
|
52877 | var opcode = new ListItemOpcode(state, this.runtime, block, key, memoRef, valueRef);
|
52878 | this.didEnter(opcode);
|
52879 | return opcode;
|
52880 | }
|
52881 |
|
52882 | registerItem(opcode) {
|
52883 | this.listBlock().initializeChild(opcode);
|
52884 | }
|
52885 |
|
52886 | enterList(offset) {
|
52887 | var updating = [];
|
52888 | var addr = this[INNER_VM].target(offset);
|
52889 | var state = this.capture(0, addr);
|
52890 | var list = this.elements().pushBlockList(updating);
|
52891 | var iterableRef = this.stack.peekJs();
|
52892 | var opcode = new ListBlockOpcode(state, this.runtime, list, updating, iterableRef);
|
52893 | this[STACKS].list.push(opcode);
|
52894 | this.didEnter(opcode);
|
52895 | }
|
52896 |
|
52897 | didEnter(opcode) {
|
52898 | this.associateDestroyable(opcode);
|
52899 | this[DESTROYABLE_STACK].push(opcode);
|
52900 | this.updateWith(opcode);
|
52901 | this.pushUpdating(opcode.children);
|
52902 | }
|
52903 |
|
52904 | exit() {
|
52905 | this[DESTROYABLE_STACK].pop();
|
52906 | this.elements().popBlock();
|
52907 | this.popUpdating();
|
52908 | var updating = this.updating();
|
52909 | var parent = updating[updating.length - 1];
|
52910 | parent.didInitializeChildren();
|
52911 | }
|
52912 |
|
52913 | exitList() {
|
52914 | this.exit();
|
52915 | this[STACKS].list.pop();
|
52916 | }
|
52917 |
|
52918 | pushUpdating(list = []) {
|
52919 | this[STACKS].updating.push(list);
|
52920 | }
|
52921 |
|
52922 | popUpdating() {
|
52923 | return this[STACKS].updating.pop();
|
52924 | }
|
52925 |
|
52926 | updateWith(opcode) {
|
52927 | this.updating().push(opcode);
|
52928 | }
|
52929 |
|
52930 | listBlock() {
|
52931 | return this[STACKS].list.current;
|
52932 | }
|
52933 |
|
52934 | associateDestroyable(child) {
|
52935 | var parent = this[DESTROYABLE_STACK].current;
|
52936 | associateDestroyableChild(parent, child);
|
52937 | }
|
52938 |
|
52939 | tryUpdating() {
|
52940 | return this[STACKS].updating.current;
|
52941 | }
|
52942 |
|
52943 | updating() {
|
52944 | return this[STACKS].updating.current;
|
52945 | }
|
52946 |
|
52947 | elements() {
|
52948 | return this.elementStack;
|
52949 | }
|
52950 |
|
52951 | scope() {
|
52952 | return this[STACKS].scope.current;
|
52953 | }
|
52954 |
|
52955 | dynamicScope() {
|
52956 | return this[STACKS].dynamicScope.current;
|
52957 | }
|
52958 |
|
52959 | pushChildScope() {
|
52960 | this[STACKS].scope.push(this.scope().child());
|
52961 | }
|
52962 |
|
52963 | pushDynamicScope() {
|
52964 | var child = this.dynamicScope().child();
|
52965 | this[STACKS].dynamicScope.push(child);
|
52966 | return child;
|
52967 | }
|
52968 |
|
52969 | pushRootScope(size) {
|
52970 | var scope = ScopeImpl.sized(size);
|
52971 | this[STACKS].scope.push(scope);
|
52972 | return scope;
|
52973 | }
|
52974 |
|
52975 | pushScope(scope) {
|
52976 | this[STACKS].scope.push(scope);
|
52977 | }
|
52978 |
|
52979 | popScope() {
|
52980 | this[STACKS].scope.pop();
|
52981 | }
|
52982 |
|
52983 | popDynamicScope() {
|
52984 | this[STACKS].dynamicScope.pop();
|
52985 | }
|
52986 |
|
52987 |
|
52988 | getSelf() {
|
52989 | return this.scope().getSelf();
|
52990 | }
|
52991 |
|
52992 | referenceForSymbol(symbol$$1) {
|
52993 | return this.scope().getSymbol(symbol$$1);
|
52994 | }
|
52995 |
|
52996 |
|
52997 | execute(initialize) {
|
52998 | if (initialize) initialize(this);
|
52999 | var result;
|
53000 |
|
53001 | try {
|
53002 | while (true) {
|
53003 | result = this.next();
|
53004 | if (result.done) break;
|
53005 | }
|
53006 | } finally {
|
53007 |
|
53008 |
|
53009 | var elements = this.elements();
|
53010 |
|
53011 | while (elements.hasBlocks) {
|
53012 | elements.popBlock();
|
53013 | }
|
53014 | }
|
53015 |
|
53016 | return result.value;
|
53017 | }
|
53018 |
|
53019 | next() {
|
53020 | var {
|
53021 | env,
|
53022 | elementStack
|
53023 | } = this;
|
53024 | var opcode = this[INNER_VM].nextStatement();
|
53025 | var result;
|
53026 |
|
53027 | if (opcode !== null) {
|
53028 | this[INNER_VM].evaluateOuter(opcode, this);
|
53029 | result = {
|
53030 | done: false,
|
53031 | value: null
|
53032 | };
|
53033 | } else {
|
53034 |
|
53035 | this.stack.reset();
|
53036 | result = {
|
53037 | done: true,
|
53038 | value: new RenderResultImpl(env, this.popUpdating(), elementStack.popBlock(), this.destructor)
|
53039 | };
|
53040 | }
|
53041 |
|
53042 | return result;
|
53043 | }
|
53044 |
|
53045 | bindDynamicScope(names) {
|
53046 | var scope = this.dynamicScope();
|
53047 |
|
53048 | for (var i = names.length - 1; i >= 0; i--) {
|
53049 | var _name10 = names[i];
|
53050 | scope.set(_name10, this.stack.popJs());
|
53051 | }
|
53052 | }
|
53053 |
|
53054 | }
|
53055 |
|
53056 | _exports.LowLevelVM = VM;
|
53057 | _a$3 = STACKS, _b = DESTROYABLE_STACK;
|
53058 |
|
53059 | function vmState(pc, scope = ScopeImpl.root(UNDEFINED_REFERENCE, 0), dynamicScope) {
|
53060 | return {
|
53061 | pc,
|
53062 | scope,
|
53063 | dynamicScope,
|
53064 | stack: []
|
53065 | };
|
53066 | }
|
53067 |
|
53068 | class AotVM extends VM {
|
53069 | static empty(runtime, {
|
53070 | handle,
|
53071 | treeBuilder,
|
53072 | dynamicScope
|
53073 | }) {
|
53074 | var vm = initAOT(runtime, vmState(runtime.program.heap.getaddr(handle), ScopeImpl.root(UNDEFINED_REFERENCE, 0), dynamicScope), treeBuilder);
|
53075 | vm.pushUpdating();
|
53076 | return vm;
|
53077 | }
|
53078 |
|
53079 | static initial(runtime, {
|
53080 | handle,
|
53081 | self,
|
53082 | treeBuilder,
|
53083 | dynamicScope
|
53084 | }) {
|
53085 | var scopeSize = runtime.program.heap.scopesizeof(handle);
|
53086 | var scope = ScopeImpl.root(self, scopeSize);
|
53087 | var pc = runtime.program.heap.getaddr(handle);
|
53088 | var state = vmState(pc, scope, dynamicScope);
|
53089 | var vm = initAOT(runtime, state, treeBuilder);
|
53090 | vm.pushUpdating();
|
53091 | return vm;
|
53092 | }
|
53093 |
|
53094 | capture(args, pc = this[INNER_VM].fetchRegister(_vm2.$pc)) {
|
53095 | return new ResumableVMStateImpl(this.captureState(args, pc), initAOT);
|
53096 | }
|
53097 |
|
53098 | }
|
53099 |
|
53100 | function initAOT(runtime, state, builder) {
|
53101 | return new AotVM(runtime, state, builder);
|
53102 | }
|
53103 |
|
53104 | function initJIT(context) {
|
53105 | return (runtime, state, builder) => new JitVM(runtime, state, builder, context);
|
53106 | }
|
53107 |
|
53108 | class JitVM extends VM {
|
53109 | constructor(runtime, state, elementStack, context) {
|
53110 | super(runtime, state, elementStack);
|
53111 | this.context = context;
|
53112 | this.resume = initJIT(this.context);
|
53113 | }
|
53114 |
|
53115 | static initial(runtime, context, {
|
53116 | handle,
|
53117 | self,
|
53118 | dynamicScope,
|
53119 | treeBuilder
|
53120 | }) {
|
53121 | var scopeSize = runtime.program.heap.scopesizeof(handle);
|
53122 | var scope = ScopeImpl.root(self, scopeSize);
|
53123 | var state = vmState(runtime.program.heap.getaddr(handle), scope, dynamicScope);
|
53124 | var vm = initJIT(context)(runtime, state, treeBuilder);
|
53125 | vm.pushUpdating();
|
53126 | return vm;
|
53127 | }
|
53128 |
|
53129 | static empty(runtime, {
|
53130 | handle,
|
53131 | treeBuilder,
|
53132 | dynamicScope
|
53133 | }, context) {
|
53134 | var vm = initJIT(context)(runtime, vmState(runtime.program.heap.getaddr(handle), ScopeImpl.root(UNDEFINED_REFERENCE, 0), dynamicScope), treeBuilder);
|
53135 | vm.pushUpdating();
|
53136 | return vm;
|
53137 | }
|
53138 |
|
53139 | capture(args, pc = this[INNER_VM].fetchRegister(_vm2.$pc)) {
|
53140 | return new ResumableVMStateImpl(this.captureState(args, pc), this.resume);
|
53141 | }
|
53142 |
|
53143 | compile(block) {
|
53144 | var handle = (0, _util.unwrapHandle)(block.compile(this.context));
|
53145 | return handle;
|
53146 | }
|
53147 |
|
53148 | }
|
53149 |
|
53150 | class TemplateIteratorImpl {
|
53151 | constructor(vm) {
|
53152 | this.vm = vm;
|
53153 | }
|
53154 |
|
53155 | next() {
|
53156 | return this.vm.next();
|
53157 | }
|
53158 |
|
53159 | sync() {
|
53160 | return renderSync(this.vm.runtime.env, this);
|
53161 | }
|
53162 |
|
53163 | }
|
53164 |
|
53165 | function renderSync(env, iterator) {
|
53166 | try {
|
53167 | env.begin();
|
53168 | var iteratorResult;
|
53169 |
|
53170 | do {
|
53171 | iteratorResult = iterator.next();
|
53172 | } while (!iteratorResult.done);
|
53173 |
|
53174 | return iteratorResult.value;
|
53175 | } finally {
|
53176 | env.commit();
|
53177 | }
|
53178 | }
|
53179 |
|
53180 | function renderAotMain(runtime, self, treeBuilder, handle, dynamicScope = new DefaultDynamicScope()) {
|
53181 | var vm = AotVM.initial(runtime, {
|
53182 | self,
|
53183 | dynamicScope,
|
53184 | treeBuilder,
|
53185 | handle
|
53186 | });
|
53187 | return new TemplateIteratorImpl(vm);
|
53188 | }
|
53189 |
|
53190 | function renderAot(runtime, handle, cursor, self = UNDEFINED_REFERENCE) {
|
53191 | var treeBuilder = NewElementBuilder.forInitialRender(runtime.env, cursor);
|
53192 | var dynamicScope = new DefaultDynamicScope();
|
53193 | var vm = AotVM.initial(runtime, {
|
53194 | self,
|
53195 | dynamicScope,
|
53196 | treeBuilder,
|
53197 | handle
|
53198 | });
|
53199 | return new TemplateIteratorImpl(vm);
|
53200 | }
|
53201 |
|
53202 | function renderJitMain(runtime, context, self, treeBuilder, handle, dynamicScope = new DefaultDynamicScope()) {
|
53203 | var vm = JitVM.initial(runtime, context, {
|
53204 | self,
|
53205 | dynamicScope,
|
53206 | treeBuilder,
|
53207 | handle
|
53208 | });
|
53209 | return new TemplateIteratorImpl(vm);
|
53210 | }
|
53211 |
|
53212 | function renderInvocation(vm, invocation, definition, args) {
|
53213 |
|
53214 |
|
53215 | var argList = Object.keys(args).map(key => [key, args[key]]);
|
53216 | var blockNames = ['main', 'else', 'attrs'];
|
53217 |
|
53218 | var argNames = argList.map(([name]) => `@${name}`);
|
53219 | vm.pushFrame();
|
53220 |
|
53221 | for (var i = 0; i < 3 * blockNames.length; i++) {
|
53222 | vm.stack.pushNull();
|
53223 | }
|
53224 |
|
53225 | vm.stack.pushNull();
|
53226 |
|
53227 | argList.forEach(([, reference]) => {
|
53228 | vm.stack.pushJs(reference);
|
53229 | });
|
53230 |
|
53231 | vm[ARGS].setup(vm.stack, argNames, blockNames, 0, true);
|
53232 |
|
53233 |
|
53234 | vm.stack.pushJs(vm[ARGS]);
|
53235 | vm.stack.pushJs(invocation);
|
53236 | vm.stack.pushJs(definition);
|
53237 | return new TemplateIteratorImpl(vm);
|
53238 | }
|
53239 |
|
53240 | function renderAotComponent(runtime, treeBuilder, main, name, args = {}, dynamicScope = new DefaultDynamicScope()) {
|
53241 | var vm = AotVM.empty(runtime, {
|
53242 | treeBuilder,
|
53243 | handle: main,
|
53244 | dynamicScope
|
53245 | });
|
53246 | var definition = resolveComponent(vm.runtime.resolver, name);
|
53247 | var {
|
53248 | manager,
|
53249 | state
|
53250 | } = definition;
|
53251 | var capabilities = capabilityFlagsFrom(manager.getCapabilities(state));
|
53252 | var invocation;
|
53253 |
|
53254 | if (hasStaticLayoutCapability(capabilities, manager)) {
|
53255 | invocation = manager.getAotStaticLayout(state, vm.runtime.resolver);
|
53256 | } else {
|
53257 | throw new Error('Cannot invoke components with dynamic layouts as a root component.');
|
53258 | }
|
53259 |
|
53260 | return renderInvocation(vm, invocation, definition, args);
|
53261 | }
|
53262 |
|
53263 | function renderJitComponent(runtime, treeBuilder, context, main, name, args = {}, dynamicScope = new DefaultDynamicScope()) {
|
53264 | var vm = JitVM.empty(runtime, {
|
53265 | treeBuilder,
|
53266 | handle: main,
|
53267 | dynamicScope
|
53268 | }, context);
|
53269 | var definition = resolveComponent(vm.runtime.resolver, name);
|
53270 | var {
|
53271 | manager,
|
53272 | state
|
53273 | } = definition;
|
53274 | var capabilities = capabilityFlagsFrom(manager.getCapabilities(state));
|
53275 | var invocation;
|
53276 |
|
53277 | if (hasStaticLayoutCapability(capabilities, manager)) {
|
53278 | var layout = manager.getJitStaticLayout(state, vm.runtime.resolver);
|
53279 | var handle = (0, _util.unwrapHandle)(layout.compile(context));
|
53280 |
|
53281 | if (Array.isArray(handle)) {
|
53282 | var error = handle[0];
|
53283 | throw new Error(`Compile Error: ${error.problem} ${error.span.start}..${error.span.end} :: TODO (thread better)`);
|
53284 | }
|
53285 |
|
53286 | invocation = {
|
53287 | handle,
|
53288 | symbolTable: layout.symbolTable
|
53289 | };
|
53290 | } else {
|
53291 | throw new Error('Cannot invoke components with dynamic layouts as a root component.');
|
53292 | }
|
53293 |
|
53294 | return renderInvocation(vm, invocation, definition, args);
|
53295 | }
|
53296 |
|
53297 | var SERIALIZATION_FIRST_NODE_STRING = '%+b:0%';
|
53298 | _exports.SERIALIZATION_FIRST_NODE_STRING = SERIALIZATION_FIRST_NODE_STRING;
|
53299 |
|
53300 | function isSerializationFirstNode(node) {
|
53301 | return node.nodeValue === SERIALIZATION_FIRST_NODE_STRING;
|
53302 | }
|
53303 |
|
53304 | class RehydratingCursor extends CursorImpl {
|
53305 | constructor(element, nextSibling, startingBlockDepth) {
|
53306 | super(element, nextSibling);
|
53307 | this.startingBlockDepth = startingBlockDepth;
|
53308 | this.candidate = null;
|
53309 | this.injectedOmittedNode = false;
|
53310 | this.openBlockDepth = startingBlockDepth - 1;
|
53311 | }
|
53312 |
|
53313 | }
|
53314 |
|
53315 | class RehydrateBuilder extends NewElementBuilder {
|
53316 | constructor(env, parentNode, nextSibling) {
|
53317 | super(env, parentNode, nextSibling);
|
53318 | this.unmatchedAttributes = null;
|
53319 | this.blockDepth = 0;
|
53320 | if (nextSibling) throw new Error('Rehydration with nextSibling not supported');
|
53321 | var node = this.currentCursor.element.firstChild;
|
53322 |
|
53323 | while (node !== null) {
|
53324 | if (isComment(node) && isSerializationFirstNode(node)) {
|
53325 | break;
|
53326 | }
|
53327 |
|
53328 | node = node.nextSibling;
|
53329 | }
|
53330 |
|
53331 | this.candidate = node;
|
53332 | }
|
53333 |
|
53334 | get currentCursor() {
|
53335 | return this[CURSOR_STACK].current;
|
53336 | }
|
53337 |
|
53338 | get candidate() {
|
53339 | if (this.currentCursor) {
|
53340 | return this.currentCursor.candidate;
|
53341 | }
|
53342 |
|
53343 | return null;
|
53344 | }
|
53345 |
|
53346 | set candidate(node) {
|
53347 | var currentCursor = this.currentCursor;
|
53348 | currentCursor.candidate = node;
|
53349 | }
|
53350 |
|
53351 | disableRehydration(nextSibling) {
|
53352 | var currentCursor = this.currentCursor;
|
53353 |
|
53354 |
|
53355 |
|
53356 |
|
53357 | currentCursor.candidate = null;
|
53358 | currentCursor.nextSibling = nextSibling;
|
53359 | }
|
53360 |
|
53361 | enableRehydration(candidate) {
|
53362 | var currentCursor = this.currentCursor;
|
53363 | currentCursor.candidate = candidate;
|
53364 | currentCursor.nextSibling = null;
|
53365 | }
|
53366 |
|
53367 | pushElement(element, nextSibling = null) {
|
53368 | var cursor = new RehydratingCursor(element, nextSibling, this.blockDepth || 0);
|
53369 | |
53370 |
|
53371 |
|
53372 |
|
53373 |
|
53374 |
|
53375 |
|
53376 |
|
53377 |
|
53378 |
|
53379 |
|
53380 | if (this.candidate !== null) {
|
53381 | cursor.candidate = element.firstChild;
|
53382 | this.candidate = element.nextSibling;
|
53383 | }
|
53384 |
|
53385 | this[CURSOR_STACK].push(cursor);
|
53386 | }
|
53387 |
|
53388 |
|
53389 |
|
53390 | clearMismatch(candidate) {
|
53391 | var current = candidate;
|
53392 | var currentCursor = this.currentCursor;
|
53393 |
|
53394 | if (currentCursor !== null) {
|
53395 | var openBlockDepth = currentCursor.openBlockDepth;
|
53396 |
|
53397 | if (openBlockDepth >= currentCursor.startingBlockDepth) {
|
53398 | while (current) {
|
53399 | if (isCloseBlock(current)) {
|
53400 | var closeBlockDepth = getBlockDepth(current);
|
53401 |
|
53402 | if (openBlockDepth >= closeBlockDepth) {
|
53403 | break;
|
53404 | }
|
53405 | }
|
53406 |
|
53407 | current = this.remove(current);
|
53408 | }
|
53409 | } else {
|
53410 | while (current !== null) {
|
53411 | current = this.remove(current);
|
53412 | }
|
53413 | }
|
53414 |
|
53415 |
|
53416 |
|
53417 | this.disableRehydration(current);
|
53418 | }
|
53419 | }
|
53420 |
|
53421 | __openBlock() {
|
53422 | var {
|
53423 | currentCursor
|
53424 | } = this;
|
53425 | if (currentCursor === null) return;
|
53426 | var blockDepth = this.blockDepth;
|
53427 | this.blockDepth++;
|
53428 | var {
|
53429 | candidate
|
53430 | } = currentCursor;
|
53431 | if (candidate === null) return;
|
53432 | var {
|
53433 | tagName
|
53434 | } = currentCursor.element;
|
53435 |
|
53436 | if (isOpenBlock(candidate) && getBlockDepth(candidate) === blockDepth) {
|
53437 | this.candidate = this.remove(candidate);
|
53438 | currentCursor.openBlockDepth = blockDepth;
|
53439 | } else if (tagName !== 'TITLE' && tagName !== 'SCRIPT' && tagName !== 'STYLE') {
|
53440 | this.clearMismatch(candidate);
|
53441 | }
|
53442 | }
|
53443 |
|
53444 | __closeBlock() {
|
53445 | var {
|
53446 | currentCursor
|
53447 | } = this;
|
53448 | if (currentCursor === null) return;
|
53449 |
|
53450 | var openBlockDepth = currentCursor.openBlockDepth;
|
53451 |
|
53452 | this.blockDepth--;
|
53453 | var {
|
53454 | candidate
|
53455 | } = currentCursor;
|
53456 | var isRehydrating = false;
|
53457 |
|
53458 | if (candidate !== null) {
|
53459 | isRehydrating = true;
|
53460 |
|
53461 |
|
53462 |
|
53463 |
|
53464 | if (isCloseBlock(candidate) && getBlockDepth(candidate) === openBlockDepth) {
|
53465 | var nextSibling = this.remove(candidate);
|
53466 | this.candidate = nextSibling;
|
53467 | currentCursor.openBlockDepth--;
|
53468 | } else {
|
53469 |
|
53470 |
|
53471 |
|
53472 | this.clearMismatch(candidate);
|
53473 | isRehydrating = false;
|
53474 | }
|
53475 | }
|
53476 |
|
53477 | if (isRehydrating === false) {
|
53478 |
|
53479 |
|
53480 |
|
53481 | var _nextSibling = currentCursor.nextSibling;
|
53482 |
|
53483 | if (_nextSibling !== null && isCloseBlock(_nextSibling) && getBlockDepth(_nextSibling) === this.blockDepth) {
|
53484 |
|
53485 | var _candidate2 = this.remove(_nextSibling);
|
53486 |
|
53487 | this.enableRehydration(_candidate2);
|
53488 | currentCursor.openBlockDepth--;
|
53489 | }
|
53490 | }
|
53491 | }
|
53492 |
|
53493 | __appendNode(node) {
|
53494 | var {
|
53495 | candidate
|
53496 | } = this;
|
53497 |
|
53498 |
|
53499 |
|
53500 | if (candidate) {
|
53501 | return candidate;
|
53502 | } else {
|
53503 | return super.__appendNode(node);
|
53504 | }
|
53505 | }
|
53506 |
|
53507 | __appendHTML(html) {
|
53508 | var candidateBounds = this.markerBounds();
|
53509 |
|
53510 | if (candidateBounds) {
|
53511 | var first = candidateBounds.firstNode();
|
53512 | var last = candidateBounds.lastNode();
|
53513 | var newBounds = new ConcreteBounds(this.element, first.nextSibling, last.previousSibling);
|
53514 | var possibleEmptyMarker = this.remove(first);
|
53515 | this.remove(last);
|
53516 |
|
53517 | if (possibleEmptyMarker !== null && isEmpty$1(possibleEmptyMarker)) {
|
53518 | this.candidate = this.remove(possibleEmptyMarker);
|
53519 |
|
53520 | if (this.candidate !== null) {
|
53521 | this.clearMismatch(this.candidate);
|
53522 | }
|
53523 | }
|
53524 |
|
53525 | return newBounds;
|
53526 | } else {
|
53527 | return super.__appendHTML(html);
|
53528 | }
|
53529 | }
|
53530 |
|
53531 | remove(node) {
|
53532 | var element = node.parentNode;
|
53533 | var next = node.nextSibling;
|
53534 | element.removeChild(node);
|
53535 | return next;
|
53536 | }
|
53537 |
|
53538 | markerBounds() {
|
53539 | var _candidate = this.candidate;
|
53540 |
|
53541 | if (_candidate && isMarker(_candidate)) {
|
53542 | var first = _candidate;
|
53543 | var last = first.nextSibling;
|
53544 |
|
53545 | while (last && !isMarker(last)) {
|
53546 | last = last.nextSibling;
|
53547 | }
|
53548 |
|
53549 | return new ConcreteBounds(this.element, first, last);
|
53550 | } else {
|
53551 | return null;
|
53552 | }
|
53553 | }
|
53554 |
|
53555 | __appendText(string) {
|
53556 | var {
|
53557 | candidate
|
53558 | } = this;
|
53559 |
|
53560 | if (candidate) {
|
53561 | if (isTextNode(candidate)) {
|
53562 | if (candidate.nodeValue !== string) {
|
53563 | candidate.nodeValue = string;
|
53564 | }
|
53565 |
|
53566 | this.candidate = candidate.nextSibling;
|
53567 | return candidate;
|
53568 | } else if (isSeparator(candidate)) {
|
53569 | this.candidate = this.remove(candidate);
|
53570 | return this.__appendText(string);
|
53571 | } else if (isEmpty$1(candidate) && string === '') {
|
53572 | this.candidate = this.remove(candidate);
|
53573 | return this.__appendText(string);
|
53574 | } else {
|
53575 | this.clearMismatch(candidate);
|
53576 | return super.__appendText(string);
|
53577 | }
|
53578 | } else {
|
53579 | return super.__appendText(string);
|
53580 | }
|
53581 | }
|
53582 |
|
53583 | __appendComment(string) {
|
53584 | var _candidate = this.candidate;
|
53585 |
|
53586 | if (_candidate && isComment(_candidate)) {
|
53587 | if (_candidate.nodeValue !== string) {
|
53588 | _candidate.nodeValue = string;
|
53589 | }
|
53590 |
|
53591 | this.candidate = _candidate.nextSibling;
|
53592 | return _candidate;
|
53593 | } else if (_candidate) {
|
53594 | this.clearMismatch(_candidate);
|
53595 | }
|
53596 |
|
53597 | return super.__appendComment(string);
|
53598 | }
|
53599 |
|
53600 | __openElement(tag) {
|
53601 | var _candidate = this.candidate;
|
53602 |
|
53603 | if (_candidate && isElement(_candidate) && isSameNodeType(_candidate, tag)) {
|
53604 | this.unmatchedAttributes = [].slice.call(_candidate.attributes);
|
53605 | return _candidate;
|
53606 | } else if (_candidate) {
|
53607 | if (isElement(_candidate) && _candidate.tagName === 'TBODY') {
|
53608 | this.pushElement(_candidate, null);
|
53609 | this.currentCursor.injectedOmittedNode = true;
|
53610 | return this.__openElement(tag);
|
53611 | }
|
53612 |
|
53613 | this.clearMismatch(_candidate);
|
53614 | }
|
53615 |
|
53616 | return super.__openElement(tag);
|
53617 | }
|
53618 |
|
53619 | __setAttribute(name, value, namespace) {
|
53620 | var unmatched = this.unmatchedAttributes;
|
53621 |
|
53622 | if (unmatched) {
|
53623 | var attr = findByName(unmatched, name);
|
53624 |
|
53625 | if (attr) {
|
53626 | if (attr.value !== value) {
|
53627 | attr.value = value;
|
53628 | }
|
53629 |
|
53630 | unmatched.splice(unmatched.indexOf(attr), 1);
|
53631 | return;
|
53632 | }
|
53633 | }
|
53634 |
|
53635 | return super.__setAttribute(name, value, namespace);
|
53636 | }
|
53637 |
|
53638 | __setProperty(name, value) {
|
53639 | var unmatched = this.unmatchedAttributes;
|
53640 |
|
53641 | if (unmatched) {
|
53642 | var attr = findByName(unmatched, name);
|
53643 |
|
53644 | if (attr) {
|
53645 | if (attr.value !== value) {
|
53646 | attr.value = value;
|
53647 | }
|
53648 |
|
53649 | unmatched.splice(unmatched.indexOf(attr), 1);
|
53650 | return;
|
53651 | }
|
53652 | }
|
53653 |
|
53654 | return super.__setProperty(name, value);
|
53655 | }
|
53656 |
|
53657 | __flushElement(parent, constructing) {
|
53658 | var {
|
53659 | unmatchedAttributes: unmatched
|
53660 | } = this;
|
53661 |
|
53662 | if (unmatched) {
|
53663 | for (var i = 0; i < unmatched.length; i++) {
|
53664 | this.constructing.removeAttribute(unmatched[i].name);
|
53665 | }
|
53666 |
|
53667 | this.unmatchedAttributes = null;
|
53668 | } else {
|
53669 | super.__flushElement(parent, constructing);
|
53670 | }
|
53671 | }
|
53672 |
|
53673 | willCloseElement() {
|
53674 | var {
|
53675 | candidate,
|
53676 | currentCursor
|
53677 | } = this;
|
53678 |
|
53679 | if (candidate !== null) {
|
53680 | this.clearMismatch(candidate);
|
53681 | }
|
53682 |
|
53683 | if (currentCursor && currentCursor.injectedOmittedNode) {
|
53684 | this.popElement();
|
53685 | }
|
53686 |
|
53687 | super.willCloseElement();
|
53688 | }
|
53689 |
|
53690 | getMarker(element, guid) {
|
53691 | var marker = element.querySelector(`script[glmr="${guid}"]`);
|
53692 |
|
53693 | if (marker) {
|
53694 | return marker;
|
53695 | }
|
53696 |
|
53697 | return null;
|
53698 | }
|
53699 |
|
53700 | __pushRemoteElement(element, cursorId, insertBefore) {
|
53701 | var marker = this.getMarker(element, cursorId);
|
53702 |
|
53703 | if (insertBefore === undefined) {
|
53704 | while (element.firstChild !== null && element.firstChild !== marker) {
|
53705 | this.remove(element.firstChild);
|
53706 | }
|
53707 |
|
53708 | insertBefore = null;
|
53709 | }
|
53710 |
|
53711 | var cursor = new RehydratingCursor(element, null, this.blockDepth);
|
53712 | this[CURSOR_STACK].push(cursor);
|
53713 |
|
53714 | if (marker === null) {
|
53715 | this.disableRehydration(insertBefore);
|
53716 | } else {
|
53717 | this.candidate = this.remove(marker);
|
53718 | }
|
53719 |
|
53720 | var block = new RemoteLiveBlock(element);
|
53721 | return this.pushLiveBlock(block, true);
|
53722 | }
|
53723 |
|
53724 | didAppendBounds(bounds) {
|
53725 | super.didAppendBounds(bounds);
|
53726 |
|
53727 | if (this.candidate) {
|
53728 | var last = bounds.lastNode();
|
53729 | this.candidate = last && last.nextSibling;
|
53730 | }
|
53731 |
|
53732 | return bounds;
|
53733 | }
|
53734 |
|
53735 | }
|
53736 |
|
53737 | _exports.RehydrateBuilder = RehydrateBuilder;
|
53738 |
|
53739 | function isTextNode(node) {
|
53740 | return node.nodeType === 3;
|
53741 | }
|
53742 |
|
53743 | function isComment(node) {
|
53744 | return node.nodeType === 8;
|
53745 | }
|
53746 |
|
53747 | function isOpenBlock(node) {
|
53748 | return node.nodeType === 8
|
53749 |
|
53750 | && node.nodeValue.lastIndexOf('%+b:', 0) === 0;
|
53751 | }
|
53752 |
|
53753 | function isCloseBlock(node) {
|
53754 | return node.nodeType === 8
|
53755 |
|
53756 | && node.nodeValue.lastIndexOf('%-b:', 0) === 0;
|
53757 | }
|
53758 |
|
53759 | function getBlockDepth(node) {
|
53760 | return parseInt(node.nodeValue.slice(4), 10);
|
53761 | }
|
53762 |
|
53763 | function isElement(node) {
|
53764 | return node.nodeType === 1;
|
53765 | }
|
53766 |
|
53767 | function isMarker(node) {
|
53768 | return node.nodeType === 8 && node.nodeValue === '%glmr%';
|
53769 | }
|
53770 |
|
53771 | function isSeparator(node) {
|
53772 | return node.nodeType === 8 && node.nodeValue === '%|%';
|
53773 | }
|
53774 |
|
53775 | function isEmpty$1(node) {
|
53776 | return node.nodeType === 8 && node.nodeValue === '% %';
|
53777 | }
|
53778 |
|
53779 | function isSameNodeType(candidate, tag) {
|
53780 | if (candidate.namespaceURI === "http://www.w3.org/2000/svg"
|
53781 |
|
53782 | ) {
|
53783 | return candidate.tagName === tag;
|
53784 | }
|
53785 |
|
53786 | return candidate.tagName === tag.toUpperCase();
|
53787 | }
|
53788 |
|
53789 | function findByName(array, name) {
|
53790 | for (var i = 0; i < array.length; i++) {
|
53791 | var attr = array[i];
|
53792 | if (attr.name === name) return attr;
|
53793 | }
|
53794 |
|
53795 | return undefined;
|
53796 | }
|
53797 |
|
53798 | function rehydrationBuilder(env, cursor) {
|
53799 | return RehydrateBuilder.forInitialRender(env, cursor);
|
53800 | }
|
53801 | });
|
53802 | define("@glimmer/util", ["exports"], function (_exports) {
|
53803 | "use strict";
|
53804 |
|
53805 | Object.defineProperty(_exports, "__esModule", {
|
53806 | value: true
|
53807 | });
|
53808 | _exports.assertNever = assertNever;
|
53809 | _exports.assert = debugAssert;
|
53810 | _exports.deprecate = deprecate;
|
53811 | _exports.dict = dict;
|
53812 | _exports.isDict = isDict;
|
53813 | _exports.isObject = isObject;
|
53814 | _exports.ensureGuid = ensureGuid;
|
53815 | _exports.initializeGuid = initializeGuid;
|
53816 | _exports.isSerializationFirstNode = isSerializationFirstNode;
|
53817 | _exports.assign = assign;
|
53818 | _exports.fillNulls = fillNulls;
|
53819 | _exports.values = values;
|
53820 | _exports.clearElement = clearElement;
|
53821 | _exports.keys = keys;
|
53822 | _exports.unwrap = unwrap;
|
53823 | _exports.expect = expect;
|
53824 | _exports.unreachable = unreachable;
|
53825 | _exports.exhausted = exhausted;
|
53826 | _exports.strip = strip;
|
53827 | _exports.isHandle = isHandle;
|
53828 | _exports.isNonPrimitiveHandle = isNonPrimitiveHandle;
|
53829 | _exports.constants = constants;
|
53830 | _exports.isSmallInt = isSmallInt;
|
53831 | _exports.encodeNegative = encodeNegative;
|
53832 | _exports.decodeNegative = decodeNegative;
|
53833 | _exports.encodePositive = encodePositive;
|
53834 | _exports.decodePositive = decodePositive;
|
53835 | _exports.encodeHandle = encodeHandle;
|
53836 | _exports.decodeHandle = decodeHandle;
|
53837 | _exports.encodeImmediate = encodeImmediate;
|
53838 | _exports.decodeImmediate = decodeImmediate;
|
53839 | _exports.unwrapHandle = unwrapHandle;
|
53840 | _exports.unwrapTemplate = unwrapTemplate;
|
53841 | _exports.extractHandle = extractHandle;
|
53842 | _exports.isOkHandle = isOkHandle;
|
53843 | _exports.isErrHandle = isErrHandle;
|
53844 | _exports.symbol = _exports.tuple = _exports.verifySteps = _exports.logStep = _exports.endTestSteps = _exports.beginTestSteps = _exports.debugToString = _exports.SERIALIZATION_FIRST_NODE_STRING = _exports.Stack = _exports.DictSet = _exports.EMPTY_ARRAY = void 0;
|
53845 | var EMPTY_ARRAY = Object.freeze([]);
|
53846 |
|
53847 |
|
53848 | _exports.EMPTY_ARRAY = EMPTY_ARRAY;
|
53849 |
|
53850 | function debugAssert(test, msg) {
|
53851 |
|
53852 |
|
53853 |
|
53854 |
|
53855 | if (!test) {
|
53856 | throw new Error(msg || 'assertion failure');
|
53857 | }
|
53858 | }
|
53859 |
|
53860 | function deprecate(desc) {
|
53861 | console.warn(`DEPRECATION: ${desc}`);
|
53862 | }
|
53863 |
|
53864 | var GUID = 0;
|
53865 |
|
53866 | function initializeGuid(object) {
|
53867 | return object._guid = ++GUID;
|
53868 | }
|
53869 |
|
53870 | function ensureGuid(object) {
|
53871 | return object._guid || initializeGuid(object);
|
53872 | }
|
53873 |
|
53874 | function dict() {
|
53875 | return Object.create(null);
|
53876 | }
|
53877 |
|
53878 | function isDict(u) {
|
53879 | return u !== null && u !== undefined;
|
53880 | }
|
53881 |
|
53882 | function isObject(u) {
|
53883 | return typeof u === 'object' && u !== null;
|
53884 | }
|
53885 |
|
53886 | class DictSet {
|
53887 | constructor() {
|
53888 | this.dict = dict();
|
53889 | }
|
53890 |
|
53891 | add(obj) {
|
53892 | if (typeof obj === 'string') this.dict[obj] = obj;else this.dict[ensureGuid(obj)] = obj;
|
53893 | return this;
|
53894 | }
|
53895 |
|
53896 | delete(obj) {
|
53897 | if (typeof obj === 'string') delete this.dict[obj];else if (obj._guid) delete this.dict[obj._guid];
|
53898 | }
|
53899 |
|
53900 | }
|
53901 |
|
53902 | _exports.DictSet = DictSet;
|
53903 |
|
53904 | class StackImpl {
|
53905 | constructor() {
|
53906 | this.stack = [];
|
53907 | this.current = null;
|
53908 | }
|
53909 |
|
53910 | get size() {
|
53911 | return this.stack.length;
|
53912 | }
|
53913 |
|
53914 | push(item) {
|
53915 | this.current = item;
|
53916 | this.stack.push(item);
|
53917 | }
|
53918 |
|
53919 | pop() {
|
53920 | var item = this.stack.pop();
|
53921 | var len = this.stack.length;
|
53922 | this.current = len === 0 ? null : this.stack[len - 1];
|
53923 | return item === undefined ? null : item;
|
53924 | }
|
53925 |
|
53926 | nth(from) {
|
53927 | var len = this.stack.length;
|
53928 | return len < from ? null : this.stack[len - from];
|
53929 | }
|
53930 |
|
53931 | isEmpty() {
|
53932 | return this.stack.length === 0;
|
53933 | }
|
53934 |
|
53935 | toArray() {
|
53936 | return this.stack;
|
53937 | }
|
53938 |
|
53939 | }
|
53940 |
|
53941 | _exports.Stack = StackImpl;
|
53942 |
|
53943 | function clearElement(parent) {
|
53944 | var current = parent.firstChild;
|
53945 |
|
53946 | while (current) {
|
53947 | var next = current.nextSibling;
|
53948 | parent.removeChild(current);
|
53949 | current = next;
|
53950 | }
|
53951 | }
|
53952 |
|
53953 | var SERIALIZATION_FIRST_NODE_STRING = '%+b:0%';
|
53954 | _exports.SERIALIZATION_FIRST_NODE_STRING = SERIALIZATION_FIRST_NODE_STRING;
|
53955 |
|
53956 | function isSerializationFirstNode(node) {
|
53957 | return node.nodeValue === SERIALIZATION_FIRST_NODE_STRING;
|
53958 | }
|
53959 |
|
53960 | var {
|
53961 | keys: objKeys
|
53962 | } = Object;
|
53963 |
|
53964 | function assign(obj) {
|
53965 | for (var i = 1; i < arguments.length; i++) {
|
53966 | var assignment = arguments[i];
|
53967 | if (assignment === null || typeof assignment !== 'object') continue;
|
53968 |
|
53969 | var _keys = objKeys(assignment);
|
53970 |
|
53971 | for (var j = 0; j < _keys.length; j++) {
|
53972 | var key = _keys[j];
|
53973 | obj[key] = assignment[key];
|
53974 | }
|
53975 | }
|
53976 |
|
53977 | return obj;
|
53978 | }
|
53979 |
|
53980 | function fillNulls(count) {
|
53981 | var arr = new Array(count);
|
53982 |
|
53983 | for (var i = 0; i < count; i++) {
|
53984 | arr[i] = null;
|
53985 | }
|
53986 |
|
53987 | return arr;
|
53988 | }
|
53989 |
|
53990 | function values(obj) {
|
53991 | var vals = [];
|
53992 |
|
53993 | for (var key in obj) {
|
53994 | vals.push(obj[key]);
|
53995 | }
|
53996 |
|
53997 | return vals;
|
53998 | }
|
53999 |
|
54000 | function keys(obj) {
|
54001 | return Object.keys(obj);
|
54002 | }
|
54003 |
|
54004 | function unwrap(val) {
|
54005 | if (val === null || val === undefined) throw new Error(`Expected value to be present`);
|
54006 | return val;
|
54007 | }
|
54008 |
|
54009 | function expect(val, message) {
|
54010 | if (val === null || val === undefined) throw new Error(message);
|
54011 | return val;
|
54012 | }
|
54013 |
|
54014 | function unreachable(message = 'unreachable') {
|
54015 | return new Error(message);
|
54016 | }
|
54017 |
|
54018 | function exhausted(value) {
|
54019 | throw new Error(`Exhausted ${value}`);
|
54020 | }
|
54021 |
|
54022 | var tuple = (...args) => args;
|
54023 |
|
54024 | _exports.tuple = tuple;
|
54025 | var symbol = typeof Symbol !== 'undefined' ? Symbol : key => `__${key}${Math.floor(Math.random() * Date.now())}__`;
|
54026 | _exports.symbol = symbol;
|
54027 |
|
54028 | function strip(strings, ...args) {
|
54029 | var out = '';
|
54030 |
|
54031 | for (var i = 0; i < strings.length; i++) {
|
54032 | var string = strings[i];
|
54033 | var dynamic = args[i] !== undefined ? String(args[i]) : '';
|
54034 | out += `${string}${dynamic}`;
|
54035 | }
|
54036 |
|
54037 | var lines = out.split('\n');
|
54038 |
|
54039 | while (lines.length && lines[0].match(/^\s*$/)) {
|
54040 | lines.shift();
|
54041 | }
|
54042 |
|
54043 | while (lines.length && lines[lines.length - 1].match(/^\s*$/)) {
|
54044 | lines.pop();
|
54045 | }
|
54046 |
|
54047 | var min = Infinity;
|
54048 |
|
54049 | for (var line of lines) {
|
54050 | var leading = line.match(/^\s*/)[0].length;
|
54051 | min = Math.min(min, leading);
|
54052 | }
|
54053 |
|
54054 | var stripped = [];
|
54055 |
|
54056 | for (var _line of lines) {
|
54057 | stripped.push(_line.slice(min));
|
54058 | }
|
54059 |
|
54060 | return stripped.join('\n');
|
54061 | }
|
54062 |
|
54063 | function isHandle(value) {
|
54064 | return value >= 0;
|
54065 | }
|
54066 |
|
54067 | function isNonPrimitiveHandle(value) {
|
54068 | return value > 3
|
54069 |
|
54070 | ;
|
54071 | }
|
54072 |
|
54073 | function constants(...values) {
|
54074 | return [false, true, null, undefined, ...values];
|
54075 | }
|
54076 |
|
54077 | function isSmallInt(value) {
|
54078 | return value % 1 === 0 && value <= 536870911
|
54079 |
|
54080 | && value >= -536870912
|
54081 |
|
54082 | ;
|
54083 | }
|
54084 |
|
54085 | function encodeNegative(num) {
|
54086 | return num & -536870913
|
54087 |
|
54088 | ;
|
54089 | }
|
54090 |
|
54091 | function decodeNegative(num) {
|
54092 | return num | ~-536870913
|
54093 |
|
54094 | ;
|
54095 | }
|
54096 |
|
54097 | function encodePositive(num) {
|
54098 | return ~num;
|
54099 | }
|
54100 |
|
54101 | function decodePositive(num) {
|
54102 | return ~num;
|
54103 | }
|
54104 |
|
54105 | function encodeHandle(num) {
|
54106 | return num;
|
54107 | }
|
54108 |
|
54109 | function decodeHandle(num) {
|
54110 | return num;
|
54111 | }
|
54112 |
|
54113 | function encodeImmediate(num) {
|
54114 | num |= 0;
|
54115 | return num < 0 ? encodeNegative(num) : encodePositive(num);
|
54116 | }
|
54117 |
|
54118 | function decodeImmediate(num) {
|
54119 | num |= 0;
|
54120 | return num > -536870913
|
54121 |
|
54122 | ? decodePositive(num) : decodeNegative(num);
|
54123 | }
|
54124 |
|
54125 |
|
54126 | [1, -1].forEach(x => decodeImmediate(encodeImmediate(x)));
|
54127 |
|
54128 | function unwrapHandle(handle) {
|
54129 | if (typeof handle === 'number') {
|
54130 | return handle;
|
54131 | } else {
|
54132 | var error = handle.errors[0];
|
54133 | throw new Error(`Compile Error: ${error.problem} @ ${error.span.start}..${error.span.end}`);
|
54134 | }
|
54135 | }
|
54136 |
|
54137 | function unwrapTemplate(template) {
|
54138 | if (template.result === 'error') {
|
54139 | throw new Error(`Compile Error: ${template.problem} @ ${template.span.start}..${template.span.end}`);
|
54140 | }
|
54141 |
|
54142 | return template;
|
54143 | }
|
54144 |
|
54145 | function extractHandle(handle) {
|
54146 | if (typeof handle === 'number') {
|
54147 | return handle;
|
54148 | } else {
|
54149 | return handle.handle;
|
54150 | }
|
54151 | }
|
54152 |
|
54153 | function isOkHandle(handle) {
|
54154 | return typeof handle === 'number';
|
54155 | }
|
54156 |
|
54157 | function isErrHandle(handle) {
|
54158 | return typeof handle === 'number';
|
54159 | }
|
54160 |
|
54161 | var debugToString;
|
54162 |
|
54163 | if (true
|
54164 |
|
54165 | ) {
|
54166 | var getFunctionName = fn => {
|
54167 | var functionName = fn.name;
|
54168 |
|
54169 | if (functionName === undefined) {
|
54170 | var match = Function.prototype.toString.call(fn).match(/function (\w+)\s*\(/);
|
54171 | functionName = match && match[1] || '';
|
54172 | }
|
54173 |
|
54174 | return functionName.replace(/^bound /, '');
|
54175 | };
|
54176 |
|
54177 | var getObjectName = obj => {
|
54178 | var name;
|
54179 | var className;
|
54180 |
|
54181 | if (obj.constructor && obj.constructor !== Object) {
|
54182 | className = getFunctionName(obj.constructor);
|
54183 | }
|
54184 |
|
54185 | if ('toString' in obj && obj.toString !== Object.prototype.toString && obj.toString !== Function.prototype.toString) {
|
54186 | name = obj.toString();
|
54187 | }
|
54188 |
|
54189 |
|
54190 |
|
54191 |
|
54192 |
|
54193 | if (name && name.match(/<.*:ember\d+>/) && className && className[0] !== '_' && className.length > 2 && className !== 'Class') {
|
54194 | return name.replace(/<.*:/, `<${className}:`);
|
54195 | }
|
54196 |
|
54197 | return name || className;
|
54198 | };
|
54199 |
|
54200 | var getPrimitiveName = value => {
|
54201 | return String(value);
|
54202 | };
|
54203 |
|
54204 | debugToString = value => {
|
54205 | if (typeof value === 'function') {
|
54206 | return getFunctionName(value) || `(unknown function)`;
|
54207 | } else if (typeof value === 'object' && value !== null) {
|
54208 | return getObjectName(value) || `(unknown object)`;
|
54209 | } else {
|
54210 | return getPrimitiveName(value);
|
54211 | }
|
54212 | };
|
54213 | }
|
54214 |
|
54215 | var debugToString$1 = debugToString;
|
54216 | _exports.debugToString = debugToString$1;
|
54217 | var beginTestSteps;
|
54218 | _exports.beginTestSteps = beginTestSteps;
|
54219 | var endTestSteps;
|
54220 | _exports.endTestSteps = endTestSteps;
|
54221 | var verifySteps;
|
54222 | _exports.verifySteps = verifySteps;
|
54223 | var logStep;
|
54224 | _exports.logStep = logStep;
|
54225 |
|
54226 | function assertNever(value, desc = 'unexpected unreachable branch') {
|
54227 | console.log('unreachable', value);
|
54228 | console.trace(`${desc} :: ${JSON.stringify(value)} (${value})`);
|
54229 | }
|
54230 | });
|
54231 | define("@glimmer/validator", ["exports", "@ember/polyfills"], function (_exports, _polyfills) {
|
54232 | "use strict";
|
54233 |
|
54234 | Object.defineProperty(_exports, "__esModule", {
|
54235 | value: true
|
54236 | });
|
54237 | _exports.bump = bump;
|
54238 | _exports.combine = combine;
|
54239 | _exports.createCombinatorTag = createCombinatorTag;
|
54240 | _exports.createTag = createTag;
|
54241 | _exports.createUpdatableTag = createUpdatableTag;
|
54242 | _exports.isConstTagged = isConstTagged;
|
54243 | _exports.isConstTag = isConstTag;
|
54244 | _exports.validateTag = validateTag;
|
54245 | _exports.valueForTag = valueForTag;
|
54246 | _exports.dirtyTagFor = dirtyTagFor;
|
54247 | _exports.tagFor = tagFor;
|
54248 | _exports.tagMetaFor = tagMetaFor;
|
54249 | _exports.setPropertyDidChange = setPropertyDidChange;
|
54250 | _exports.beginTrackFrame = beginTrackFrame;
|
54251 | _exports.endTrackFrame = endTrackFrame;
|
54252 | _exports.consumeTag = consumeTag;
|
54253 | _exports.isTracking = isTracking;
|
54254 | _exports.track = track;
|
54255 | _exports.memo = memo;
|
54256 | _exports.untrack = untrack;
|
54257 | _exports.isConstMemo = isConstMemo;
|
54258 | _exports.createCache = createCache;
|
54259 | _exports.isConst = isConst;
|
54260 | _exports.getValue = getValue;
|
54261 | _exports.trackedData = trackedData;
|
54262 | _exports.deprecateMutationsInAutotrackingTransaction = _exports.runInAutotrackingTransaction = _exports.setAutotrackingTransactionEnv = _exports.VOLATILE = _exports.VOLATILE_TAG = _exports.VolatileTag = _exports.updateTag = _exports.INITIAL = _exports.dirtyTag = _exports.CURRENT_TAG = _exports.CurrentTag = _exports.CONSTANT = _exports.CONSTANT_TAG = _exports.COMPUTE = _exports.ALLOW_CYCLES = void 0;
|
54263 |
|
54264 |
|
54265 |
|
54266 | var symbol = typeof Symbol !== 'undefined' ? Symbol : key => `__${key}${Math.floor(Math.random() * Date.now())}__`;
|
54267 | var symbolFor = typeof Symbol !== 'undefined' ? Symbol.for : key => `__GLIMMER_VALIDATOR_SYMBOL_FOR_${key}`;
|
54268 |
|
54269 | function getGlobal() {
|
54270 |
|
54271 | if (typeof globalThis !== 'undefined') return globalThis;
|
54272 | if (typeof self !== 'undefined') return self;
|
54273 | if (typeof window !== 'undefined') return window;
|
54274 | if (typeof global !== 'undefined') return global;
|
54275 | throw new Error('unable to locate global object');
|
54276 | }
|
54277 |
|
54278 | var runInAutotrackingTransaction;
|
54279 | _exports.runInAutotrackingTransaction = runInAutotrackingTransaction;
|
54280 | var deprecateMutationsInAutotrackingTransaction;
|
54281 | _exports.deprecateMutationsInAutotrackingTransaction = deprecateMutationsInAutotrackingTransaction;
|
54282 | var setAutotrackingTransactionEnv;
|
54283 | _exports.setAutotrackingTransactionEnv = setAutotrackingTransactionEnv;
|
54284 | var assertTagNotConsumed;
|
54285 | var markTagAsConsumed;
|
54286 |
|
54287 | if (true
|
54288 |
|
54289 | ) {
|
54290 | var DEPRECATE_IN_AUTOTRACKING_TRANSACTION = false;
|
54291 | var AUTOTRACKING_TRANSACTION = null;
|
54292 | var debuggingContexts = [];
|
54293 |
|
54294 | var TRANSACTION_ENV = {
|
54295 | assert(message) {
|
54296 | throw new Error(message);
|
54297 | },
|
54298 |
|
54299 | deprecate(message) {
|
54300 | console.warn(message);
|
54301 | },
|
54302 |
|
54303 | debugMessage(obj, keyName) {
|
54304 | var objName;
|
54305 |
|
54306 | if (typeof obj === 'function') {
|
54307 | objName = obj.name;
|
54308 | } else if (typeof obj === 'object' && obj !== null) {
|
54309 | var className = obj.constructor && obj.constructor.name || '(unknown class)';
|
54310 | objName = `(an instance of ${className})`;
|
54311 | } else if (obj === undefined) {
|
54312 | objName = '(an unknown tag)';
|
54313 | } else {
|
54314 | objName = String(obj);
|
54315 | }
|
54316 |
|
54317 | var dirtyString = keyName ? `\`${keyName}\` on \`${objName}\`` : `\`${objName}\``;
|
54318 | return `You attempted to update ${dirtyString}, but it had already been used previously in the same computation. Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.`;
|
54319 | }
|
54320 |
|
54321 | };
|
54322 |
|
54323 | _exports.setAutotrackingTransactionEnv = setAutotrackingTransactionEnv = env => (0, _polyfills.assign)(TRANSACTION_ENV, env);
|
54324 | |
54325 |
|
54326 |
|
54327 |
|
54328 |
|
54329 |
|
54330 |
|
54331 |
|
54332 |
|
54333 |
|
54334 |
|
54335 |
|
54336 | _exports.runInAutotrackingTransaction = runInAutotrackingTransaction = (fn, debuggingContext) => {
|
54337 | var previousDeprecateState = DEPRECATE_IN_AUTOTRACKING_TRANSACTION;
|
54338 | var previousTransactionState = AUTOTRACKING_TRANSACTION;
|
54339 | DEPRECATE_IN_AUTOTRACKING_TRANSACTION = false;
|
54340 |
|
54341 | if (previousTransactionState === null) {
|
54342 |
|
54343 | AUTOTRACKING_TRANSACTION = new WeakMap();
|
54344 | }
|
54345 |
|
54346 | if (debuggingContext) {
|
54347 | debuggingContexts.unshift(debuggingContext);
|
54348 | }
|
54349 |
|
54350 | try {
|
54351 | fn();
|
54352 | } finally {
|
54353 | if (debuggingContext) {
|
54354 | debuggingContexts.shift();
|
54355 | }
|
54356 |
|
54357 | DEPRECATE_IN_AUTOTRACKING_TRANSACTION = previousDeprecateState;
|
54358 | AUTOTRACKING_TRANSACTION = previousTransactionState;
|
54359 | }
|
54360 | };
|
54361 | |
54362 |
|
54363 |
|
54364 |
|
54365 |
|
54366 |
|
54367 |
|
54368 |
|
54369 |
|
54370 |
|
54371 |
|
54372 |
|
54373 |
|
54374 | _exports.deprecateMutationsInAutotrackingTransaction = deprecateMutationsInAutotrackingTransaction = fn => {
|
54375 | var previousDeprecateState = DEPRECATE_IN_AUTOTRACKING_TRANSACTION;
|
54376 | DEPRECATE_IN_AUTOTRACKING_TRANSACTION = true;
|
54377 |
|
54378 | try {
|
54379 | fn();
|
54380 | } finally {
|
54381 | DEPRECATE_IN_AUTOTRACKING_TRANSACTION = previousDeprecateState;
|
54382 | }
|
54383 | };
|
54384 |
|
54385 | var nthIndex = (str, pattern, n, startingPos = -1) => {
|
54386 | var i = startingPos;
|
54387 |
|
54388 | while (n-- > 0 && i++ < str.length) {
|
54389 | i = str.indexOf(pattern, i);
|
54390 | if (i < 0) break;
|
54391 | }
|
54392 |
|
54393 | return i;
|
54394 | };
|
54395 |
|
54396 | var makeAutotrackingErrorMessage = (sourceData, obj, keyName) => {
|
54397 | var message = [TRANSACTION_ENV.debugMessage(obj, keyName && String(keyName))];
|
54398 |
|
54399 | if (sourceData.context) {
|
54400 | message.push(`\`${String(keyName)}\` was first used:\n\n${sourceData.context}`);
|
54401 | }
|
54402 |
|
54403 | message.push(`Stack trace for the update:`);
|
54404 | return message.join('\n\n');
|
54405 | };
|
54406 |
|
54407 | markTagAsConsumed = _tag => {
|
54408 | if (!AUTOTRACKING_TRANSACTION || AUTOTRACKING_TRANSACTION.has(_tag)) return;
|
54409 | AUTOTRACKING_TRANSACTION.set(_tag, {
|
54410 | context: debuggingContexts.map(c => c.replace(/^/gm, ' ').replace(/^ /, '-')).join('\n\n')
|
54411 | }); // We need to mark the tag and all of its subtags as consumed, so we need to
|
54412 | // cast it and access its internals. In the future this shouldn't be necessary,
|
54413 | // this is only for computed properties.
|
54414 |
|
54415 | var tag = _tag;
|
54416 |
|
54417 | if (tag.subtag) {
|
54418 | markTagAsConsumed(tag.subtag);
|
54419 | }
|
54420 |
|
54421 | if (tag.subtags) {
|
54422 | tag.subtags.forEach(tag => markTagAsConsumed(tag));
|
54423 | }
|
54424 | };
|
54425 |
|
54426 | assertTagNotConsumed = (tag, obj, keyName, forceHardError = false) => {
|
54427 | if (AUTOTRACKING_TRANSACTION === null) return;
|
54428 | var sourceData = AUTOTRACKING_TRANSACTION.get(tag);
|
54429 | if (!sourceData) return;
|
54430 |
|
54431 | if (DEPRECATE_IN_AUTOTRACKING_TRANSACTION && !forceHardError) {
|
54432 | TRANSACTION_ENV.deprecate(makeAutotrackingErrorMessage(sourceData, obj, keyName));
|
54433 | } else {
|
54434 | // This hack makes the assertion message nicer, we can cut off the first
|
54435 | // few lines of the stack trace and let users know where the actual error
|
54436 | // occurred.
|
54437 | try {
|
54438 | TRANSACTION_ENV.assert(makeAutotrackingErrorMessage(sourceData, obj, keyName));
|
54439 | } catch (e) {
|
54440 | if (e.stack) {
|
54441 | var updateStackBegin = e.stack.indexOf('Stack trace for the update:');
|
54442 |
|
54443 | if (updateStackBegin !== -1) {
|
54444 | var start = nthIndex(e.stack, '\n', 1, updateStackBegin);
|
54445 | var end = nthIndex(e.stack, '\n', 4, updateStackBegin);
|
54446 | e.stack = e.stack.substr(0, start) + e.stack.substr(end);
|
54447 | }
|
54448 | }
|
54449 |
|
54450 | throw e;
|
54451 | }
|
54452 | }
|
54453 | };
|
54454 | }
|
54455 |
|
54456 | var CONSTANT = 0;
|
54457 | _exports.CONSTANT = CONSTANT;
|
54458 | var INITIAL = 1;
|
54459 | _exports.INITIAL = INITIAL;
|
54460 | var VOLATILE = NaN;
|
54461 | _exports.VOLATILE = VOLATILE;
|
54462 | var $REVISION = INITIAL;
|
54463 |
|
54464 | function bump() {
|
54465 | $REVISION++;
|
54466 | } //////////
|
54467 |
|
54468 |
|
54469 | var COMPUTE = symbol('TAG_COMPUTE'); //////////
|
54470 |
|
54471 | /**
|
54472 | * `value` receives a tag and returns an opaque Revision based on that tag. This
|
54473 | * snapshot can then later be passed to `validate` with the same tag to
|
54474 | * determine if the tag has changed at all since the time that `value` was
|
54475 | * called.
|
54476 | *
|
54477 | * @param tag
|
54478 | */
|
54479 |
|
54480 | _exports.COMPUTE = COMPUTE;
|
54481 |
|
54482 | function valueForTag(tag) {
|
54483 | return tag[COMPUTE]();
|
54484 | }
|
54485 | /**
|
54486 | * `validate` receives a tag and a snapshot from a previous call to `value` with
|
54487 | * the same tag, and determines if the tag is still valid compared to the
|
54488 | * snapshot. If the tag's state has changed at all since then, `validate` will
|
54489 | * return false, otherwise it will return true. This is used to determine if a
|
54490 | * calculation related to the tags should be rerun.
|
54491 | *
|
54492 | * @param tag
|
54493 | * @param snapshot
|
54494 | */
|
54495 |
|
54496 |
|
54497 | function validateTag(tag, snapshot) {
|
54498 | return snapshot >= tag[COMPUTE]();
|
54499 | }
|
54500 |
|
54501 | var TYPE = symbol('TAG_TYPE');
|
54502 | var ALLOW_CYCLES;
|
54503 | _exports.ALLOW_CYCLES = ALLOW_CYCLES;
|
54504 |
|
54505 | if (true
|
54506 | /* DEBUG */
|
54507 | ) {
|
54508 | _exports.ALLOW_CYCLES = ALLOW_CYCLES = new WeakMap();
|
54509 | }
|
54510 |
|
54511 | class MonomorphicTagImpl {
|
54512 | constructor(type) {
|
54513 | this.revision = INITIAL;
|
54514 | this.lastChecked = INITIAL;
|
54515 | this.lastValue = INITIAL;
|
54516 | this.isUpdating = false;
|
54517 | this.subtag = null;
|
54518 | this.subtagBufferCache = null;
|
54519 | this[TYPE] = type;
|
54520 | }
|
54521 |
|
54522 | [COMPUTE]() {
|
54523 | var {
|
54524 | lastChecked
|
54525 | } = this;
|
54526 |
|
54527 | if (this.isUpdating === true) {
|
54528 | if (true
|
54529 | /* DEBUG */
|
54530 | && !ALLOW_CYCLES.has(this)) {
|
54531 | throw new Error('Cycles in tags are not allowed');
|
54532 | }
|
54533 |
|
54534 | this.lastChecked = ++$REVISION;
|
54535 | } else if (lastChecked !== $REVISION) {
|
54536 | this.isUpdating = true;
|
54537 | this.lastChecked = $REVISION;
|
54538 |
|
54539 | try {
|
54540 | var {
|
54541 | subtag,
|
54542 | revision
|
54543 | } = this;
|
54544 |
|
54545 | if (subtag !== null) {
|
54546 | if (Array.isArray(subtag)) {
|
54547 | for (var i = 0; i < subtag.length; i++) {
|
54548 | var value = subtag[i][COMPUTE]();
|
54549 | revision = Math.max(value, revision);
|
54550 | }
|
54551 | } else {
|
54552 | var subtagValue = subtag[COMPUTE]();
|
54553 |
|
54554 | if (subtagValue === this.subtagBufferCache) {
|
54555 | revision = Math.max(revision, this.lastValue);
|
54556 | } else {
|
54557 | // Clear the temporary buffer cache
|
54558 | this.subtagBufferCache = null;
|
54559 | revision = Math.max(revision, subtagValue);
|
54560 | }
|
54561 | }
|
54562 | }
|
54563 |
|
54564 | this.lastValue = revision;
|
54565 | } finally {
|
54566 | this.isUpdating = false;
|
54567 | }
|
54568 | }
|
54569 |
|
54570 | return this.lastValue;
|
54571 | }
|
54572 |
|
54573 | static updateTag(_tag, _subtag) {
|
54574 | if (true
|
54575 | /* DEBUG */
|
54576 | && _tag[TYPE] !== 1
|
54577 | /* Updatable */
|
54578 | ) {
|
54579 | throw new Error('Attempted to update a tag that was not updatable');
|
54580 | } // TODO: TS 3.7 should allow us to do this via assertion
|
54581 |
|
54582 |
|
54583 | var tag = _tag;
|
54584 | var subtag = _subtag;
|
54585 |
|
54586 | if (subtag === CONSTANT_TAG) {
|
54587 | tag.subtag = null;
|
54588 | } else {
|
54589 | // There are two different possibilities when updating a subtag:
|
54590 | //
|
54591 | // 1. subtag[COMPUTE]() <= tag[COMPUTE]();
|
54592 | // 2. subtag[COMPUTE]() > tag[COMPUTE]();
|
54593 | //
|
54594 | // The first possibility is completely fine within our caching model, but
|
54595 | // the second possibility presents a problem. If the parent tag has
|
54596 | // already been read, then it's value is cached and will not update to
|
54597 | // reflect the subtag's greater value. Next time the cache is busted, the
|
54598 | // subtag's value _will_ be read, and it's value will be _greater_ than
|
54599 | // the saved snapshot of the parent, causing the resulting calculation to
|
54600 | // be rerun erroneously.
|
54601 | //
|
54602 | // In order to prevent this, when we first update to a new subtag we store
|
54603 | // its computed value, and then check against that computed value on
|
54604 | // subsequent updates. If its value hasn't changed, then we return the
|
54605 | // parent's previous value. Once the subtag changes for the first time,
|
54606 | // we clear the cache and everything is finally in sync with the parent.
|
54607 | tag.subtagBufferCache = subtag[COMPUTE]();
|
54608 | tag.subtag = subtag;
|
54609 | }
|
54610 | }
|
54611 |
|
54612 | static dirtyTag(tag) {
|
54613 | if (true
|
54614 | /* DEBUG */
|
54615 | && !(tag[TYPE] === 1
|
54616 | /* Updatable */
|
54617 | || tag[TYPE] === 0
|
54618 | /* Dirtyable */
|
54619 | )) {
|
54620 | throw new Error('Attempted to dirty a tag that was not dirtyable');
|
54621 | }
|
54622 |
|
54623 | if (true
|
54624 | /* DEBUG */
|
54625 | ) {
|
54626 | // Usually by this point, we've already asserted with better error information,
|
54627 | // but this is our last line of defense.
|
54628 | assertTagNotConsumed(tag);
|
54629 | }
|
54630 |
|
54631 | tag.revision = ++$REVISION;
|
54632 | }
|
54633 |
|
54634 | }
|
54635 |
|
54636 | var dirtyTag = MonomorphicTagImpl.dirtyTag;
|
54637 | _exports.dirtyTag = dirtyTag;
|
54638 | var updateTag = MonomorphicTagImpl.updateTag; //////////
|
54639 |
|
54640 | _exports.updateTag = updateTag;
|
54641 |
|
54642 | function createTag() {
|
54643 | return new MonomorphicTagImpl(0
|
54644 | /* Dirtyable */
|
54645 | );
|
54646 | }
|
54647 |
|
54648 | function createUpdatableTag() {
|
54649 | return new MonomorphicTagImpl(1
|
54650 | /* Updatable */
|
54651 | );
|
54652 | } //////////
|
54653 |
|
54654 |
|
54655 | var CONSTANT_TAG = new MonomorphicTagImpl(3
|
54656 | /* Constant */
|
54657 | );
|
54658 | _exports.CONSTANT_TAG = CONSTANT_TAG;
|
54659 |
|
54660 | function isConstTagged({
|
54661 | tag
|
54662 | }) {
|
54663 | return tag === CONSTANT_TAG;
|
54664 | }
|
54665 |
|
54666 | function isConstTag(tag) {
|
54667 | return tag === CONSTANT_TAG;
|
54668 | } //////////
|
54669 |
|
54670 |
|
54671 | class VolatileTag {
|
54672 | [COMPUTE]() {
|
54673 | return VOLATILE;
|
54674 | }
|
54675 |
|
54676 | }
|
54677 |
|
54678 | _exports.VolatileTag = VolatileTag;
|
54679 | var VOLATILE_TAG = new VolatileTag(); //////////
|
54680 |
|
54681 | _exports.VOLATILE_TAG = VOLATILE_TAG;
|
54682 |
|
54683 | class CurrentTag {
|
54684 | [COMPUTE]() {
|
54685 | return $REVISION;
|
54686 | }
|
54687 |
|
54688 | }
|
54689 |
|
54690 | _exports.CurrentTag = CurrentTag;
|
54691 | var CURRENT_TAG = new CurrentTag(); //////////
|
54692 |
|
54693 | _exports.CURRENT_TAG = CURRENT_TAG;
|
54694 |
|
54695 | function combine(tags) {
|
54696 | var optimized = [];
|
54697 |
|
54698 | for (var i = 0, l = tags.length; i < l; i++) {
|
54699 | var tag = tags[i];
|
54700 | if (tag === CONSTANT_TAG) continue;
|
54701 | optimized.push(tag);
|
54702 | }
|
54703 |
|
54704 | return createCombinatorTag(optimized);
|
54705 | }
|
54706 |
|
54707 | function createCombinatorTag(tags) {
|
54708 | switch (tags.length) {
|
54709 | case 0:
|
54710 | return CONSTANT_TAG;
|
54711 |
|
54712 | case 1:
|
54713 | return tags[0];
|
54714 |
|
54715 | default:
|
54716 | var tag = new MonomorphicTagImpl(2
|
54717 | /* Combinator */
|
54718 | );
|
54719 | tag.subtag = tags;
|
54720 | return tag;
|
54721 | }
|
54722 | } // Warm
|
54723 |
|
54724 |
|
54725 | var tag1 = createUpdatableTag();
|
54726 | var tag2 = createUpdatableTag();
|
54727 | var tag3 = createUpdatableTag();
|
54728 | valueForTag(tag1);
|
54729 | dirtyTag(tag1);
|
54730 | valueForTag(tag1);
|
54731 | updateTag(tag1, combine([tag2, tag3]));
|
54732 | valueForTag(tag1);
|
54733 | dirtyTag(tag2);
|
54734 | valueForTag(tag1);
|
54735 | dirtyTag(tag3);
|
54736 | valueForTag(tag1);
|
54737 | updateTag(tag1, tag3);
|
54738 | valueForTag(tag1);
|
54739 | dirtyTag(tag3);
|
54740 | valueForTag(tag1);
|
54741 |
|
54742 | var propertyDidChange = function () {};
|
54743 |
|
54744 | function setPropertyDidChange(cb) {
|
54745 | propertyDidChange = cb;
|
54746 | }
|
54747 |
|
54748 | function isObjectLike(u) {
|
54749 | return typeof u === 'object' && u !== null || typeof u === 'function';
|
54750 | }
|
54751 |
|
54752 | var TRACKED_TAGS = new WeakMap();
|
54753 |
|
54754 | function dirtyTagFor(obj, key) {
|
54755 | if (true
|
54756 | /* DEBUG */
|
54757 | && !isObjectLike(obj)) {
|
54758 | throw new Error(`BUG: Can't update a tag for a primitive`);
|
54759 | }
|
54760 |
|
54761 | var tags = TRACKED_TAGS.get(obj); // No tags have been setup for this object yet, return
|
54762 |
|
54763 | if (tags === undefined) return; // Dirty the tag for the specific property if it exists
|
54764 |
|
54765 | var propertyTag = tags.get(key);
|
54766 |
|
54767 | if (propertyTag !== undefined) {
|
54768 | if (true
|
54769 | /* DEBUG */
|
54770 | ) {
|
54771 | assertTagNotConsumed(propertyTag, obj, key);
|
54772 | }
|
54773 |
|
54774 | dirtyTag(propertyTag);
|
54775 | propertyDidChange();
|
54776 | }
|
54777 | }
|
54778 |
|
54779 | function tagMetaFor(obj) {
|
54780 | var tags = TRACKED_TAGS.get(obj);
|
54781 |
|
54782 | if (tags === undefined) {
|
54783 | tags = new Map();
|
54784 | TRACKED_TAGS.set(obj, tags);
|
54785 | }
|
54786 |
|
54787 | return tags;
|
54788 | }
|
54789 |
|
54790 | function tagFor(obj, key, meta) {
|
54791 | var tags = meta === undefined ? tagMetaFor(obj) : meta;
|
54792 | var tag = tags.get(key);
|
54793 |
|
54794 | if (tag === undefined) {
|
54795 | tag = createUpdatableTag();
|
54796 | tags.set(key, tag);
|
54797 | }
|
54798 |
|
54799 | return tag;
|
54800 | }
|
54801 | /**
|
54802 | * An object that that tracks @tracked properties that were consumed.
|
54803 | */
|
54804 |
|
54805 |
|
54806 | class Tracker {
|
54807 | constructor() {
|
54808 | this.tags = new Set();
|
54809 | this.last = null;
|
54810 | }
|
54811 |
|
54812 | add(tag) {
|
54813 | this.tags.add(tag);
|
54814 |
|
54815 | if (true
|
54816 | /* DEBUG */
|
54817 | ) {
|
54818 | markTagAsConsumed(tag);
|
54819 | }
|
54820 |
|
54821 | this.last = tag;
|
54822 | }
|
54823 |
|
54824 | combine() {
|
54825 | var {
|
54826 | tags
|
54827 | } = this;
|
54828 |
|
54829 | if (tags.size === 0) {
|
54830 | return CONSTANT_TAG;
|
54831 | } else if (tags.size === 1) {
|
54832 | return this.last;
|
54833 | } else {
|
54834 | var tagsArr = [];
|
54835 | tags.forEach(tag => tagsArr.push(tag));
|
54836 | return combine(tagsArr);
|
54837 | }
|
54838 | }
|
54839 |
|
54840 | }
|
54841 | /**
|
54842 | * Whenever a tracked computed property is entered, the current tracker is
|
54843 | * saved off and a new tracker is replaced.
|
54844 | *
|
54845 | * Any tracked properties consumed are added to the current tracker.
|
54846 | *
|
54847 | * When a tracked computed property is exited, the tracker's tags are
|
54848 | * combined and added to the parent tracker.
|
54849 | *
|
54850 | * The consequence is that each tracked computed property has a tag
|
54851 | * that corresponds to the tracked properties consumed inside of
|
54852 | * itself, including child tracked computed properties.
|
54853 | */
|
54854 |
|
54855 |
|
54856 | var CURRENT_TRACKER = null;
|
54857 | var OPEN_TRACK_FRAMES = [];
|
54858 |
|
54859 | function beginTrackFrame() {
|
54860 | OPEN_TRACK_FRAMES.push(CURRENT_TRACKER);
|
54861 | CURRENT_TRACKER = new Tracker();
|
54862 | }
|
54863 |
|
54864 | function endTrackFrame() {
|
54865 | var current = CURRENT_TRACKER;
|
54866 |
|
54867 | if (true
|
54868 | /* DEBUG */
|
54869 | && OPEN_TRACK_FRAMES.length === 0) {
|
54870 | throw new Error('attempted to close a tracking frame, but one was not open');
|
54871 | }
|
54872 |
|
54873 | CURRENT_TRACKER = OPEN_TRACK_FRAMES.pop();
|
54874 | return current.combine();
|
54875 | }
|
54876 |
|
54877 | function isTracking() {
|
54878 | return CURRENT_TRACKER !== null;
|
54879 | }
|
54880 |
|
54881 | function consumeTag(tag) {
|
54882 | if (CURRENT_TRACKER !== null) {
|
54883 | CURRENT_TRACKER.add(tag);
|
54884 | }
|
54885 | } //////////
|
54886 |
|
54887 |
|
54888 | var CACHE_KEY = symbol('CACHE_KEY');
|
54889 |
|
54890 | function memo(callback, debuggingContext) {
|
54891 | var cache = createCache(callback, debuggingContext);
|
54892 |
|
54893 | var memoized = () => getValue(cache);
|
54894 |
|
54895 | memoized[CACHE_KEY] = cache;
|
54896 | return memoized;
|
54897 | }
|
54898 |
|
54899 | function isConstMemo(fn) {
|
54900 | return isMemo(fn) ? isConst(fn[CACHE_KEY]) : false;
|
54901 | }
|
54902 |
|
54903 | function isMemo(fn) {
|
54904 | return CACHE_KEY in fn;
|
54905 | }
|
54906 |
|
54907 | var FN = symbol('FN');
|
54908 | var LAST_VALUE = symbol('LAST_VALUE');
|
54909 | var TAG = symbol('TAG');
|
54910 | var SNAPSHOT = symbol('SNAPSHOT');
|
54911 | var DEBUG_LABEL = symbol('DEBUG_LABEL');
|
54912 |
|
54913 | function createCache(fn, debuggingLabel) {
|
54914 | if (true
|
54915 | /* DEBUG */
|
54916 | && !(typeof fn === 'function')) {
|
54917 | throw new Error(`createCache() must be passed a function as its first parameter. Called with: ${String(fn)}`);
|
54918 | }
|
54919 |
|
54920 | var cache = {
|
54921 | [FN]: fn,
|
54922 | [LAST_VALUE]: undefined,
|
54923 | [TAG]: undefined,
|
54924 | [SNAPSHOT]: -1
|
54925 | };
|
54926 |
|
54927 | if (true
|
54928 | /* DEBUG */
|
54929 | ) {
|
54930 | cache[DEBUG_LABEL] = debuggingLabel;
|
54931 | }
|
54932 |
|
54933 | return cache;
|
54934 | }
|
54935 |
|
54936 | function getValue(cache) {
|
54937 | assertCache(cache, 'getValue');
|
54938 | var fn = cache[FN];
|
54939 | var tag = cache[TAG];
|
54940 | var snapshot = cache[SNAPSHOT];
|
54941 |
|
54942 | if (tag === undefined || !validateTag(tag, snapshot)) {
|
54943 | beginTrackFrame();
|
54944 |
|
54945 | try {
|
54946 | if (true
|
54947 | /* DEBUG */
|
54948 | ) {
|
54949 | runInAutotrackingTransaction(() => cache[LAST_VALUE] = fn(), cache[DEBUG_LABEL]);
|
54950 | } else {
|
54951 | cache[LAST_VALUE] = fn();
|
54952 | }
|
54953 | } finally {
|
54954 | tag = endTrackFrame();
|
54955 | cache[TAG] = tag;
|
54956 | cache[SNAPSHOT] = valueForTag(tag);
|
54957 | consumeTag(tag);
|
54958 | }
|
54959 | } else {
|
54960 | consumeTag(tag);
|
54961 | }
|
54962 |
|
54963 | return cache[LAST_VALUE];
|
54964 | }
|
54965 |
|
54966 | function isConst(cache) {
|
54967 | assertCache(cache, 'isConst');
|
54968 | var tag = cache[TAG];
|
54969 | assertTag(tag, cache);
|
54970 | return isConstTag(tag);
|
54971 | }
|
54972 |
|
54973 | function assertCache(value, fnName) {
|
54974 | if (true
|
54975 | /* DEBUG */
|
54976 | && !(typeof value === 'object' && value !== null && FN in value)) {
|
54977 | throw new Error(`${fnName}() can only be used on an instance of a cache created with createCache(). Called with: ${String(value)}`);
|
54978 | }
|
54979 | } // replace this with `expect` when we can
|
54980 |
|
54981 |
|
54982 | function assertTag(tag, cache) {
|
54983 | if (true
|
54984 | /* DEBUG */
|
54985 | && tag === undefined) {
|
54986 | throw new Error(`isConst() can only be used on a cache once getValue() has been called at least once. Called with cache function:\n\n${String(cache[FN])}`);
|
54987 | }
|
54988 | } //////////
|
54989 | // Legacy tracking APIs
|
54990 | // track() shouldn't be necessary at all in the VM once the autotracking
|
54991 | // refactors are merged, and we should generally be moving away from it. It may
|
54992 | // be necessary in Ember for a while longer, but I think we'll be able to drop
|
54993 | // it in favor of cache sooner rather than later.
|
54994 |
|
54995 |
|
54996 | function track(callback, debuggingContext) {
|
54997 | beginTrackFrame();
|
54998 | var tag;
|
54999 |
|
55000 | try {
|
55001 | if (true
|
55002 | /* DEBUG */
|
55003 | ) {
|
55004 | runInAutotrackingTransaction(callback, debuggingContext);
|
55005 | } else {
|
55006 | callback();
|
55007 | }
|
55008 | } finally {
|
55009 | tag = endTrackFrame();
|
55010 | }
|
55011 |
|
55012 | return tag;
|
55013 | } // untrack() is currently mainly used to handle places that were previously not
|
55014 | // tracked, and that tracking now would cause backtracking rerender assertions.
|
55015 | // I think once we move everyone forward onto modern APIs, we'll probably be
|
55016 | // able to remove it, but I'm not sure yet.
|
55017 |
|
55018 |
|
55019 | function untrack(callback) {
|
55020 | OPEN_TRACK_FRAMES.push(CURRENT_TRACKER);
|
55021 | CURRENT_TRACKER = null;
|
55022 |
|
55023 | try {
|
55024 | callback();
|
55025 | } finally {
|
55026 | CURRENT_TRACKER = OPEN_TRACK_FRAMES.pop();
|
55027 | }
|
55028 | }
|
55029 |
|
55030 | function trackedData(key, initializer) {
|
55031 | var values = new WeakMap();
|
55032 | var hasInitializer = typeof initializer === 'function';
|
55033 |
|
55034 | function getter(self) {
|
55035 | consumeTag(tagFor(self, key));
|
55036 | var value; // If the field has never been initialized, we should initialize it
|
55037 |
|
55038 | if (hasInitializer && !values.has(self)) {
|
55039 | value = initializer.call(self);
|
55040 | values.set(self, value);
|
55041 | } else {
|
55042 | value = values.get(self);
|
55043 | }
|
55044 |
|
55045 | return value;
|
55046 | }
|
55047 |
|
55048 | function setter(self, value) {
|
55049 | if (true
|
55050 | /* DEBUG */
|
55051 | ) {
|
55052 | assertTagNotConsumed(tagFor(self, key), self, key, true);
|
55053 | }
|
55054 |
|
55055 | dirtyTagFor(self, key);
|
55056 | values.set(self, value);
|
55057 | }
|
55058 |
|
55059 | return {
|
55060 | getter,
|
55061 | setter
|
55062 | };
|
55063 | }
|
55064 |
|
55065 | var globalObj = getGlobal();
|
55066 | var GLIMMER_VALIDATOR_REGISTRATION = symbolFor('GLIMMER_VALIDATOR_REGISTRATION');
|
55067 |
|
55068 | if (globalObj[GLIMMER_VALIDATOR_REGISTRATION] === true) {
|
55069 | throw new Error('The `@glimmer/validator` library has been included twice in this application. It could be different versions of the package, or the same version included twice by mistake. `@glimmer/validator` depends on having a single copy of the package in use at any time in an application, even if they are the same version. You must dedupe your build to remove the duplicate packages in order to prevent this error.');
|
55070 | }
|
55071 |
|
55072 | globalObj[GLIMMER_VALIDATOR_REGISTRATION] = true;
|
55073 | });
|
55074 | define("@glimmer/vm", ["exports"], function (_exports) {
|
55075 | "use strict";
|
55076 |
|
55077 | Object.defineProperty(_exports, "__esModule", {
|
55078 | value: true
|
55079 | });
|
55080 | _exports.isMachineOp = isMachineOp;
|
55081 | _exports.isOp = isOp;
|
55082 | _exports.isLowLevelRegister = isLowLevelRegister;
|
55083 | _exports.$v0 = _exports.$t1 = _exports.$t0 = _exports.$s1 = _exports.$s0 = _exports.$sp = _exports.$ra = _exports.$fp = _exports.$pc = _exports.TemporaryRegister = _exports.SavedRegister = void 0;
|
55084 |
|
55085 | /* This file is generated by build/debug.js */
|
55086 | function isMachineOp(value) {
|
55087 | return value >= 0 && value <= 15;
|
55088 | }
|
55089 |
|
55090 | function isOp(value) {
|
55091 | return value >= 16;
|
55092 | }
|
55093 | /**
|
55094 | * Registers
|
55095 | *
|
55096 | * For the most part, these follows MIPS naming conventions, however the
|
55097 | * register numbers are different.
|
55098 | */
|
55099 | // $0 or $pc (program counter): pointer into `program` for the next insturction; -1 means exit
|
55100 |
|
55101 |
|
55102 | var $pc = 0; // $1 or $ra (return address): pointer into `program` for the return
|
55103 |
|
55104 | _exports.$pc = $pc;
|
55105 | var $ra = 1; // $2 or $fp (frame pointer): pointer into the `evalStack` for the base of the stack
|
55106 |
|
55107 | _exports.$ra = $ra;
|
55108 | var $fp = 2; // $3 or $sp (stack pointer): pointer into the `evalStack` for the top of the stack
|
55109 |
|
55110 | _exports.$fp = $fp;
|
55111 | var $sp = 3; // $4-$5 or $s0-$s1 (saved): callee saved general-purpose registers
|
55112 |
|
55113 | _exports.$sp = $sp;
|
55114 | var $s0 = 4;
|
55115 | _exports.$s0 = $s0;
|
55116 | var $s1 = 5; // $6-$7 or $t0-$t1 (temporaries): caller saved general-purpose registers
|
55117 |
|
55118 | _exports.$s1 = $s1;
|
55119 | var $t0 = 6;
|
55120 | _exports.$t0 = $t0;
|
55121 | var $t1 = 7; // $8 or $v0 (return value)
|
55122 |
|
55123 | _exports.$t1 = $t1;
|
55124 | var $v0 = 8;
|
55125 | _exports.$v0 = $v0;
|
55126 |
|
55127 | function isLowLevelRegister(register) {
|
55128 | return register <= $sp;
|
55129 | }
|
55130 |
|
55131 | var SavedRegister;
|
55132 | _exports.SavedRegister = SavedRegister;
|
55133 |
|
55134 | (function (SavedRegister) {
|
55135 | SavedRegister[SavedRegister["s0"] = 4] = "s0";
|
55136 | SavedRegister[SavedRegister["s1"] = 5] = "s1";
|
55137 | })(SavedRegister || (_exports.SavedRegister = SavedRegister = {}));
|
55138 |
|
55139 | var TemporaryRegister;
|
55140 | _exports.TemporaryRegister = TemporaryRegister;
|
55141 |
|
55142 | (function (TemporaryRegister) {
|
55143 | TemporaryRegister[TemporaryRegister["t0"] = 6] = "t0";
|
55144 | TemporaryRegister[TemporaryRegister["t1"] = 7] = "t1";
|
55145 | })(TemporaryRegister || (_exports.TemporaryRegister = TemporaryRegister = {}));
|
55146 | });
|
55147 | define("@glimmer/wire-format", ["exports"], function (_exports) {
|
55148 | "use strict";
|
55149 |
|
55150 | Object.defineProperty(_exports, "__esModule", {
|
55151 | value: true
|
55152 | });
|
55153 | _exports.is = is;
|
55154 | _exports.isAttribute = isAttribute;
|
55155 | _exports.isArgument = isArgument;
|
55156 | _exports.isHelper = isHelper;
|
55157 | _exports.isGet = _exports.isFlushElement = void 0;
|
55158 |
|
55159 | function is(variant) {
|
55160 | return function (value) {
|
55161 | return Array.isArray(value) && value[0] === variant;
|
55162 | };
|
55163 | } // Statements
|
55164 |
|
55165 |
|
55166 | var isFlushElement = is(12
|
55167 | /* FlushElement */
|
55168 | );
|
55169 | _exports.isFlushElement = isFlushElement;
|
55170 |
|
55171 | function isAttribute(val) {
|
55172 | return val[0] === 14
|
55173 | /* StaticAttr */
|
55174 | || val[0] === 15
|
55175 | /* DynamicAttr */
|
55176 | || val[0] === 22
|
55177 | /* TrustingDynamicAttr */
|
55178 | || val[0] === 16
|
55179 | /* ComponentAttr */
|
55180 | || val[0] === 24
|
55181 | /* StaticComponentAttr */
|
55182 | || val[0] === 23
|
55183 | /* TrustingComponentAttr */
|
55184 | || val[0] === 17
|
55185 | /* AttrSplat */
|
55186 | || val[0] === 4
|
55187 | /* Modifier */
|
55188 | ;
|
55189 | }
|
55190 |
|
55191 | function isArgument(val) {
|
55192 | return val[0] === 21
|
55193 | /* StaticArg */
|
55194 | || val[0] === 20
|
55195 | /* DynamicArg */
|
55196 | ;
|
55197 | }
|
55198 |
|
55199 | function isHelper(expr) {
|
55200 | return Array.isArray(expr) && expr[0] === 30
|
55201 | /* Call */
|
55202 | ;
|
55203 | } // Expressions
|
55204 |
|
55205 |
|
55206 | var isGet = is(32
|
55207 | /* GetSymbol */
|
55208 | );
|
55209 | _exports.isGet = isGet;
|
55210 | });
|
55211 | define("@simple-dom/document", ["exports"], function (_exports) {
|
55212 | "use strict";
|
55213 |
|
55214 | Object.defineProperty(_exports, "__esModule", {
|
55215 | value: true
|
55216 | });
|
55217 | _exports.default = void 0;
|
55218 | var EMPTY_ATTRS = [];
|
55219 |
|
55220 | function indexOfAttribute(attributes, namespaceURI, localName) {
|
55221 | for (var i = 0; i < attributes.length; i++) {
|
55222 | var attr = attributes[i];
|
55223 |
|
55224 | if (attr.namespaceURI === namespaceURI && attr.localName === localName) {
|
55225 | return i;
|
55226 | }
|
55227 | }
|
55228 |
|
55229 | return -1;
|
55230 | }
|
55231 |
|
55232 | function adjustAttrName(namespaceURI, localName) {
|
55233 | return namespaceURI === "http://www.w3.org/1999/xhtml"
|
55234 | /* HTML */
|
55235 | ? localName.toLowerCase() : localName;
|
55236 | }
|
55237 |
|
55238 | function getAttribute(attributes, namespaceURI, localName) {
|
55239 | var index = indexOfAttribute(attributes, namespaceURI, localName);
|
55240 | return index === -1 ? null : attributes[index].value;
|
55241 | }
|
55242 |
|
55243 | function removeAttribute(attributes, namespaceURI, localName) {
|
55244 | var index = indexOfAttribute(attributes, namespaceURI, localName);
|
55245 |
|
55246 | if (index !== -1) {
|
55247 | attributes.splice(index, 1);
|
55248 | }
|
55249 | } // https://dom.spec.whatwg.org/#dom-element-setattributens
|
55250 |
|
55251 |
|
55252 | function setAttribute(element, namespaceURI, prefix, localName, value) {
|
55253 | if (typeof value !== 'string') {
|
55254 | value = '' + value;
|
55255 | }
|
55256 |
|
55257 | var {
|
55258 | attributes
|
55259 | } = element;
|
55260 |
|
55261 | if (attributes === EMPTY_ATTRS) {
|
55262 | attributes = element.attributes = [];
|
55263 | } else {
|
55264 | var index = indexOfAttribute(attributes, namespaceURI, localName);
|
55265 |
|
55266 | if (index !== -1) {
|
55267 | attributes[index].value = value;
|
55268 | return;
|
55269 | }
|
55270 | }
|
55271 |
|
55272 | attributes.push({
|
55273 | localName,
|
55274 | name: prefix === null ? localName : prefix + ':' + localName,
|
55275 | namespaceURI,
|
55276 | prefix,
|
55277 | specified: true,
|
55278 | value
|
55279 | });
|
55280 | }
|
55281 |
|
55282 | class ChildNodes {
|
55283 | constructor(node) {
|
55284 | this.node = node;
|
55285 | this.stale = true;
|
55286 | this._length = 0;
|
55287 | }
|
55288 |
|
55289 | get length() {
|
55290 | if (this.stale) {
|
55291 | this.stale = false;
|
55292 | var len = 0;
|
55293 | var child = this.node.firstChild;
|
55294 |
|
55295 | for (; child !== null; len++) {
|
55296 | this[len] = child;
|
55297 | child = child.nextSibling;
|
55298 | }
|
55299 |
|
55300 | var oldLen = this._length;
|
55301 | this._length = len;
|
55302 |
|
55303 | for (; len < oldLen; len++) {
|
55304 | delete this[len];
|
55305 | }
|
55306 | }
|
55307 |
|
55308 | return this._length;
|
55309 | }
|
55310 |
|
55311 | item(index) {
|
55312 | return index < this.length ? this[index] : null;
|
55313 | }
|
55314 |
|
55315 | }
|
55316 |
|
55317 | function cloneNode(node, deep) {
|
55318 | var clone = nodeFrom(node);
|
55319 |
|
55320 | if (deep) {
|
55321 | var child = node.firstChild;
|
55322 | var nextChild = child;
|
55323 |
|
55324 | while (child !== null) {
|
55325 | nextChild = child.nextSibling;
|
55326 | clone.appendChild(child.cloneNode(true));
|
55327 | child = nextChild;
|
55328 | }
|
55329 | }
|
55330 |
|
55331 | return clone;
|
55332 | }
|
55333 |
|
55334 | function nodeFrom(node) {
|
55335 | var namespaceURI;
|
55336 |
|
55337 | if (node.nodeType === 1
|
55338 | /* ELEMENT_NODE */
|
55339 | ) {
|
55340 | namespaceURI = node.namespaceURI;
|
55341 | }
|
55342 |
|
55343 | var clone = new SimpleNodeImpl(node.ownerDocument, node.nodeType, node.nodeName, node.nodeValue, namespaceURI);
|
55344 |
|
55345 | if (node.nodeType === 1
|
55346 | /* ELEMENT_NODE */
|
55347 | ) {
|
55348 | clone.attributes = copyAttrs(node.attributes);
|
55349 | }
|
55350 |
|
55351 | return clone;
|
55352 | }
|
55353 |
|
55354 | function copyAttrs(attrs) {
|
55355 | if (attrs === EMPTY_ATTRS) {
|
55356 | return EMPTY_ATTRS;
|
55357 | }
|
55358 |
|
55359 | var copy = [];
|
55360 |
|
55361 | for (var i = 0; i < attrs.length; i++) {
|
55362 | var attr = attrs[i];
|
55363 | copy.push({
|
55364 | localName: attr.localName,
|
55365 | name: attr.name,
|
55366 | namespaceURI: attr.namespaceURI,
|
55367 | prefix: attr.prefix,
|
55368 | specified: true,
|
55369 | value: attr.value
|
55370 | });
|
55371 | }
|
55372 |
|
55373 | return copy;
|
55374 | }
|
55375 |
|
55376 | function insertBefore(parentNode, newChild, refChild) {
|
55377 | invalidate(parentNode);
|
55378 | insertBetween(parentNode, newChild, refChild === null ? parentNode.lastChild : refChild.previousSibling, refChild);
|
55379 | }
|
55380 |
|
55381 | function removeChild(parentNode, oldChild) {
|
55382 | invalidate(parentNode);
|
55383 | removeBetween(parentNode, oldChild, oldChild.previousSibling, oldChild.nextSibling);
|
55384 | }
|
55385 |
|
55386 | function invalidate(parentNode) {
|
55387 | var childNodes = parentNode._childNodes;
|
55388 |
|
55389 | if (childNodes !== undefined) {
|
55390 | childNodes.stale = true;
|
55391 | }
|
55392 | }
|
55393 |
|
55394 | function insertBetween(parentNode, newChild, previousSibling, nextSibling) {
|
55395 | if (newChild.nodeType === 11
|
55396 | /* DOCUMENT_FRAGMENT_NODE */
|
55397 | ) {
|
55398 | insertFragment(newChild, parentNode, previousSibling, nextSibling);
|
55399 | return;
|
55400 | }
|
55401 |
|
55402 | if (newChild.parentNode !== null) {
|
55403 | removeChild(newChild.parentNode, newChild);
|
55404 | }
|
55405 |
|
55406 | newChild.parentNode = parentNode;
|
55407 | newChild.previousSibling = previousSibling;
|
55408 | newChild.nextSibling = nextSibling;
|
55409 |
|
55410 | if (previousSibling === null) {
|
55411 | parentNode.firstChild = newChild;
|
55412 | } else {
|
55413 | previousSibling.nextSibling = newChild;
|
55414 | }
|
55415 |
|
55416 | if (nextSibling === null) {
|
55417 | parentNode.lastChild = newChild;
|
55418 | } else {
|
55419 | nextSibling.previousSibling = newChild;
|
55420 | }
|
55421 | }
|
55422 |
|
55423 | function removeBetween(parentNode, oldChild, previousSibling, nextSibling) {
|
55424 | oldChild.parentNode = null;
|
55425 | oldChild.previousSibling = null;
|
55426 | oldChild.nextSibling = null;
|
55427 |
|
55428 | if (previousSibling === null) {
|
55429 | parentNode.firstChild = nextSibling;
|
55430 | } else {
|
55431 | previousSibling.nextSibling = nextSibling;
|
55432 | }
|
55433 |
|
55434 | if (nextSibling === null) {
|
55435 | parentNode.lastChild = previousSibling;
|
55436 | } else {
|
55437 | nextSibling.previousSibling = previousSibling;
|
55438 | }
|
55439 | }
|
55440 |
|
55441 | function insertFragment(fragment, parentNode, previousSibling, nextSibling) {
|
55442 | var firstChild = fragment.firstChild;
|
55443 |
|
55444 | if (firstChild === null) {
|
55445 | return;
|
55446 | }
|
55447 |
|
55448 | fragment.firstChild = null;
|
55449 | fragment.lastChild = null;
|
55450 | var lastChild = firstChild;
|
55451 | var newChild = firstChild;
|
55452 | firstChild.previousSibling = previousSibling;
|
55453 |
|
55454 | if (previousSibling === null) {
|
55455 | parentNode.firstChild = firstChild;
|
55456 | } else {
|
55457 | previousSibling.nextSibling = firstChild;
|
55458 | }
|
55459 |
|
55460 | while (newChild !== null) {
|
55461 | newChild.parentNode = parentNode;
|
55462 | lastChild = newChild;
|
55463 | newChild = newChild.nextSibling;
|
55464 | }
|
55465 |
|
55466 | lastChild.nextSibling = nextSibling;
|
55467 |
|
55468 | if (nextSibling === null) {
|
55469 | parentNode.lastChild = lastChild;
|
55470 | } else {
|
55471 | nextSibling.previousSibling = lastChild;
|
55472 | }
|
55473 | }
|
55474 |
|
55475 | function parseQualifiedName(qualifiedName) {
|
55476 | var localName = qualifiedName;
|
55477 | var prefix = null;
|
55478 | var i = qualifiedName.indexOf(':');
|
55479 |
|
55480 | if (i !== -1) {
|
55481 | prefix = qualifiedName.slice(0, i);
|
55482 | localName = qualifiedName.slice(i + 1);
|
55483 | }
|
55484 |
|
55485 | return [prefix, localName];
|
55486 | }
|
55487 |
|
55488 | class SimpleNodeImpl {
|
55489 | constructor(ownerDocument, nodeType, nodeName, nodeValue, namespaceURI) {
|
55490 | this.ownerDocument = ownerDocument;
|
55491 | this.nodeType = nodeType;
|
55492 | this.nodeName = nodeName;
|
55493 | this.nodeValue = nodeValue;
|
55494 | this.namespaceURI = namespaceURI;
|
55495 | this.parentNode = null;
|
55496 | this.previousSibling = null;
|
55497 | this.nextSibling = null;
|
55498 | this.firstChild = null;
|
55499 | this.lastChild = null;
|
55500 | this.attributes = EMPTY_ATTRS;
|
55501 | /**
|
55502 | * @internal
|
55503 | */
|
55504 |
|
55505 | this._childNodes = undefined;
|
55506 | }
|
55507 |
|
55508 | get tagName() {
|
55509 | return this.nodeName;
|
55510 | }
|
55511 |
|
55512 | get childNodes() {
|
55513 | var children = this._childNodes;
|
55514 |
|
55515 | if (children === undefined) {
|
55516 | children = this._childNodes = new ChildNodes(this);
|
55517 | }
|
55518 |
|
55519 | return children;
|
55520 | }
|
55521 |
|
55522 | cloneNode(deep) {
|
55523 | return cloneNode(this, deep === true);
|
55524 | }
|
55525 |
|
55526 | appendChild(newChild) {
|
55527 | insertBefore(this, newChild, null);
|
55528 | return newChild;
|
55529 | }
|
55530 |
|
55531 | insertBefore(newChild, refChild) {
|
55532 | insertBefore(this, newChild, refChild);
|
55533 | return newChild;
|
55534 | }
|
55535 |
|
55536 | removeChild(oldChild) {
|
55537 | removeChild(this, oldChild);
|
55538 | return oldChild;
|
55539 | }
|
55540 |
|
55541 | insertAdjacentHTML(position, html) {
|
55542 | var raw = new SimpleNodeImpl(this.ownerDocument, -1
|
55543 | /* RAW_NODE */
|
55544 | , '#raw', html, void 0);
|
55545 | var parentNode;
|
55546 | var nextSibling;
|
55547 |
|
55548 | switch (position) {
|
55549 | case 'beforebegin':
|
55550 | parentNode = this.parentNode;
|
55551 | nextSibling = this;
|
55552 | break;
|
55553 |
|
55554 | case 'afterbegin':
|
55555 | parentNode = this;
|
55556 | nextSibling = this.firstChild;
|
55557 | break;
|
55558 |
|
55559 | case 'beforeend':
|
55560 | parentNode = this;
|
55561 | nextSibling = null;
|
55562 | break;
|
55563 |
|
55564 | case 'afterend':
|
55565 | parentNode = this.parentNode;
|
55566 | nextSibling = this.nextSibling;
|
55567 | break;
|
55568 |
|
55569 | default:
|
55570 | throw new Error('invalid position');
|
55571 | }
|
55572 |
|
55573 | if (parentNode === null) {
|
55574 | throw new Error(`${position} requires a parentNode`);
|
55575 | }
|
55576 |
|
55577 | insertBefore(parentNode, raw, nextSibling);
|
55578 | }
|
55579 |
|
55580 | getAttribute(name) {
|
55581 | var localName = adjustAttrName(this.namespaceURI, name);
|
55582 | return getAttribute(this.attributes, null, localName);
|
55583 | }
|
55584 |
|
55585 | getAttributeNS(namespaceURI, localName) {
|
55586 | return getAttribute(this.attributes, namespaceURI, localName);
|
55587 | }
|
55588 |
|
55589 | setAttribute(name, value) {
|
55590 | var localName = adjustAttrName(this.namespaceURI, name);
|
55591 | setAttribute(this, null, null, localName, value);
|
55592 | }
|
55593 |
|
55594 | setAttributeNS(namespaceURI, qualifiedName, value) {
|
55595 | var [prefix, localName] = parseQualifiedName(qualifiedName);
|
55596 | setAttribute(this, namespaceURI, prefix, localName, value);
|
55597 | }
|
55598 |
|
55599 | removeAttribute(name) {
|
55600 | var localName = adjustAttrName(this.namespaceURI, name);
|
55601 | removeAttribute(this.attributes, null, localName);
|
55602 | }
|
55603 |
|
55604 | removeAttributeNS(namespaceURI, localName) {
|
55605 | removeAttribute(this.attributes, namespaceURI, localName);
|
55606 | }
|
55607 |
|
55608 | get doctype() {
|
55609 | return this.firstChild;
|
55610 | }
|
55611 |
|
55612 | get documentElement() {
|
55613 | return this.lastChild;
|
55614 | }
|
55615 |
|
55616 | get head() {
|
55617 | return this.documentElement.firstChild;
|
55618 | }
|
55619 |
|
55620 | get body() {
|
55621 | return this.documentElement.lastChild;
|
55622 | }
|
55623 |
|
55624 | createElement(name) {
|
55625 | return new SimpleNodeImpl(this, 1
|
55626 | /* ELEMENT_NODE */
|
55627 | , name.toUpperCase(), null, "http://www.w3.org/1999/xhtml"
|
55628 | /* HTML */
|
55629 | );
|
55630 | }
|
55631 |
|
55632 | createElementNS(namespace, qualifiedName) {
|
55633 | // Node name is case-preserving in XML contexts, but returns canonical uppercase form in HTML contexts
|
55634 | // https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-104682815
|
55635 | var nodeName = namespace === "http://www.w3.org/1999/xhtml"
|
55636 | /* HTML */
|
55637 | ? qualifiedName.toUpperCase() : qualifiedName; // we don't care to parse the qualified name because we only support HTML documents
|
55638 | // which don't support prefixed elements
|
55639 |
|
55640 | return new SimpleNodeImpl(this, 1
|
55641 | /* ELEMENT_NODE */
|
55642 | , nodeName, null, namespace);
|
55643 | }
|
55644 |
|
55645 | createTextNode(text) {
|
55646 | return new SimpleNodeImpl(this, 3
|
55647 | /* TEXT_NODE */
|
55648 | , '#text', text, void 0);
|
55649 | }
|
55650 |
|
55651 | createComment(text) {
|
55652 | return new SimpleNodeImpl(this, 8
|
55653 | /* COMMENT_NODE */
|
55654 | , '#comment', text, void 0);
|
55655 | }
|
55656 | /**
|
55657 | * Backwards compat
|
55658 | * @deprecated
|
55659 | */
|
55660 |
|
55661 |
|
55662 | createRawHTMLSection(text) {
|
55663 | return new SimpleNodeImpl(this, -1
|
55664 | /* RAW_NODE */
|
55665 | , '#raw', text, void 0);
|
55666 | }
|
55667 |
|
55668 | createDocumentFragment() {
|
55669 | return new SimpleNodeImpl(this, 11
|
55670 | /* DOCUMENT_FRAGMENT_NODE */
|
55671 | , '#document-fragment', null, void 0);
|
55672 | }
|
55673 |
|
55674 | }
|
55675 |
|
55676 | function createHTMLDocument() {
|
55677 | // dom.d.ts types ownerDocument as Document but for a document ownerDocument is null
|
55678 | var document = new SimpleNodeImpl(null, 9
|
55679 | /* DOCUMENT_NODE */
|
55680 | , '#document', null, "http://www.w3.org/1999/xhtml"
|
55681 | /* HTML */
|
55682 | );
|
55683 | var doctype = new SimpleNodeImpl(document, 10
|
55684 | /* DOCUMENT_TYPE_NODE */
|
55685 | , 'html', null, "http://www.w3.org/1999/xhtml"
|
55686 | /* HTML */
|
55687 | );
|
55688 | var html = new SimpleNodeImpl(document, 1
|
55689 | /* ELEMENT_NODE */
|
55690 | , 'HTML', null, "http://www.w3.org/1999/xhtml"
|
55691 | /* HTML */
|
55692 | );
|
55693 | var head = new SimpleNodeImpl(document, 1
|
55694 | /* ELEMENT_NODE */
|
55695 | , 'HEAD', null, "http://www.w3.org/1999/xhtml"
|
55696 | /* HTML */
|
55697 | );
|
55698 | var body = new SimpleNodeImpl(document, 1
|
55699 | /* ELEMENT_NODE */
|
55700 | , 'BODY', null, "http://www.w3.org/1999/xhtml"
|
55701 | /* HTML */
|
55702 | );
|
55703 | html.appendChild(head);
|
55704 | html.appendChild(body);
|
55705 | document.appendChild(doctype);
|
55706 | document.appendChild(html);
|
55707 | return document;
|
55708 | }
|
55709 |
|
55710 | var _default = createHTMLDocument;
|
55711 | _exports.default = _default;
|
55712 | });
|
55713 | define("backburner", ["exports"], function (_exports) {
|
55714 | "use strict";
|
55715 |
|
55716 | Object.defineProperty(_exports, "__esModule", {
|
55717 | value: true
|
55718 | });
|
55719 | _exports.buildPlatform = buildPlatform;
|
55720 | _exports.default = void 0;
|
55721 | var SET_TIMEOUT = setTimeout;
|
55722 |
|
55723 | var NOOP = () => {};
|
55724 |
|
55725 | function buildNext(flush) {
|
55726 | // Using "promises first" here to:
|
55727 | //
|
55728 | // 1) Ensure more consistent experience on browsers that
|
55729 | // have differently queued microtasks (separate queues for
|
55730 | // MutationObserver vs Promises).
|
55731 | // 2) Ensure better debugging experiences (it shows up in Chrome
|
55732 | // call stack as "Promise.then (async)") which is more consistent
|
55733 | // with user expectations
|
55734 | //
|
55735 | // When Promise is unavailable use MutationObserver (mostly so that we
|
55736 | // still get microtasks on IE11), and when neither MutationObserver and
|
55737 | // Promise are present use a plain old setTimeout.
|
55738 | if (typeof Promise === 'function') {
|
55739 | var autorunPromise = Promise.resolve();
|
55740 | return () => autorunPromise.then(flush);
|
55741 | } else if (typeof MutationObserver === 'function') {
|
55742 | var iterations = 0;
|
55743 | var observer = new MutationObserver(flush);
|
55744 | var node = document.createTextNode('');
|
55745 | observer.observe(node, {
|
55746 | characterData: true
|
55747 | });
|
55748 | return () => {
|
55749 | iterations = ++iterations % 2;
|
55750 | node.data = '' + iterations;
|
55751 | return iterations;
|
55752 | };
|
55753 | } else {
|
55754 | return () => SET_TIMEOUT(flush, 0);
|
55755 | }
|
55756 | }
|
55757 |
|
55758 | function buildPlatform(flush) {
|
55759 | var clearNext = NOOP;
|
55760 | return {
|
55761 | setTimeout(fn, ms) {
|
55762 | return setTimeout(fn, ms);
|
55763 | },
|
55764 |
|
55765 | clearTimeout(timerId) {
|
55766 | return clearTimeout(timerId);
|
55767 | },
|
55768 |
|
55769 | now() {
|
55770 | return Date.now();
|
55771 | },
|
55772 |
|
55773 | next: buildNext(flush),
|
55774 | clearNext
|
55775 | };
|
55776 | }
|
55777 |
|
55778 | var NUMBER = /\d+/;
|
55779 | var TIMERS_OFFSET = 6;
|
55780 |
|
55781 | function isCoercableNumber(suspect) {
|
55782 | var type = typeof suspect;
|
55783 | return type === 'number' && suspect === suspect || type === 'string' && NUMBER.test(suspect);
|
55784 | }
|
55785 |
|
55786 | function getOnError(options) {
|
55787 | return options.onError || options.onErrorTarget && options.onErrorTarget[options.onErrorMethod];
|
55788 | }
|
55789 |
|
55790 | function findItem(target, method, collection) {
|
55791 | var index = -1;
|
55792 |
|
55793 | for (var i = 0, l = collection.length; i < l; i += 4) {
|
55794 | if (collection[i] === target && collection[i + 1] === method) {
|
55795 | index = i;
|
55796 | break;
|
55797 | }
|
55798 | }
|
55799 |
|
55800 | return index;
|
55801 | }
|
55802 |
|
55803 | function findTimerItem(target, method, collection) {
|
55804 | var index = -1;
|
55805 |
|
55806 | for (var i = 2, l = collection.length; i < l; i += 6) {
|
55807 | if (collection[i] === target && collection[i + 1] === method) {
|
55808 | index = i - 2;
|
55809 | break;
|
55810 | }
|
55811 | }
|
55812 |
|
55813 | return index;
|
55814 | }
|
55815 |
|
55816 | function getQueueItems(items, queueItemLength, queueItemPositionOffset = 0) {
|
55817 | var queueItems = [];
|
55818 |
|
55819 | for (var i = 0; i < items.length; i += queueItemLength) {
|
55820 | var maybeError = items[i + 3
|
55821 | /* stack */
|
55822 | + queueItemPositionOffset];
|
55823 | var queueItem = {
|
55824 | target: items[i + 0
|
55825 | /* target */
|
55826 | + queueItemPositionOffset],
|
55827 | method: items[i + 1
|
55828 | /* method */
|
55829 | + queueItemPositionOffset],
|
55830 | args: items[i + 2
|
55831 | /* args */
|
55832 | + queueItemPositionOffset],
|
55833 | stack: maybeError !== undefined && 'stack' in maybeError ? maybeError.stack : ''
|
55834 | };
|
55835 | queueItems.push(queueItem);
|
55836 | }
|
55837 |
|
55838 | return queueItems;
|
55839 | }
|
55840 |
|
55841 | function binarySearch(time, timers) {
|
55842 | var start = 0;
|
55843 | var end = timers.length - TIMERS_OFFSET;
|
55844 | var middle;
|
55845 | var l;
|
55846 |
|
55847 | while (start < end) {
|
55848 | // since timers is an array of pairs 'l' will always
|
55849 | // be an integer
|
55850 | l = (end - start) / TIMERS_OFFSET; // compensate for the index in case even number
|
55851 | // of pairs inside timers
|
55852 |
|
55853 | middle = start + l - l % TIMERS_OFFSET;
|
55854 |
|
55855 | if (time >= timers[middle]) {
|
55856 | start = middle + TIMERS_OFFSET;
|
55857 | } else {
|
55858 | end = middle;
|
55859 | }
|
55860 | }
|
55861 |
|
55862 | return time >= timers[start] ? start + TIMERS_OFFSET : start;
|
55863 | }
|
55864 |
|
55865 | var QUEUE_ITEM_LENGTH = 4;
|
55866 |
|
55867 | class Queue {
|
55868 | constructor(name, options = {}, globalOptions = {}) {
|
55869 | this._queueBeingFlushed = [];
|
55870 | this.targetQueues = new Map();
|
55871 | this.index = 0;
|
55872 | this._queue = [];
|
55873 | this.name = name;
|
55874 | this.options = options;
|
55875 | this.globalOptions = globalOptions;
|
55876 | }
|
55877 |
|
55878 | stackFor(index) {
|
55879 | if (index < this._queue.length) {
|
55880 | var entry = this._queue[index * 3 + QUEUE_ITEM_LENGTH];
|
55881 |
|
55882 | if (entry) {
|
55883 | return entry.stack;
|
55884 | } else {
|
55885 | return null;
|
55886 | }
|
55887 | }
|
55888 | }
|
55889 |
|
55890 | flush(sync) {
|
55891 | var {
|
55892 | before,
|
55893 | after
|
55894 | } = this.options;
|
55895 | var target;
|
55896 | var method;
|
55897 | var args;
|
55898 | var errorRecordedForStack;
|
55899 | this.targetQueues.clear();
|
55900 |
|
55901 | if (this._queueBeingFlushed.length === 0) {
|
55902 | this._queueBeingFlushed = this._queue;
|
55903 | this._queue = [];
|
55904 | }
|
55905 |
|
55906 | if (before !== undefined) {
|
55907 | before();
|
55908 | }
|
55909 |
|
55910 | var invoke;
|
55911 | var queueItems = this._queueBeingFlushed;
|
55912 |
|
55913 | if (queueItems.length > 0) {
|
55914 | var onError = getOnError(this.globalOptions);
|
55915 | invoke = onError ? this.invokeWithOnError : this.invoke;
|
55916 |
|
55917 | for (var i = this.index; i < queueItems.length; i += QUEUE_ITEM_LENGTH) {
|
55918 | this.index += QUEUE_ITEM_LENGTH;
|
55919 | method = queueItems[i + 1]; // method could have been nullified / canceled during flush
|
55920 |
|
55921 | if (method !== null) {
|
55922 | //
|
55923 | // ** Attention intrepid developer **
|
55924 | //
|
55925 | // To find out the stack of this task when it was scheduled onto
|
55926 | // the run loop, add the following to your app.js:
|
55927 | //
|
55928 | // Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production.
|
55929 | //
|
55930 | // Once that is in place, when you are at a breakpoint and navigate
|
55931 | // here in the stack explorer, you can look at `errorRecordedForStack.stack`,
|
55932 | // which will be the captured stack when this job was scheduled.
|
55933 | //
|
55934 | // One possible long-term solution is the following Chrome issue:
|
55935 | // https://bugs.chromium.org/p/chromium/issues/detail?id=332624
|
55936 | //
|
55937 | target = queueItems[i];
|
55938 | args = queueItems[i + 2];
|
55939 | errorRecordedForStack = queueItems[i + 3]; // Debugging assistance
|
55940 |
|
55941 | invoke(target, method, args, onError, errorRecordedForStack);
|
55942 | }
|
55943 |
|
55944 | if (this.index !== this._queueBeingFlushed.length && this.globalOptions.mustYield && this.globalOptions.mustYield()) {
|
55945 | return 1
|
55946 | /* Pause */
|
55947 | ;
|
55948 | }
|
55949 | }
|
55950 | }
|
55951 |
|
55952 | if (after !== undefined) {
|
55953 | after();
|
55954 | }
|
55955 |
|
55956 | this._queueBeingFlushed.length = 0;
|
55957 | this.index = 0;
|
55958 |
|
55959 | if (sync !== false && this._queue.length > 0) {
|
55960 | // check if new items have been added
|
55961 | this.flush(true);
|
55962 | }
|
55963 | }
|
55964 |
|
55965 | hasWork() {
|
55966 | return this._queueBeingFlushed.length > 0 || this._queue.length > 0;
|
55967 | }
|
55968 |
|
55969 | cancel({
|
55970 | target,
|
55971 | method
|
55972 | }) {
|
55973 | var queue = this._queue;
|
55974 | var targetQueueMap = this.targetQueues.get(target);
|
55975 |
|
55976 | if (targetQueueMap !== undefined) {
|
55977 | targetQueueMap.delete(method);
|
55978 | }
|
55979 |
|
55980 | var index = findItem(target, method, queue);
|
55981 |
|
55982 | if (index > -1) {
|
55983 | queue.splice(index, QUEUE_ITEM_LENGTH);
|
55984 | return true;
|
55985 | } // if not found in current queue
|
55986 | // could be in the queue that is being flushed
|
55987 |
|
55988 |
|
55989 | queue = this._queueBeingFlushed;
|
55990 | index = findItem(target, method, queue);
|
55991 |
|
55992 | if (index > -1) {
|
55993 | queue[index + 1] = null;
|
55994 | return true;
|
55995 | }
|
55996 |
|
55997 | return false;
|
55998 | }
|
55999 |
|
56000 | push(target, method, args, stack) {
|
56001 | this._queue.push(target, method, args, stack);
|
56002 |
|
56003 | return {
|
56004 | queue: this,
|
56005 | target,
|
56006 | method
|
56007 | };
|
56008 | }
|
56009 |
|
56010 | pushUnique(target, method, args, stack) {
|
56011 | var localQueueMap = this.targetQueues.get(target);
|
56012 |
|
56013 | if (localQueueMap === undefined) {
|
56014 | localQueueMap = new Map();
|
56015 | this.targetQueues.set(target, localQueueMap);
|
56016 | }
|
56017 |
|
56018 | var index = localQueueMap.get(method);
|
56019 |
|
56020 | if (index === undefined) {
|
56021 | var queueIndex = this._queue.push(target, method, args, stack) - QUEUE_ITEM_LENGTH;
|
56022 | localQueueMap.set(method, queueIndex);
|
56023 | } else {
|
56024 | var queue = this._queue;
|
56025 | queue[index + 2] = args; // replace args
|
56026 |
|
56027 | queue[index + 3] = stack; // replace stack
|
56028 | }
|
56029 |
|
56030 | return {
|
56031 | queue: this,
|
56032 | target,
|
56033 | method
|
56034 | };
|
56035 | }
|
56036 |
|
56037 | _getDebugInfo(debugEnabled) {
|
56038 | if (debugEnabled) {
|
56039 | var debugInfo = getQueueItems(this._queue, QUEUE_ITEM_LENGTH);
|
56040 | return debugInfo;
|
56041 | }
|
56042 |
|
56043 | return undefined;
|
56044 | }
|
56045 |
|
56046 | invoke(target, method, args
|
56047 | /*, onError, errorRecordedForStack */
|
56048 | ) {
|
56049 | if (args === undefined) {
|
56050 | method.call(target);
|
56051 | } else {
|
56052 | method.apply(target, args);
|
56053 | }
|
56054 | }
|
56055 |
|
56056 | invokeWithOnError(target, method, args, onError, errorRecordedForStack) {
|
56057 | try {
|
56058 | if (args === undefined) {
|
56059 | method.call(target);
|
56060 | } else {
|
56061 | method.apply(target, args);
|
56062 | }
|
56063 | } catch (error) {
|
56064 | onError(error, errorRecordedForStack);
|
56065 | }
|
56066 | }
|
56067 |
|
56068 | }
|
56069 |
|
56070 | class DeferredActionQueues {
|
56071 | constructor(queueNames = [], options) {
|
56072 | this.queues = {};
|
56073 | this.queueNameIndex = 0;
|
56074 | this.queueNames = queueNames;
|
56075 | queueNames.reduce(function (queues, queueName) {
|
56076 | queues[queueName] = new Queue(queueName, options[queueName], options);
|
56077 | return queues;
|
56078 | }, this.queues);
|
56079 | }
|
56080 | /**
|
56081 | * @method schedule
|
56082 | * @param {String} queueName
|
56083 | * @param {Any} target
|
56084 | * @param {Any} method
|
56085 | * @param {Any} args
|
56086 | * @param {Boolean} onceFlag
|
56087 | * @param {Any} stack
|
56088 | * @return queue
|
56089 | */
|
56090 |
|
56091 |
|
56092 | schedule(queueName, target, method, args, onceFlag, stack) {
|
56093 | var queues = this.queues;
|
56094 | var queue = queues[queueName];
|
56095 |
|
56096 | if (queue === undefined) {
|
56097 | throw new Error(`You attempted to schedule an action in a queue (${queueName}) that doesn\'t exist`);
|
56098 | }
|
56099 |
|
56100 | if (method === undefined || method === null) {
|
56101 | throw new Error(`You attempted to schedule an action in a queue (${queueName}) for a method that doesn\'t exist`);
|
56102 | }
|
56103 |
|
56104 | this.queueNameIndex = 0;
|
56105 |
|
56106 | if (onceFlag) {
|
56107 | return queue.pushUnique(target, method, args, stack);
|
56108 | } else {
|
56109 | return queue.push(target, method, args, stack);
|
56110 | }
|
56111 | }
|
56112 | /**
|
56113 | * DeferredActionQueues.flush() calls Queue.flush()
|
56114 | *
|
56115 | * @method flush
|
56116 | * @param {Boolean} fromAutorun
|
56117 | */
|
56118 |
|
56119 |
|
56120 | flush(fromAutorun = false) {
|
56121 | var queue;
|
56122 | var queueName;
|
56123 | var numberOfQueues = this.queueNames.length;
|
56124 |
|
56125 | while (this.queueNameIndex < numberOfQueues) {
|
56126 | queueName = this.queueNames[this.queueNameIndex];
|
56127 | queue = this.queues[queueName];
|
56128 |
|
56129 | if (queue.hasWork() === false) {
|
56130 | this.queueNameIndex++;
|
56131 |
|
56132 | if (fromAutorun && this.queueNameIndex < numberOfQueues) {
|
56133 | return 1
|
56134 | /* Pause */
|
56135 | ;
|
56136 | }
|
56137 | } else {
|
56138 | if (queue.flush(false
|
56139 | /* async */
|
56140 | ) === 1
|
56141 | /* Pause */
|
56142 | ) {
|
56143 | return 1
|
56144 | /* Pause */
|
56145 | ;
|
56146 | }
|
56147 | }
|
56148 | }
|
56149 | }
|
56150 | /**
|
56151 | * Returns debug information for the current queues.
|
56152 | *
|
56153 | * @method _getDebugInfo
|
56154 | * @param {Boolean} debugEnabled
|
56155 | * @returns {IDebugInfo | undefined}
|
56156 | */
|
56157 |
|
56158 |
|
56159 | _getDebugInfo(debugEnabled) {
|
56160 | if (debugEnabled) {
|
56161 | var debugInfo = {};
|
56162 | var queue;
|
56163 | var queueName;
|
56164 | var numberOfQueues = this.queueNames.length;
|
56165 | var i = 0;
|
56166 |
|
56167 | while (i < numberOfQueues) {
|
56168 | queueName = this.queueNames[i];
|
56169 | queue = this.queues[queueName];
|
56170 | debugInfo[queueName] = queue._getDebugInfo(debugEnabled);
|
56171 | i++;
|
56172 | }
|
56173 |
|
56174 | return debugInfo;
|
56175 | }
|
56176 |
|
56177 | return;
|
56178 | }
|
56179 |
|
56180 | }
|
56181 |
|
56182 | function iteratorDrain(fn) {
|
56183 | var iterator = fn();
|
56184 | var result = iterator.next();
|
56185 |
|
56186 | while (result.done === false) {
|
56187 | result.value();
|
56188 | result = iterator.next();
|
56189 | }
|
56190 | }
|
56191 |
|
56192 | var noop = function () {};
|
56193 |
|
56194 | var DISABLE_SCHEDULE = Object.freeze([]);
|
56195 |
|
56196 | function parseArgs() {
|
56197 | var length = arguments.length;
|
56198 | var args;
|
56199 | var method;
|
56200 | var target;
|
56201 |
|
56202 | if (length === 0) {} else if (length === 1) {
|
56203 | target = null;
|
56204 | method = arguments[0];
|
56205 | } else {
|
56206 | var argsIndex = 2;
|
56207 | var methodOrTarget = arguments[0];
|
56208 | var methodOrArgs = arguments[1];
|
56209 | var type = typeof methodOrArgs;
|
56210 |
|
56211 | if (type === 'function') {
|
56212 | target = methodOrTarget;
|
56213 | method = methodOrArgs;
|
56214 | } else if (methodOrTarget !== null && type === 'string' && methodOrArgs in methodOrTarget) {
|
56215 | target = methodOrTarget;
|
56216 | method = target[methodOrArgs];
|
56217 | } else if (typeof methodOrTarget === 'function') {
|
56218 | argsIndex = 1;
|
56219 | target = null;
|
56220 | method = methodOrTarget;
|
56221 | }
|
56222 |
|
56223 | if (length > argsIndex) {
|
56224 | var len = length - argsIndex;
|
56225 | args = new Array(len);
|
56226 |
|
56227 | for (var i = 0; i < len; i++) {
|
56228 | args[i] = arguments[i + argsIndex];
|
56229 | }
|
56230 | }
|
56231 | }
|
56232 |
|
56233 | return [target, method, args];
|
56234 | }
|
56235 |
|
56236 | function parseTimerArgs() {
|
56237 | var [target, method, args] = parseArgs(...arguments);
|
56238 | var wait = 0;
|
56239 | var length = args !== undefined ? args.length : 0;
|
56240 |
|
56241 | if (length > 0) {
|
56242 | var last = args[length - 1];
|
56243 |
|
56244 | if (isCoercableNumber(last)) {
|
56245 | wait = parseInt(args.pop(), 10);
|
56246 | }
|
56247 | }
|
56248 |
|
56249 | return [target, method, args, wait];
|
56250 | }
|
56251 |
|
56252 | function parseDebounceArgs() {
|
56253 | var target;
|
56254 | var method;
|
56255 | var isImmediate;
|
56256 | var args;
|
56257 | var wait;
|
56258 |
|
56259 | if (arguments.length === 2) {
|
56260 | method = arguments[0];
|
56261 | wait = arguments[1];
|
56262 | target = null;
|
56263 | } else {
|
56264 | [target, method, args] = parseArgs(...arguments);
|
56265 |
|
56266 | if (args === undefined) {
|
56267 | wait = 0;
|
56268 | } else {
|
56269 | wait = args.pop();
|
56270 |
|
56271 | if (!isCoercableNumber(wait)) {
|
56272 | isImmediate = wait === true;
|
56273 | wait = args.pop();
|
56274 | }
|
56275 | }
|
56276 | }
|
56277 |
|
56278 | wait = parseInt(wait, 10);
|
56279 | return [target, method, args, wait, isImmediate];
|
56280 | }
|
56281 |
|
56282 | var UUID = 0;
|
56283 | var beginCount = 0;
|
56284 | var endCount = 0;
|
56285 | var beginEventCount = 0;
|
56286 | var endEventCount = 0;
|
56287 | var runCount = 0;
|
56288 | var joinCount = 0;
|
56289 | var deferCount = 0;
|
56290 | var scheduleCount = 0;
|
56291 | var scheduleIterableCount = 0;
|
56292 | var deferOnceCount = 0;
|
56293 | var scheduleOnceCount = 0;
|
56294 | var setTimeoutCount = 0;
|
56295 | var laterCount = 0;
|
56296 | var throttleCount = 0;
|
56297 | var debounceCount = 0;
|
56298 | var cancelTimersCount = 0;
|
56299 | var cancelCount = 0;
|
56300 | var autorunsCreatedCount = 0;
|
56301 | var autorunsCompletedCount = 0;
|
56302 | var deferredActionQueuesCreatedCount = 0;
|
56303 | var nestedDeferredActionQueuesCreated = 0;
|
56304 |
|
56305 | class Backburner {
|
56306 | constructor(queueNames, options) {
|
56307 | this.DEBUG = false;
|
56308 | this.currentInstance = null;
|
56309 | this.instanceStack = [];
|
56310 | this._eventCallbacks = {
|
56311 | end: [],
|
56312 | begin: []
|
56313 | };
|
56314 | this._timerTimeoutId = null;
|
56315 | this._timers = [];
|
56316 | this._autorun = false;
|
56317 | this._autorunStack = null;
|
56318 | this.queueNames = queueNames;
|
56319 | this.options = options || {};
|
56320 |
|
56321 | if (typeof this.options.defaultQueue === 'string') {
|
56322 | this._defaultQueue = this.options.defaultQueue;
|
56323 | } else {
|
56324 | this._defaultQueue = this.queueNames[0];
|
56325 | }
|
56326 |
|
56327 | this._onBegin = this.options.onBegin || noop;
|
56328 | this._onEnd = this.options.onEnd || noop;
|
56329 | this._boundRunExpiredTimers = this._runExpiredTimers.bind(this);
|
56330 |
|
56331 | this._boundAutorunEnd = () => {
|
56332 | autorunsCompletedCount++; // if the autorun was already flushed, do nothing
|
56333 |
|
56334 | if (this._autorun === false) {
|
56335 | return;
|
56336 | }
|
56337 |
|
56338 | this._autorun = false;
|
56339 | this._autorunStack = null;
|
56340 |
|
56341 | this._end(true
|
56342 | /* fromAutorun */
|
56343 | );
|
56344 | };
|
56345 |
|
56346 | var builder = this.options._buildPlatform || buildPlatform;
|
56347 | this._platform = builder(this._boundAutorunEnd);
|
56348 | }
|
56349 |
|
56350 | get counters() {
|
56351 | return {
|
56352 | begin: beginCount,
|
56353 | end: endCount,
|
56354 | events: {
|
56355 | begin: beginEventCount,
|
56356 | end: endEventCount
|
56357 | },
|
56358 | autoruns: {
|
56359 | created: autorunsCreatedCount,
|
56360 | completed: autorunsCompletedCount
|
56361 | },
|
56362 | run: runCount,
|
56363 | join: joinCount,
|
56364 | defer: deferCount,
|
56365 | schedule: scheduleCount,
|
56366 | scheduleIterable: scheduleIterableCount,
|
56367 | deferOnce: deferOnceCount,
|
56368 | scheduleOnce: scheduleOnceCount,
|
56369 | setTimeout: setTimeoutCount,
|
56370 | later: laterCount,
|
56371 | throttle: throttleCount,
|
56372 | debounce: debounceCount,
|
56373 | cancelTimers: cancelTimersCount,
|
56374 | cancel: cancelCount,
|
56375 | loops: {
|
56376 | total: deferredActionQueuesCreatedCount,
|
56377 | nested: nestedDeferredActionQueuesCreated
|
56378 | }
|
56379 | };
|
56380 | }
|
56381 |
|
56382 | get defaultQueue() {
|
56383 | return this._defaultQueue;
|
56384 | }
|
56385 | /*
|
56386 | @method begin
|
56387 | @return instantiated class DeferredActionQueues
|
56388 | */
|
56389 |
|
56390 |
|
56391 | begin() {
|
56392 | beginCount++;
|
56393 | var options = this.options;
|
56394 | var previousInstance = this.currentInstance;
|
56395 | var current;
|
56396 |
|
56397 | if (this._autorun !== false) {
|
56398 | current = previousInstance;
|
56399 |
|
56400 | this._cancelAutorun();
|
56401 | } else {
|
56402 | if (previousInstance !== null) {
|
56403 | nestedDeferredActionQueuesCreated++;
|
56404 | this.instanceStack.push(previousInstance);
|
56405 | }
|
56406 |
|
56407 | deferredActionQueuesCreatedCount++;
|
56408 | current = this.currentInstance = new DeferredActionQueues(this.queueNames, options);
|
56409 | beginEventCount++;
|
56410 |
|
56411 | this._trigger('begin', current, previousInstance);
|
56412 | }
|
56413 |
|
56414 | this._onBegin(current, previousInstance);
|
56415 |
|
56416 | return current;
|
56417 | }
|
56418 |
|
56419 | end() {
|
56420 | endCount++;
|
56421 |
|
56422 | this._end(false);
|
56423 | }
|
56424 |
|
56425 | on(eventName, callback) {
|
56426 | if (typeof callback !== 'function') {
|
56427 | throw new TypeError(`Callback must be a function`);
|
56428 | }
|
56429 |
|
56430 | var callbacks = this._eventCallbacks[eventName];
|
56431 |
|
56432 | if (callbacks !== undefined) {
|
56433 | callbacks.push(callback);
|
56434 | } else {
|
56435 | throw new TypeError(`Cannot on() event ${eventName} because it does not exist`);
|
56436 | }
|
56437 | }
|
56438 |
|
56439 | off(eventName, callback) {
|
56440 | var callbacks = this._eventCallbacks[eventName];
|
56441 |
|
56442 | if (!eventName || callbacks === undefined) {
|
56443 | throw new TypeError(`Cannot off() event ${eventName} because it does not exist`);
|
56444 | }
|
56445 |
|
56446 | var callbackFound = false;
|
56447 |
|
56448 | if (callback) {
|
56449 | for (var i = 0; i < callbacks.length; i++) {
|
56450 | if (callbacks[i] === callback) {
|
56451 | callbackFound = true;
|
56452 | callbacks.splice(i, 1);
|
56453 | i--;
|
56454 | }
|
56455 | }
|
56456 | }
|
56457 |
|
56458 | if (!callbackFound) {
|
56459 | throw new TypeError(`Cannot off() callback that does not exist`);
|
56460 | }
|
56461 | }
|
56462 |
|
56463 | run() {
|
56464 | runCount++;
|
56465 | var [target, method, args] = parseArgs(...arguments);
|
56466 | return this._run(target, method, args);
|
56467 | }
|
56468 |
|
56469 | join() {
|
56470 | joinCount++;
|
56471 | var [target, method, args] = parseArgs(...arguments);
|
56472 | return this._join(target, method, args);
|
56473 | }
|
56474 | /**
|
56475 | * @deprecated please use schedule instead.
|
56476 | */
|
56477 |
|
56478 |
|
56479 | defer(queueName, target, method, ...args) {
|
56480 | deferCount++;
|
56481 | return this.schedule(queueName, target, method, ...args);
|
56482 | }
|
56483 |
|
56484 | schedule(queueName, ..._args) {
|
56485 | scheduleCount++;
|
56486 | var [target, method, args] = parseArgs(..._args);
|
56487 | var stack = this.DEBUG ? new Error() : undefined;
|
56488 | return this._ensureInstance().schedule(queueName, target, method, args, false, stack);
|
56489 | }
|
56490 | /*
|
56491 | Defer the passed iterable of functions to run inside the specified queue.
|
56492 | @method scheduleIterable
|
56493 | @param {String} queueName
|
56494 | @param {Iterable} an iterable of functions to execute
|
56495 | @return method result
|
56496 | */
|
56497 |
|
56498 |
|
56499 | scheduleIterable(queueName, iterable) {
|
56500 | scheduleIterableCount++;
|
56501 | var stack = this.DEBUG ? new Error() : undefined;
|
56502 | return this._ensureInstance().schedule(queueName, null, iteratorDrain, [iterable], false, stack);
|
56503 | }
|
56504 | /**
|
56505 | * @deprecated please use scheduleOnce instead.
|
56506 | */
|
56507 |
|
56508 |
|
56509 | deferOnce(queueName, target, method, ...args) {
|
56510 | deferOnceCount++;
|
56511 | return this.scheduleOnce(queueName, target, method, ...args);
|
56512 | }
|
56513 |
|
56514 | scheduleOnce(queueName, ..._args) {
|
56515 | scheduleOnceCount++;
|
56516 | var [target, method, args] = parseArgs(..._args);
|
56517 | var stack = this.DEBUG ? new Error() : undefined;
|
56518 | return this._ensureInstance().schedule(queueName, target, method, args, true, stack);
|
56519 | }
|
56520 |
|
56521 | setTimeout() {
|
56522 | setTimeoutCount++;
|
56523 | return this.later(...arguments);
|
56524 | }
|
56525 |
|
56526 | later() {
|
56527 | laterCount++;
|
56528 | var [target, method, args, wait] = parseTimerArgs(...arguments);
|
56529 | return this._later(target, method, args, wait);
|
56530 | }
|
56531 |
|
56532 | throttle() {
|
56533 | throttleCount++;
|
56534 | var [target, method, args, wait, isImmediate = true] = parseDebounceArgs(...arguments);
|
56535 | var index = findTimerItem(target, method, this._timers);
|
56536 | var timerId;
|
56537 |
|
56538 | if (index === -1) {
|
56539 | timerId = this._later(target, method, isImmediate ? DISABLE_SCHEDULE : args, wait);
|
56540 |
|
56541 | if (isImmediate) {
|
56542 | this._join(target, method, args);
|
56543 | }
|
56544 | } else {
|
56545 | timerId = this._timers[index + 1];
|
56546 | var argIndex = index + 4;
|
56547 |
|
56548 | if (this._timers[argIndex] !== DISABLE_SCHEDULE) {
|
56549 | this._timers[argIndex] = args;
|
56550 | }
|
56551 | }
|
56552 |
|
56553 | return timerId;
|
56554 | }
|
56555 |
|
56556 | debounce() {
|
56557 | debounceCount++;
|
56558 | var [target, method, args, wait, isImmediate = false] = parseDebounceArgs(...arguments);
|
56559 | var _timers = this._timers;
|
56560 | var index = findTimerItem(target, method, _timers);
|
56561 | var timerId;
|
56562 |
|
56563 | if (index === -1) {
|
56564 | timerId = this._later(target, method, isImmediate ? DISABLE_SCHEDULE : args, wait);
|
56565 |
|
56566 | if (isImmediate) {
|
56567 | this._join(target, method, args);
|
56568 | }
|
56569 | } else {
|
56570 | var executeAt = this._platform.now() + wait;
|
56571 | var argIndex = index + 4;
|
56572 |
|
56573 | if (_timers[argIndex] === DISABLE_SCHEDULE) {
|
56574 | args = DISABLE_SCHEDULE;
|
56575 | }
|
56576 |
|
56577 | timerId = _timers[index + 1];
|
56578 | var i = binarySearch(executeAt, _timers);
|
56579 |
|
56580 | if (index + TIMERS_OFFSET === i) {
|
56581 | _timers[index] = executeAt;
|
56582 | _timers[argIndex] = args;
|
56583 | } else {
|
56584 | var stack = this._timers[index + 5];
|
56585 |
|
56586 | this._timers.splice(i, 0, executeAt, timerId, target, method, args, stack);
|
56587 |
|
56588 | this._timers.splice(index, TIMERS_OFFSET);
|
56589 | }
|
56590 |
|
56591 | if (index === 0) {
|
56592 | this._reinstallTimerTimeout();
|
56593 | }
|
56594 | }
|
56595 |
|
56596 | return timerId;
|
56597 | }
|
56598 |
|
56599 | cancelTimers() {
|
56600 | cancelTimersCount++;
|
56601 |
|
56602 | this._clearTimerTimeout();
|
56603 |
|
56604 | this._timers = [];
|
56605 |
|
56606 | this._cancelAutorun();
|
56607 | }
|
56608 |
|
56609 | hasTimers() {
|
56610 | return this._timers.length > 0 || this._autorun;
|
56611 | }
|
56612 |
|
56613 | cancel(timer) {
|
56614 | cancelCount++;
|
56615 |
|
56616 | if (timer === null || timer === undefined) {
|
56617 | return false;
|
56618 | }
|
56619 |
|
56620 | var timerType = typeof timer;
|
56621 |
|
56622 | if (timerType === 'number') {
|
56623 | // we're cancelling a setTimeout or throttle or debounce
|
56624 | return this._cancelLaterTimer(timer);
|
56625 | } else if (timerType === 'object' && timer.queue && timer.method) {
|
56626 | // we're cancelling a deferOnce
|
56627 | return timer.queue.cancel(timer);
|
56628 | }
|
56629 |
|
56630 | return false;
|
56631 | }
|
56632 |
|
56633 | ensureInstance() {
|
56634 | this._ensureInstance();
|
56635 | }
|
56636 | /**
|
56637 | * Returns debug information related to the current instance of Backburner
|
56638 | *
|
56639 | * @method getDebugInfo
|
56640 | * @returns {Object | undefined} Will return and Object containing debug information if
|
56641 | * the DEBUG flag is set to true on the current instance of Backburner, else undefined.
|
56642 | */
|
56643 |
|
56644 |
|
56645 | getDebugInfo() {
|
56646 | if (this.DEBUG) {
|
56647 | return {
|
56648 | autorun: this._autorunStack,
|
56649 | counters: this.counters,
|
56650 | timers: getQueueItems(this._timers, TIMERS_OFFSET, 2),
|
56651 | instanceStack: [this.currentInstance, ...this.instanceStack].map(deferredActionQueue => deferredActionQueue && deferredActionQueue._getDebugInfo(this.DEBUG))
|
56652 | };
|
56653 | }
|
56654 |
|
56655 | return undefined;
|
56656 | }
|
56657 |
|
56658 | _end(fromAutorun) {
|
56659 | var currentInstance = this.currentInstance;
|
56660 | var nextInstance = null;
|
56661 |
|
56662 | if (currentInstance === null) {
|
56663 | throw new Error(`end called without begin`);
|
56664 | } // Prevent double-finally bug in Safari 6.0.2 and iOS 6
|
56665 | // This bug appears to be resolved in Safari 6.0.5 and iOS 7
|
56666 |
|
56667 |
|
56668 | var finallyAlreadyCalled = false;
|
56669 | var result;
|
56670 |
|
56671 | try {
|
56672 | result = currentInstance.flush(fromAutorun);
|
56673 | } finally {
|
56674 | if (!finallyAlreadyCalled) {
|
56675 | finallyAlreadyCalled = true;
|
56676 |
|
56677 | if (result === 1
|
56678 | /* Pause */
|
56679 | ) {
|
56680 | var plannedNextQueue = this.queueNames[currentInstance.queueNameIndex];
|
56681 |
|
56682 | this._scheduleAutorun(plannedNextQueue);
|
56683 | } else {
|
56684 | this.currentInstance = null;
|
56685 |
|
56686 | if (this.instanceStack.length > 0) {
|
56687 | nextInstance = this.instanceStack.pop();
|
56688 | this.currentInstance = nextInstance;
|
56689 | }
|
56690 |
|
56691 | this._trigger('end', currentInstance, nextInstance);
|
56692 |
|
56693 | this._onEnd(currentInstance, nextInstance);
|
56694 | }
|
56695 | }
|
56696 | }
|
56697 | }
|
56698 |
|
56699 | _join(target, method, args) {
|
56700 | if (this.currentInstance === null) {
|
56701 | return this._run(target, method, args);
|
56702 | }
|
56703 |
|
56704 | if (target === undefined && args === undefined) {
|
56705 | return method();
|
56706 | } else {
|
56707 | return method.apply(target, args);
|
56708 | }
|
56709 | }
|
56710 |
|
56711 | _run(target, method, args) {
|
56712 | var onError = getOnError(this.options);
|
56713 | this.begin();
|
56714 |
|
56715 | if (onError) {
|
56716 | try {
|
56717 | return method.apply(target, args);
|
56718 | } catch (error) {
|
56719 | onError(error);
|
56720 | } finally {
|
56721 | this.end();
|
56722 | }
|
56723 | } else {
|
56724 | try {
|
56725 | return method.apply(target, args);
|
56726 | } finally {
|
56727 | this.end();
|
56728 | }
|
56729 | }
|
56730 | }
|
56731 |
|
56732 | _cancelAutorun() {
|
56733 | if (this._autorun) {
|
56734 | this._platform.clearNext();
|
56735 |
|
56736 | this._autorun = false;
|
56737 | this._autorunStack = null;
|
56738 | }
|
56739 | }
|
56740 |
|
56741 | _later(target, method, args, wait) {
|
56742 | var stack = this.DEBUG ? new Error() : undefined;
|
56743 | var executeAt = this._platform.now() + wait;
|
56744 | var id = UUID++;
|
56745 |
|
56746 | if (this._timers.length === 0) {
|
56747 | this._timers.push(executeAt, id, target, method, args, stack);
|
56748 |
|
56749 | this._installTimerTimeout();
|
56750 | } else {
|
56751 | // find position to insert
|
56752 | var i = binarySearch(executeAt, this._timers);
|
56753 |
|
56754 | this._timers.splice(i, 0, executeAt, id, target, method, args, stack); // always reinstall since it could be out of sync
|
56755 |
|
56756 |
|
56757 | this._reinstallTimerTimeout();
|
56758 | }
|
56759 |
|
56760 | return id;
|
56761 | }
|
56762 |
|
56763 | _cancelLaterTimer(timer) {
|
56764 | for (var i = 1; i < this._timers.length; i += TIMERS_OFFSET) {
|
56765 | if (this._timers[i] === timer) {
|
56766 | this._timers.splice(i - 1, TIMERS_OFFSET);
|
56767 |
|
56768 | if (i === 1) {
|
56769 | this._reinstallTimerTimeout();
|
56770 | }
|
56771 |
|
56772 | return true;
|
56773 | }
|
56774 | }
|
56775 |
|
56776 | return false;
|
56777 | }
|
56778 | /**
|
56779 | Trigger an event. Supports up to two arguments. Designed around
|
56780 | triggering transition events from one run loop instance to the
|
56781 | next, which requires an argument for the instance and then
|
56782 | an argument for the next instance.
|
56783 | @private
|
56784 | @method _trigger
|
56785 | @param {String} eventName
|
56786 | @param {any} arg1
|
56787 | @param {any} arg2
|
56788 | */
|
56789 |
|
56790 |
|
56791 | _trigger(eventName, arg1, arg2) {
|
56792 | var callbacks = this._eventCallbacks[eventName];
|
56793 |
|
56794 | if (callbacks !== undefined) {
|
56795 | for (var i = 0; i < callbacks.length; i++) {
|
56796 | callbacks[i](arg1, arg2);
|
56797 | }
|
56798 | }
|
56799 | }
|
56800 |
|
56801 | _runExpiredTimers() {
|
56802 | this._timerTimeoutId = null;
|
56803 |
|
56804 | if (this._timers.length > 0) {
|
56805 | this.begin();
|
56806 |
|
56807 | this._scheduleExpiredTimers();
|
56808 |
|
56809 | this.end();
|
56810 | }
|
56811 | }
|
56812 |
|
56813 | _scheduleExpiredTimers() {
|
56814 | var timers = this._timers;
|
56815 | var i = 0;
|
56816 | var l = timers.length;
|
56817 | var defaultQueue = this._defaultQueue;
|
56818 |
|
56819 | var n = this._platform.now();
|
56820 |
|
56821 | for (; i < l; i += TIMERS_OFFSET) {
|
56822 | var executeAt = timers[i];
|
56823 |
|
56824 | if (executeAt > n) {
|
56825 | break;
|
56826 | }
|
56827 |
|
56828 | var args = timers[i + 4];
|
56829 |
|
56830 | if (args !== DISABLE_SCHEDULE) {
|
56831 | var target = timers[i + 2];
|
56832 | var method = timers[i + 3];
|
56833 | var stack = timers[i + 5];
|
56834 | this.currentInstance.schedule(defaultQueue, target, method, args, false, stack);
|
56835 | }
|
56836 | }
|
56837 |
|
56838 | timers.splice(0, i);
|
56839 |
|
56840 | this._installTimerTimeout();
|
56841 | }
|
56842 |
|
56843 | _reinstallTimerTimeout() {
|
56844 | this._clearTimerTimeout();
|
56845 |
|
56846 | this._installTimerTimeout();
|
56847 | }
|
56848 |
|
56849 | _clearTimerTimeout() {
|
56850 | if (this._timerTimeoutId === null) {
|
56851 | return;
|
56852 | }
|
56853 |
|
56854 | this._platform.clearTimeout(this._timerTimeoutId);
|
56855 |
|
56856 | this._timerTimeoutId = null;
|
56857 | }
|
56858 |
|
56859 | _installTimerTimeout() {
|
56860 | if (this._timers.length === 0) {
|
56861 | return;
|
56862 | }
|
56863 |
|
56864 | var minExpiresAt = this._timers[0];
|
56865 |
|
56866 | var n = this._platform.now();
|
56867 |
|
56868 | var wait = Math.max(0, minExpiresAt - n);
|
56869 | this._timerTimeoutId = this._platform.setTimeout(this._boundRunExpiredTimers, wait);
|
56870 | }
|
56871 |
|
56872 | _ensureInstance() {
|
56873 | var currentInstance = this.currentInstance;
|
56874 |
|
56875 | if (currentInstance === null) {
|
56876 | this._autorunStack = this.DEBUG ? new Error() : undefined;
|
56877 | currentInstance = this.begin();
|
56878 |
|
56879 | this._scheduleAutorun(this.queueNames[0]);
|
56880 | }
|
56881 |
|
56882 | return currentInstance;
|
56883 | }
|
56884 |
|
56885 | _scheduleAutorun(plannedNextQueue) {
|
56886 | autorunsCreatedCount++;
|
56887 | var next = this._platform.next;
|
56888 | var flush = this.options.flush;
|
56889 |
|
56890 | if (flush) {
|
56891 | flush(plannedNextQueue, next);
|
56892 | } else {
|
56893 | next();
|
56894 | }
|
56895 |
|
56896 | this._autorun = true;
|
56897 | }
|
56898 |
|
56899 | }
|
56900 |
|
56901 | Backburner.Queue = Queue;
|
56902 | Backburner.buildPlatform = buildPlatform;
|
56903 | Backburner.buildNext = buildNext;
|
56904 | var _default = Backburner;
|
56905 | _exports.default = _default;
|
56906 | });
|
56907 | define("dag-map", ["exports"], function (_exports) {
|
56908 | "use strict";
|
56909 |
|
56910 | Object.defineProperty(_exports, "__esModule", {
|
56911 | value: true
|
56912 | });
|
56913 | _exports.default = void 0;
|
56914 |
|
56915 | /**
|
56916 | * A topologically ordered map of key/value pairs with a simple API for adding constraints.
|
56917 | *
|
56918 | * Edges can forward reference keys that have not been added yet (the forward reference will
|
56919 | * map the key to undefined).
|
56920 | */
|
56921 | var DAG = function () {
|
56922 | function DAG() {
|
56923 | this._vertices = new Vertices();
|
56924 | }
|
56925 | /**
|
56926 | * Adds a key/value pair with dependencies on other key/value pairs.
|
56927 | *
|
56928 | * @public
|
56929 | * @param key The key of the vertex to be added.
|
56930 | * @param value The value of that vertex.
|
56931 | * @param before A key or array of keys of the vertices that must
|
56932 | * be visited before this vertex.
|
56933 | * @param after An string or array of strings with the keys of the
|
56934 | * vertices that must be after this vertex is visited.
|
56935 | */
|
56936 |
|
56937 |
|
56938 | DAG.prototype.add = function (key, value, before, after) {
|
56939 | if (!key) throw new Error('argument `key` is required');
|
56940 | var vertices = this._vertices;
|
56941 | var v = vertices.add(key);
|
56942 | v.val = value;
|
56943 |
|
56944 | if (before) {
|
56945 | if (typeof before === "string") {
|
56946 | vertices.addEdge(v, vertices.add(before));
|
56947 | } else {
|
56948 | for (var i = 0; i < before.length; i++) {
|
56949 | vertices.addEdge(v, vertices.add(before[i]));
|
56950 | }
|
56951 | }
|
56952 | }
|
56953 |
|
56954 | if (after) {
|
56955 | if (typeof after === "string") {
|
56956 | vertices.addEdge(vertices.add(after), v);
|
56957 | } else {
|
56958 | for (var i = 0; i < after.length; i++) {
|
56959 | vertices.addEdge(vertices.add(after[i]), v);
|
56960 | }
|
56961 | }
|
56962 | }
|
56963 | };
|
56964 | /**
|
56965 | * @deprecated please use add.
|
56966 | */
|
56967 |
|
56968 |
|
56969 | DAG.prototype.addEdges = function (key, value, before, after) {
|
56970 | this.add(key, value, before, after);
|
56971 | };
|
56972 | /**
|
56973 | * Visits key/value pairs in topological order.
|
56974 | *
|
56975 | * @public
|
56976 | * @param callback The function to be invoked with each key/value.
|
56977 | */
|
56978 |
|
56979 |
|
56980 | DAG.prototype.each = function (callback) {
|
56981 | this._vertices.walk(callback);
|
56982 | };
|
56983 | /**
|
56984 | * @deprecated please use each.
|
56985 | */
|
56986 |
|
56987 |
|
56988 | DAG.prototype.topsort = function (callback) {
|
56989 | this.each(callback);
|
56990 | };
|
56991 |
|
56992 | return DAG;
|
56993 | }();
|
56994 |
|
56995 | var _default = DAG;
|
56996 | /** @private */
|
56997 |
|
56998 | _exports.default = _default;
|
56999 |
|
57000 | var Vertices = function () {
|
57001 | function Vertices() {
|
57002 | this.length = 0;
|
57003 | this.stack = new IntStack();
|
57004 | this.path = new IntStack();
|
57005 | this.result = new IntStack();
|
57006 | }
|
57007 |
|
57008 | Vertices.prototype.add = function (key) {
|
57009 | if (!key) throw new Error("missing key");
|
57010 | var l = this.length | 0;
|
57011 | var vertex;
|
57012 |
|
57013 | for (var i = 0; i < l; i++) {
|
57014 | vertex = this[i];
|
57015 | if (vertex.key === key) return vertex;
|
57016 | }
|
57017 |
|
57018 | this.length = l + 1;
|
57019 | return this[l] = {
|
57020 | idx: l,
|
57021 | key: key,
|
57022 | val: undefined,
|
57023 | out: false,
|
57024 | flag: false,
|
57025 | length: 0
|
57026 | };
|
57027 | };
|
57028 |
|
57029 | Vertices.prototype.addEdge = function (v, w) {
|
57030 | this.check(v, w.key);
|
57031 | var l = w.length | 0;
|
57032 |
|
57033 | for (var i = 0; i < l; i++) {
|
57034 | if (w[i] === v.idx) return;
|
57035 | }
|
57036 |
|
57037 | w.length = l + 1;
|
57038 | w[l] = v.idx;
|
57039 | v.out = true;
|
57040 | };
|
57041 |
|
57042 | Vertices.prototype.walk = function (cb) {
|
57043 | this.reset();
|
57044 |
|
57045 | for (var i = 0; i < this.length; i++) {
|
57046 | var vertex = this[i];
|
57047 | if (vertex.out) continue;
|
57048 | this.visit(vertex, "");
|
57049 | }
|
57050 |
|
57051 | this.each(this.result, cb);
|
57052 | };
|
57053 |
|
57054 | Vertices.prototype.check = function (v, w) {
|
57055 | if (v.key === w) {
|
57056 | throw new Error("cycle detected: " + w + " <- " + w);
|
57057 | } // quick check
|
57058 |
|
57059 |
|
57060 | if (v.length === 0) return; // shallow check
|
57061 |
|
57062 | for (var i = 0; i < v.length; i++) {
|
57063 | var key = this[v[i]].key;
|
57064 |
|
57065 | if (key === w) {
|
57066 | throw new Error("cycle detected: " + w + " <- " + v.key + " <- " + w);
|
57067 | }
|
57068 | } // deep check
|
57069 |
|
57070 |
|
57071 | this.reset();
|
57072 | this.visit(v, w);
|
57073 |
|
57074 | if (this.path.length > 0) {
|
57075 | var msg_1 = "cycle detected: " + w;
|
57076 | this.each(this.path, function (key) {
|
57077 | msg_1 += " <- " + key;
|
57078 | });
|
57079 | throw new Error(msg_1);
|
57080 | }
|
57081 | };
|
57082 |
|
57083 | Vertices.prototype.reset = function () {
|
57084 | this.stack.length = 0;
|
57085 | this.path.length = 0;
|
57086 | this.result.length = 0;
|
57087 |
|
57088 | for (var i = 0, l = this.length; i < l; i++) {
|
57089 | this[i].flag = false;
|
57090 | }
|
57091 | };
|
57092 |
|
57093 | Vertices.prototype.visit = function (start, search) {
|
57094 | var _a = this,
|
57095 | stack = _a.stack,
|
57096 | path = _a.path,
|
57097 | result = _a.result;
|
57098 |
|
57099 | stack.push(start.idx);
|
57100 |
|
57101 | while (stack.length) {
|
57102 | var index = stack.pop() | 0;
|
57103 |
|
57104 | if (index >= 0) {
|
57105 | // enter
|
57106 | var vertex = this[index];
|
57107 | if (vertex.flag) continue;
|
57108 | vertex.flag = true;
|
57109 | path.push(index);
|
57110 | if (search === vertex.key) break; // push exit
|
57111 |
|
57112 | stack.push(~index);
|
57113 | this.pushIncoming(vertex);
|
57114 | } else {
|
57115 | // exit
|
57116 | path.pop();
|
57117 | result.push(~index);
|
57118 | }
|
57119 | }
|
57120 | };
|
57121 |
|
57122 | Vertices.prototype.pushIncoming = function (incomming) {
|
57123 | var stack = this.stack;
|
57124 |
|
57125 | for (var i = incomming.length - 1; i >= 0; i--) {
|
57126 | var index = incomming[i];
|
57127 |
|
57128 | if (!this[index].flag) {
|
57129 | stack.push(index);
|
57130 | }
|
57131 | }
|
57132 | };
|
57133 |
|
57134 | Vertices.prototype.each = function (indices, cb) {
|
57135 | for (var i = 0, l = indices.length; i < l; i++) {
|
57136 | var vertex = this[indices[i]];
|
57137 | cb(vertex.key, vertex.val);
|
57138 | }
|
57139 | };
|
57140 |
|
57141 | return Vertices;
|
57142 | }();
|
57143 | /** @private */
|
57144 |
|
57145 |
|
57146 | var IntStack = function () {
|
57147 | function IntStack() {
|
57148 | this.length = 0;
|
57149 | }
|
57150 |
|
57151 | IntStack.prototype.push = function (n) {
|
57152 | this[this.length++] = n | 0;
|
57153 | };
|
57154 |
|
57155 | IntStack.prototype.pop = function () {
|
57156 | return this[--this.length] | 0;
|
57157 | };
|
57158 |
|
57159 | return IntStack;
|
57160 | }();
|
57161 | });
|
57162 | define("ember-babel", ["exports"], function (_exports) {
|
57163 | "use strict";
|
57164 |
|
57165 | Object.defineProperty(_exports, "__esModule", {
|
57166 | value: true
|
57167 | });
|
57168 | _exports.wrapNativeSuper = wrapNativeSuper;
|
57169 | _exports.classCallCheck = classCallCheck;
|
57170 | _exports.inheritsLoose = inheritsLoose;
|
57171 | _exports.taggedTemplateLiteralLoose = taggedTemplateLiteralLoose;
|
57172 | _exports.createClass = createClass;
|
57173 | _exports.assertThisInitialized = assertThisInitialized;
|
57174 | _exports.possibleConstructorReturn = possibleConstructorReturn;
|
57175 | _exports.objectDestructuringEmpty = objectDestructuringEmpty;
|
57176 | _exports.createSuper = createSuper;
|
57177 | _exports.createForOfIteratorHelperLoose = createForOfIteratorHelperLoose;
|
57178 |
|
57179 | /* globals Reflect */
|
57180 | var setPrototypeOf = Object.setPrototypeOf;
|
57181 | var getPrototypeOf = Object.getPrototypeOf;
|
57182 | var hasReflectConstruct = typeof Reflect === 'object' && typeof Reflect.construct === 'function';
|
57183 | var nativeWrapperCache = new Map(); // Super minimal version of Babel's wrapNativeSuper. We only use this for
|
57184 | // extending Function, for ComputedDecoratorImpl and AliasDecoratorImpl. We know
|
57185 | // we will never directly create an instance of these classes so no need to
|
57186 | // include `construct` code or other helpers.
|
57187 |
|
57188 | function wrapNativeSuper(Class) {
|
57189 | if (nativeWrapperCache.has(Class)) {
|
57190 | return nativeWrapperCache.get(Class);
|
57191 | }
|
57192 |
|
57193 | function Wrapper() {}
|
57194 |
|
57195 | Wrapper.prototype = Object.create(Class.prototype, {
|
57196 | constructor: {
|
57197 | value: Wrapper,
|
57198 | enumerable: false,
|
57199 | writable: true,
|
57200 | configurable: true
|
57201 | }
|
57202 | });
|
57203 | nativeWrapperCache.set(Class, Wrapper);
|
57204 | return setPrototypeOf(Wrapper, Class);
|
57205 | }
|
57206 |
|
57207 | function classCallCheck(instance, Constructor) {
|
57208 | if (true
|
57209 | /* DEBUG */
|
57210 | ) {
|
57211 | if (!(instance instanceof Constructor)) {
|
57212 | throw new TypeError('Cannot call a class as a function');
|
57213 | }
|
57214 | }
|
57215 | }
|
57216 | /*
|
57217 | Overrides default `inheritsLoose` to _also_ call `Object.setPrototypeOf`.
|
57218 | This is needed so that we can use `loose` option with the
|
57219 | `@babel/plugin-transform-classes` (because we want simple assignment to the
|
57220 | prototype wherever possible) but also keep our constructor based prototypal
|
57221 | inheritance working properly
|
57222 | */
|
57223 |
|
57224 |
|
57225 | function inheritsLoose(subClass, superClass) {
|
57226 | if (true
|
57227 | /* DEBUG */
|
57228 | ) {
|
57229 | if (typeof superClass !== 'function' && superClass !== null) {
|
57230 | throw new TypeError('Super expression must either be null or a function');
|
57231 | }
|
57232 | }
|
57233 |
|
57234 | subClass.prototype = Object.create(superClass === null ? null : superClass.prototype, {
|
57235 | constructor: {
|
57236 | value: subClass,
|
57237 | writable: true,
|
57238 | configurable: true
|
57239 | }
|
57240 | });
|
57241 |
|
57242 | if (superClass !== null) {
|
57243 | setPrototypeOf(subClass, superClass);
|
57244 | }
|
57245 | }
|
57246 |
|
57247 | function taggedTemplateLiteralLoose(strings, raw) {
|
57248 | if (!raw) {
|
57249 | raw = strings.slice(0);
|
57250 | }
|
57251 |
|
57252 | strings.raw = raw;
|
57253 | return strings;
|
57254 | }
|
57255 |
|
57256 | function _defineProperties(target, props) {
|
57257 | for (var i = 0; i < props.length; i++) {
|
57258 | var descriptor = props[i];
|
57259 | descriptor.enumerable = descriptor.enumerable || false;
|
57260 | descriptor.configurable = true;
|
57261 | if ('value' in descriptor) descriptor.writable = true;
|
57262 | Object.defineProperty(target, descriptor.key, descriptor);
|
57263 | }
|
57264 | }
|
57265 | /*
|
57266 | Differs from default implementation by avoiding boolean coercion of
|
57267 | `protoProps` and `staticProps`.
|
57268 | */
|
57269 |
|
57270 |
|
57271 | function createClass(Constructor, protoProps, staticProps) {
|
57272 | if (protoProps !== null && protoProps !== undefined) {
|
57273 | _defineProperties(Constructor.prototype, protoProps);
|
57274 | }
|
57275 |
|
57276 | if (staticProps !== null && staticProps !== undefined) {
|
57277 | _defineProperties(Constructor, staticProps);
|
57278 | }
|
57279 |
|
57280 | return Constructor;
|
57281 | }
|
57282 |
|
57283 | function assertThisInitialized(self) {
|
57284 | if (true
|
57285 | /* DEBUG */
|
57286 | && self === void 0) {
|
57287 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
57288 | }
|
57289 |
|
57290 | return self;
|
57291 | }
|
57292 | /*
|
57293 | Adds `DEBUG` guard to error being thrown, and avoids boolean coercion of `call`.
|
57294 | */
|
57295 |
|
57296 |
|
57297 | function possibleConstructorReturn(self, call) {
|
57298 | if (typeof call === 'object' && call !== null || typeof call === 'function') {
|
57299 | return call;
|
57300 | }
|
57301 |
|
57302 | return assertThisInitialized(self);
|
57303 | }
|
57304 |
|
57305 | function objectDestructuringEmpty(obj) {
|
57306 | if (true
|
57307 | /* DEBUG */
|
57308 | && (obj === null || obj === undefined)) {
|
57309 | throw new TypeError('Cannot destructure undefined');
|
57310 | }
|
57311 | }
|
57312 | /*
|
57313 | Differs from default implementation by checking for _any_ `Reflect.construct`
|
57314 | (the default implementation tries to ensure that `Reflect.construct` is truly
|
57315 | the native one).
|
57316 |
|
57317 | Original source: https://github.com/babel/babel/blob/v7.9.2/packages/babel-helpers/src/helpers.js#L738-L757
|
57318 | */
|
57319 |
|
57320 |
|
57321 | function createSuper(Derived) {
|
57322 | return function () {
|
57323 | var Super = getPrototypeOf(Derived);
|
57324 | var result;
|
57325 |
|
57326 | if (hasReflectConstruct) {
|
57327 | // NOTE: This doesn't work if this.__proto__.constructor has been modified.
|
57328 | var NewTarget = getPrototypeOf(this).constructor;
|
57329 | result = Reflect.construct(Super, arguments, NewTarget);
|
57330 | } else {
|
57331 | result = Super.apply(this, arguments);
|
57332 | }
|
57333 |
|
57334 | return possibleConstructorReturn(this, result);
|
57335 | };
|
57336 | }
|
57337 | /*
|
57338 | Does not differ from default implementation.
|
57339 | */
|
57340 |
|
57341 |
|
57342 | function arrayLikeToArray(arr, len) {
|
57343 | if (len == null || len > arr.length) len = arr.length;
|
57344 | var arr2 = new Array(len);
|
57345 |
|
57346 | for (var i = 0; i < len; i++) {
|
57347 | arr2[i] = arr[i];
|
57348 | }
|
57349 |
|
57350 | return arr2;
|
57351 | }
|
57352 | /*
|
57353 | Does not differ from default implementation.
|
57354 | */
|
57355 |
|
57356 |
|
57357 | function unsupportedIterableToArray(o, minLen) {
|
57358 | if (!o) return;
|
57359 | if (typeof o === 'string') return arrayLikeToArray(o, minLen);
|
57360 | var n = Object.prototype.toString.call(o).slice(8, -1);
|
57361 | if (n === 'Object' && o.constructor) n = o.constructor.name;
|
57362 | if (n === 'Map' || n === 'Set') return Array.from(n);
|
57363 | if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
|
57364 | }
|
57365 | /*
|
57366 | Does not differ from default implementation.
|
57367 | */
|
57368 |
|
57369 |
|
57370 | function createForOfIteratorHelperLoose(o) {
|
57371 | var i = 0;
|
57372 |
|
57373 | if (typeof Symbol === 'undefined' || o[Symbol.iterator] == null) {
|
57374 | // Fallback for engines without symbol support
|
57375 | if (Array.isArray(o) || (o = unsupportedIterableToArray(o))) return function () {
|
57376 | if (i >= o.length) return {
|
57377 | done: true
|
57378 | };
|
57379 | return {
|
57380 | done: false,
|
57381 | value: o[i++]
|
57382 | };
|
57383 | };
|
57384 | throw new TypeError('Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
57385 | }
|
57386 |
|
57387 | i = o[Symbol.iterator]();
|
57388 | return i.next.bind(i);
|
57389 | }
|
57390 | });
|
57391 | define("ember-testing/index", ["exports", "ember-testing/lib/test", "ember-testing/lib/adapters/adapter", "ember-testing/lib/setup_for_testing", "ember-testing/lib/adapters/qunit", "ember-testing/lib/support", "ember-testing/lib/ext/application", "ember-testing/lib/ext/rsvp", "ember-testing/lib/helpers", "ember-testing/lib/initializers"], function (_exports, _test, _adapter, _setup_for_testing, _qunit, _support, _application, _rsvp, _helpers, _initializers) {
|
57392 | "use strict";
|
57393 |
|
57394 | Object.defineProperty(_exports, "__esModule", {
|
57395 | value: true
|
57396 | });
|
57397 | Object.defineProperty(_exports, "Test", {
|
57398 | enumerable: true,
|
57399 | get: function () {
|
57400 | return _test.default;
|
57401 | }
|
57402 | });
|
57403 | Object.defineProperty(_exports, "Adapter", {
|
57404 | enumerable: true,
|
57405 | get: function () {
|
57406 | return _adapter.default;
|
57407 | }
|
57408 | });
|
57409 | Object.defineProperty(_exports, "setupForTesting", {
|
57410 | enumerable: true,
|
57411 | get: function () {
|
57412 | return _setup_for_testing.default;
|
57413 | }
|
57414 | });
|
57415 | Object.defineProperty(_exports, "QUnitAdapter", {
|
57416 | enumerable: true,
|
57417 | get: function () {
|
57418 | return _qunit.default;
|
57419 | }
|
57420 | });
|
57421 | });
|
57422 | define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runtime"], function (_exports, _runtime) {
|
57423 | "use strict";
|
57424 |
|
57425 | Object.defineProperty(_exports, "__esModule", {
|
57426 | value: true
|
57427 | });
|
57428 | _exports.default = void 0;
|
57429 |
|
57430 | function K() {
|
57431 | return this;
|
57432 | }
|
57433 | /**
|
57434 | @module @ember/test
|
57435 | */
|
57436 |
|
57437 | /**
|
57438 | The primary purpose of this class is to create hooks that can be implemented
|
57439 | by an adapter for various test frameworks.
|
57440 |
|
57441 | @class TestAdapter
|
57442 | @public
|
57443 | */
|
57444 |
|
57445 |
|
57446 | var _default = _runtime.Object.extend({
|
57447 | /**
|
57448 | This callback will be called whenever an async operation is about to start.
|
57449 | Override this to call your framework's methods that handle async
|
57450 | operations.
|
57451 | @public
|
57452 | @method asyncStart
|
57453 | */
|
57454 | asyncStart: K,
|
57455 |
|
57456 | /**
|
57457 | This callback will be called whenever an async operation has completed.
|
57458 | @public
|
57459 | @method asyncEnd
|
57460 | */
|
57461 | asyncEnd: K,
|
57462 |
|
57463 | /**
|
57464 | Override this method with your testing framework's false assertion.
|
57465 | This function is called whenever an exception occurs causing the testing
|
57466 | promise to fail.
|
57467 | QUnit example:
|
57468 | ```javascript
|
57469 | exception: function(error) {
|
57470 | ok(false, error);
|
57471 | };
|
57472 | ```
|
57473 | @public
|
57474 | @method exception
|
57475 | @param {String} error The exception to be raised.
|
57476 | */
|
57477 | exception(error) {
|
57478 | throw error;
|
57479 | }
|
57480 |
|
57481 | });
|
57482 |
|
57483 | _exports.default = _default;
|
57484 | });
|
57485 | define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils", "ember-testing/lib/adapters/adapter"], function (_exports, _utils, _adapter) {
|
57486 | "use strict";
|
57487 |
|
57488 | Object.defineProperty(_exports, "__esModule", {
|
57489 | value: true
|
57490 | });
|
57491 | _exports.default = void 0;
|
57492 |
|
57493 | /* globals QUnit */
|
57494 |
|
57495 | /**
|
57496 | @module ember
|
57497 | */
|
57498 |
|
57499 | /**
|
57500 | This class implements the methods defined by TestAdapter for the
|
57501 | QUnit testing framework.
|
57502 |
|
57503 | @class QUnitAdapter
|
57504 | @namespace Ember.Test
|
57505 | @extends TestAdapter
|
57506 | @public
|
57507 | */
|
57508 | var _default = _adapter.default.extend({
|
57509 | init() {
|
57510 | this.doneCallbacks = [];
|
57511 | },
|
57512 |
|
57513 | asyncStart() {
|
57514 | if (typeof QUnit.stop === 'function') {
|
57515 | // very old QUnit version
|
57516 | QUnit.stop();
|
57517 | } else {
|
57518 | this.doneCallbacks.push(QUnit.config.current ? QUnit.config.current.assert.async() : null);
|
57519 | }
|
57520 | },
|
57521 |
|
57522 | asyncEnd() {
|
57523 | // checking for QUnit.stop here (even though we _need_ QUnit.start) because
|
57524 | // QUnit.start() still exists in QUnit 2.x (it just throws an error when calling
|
57525 | // inside a test context)
|
57526 | if (typeof QUnit.stop === 'function') {
|
57527 | QUnit.start();
|
57528 | } else {
|
57529 | var done = this.doneCallbacks.pop(); // This can be null if asyncStart() was called outside of a test
|
57530 |
|
57531 | if (done) {
|
57532 | done();
|
57533 | }
|
57534 | }
|
57535 | },
|
57536 |
|
57537 | exception(error) {
|
57538 | QUnit.config.current.assert.ok(false, (0, _utils.inspect)(error));
|
57539 | }
|
57540 |
|
57541 | });
|
57542 |
|
57543 | _exports.default = _default;
|
57544 | });
|
57545 | define("ember-testing/lib/events", ["exports", "@ember/runloop", "@ember/polyfills", "ember-testing/lib/helpers/-is-form-control"], function (_exports, _runloop, _polyfills, _isFormControl) {
|
57546 | "use strict";
|
57547 |
|
57548 | Object.defineProperty(_exports, "__esModule", {
|
57549 | value: true
|
57550 | });
|
57551 | _exports.focus = focus;
|
57552 | _exports.fireEvent = fireEvent;
|
57553 | var DEFAULT_EVENT_OPTIONS = {
|
57554 | canBubble: true,
|
57555 | cancelable: true
|
57556 | };
|
57557 | var KEYBOARD_EVENT_TYPES = ['keydown', 'keypress', 'keyup'];
|
57558 | var MOUSE_EVENT_TYPES = ['click', 'mousedown', 'mouseup', 'dblclick', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover'];
|
57559 |
|
57560 | function focus(el) {
|
57561 | if (!el) {
|
57562 | return;
|
57563 | }
|
57564 |
|
57565 | if (el.isContentEditable || (0, _isFormControl.default)(el)) {
|
57566 | var type = el.getAttribute('type');
|
57567 |
|
57568 | if (type !== 'checkbox' && type !== 'radio' && type !== 'hidden') {
|
57569 | (0, _runloop.run)(null, function () {
|
57570 | var browserIsNotFocused = document.hasFocus && !document.hasFocus(); // makes `document.activeElement` be `element`. If the browser is focused, it also fires a focus event
|
57571 |
|
57572 | el.focus(); // Firefox does not trigger the `focusin` event if the window
|
57573 | // does not have focus. If the document does not have focus then
|
57574 | // fire `focusin` event as well.
|
57575 |
|
57576 | if (browserIsNotFocused) {
|
57577 | // if the browser is not focused the previous `el.focus()` didn't fire an event, so we simulate it
|
57578 | fireEvent(el, 'focus', {
|
57579 | bubbles: false
|
57580 | });
|
57581 | fireEvent(el, 'focusin');
|
57582 | }
|
57583 | });
|
57584 | }
|
57585 | }
|
57586 | }
|
57587 |
|
57588 | function fireEvent(element, type, options = {}) {
|
57589 | if (!element) {
|
57590 | return;
|
57591 | }
|
57592 |
|
57593 | var event;
|
57594 |
|
57595 | if (KEYBOARD_EVENT_TYPES.indexOf(type) > -1) {
|
57596 | event = buildKeyboardEvent(type, options);
|
57597 | } else if (MOUSE_EVENT_TYPES.indexOf(type) > -1) {
|
57598 | var rect = element.getBoundingClientRect();
|
57599 | var x = rect.left + 1;
|
57600 | var y = rect.top + 1;
|
57601 | var simulatedCoordinates = {
|
57602 | screenX: x + 5,
|
57603 | screenY: y + 95,
|
57604 | clientX: x,
|
57605 | clientY: y
|
57606 | };
|
57607 | event = buildMouseEvent(type, (0, _polyfills.assign)(simulatedCoordinates, options));
|
57608 | } else {
|
57609 | event = buildBasicEvent(type, options);
|
57610 | }
|
57611 |
|
57612 | element.dispatchEvent(event);
|
57613 | }
|
57614 |
|
57615 | function buildBasicEvent(type, options = {}) {
|
57616 | var event = document.createEvent('Events'); // Event.bubbles is read only
|
57617 |
|
57618 | var bubbles = options.bubbles !== undefined ? options.bubbles : true;
|
57619 | var cancelable = options.cancelable !== undefined ? options.cancelable : true;
|
57620 | delete options.bubbles;
|
57621 | delete options.cancelable;
|
57622 | event.initEvent(type, bubbles, cancelable);
|
57623 | (0, _polyfills.assign)(event, options);
|
57624 | return event;
|
57625 | }
|
57626 |
|
57627 | function buildMouseEvent(type, options = {}) {
|
57628 | var event;
|
57629 |
|
57630 | try {
|
57631 | event = document.createEvent('MouseEvents');
|
57632 | var eventOpts = (0, _polyfills.assign)({}, DEFAULT_EVENT_OPTIONS, options);
|
57633 | event.initMouseEvent(type, eventOpts.canBubble, eventOpts.cancelable, window, eventOpts.detail, eventOpts.screenX, eventOpts.screenY, eventOpts.clientX, eventOpts.clientY, eventOpts.ctrlKey, eventOpts.altKey, eventOpts.shiftKey, eventOpts.metaKey, eventOpts.button, eventOpts.relatedTarget);
|
57634 | } catch (e) {
|
57635 | event = buildBasicEvent(type, options);
|
57636 | }
|
57637 |
|
57638 | return event;
|
57639 | }
|
57640 |
|
57641 | function buildKeyboardEvent(type, options = {}) {
|
57642 | var event;
|
57643 |
|
57644 | try {
|
57645 | event = document.createEvent('KeyEvents');
|
57646 | var eventOpts = (0, _polyfills.assign)({}, DEFAULT_EVENT_OPTIONS, options);
|
57647 | event.initKeyEvent(type, eventOpts.canBubble, eventOpts.cancelable, window, eventOpts.ctrlKey, eventOpts.altKey, eventOpts.shiftKey, eventOpts.metaKey, eventOpts.keyCode, eventOpts.charCode);
|
57648 | } catch (e) {
|
57649 | event = buildBasicEvent(type, options);
|
57650 | }
|
57651 |
|
57652 | return event;
|
57653 | }
|
57654 | });
|
57655 | define("ember-testing/lib/ext/application", ["@ember/application", "ember-testing/lib/setup_for_testing", "ember-testing/lib/test/helpers", "ember-testing/lib/test/promise", "ember-testing/lib/test/run", "ember-testing/lib/test/on_inject_helpers", "ember-testing/lib/test/adapter"], function (_application, _setup_for_testing, _helpers, _promise, _run, _on_inject_helpers, _adapter) {
|
57656 | "use strict";
|
57657 |
|
57658 | _application.default.reopen({
|
57659 | /**
|
57660 | This property contains the testing helpers for the current application. These
|
57661 | are created once you call `injectTestHelpers` on your `Application`
|
57662 | instance. The included helpers are also available on the `window` object by
|
57663 | default, but can be used from this object on the individual application also.
|
57664 | @property testHelpers
|
57665 | @type {Object}
|
57666 | @default {}
|
57667 | @public
|
57668 | */
|
57669 | testHelpers: {},
|
57670 |
|
57671 | /**
|
57672 | This property will contain the original methods that were registered
|
57673 | on the `helperContainer` before `injectTestHelpers` is called.
|
57674 | When `removeTestHelpers` is called, these methods are restored to the
|
57675 | `helperContainer`.
|
57676 | @property originalMethods
|
57677 | @type {Object}
|
57678 | @default {}
|
57679 | @private
|
57680 | @since 1.3.0
|
57681 | */
|
57682 | originalMethods: {},
|
57683 |
|
57684 | /**
|
57685 | This property indicates whether or not this application is currently in
|
57686 | testing mode. This is set when `setupForTesting` is called on the current
|
57687 | application.
|
57688 | @property testing
|
57689 | @type {Boolean}
|
57690 | @default false
|
57691 | @since 1.3.0
|
57692 | @public
|
57693 | */
|
57694 | testing: false,
|
57695 |
|
57696 | /**
|
57697 | This hook defers the readiness of the application, so that you can start
|
57698 | the app when your tests are ready to run. It also sets the router's
|
57699 | location to 'none', so that the window's location will not be modified
|
57700 | (preventing both accidental leaking of state between tests and interference
|
57701 | with your testing framework). `setupForTesting` should only be called after
|
57702 | setting a custom `router` class (for example `App.Router = Router.extend(`).
|
57703 | Example:
|
57704 | ```
|
57705 | App.setupForTesting();
|
57706 | ```
|
57707 | @method setupForTesting
|
57708 | @public
|
57709 | */
|
57710 | setupForTesting() {
|
57711 | (0, _setup_for_testing.default)();
|
57712 | this.testing = true;
|
57713 | this.resolveRegistration('router:main').reopen({
|
57714 | location: 'none'
|
57715 | });
|
57716 | },
|
57717 |
|
57718 | /**
|
57719 | This will be used as the container to inject the test helpers into. By
|
57720 | default the helpers are injected into `window`.
|
57721 | @property helperContainer
|
57722 | @type {Object} The object to be used for test helpers.
|
57723 | @default window
|
57724 | @since 1.2.0
|
57725 | @private
|
57726 | */
|
57727 | helperContainer: null,
|
57728 |
|
57729 | /**
|
57730 | This injects the test helpers into the `helperContainer` object. If an object is provided
|
57731 | it will be used as the helperContainer. If `helperContainer` is not set it will default
|
57732 | to `window`. If a function of the same name has already been defined it will be cached
|
57733 | (so that it can be reset if the helper is removed with `unregisterHelper` or
|
57734 | `removeTestHelpers`).
|
57735 | Any callbacks registered with `onInjectHelpers` will be called once the
|
57736 | helpers have been injected.
|
57737 | Example:
|
57738 | ```
|
57739 | App.injectTestHelpers();
|
57740 | ```
|
57741 | @method injectTestHelpers
|
57742 | @public
|
57743 | */
|
57744 | injectTestHelpers(helperContainer) {
|
57745 | if (helperContainer) {
|
57746 | this.helperContainer = helperContainer;
|
57747 | } else {
|
57748 | this.helperContainer = window;
|
57749 | }
|
57750 |
|
57751 | this.reopen({
|
57752 | willDestroy() {
|
57753 | this._super(...arguments);
|
57754 |
|
57755 | this.removeTestHelpers();
|
57756 | }
|
57757 |
|
57758 | });
|
57759 | this.testHelpers = {};
|
57760 |
|
57761 | for (var name in _helpers.helpers) {
|
57762 | this.originalMethods[name] = this.helperContainer[name];
|
57763 | this.testHelpers[name] = this.helperContainer[name] = helper(this, name);
|
57764 | protoWrap(_promise.default.prototype, name, helper(this, name), _helpers.helpers[name].meta.wait);
|
57765 | }
|
57766 |
|
57767 | (0, _on_inject_helpers.invokeInjectHelpersCallbacks)(this);
|
57768 | },
|
57769 |
|
57770 | /**
|
57771 | This removes all helpers that have been registered, and resets and functions
|
57772 | that were overridden by the helpers.
|
57773 | Example:
|
57774 | ```javascript
|
57775 | App.removeTestHelpers();
|
57776 | ```
|
57777 | @public
|
57778 | @method removeTestHelpers
|
57779 | */
|
57780 | removeTestHelpers() {
|
57781 | if (!this.helperContainer) {
|
57782 | return;
|
57783 | }
|
57784 |
|
57785 | for (var name in _helpers.helpers) {
|
57786 | this.helperContainer[name] = this.originalMethods[name];
|
57787 | delete _promise.default.prototype[name];
|
57788 | delete this.testHelpers[name];
|
57789 | delete this.originalMethods[name];
|
57790 | }
|
57791 | }
|
57792 |
|
57793 | }); // This method is no longer needed
|
57794 | // But still here for backwards compatibility
|
57795 | // of helper chaining
|
57796 |
|
57797 |
|
57798 | function protoWrap(proto, name, callback, isAsync) {
|
57799 | proto[name] = function (...args) {
|
57800 | if (isAsync) {
|
57801 | return callback.apply(this, args);
|
57802 | } else {
|
57803 | return this.then(function () {
|
57804 | return callback.apply(this, args);
|
57805 | });
|
57806 | }
|
57807 | };
|
57808 | }
|
57809 |
|
57810 | function helper(app, name) {
|
57811 | var fn = _helpers.helpers[name].method;
|
57812 | var meta = _helpers.helpers[name].meta;
|
57813 |
|
57814 | if (!meta.wait) {
|
57815 | return (...args) => fn.apply(app, [app, ...args]);
|
57816 | }
|
57817 |
|
57818 | return (...args) => {
|
57819 | var lastPromise = (0, _run.default)(() => (0, _promise.resolve)((0, _promise.getLastPromise)())); // wait for last helper's promise to resolve and then
|
57820 | // execute. To be safe, we need to tell the adapter we're going
|
57821 | // asynchronous here, because fn may not be invoked before we
|
57822 | // return.
|
57823 |
|
57824 | (0, _adapter.asyncStart)();
|
57825 | return lastPromise.then(() => fn.apply(app, [app, ...args])).finally(_adapter.asyncEnd);
|
57826 | };
|
57827 | }
|
57828 | });
|
57829 | define("ember-testing/lib/ext/rsvp", ["exports", "@ember/-internals/runtime", "@ember/runloop", "@ember/debug", "ember-testing/lib/test/adapter"], function (_exports, _runtime, _runloop, _debug, _adapter) {
|
57830 | "use strict";
|
57831 |
|
57832 | Object.defineProperty(_exports, "__esModule", {
|
57833 | value: true
|
57834 | });
|
57835 | _exports.default = void 0;
|
57836 |
|
57837 | _runtime.RSVP.configure('async', function (callback, promise) {
|
57838 | // if schedule will cause autorun, we need to inform adapter
|
57839 | if ((0, _debug.isTesting)() && !_runloop.backburner.currentInstance) {
|
57840 | (0, _adapter.asyncStart)();
|
57841 |
|
57842 | _runloop.backburner.schedule('actions', () => {
|
57843 | (0, _adapter.asyncEnd)();
|
57844 | callback(promise);
|
57845 | });
|
57846 | } else {
|
57847 | _runloop.backburner.schedule('actions', () => callback(promise));
|
57848 | }
|
57849 | });
|
57850 |
|
57851 | var _default = _runtime.RSVP;
|
57852 | _exports.default = _default;
|
57853 | });
|
57854 | define("ember-testing/lib/helpers", ["ember-testing/lib/test/helpers", "ember-testing/lib/helpers/and_then", "ember-testing/lib/helpers/click", "ember-testing/lib/helpers/current_path", "ember-testing/lib/helpers/current_route_name", "ember-testing/lib/helpers/current_url", "ember-testing/lib/helpers/fill_in", "ember-testing/lib/helpers/find", "ember-testing/lib/helpers/find_with_assert", "ember-testing/lib/helpers/key_event", "ember-testing/lib/helpers/pause_test", "ember-testing/lib/helpers/trigger_event", "ember-testing/lib/helpers/visit", "ember-testing/lib/helpers/wait"], function (_helpers, _and_then, _click, _current_path, _current_route_name, _current_url, _fill_in, _find, _find_with_assert, _key_event, _pause_test, _trigger_event, _visit, _wait) {
|
57855 | "use strict";
|
57856 |
|
57857 | (0, _helpers.registerAsyncHelper)('visit', _visit.default);
|
57858 | (0, _helpers.registerAsyncHelper)('click', _click.default);
|
57859 | (0, _helpers.registerAsyncHelper)('keyEvent', _key_event.default);
|
57860 | (0, _helpers.registerAsyncHelper)('fillIn', _fill_in.default);
|
57861 | (0, _helpers.registerAsyncHelper)('wait', _wait.default);
|
57862 | (0, _helpers.registerAsyncHelper)('andThen', _and_then.default);
|
57863 | (0, _helpers.registerAsyncHelper)('pauseTest', _pause_test.pauseTest);
|
57864 | (0, _helpers.registerAsyncHelper)('triggerEvent', _trigger_event.default);
|
57865 | (0, _helpers.registerHelper)('find', _find.default);
|
57866 | (0, _helpers.registerHelper)('findWithAssert', _find_with_assert.default);
|
57867 | (0, _helpers.registerHelper)('currentRouteName', _current_route_name.default);
|
57868 | (0, _helpers.registerHelper)('currentPath', _current_path.default);
|
57869 | (0, _helpers.registerHelper)('currentURL', _current_url.default);
|
57870 | (0, _helpers.registerHelper)('resumeTest', _pause_test.resumeTest);
|
57871 | });
|
57872 | define("ember-testing/lib/helpers/-is-form-control", ["exports"], function (_exports) {
|
57873 | "use strict";
|
57874 |
|
57875 | Object.defineProperty(_exports, "__esModule", {
|
57876 | value: true
|
57877 | });
|
57878 | _exports.default = isFormControl;
|
57879 | var FORM_CONTROL_TAGS = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'];
|
57880 | /**
|
57881 | @private
|
57882 | @param {Element} element the element to check
|
57883 | @returns {boolean} `true` when the element is a form control, `false` otherwise
|
57884 | */
|
57885 |
|
57886 | function isFormControl(element) {
|
57887 | var {
|
57888 | tagName,
|
57889 | type
|
57890 | } = element;
|
57891 |
|
57892 | if (type === 'hidden') {
|
57893 | return false;
|
57894 | }
|
57895 |
|
57896 | return FORM_CONTROL_TAGS.indexOf(tagName) > -1;
|
57897 | }
|
57898 | });
|
57899 | define("ember-testing/lib/helpers/and_then", ["exports"], function (_exports) {
|
57900 | "use strict";
|
57901 |
|
57902 | Object.defineProperty(_exports, "__esModule", {
|
57903 | value: true
|
57904 | });
|
57905 | _exports.default = andThen;
|
57906 |
|
57907 | function andThen(app, callback) {
|
57908 | return app.testHelpers.wait(callback(app));
|
57909 | }
|
57910 | });
|
57911 | define("ember-testing/lib/helpers/click", ["exports", "ember-testing/lib/events"], function (_exports, _events) {
|
57912 | "use strict";
|
57913 |
|
57914 | Object.defineProperty(_exports, "__esModule", {
|
57915 | value: true
|
57916 | });
|
57917 | _exports.default = click;
|
57918 |
|
57919 | /**
|
57920 | @module ember
|
57921 | */
|
57922 |
|
57923 | /**
|
57924 | Clicks an element and triggers any actions triggered by the element's `click`
|
57925 | event.
|
57926 |
|
57927 | Example:
|
57928 |
|
57929 | ```javascript
|
57930 | click('.some-jQuery-selector').then(function() {
|
57931 | // assert something
|
57932 | });
|
57933 | ```
|
57934 |
|
57935 | @method click
|
57936 | @param {String} selector jQuery selector for finding element on the DOM
|
57937 | @param {Object} context A DOM Element, Document, or jQuery to use as context
|
57938 | @return {RSVP.Promise<undefined>}
|
57939 | @public
|
57940 | */
|
57941 | function click(app, selector, context) {
|
57942 | var $el = app.testHelpers.findWithAssert(selector, context);
|
57943 | var el = $el[0];
|
57944 | (0, _events.fireEvent)(el, 'mousedown');
|
57945 | (0, _events.focus)(el);
|
57946 | (0, _events.fireEvent)(el, 'mouseup');
|
57947 | (0, _events.fireEvent)(el, 'click');
|
57948 | return app.testHelpers.wait();
|
57949 | }
|
57950 | });
|
57951 | define("ember-testing/lib/helpers/current_path", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
57952 | "use strict";
|
57953 |
|
57954 | Object.defineProperty(_exports, "__esModule", {
|
57955 | value: true
|
57956 | });
|
57957 | _exports.default = currentPath;
|
57958 |
|
57959 | /**
|
57960 | @module ember
|
57961 | */
|
57962 |
|
57963 | /**
|
57964 | Returns the current path.
|
57965 |
|
57966 | Example:
|
57967 |
|
57968 | ```javascript
|
57969 | function validateURL() {
|
57970 | equal(currentPath(), 'some.path.index', "correct path was transitioned into.");
|
57971 | }
|
57972 |
|
57973 | click('#some-link-id').then(validateURL);
|
57974 | ```
|
57975 |
|
57976 | @method currentPath
|
57977 | @return {Object} The currently active path.
|
57978 | @since 1.5.0
|
57979 | @public
|
57980 | */
|
57981 | function currentPath(app) {
|
57982 | var routingService = app.__container__.lookup('service:-routing');
|
57983 |
|
57984 | return (0, _metal.get)(routingService, 'currentPath');
|
57985 | }
|
57986 | });
|
57987 | define("ember-testing/lib/helpers/current_route_name", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
57988 | "use strict";
|
57989 |
|
57990 | Object.defineProperty(_exports, "__esModule", {
|
57991 | value: true
|
57992 | });
|
57993 | _exports.default = currentRouteName;
|
57994 |
|
57995 | /**
|
57996 | @module ember
|
57997 | */
|
57998 |
|
57999 | /**
|
58000 | Returns the currently active route name.
|
58001 |
|
58002 | Example:
|
58003 |
|
58004 | ```javascript
|
58005 | function validateRouteName() {
|
58006 | equal(currentRouteName(), 'some.path', "correct route was transitioned into.");
|
58007 | }
|
58008 | visit('/some/path').then(validateRouteName)
|
58009 | ```
|
58010 |
|
58011 | @method currentRouteName
|
58012 | @return {Object} The name of the currently active route.
|
58013 | @since 1.5.0
|
58014 | @public
|
58015 | */
|
58016 | function currentRouteName(app) {
|
58017 | var routingService = app.__container__.lookup('service:-routing');
|
58018 |
|
58019 | return (0, _metal.get)(routingService, 'currentRouteName');
|
58020 | }
|
58021 | });
|
58022 | define("ember-testing/lib/helpers/current_url", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
58023 | "use strict";
|
58024 |
|
58025 | Object.defineProperty(_exports, "__esModule", {
|
58026 | value: true
|
58027 | });
|
58028 | _exports.default = currentURL;
|
58029 |
|
58030 | /**
|
58031 | @module ember
|
58032 | */
|
58033 |
|
58034 | /**
|
58035 | Returns the current URL.
|
58036 |
|
58037 | Example:
|
58038 |
|
58039 | ```javascript
|
58040 | function validateURL() {
|
58041 | equal(currentURL(), '/some/path', "correct URL was transitioned into.");
|
58042 | }
|
58043 |
|
58044 | click('#some-link-id').then(validateURL);
|
58045 | ```
|
58046 |
|
58047 | @method currentURL
|
58048 | @return {Object} The currently active URL.
|
58049 | @since 1.5.0
|
58050 | @public
|
58051 | */
|
58052 | function currentURL(app) {
|
58053 | var router = app.__container__.lookup('router:main');
|
58054 |
|
58055 | return (0, _metal.get)(router, 'location').getURL();
|
58056 | }
|
58057 | });
|
58058 | define("ember-testing/lib/helpers/fill_in", ["exports", "ember-testing/lib/events", "ember-testing/lib/helpers/-is-form-control"], function (_exports, _events, _isFormControl) {
|
58059 | "use strict";
|
58060 |
|
58061 | Object.defineProperty(_exports, "__esModule", {
|
58062 | value: true
|
58063 | });
|
58064 | _exports.default = fillIn;
|
58065 |
|
58066 | /**
|
58067 | @module ember
|
58068 | */
|
58069 |
|
58070 | /**
|
58071 | Fills in an input element with some text.
|
58072 |
|
58073 | Example:
|
58074 |
|
58075 | ```javascript
|
58076 | fillIn('#email', 'you@example.com').then(function() {
|
58077 | // assert something
|
58078 | });
|
58079 | ```
|
58080 |
|
58081 | @method fillIn
|
58082 | @param {String} selector jQuery selector finding an input element on the DOM
|
58083 | to fill text with
|
58084 | @param {String} text text to place inside the input element
|
58085 | @return {RSVP.Promise<undefined>}
|
58086 | @public
|
58087 | */
|
58088 | function fillIn(app, selector, contextOrText, text) {
|
58089 | var $el, el, context;
|
58090 |
|
58091 | if (text === undefined) {
|
58092 | text = contextOrText;
|
58093 | } else {
|
58094 | context = contextOrText;
|
58095 | }
|
58096 |
|
58097 | $el = app.testHelpers.findWithAssert(selector, context);
|
58098 | el = $el[0];
|
58099 | (0, _events.focus)(el);
|
58100 |
|
58101 | if ((0, _isFormControl.default)(el)) {
|
58102 | el.value = text;
|
58103 | } else {
|
58104 | el.innerHTML = text;
|
58105 | }
|
58106 |
|
58107 | (0, _events.fireEvent)(el, 'input');
|
58108 | (0, _events.fireEvent)(el, 'change');
|
58109 | return app.testHelpers.wait();
|
58110 | }
|
58111 | });
|
58112 | define("ember-testing/lib/helpers/find", ["exports", "@ember/-internals/metal", "@ember/debug", "@ember/-internals/views"], function (_exports, _metal, _debug, _views) {
|
58113 | "use strict";
|
58114 |
|
58115 | Object.defineProperty(_exports, "__esModule", {
|
58116 | value: true
|
58117 | });
|
58118 | _exports.default = find;
|
58119 |
|
58120 | /**
|
58121 | @module ember
|
58122 | */
|
58123 |
|
58124 | /**
|
58125 | Finds an element in the context of the app's container element. A simple alias
|
58126 | for `app.$(selector)`.
|
58127 |
|
58128 | Example:
|
58129 |
|
58130 | ```javascript
|
58131 | var $el = find('.my-selector');
|
58132 | ```
|
58133 |
|
58134 | With the `context` param:
|
58135 |
|
58136 | ```javascript
|
58137 | var $el = find('.my-selector', '.parent-element-class');
|
58138 | ```
|
58139 |
|
58140 | @method find
|
58141 | @param {String} selector jQuery selector for element lookup
|
58142 | @param {String} [context] (optional) jQuery selector that will limit the selector
|
58143 | argument to find only within the context's children
|
58144 | @return {Object} DOM element representing the results of the query
|
58145 | @public
|
58146 | */
|
58147 | function find(app, selector, context) {
|
58148 | if (_views.jQueryDisabled) {
|
58149 | (true && !(false) && (0, _debug.assert)('If jQuery is disabled, please import and use helpers from @ember/test-helpers [https://github.com/emberjs/ember-test-helpers]. Note: `find` is not an available helper.'));
|
58150 | }
|
58151 |
|
58152 | var $el;
|
58153 | context = context || (0, _metal.get)(app, 'rootElement');
|
58154 | $el = app.$(selector, context);
|
58155 | return $el;
|
58156 | }
|
58157 | });
|
58158 | define("ember-testing/lib/helpers/find_with_assert", ["exports"], function (_exports) {
|
58159 | "use strict";
|
58160 |
|
58161 | Object.defineProperty(_exports, "__esModule", {
|
58162 | value: true
|
58163 | });
|
58164 | _exports.default = findWithAssert;
|
58165 |
|
58166 | /**
|
58167 | @module ember
|
58168 | */
|
58169 |
|
58170 | /**
|
58171 | Like `find`, but throws an error if the element selector returns no results.
|
58172 |
|
58173 | Example:
|
58174 |
|
58175 | ```javascript
|
58176 | var $el = findWithAssert('.doesnt-exist'); // throws error
|
58177 | ```
|
58178 |
|
58179 | With the `context` param:
|
58180 |
|
58181 | ```javascript
|
58182 | var $el = findWithAssert('.selector-id', '.parent-element-class'); // assert will pass
|
58183 | ```
|
58184 |
|
58185 | @method findWithAssert
|
58186 | @param {String} selector jQuery selector string for finding an element within
|
58187 | the DOM
|
58188 | @param {String} [context] (optional) jQuery selector that will limit the
|
58189 | selector argument to find only within the context's children
|
58190 | @return {Object} jQuery object representing the results of the query
|
58191 | @throws {Error} throws error if object returned has a length of 0
|
58192 | @public
|
58193 | */
|
58194 | function findWithAssert(app, selector, context) {
|
58195 | var $el = app.testHelpers.find(selector, context);
|
58196 |
|
58197 | if ($el.length === 0) {
|
58198 | throw new Error('Element ' + selector + ' not found.');
|
58199 | }
|
58200 |
|
58201 | return $el;
|
58202 | }
|
58203 | });
|
58204 | define("ember-testing/lib/helpers/key_event", ["exports"], function (_exports) {
|
58205 | "use strict";
|
58206 |
|
58207 | Object.defineProperty(_exports, "__esModule", {
|
58208 | value: true
|
58209 | });
|
58210 | _exports.default = keyEvent;
|
58211 |
|
58212 | /**
|
58213 | @module ember
|
58214 | */
|
58215 |
|
58216 | /**
|
58217 | Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
|
58218 | Example:
|
58219 | ```javascript
|
58220 | keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() {
|
58221 | // assert something
|
58222 | });
|
58223 | ```
|
58224 | @method keyEvent
|
58225 | @param {String} selector jQuery selector for finding element on the DOM
|
58226 | @param {String} type the type of key event, e.g. `keypress`, `keydown`, `keyup`
|
58227 | @param {Number} keyCode the keyCode of the simulated key event
|
58228 | @return {RSVP.Promise<undefined>}
|
58229 | @since 1.5.0
|
58230 | @public
|
58231 | */
|
58232 | function keyEvent(app, selector, contextOrType, typeOrKeyCode, keyCode) {
|
58233 | var context, type;
|
58234 |
|
58235 | if (keyCode === undefined) {
|
58236 | context = null;
|
58237 | keyCode = typeOrKeyCode;
|
58238 | type = contextOrType;
|
58239 | } else {
|
58240 | context = contextOrType;
|
58241 | type = typeOrKeyCode;
|
58242 | }
|
58243 |
|
58244 | return app.testHelpers.triggerEvent(selector, context, type, {
|
58245 | keyCode,
|
58246 | which: keyCode
|
58247 | });
|
58248 | }
|
58249 | });
|
58250 | define("ember-testing/lib/helpers/pause_test", ["exports", "@ember/-internals/runtime", "@ember/debug"], function (_exports, _runtime, _debug) {
|
58251 | "use strict";
|
58252 |
|
58253 | Object.defineProperty(_exports, "__esModule", {
|
58254 | value: true
|
58255 | });
|
58256 | _exports.resumeTest = resumeTest;
|
58257 | _exports.pauseTest = pauseTest;
|
58258 |
|
58259 | /**
|
58260 | @module ember
|
58261 | */
|
58262 | var resume;
|
58263 | /**
|
58264 | Resumes a test paused by `pauseTest`.
|
58265 |
|
58266 | @method resumeTest
|
58267 | @return {void}
|
58268 | @public
|
58269 | */
|
58270 |
|
58271 | function resumeTest() {
|
58272 | (true && !(resume) && (0, _debug.assert)('Testing has not been paused. There is nothing to resume.', resume));
|
58273 | resume();
|
58274 | resume = undefined;
|
58275 | }
|
58276 | /**
|
58277 | Pauses the current test - this is useful for debugging while testing or for test-driving.
|
58278 | It allows you to inspect the state of your application at any point.
|
58279 | Example (The test will pause before clicking the button):
|
58280 |
|
58281 | ```javascript
|
58282 | visit('/')
|
58283 | return pauseTest();
|
58284 | click('.btn');
|
58285 | ```
|
58286 |
|
58287 | You may want to turn off the timeout before pausing.
|
58288 |
|
58289 | qunit (timeout available to use as of 2.4.0):
|
58290 |
|
58291 | ```
|
58292 | visit('/');
|
58293 | assert.timeout(0);
|
58294 | return pauseTest();
|
58295 | click('.btn');
|
58296 | ```
|
58297 |
|
58298 | mocha (timeout happens automatically as of ember-mocha v0.14.0):
|
58299 |
|
58300 | ```
|
58301 | visit('/');
|
58302 | this.timeout(0);
|
58303 | return pauseTest();
|
58304 | click('.btn');
|
58305 | ```
|
58306 |
|
58307 |
|
58308 | @since 1.9.0
|
58309 | @method pauseTest
|
58310 | @return {Object} A promise that will never resolve
|
58311 | @public
|
58312 | */
|
58313 |
|
58314 |
|
58315 | function pauseTest() {
|
58316 | (0, _debug.info)('Testing paused. Use `resumeTest()` to continue.');
|
58317 | return new _runtime.RSVP.Promise(resolve => {
|
58318 | resume = resolve;
|
58319 | }, 'TestAdapter paused promise');
|
58320 | }
|
58321 | });
|
58322 | define("ember-testing/lib/helpers/trigger_event", ["exports", "ember-testing/lib/events"], function (_exports, _events) {
|
58323 | "use strict";
|
58324 |
|
58325 | Object.defineProperty(_exports, "__esModule", {
|
58326 | value: true
|
58327 | });
|
58328 | _exports.default = triggerEvent;
|
58329 |
|
58330 | /**
|
58331 | @module ember
|
58332 | */
|
58333 |
|
58334 | /**
|
58335 | Triggers the given DOM event on the element identified by the provided selector.
|
58336 | Example:
|
58337 | ```javascript
|
58338 | triggerEvent('#some-elem-id', 'blur');
|
58339 | ```
|
58340 | This is actually used internally by the `keyEvent` helper like so:
|
58341 | ```javascript
|
58342 | triggerEvent('#some-elem-id', 'keypress', { keyCode: 13 });
|
58343 | ```
|
58344 | @method triggerEvent
|
58345 | @param {String} selector jQuery selector for finding element on the DOM
|
58346 | @param {String} [context] jQuery selector that will limit the selector
|
58347 | argument to find only within the context's children
|
58348 | @param {String} type The event type to be triggered.
|
58349 | @param {Object} [options] The options to be passed to jQuery.Event.
|
58350 | @return {RSVP.Promise<undefined>}
|
58351 | @since 1.5.0
|
58352 | @public
|
58353 | */
|
58354 | function triggerEvent(app, selector, contextOrType, typeOrOptions, possibleOptions) {
|
58355 | var arity = arguments.length;
|
58356 | var context, type, options;
|
58357 |
|
58358 | if (arity === 3) {
|
58359 | // context and options are optional, so this is
|
58360 | // app, selector, type
|
58361 | context = null;
|
58362 | type = contextOrType;
|
58363 | options = {};
|
58364 | } else if (arity === 4) {
|
58365 | // context and options are optional, so this is
|
58366 | if (typeof typeOrOptions === 'object') {
|
58367 | // either
|
58368 | // app, selector, type, options
|
58369 | context = null;
|
58370 | type = contextOrType;
|
58371 | options = typeOrOptions;
|
58372 | } else {
|
58373 | // or
|
58374 | // app, selector, context, type
|
58375 | context = contextOrType;
|
58376 | type = typeOrOptions;
|
58377 | options = {};
|
58378 | }
|
58379 | } else {
|
58380 | context = contextOrType;
|
58381 | type = typeOrOptions;
|
58382 | options = possibleOptions;
|
58383 | }
|
58384 |
|
58385 | var $el = app.testHelpers.findWithAssert(selector, context);
|
58386 | var el = $el[0];
|
58387 | (0, _events.fireEvent)(el, type, options);
|
58388 | return app.testHelpers.wait();
|
58389 | }
|
58390 | });
|
58391 | define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], function (_exports, _runloop) {
|
58392 | "use strict";
|
58393 |
|
58394 | Object.defineProperty(_exports, "__esModule", {
|
58395 | value: true
|
58396 | });
|
58397 | _exports.default = visit;
|
58398 |
|
58399 | /**
|
58400 | Loads a route, sets up any controllers, and renders any templates associated
|
58401 | with the route as though a real user had triggered the route change while
|
58402 | using your app.
|
58403 |
|
58404 | Example:
|
58405 |
|
58406 | ```javascript
|
58407 | visit('posts/index').then(function() {
|
58408 | // assert something
|
58409 | });
|
58410 | ```
|
58411 |
|
58412 | @method visit
|
58413 | @param {String} url the name of the route
|
58414 | @return {RSVP.Promise<undefined>}
|
58415 | @public
|
58416 | */
|
58417 | function visit(app, url) {
|
58418 | var router = app.__container__.lookup('router:main');
|
58419 |
|
58420 | var shouldHandleURL = false;
|
58421 | app.boot().then(() => {
|
58422 | router.location.setURL(url);
|
58423 |
|
58424 | if (shouldHandleURL) {
|
58425 | (0, _runloop.run)(app.__deprecatedInstance__, 'handleURL', url);
|
58426 | }
|
58427 | });
|
58428 |
|
58429 | if (app._readinessDeferrals > 0) {
|
58430 | router.initialURL = url;
|
58431 | (0, _runloop.run)(app, 'advanceReadiness');
|
58432 | delete router.initialURL;
|
58433 | } else {
|
58434 | shouldHandleURL = true;
|
58435 | }
|
58436 |
|
58437 | return app.testHelpers.wait();
|
58438 | }
|
58439 | });
|
58440 | define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/waiters", "@ember/-internals/runtime", "@ember/runloop", "ember-testing/lib/test/pending_requests"], function (_exports, _waiters, _runtime, _runloop, _pending_requests) {
|
58441 | "use strict";
|
58442 |
|
58443 | Object.defineProperty(_exports, "__esModule", {
|
58444 | value: true
|
58445 | });
|
58446 | _exports.default = wait;
|
58447 |
|
58448 | /**
|
58449 | @module ember
|
58450 | */
|
58451 |
|
58452 | /**
|
58453 | Causes the run loop to process any pending events. This is used to ensure that
|
58454 | any async operations from other helpers (or your assertions) have been processed.
|
58455 |
|
58456 | This is most often used as the return value for the helper functions (see 'click',
|
58457 | 'fillIn','visit',etc). However, there is a method to register a test helper which
|
58458 | utilizes this method without the need to actually call `wait()` in your helpers.
|
58459 |
|
58460 | The `wait` helper is built into `registerAsyncHelper` by default. You will not need
|
58461 | to `return app.testHelpers.wait();` - the wait behavior is provided for you.
|
58462 |
|
58463 | Example:
|
58464 |
|
58465 | ```javascript
|
58466 | import { registerAsyncHelper } from '@ember/test';
|
58467 |
|
58468 | registerAsyncHelper('loginUser', function(app, username, password) {
|
58469 | visit('secured/path/here')
|
58470 | .fillIn('#username', username)
|
58471 | .fillIn('#password', password)
|
58472 | .click('.submit');
|
58473 | });
|
58474 | ```
|
58475 |
|
58476 | @method wait
|
58477 | @param {Object} value The value to be returned.
|
58478 | @return {RSVP.Promise<any>} Promise that resolves to the passed value.
|
58479 | @public
|
58480 | @since 1.0.0
|
58481 | */
|
58482 | function wait(app, value) {
|
58483 | return new _runtime.RSVP.Promise(function (resolve) {
|
58484 | var router = app.__container__.lookup('router:main'); // Every 10ms, poll for the async thing to have finished
|
58485 |
|
58486 |
|
58487 | var watcher = setInterval(() => {
|
58488 | // 1. If the router is loading, keep polling
|
58489 | var routerIsLoading = router._routerMicrolib && Boolean(router._routerMicrolib.activeTransition);
|
58490 |
|
58491 | if (routerIsLoading) {
|
58492 | return;
|
58493 | } // 2. If there are pending Ajax requests, keep polling
|
58494 |
|
58495 |
|
58496 | if ((0, _pending_requests.pendingRequests)()) {
|
58497 | return;
|
58498 | } // 3. If there are scheduled timers or we are inside of a run loop, keep polling
|
58499 |
|
58500 |
|
58501 | if ((0, _runloop.hasScheduledTimers)() || (0, _runloop.getCurrentRunLoop)()) {
|
58502 | return;
|
58503 | }
|
58504 |
|
58505 | if ((0, _waiters.checkWaiters)()) {
|
58506 | return;
|
58507 | } // Stop polling
|
58508 |
|
58509 |
|
58510 | clearInterval(watcher); // Synchronously resolve the promise
|
58511 |
|
58512 | (0, _runloop.run)(null, resolve, value);
|
58513 | }, 10);
|
58514 | });
|
58515 | }
|
58516 | });
|
58517 | define("ember-testing/lib/initializers", ["@ember/application"], function (_application) {
|
58518 | "use strict";
|
58519 |
|
58520 | var name = 'deferReadiness in `testing` mode';
|
58521 | (0, _application.onLoad)('Ember.Application', function (Application) {
|
58522 | if (!Application.initializers[name]) {
|
58523 | Application.initializer({
|
58524 | name: name,
|
58525 |
|
58526 | initialize(application) {
|
58527 | if (application.testing) {
|
58528 | application.deferReadiness();
|
58529 | }
|
58530 | }
|
58531 |
|
58532 | });
|
58533 | }
|
58534 | });
|
58535 | });
|
58536 | define("ember-testing/lib/setup_for_testing", ["exports", "@ember/debug", "@ember/-internals/views", "ember-testing/lib/test/adapter", "ember-testing/lib/test/pending_requests", "ember-testing/lib/adapters/adapter", "ember-testing/lib/adapters/qunit"], function (_exports, _debug, _views, _adapter, _pending_requests, _adapter2, _qunit) {
|
58537 | "use strict";
|
58538 |
|
58539 | Object.defineProperty(_exports, "__esModule", {
|
58540 | value: true
|
58541 | });
|
58542 | _exports.default = setupForTesting;
|
58543 |
|
58544 | /* global self */
|
58545 |
|
58546 | /**
|
58547 | Sets Ember up for testing. This is useful to perform
|
58548 | basic setup steps in order to unit test.
|
58549 |
|
58550 | Use `App.setupForTesting` to perform integration tests (full
|
58551 | application testing).
|
58552 |
|
58553 | @method setupForTesting
|
58554 | @namespace Ember
|
58555 | @since 1.5.0
|
58556 | @private
|
58557 | */
|
58558 | function setupForTesting() {
|
58559 | (0, _debug.setTesting)(true);
|
58560 | var adapter = (0, _adapter.getAdapter)(); // if adapter is not manually set default to QUnit
|
58561 |
|
58562 | if (!adapter) {
|
58563 | (0, _adapter.setAdapter)(typeof self.QUnit === 'undefined' ? _adapter2.default.create() : _qunit.default.create());
|
58564 | }
|
58565 |
|
58566 | if (!_views.jQueryDisabled) {
|
58567 | (0, _views.jQuery)(document).off('ajaxSend', _pending_requests.incrementPendingRequests);
|
58568 | (0, _views.jQuery)(document).off('ajaxComplete', _pending_requests.decrementPendingRequests);
|
58569 | (0, _pending_requests.clearPendingRequests)();
|
58570 | (0, _views.jQuery)(document).on('ajaxSend', _pending_requests.incrementPendingRequests);
|
58571 | (0, _views.jQuery)(document).on('ajaxComplete', _pending_requests.decrementPendingRequests);
|
58572 | }
|
58573 | }
|
58574 | });
|
58575 | define("ember-testing/lib/support", ["@ember/debug", "@ember/-internals/views", "@ember/-internals/browser-environment"], function (_debug, _views, _browserEnvironment) {
|
58576 | "use strict";
|
58577 |
|
58578 | /**
|
58579 | @module ember
|
58580 | */
|
58581 | var $ = _views.jQuery;
|
58582 | /**
|
58583 | This method creates a checkbox and triggers the click event to fire the
|
58584 | passed in handler. It is used to correct for a bug in older versions
|
58585 | of jQuery (e.g 1.8.3).
|
58586 |
|
58587 | @private
|
58588 | @method testCheckboxClick
|
58589 | */
|
58590 |
|
58591 | function testCheckboxClick(handler) {
|
58592 | var input = document.createElement('input');
|
58593 | $(input).attr('type', 'checkbox').css({
|
58594 | position: 'absolute',
|
58595 | left: '-1000px',
|
58596 | top: '-1000px'
|
58597 | }).appendTo('body').on('click', handler).trigger('click').remove();
|
58598 | }
|
58599 |
|
58600 | if (_browserEnvironment.hasDOM && !_views.jQueryDisabled) {
|
58601 | $(function () {
|
58602 | /*
|
58603 | Determine whether a checkbox checked using jQuery's "click" method will have
|
58604 | the correct value for its checked property.
|
58605 | If we determine that the current jQuery version exhibits this behavior,
|
58606 | patch it to work correctly as in the commit for the actual fix:
|
58607 | https://github.com/jquery/jquery/commit/1fb2f92.
|
58608 | */
|
58609 | testCheckboxClick(function () {
|
58610 | if (!this.checked && !$.event.special.click) {
|
58611 | $.event.special.click = {
|
58612 | // For checkbox, fire native event so checked state will be right
|
58613 | trigger() {
|
58614 | if (this.nodeName === 'INPUT' && this.type === 'checkbox' && this.click) {
|
58615 | this.click();
|
58616 | return false;
|
58617 | }
|
58618 | }
|
58619 |
|
58620 | };
|
58621 | }
|
58622 | }); // Try again to verify that the patch took effect or blow up.
|
58623 |
|
58624 | testCheckboxClick(function () {
|
58625 | (true && (0, _debug.warn)("clicked checkboxes should be checked! the jQuery patch didn't work", this.checked, {
|
58626 | id: 'ember-testing.test-checkbox-click'
|
58627 | }));
|
58628 | });
|
58629 | });
|
58630 | }
|
58631 | });
|
58632 | define("ember-testing/lib/test", ["exports", "ember-testing/lib/test/helpers", "ember-testing/lib/test/on_inject_helpers", "ember-testing/lib/test/promise", "ember-testing/lib/test/waiters", "ember-testing/lib/test/adapter"], function (_exports, _helpers, _on_inject_helpers, _promise, _waiters, _adapter) {
|
58633 | "use strict";
|
58634 |
|
58635 | Object.defineProperty(_exports, "__esModule", {
|
58636 | value: true
|
58637 | });
|
58638 | _exports.default = void 0;
|
58639 |
|
58640 | /**
|
58641 | @module ember
|
58642 | */
|
58643 |
|
58644 | /**
|
58645 | This is a container for an assortment of testing related functionality:
|
58646 |
|
58647 | * Choose your default test adapter (for your framework of choice).
|
58648 | * Register/Unregister additional test helpers.
|
58649 | * Setup callbacks to be fired when the test helpers are injected into
|
58650 | your application.
|
58651 |
|
58652 | @class Test
|
58653 | @namespace Ember
|
58654 | @public
|
58655 | */
|
58656 | var Test = {
|
58657 | /**
|
58658 | Hash containing all known test helpers.
|
58659 | @property _helpers
|
58660 | @private
|
58661 | @since 1.7.0
|
58662 | */
|
58663 | _helpers: _helpers.helpers,
|
58664 | registerHelper: _helpers.registerHelper,
|
58665 | registerAsyncHelper: _helpers.registerAsyncHelper,
|
58666 | unregisterHelper: _helpers.unregisterHelper,
|
58667 | onInjectHelpers: _on_inject_helpers.onInjectHelpers,
|
58668 | Promise: _promise.default,
|
58669 | promise: _promise.promise,
|
58670 | resolve: _promise.resolve,
|
58671 | registerWaiter: _waiters.registerWaiter,
|
58672 | unregisterWaiter: _waiters.unregisterWaiter,
|
58673 | checkWaiters: _waiters.checkWaiters
|
58674 | };
|
58675 | /**
|
58676 | Used to allow ember-testing to communicate with a specific testing
|
58677 | framework.
|
58678 |
|
58679 | You can manually set it before calling `App.setupForTesting()`.
|
58680 |
|
58681 | Example:
|
58682 |
|
58683 | ```javascript
|
58684 | Ember.Test.adapter = MyCustomAdapter.create()
|
58685 | ```
|
58686 |
|
58687 | If you do not set it, ember-testing will default to `Ember.Test.QUnitAdapter`.
|
58688 |
|
58689 | @public
|
58690 | @for Ember.Test
|
58691 | @property adapter
|
58692 | @type {Class} The adapter to be used.
|
58693 | @default Ember.Test.QUnitAdapter
|
58694 | */
|
58695 |
|
58696 | Object.defineProperty(Test, 'adapter', {
|
58697 | get: _adapter.getAdapter,
|
58698 | set: _adapter.setAdapter
|
58699 | });
|
58700 | var _default = Test;
|
58701 | _exports.default = _default;
|
58702 | });
|
58703 | define("ember-testing/lib/test/adapter", ["exports", "@ember/-internals/error-handling"], function (_exports, _errorHandling) {
|
58704 | "use strict";
|
58705 |
|
58706 | Object.defineProperty(_exports, "__esModule", {
|
58707 | value: true
|
58708 | });
|
58709 | _exports.getAdapter = getAdapter;
|
58710 | _exports.setAdapter = setAdapter;
|
58711 | _exports.asyncStart = asyncStart;
|
58712 | _exports.asyncEnd = asyncEnd;
|
58713 | var adapter;
|
58714 |
|
58715 | function getAdapter() {
|
58716 | return adapter;
|
58717 | }
|
58718 |
|
58719 | function setAdapter(value) {
|
58720 | adapter = value;
|
58721 |
|
58722 | if (value && typeof value.exception === 'function') {
|
58723 | (0, _errorHandling.setDispatchOverride)(adapterDispatch);
|
58724 | } else {
|
58725 | (0, _errorHandling.setDispatchOverride)(null);
|
58726 | }
|
58727 | }
|
58728 |
|
58729 | function asyncStart() {
|
58730 | if (adapter) {
|
58731 | adapter.asyncStart();
|
58732 | }
|
58733 | }
|
58734 |
|
58735 | function asyncEnd() {
|
58736 | if (adapter) {
|
58737 | adapter.asyncEnd();
|
58738 | }
|
58739 | }
|
58740 |
|
58741 | function adapterDispatch(error) {
|
58742 | adapter.exception(error);
|
58743 | console.error(error.stack); // eslint-disable-line no-console
|
58744 | }
|
58745 | });
|
58746 | define("ember-testing/lib/test/helpers", ["exports", "ember-testing/lib/test/promise"], function (_exports, _promise) {
|
58747 | "use strict";
|
58748 |
|
58749 | Object.defineProperty(_exports, "__esModule", {
|
58750 | value: true
|
58751 | });
|
58752 | _exports.registerHelper = registerHelper;
|
58753 | _exports.registerAsyncHelper = registerAsyncHelper;
|
58754 | _exports.unregisterHelper = unregisterHelper;
|
58755 | _exports.helpers = void 0;
|
58756 | var helpers = {};
|
58757 | /**
|
58758 | @module @ember/test
|
58759 | */
|
58760 |
|
58761 | /**
|
58762 | `registerHelper` is used to register a test helper that will be injected
|
58763 | when `App.injectTestHelpers` is called.
|
58764 |
|
58765 | The helper method will always be called with the current Application as
|
58766 | the first parameter.
|
58767 |
|
58768 | For example:
|
58769 |
|
58770 | ```javascript
|
58771 | import { registerHelper } from '@ember/test';
|
58772 | import { run } from '@ember/runloop';
|
58773 |
|
58774 | registerHelper('boot', function(app) {
|
58775 | run(app, app.advanceReadiness);
|
58776 | });
|
58777 | ```
|
58778 |
|
58779 | This helper can later be called without arguments because it will be
|
58780 | called with `app` as the first parameter.
|
58781 |
|
58782 | ```javascript
|
58783 | import Application from '@ember/application';
|
58784 |
|
58785 | App = Application.create();
|
58786 | App.injectTestHelpers();
|
58787 | boot();
|
58788 | ```
|
58789 |
|
58790 | @public
|
58791 | @for @ember/test
|
58792 | @static
|
58793 | @method registerHelper
|
58794 | @param {String} name The name of the helper method to add.
|
58795 | @param {Function} helperMethod
|
58796 | @param options {Object}
|
58797 | */
|
58798 |
|
58799 | _exports.helpers = helpers;
|
58800 |
|
58801 | function registerHelper(name, helperMethod) {
|
58802 | helpers[name] = {
|
58803 | method: helperMethod,
|
58804 | meta: {
|
58805 | wait: false
|
58806 | }
|
58807 | };
|
58808 | }
|
58809 | /**
|
58810 | `registerAsyncHelper` is used to register an async test helper that will be injected
|
58811 | when `App.injectTestHelpers` is called.
|
58812 |
|
58813 | The helper method will always be called with the current Application as
|
58814 | the first parameter.
|
58815 |
|
58816 | For example:
|
58817 |
|
58818 | ```javascript
|
58819 | import { registerAsyncHelper } from '@ember/test';
|
58820 | import { run } from '@ember/runloop';
|
58821 |
|
58822 | registerAsyncHelper('boot', function(app) {
|
58823 | run(app, app.advanceReadiness);
|
58824 | });
|
58825 | ```
|
58826 |
|
58827 | The advantage of an async helper is that it will not run
|
58828 | until the last async helper has completed. All async helpers
|
58829 | after it will wait for it complete before running.
|
58830 |
|
58831 |
|
58832 | For example:
|
58833 |
|
58834 | ```javascript
|
58835 | import { registerAsyncHelper } from '@ember/test';
|
58836 |
|
58837 | registerAsyncHelper('deletePost', function(app, postId) {
|
58838 | click('.delete-' + postId);
|
58839 | });
|
58840 |
|
58841 | // ... in your test
|
58842 | visit('/post/2');
|
58843 | deletePost(2);
|
58844 | visit('/post/3');
|
58845 | deletePost(3);
|
58846 | ```
|
58847 |
|
58848 | @public
|
58849 | @for @ember/test
|
58850 | @method registerAsyncHelper
|
58851 | @param {String} name The name of the helper method to add.
|
58852 | @param {Function} helperMethod
|
58853 | @since 1.2.0
|
58854 | */
|
58855 |
|
58856 |
|
58857 | function registerAsyncHelper(name, helperMethod) {
|
58858 | helpers[name] = {
|
58859 | method: helperMethod,
|
58860 | meta: {
|
58861 | wait: true
|
58862 | }
|
58863 | };
|
58864 | }
|
58865 | /**
|
58866 | Remove a previously added helper method.
|
58867 |
|
58868 | Example:
|
58869 |
|
58870 | ```javascript
|
58871 | import { unregisterHelper } from '@ember/test';
|
58872 |
|
58873 | unregisterHelper('wait');
|
58874 | ```
|
58875 |
|
58876 | @public
|
58877 | @method unregisterHelper
|
58878 | @static
|
58879 | @for @ember/test
|
58880 | @param {String} name The helper to remove.
|
58881 | */
|
58882 |
|
58883 |
|
58884 | function unregisterHelper(name) {
|
58885 | delete helpers[name];
|
58886 | delete _promise.default.prototype[name];
|
58887 | }
|
58888 | });
|
58889 | define("ember-testing/lib/test/on_inject_helpers", ["exports"], function (_exports) {
|
58890 | "use strict";
|
58891 |
|
58892 | Object.defineProperty(_exports, "__esModule", {
|
58893 | value: true
|
58894 | });
|
58895 | _exports.onInjectHelpers = onInjectHelpers;
|
58896 | _exports.invokeInjectHelpersCallbacks = invokeInjectHelpersCallbacks;
|
58897 | _exports.callbacks = void 0;
|
58898 | var callbacks = [];
|
58899 | /**
|
58900 | Used to register callbacks to be fired whenever `App.injectTestHelpers`
|
58901 | is called.
|
58902 |
|
58903 | The callback will receive the current application as an argument.
|
58904 |
|
58905 | Example:
|
58906 |
|
58907 | ```javascript
|
58908 | import $ from 'jquery';
|
58909 |
|
58910 | Ember.Test.onInjectHelpers(function() {
|
58911 | $(document).ajaxSend(function() {
|
58912 | Test.pendingRequests++;
|
58913 | });
|
58914 |
|
58915 | $(document).ajaxComplete(function() {
|
58916 | Test.pendingRequests--;
|
58917 | });
|
58918 | });
|
58919 | ```
|
58920 |
|
58921 | @public
|
58922 | @for Ember.Test
|
58923 | @method onInjectHelpers
|
58924 | @param {Function} callback The function to be called.
|
58925 | */
|
58926 |
|
58927 | _exports.callbacks = callbacks;
|
58928 |
|
58929 | function onInjectHelpers(callback) {
|
58930 | callbacks.push(callback);
|
58931 | }
|
58932 |
|
58933 | function invokeInjectHelpersCallbacks(app) {
|
58934 | for (var i = 0; i < callbacks.length; i++) {
|
58935 | callbacks[i](app);
|
58936 | }
|
58937 | }
|
58938 | });
|
58939 | define("ember-testing/lib/test/pending_requests", ["exports"], function (_exports) {
|
58940 | "use strict";
|
58941 |
|
58942 | Object.defineProperty(_exports, "__esModule", {
|
58943 | value: true
|
58944 | });
|
58945 | _exports.pendingRequests = pendingRequests;
|
58946 | _exports.clearPendingRequests = clearPendingRequests;
|
58947 | _exports.incrementPendingRequests = incrementPendingRequests;
|
58948 | _exports.decrementPendingRequests = decrementPendingRequests;
|
58949 | var requests = [];
|
58950 |
|
58951 | function pendingRequests() {
|
58952 | return requests.length;
|
58953 | }
|
58954 |
|
58955 | function clearPendingRequests() {
|
58956 | requests.length = 0;
|
58957 | }
|
58958 |
|
58959 | function incrementPendingRequests(_, xhr) {
|
58960 | requests.push(xhr);
|
58961 | }
|
58962 |
|
58963 | function decrementPendingRequests(_, xhr) {
|
58964 | setTimeout(function () {
|
58965 | for (var i = 0; i < requests.length; i++) {
|
58966 | if (xhr === requests[i]) {
|
58967 | requests.splice(i, 1);
|
58968 | break;
|
58969 | }
|
58970 | }
|
58971 | }, 0);
|
58972 | }
|
58973 | });
|
58974 | define("ember-testing/lib/test/promise", ["exports", "@ember/-internals/runtime", "ember-testing/lib/test/run"], function (_exports, _runtime, _run) {
|
58975 | "use strict";
|
58976 |
|
58977 | Object.defineProperty(_exports, "__esModule", {
|
58978 | value: true
|
58979 | });
|
58980 | _exports.promise = promise;
|
58981 | _exports.resolve = resolve;
|
58982 | _exports.getLastPromise = getLastPromise;
|
58983 | _exports.default = void 0;
|
58984 | var lastPromise;
|
58985 |
|
58986 | class TestPromise extends _runtime.RSVP.Promise {
|
58987 | constructor() {
|
58988 | super(...arguments);
|
58989 | lastPromise = this;
|
58990 | }
|
58991 |
|
58992 | then(_onFulfillment, ...args) {
|
58993 | var onFulfillment = typeof _onFulfillment === 'function' ? result => isolate(_onFulfillment, result) : undefined;
|
58994 | return super.then(onFulfillment, ...args);
|
58995 | }
|
58996 |
|
58997 | }
|
58998 | /**
|
58999 | This returns a thenable tailored for testing. It catches failed
|
59000 | `onSuccess` callbacks and invokes the `Ember.Test.adapter.exception`
|
59001 | callback in the last chained then.
|
59002 |
|
59003 | This method should be returned by async helpers such as `wait`.
|
59004 |
|
59005 | @public
|
59006 | @for Ember.Test
|
59007 | @method promise
|
59008 | @param {Function} resolver The function used to resolve the promise.
|
59009 | @param {String} label An optional string for identifying the promise.
|
59010 | */
|
59011 |
|
59012 |
|
59013 | _exports.default = TestPromise;
|
59014 |
|
59015 | function promise(resolver, label) {
|
59016 | var fullLabel = `Ember.Test.promise: ${label || '<Unknown Promise>'}`;
|
59017 | return new TestPromise(resolver, fullLabel);
|
59018 | }
|
59019 | /**
|
59020 | Replacement for `Ember.RSVP.resolve`
|
59021 | The only difference is this uses
|
59022 | an instance of `Ember.Test.Promise`
|
59023 |
|
59024 | @public
|
59025 | @for Ember.Test
|
59026 | @method resolve
|
59027 | @param {Mixed} The value to resolve
|
59028 | @since 1.2.0
|
59029 | */
|
59030 |
|
59031 |
|
59032 | function resolve(result, label) {
|
59033 | return TestPromise.resolve(result, label);
|
59034 | }
|
59035 |
|
59036 | function getLastPromise() {
|
59037 | return lastPromise;
|
59038 | } // This method isolates nested async methods
|
59039 | // so that they don't conflict with other last promises.
|
59040 | //
|
59041 | // 1. Set `Ember.Test.lastPromise` to null
|
59042 | // 2. Invoke method
|
59043 | // 3. Return the last promise created during method
|
59044 |
|
59045 |
|
59046 | function isolate(onFulfillment, result) {
|
59047 | // Reset lastPromise for nested helpers
|
59048 | lastPromise = null;
|
59049 | var value = onFulfillment(result);
|
59050 | var promise = lastPromise;
|
59051 | lastPromise = null; // If the method returned a promise
|
59052 | // return that promise. If not,
|
59053 | // return the last async helper's promise
|
59054 |
|
59055 | if (value && value instanceof TestPromise || !promise) {
|
59056 | return value;
|
59057 | } else {
|
59058 | return (0, _run.default)(() => resolve(promise).then(() => value));
|
59059 | }
|
59060 | }
|
59061 | });
|
59062 | define("ember-testing/lib/test/run", ["exports", "@ember/runloop"], function (_exports, _runloop) {
|
59063 | "use strict";
|
59064 |
|
59065 | Object.defineProperty(_exports, "__esModule", {
|
59066 | value: true
|
59067 | });
|
59068 | _exports.default = run;
|
59069 |
|
59070 | function run(fn) {
|
59071 | if (!(0, _runloop.getCurrentRunLoop)()) {
|
59072 | return (0, _runloop.run)(fn);
|
59073 | } else {
|
59074 | return fn();
|
59075 | }
|
59076 | }
|
59077 | });
|
59078 | define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
|
59079 | "use strict";
|
59080 |
|
59081 | Object.defineProperty(_exports, "__esModule", {
|
59082 | value: true
|
59083 | });
|
59084 | _exports.registerWaiter = registerWaiter;
|
59085 | _exports.unregisterWaiter = unregisterWaiter;
|
59086 | _exports.checkWaiters = checkWaiters;
|
59087 |
|
59088 | /**
|
59089 | @module @ember/test
|
59090 | */
|
59091 | var contexts = [];
|
59092 | var callbacks = [];
|
59093 | /**
|
59094 | This allows ember-testing to play nicely with other asynchronous
|
59095 | events, such as an application that is waiting for a CSS3
|
59096 | transition or an IndexDB transaction. The waiter runs periodically
|
59097 | after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
|
59098 | until the returning result is truthy. After the waiters finish, the next async helper
|
59099 | is executed and the process repeats.
|
59100 |
|
59101 | For example:
|
59102 |
|
59103 | ```javascript
|
59104 | import { registerWaiter } from '@ember/test';
|
59105 |
|
59106 | registerWaiter(function() {
|
59107 | return myPendingTransactions() === 0;
|
59108 | });
|
59109 | ```
|
59110 | The `context` argument allows you to optionally specify the `this`
|
59111 | with which your callback will be invoked.
|
59112 |
|
59113 | For example:
|
59114 |
|
59115 | ```javascript
|
59116 | import { registerWaiter } from '@ember/test';
|
59117 |
|
59118 | registerWaiter(MyDB, MyDB.hasPendingTransactions);
|
59119 | ```
|
59120 |
|
59121 | @public
|
59122 | @for @ember/test
|
59123 | @static
|
59124 | @method registerWaiter
|
59125 | @param {Object} context (optional)
|
59126 | @param {Function} callback
|
59127 | @since 1.2.0
|
59128 | */
|
59129 |
|
59130 | function registerWaiter(context, callback) {
|
59131 | if (arguments.length === 1) {
|
59132 | callback = context;
|
59133 | context = null;
|
59134 | }
|
59135 |
|
59136 | if (indexOf(context, callback) > -1) {
|
59137 | return;
|
59138 | }
|
59139 |
|
59140 | contexts.push(context);
|
59141 | callbacks.push(callback);
|
59142 | }
|
59143 | /**
|
59144 | `unregisterWaiter` is used to unregister a callback that was
|
59145 | registered with `registerWaiter`.
|
59146 |
|
59147 | @public
|
59148 | @for @ember/test
|
59149 | @static
|
59150 | @method unregisterWaiter
|
59151 | @param {Object} context (optional)
|
59152 | @param {Function} callback
|
59153 | @since 1.2.0
|
59154 | */
|
59155 |
|
59156 |
|
59157 | function unregisterWaiter(context, callback) {
|
59158 | if (!callbacks.length) {
|
59159 | return;
|
59160 | }
|
59161 |
|
59162 | if (arguments.length === 1) {
|
59163 | callback = context;
|
59164 | context = null;
|
59165 | }
|
59166 |
|
59167 | var i = indexOf(context, callback);
|
59168 |
|
59169 | if (i === -1) {
|
59170 | return;
|
59171 | }
|
59172 |
|
59173 | contexts.splice(i, 1);
|
59174 | callbacks.splice(i, 1);
|
59175 | }
|
59176 | /**
|
59177 | Iterates through each registered test waiter, and invokes
|
59178 | its callback. If any waiter returns false, this method will return
|
59179 | true indicating that the waiters have not settled yet.
|
59180 |
|
59181 | This is generally used internally from the acceptance/integration test
|
59182 | infrastructure.
|
59183 |
|
59184 | @public
|
59185 | @for @ember/test
|
59186 | @static
|
59187 | @method checkWaiters
|
59188 | */
|
59189 |
|
59190 |
|
59191 | function checkWaiters() {
|
59192 | if (!callbacks.length) {
|
59193 | return false;
|
59194 | }
|
59195 |
|
59196 | for (var i = 0; i < callbacks.length; i++) {
|
59197 | var context = contexts[i];
|
59198 | var callback = callbacks[i];
|
59199 |
|
59200 | if (!callback.call(context)) {
|
59201 | return true;
|
59202 | }
|
59203 | }
|
59204 |
|
59205 | return false;
|
59206 | }
|
59207 |
|
59208 | function indexOf(context, callback) {
|
59209 | for (var i = 0; i < callbacks.length; i++) {
|
59210 | if (callbacks[i] === callback && contexts[i] === context) {
|
59211 | return i;
|
59212 | }
|
59213 | }
|
59214 |
|
59215 | return -1;
|
59216 | }
|
59217 | });
|
59218 | define("ember/index", ["exports", "require", "@ember/-internals/environment", "node-module", "@ember/-internals/utils", "@ember/-internals/container", "@ember/instrumentation", "@ember/-internals/meta", "@ember/-internals/metal", "@ember/canary-features", "@ember/debug", "backburner", "@ember/-internals/console", "@ember/controller", "@ember/controller/lib/controller_mixin", "@ember/string", "@ember/service", "@ember/object", "@ember/object/compat", "@ember/object/computed", "@ember/-internals/runtime", "@ember/-internals/glimmer", "ember/version", "@ember/-internals/views", "@ember/-internals/routing", "@ember/-internals/extension-support", "@ember/error", "@ember/runloop", "@ember/-internals/error-handling", "@ember/-internals/owner", "@ember/application", "@ember/application/globals-resolver", "@ember/application/instance", "@ember/engine", "@ember/engine/instance", "@ember/polyfills", "@ember/deprecated-features", "@ember/component/template-only", "@glimmer/runtime"], function (_exports, _require, _environment, _nodeModule, utils, _container, instrumentation, _meta, metal, _canaryFeatures, EmberDebug, _backburner, _console, _controller, _controller_mixin, _string, _service, _object, _compat, _computed, _runtime, _glimmer, _version, views, routing, extensionSupport, _error, runloop, _errorHandling, _owner, _application, _globalsResolver, _instance, _engine, _instance2, _polyfills, _deprecatedFeatures, _templateOnly, _runtime2) {
|
59219 | "use strict";
|
59220 |
|
59221 | Object.defineProperty(_exports, "__esModule", {
|
59222 | value: true
|
59223 | });
|
59224 | _exports.default = void 0;
|
59225 | // eslint-disable-next-line import/no-unresolved
|
59226 | // ****@ember/-internals/environment****
|
59227 | var Ember = typeof _environment.context.imports.Ember === 'object' && _environment.context.imports.Ember || {};
|
59228 | Ember.isNamespace = true;
|
59229 |
|
59230 | Ember.toString = function () {
|
59231 | return 'Ember';
|
59232 | };
|
59233 |
|
59234 | Object.defineProperty(Ember, 'ENV', {
|
59235 | get: _environment.getENV,
|
59236 | enumerable: false
|
59237 | });
|
59238 | Object.defineProperty(Ember, 'lookup', {
|
59239 | get: _environment.getLookup,
|
59240 | set: _environment.setLookup,
|
59241 | enumerable: false
|
59242 | });
|
59243 |
|
59244 | if (_deprecatedFeatures.EMBER_EXTEND_PROTOTYPES) {
|
59245 | Object.defineProperty(Ember, 'EXTEND_PROTOTYPES', {
|
59246 | enumerable: false,
|
59247 |
|
59248 | get() {
|
59249 | (true && !(false) && (0, EmberDebug.deprecate)('Accessing Ember.EXTEND_PROTOTYPES is deprecated, please migrate to Ember.ENV.EXTEND_PROTOTYPES', false, {
|
59250 | id: 'ember-env.old-extend-prototypes',
|
59251 | until: '4.0.0'
|
59252 | }));
|
59253 | return _environment.ENV.EXTEND_PROTOTYPES;
|
59254 | }
|
59255 |
|
59256 | });
|
59257 | } // ****@ember/application****
|
59258 |
|
59259 |
|
59260 | Ember.getOwner = _owner.getOwner;
|
59261 | Ember.setOwner = _owner.setOwner;
|
59262 | Ember.Application = _application.default;
|
59263 | Ember.ApplicationInstance = _instance.default;
|
59264 | Object.defineProperty(Ember, 'Resolver', {
|
59265 | get() {
|
59266 | (true && !(false) && (0, EmberDebug.deprecate)('Using the globals resolver is deprecated. Use the ember-resolver package instead. See https://deprecations.emberjs.com/v3.x#toc_ember-deprecate-globals-resolver', false, {
|
59267 | id: 'ember.globals-resolver',
|
59268 | until: '4.0.0',
|
59269 | url: 'https://deprecations.emberjs.com/v3.x#toc_ember-deprecate-globals-resolver'
|
59270 | }));
|
59271 | return _globalsResolver.default;
|
59272 | }
|
59273 |
|
59274 | });
|
59275 | Object.defineProperty(Ember, 'DefaultResolver', {
|
59276 | get() {
|
59277 | return Ember.Resolver;
|
59278 | }
|
59279 |
|
59280 | }); // ****@ember/engine****
|
59281 |
|
59282 | Ember.Engine = _engine.default;
|
59283 | Ember.EngineInstance = _instance2.default; // ****@ember/polyfills****
|
59284 |
|
59285 | Ember.assign = _polyfills.assign;
|
59286 | Ember.merge = _polyfills.merge; // ****@ember/-internals/utils****
|
59287 |
|
59288 | Ember.generateGuid = utils.generateGuid;
|
59289 | Ember.GUID_KEY = utils.GUID_KEY;
|
59290 | Ember.guidFor = utils.guidFor;
|
59291 | Ember.inspect = utils.inspect;
|
59292 | Ember.makeArray = utils.makeArray;
|
59293 | Ember.canInvoke = utils.canInvoke;
|
59294 | Ember.tryInvoke = utils.tryInvoke;
|
59295 | Ember.wrap = utils.wrap;
|
59296 | Ember.uuid = utils.uuid; // ****@ember/-internals/container****
|
59297 |
|
59298 | Ember.Container = _container.Container;
|
59299 | Ember.Registry = _container.Registry; // ****@ember/debug****
|
59300 |
|
59301 | Ember.assert = EmberDebug.assert;
|
59302 | Ember.warn = EmberDebug.warn;
|
59303 | Ember.debug = EmberDebug.debug;
|
59304 | Ember.deprecate = EmberDebug.deprecate;
|
59305 | Ember.deprecateFunc = EmberDebug.deprecateFunc;
|
59306 | Ember.runInDebug = EmberDebug.runInDebug; // ****@ember/error****
|
59307 |
|
59308 | Ember.Error = _error.default;
|
59309 | /**
|
59310 | @public
|
59311 | @class Ember.Debug
|
59312 | */
|
59313 |
|
59314 | Ember.Debug = {
|
59315 | registerDeprecationHandler: EmberDebug.registerDeprecationHandler,
|
59316 | registerWarnHandler: EmberDebug.registerWarnHandler,
|
59317 | isComputed: metal.isComputed
|
59318 | }; // ****@ember/instrumentation****
|
59319 |
|
59320 | Ember.instrument = instrumentation.instrument;
|
59321 | Ember.subscribe = instrumentation.subscribe;
|
59322 | Ember.Instrumentation = {
|
59323 | instrument: instrumentation.instrument,
|
59324 | subscribe: instrumentation.subscribe,
|
59325 | unsubscribe: instrumentation.unsubscribe,
|
59326 | reset: instrumentation.reset
|
59327 | }; // ****@ember/runloop****
|
59328 | // Using _globalsRun here so that mutating the function (adding
|
59329 | // `next`, `later`, etc to it) is only available in globals builds
|
59330 |
|
59331 | Ember.run = runloop._globalsRun;
|
59332 | Ember.run.backburner = runloop.backburner;
|
59333 | Ember.run.begin = runloop.begin;
|
59334 | Ember.run.bind = runloop.bind;
|
59335 | Ember.run.cancel = runloop.cancel;
|
59336 | Ember.run.debounce = runloop.debounce;
|
59337 | Ember.run.end = runloop.end;
|
59338 | Ember.run.hasScheduledTimers = runloop.hasScheduledTimers;
|
59339 | Ember.run.join = runloop.join;
|
59340 | Ember.run.later = runloop.later;
|
59341 | Ember.run.next = runloop.next;
|
59342 | Ember.run.once = runloop.once;
|
59343 | Ember.run.schedule = runloop.schedule;
|
59344 | Ember.run.scheduleOnce = runloop.scheduleOnce;
|
59345 | Ember.run.throttle = runloop.throttle;
|
59346 | Ember.run.cancelTimers = runloop.cancelTimers;
|
59347 | Object.defineProperty(Ember.run, 'currentRunLoop', {
|
59348 | get: runloop.getCurrentRunLoop,
|
59349 | enumerable: false
|
59350 | }); // ****@ember/-internals/metal****
|
59351 | // Using _globalsComputed here so that mutating the function is only available
|
59352 | // in globals builds
|
59353 |
|
59354 | var computed = metal._globalsComputed;
|
59355 | Ember.computed = computed;
|
59356 | Ember._descriptor = metal.nativeDescDecorator;
|
59357 | Ember._tracked = metal.tracked;
|
59358 | computed.alias = metal.alias;
|
59359 | Ember.cacheFor = metal.getCachedValueFor;
|
59360 | Ember.ComputedProperty = metal.ComputedProperty;
|
59361 | Ember._setClassicDecorator = metal.setClassicDecorator;
|
59362 | Ember.meta = _meta.meta;
|
59363 | Ember.get = metal.get;
|
59364 | Ember.getWithDefault = metal.getWithDefault;
|
59365 | Ember._getPath = metal._getPath;
|
59366 | Ember.set = metal.set;
|
59367 | Ember.trySet = metal.trySet;
|
59368 | Ember.FEATURES = (0, _polyfills.assign)({
|
59369 | isEnabled: _canaryFeatures.isEnabled
|
59370 | }, _canaryFeatures.FEATURES);
|
59371 | Ember._Cache = utils.Cache;
|
59372 | Ember.on = metal.on;
|
59373 | Ember.addListener = metal.addListener;
|
59374 | Ember.removeListener = metal.removeListener;
|
59375 | Ember.sendEvent = metal.sendEvent;
|
59376 | Ember.hasListeners = metal.hasListeners;
|
59377 | Ember.isNone = metal.isNone;
|
59378 | Ember.isEmpty = metal.isEmpty;
|
59379 | Ember.isBlank = metal.isBlank;
|
59380 | Ember.isPresent = metal.isPresent;
|
59381 | Ember.notifyPropertyChange = metal.notifyPropertyChange;
|
59382 | Ember.beginPropertyChanges = metal.beginPropertyChanges;
|
59383 | Ember.endPropertyChanges = metal.endPropertyChanges;
|
59384 | Ember.changeProperties = metal.changeProperties;
|
59385 | Ember.platform = {
|
59386 | defineProperty: true,
|
59387 | hasPropertyAccessors: true
|
59388 | };
|
59389 | Ember.defineProperty = metal.defineProperty;
|
59390 | Ember.destroy = _runtime2.destroy;
|
59391 | Ember.libraries = metal.libraries;
|
59392 | Ember.getProperties = metal.getProperties;
|
59393 | Ember.setProperties = metal.setProperties;
|
59394 | Ember.expandProperties = metal.expandProperties;
|
59395 | Ember.addObserver = metal.addObserver;
|
59396 | Ember.removeObserver = metal.removeObserver;
|
59397 | Ember.aliasMethod = metal.aliasMethod;
|
59398 | Ember.observer = metal.observer;
|
59399 | Ember.mixin = metal.mixin;
|
59400 | Ember.Mixin = metal.Mixin;
|
59401 |
|
59402 | if (false
|
59403 | /* EMBER_CACHE_API */
|
59404 | ) {
|
59405 | Ember._createCache = metal.createCache;
|
59406 | Ember._cacheGetValue = metal.getValue;
|
59407 | Ember._cacheIsConst = metal.isConst;
|
59408 | }
|
59409 | /**
|
59410 | A function may be assigned to `Ember.onerror` to be called when Ember
|
59411 | internals encounter an error. This is useful for specialized error handling
|
59412 | and reporting code.
|
59413 |
|
59414 | ```javascript
|
59415 | import $ from 'jquery';
|
59416 |
|
59417 | Ember.onerror = function(error) {
|
59418 | $.ajax('/report-error', 'POST', {
|
59419 | stack: error.stack,
|
59420 | otherInformation: 'whatever app state you want to provide'
|
59421 | });
|
59422 | };
|
59423 | ```
|
59424 |
|
59425 | Internally, `Ember.onerror` is used as Backburner's error handler.
|
59426 |
|
59427 | @event onerror
|
59428 | @for Ember
|
59429 | @param {Exception} error the error object
|
59430 | @public
|
59431 | */
|
59432 |
|
59433 |
|
59434 | Object.defineProperty(Ember, 'onerror', {
|
59435 | get: _errorHandling.getOnerror,
|
59436 | set: _errorHandling.setOnerror,
|
59437 | enumerable: false
|
59438 | });
|
59439 | Object.defineProperty(Ember, 'testing', {
|
59440 | get: EmberDebug.isTesting,
|
59441 | set: EmberDebug.setTesting,
|
59442 | enumerable: false
|
59443 | });
|
59444 | Ember._Backburner = _backburner.default; // ****@ember/-internals/console****
|
59445 |
|
59446 | if (_deprecatedFeatures.LOGGER) {
|
59447 | Ember.Logger = _console.default;
|
59448 | } // ****@ember/-internals/runtime****
|
59449 |
|
59450 |
|
59451 | Ember.A = _runtime.A;
|
59452 | Ember.String = {
|
59453 | loc: _string.loc,
|
59454 | w: _string.w,
|
59455 | dasherize: _string.dasherize,
|
59456 | decamelize: _string.decamelize,
|
59457 | camelize: _string.camelize,
|
59458 | classify: _string.classify,
|
59459 | underscore: _string.underscore,
|
59460 | capitalize: _string.capitalize
|
59461 | };
|
59462 | Ember.Object = _runtime.Object;
|
59463 | Ember._RegistryProxyMixin = _runtime.RegistryProxyMixin;
|
59464 | Ember._ContainerProxyMixin = _runtime.ContainerProxyMixin;
|
59465 | Ember.compare = _runtime.compare;
|
59466 | Ember.copy = _runtime.copy;
|
59467 | Ember.isEqual = _runtime.isEqual;
|
59468 | /**
|
59469 | @module ember
|
59470 | */
|
59471 |
|
59472 | /**
|
59473 | Namespace for injection helper methods.
|
59474 |
|
59475 | @class inject
|
59476 | @namespace Ember
|
59477 | @static
|
59478 | @public
|
59479 | */
|
59480 |
|
59481 | Ember.inject = function inject() {
|
59482 | (true && !(false) && (0, EmberDebug.assert)(`Injected properties must be created through helpers, see '${Object.keys(inject).map(k => `'inject.${k}'`).join(' or ')}'`));
|
59483 | };
|
59484 |
|
59485 | Ember.inject.service = _service.inject;
|
59486 | Ember.inject.controller = _controller.inject;
|
59487 | Ember.Array = _runtime.Array;
|
59488 | Ember.Comparable = _runtime.Comparable;
|
59489 | Ember.Enumerable = _runtime.Enumerable;
|
59490 | Ember.ArrayProxy = _runtime.ArrayProxy;
|
59491 | Ember.ObjectProxy = _runtime.ObjectProxy;
|
59492 | Ember.ActionHandler = _runtime.ActionHandler;
|
59493 | Ember.CoreObject = _runtime.CoreObject;
|
59494 | Ember.NativeArray = _runtime.NativeArray;
|
59495 | Ember.Copyable = _runtime.Copyable;
|
59496 | Ember.MutableEnumerable = _runtime.MutableEnumerable;
|
59497 | Ember.MutableArray = _runtime.MutableArray;
|
59498 | Ember.TargetActionSupport = _runtime.TargetActionSupport;
|
59499 | Ember.Evented = _runtime.Evented;
|
59500 | Ember.PromiseProxyMixin = _runtime.PromiseProxyMixin;
|
59501 | Ember.Observable = _runtime.Observable;
|
59502 | Ember.typeOf = _runtime.typeOf;
|
59503 | Ember.isArray = _runtime.isArray;
|
59504 | Ember.Object = _runtime.Object;
|
59505 | Ember.onLoad = _application.onLoad;
|
59506 | Ember.runLoadHooks = _application.runLoadHooks;
|
59507 | Ember.Controller = _controller.default;
|
59508 | Ember.ControllerMixin = _controller_mixin.default;
|
59509 | Ember.Service = _service.default;
|
59510 | Ember._ProxyMixin = _runtime._ProxyMixin;
|
59511 | Ember.RSVP = _runtime.RSVP;
|
59512 | Ember.Namespace = _runtime.Namespace;
|
59513 | Ember._action = _object.action;
|
59514 | Ember._dependentKeyCompat = _compat.dependentKeyCompat;
|
59515 | computed.empty = _computed.empty;
|
59516 | computed.notEmpty = _computed.notEmpty;
|
59517 | computed.none = _computed.none;
|
59518 | computed.not = _computed.not;
|
59519 | computed.bool = _computed.bool;
|
59520 | computed.match = _computed.match;
|
59521 | computed.equal = _computed.equal;
|
59522 | computed.gt = _computed.gt;
|
59523 | computed.gte = _computed.gte;
|
59524 | computed.lt = _computed.lt;
|
59525 | computed.lte = _computed.lte;
|
59526 | computed.oneWay = _computed.oneWay;
|
59527 | computed.reads = _computed.oneWay;
|
59528 | computed.readOnly = _computed.readOnly;
|
59529 | computed.deprecatingAlias = _computed.deprecatingAlias;
|
59530 | computed.and = _computed.and;
|
59531 | computed.or = _computed.or;
|
59532 | computed.sum = _computed.sum;
|
59533 | computed.min = _computed.min;
|
59534 | computed.max = _computed.max;
|
59535 | computed.map = _computed.map;
|
59536 | computed.sort = _computed.sort;
|
59537 | computed.setDiff = _computed.setDiff;
|
59538 | computed.mapBy = _computed.mapBy;
|
59539 | computed.filter = _computed.filter;
|
59540 | computed.filterBy = _computed.filterBy;
|
59541 | computed.uniq = _computed.uniq;
|
59542 | computed.uniqBy = _computed.uniqBy;
|
59543 | computed.union = _computed.union;
|
59544 | computed.intersect = _computed.intersect;
|
59545 | computed.collect = _computed.collect;
|
59546 | /**
|
59547 | Defines the hash of localized strings for the current language. Used by
|
59548 | the `String.loc` helper. To localize, add string values to this
|
59549 | hash.
|
59550 |
|
59551 | @property STRINGS
|
59552 | @for Ember
|
59553 | @type Object
|
59554 | @private
|
59555 | */
|
59556 |
|
59557 | Object.defineProperty(Ember, 'STRINGS', {
|
59558 | configurable: false,
|
59559 | get: _string._getStrings,
|
59560 | set: _string._setStrings
|
59561 | });
|
59562 | /**
|
59563 | Whether searching on the global for new Namespace instances is enabled.
|
59564 |
|
59565 | This is only exported here as to not break any addons. Given the new
|
59566 | visit API, you will have issues if you treat this as a indicator of
|
59567 | booted.
|
59568 |
|
59569 | Internally this is only exposing a flag in Namespace.
|
59570 |
|
59571 | @property BOOTED
|
59572 | @for Ember
|
59573 | @type Boolean
|
59574 | @private
|
59575 | */
|
59576 |
|
59577 | Object.defineProperty(Ember, 'BOOTED', {
|
59578 | configurable: false,
|
59579 | enumerable: false,
|
59580 | get: metal.isNamespaceSearchDisabled,
|
59581 | set: metal.setNamespaceSearchDisabled
|
59582 | }); // ****@ember/-internals/glimmer****
|
59583 |
|
59584 | Ember.Component = _glimmer.Component;
|
59585 | _glimmer.Helper.helper = _glimmer.helper;
|
59586 | Ember.Helper = _glimmer.Helper;
|
59587 | Ember.Checkbox = _glimmer.Checkbox;
|
59588 | Ember.TextField = _glimmer.TextField;
|
59589 | Ember.TextArea = _glimmer.TextArea;
|
59590 | Ember.LinkComponent = _glimmer.LinkComponent;
|
59591 | Ember._setComponentManager = _glimmer.setComponentManager;
|
59592 | Ember._componentManagerCapabilities = _glimmer.capabilities;
|
59593 | Ember._setModifierManager = _glimmer.setModifierManager;
|
59594 | Ember._modifierManagerCapabilities = _glimmer.modifierCapabilities;
|
59595 |
|
59596 | if (true
|
59597 | /* EMBER_GLIMMER_SET_COMPONENT_TEMPLATE */
|
59598 | ) {
|
59599 | Ember._getComponentTemplate = _glimmer.getComponentTemplate;
|
59600 | Ember._setComponentTemplate = _glimmer.setComponentTemplate;
|
59601 | Ember._templateOnlyComponent = _templateOnly.default;
|
59602 | }
|
59603 |
|
59604 | Ember._captureRenderTree = EmberDebug.captureRenderTree;
|
59605 | Ember.Handlebars = {
|
59606 | template: _glimmer.template,
|
59607 | Utils: {
|
59608 | escapeExpression: _glimmer.escapeExpression
|
59609 | }
|
59610 | };
|
59611 | Ember.HTMLBars = {
|
59612 | template: _glimmer.template
|
59613 | };
|
59614 |
|
59615 | if (_environment.ENV.EXTEND_PROTOTYPES.String) {
|
59616 | String.prototype.htmlSafe = function () {
|
59617 | return (0, _glimmer.htmlSafe)(this);
|
59618 | };
|
59619 | }
|
59620 |
|
59621 | Ember.String.htmlSafe = _glimmer.htmlSafe;
|
59622 | Ember.String.isHTMLSafe = _glimmer.isHTMLSafe;
|
59623 | /**
|
59624 | Global hash of shared templates. This will automatically be populated
|
59625 | by the build tools so that you can store your Handlebars templates in
|
59626 | separate files that get loaded into JavaScript at buildtime.
|
59627 |
|
59628 | @property TEMPLATES
|
59629 | @for Ember
|
59630 | @type Object
|
59631 | @private
|
59632 | */
|
59633 |
|
59634 | Object.defineProperty(Ember, 'TEMPLATES', {
|
59635 | get: _glimmer.getTemplates,
|
59636 | set: _glimmer.setTemplates,
|
59637 | configurable: false,
|
59638 | enumerable: false
|
59639 | });
|
59640 | /**
|
59641 | The semantic version
|
59642 |
|
59643 | @property VERSION
|
59644 | @type String
|
59645 | @public
|
59646 | */
|
59647 |
|
59648 | Ember.VERSION = _version.default; // ****@ember/-internals/views****
|
59649 |
|
59650 | if (_deprecatedFeatures.JQUERY_INTEGRATION && !views.jQueryDisabled) {
|
59651 | Object.defineProperty(Ember, '$', {
|
59652 | get() {
|
59653 | (true && !(false) && (0, EmberDebug.deprecate)("Using Ember.$() has been deprecated, use `import jQuery from 'jquery';` instead", false, {
|
59654 | id: 'ember-views.curly-components.jquery-element',
|
59655 | until: '4.0.0',
|
59656 | url: 'https://emberjs.com/deprecations/v3.x#toc_jquery-apis'
|
59657 | }));
|
59658 | return views.jQuery;
|
59659 | },
|
59660 |
|
59661 | configurable: true,
|
59662 | enumerable: true
|
59663 | });
|
59664 | }
|
59665 |
|
59666 | Ember.ViewUtils = {
|
59667 | isSimpleClick: views.isSimpleClick,
|
59668 | getElementView: views.getElementView,
|
59669 | getViewElement: views.getViewElement,
|
59670 | getViewBounds: views.getViewBounds,
|
59671 | getViewClientRects: views.getViewClientRects,
|
59672 | getViewBoundingClientRect: views.getViewBoundingClientRect,
|
59673 | getRootViews: views.getRootViews,
|
59674 | getChildViews: views.getChildViews,
|
59675 | isSerializationFirstNode: _glimmer.isSerializationFirstNode
|
59676 | };
|
59677 | Ember.TextSupport = views.TextSupport;
|
59678 | Ember.ComponentLookup = views.ComponentLookup;
|
59679 | Ember.EventDispatcher = views.EventDispatcher; // ****@ember/-internals/routing****
|
59680 |
|
59681 | Ember.Location = routing.Location;
|
59682 | Ember.AutoLocation = routing.AutoLocation;
|
59683 | Ember.HashLocation = routing.HashLocation;
|
59684 | Ember.HistoryLocation = routing.HistoryLocation;
|
59685 | Ember.NoneLocation = routing.NoneLocation;
|
59686 | Ember.controllerFor = routing.controllerFor;
|
59687 | Ember.generateControllerFactory = routing.generateControllerFactory;
|
59688 | Ember.generateController = routing.generateController;
|
59689 | Ember.RouterDSL = routing.RouterDSL;
|
59690 | Ember.Router = routing.Router;
|
59691 | Ember.Route = routing.Route;
|
59692 | (0, _application.runLoadHooks)('Ember.Application', _application.default);
|
59693 | Ember.DataAdapter = extensionSupport.DataAdapter;
|
59694 | Ember.ContainerDebugAdapter = extensionSupport.ContainerDebugAdapter;
|
59695 |
|
59696 | if ((0, _require.has)('ember-template-compiler')) {
|
59697 | (0, _require.default)("ember-template-compiler");
|
59698 | } // do this to ensure that Ember.Test is defined properly on the global
|
59699 | // if it is present.
|
59700 |
|
59701 |
|
59702 | if ((0, _require.has)('ember-testing')) {
|
59703 | var testing = (0, _require.default)("ember-testing");
|
59704 | Ember.Test = testing.Test;
|
59705 | Ember.Test.Adapter = testing.Adapter;
|
59706 | Ember.Test.QUnitAdapter = testing.QUnitAdapter;
|
59707 | Ember.setupForTesting = testing.setupForTesting;
|
59708 | }
|
59709 |
|
59710 | (0, _application.runLoadHooks)('Ember');
|
59711 | var _default = Ember;
|
59712 | _exports.default = _default;
|
59713 |
|
59714 | if (_nodeModule.IS_NODE) {
|
59715 | _nodeModule.module.exports = Ember;
|
59716 | } else {
|
59717 | _environment.context.exports.Ember = _environment.context.exports.Em = Ember;
|
59718 | }
|
59719 | /**
|
59720 | @module jquery
|
59721 | @public
|
59722 | */
|
59723 |
|
59724 | /**
|
59725 | @class jquery
|
59726 | @public
|
59727 | @static
|
59728 | */
|
59729 |
|
59730 | /**
|
59731 | Alias for jQuery
|
59732 |
|
59733 | @for jquery
|
59734 | @method $
|
59735 | @static
|
59736 | @public
|
59737 | */
|
59738 |
|
59739 | });
|
59740 | define("ember/version", ["exports"], function (_exports) {
|
59741 | "use strict";
|
59742 |
|
59743 | Object.defineProperty(_exports, "__esModule", {
|
59744 | value: true
|
59745 | });
|
59746 | _exports.default = void 0;
|
59747 | var _default = "3.21.3";
|
59748 | _exports.default = _default;
|
59749 | });
|
59750 | define("node-module/index", ["exports"], function (_exports) {
|
59751 | "use strict";
|
59752 |
|
59753 | Object.defineProperty(_exports, "__esModule", {
|
59754 | value: true
|
59755 | });
|
59756 | _exports.require = _exports.module = _exports.IS_NODE = void 0;
|
59757 |
|
59758 | /*global module */
|
59759 | var IS_NODE = typeof module === 'object' && typeof module.require === 'function';
|
59760 | _exports.IS_NODE = IS_NODE;
|
59761 | var exportModule;
|
59762 | _exports.module = exportModule;
|
59763 | var exportRequire;
|
59764 | _exports.require = exportRequire;
|
59765 |
|
59766 | if (IS_NODE) {
|
59767 | _exports.module = exportModule = module;
|
59768 | _exports.require = exportRequire = module.require;
|
59769 | } else {
|
59770 | _exports.module = exportModule = null;
|
59771 | _exports.require = exportRequire = null;
|
59772 | }
|
59773 | });
|
59774 | define("route-recognizer", ["exports"], function (_exports) {
|
59775 | "use strict";
|
59776 |
|
59777 | Object.defineProperty(_exports, "__esModule", {
|
59778 | value: true
|
59779 | });
|
59780 | _exports.default = void 0;
|
59781 | var createObject = Object.create;
|
59782 |
|
59783 | function createMap() {
|
59784 | var map = createObject(null);
|
59785 | map["__"] = undefined;
|
59786 | delete map["__"];
|
59787 | return map;
|
59788 | }
|
59789 |
|
59790 | var Target = function Target(path, matcher, delegate) {
|
59791 | this.path = path;
|
59792 | this.matcher = matcher;
|
59793 | this.delegate = delegate;
|
59794 | };
|
59795 |
|
59796 | Target.prototype.to = function to(target, callback) {
|
59797 | var delegate = this.delegate;
|
59798 |
|
59799 | if (delegate && delegate.willAddRoute) {
|
59800 | target = delegate.willAddRoute(this.matcher.target, target);
|
59801 | }
|
59802 |
|
59803 | this.matcher.add(this.path, target);
|
59804 |
|
59805 | if (callback) {
|
59806 | if (callback.length === 0) {
|
59807 | throw new Error("You must have an argument in the function passed to `to`");
|
59808 | }
|
59809 |
|
59810 | this.matcher.addChild(this.path, target, callback, this.delegate);
|
59811 | }
|
59812 | };
|
59813 |
|
59814 | var Matcher = function Matcher(target) {
|
59815 | this.routes = createMap();
|
59816 | this.children = createMap();
|
59817 | this.target = target;
|
59818 | };
|
59819 |
|
59820 | Matcher.prototype.add = function add(path, target) {
|
59821 | this.routes[path] = target;
|
59822 | };
|
59823 |
|
59824 | Matcher.prototype.addChild = function addChild(path, target, callback, delegate) {
|
59825 | var matcher = new Matcher(target);
|
59826 | this.children[path] = matcher;
|
59827 | var match = generateMatch(path, matcher, delegate);
|
59828 |
|
59829 | if (delegate && delegate.contextEntered) {
|
59830 | delegate.contextEntered(target, match);
|
59831 | }
|
59832 |
|
59833 | callback(match);
|
59834 | };
|
59835 |
|
59836 | function generateMatch(startingPath, matcher, delegate) {
|
59837 | function match(path, callback) {
|
59838 | var fullPath = startingPath + path;
|
59839 |
|
59840 | if (callback) {
|
59841 | callback(generateMatch(fullPath, matcher, delegate));
|
59842 | } else {
|
59843 | return new Target(fullPath, matcher, delegate);
|
59844 | }
|
59845 | }
|
59846 |
|
59847 | return match;
|
59848 | }
|
59849 |
|
59850 | function addRoute(routeArray, path, handler) {
|
59851 | var len = 0;
|
59852 |
|
59853 | for (var i = 0; i < routeArray.length; i++) {
|
59854 | len += routeArray[i].path.length;
|
59855 | }
|
59856 |
|
59857 | path = path.substr(len);
|
59858 | var route = {
|
59859 | path: path,
|
59860 | handler: handler
|
59861 | };
|
59862 | routeArray.push(route);
|
59863 | }
|
59864 |
|
59865 | function eachRoute(baseRoute, matcher, callback, binding) {
|
59866 | var routes = matcher.routes;
|
59867 | var paths = Object.keys(routes);
|
59868 |
|
59869 | for (var i = 0; i < paths.length; i++) {
|
59870 | var path = paths[i];
|
59871 | var routeArray = baseRoute.slice();
|
59872 | addRoute(routeArray, path, routes[path]);
|
59873 | var nested = matcher.children[path];
|
59874 |
|
59875 | if (nested) {
|
59876 | eachRoute(routeArray, nested, callback, binding);
|
59877 | } else {
|
59878 | callback.call(binding, routeArray);
|
59879 | }
|
59880 | }
|
59881 | }
|
59882 |
|
59883 | var map = function (callback, addRouteCallback) {
|
59884 | var matcher = new Matcher();
|
59885 | callback(generateMatch("", matcher, this.delegate));
|
59886 | eachRoute([], matcher, function (routes) {
|
59887 | if (addRouteCallback) {
|
59888 | addRouteCallback(this, routes);
|
59889 | } else {
|
59890 | this.add(routes);
|
59891 | }
|
59892 | }, this);
|
59893 | }; // Normalizes percent-encoded values in `path` to upper-case and decodes percent-encoded
|
59894 | // values that are not reserved (i.e., unicode characters, emoji, etc). The reserved
|
59895 | // chars are "/" and "%".
|
59896 | // Safe to call multiple times on the same path.
|
59897 | // Normalizes percent-encoded values in `path` to upper-case and decodes percent-encoded
|
59898 |
|
59899 |
|
59900 | function normalizePath(path) {
|
59901 | return path.split("/").map(normalizeSegment).join("/");
|
59902 | } // We want to ensure the characters "%" and "/" remain in percent-encoded
|
59903 | // form when normalizing paths, so replace them with their encoded form after
|
59904 | // decoding the rest of the path
|
59905 |
|
59906 |
|
59907 | var SEGMENT_RESERVED_CHARS = /%|\//g;
|
59908 |
|
59909 | function normalizeSegment(segment) {
|
59910 | if (segment.length < 3 || segment.indexOf("%") === -1) {
|
59911 | return segment;
|
59912 | }
|
59913 |
|
59914 | return decodeURIComponent(segment).replace(SEGMENT_RESERVED_CHARS, encodeURIComponent);
|
59915 | } // We do not want to encode these characters when generating dynamic path segments
|
59916 | // See https://tools.ietf.org/html/rfc3986#section-3.3
|
59917 | // sub-delims: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="
|
59918 | // others allowed by RFC 3986: ":", "@"
|
59919 | //
|
59920 | // First encode the entire path segment, then decode any of the encoded special chars.
|
59921 | //
|
59922 | // The chars "!", "'", "(", ")", "*" do not get changed by `encodeURIComponent`,
|
59923 | // so the possible encoded chars are:
|
59924 | // ['%24', '%26', '%2B', '%2C', '%3B', '%3D', '%3A', '%40'].
|
59925 |
|
59926 |
|
59927 | var PATH_SEGMENT_ENCODINGS = /%(?:2(?:4|6|B|C)|3(?:B|D|A)|40)/g;
|
59928 |
|
59929 | function encodePathSegment(str) {
|
59930 | return encodeURIComponent(str).replace(PATH_SEGMENT_ENCODINGS, decodeURIComponent);
|
59931 | }
|
59932 |
|
59933 | var escapeRegex = /(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\)/g;
|
59934 | var isArray = Array.isArray;
|
59935 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
59936 |
|
59937 | function getParam(params, key) {
|
59938 | if (typeof params !== "object" || params === null) {
|
59939 | throw new Error("You must pass an object as the second argument to `generate`.");
|
59940 | }
|
59941 |
|
59942 | if (!hasOwnProperty.call(params, key)) {
|
59943 | throw new Error("You must provide param `" + key + "` to `generate`.");
|
59944 | }
|
59945 |
|
59946 | var value = params[key];
|
59947 | var str = typeof value === "string" ? value : "" + value;
|
59948 |
|
59949 | if (str.length === 0) {
|
59950 | throw new Error("You must provide a param `" + key + "`.");
|
59951 | }
|
59952 |
|
59953 | return str;
|
59954 | }
|
59955 |
|
59956 | var eachChar = [];
|
59957 |
|
59958 | eachChar[0
|
59959 | /* Static */
|
59960 | ] = function (segment, currentState) {
|
59961 | var state = currentState;
|
59962 | var value = segment.value;
|
59963 |
|
59964 | for (var i = 0; i < value.length; i++) {
|
59965 | var ch = value.charCodeAt(i);
|
59966 | state = state.put(ch, false, false);
|
59967 | }
|
59968 |
|
59969 | return state;
|
59970 | };
|
59971 |
|
59972 | eachChar[1
|
59973 | /* Dynamic */
|
59974 | ] = function (_, currentState) {
|
59975 | return currentState.put(47
|
59976 | /* SLASH */
|
59977 | , true, true);
|
59978 | };
|
59979 |
|
59980 | eachChar[2
|
59981 | /* Star */
|
59982 | ] = function (_, currentState) {
|
59983 | return currentState.put(-1
|
59984 | /* ANY */
|
59985 | , false, true);
|
59986 | };
|
59987 |
|
59988 | eachChar[4
|
59989 | /* Epsilon */
|
59990 | ] = function (_, currentState) {
|
59991 | return currentState;
|
59992 | };
|
59993 |
|
59994 | var regex = [];
|
59995 |
|
59996 | regex[0
|
59997 | /* Static */
|
59998 | ] = function (segment) {
|
59999 | return segment.value.replace(escapeRegex, "\\$1");
|
60000 | };
|
60001 |
|
60002 | regex[1
|
60003 | /* Dynamic */
|
60004 | ] = function () {
|
60005 | return "([^/]+)";
|
60006 | };
|
60007 |
|
60008 | regex[2
|
60009 | /* Star */
|
60010 | ] = function () {
|
60011 | return "(.+)";
|
60012 | };
|
60013 |
|
60014 | regex[4
|
60015 | /* Epsilon */
|
60016 | ] = function () {
|
60017 | return "";
|
60018 | };
|
60019 |
|
60020 | var generate = [];
|
60021 |
|
60022 | generate[0
|
60023 | /* Static */
|
60024 | ] = function (segment) {
|
60025 | return segment.value;
|
60026 | };
|
60027 |
|
60028 | generate[1
|
60029 | /* Dynamic */
|
60030 | ] = function (segment, params) {
|
60031 | var value = getParam(params, segment.value);
|
60032 |
|
60033 | if (RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS) {
|
60034 | return encodePathSegment(value);
|
60035 | } else {
|
60036 | return value;
|
60037 | }
|
60038 | };
|
60039 |
|
60040 | generate[2
|
60041 | /* Star */
|
60042 | ] = function (segment, params) {
|
60043 | return getParam(params, segment.value);
|
60044 | };
|
60045 |
|
60046 | generate[4
|
60047 | /* Epsilon */
|
60048 | ] = function () {
|
60049 | return "";
|
60050 | };
|
60051 |
|
60052 | var EmptyObject = Object.freeze({});
|
60053 | var EmptyArray = Object.freeze([]); // The `names` will be populated with the paramter name for each dynamic/star
|
60054 | // segment. `shouldDecodes` will be populated with a boolean for each dyanamic/star
|
60055 | // segment, indicating whether it should be decoded during recognition.
|
60056 |
|
60057 | function parse(segments, route, types) {
|
60058 | // normalize route as not starting with a "/". Recognition will
|
60059 | // also normalize.
|
60060 | if (route.length > 0 && route.charCodeAt(0) === 47
|
60061 | /* SLASH */
|
60062 | ) {
|
60063 | route = route.substr(1);
|
60064 | }
|
60065 |
|
60066 | var parts = route.split("/");
|
60067 | var names = undefined;
|
60068 | var shouldDecodes = undefined;
|
60069 |
|
60070 | for (var i = 0; i < parts.length; i++) {
|
60071 | var part = parts[i];
|
60072 | var flags = 0;
|
60073 | var type = 0;
|
60074 |
|
60075 | if (part === "") {
|
60076 | type = 4
|
60077 | /* Epsilon */
|
60078 | ;
|
60079 | } else if (part.charCodeAt(0) === 58
|
60080 | /* COLON */
|
60081 | ) {
|
60082 | type = 1
|
60083 | /* Dynamic */
|
60084 | ;
|
60085 | } else if (part.charCodeAt(0) === 42
|
60086 | /* STAR */
|
60087 | ) {
|
60088 | type = 2
|
60089 | /* Star */
|
60090 | ;
|
60091 | } else {
|
60092 | type = 0
|
60093 | /* Static */
|
60094 | ;
|
60095 | }
|
60096 |
|
60097 | flags = 2 << type;
|
60098 |
|
60099 | if (flags & 12
|
60100 | /* Named */
|
60101 | ) {
|
60102 | part = part.slice(1);
|
60103 | names = names || [];
|
60104 | names.push(part);
|
60105 | shouldDecodes = shouldDecodes || [];
|
60106 | shouldDecodes.push((flags & 4
|
60107 | /* Decoded */
|
60108 | ) !== 0);
|
60109 | }
|
60110 |
|
60111 | if (flags & 14
|
60112 | /* Counted */
|
60113 | ) {
|
60114 | types[type]++;
|
60115 | }
|
60116 |
|
60117 | segments.push({
|
60118 | type: type,
|
60119 | value: normalizeSegment(part)
|
60120 | });
|
60121 | }
|
60122 |
|
60123 | return {
|
60124 | names: names || EmptyArray,
|
60125 | shouldDecodes: shouldDecodes || EmptyArray
|
60126 | };
|
60127 | }
|
60128 |
|
60129 | function isEqualCharSpec(spec, char, negate) {
|
60130 | return spec.char === char && spec.negate === negate;
|
60131 | } // A State has a character specification and (`charSpec`) and a list of possible
|
60132 | // subsequent states (`nextStates`).
|
60133 | //
|
60134 | // If a State is an accepting state, it will also have several additional
|
60135 | // properties:
|
60136 | //
|
60137 | // * `regex`: A regular expression that is used to extract parameters from paths
|
60138 | // that reached this accepting state.
|
60139 | // * `handlers`: Information on how to convert the list of captures into calls
|
60140 | // to registered handlers with the specified parameters
|
60141 | // * `types`: How many static, dynamic or star segments in this route. Used to
|
60142 | // decide which route to use if multiple registered routes match a path.
|
60143 | //
|
60144 | // Currently, State is implemented naively by looping over `nextStates` and
|
60145 | // comparing a character specification against a character. A more efficient
|
60146 | // implementation would use a hash of keys pointing at one or more next states.
|
60147 |
|
60148 |
|
60149 | var State = function State(states, id, char, negate, repeat) {
|
60150 | this.states = states;
|
60151 | this.id = id;
|
60152 | this.char = char;
|
60153 | this.negate = negate;
|
60154 | this.nextStates = repeat ? id : null;
|
60155 | this.pattern = "";
|
60156 | this._regex = undefined;
|
60157 | this.handlers = undefined;
|
60158 | this.types = undefined;
|
60159 | };
|
60160 |
|
60161 | State.prototype.regex = function regex$1() {
|
60162 | if (!this._regex) {
|
60163 | this._regex = new RegExp(this.pattern);
|
60164 | }
|
60165 |
|
60166 | return this._regex;
|
60167 | };
|
60168 |
|
60169 | State.prototype.get = function get(char, negate) {
|
60170 | var this$1 = this;
|
60171 | var nextStates = this.nextStates;
|
60172 |
|
60173 | if (nextStates === null) {
|
60174 | return;
|
60175 | }
|
60176 |
|
60177 | if (isArray(nextStates)) {
|
60178 | for (var i = 0; i < nextStates.length; i++) {
|
60179 | var child = this$1.states[nextStates[i]];
|
60180 |
|
60181 | if (isEqualCharSpec(child, char, negate)) {
|
60182 | return child;
|
60183 | }
|
60184 | }
|
60185 | } else {
|
60186 | var child$1 = this.states[nextStates];
|
60187 |
|
60188 | if (isEqualCharSpec(child$1, char, negate)) {
|
60189 | return child$1;
|
60190 | }
|
60191 | }
|
60192 | };
|
60193 |
|
60194 | State.prototype.put = function put(char, negate, repeat) {
|
60195 | var state; // If the character specification already exists in a child of the current
|
60196 | // state, just return that state.
|
60197 |
|
60198 | if (state = this.get(char, negate)) {
|
60199 | return state;
|
60200 | } // Make a new state for the character spec
|
60201 |
|
60202 |
|
60203 | var states = this.states;
|
60204 | state = new State(states, states.length, char, negate, repeat);
|
60205 | states[states.length] = state; // Insert the new state as a child of the current state
|
60206 |
|
60207 | if (this.nextStates == null) {
|
60208 | this.nextStates = state.id;
|
60209 | } else if (isArray(this.nextStates)) {
|
60210 | this.nextStates.push(state.id);
|
60211 | } else {
|
60212 | this.nextStates = [this.nextStates, state.id];
|
60213 | } // Return the new state
|
60214 |
|
60215 |
|
60216 | return state;
|
60217 | }; // Find a list of child states matching the next character
|
60218 |
|
60219 |
|
60220 | State.prototype.match = function match(ch) {
|
60221 | var this$1 = this;
|
60222 | var nextStates = this.nextStates;
|
60223 |
|
60224 | if (!nextStates) {
|
60225 | return [];
|
60226 | }
|
60227 |
|
60228 | var returned = [];
|
60229 |
|
60230 | if (isArray(nextStates)) {
|
60231 | for (var i = 0; i < nextStates.length; i++) {
|
60232 | var child = this$1.states[nextStates[i]];
|
60233 |
|
60234 | if (isMatch(child, ch)) {
|
60235 | returned.push(child);
|
60236 | }
|
60237 | }
|
60238 | } else {
|
60239 | var child$1 = this.states[nextStates];
|
60240 |
|
60241 | if (isMatch(child$1, ch)) {
|
60242 | returned.push(child$1);
|
60243 | }
|
60244 | }
|
60245 |
|
60246 | return returned;
|
60247 | };
|
60248 |
|
60249 | function isMatch(spec, char) {
|
60250 | return spec.negate ? spec.char !== char && spec.char !== -1
|
60251 | /* ANY */
|
60252 | : spec.char === char || spec.char === -1
|
60253 | /* ANY */
|
60254 | ;
|
60255 | } // This is a somewhat naive strategy, but should work in a lot of cases
|
60256 | // A better strategy would properly resolve /posts/:id/new and /posts/edit/:id.
|
60257 | //
|
60258 | // This strategy generally prefers more static and less dynamic matching.
|
60259 | // Specifically, it
|
60260 | //
|
60261 | // * prefers fewer stars to more, then
|
60262 | // * prefers using stars for less of the match to more, then
|
60263 | // * prefers fewer dynamic segments to more, then
|
60264 | // * prefers more static segments to more
|
60265 |
|
60266 |
|
60267 | function sortSolutions(states) {
|
60268 | return states.sort(function (a, b) {
|
60269 | var ref = a.types || [0, 0, 0];
|
60270 | var astatics = ref[0];
|
60271 | var adynamics = ref[1];
|
60272 | var astars = ref[2];
|
60273 | var ref$1 = b.types || [0, 0, 0];
|
60274 | var bstatics = ref$1[0];
|
60275 | var bdynamics = ref$1[1];
|
60276 | var bstars = ref$1[2];
|
60277 |
|
60278 | if (astars !== bstars) {
|
60279 | return astars - bstars;
|
60280 | }
|
60281 |
|
60282 | if (astars) {
|
60283 | if (astatics !== bstatics) {
|
60284 | return bstatics - astatics;
|
60285 | }
|
60286 |
|
60287 | if (adynamics !== bdynamics) {
|
60288 | return bdynamics - adynamics;
|
60289 | }
|
60290 | }
|
60291 |
|
60292 | if (adynamics !== bdynamics) {
|
60293 | return adynamics - bdynamics;
|
60294 | }
|
60295 |
|
60296 | if (astatics !== bstatics) {
|
60297 | return bstatics - astatics;
|
60298 | }
|
60299 |
|
60300 | return 0;
|
60301 | });
|
60302 | }
|
60303 |
|
60304 | function recognizeChar(states, ch) {
|
60305 | var nextStates = [];
|
60306 |
|
60307 | for (var i = 0, l = states.length; i < l; i++) {
|
60308 | var state = states[i];
|
60309 | nextStates = nextStates.concat(state.match(ch));
|
60310 | }
|
60311 |
|
60312 | return nextStates;
|
60313 | }
|
60314 |
|
60315 | var RecognizeResults = function RecognizeResults(queryParams) {
|
60316 | this.length = 0;
|
60317 | this.queryParams = queryParams || {};
|
60318 | };
|
60319 |
|
60320 | RecognizeResults.prototype.splice = Array.prototype.splice;
|
60321 | RecognizeResults.prototype.slice = Array.prototype.slice;
|
60322 | RecognizeResults.prototype.push = Array.prototype.push;
|
60323 |
|
60324 | function findHandler(state, originalPath, queryParams) {
|
60325 | var handlers = state.handlers;
|
60326 | var regex = state.regex();
|
60327 |
|
60328 | if (!regex || !handlers) {
|
60329 | throw new Error("state not initialized");
|
60330 | }
|
60331 |
|
60332 | var captures = originalPath.match(regex);
|
60333 | var currentCapture = 1;
|
60334 | var result = new RecognizeResults(queryParams);
|
60335 | result.length = handlers.length;
|
60336 |
|
60337 | for (var i = 0; i < handlers.length; i++) {
|
60338 | var handler = handlers[i];
|
60339 | var names = handler.names;
|
60340 | var shouldDecodes = handler.shouldDecodes;
|
60341 | var params = EmptyObject;
|
60342 | var isDynamic = false;
|
60343 |
|
60344 | if (names !== EmptyArray && shouldDecodes !== EmptyArray) {
|
60345 | for (var j = 0; j < names.length; j++) {
|
60346 | isDynamic = true;
|
60347 | var name = names[j];
|
60348 | var capture = captures && captures[currentCapture++];
|
60349 |
|
60350 | if (params === EmptyObject) {
|
60351 | params = {};
|
60352 | }
|
60353 |
|
60354 | if (RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS && shouldDecodes[j]) {
|
60355 | params[name] = capture && decodeURIComponent(capture);
|
60356 | } else {
|
60357 | params[name] = capture;
|
60358 | }
|
60359 | }
|
60360 | }
|
60361 |
|
60362 | result[i] = {
|
60363 | handler: handler.handler,
|
60364 | params: params,
|
60365 | isDynamic: isDynamic
|
60366 | };
|
60367 | }
|
60368 |
|
60369 | return result;
|
60370 | }
|
60371 |
|
60372 | function decodeQueryParamPart(part) {
|
60373 | // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
|
60374 | part = part.replace(/\+/gm, "%20");
|
60375 | var result;
|
60376 |
|
60377 | try {
|
60378 | result = decodeURIComponent(part);
|
60379 | } catch (error) {
|
60380 | result = "";
|
60381 | }
|
60382 |
|
60383 | return result;
|
60384 | }
|
60385 |
|
60386 | var RouteRecognizer = function RouteRecognizer() {
|
60387 | this.names = createMap();
|
60388 | var states = [];
|
60389 | var state = new State(states, 0, -1
|
60390 | /* ANY */
|
60391 | , true, false);
|
60392 | states[0] = state;
|
60393 | this.states = states;
|
60394 | this.rootState = state;
|
60395 | };
|
60396 |
|
60397 | RouteRecognizer.prototype.add = function add(routes, options) {
|
60398 | var currentState = this.rootState;
|
60399 | var pattern = "^";
|
60400 | var types = [0, 0, 0];
|
60401 | var handlers = new Array(routes.length);
|
60402 | var allSegments = [];
|
60403 | var isEmpty = true;
|
60404 | var j = 0;
|
60405 |
|
60406 | for (var i = 0; i < routes.length; i++) {
|
60407 | var route = routes[i];
|
60408 | var ref = parse(allSegments, route.path, types);
|
60409 | var names = ref.names;
|
60410 | var shouldDecodes = ref.shouldDecodes; // preserve j so it points to the start of newly added segments
|
60411 |
|
60412 | for (; j < allSegments.length; j++) {
|
60413 | var segment = allSegments[j];
|
60414 |
|
60415 | if (segment.type === 4
|
60416 | /* Epsilon */
|
60417 | ) {
|
60418 | continue;
|
60419 | }
|
60420 |
|
60421 | isEmpty = false; // Add a "/" for the new segment
|
60422 |
|
60423 | currentState = currentState.put(47
|
60424 | /* SLASH */
|
60425 | , false, false);
|
60426 | pattern += "/"; // Add a representation of the segment to the NFA and regex
|
60427 |
|
60428 | currentState = eachChar[segment.type](segment, currentState);
|
60429 | pattern += regex[segment.type](segment);
|
60430 | }
|
60431 |
|
60432 | handlers[i] = {
|
60433 | handler: route.handler,
|
60434 | names: names,
|
60435 | shouldDecodes: shouldDecodes
|
60436 | };
|
60437 | }
|
60438 |
|
60439 | if (isEmpty) {
|
60440 | currentState = currentState.put(47
|
60441 | /* SLASH */
|
60442 | , false, false);
|
60443 | pattern += "/";
|
60444 | }
|
60445 |
|
60446 | currentState.handlers = handlers;
|
60447 | currentState.pattern = pattern + "$";
|
60448 | currentState.types = types;
|
60449 | var name;
|
60450 |
|
60451 | if (typeof options === "object" && options !== null && options.as) {
|
60452 | name = options.as;
|
60453 | }
|
60454 |
|
60455 | if (name) {
|
60456 | // if (this.names[name]) {
|
60457 | // throw new Error("You may not add a duplicate route named `" + name + "`.");
|
60458 | // }
|
60459 | this.names[name] = {
|
60460 | segments: allSegments,
|
60461 | handlers: handlers
|
60462 | };
|
60463 | }
|
60464 | };
|
60465 |
|
60466 | RouteRecognizer.prototype.handlersFor = function handlersFor(name) {
|
60467 | var route = this.names[name];
|
60468 |
|
60469 | if (!route) {
|
60470 | throw new Error("There is no route named " + name);
|
60471 | }
|
60472 |
|
60473 | var result = new Array(route.handlers.length);
|
60474 |
|
60475 | for (var i = 0; i < route.handlers.length; i++) {
|
60476 | var handler = route.handlers[i];
|
60477 | result[i] = handler;
|
60478 | }
|
60479 |
|
60480 | return result;
|
60481 | };
|
60482 |
|
60483 | RouteRecognizer.prototype.hasRoute = function hasRoute(name) {
|
60484 | return !!this.names[name];
|
60485 | };
|
60486 |
|
60487 | RouteRecognizer.prototype.generate = function generate$1(name, params) {
|
60488 | var route = this.names[name];
|
60489 | var output = "";
|
60490 |
|
60491 | if (!route) {
|
60492 | throw new Error("There is no route named " + name);
|
60493 | }
|
60494 |
|
60495 | var segments = route.segments;
|
60496 |
|
60497 | for (var i = 0; i < segments.length; i++) {
|
60498 | var segment = segments[i];
|
60499 |
|
60500 | if (segment.type === 4
|
60501 | /* Epsilon */
|
60502 | ) {
|
60503 | continue;
|
60504 | }
|
60505 |
|
60506 | output += "/";
|
60507 | output += generate[segment.type](segment, params);
|
60508 | }
|
60509 |
|
60510 | if (output.charAt(0) !== "/") {
|
60511 | output = "/" + output;
|
60512 | }
|
60513 |
|
60514 | if (params && params.queryParams) {
|
60515 | output += this.generateQueryString(params.queryParams);
|
60516 | }
|
60517 |
|
60518 | return output;
|
60519 | };
|
60520 |
|
60521 | RouteRecognizer.prototype.generateQueryString = function generateQueryString(params) {
|
60522 | var pairs = [];
|
60523 | var keys = Object.keys(params);
|
60524 | keys.sort();
|
60525 |
|
60526 | for (var i = 0; i < keys.length; i++) {
|
60527 | var key = keys[i];
|
60528 | var value = params[key];
|
60529 |
|
60530 | if (value == null) {
|
60531 | continue;
|
60532 | }
|
60533 |
|
60534 | var pair = encodeURIComponent(key);
|
60535 |
|
60536 | if (isArray(value)) {
|
60537 | for (var j = 0; j < value.length; j++) {
|
60538 | var arrayPair = key + "[]" + "=" + encodeURIComponent(value[j]);
|
60539 | pairs.push(arrayPair);
|
60540 | }
|
60541 | } else {
|
60542 | pair += "=" + encodeURIComponent(value);
|
60543 | pairs.push(pair);
|
60544 | }
|
60545 | }
|
60546 |
|
60547 | if (pairs.length === 0) {
|
60548 | return "";
|
60549 | }
|
60550 |
|
60551 | return "?" + pairs.join("&");
|
60552 | };
|
60553 |
|
60554 | RouteRecognizer.prototype.parseQueryString = function parseQueryString(queryString) {
|
60555 | var pairs = queryString.split("&");
|
60556 | var queryParams = {};
|
60557 |
|
60558 | for (var i = 0; i < pairs.length; i++) {
|
60559 | var pair = pairs[i].split("="),
|
60560 | key = decodeQueryParamPart(pair[0]),
|
60561 | keyLength = key.length,
|
60562 | isArray = false,
|
60563 | value = void 0;
|
60564 |
|
60565 | if (pair.length === 1) {
|
60566 | value = "true";
|
60567 | } else {
|
60568 | // Handle arrays
|
60569 | if (keyLength > 2 && key.slice(keyLength - 2) === "[]") {
|
60570 | isArray = true;
|
60571 | key = key.slice(0, keyLength - 2);
|
60572 |
|
60573 | if (!queryParams[key]) {
|
60574 | queryParams[key] = [];
|
60575 | }
|
60576 | }
|
60577 |
|
60578 | value = pair[1] ? decodeQueryParamPart(pair[1]) : "";
|
60579 | }
|
60580 |
|
60581 | if (isArray) {
|
60582 | queryParams[key].push(value);
|
60583 | } else {
|
60584 | queryParams[key] = value;
|
60585 | }
|
60586 | }
|
60587 |
|
60588 | return queryParams;
|
60589 | };
|
60590 |
|
60591 | RouteRecognizer.prototype.recognize = function recognize(path) {
|
60592 | var results;
|
60593 | var states = [this.rootState];
|
60594 | var queryParams = {};
|
60595 | var isSlashDropped = false;
|
60596 | var hashStart = path.indexOf("#");
|
60597 |
|
60598 | if (hashStart !== -1) {
|
60599 | path = path.substr(0, hashStart);
|
60600 | }
|
60601 |
|
60602 | var queryStart = path.indexOf("?");
|
60603 |
|
60604 | if (queryStart !== -1) {
|
60605 | var queryString = path.substr(queryStart + 1, path.length);
|
60606 | path = path.substr(0, queryStart);
|
60607 | queryParams = this.parseQueryString(queryString);
|
60608 | }
|
60609 |
|
60610 | if (path.charAt(0) !== "/") {
|
60611 | path = "/" + path;
|
60612 | }
|
60613 |
|
60614 | var originalPath = path;
|
60615 |
|
60616 | if (RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS) {
|
60617 | path = normalizePath(path);
|
60618 | } else {
|
60619 | path = decodeURI(path);
|
60620 | originalPath = decodeURI(originalPath);
|
60621 | }
|
60622 |
|
60623 | var pathLen = path.length;
|
60624 |
|
60625 | if (pathLen > 1 && path.charAt(pathLen - 1) === "/") {
|
60626 | path = path.substr(0, pathLen - 1);
|
60627 | originalPath = originalPath.substr(0, originalPath.length - 1);
|
60628 | isSlashDropped = true;
|
60629 | }
|
60630 |
|
60631 | for (var i = 0; i < path.length; i++) {
|
60632 | states = recognizeChar(states, path.charCodeAt(i));
|
60633 |
|
60634 | if (!states.length) {
|
60635 | break;
|
60636 | }
|
60637 | }
|
60638 |
|
60639 | var solutions = [];
|
60640 |
|
60641 | for (var i$1 = 0; i$1 < states.length; i$1++) {
|
60642 | if (states[i$1].handlers) {
|
60643 | solutions.push(states[i$1]);
|
60644 | }
|
60645 | }
|
60646 |
|
60647 | states = sortSolutions(solutions);
|
60648 | var state = solutions[0];
|
60649 |
|
60650 | if (state && state.handlers) {
|
60651 | // if a trailing slash was dropped and a star segment is the last segment
|
60652 | // specified, put the trailing slash back
|
60653 | if (isSlashDropped && state.pattern && state.pattern.slice(-5) === "(.+)$") {
|
60654 | originalPath = originalPath + "/";
|
60655 | }
|
60656 |
|
60657 | results = findHandler(state, originalPath, queryParams);
|
60658 | }
|
60659 |
|
60660 | return results;
|
60661 | };
|
60662 |
|
60663 | RouteRecognizer.VERSION = "0.3.4"; // Set to false to opt-out of encoding and decoding path segments.
|
60664 | // See https://github.com/tildeio/route-recognizer/pull/55
|
60665 |
|
60666 | RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS = true;
|
60667 | RouteRecognizer.Normalizer = {
|
60668 | normalizeSegment: normalizeSegment,
|
60669 | normalizePath: normalizePath,
|
60670 | encodePathSegment: encodePathSegment
|
60671 | };
|
60672 | RouteRecognizer.prototype.map = map;
|
60673 | var _default = RouteRecognizer;
|
60674 | _exports.default = _default;
|
60675 | });
|
60676 | define("router_js", ["exports", "@ember/polyfills", "rsvp", "route-recognizer"], function (_exports, _polyfills, _rsvp, _routeRecognizer) {
|
60677 | "use strict";
|
60678 |
|
60679 | Object.defineProperty(_exports, "__esModule", {
|
60680 | value: true
|
60681 | });
|
60682 | _exports.logAbort = logAbort;
|
60683 | _exports.InternalRouteInfo = _exports.TransitionError = _exports.TransitionState = _exports.QUERY_PARAMS_SYMBOL = _exports.PARAMS_SYMBOL = _exports.STATE_SYMBOL = _exports.InternalTransition = _exports.default = void 0;
|
60684 |
|
60685 | var TransitionAbortedError = function () {
|
60686 | TransitionAbortedError.prototype = Object.create(Error.prototype);
|
60687 | TransitionAbortedError.prototype.constructor = TransitionAbortedError;
|
60688 |
|
60689 | function TransitionAbortedError(message) {
|
60690 | var error = Error.call(this, message);
|
60691 | this.name = 'TransitionAborted';
|
60692 | this.message = message || 'TransitionAborted';
|
60693 |
|
60694 | if (Error.captureStackTrace) {
|
60695 | Error.captureStackTrace(this, TransitionAbortedError);
|
60696 | } else {
|
60697 | this.stack = error.stack;
|
60698 | }
|
60699 | }
|
60700 |
|
60701 | return TransitionAbortedError;
|
60702 | }();
|
60703 |
|
60704 | var slice = Array.prototype.slice;
|
60705 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
60706 | /**
|
60707 | Determines if an object is Promise by checking if it is "thenable".
|
60708 | **/
|
60709 |
|
60710 | function isPromise(p) {
|
60711 | return p !== null && typeof p === 'object' && typeof p.then === 'function';
|
60712 | }
|
60713 |
|
60714 | function merge(hash, other) {
|
60715 | for (var prop in other) {
|
60716 | if (hasOwnProperty.call(other, prop)) {
|
60717 | hash[prop] = other[prop];
|
60718 | }
|
60719 | }
|
60720 | }
|
60721 | /**
|
60722 | @private
|
60723 |
|
60724 | Extracts query params from the end of an array
|
60725 | **/
|
60726 |
|
60727 |
|
60728 | function extractQueryParams(array) {
|
60729 | var len = array && array.length,
|
60730 | head,
|
60731 | queryParams;
|
60732 |
|
60733 | if (len && len > 0) {
|
60734 | var obj = array[len - 1];
|
60735 |
|
60736 | if (isQueryParams(obj)) {
|
60737 | queryParams = obj.queryParams;
|
60738 | head = slice.call(array, 0, len - 1);
|
60739 | return [head, queryParams];
|
60740 | }
|
60741 | }
|
60742 |
|
60743 | return [array, null];
|
60744 | }
|
60745 |
|
60746 | function isQueryParams(obj) {
|
60747 | return obj && hasOwnProperty.call(obj, 'queryParams');
|
60748 | }
|
60749 | /**
|
60750 | @private
|
60751 |
|
60752 | Coerces query param properties and array elements into strings.
|
60753 | **/
|
60754 |
|
60755 |
|
60756 | function coerceQueryParamsToString(queryParams) {
|
60757 | for (var key in queryParams) {
|
60758 | var val = queryParams[key];
|
60759 |
|
60760 | if (typeof val === 'number') {
|
60761 | queryParams[key] = '' + val;
|
60762 | } else if (Array.isArray(val)) {
|
60763 | for (var i = 0, l = val.length; i < l; i++) {
|
60764 | val[i] = '' + val[i];
|
60765 | }
|
60766 | }
|
60767 | }
|
60768 | }
|
60769 | /**
|
60770 | @private
|
60771 | */
|
60772 |
|
60773 |
|
60774 | function log(router, ...args) {
|
60775 | if (!router.log) {
|
60776 | return;
|
60777 | }
|
60778 |
|
60779 | if (args.length === 2) {
|
60780 | var [sequence, msg] = args;
|
60781 | router.log('Transition #' + sequence + ': ' + msg);
|
60782 | } else {
|
60783 | var [_msg] = args;
|
60784 | router.log(_msg);
|
60785 | }
|
60786 | }
|
60787 |
|
60788 | function isParam(object) {
|
60789 | return typeof object === 'string' || object instanceof String || typeof object === 'number' || object instanceof Number;
|
60790 | }
|
60791 |
|
60792 | function forEach(array, callback) {
|
60793 | for (var i = 0, l = array.length; i < l && callback(array[i]) !== false; i++) {// empty intentionally
|
60794 | }
|
60795 | }
|
60796 |
|
60797 | function getChangelist(oldObject, newObject) {
|
60798 | var key;
|
60799 | var results = {
|
60800 | all: {},
|
60801 | changed: {},
|
60802 | removed: {}
|
60803 | };
|
60804 | merge(results.all, newObject);
|
60805 | var didChange = false;
|
60806 | coerceQueryParamsToString(oldObject);
|
60807 | coerceQueryParamsToString(newObject); // Calculate removals
|
60808 |
|
60809 | for (key in oldObject) {
|
60810 | if (hasOwnProperty.call(oldObject, key)) {
|
60811 | if (!hasOwnProperty.call(newObject, key)) {
|
60812 | didChange = true;
|
60813 | results.removed[key] = oldObject[key];
|
60814 | }
|
60815 | }
|
60816 | } // Calculate changes
|
60817 |
|
60818 |
|
60819 | for (key in newObject) {
|
60820 | if (hasOwnProperty.call(newObject, key)) {
|
60821 | var oldElement = oldObject[key];
|
60822 | var newElement = newObject[key];
|
60823 |
|
60824 | if (isArray(oldElement) && isArray(newElement)) {
|
60825 | if (oldElement.length !== newElement.length) {
|
60826 | results.changed[key] = newObject[key];
|
60827 | didChange = true;
|
60828 | } else {
|
60829 | for (var i = 0, l = oldElement.length; i < l; i++) {
|
60830 | if (oldElement[i] !== newElement[i]) {
|
60831 | results.changed[key] = newObject[key];
|
60832 | didChange = true;
|
60833 | }
|
60834 | }
|
60835 | }
|
60836 | } else if (oldObject[key] !== newObject[key]) {
|
60837 | results.changed[key] = newObject[key];
|
60838 | didChange = true;
|
60839 | }
|
60840 | }
|
60841 | }
|
60842 |
|
60843 | return didChange ? results : undefined;
|
60844 | }
|
60845 |
|
60846 | function isArray(obj) {
|
60847 | return Array.isArray(obj);
|
60848 | }
|
60849 |
|
60850 | function promiseLabel(label) {
|
60851 | return 'Router: ' + label;
|
60852 | }
|
60853 |
|
60854 | var STATE_SYMBOL = `__STATE__-2619860001345920-3322w3`;
|
60855 | _exports.STATE_SYMBOL = STATE_SYMBOL;
|
60856 | var PARAMS_SYMBOL = `__PARAMS__-261986232992830203-23323`;
|
60857 | _exports.PARAMS_SYMBOL = PARAMS_SYMBOL;
|
60858 | var QUERY_PARAMS_SYMBOL = `__QPS__-2619863929824844-32323`;
|
60859 | /**
|
60860 | A Transition is a thennable (a promise-like object) that represents
|
60861 | an attempt to transition to another route. It can be aborted, either
|
60862 | explicitly via `abort` or by attempting another transition while a
|
60863 | previous one is still underway. An aborted transition can also
|
60864 | be `retry()`d later.
|
60865 |
|
60866 | @class Transition
|
60867 | @constructor
|
60868 | @param {Object} router
|
60869 | @param {Object} intent
|
60870 | @param {Object} state
|
60871 | @param {Object} error
|
60872 | @private
|
60873 | */
|
60874 |
|
60875 | _exports.QUERY_PARAMS_SYMBOL = QUERY_PARAMS_SYMBOL;
|
60876 |
|
60877 | class Transition {
|
60878 | constructor(router, intent, state, error = undefined, previousTransition = undefined) {
|
60879 | this.from = null;
|
60880 | this.to = undefined;
|
60881 | this.isAborted = false;
|
60882 | this.isActive = true;
|
60883 | this.urlMethod = 'update';
|
60884 | this.resolveIndex = 0;
|
60885 | this.queryParamsOnly = false;
|
60886 | this.isTransition = true;
|
60887 | this.isCausedByAbortingTransition = false;
|
60888 | this.isCausedByInitialTransition = false;
|
60889 | this.isCausedByAbortingReplaceTransition = false;
|
60890 | this._visibleQueryParams = {};
|
60891 | this[STATE_SYMBOL] = state || router.state;
|
60892 | this.intent = intent;
|
60893 | this.router = router;
|
60894 | this.data = intent && intent.data || {};
|
60895 | this.resolvedModels = {};
|
60896 | this[QUERY_PARAMS_SYMBOL] = {};
|
60897 | this.promise = undefined;
|
60898 | this.error = undefined;
|
60899 | this[PARAMS_SYMBOL] = {};
|
60900 | this.routeInfos = [];
|
60901 | this.targetName = undefined;
|
60902 | this.pivotHandler = undefined;
|
60903 | this.sequence = -1;
|
60904 |
|
60905 | if (error) {
|
60906 | this.promise = _rsvp.Promise.reject(error);
|
60907 | this.error = error;
|
60908 | return;
|
60909 | } // if you're doing multiple redirects, need the new transition to know if it
|
60910 | // is actually part of the first transition or not. Any further redirects
|
60911 | // in the initial transition also need to know if they are part of the
|
60912 | // initial transition
|
60913 |
|
60914 |
|
60915 | this.isCausedByAbortingTransition = !!previousTransition;
|
60916 | this.isCausedByInitialTransition = !!previousTransition && (previousTransition.isCausedByInitialTransition || previousTransition.sequence === 0); // Every transition in the chain is a replace
|
60917 |
|
60918 | this.isCausedByAbortingReplaceTransition = !!previousTransition && previousTransition.urlMethod === 'replace' && (!previousTransition.isCausedByAbortingTransition || previousTransition.isCausedByAbortingReplaceTransition);
|
60919 |
|
60920 | if (state) {
|
60921 | this[PARAMS_SYMBOL] = state.params;
|
60922 | this[QUERY_PARAMS_SYMBOL] = state.queryParams;
|
60923 | this.routeInfos = state.routeInfos;
|
60924 | var len = state.routeInfos.length;
|
60925 |
|
60926 | if (len) {
|
60927 | this.targetName = state.routeInfos[len - 1].name;
|
60928 | }
|
60929 |
|
60930 | for (var i = 0; i < len; ++i) {
|
60931 | var handlerInfo = state.routeInfos[i]; // TODO: this all seems hacky
|
60932 |
|
60933 | if (!handlerInfo.isResolved) {
|
60934 | break;
|
60935 | }
|
60936 |
|
60937 | this.pivotHandler = handlerInfo.route;
|
60938 | }
|
60939 |
|
60940 | this.sequence = router.currentSequence++;
|
60941 | this.promise = state.resolve(() => {
|
60942 | if (this.isAborted) {
|
60943 | return _rsvp.Promise.reject(false, promiseLabel('Transition aborted - reject'));
|
60944 | }
|
60945 |
|
60946 | return _rsvp.Promise.resolve(true);
|
60947 | }, this).catch(result => {
|
60948 | return _rsvp.Promise.reject(this.router.transitionDidError(result, this));
|
60949 | }, promiseLabel('Handle Abort'));
|
60950 | } else {
|
60951 | this.promise = _rsvp.Promise.resolve(this[STATE_SYMBOL]);
|
60952 | this[PARAMS_SYMBOL] = {};
|
60953 | }
|
60954 | }
|
60955 | /**
|
60956 | The Transition's internal promise. Calling `.then` on this property
|
60957 | is that same as calling `.then` on the Transition object itself, but
|
60958 | this property is exposed for when you want to pass around a
|
60959 | Transition's promise, but not the Transition object itself, since
|
60960 | Transition object can be externally `abort`ed, while the promise
|
60961 | cannot.
|
60962 | @property promise
|
60963 | @type {Object}
|
60964 | @public
|
60965 | */
|
60966 |
|
60967 | /**
|
60968 | Custom state can be stored on a Transition's `data` object.
|
60969 | This can be useful for decorating a Transition within an earlier
|
60970 | hook and shared with a later hook. Properties set on `data` will
|
60971 | be copied to new transitions generated by calling `retry` on this
|
60972 | transition.
|
60973 | @property data
|
60974 | @type {Object}
|
60975 | @public
|
60976 | */
|
60977 |
|
60978 | /**
|
60979 | A standard promise hook that resolves if the transition
|
60980 | succeeds and rejects if it fails/redirects/aborts.
|
60981 | Forwards to the internal `promise` property which you can
|
60982 | use in situations where you want to pass around a thennable,
|
60983 | but not the Transition itself.
|
60984 | @method then
|
60985 | @param {Function} onFulfilled
|
60986 | @param {Function} onRejected
|
60987 | @param {String} label optional string for labeling the promise.
|
60988 | Useful for tooling.
|
60989 | @return {Promise}
|
60990 | @public
|
60991 | */
|
60992 |
|
60993 |
|
60994 | then(onFulfilled, onRejected, label) {
|
60995 | return this.promise.then(onFulfilled, onRejected, label);
|
60996 | }
|
60997 | /**
|
60998 | Forwards to the internal `promise` property which you can
|
60999 | use in situations where you want to pass around a thennable,
|
61000 | but not the Transition itself.
|
61001 | @method catch
|
61002 | @param {Function} onRejection
|
61003 | @param {String} label optional string for labeling the promise.
|
61004 | Useful for tooling.
|
61005 | @return {Promise}
|
61006 | @public
|
61007 | */
|
61008 |
|
61009 |
|
61010 | catch(onRejection, label) {
|
61011 | return this.promise.catch(onRejection, label);
|
61012 | }
|
61013 | /**
|
61014 | Forwards to the internal `promise` property which you can
|
61015 | use in situations where you want to pass around a thennable,
|
61016 | but not the Transition itself.
|
61017 | @method finally
|
61018 | @param {Function} callback
|
61019 | @param {String} label optional string for labeling the promise.
|
61020 | Useful for tooling.
|
61021 | @return {Promise}
|
61022 | @public
|
61023 | */
|
61024 |
|
61025 |
|
61026 | finally(callback, label) {
|
61027 | return this.promise.finally(callback, label);
|
61028 | }
|
61029 | /**
|
61030 | Aborts the Transition. Note you can also implicitly abort a transition
|
61031 | by initiating another transition while a previous one is underway.
|
61032 | @method abort
|
61033 | @return {Transition} this transition
|
61034 | @public
|
61035 | */
|
61036 |
|
61037 |
|
61038 | abort() {
|
61039 | this.rollback();
|
61040 | var transition = new Transition(this.router, undefined, undefined, undefined);
|
61041 | transition.to = this.from;
|
61042 | transition.from = this.from;
|
61043 | transition.isAborted = true;
|
61044 | this.router.routeWillChange(transition);
|
61045 | this.router.routeDidChange(transition);
|
61046 | return this;
|
61047 | }
|
61048 |
|
61049 | rollback() {
|
61050 | if (!this.isAborted) {
|
61051 | log(this.router, this.sequence, this.targetName + ': transition was aborted');
|
61052 |
|
61053 | if (this.intent !== undefined && this.intent !== null) {
|
61054 | this.intent.preTransitionState = this.router.state;
|
61055 | }
|
61056 |
|
61057 | this.isAborted = true;
|
61058 | this.isActive = false;
|
61059 | this.router.activeTransition = undefined;
|
61060 | }
|
61061 | }
|
61062 |
|
61063 | redirect(newTransition) {
|
61064 | this.rollback();
|
61065 | this.router.routeWillChange(newTransition);
|
61066 | }
|
61067 | /**
|
61068 | Retries a previously-aborted transition (making sure to abort the
|
61069 | transition if it's still active). Returns a new transition that
|
61070 | represents the new attempt to transition.
|
61071 | @method retry
|
61072 | @return {Transition} new transition
|
61073 | @public
|
61074 | */
|
61075 |
|
61076 |
|
61077 | retry() {
|
61078 | // TODO: add tests for merged state retry()s
|
61079 | this.abort();
|
61080 | var newTransition = this.router.transitionByIntent(this.intent, false); // inheriting a `null` urlMethod is not valid
|
61081 | // the urlMethod is only set to `null` when
|
61082 | // the transition is initiated *after* the url
|
61083 | // has been updated (i.e. `router.handleURL`)
|
61084 | //
|
61085 | // in that scenario, the url method cannot be
|
61086 | // inherited for a new transition because then
|
61087 | // the url would not update even though it should
|
61088 |
|
61089 | if (this.urlMethod !== null) {
|
61090 | newTransition.method(this.urlMethod);
|
61091 | }
|
61092 |
|
61093 | return newTransition;
|
61094 | }
|
61095 | /**
|
61096 | Sets the URL-changing method to be employed at the end of a
|
61097 | successful transition. By default, a new Transition will just
|
61098 | use `updateURL`, but passing 'replace' to this method will
|
61099 | cause the URL to update using 'replaceWith' instead. Omitting
|
61100 | a parameter will disable the URL change, allowing for transitions
|
61101 | that don't update the URL at completion (this is also used for
|
61102 | handleURL, since the URL has already changed before the
|
61103 | transition took place).
|
61104 | @method method
|
61105 | @param {String} method the type of URL-changing method to use
|
61106 | at the end of a transition. Accepted values are 'replace',
|
61107 | falsy values, or any other non-falsy value (which is
|
61108 | interpreted as an updateURL transition).
|
61109 | @return {Transition} this transition
|
61110 | @public
|
61111 | */
|
61112 |
|
61113 |
|
61114 | method(method) {
|
61115 | this.urlMethod = method;
|
61116 | return this;
|
61117 | } // Alias 'trigger' as 'send'
|
61118 |
|
61119 |
|
61120 | send(ignoreFailure = false, _name, err, transition, handler) {
|
61121 | this.trigger(ignoreFailure, _name, err, transition, handler);
|
61122 | }
|
61123 | /**
|
61124 | Fires an event on the current list of resolved/resolving
|
61125 | handlers within this transition. Useful for firing events
|
61126 | on route hierarchies that haven't fully been entered yet.
|
61127 | Note: This method is also aliased as `send`
|
61128 | @method trigger
|
61129 | @param {Boolean} [ignoreFailure=false] a boolean specifying whether unhandled events throw an error
|
61130 | @param {String} name the name of the event to fire
|
61131 | @public
|
61132 | */
|
61133 |
|
61134 |
|
61135 | trigger(ignoreFailure = false, name, ...args) {
|
61136 | // TODO: Deprecate the current signature
|
61137 | if (typeof ignoreFailure === 'string') {
|
61138 | name = ignoreFailure;
|
61139 | ignoreFailure = false;
|
61140 | }
|
61141 |
|
61142 | this.router.triggerEvent(this[STATE_SYMBOL].routeInfos.slice(0, this.resolveIndex + 1), ignoreFailure, name, args);
|
61143 | }
|
61144 | /**
|
61145 | Transitions are aborted and their promises rejected
|
61146 | when redirects occur; this method returns a promise
|
61147 | that will follow any redirects that occur and fulfill
|
61148 | with the value fulfilled by any redirecting transitions
|
61149 | that occur.
|
61150 | @method followRedirects
|
61151 | @return {Promise} a promise that fulfills with the same
|
61152 | value that the final redirecting transition fulfills with
|
61153 | @public
|
61154 | */
|
61155 |
|
61156 |
|
61157 | followRedirects() {
|
61158 | var router = this.router;
|
61159 | return this.promise.catch(function (reason) {
|
61160 | if (router.activeTransition) {
|
61161 | return router.activeTransition.followRedirects();
|
61162 | }
|
61163 |
|
61164 | return _rsvp.Promise.reject(reason);
|
61165 | });
|
61166 | }
|
61167 |
|
61168 | toString() {
|
61169 | return 'Transition (sequence ' + this.sequence + ')';
|
61170 | }
|
61171 | /**
|
61172 | @private
|
61173 | */
|
61174 |
|
61175 |
|
61176 | log(message) {
|
61177 | log(this.router, this.sequence, message);
|
61178 | }
|
61179 |
|
61180 | }
|
61181 | /**
|
61182 | @private
|
61183 |
|
61184 | Logs and returns an instance of TransitionAborted.
|
61185 | */
|
61186 |
|
61187 |
|
61188 | _exports.InternalTransition = Transition;
|
61189 |
|
61190 | function logAbort(transition) {
|
61191 | log(transition.router, transition.sequence, 'detected abort.');
|
61192 | return new TransitionAbortedError();
|
61193 | }
|
61194 |
|
61195 | function isTransition(obj) {
|
61196 | return typeof obj === 'object' && obj instanceof Transition && obj.isTransition;
|
61197 | }
|
61198 |
|
61199 | function prepareResult(obj) {
|
61200 | if (isTransition(obj)) {
|
61201 | return null;
|
61202 | }
|
61203 |
|
61204 | return obj;
|
61205 | }
|
61206 |
|
61207 | var ROUTE_INFOS = new WeakMap();
|
61208 |
|
61209 | function toReadOnlyRouteInfo(routeInfos, queryParams = {}, includeAttributes = false) {
|
61210 | return routeInfos.map((info, i) => {
|
61211 | var {
|
61212 | name,
|
61213 | params,
|
61214 | paramNames,
|
61215 | context,
|
61216 | route
|
61217 | } = info;
|
61218 |
|
61219 | if (ROUTE_INFOS.has(info) && includeAttributes) {
|
61220 | var _routeInfo = ROUTE_INFOS.get(info);
|
61221 |
|
61222 | _routeInfo = attachMetadata(route, _routeInfo);
|
61223 | var routeInfoWithAttribute = createRouteInfoWithAttributes(_routeInfo, context);
|
61224 | ROUTE_INFOS.set(info, routeInfoWithAttribute);
|
61225 | return routeInfoWithAttribute;
|
61226 | }
|
61227 |
|
61228 | var routeInfo = {
|
61229 | find(predicate, thisArg) {
|
61230 | var publicInfo;
|
61231 | var arr = [];
|
61232 |
|
61233 | if (predicate.length === 3) {
|
61234 | arr = routeInfos.map(info => ROUTE_INFOS.get(info));
|
61235 | }
|
61236 |
|
61237 | for (var _i = 0; routeInfos.length > _i; _i++) {
|
61238 | publicInfo = ROUTE_INFOS.get(routeInfos[_i]);
|
61239 |
|
61240 | if (predicate.call(thisArg, publicInfo, _i, arr)) {
|
61241 | return publicInfo;
|
61242 | }
|
61243 | }
|
61244 |
|
61245 | return undefined;
|
61246 | },
|
61247 |
|
61248 | get name() {
|
61249 | return name;
|
61250 | },
|
61251 |
|
61252 | get paramNames() {
|
61253 | return paramNames;
|
61254 | },
|
61255 |
|
61256 | get metadata() {
|
61257 | return buildRouteInfoMetadata(info.route);
|
61258 | },
|
61259 |
|
61260 | get parent() {
|
61261 | var parent = routeInfos[i - 1];
|
61262 |
|
61263 | if (parent === undefined) {
|
61264 | return null;
|
61265 | }
|
61266 |
|
61267 | return ROUTE_INFOS.get(parent);
|
61268 | },
|
61269 |
|
61270 | get child() {
|
61271 | var child = routeInfos[i + 1];
|
61272 |
|
61273 | if (child === undefined) {
|
61274 | return null;
|
61275 | }
|
61276 |
|
61277 | return ROUTE_INFOS.get(child);
|
61278 | },
|
61279 |
|
61280 | get localName() {
|
61281 | var parts = this.name.split('.');
|
61282 | return parts[parts.length - 1];
|
61283 | },
|
61284 |
|
61285 | get params() {
|
61286 | return params;
|
61287 | },
|
61288 |
|
61289 | get queryParams() {
|
61290 | return queryParams;
|
61291 | }
|
61292 |
|
61293 | };
|
61294 |
|
61295 | if (includeAttributes) {
|
61296 | routeInfo = createRouteInfoWithAttributes(routeInfo, context);
|
61297 | }
|
61298 |
|
61299 | ROUTE_INFOS.set(info, routeInfo);
|
61300 | return routeInfo;
|
61301 | });
|
61302 | }
|
61303 |
|
61304 | function createRouteInfoWithAttributes(routeInfo, context) {
|
61305 | var attributes = {
|
61306 | get attributes() {
|
61307 | return context;
|
61308 | }
|
61309 |
|
61310 | };
|
61311 |
|
61312 | if (!Object.isExtensible(routeInfo) || routeInfo.hasOwnProperty('attributes')) {
|
61313 | return Object.freeze((0, _polyfills.assign)({}, routeInfo, attributes));
|
61314 | }
|
61315 |
|
61316 | return (0, _polyfills.assign)(routeInfo, attributes);
|
61317 | }
|
61318 |
|
61319 | function buildRouteInfoMetadata(route) {
|
61320 | if (route !== undefined && route !== null && route.buildRouteInfoMetadata !== undefined) {
|
61321 | return route.buildRouteInfoMetadata();
|
61322 | }
|
61323 |
|
61324 | return null;
|
61325 | }
|
61326 |
|
61327 | function attachMetadata(route, routeInfo) {
|
61328 | var metadata = {
|
61329 | get metadata() {
|
61330 | return buildRouteInfoMetadata(route);
|
61331 | }
|
61332 |
|
61333 | };
|
61334 |
|
61335 | if (!Object.isExtensible(routeInfo) || routeInfo.hasOwnProperty('metadata')) {
|
61336 | return Object.freeze((0, _polyfills.assign)({}, routeInfo, metadata));
|
61337 | }
|
61338 |
|
61339 | return (0, _polyfills.assign)(routeInfo, metadata);
|
61340 | }
|
61341 |
|
61342 | class InternalRouteInfo {
|
61343 | constructor(router, name, paramNames, route) {
|
61344 | this._routePromise = undefined;
|
61345 | this._route = null;
|
61346 | this.params = {};
|
61347 | this.isResolved = false;
|
61348 | this.name = name;
|
61349 | this.paramNames = paramNames;
|
61350 | this.router = router;
|
61351 |
|
61352 | if (route) {
|
61353 | this._processRoute(route);
|
61354 | }
|
61355 | }
|
61356 |
|
61357 | getModel(_transition) {
|
61358 | return _rsvp.Promise.resolve(this.context);
|
61359 | }
|
61360 |
|
61361 | serialize(_context) {
|
61362 | return this.params || {};
|
61363 | }
|
61364 |
|
61365 | resolve(shouldContinue, transition) {
|
61366 | return _rsvp.Promise.resolve(this.routePromise).then(route => this.checkForAbort(shouldContinue, route)).then(() => this.runBeforeModelHook(transition)).then(() => this.checkForAbort(shouldContinue, null)).then(() => this.getModel(transition)).then(resolvedModel => this.checkForAbort(shouldContinue, resolvedModel)).then(resolvedModel => this.runAfterModelHook(transition, resolvedModel)).then(resolvedModel => this.becomeResolved(transition, resolvedModel));
|
61367 | }
|
61368 |
|
61369 | becomeResolved(transition, resolvedContext) {
|
61370 | var params = this.serialize(resolvedContext);
|
61371 |
|
61372 | if (transition) {
|
61373 | this.stashResolvedModel(transition, resolvedContext);
|
61374 | transition[PARAMS_SYMBOL] = transition[PARAMS_SYMBOL] || {};
|
61375 | transition[PARAMS_SYMBOL][this.name] = params;
|
61376 | }
|
61377 |
|
61378 | var context;
|
61379 | var contextsMatch = resolvedContext === this.context;
|
61380 |
|
61381 | if ('context' in this || !contextsMatch) {
|
61382 | context = resolvedContext;
|
61383 | }
|
61384 |
|
61385 | var cached = ROUTE_INFOS.get(this);
|
61386 | var resolved = new ResolvedRouteInfo(this.router, this.name, this.paramNames, params, this.route, context);
|
61387 |
|
61388 | if (cached !== undefined) {
|
61389 | ROUTE_INFOS.set(resolved, cached);
|
61390 | }
|
61391 |
|
61392 | return resolved;
|
61393 | }
|
61394 |
|
61395 | shouldSupercede(routeInfo) {
|
61396 | // Prefer this newer routeInfo over `other` if:
|
61397 | // 1) The other one doesn't exist
|
61398 | // 2) The names don't match
|
61399 | // 3) This route has a context that doesn't match
|
61400 | // the other one (or the other one doesn't have one).
|
61401 | // 4) This route has parameters that don't match the other.
|
61402 | if (!routeInfo) {
|
61403 | return true;
|
61404 | }
|
61405 |
|
61406 | var contextsMatch = routeInfo.context === this.context;
|
61407 | return routeInfo.name !== this.name || 'context' in this && !contextsMatch || this.hasOwnProperty('params') && !paramsMatch(this.params, routeInfo.params);
|
61408 | }
|
61409 |
|
61410 | get route() {
|
61411 | // _route could be set to either a route object or undefined, so we
|
61412 | // compare against null to know when it's been set
|
61413 | if (this._route !== null) {
|
61414 | return this._route;
|
61415 | }
|
61416 |
|
61417 | return this.fetchRoute();
|
61418 | }
|
61419 |
|
61420 | set route(route) {
|
61421 | this._route = route;
|
61422 | }
|
61423 |
|
61424 | get routePromise() {
|
61425 | if (this._routePromise) {
|
61426 | return this._routePromise;
|
61427 | }
|
61428 |
|
61429 | this.fetchRoute();
|
61430 | return this._routePromise;
|
61431 | }
|
61432 |
|
61433 | set routePromise(routePromise) {
|
61434 | this._routePromise = routePromise;
|
61435 | }
|
61436 |
|
61437 | log(transition, message) {
|
61438 | if (transition.log) {
|
61439 | transition.log(this.name + ': ' + message);
|
61440 | }
|
61441 | }
|
61442 |
|
61443 | updateRoute(route) {
|
61444 | route._internalName = this.name;
|
61445 | return this.route = route;
|
61446 | }
|
61447 |
|
61448 | runBeforeModelHook(transition) {
|
61449 | if (transition.trigger) {
|
61450 | transition.trigger(true, 'willResolveModel', transition, this.route);
|
61451 | }
|
61452 |
|
61453 | var result;
|
61454 |
|
61455 | if (this.route) {
|
61456 | if (this.route.beforeModel !== undefined) {
|
61457 | result = this.route.beforeModel(transition);
|
61458 | }
|
61459 | }
|
61460 |
|
61461 | if (isTransition(result)) {
|
61462 | result = null;
|
61463 | }
|
61464 |
|
61465 | return _rsvp.Promise.resolve(result);
|
61466 | }
|
61467 |
|
61468 | runAfterModelHook(transition, resolvedModel) {
|
61469 | // Stash the resolved model on the payload.
|
61470 | // This makes it possible for users to swap out
|
61471 | // the resolved model in afterModel.
|
61472 | var name = this.name;
|
61473 | this.stashResolvedModel(transition, resolvedModel);
|
61474 | var result;
|
61475 |
|
61476 | if (this.route !== undefined) {
|
61477 | if (this.route.afterModel !== undefined) {
|
61478 | result = this.route.afterModel(resolvedModel, transition);
|
61479 | }
|
61480 | }
|
61481 |
|
61482 | result = prepareResult(result);
|
61483 | return _rsvp.Promise.resolve(result).then(() => {
|
61484 | // Ignore the fulfilled value returned from afterModel.
|
61485 | // Return the value stashed in resolvedModels, which
|
61486 | // might have been swapped out in afterModel.
|
61487 | return transition.resolvedModels[name];
|
61488 | });
|
61489 | }
|
61490 |
|
61491 | checkForAbort(shouldContinue, value) {
|
61492 | return _rsvp.Promise.resolve(shouldContinue()).then(function () {
|
61493 | // We don't care about shouldContinue's resolve value;
|
61494 | // pass along the original value passed to this fn.
|
61495 | return value;
|
61496 | }, null);
|
61497 | }
|
61498 |
|
61499 | stashResolvedModel(transition, resolvedModel) {
|
61500 | transition.resolvedModels = transition.resolvedModels || {};
|
61501 | transition.resolvedModels[this.name] = resolvedModel;
|
61502 | }
|
61503 |
|
61504 | fetchRoute() {
|
61505 | var route = this.router.getRoute(this.name);
|
61506 | return this._processRoute(route);
|
61507 | }
|
61508 |
|
61509 | _processRoute(route) {
|
61510 | // Setup a routePromise so that we can wait for asynchronously loaded routes
|
61511 | this.routePromise = _rsvp.Promise.resolve(route); // Wait until the 'route' property has been updated when chaining to a route
|
61512 | // that is a promise
|
61513 |
|
61514 | if (isPromise(route)) {
|
61515 | this.routePromise = this.routePromise.then(r => {
|
61516 | return this.updateRoute(r);
|
61517 | }); // set to undefined to avoid recursive loop in the route getter
|
61518 |
|
61519 | return this.route = undefined;
|
61520 | } else if (route) {
|
61521 | return this.updateRoute(route);
|
61522 | }
|
61523 |
|
61524 | return undefined;
|
61525 | }
|
61526 |
|
61527 | }
|
61528 |
|
61529 | _exports.InternalRouteInfo = InternalRouteInfo;
|
61530 |
|
61531 | class ResolvedRouteInfo extends InternalRouteInfo {
|
61532 | constructor(router, name, paramNames, params, route, context) {
|
61533 | super(router, name, paramNames, route);
|
61534 | this.params = params;
|
61535 | this.isResolved = true;
|
61536 | this.context = context;
|
61537 | }
|
61538 |
|
61539 | resolve(_shouldContinue, transition) {
|
61540 | // A ResolvedRouteInfo just resolved with itself.
|
61541 | if (transition && transition.resolvedModels) {
|
61542 | transition.resolvedModels[this.name] = this.context;
|
61543 | }
|
61544 |
|
61545 | return _rsvp.Promise.resolve(this);
|
61546 | }
|
61547 |
|
61548 | }
|
61549 |
|
61550 | class UnresolvedRouteInfoByParam extends InternalRouteInfo {
|
61551 | constructor(router, name, paramNames, params, route) {
|
61552 | super(router, name, paramNames, route);
|
61553 | this.params = {};
|
61554 | this.params = params;
|
61555 | }
|
61556 |
|
61557 | getModel(transition) {
|
61558 | var fullParams = this.params;
|
61559 |
|
61560 | if (transition && transition[QUERY_PARAMS_SYMBOL]) {
|
61561 | fullParams = {};
|
61562 | merge(fullParams, this.params);
|
61563 | fullParams.queryParams = transition[QUERY_PARAMS_SYMBOL];
|
61564 | }
|
61565 |
|
61566 | var route = this.route;
|
61567 | var result = undefined;
|
61568 |
|
61569 | if (route.deserialize) {
|
61570 | result = route.deserialize(fullParams, transition);
|
61571 | } else if (route.model) {
|
61572 | result = route.model(fullParams, transition);
|
61573 | }
|
61574 |
|
61575 | if (result && isTransition(result)) {
|
61576 | result = undefined;
|
61577 | }
|
61578 |
|
61579 | return _rsvp.Promise.resolve(result);
|
61580 | }
|
61581 |
|
61582 | }
|
61583 |
|
61584 | class UnresolvedRouteInfoByObject extends InternalRouteInfo {
|
61585 | constructor(router, name, paramNames, context) {
|
61586 | super(router, name, paramNames);
|
61587 | this.context = context;
|
61588 | this.serializer = this.router.getSerializer(name);
|
61589 | }
|
61590 |
|
61591 | getModel(transition) {
|
61592 | if (this.router.log !== undefined) {
|
61593 | this.router.log(this.name + ': resolving provided model');
|
61594 | }
|
61595 |
|
61596 | return super.getModel(transition);
|
61597 | }
|
61598 | /**
|
61599 | @private
|
61600 | Serializes a route using its custom `serialize` method or
|
61601 | by a default that looks up the expected property name from
|
61602 | the dynamic segment.
|
61603 | @param {Object} model the model to be serialized for this route
|
61604 | */
|
61605 |
|
61606 |
|
61607 | serialize(model) {
|
61608 | var {
|
61609 | paramNames,
|
61610 | context
|
61611 | } = this;
|
61612 |
|
61613 | if (!model) {
|
61614 | model = context;
|
61615 | }
|
61616 |
|
61617 | var object = {};
|
61618 |
|
61619 | if (isParam(model)) {
|
61620 | object[paramNames[0]] = model;
|
61621 | return object;
|
61622 | } // Use custom serialize if it exists.
|
61623 |
|
61624 |
|
61625 | if (this.serializer) {
|
61626 | // invoke this.serializer unbound (getSerializer returns a stateless function)
|
61627 | return this.serializer.call(null, model, paramNames);
|
61628 | } else if (this.route !== undefined) {
|
61629 | if (this.route.serialize) {
|
61630 | return this.route.serialize(model, paramNames);
|
61631 | }
|
61632 | }
|
61633 |
|
61634 | if (paramNames.length !== 1) {
|
61635 | return;
|
61636 | }
|
61637 |
|
61638 | var name = paramNames[0];
|
61639 |
|
61640 | if (/_id$/.test(name)) {
|
61641 | object[name] = model.id;
|
61642 | } else {
|
61643 | object[name] = model;
|
61644 | }
|
61645 |
|
61646 | return object;
|
61647 | }
|
61648 |
|
61649 | }
|
61650 |
|
61651 | function paramsMatch(a, b) {
|
61652 | if (!a !== !b) {
|
61653 | // Only one is null.
|
61654 | return false;
|
61655 | }
|
61656 |
|
61657 | if (!a) {
|
61658 | // Both must be null.
|
61659 | return true;
|
61660 | } // Note: this assumes that both params have the same
|
61661 | // number of keys, but since we're comparing the
|
61662 | // same routes, they should.
|
61663 |
|
61664 |
|
61665 | for (var k in a) {
|
61666 | if (a.hasOwnProperty(k) && a[k] !== b[k]) {
|
61667 | return false;
|
61668 | }
|
61669 | }
|
61670 |
|
61671 | return true;
|
61672 | }
|
61673 |
|
61674 | class TransitionIntent {
|
61675 | constructor(router, data = {}) {
|
61676 | this.router = router;
|
61677 | this.data = data;
|
61678 | }
|
61679 |
|
61680 | }
|
61681 |
|
61682 | class TransitionState {
|
61683 | constructor() {
|
61684 | this.routeInfos = [];
|
61685 | this.queryParams = {};
|
61686 | this.params = {};
|
61687 | }
|
61688 |
|
61689 | promiseLabel(label) {
|
61690 | var targetName = '';
|
61691 | forEach(this.routeInfos, function (routeInfo) {
|
61692 | if (targetName !== '') {
|
61693 | targetName += '.';
|
61694 | }
|
61695 |
|
61696 | targetName += routeInfo.name;
|
61697 | return true;
|
61698 | });
|
61699 | return promiseLabel("'" + targetName + "': " + label);
|
61700 | }
|
61701 |
|
61702 | resolve(shouldContinue, transition) {
|
61703 | // First, calculate params for this state. This is useful
|
61704 | // information to provide to the various route hooks.
|
61705 | var params = this.params;
|
61706 | forEach(this.routeInfos, routeInfo => {
|
61707 | params[routeInfo.name] = routeInfo.params || {};
|
61708 | return true;
|
61709 | });
|
61710 | transition.resolveIndex = 0;
|
61711 | var currentState = this;
|
61712 | var wasAborted = false; // The prelude RSVP.resolve() asyncs us into the promise land.
|
61713 |
|
61714 | return _rsvp.Promise.resolve(null, this.promiseLabel('Start transition')).then(resolveOneRouteInfo, null, this.promiseLabel('Resolve route')).catch(handleError, this.promiseLabel('Handle error'));
|
61715 |
|
61716 | function innerShouldContinue() {
|
61717 | return _rsvp.Promise.resolve(shouldContinue(), currentState.promiseLabel('Check if should continue')).catch(function (reason) {
|
61718 | // We distinguish between errors that occurred
|
61719 | // during resolution (e.g. before"Model/model/afterModel),
|
61720 | // and aborts due to a rejecting promise from shouldContinue().
|
61721 | wasAborted = true;
|
61722 | return _rsvp.Promise.reject(reason);
|
61723 | }, currentState.promiseLabel('Handle abort'));
|
61724 | }
|
61725 |
|
61726 | function handleError(error) {
|
61727 | // This is the only possible
|
61728 | // reject value of TransitionState#resolve
|
61729 | var routeInfos = currentState.routeInfos;
|
61730 | var errorHandlerIndex = transition.resolveIndex >= routeInfos.length ? routeInfos.length - 1 : transition.resolveIndex;
|
61731 | return _rsvp.Promise.reject(new TransitionError(error, currentState.routeInfos[errorHandlerIndex].route, wasAborted, currentState));
|
61732 | }
|
61733 |
|
61734 | function proceed(resolvedRouteInfo) {
|
61735 | var wasAlreadyResolved = currentState.routeInfos[transition.resolveIndex].isResolved; // Swap the previously unresolved routeInfo with
|
61736 | // the resolved routeInfo
|
61737 |
|
61738 | currentState.routeInfos[transition.resolveIndex++] = resolvedRouteInfo;
|
61739 |
|
61740 | if (!wasAlreadyResolved) {
|
61741 | // Call the redirect hook. The reason we call it here
|
61742 | // vs. afterModel is so that redirects into child
|
61743 | // routes don't re-run the model hooks for this
|
61744 | // already-resolved route.
|
61745 | var {
|
61746 | route
|
61747 | } = resolvedRouteInfo;
|
61748 |
|
61749 | if (route !== undefined) {
|
61750 | if (route.redirect) {
|
61751 | route.redirect(resolvedRouteInfo.context, transition);
|
61752 | }
|
61753 | }
|
61754 | } // Proceed after ensuring that the redirect hook
|
61755 | // didn't abort this transition by transitioning elsewhere.
|
61756 |
|
61757 |
|
61758 | return innerShouldContinue().then(resolveOneRouteInfo, null, currentState.promiseLabel('Resolve route'));
|
61759 | }
|
61760 |
|
61761 | function resolveOneRouteInfo() {
|
61762 | if (transition.resolveIndex === currentState.routeInfos.length) {
|
61763 | // This is is the only possible
|
61764 | // fulfill value of TransitionState#resolve
|
61765 | return currentState;
|
61766 | }
|
61767 |
|
61768 | var routeInfo = currentState.routeInfos[transition.resolveIndex];
|
61769 | return routeInfo.resolve(innerShouldContinue, transition).then(proceed, null, currentState.promiseLabel('Proceed'));
|
61770 | }
|
61771 | }
|
61772 |
|
61773 | }
|
61774 |
|
61775 | _exports.TransitionState = TransitionState;
|
61776 |
|
61777 | class TransitionError {
|
61778 | constructor(error, route, wasAborted, state) {
|
61779 | this.error = error;
|
61780 | this.route = route;
|
61781 | this.wasAborted = wasAborted;
|
61782 | this.state = state;
|
61783 | }
|
61784 |
|
61785 | }
|
61786 |
|
61787 | _exports.TransitionError = TransitionError;
|
61788 |
|
61789 | class NamedTransitionIntent extends TransitionIntent {
|
61790 | constructor(router, name, pivotHandler, contexts = [], queryParams = {}, data) {
|
61791 | super(router, data);
|
61792 | this.preTransitionState = undefined;
|
61793 | this.name = name;
|
61794 | this.pivotHandler = pivotHandler;
|
61795 | this.contexts = contexts;
|
61796 | this.queryParams = queryParams;
|
61797 | }
|
61798 |
|
61799 | applyToState(oldState, isIntermediate) {
|
61800 | // TODO: WTF fix me
|
61801 | var partitionedArgs = extractQueryParams([this.name].concat(this.contexts)),
|
61802 | pureArgs = partitionedArgs[0],
|
61803 | handlers = this.router.recognizer.handlersFor(pureArgs[0]);
|
61804 | var targetRouteName = handlers[handlers.length - 1].handler;
|
61805 | return this.applyToHandlers(oldState, handlers, targetRouteName, isIntermediate, false);
|
61806 | }
|
61807 |
|
61808 | applyToHandlers(oldState, parsedHandlers, targetRouteName, isIntermediate, checkingIfActive) {
|
61809 | var i, len;
|
61810 | var newState = new TransitionState();
|
61811 | var objects = this.contexts.slice(0);
|
61812 | var invalidateIndex = parsedHandlers.length; // Pivot handlers are provided for refresh transitions
|
61813 |
|
61814 | if (this.pivotHandler) {
|
61815 | for (i = 0, len = parsedHandlers.length; i < len; ++i) {
|
61816 | if (parsedHandlers[i].handler === this.pivotHandler._internalName) {
|
61817 | invalidateIndex = i;
|
61818 | break;
|
61819 | }
|
61820 | }
|
61821 | }
|
61822 |
|
61823 | for (i = parsedHandlers.length - 1; i >= 0; --i) {
|
61824 | var result = parsedHandlers[i];
|
61825 | var name = result.handler;
|
61826 | var oldHandlerInfo = oldState.routeInfos[i];
|
61827 | var newHandlerInfo = null;
|
61828 |
|
61829 | if (result.names.length > 0) {
|
61830 | if (i >= invalidateIndex) {
|
61831 | newHandlerInfo = this.createParamHandlerInfo(name, result.names, objects, oldHandlerInfo);
|
61832 | } else {
|
61833 | newHandlerInfo = this.getHandlerInfoForDynamicSegment(name, result.names, objects, oldHandlerInfo, targetRouteName, i);
|
61834 | }
|
61835 | } else {
|
61836 | // This route has no dynamic segment.
|
61837 | // Therefore treat as a param-based handlerInfo
|
61838 | // with empty params. This will cause the `model`
|
61839 | // hook to be called with empty params, which is desirable.
|
61840 | newHandlerInfo = this.createParamHandlerInfo(name, result.names, objects, oldHandlerInfo);
|
61841 | }
|
61842 |
|
61843 | if (checkingIfActive) {
|
61844 | // If we're performing an isActive check, we want to
|
61845 | // serialize URL params with the provided context, but
|
61846 | // ignore mismatches between old and new context.
|
61847 | newHandlerInfo = newHandlerInfo.becomeResolved(null, newHandlerInfo.context);
|
61848 | var oldContext = oldHandlerInfo && oldHandlerInfo.context;
|
61849 |
|
61850 | if (result.names.length > 0 && oldHandlerInfo.context !== undefined && newHandlerInfo.context === oldContext) {
|
61851 | // If contexts match in isActive test, assume params also match.
|
61852 | // This allows for flexibility in not requiring that every last
|
61853 | // handler provide a `serialize` method
|
61854 | newHandlerInfo.params = oldHandlerInfo && oldHandlerInfo.params;
|
61855 | }
|
61856 |
|
61857 | newHandlerInfo.context = oldContext;
|
61858 | }
|
61859 |
|
61860 | var handlerToUse = oldHandlerInfo;
|
61861 |
|
61862 | if (i >= invalidateIndex || newHandlerInfo.shouldSupercede(oldHandlerInfo)) {
|
61863 | invalidateIndex = Math.min(i, invalidateIndex);
|
61864 | handlerToUse = newHandlerInfo;
|
61865 | }
|
61866 |
|
61867 | if (isIntermediate && !checkingIfActive) {
|
61868 | handlerToUse = handlerToUse.becomeResolved(null, handlerToUse.context);
|
61869 | }
|
61870 |
|
61871 | newState.routeInfos.unshift(handlerToUse);
|
61872 | }
|
61873 |
|
61874 | if (objects.length > 0) {
|
61875 | throw new Error('More context objects were passed than there are dynamic segments for the route: ' + targetRouteName);
|
61876 | }
|
61877 |
|
61878 | if (!isIntermediate) {
|
61879 | this.invalidateChildren(newState.routeInfos, invalidateIndex);
|
61880 | }
|
61881 |
|
61882 | merge(newState.queryParams, this.queryParams || {});
|
61883 | return newState;
|
61884 | }
|
61885 |
|
61886 | invalidateChildren(handlerInfos, invalidateIndex) {
|
61887 | for (var i = invalidateIndex, l = handlerInfos.length; i < l; ++i) {
|
61888 | var handlerInfo = handlerInfos[i];
|
61889 |
|
61890 | if (handlerInfo.isResolved) {
|
61891 | var {
|
61892 | name,
|
61893 | params,
|
61894 | route,
|
61895 | paramNames
|
61896 | } = handlerInfos[i];
|
61897 | handlerInfos[i] = new UnresolvedRouteInfoByParam(this.router, name, paramNames, params, route);
|
61898 | }
|
61899 | }
|
61900 | }
|
61901 |
|
61902 | getHandlerInfoForDynamicSegment(name, names, objects, oldHandlerInfo, _targetRouteName, i) {
|
61903 | var objectToUse;
|
61904 |
|
61905 | if (objects.length > 0) {
|
61906 | // Use the objects provided for this transition.
|
61907 | objectToUse = objects[objects.length - 1];
|
61908 |
|
61909 | if (isParam(objectToUse)) {
|
61910 | return this.createParamHandlerInfo(name, names, objects, oldHandlerInfo);
|
61911 | } else {
|
61912 | objects.pop();
|
61913 | }
|
61914 | } else if (oldHandlerInfo && oldHandlerInfo.name === name) {
|
61915 | // Reuse the matching oldHandlerInfo
|
61916 | return oldHandlerInfo;
|
61917 | } else {
|
61918 | if (this.preTransitionState) {
|
61919 | var preTransitionHandlerInfo = this.preTransitionState.routeInfos[i];
|
61920 | objectToUse = preTransitionHandlerInfo && preTransitionHandlerInfo.context;
|
61921 | } else {
|
61922 | // Ideally we should throw this error to provide maximal
|
61923 | // information to the user that not enough context objects
|
61924 | // were provided, but this proves too cumbersome in Ember
|
61925 | // in cases where inner template helpers are evaluated
|
61926 | // before parent helpers un-render, in which cases this
|
61927 | // error somewhat prematurely fires.
|
61928 | //throw new Error("Not enough context objects were provided to complete a transition to " + targetRouteName + ". Specifically, the " + name + " route needs an object that can be serialized into its dynamic URL segments [" + names.join(', ') + "]");
|
61929 | return oldHandlerInfo;
|
61930 | }
|
61931 | }
|
61932 |
|
61933 | return new UnresolvedRouteInfoByObject(this.router, name, names, objectToUse);
|
61934 | }
|
61935 |
|
61936 | createParamHandlerInfo(name, names, objects, oldHandlerInfo) {
|
61937 | var params = {}; // Soak up all the provided string/numbers
|
61938 |
|
61939 | var numNames = names.length;
|
61940 | var missingParams = [];
|
61941 |
|
61942 | while (numNames--) {
|
61943 | // Only use old params if the names match with the new handler
|
61944 | var oldParams = oldHandlerInfo && name === oldHandlerInfo.name && oldHandlerInfo.params || {};
|
61945 | var peek = objects[objects.length - 1];
|
61946 | var paramName = names[numNames];
|
61947 |
|
61948 | if (isParam(peek)) {
|
61949 | params[paramName] = '' + objects.pop();
|
61950 | } else {
|
61951 | // If we're here, this means only some of the params
|
61952 | // were string/number params, so try and use a param
|
61953 | // value from a previous handler.
|
61954 | if (oldParams.hasOwnProperty(paramName)) {
|
61955 | params[paramName] = oldParams[paramName];
|
61956 | } else {
|
61957 | missingParams.push(paramName);
|
61958 | }
|
61959 | }
|
61960 | }
|
61961 |
|
61962 | if (missingParams.length > 0) {
|
61963 | throw new Error(`You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route ${name}.` + ` Missing params: ${missingParams}`);
|
61964 | }
|
61965 |
|
61966 | return new UnresolvedRouteInfoByParam(this.router, name, names, params);
|
61967 | }
|
61968 |
|
61969 | }
|
61970 |
|
61971 | var UnrecognizedURLError = function () {
|
61972 | UnrecognizedURLError.prototype = Object.create(Error.prototype);
|
61973 | UnrecognizedURLError.prototype.constructor = UnrecognizedURLError;
|
61974 |
|
61975 | function UnrecognizedURLError(message) {
|
61976 | var error = Error.call(this, message);
|
61977 | this.name = 'UnrecognizedURLError';
|
61978 | this.message = message || 'UnrecognizedURL';
|
61979 |
|
61980 | if (Error.captureStackTrace) {
|
61981 | Error.captureStackTrace(this, UnrecognizedURLError);
|
61982 | } else {
|
61983 | this.stack = error.stack;
|
61984 | }
|
61985 | }
|
61986 |
|
61987 | return UnrecognizedURLError;
|
61988 | }();
|
61989 |
|
61990 | class URLTransitionIntent extends TransitionIntent {
|
61991 | constructor(router, url, data) {
|
61992 | super(router, data);
|
61993 | this.url = url;
|
61994 | this.preTransitionState = undefined;
|
61995 | }
|
61996 |
|
61997 | applyToState(oldState) {
|
61998 | var newState = new TransitionState();
|
61999 | var results = this.router.recognizer.recognize(this.url),
|
62000 | i,
|
62001 | len;
|
62002 |
|
62003 | if (!results) {
|
62004 | throw new UnrecognizedURLError(this.url);
|
62005 | }
|
62006 |
|
62007 | var statesDiffer = false;
|
62008 | var _url = this.url; // Checks if a handler is accessible by URL. If it is not, an error is thrown.
|
62009 | // For the case where the handler is loaded asynchronously, the error will be
|
62010 | // thrown once it is loaded.
|
62011 |
|
62012 | function checkHandlerAccessibility(handler) {
|
62013 | if (handler && handler.inaccessibleByURL) {
|
62014 | throw new UnrecognizedURLError(_url);
|
62015 | }
|
62016 |
|
62017 | return handler;
|
62018 | }
|
62019 |
|
62020 | for (i = 0, len = results.length; i < len; ++i) {
|
62021 | var result = results[i];
|
62022 | var name = result.handler;
|
62023 | var paramNames = [];
|
62024 |
|
62025 | if (this.router.recognizer.hasRoute(name)) {
|
62026 | paramNames = this.router.recognizer.handlersFor(name)[i].names;
|
62027 | }
|
62028 |
|
62029 | var newRouteInfo = new UnresolvedRouteInfoByParam(this.router, name, paramNames, result.params);
|
62030 | var route = newRouteInfo.route;
|
62031 |
|
62032 | if (route) {
|
62033 | checkHandlerAccessibility(route);
|
62034 | } else {
|
62035 | // If the hanlder is being loaded asynchronously, check if we can
|
62036 | // access it after it has resolved
|
62037 | newRouteInfo.routePromise = newRouteInfo.routePromise.then(checkHandlerAccessibility);
|
62038 | }
|
62039 |
|
62040 | var oldRouteInfo = oldState.routeInfos[i];
|
62041 |
|
62042 | if (statesDiffer || newRouteInfo.shouldSupercede(oldRouteInfo)) {
|
62043 | statesDiffer = true;
|
62044 | newState.routeInfos[i] = newRouteInfo;
|
62045 | } else {
|
62046 | newState.routeInfos[i] = oldRouteInfo;
|
62047 | }
|
62048 | }
|
62049 |
|
62050 | merge(newState.queryParams, results.queryParams);
|
62051 | return newState;
|
62052 | }
|
62053 |
|
62054 | }
|
62055 |
|
62056 | class Router {
|
62057 | constructor(logger) {
|
62058 | this._lastQueryParams = {};
|
62059 | this.state = undefined;
|
62060 | this.oldState = undefined;
|
62061 | this.activeTransition = undefined;
|
62062 | this.currentRouteInfos = undefined;
|
62063 | this._changedQueryParams = undefined;
|
62064 | this.currentSequence = 0;
|
62065 | this.log = logger;
|
62066 | this.recognizer = new _routeRecognizer.default();
|
62067 | this.reset();
|
62068 | }
|
62069 | /**
|
62070 | The main entry point into the router. The API is essentially
|
62071 | the same as the `map` method in `route-recognizer`.
|
62072 | This method extracts the String handler at the last `.to()`
|
62073 | call and uses it as the name of the whole route.
|
62074 | @param {Function} callback
|
62075 | */
|
62076 |
|
62077 |
|
62078 | map(callback) {
|
62079 | this.recognizer.map(callback, function (recognizer, routes) {
|
62080 | for (var i = routes.length - 1, proceed = true; i >= 0 && proceed; --i) {
|
62081 | var route = routes[i];
|
62082 | var handler = route.handler;
|
62083 | recognizer.add(routes, {
|
62084 | as: handler
|
62085 | });
|
62086 | proceed = route.path === '/' || route.path === '' || handler.slice(-6) === '.index';
|
62087 | }
|
62088 | });
|
62089 | }
|
62090 |
|
62091 | hasRoute(route) {
|
62092 | return this.recognizer.hasRoute(route);
|
62093 | }
|
62094 |
|
62095 | queryParamsTransition(changelist, wasTransitioning, oldState, newState) {
|
62096 | this.fireQueryParamDidChange(newState, changelist);
|
62097 |
|
62098 | if (!wasTransitioning && this.activeTransition) {
|
62099 | // One of the routes in queryParamsDidChange
|
62100 | // caused a transition. Just return that transition.
|
62101 | return this.activeTransition;
|
62102 | } else {
|
62103 | // Running queryParamsDidChange didn't change anything.
|
62104 | // Just update query params and be on our way.
|
62105 | // We have to return a noop transition that will
|
62106 | // perform a URL update at the end. This gives
|
62107 | // the user the ability to set the url update
|
62108 | // method (default is replaceState).
|
62109 | var newTransition = new Transition(this, undefined, undefined);
|
62110 | newTransition.queryParamsOnly = true;
|
62111 | oldState.queryParams = this.finalizeQueryParamChange(newState.routeInfos, newState.queryParams, newTransition);
|
62112 | newTransition[QUERY_PARAMS_SYMBOL] = newState.queryParams;
|
62113 | this.toReadOnlyInfos(newTransition, newState);
|
62114 | this.routeWillChange(newTransition);
|
62115 | newTransition.promise = newTransition.promise.then(result => {
|
62116 | if (!newTransition.isAborted) {
|
62117 | this._updateURL(newTransition, oldState);
|
62118 |
|
62119 | this.didTransition(this.currentRouteInfos);
|
62120 | this.toInfos(newTransition, newState.routeInfos, true);
|
62121 | this.routeDidChange(newTransition);
|
62122 | }
|
62123 |
|
62124 | return result;
|
62125 | }, null, promiseLabel('Transition complete'));
|
62126 | return newTransition;
|
62127 | }
|
62128 | }
|
62129 |
|
62130 | transitionByIntent(intent, isIntermediate) {
|
62131 | try {
|
62132 | return this.getTransitionByIntent(intent, isIntermediate);
|
62133 | } catch (e) {
|
62134 | return new Transition(this, intent, undefined, e, undefined);
|
62135 | }
|
62136 | }
|
62137 |
|
62138 | recognize(url) {
|
62139 | var intent = new URLTransitionIntent(this, url);
|
62140 | var newState = this.generateNewState(intent);
|
62141 |
|
62142 | if (newState === null) {
|
62143 | return newState;
|
62144 | }
|
62145 |
|
62146 | var readonlyInfos = toReadOnlyRouteInfo(newState.routeInfos, newState.queryParams);
|
62147 | return readonlyInfos[readonlyInfos.length - 1];
|
62148 | }
|
62149 |
|
62150 | recognizeAndLoad(url) {
|
62151 | var intent = new URLTransitionIntent(this, url);
|
62152 | var newState = this.generateNewState(intent);
|
62153 |
|
62154 | if (newState === null) {
|
62155 | return _rsvp.Promise.reject(`URL ${url} was not recognized`);
|
62156 | }
|
62157 |
|
62158 | var newTransition = new Transition(this, intent, newState, undefined);
|
62159 | return newTransition.then(() => {
|
62160 | var routeInfosWithAttributes = toReadOnlyRouteInfo(newState.routeInfos, newTransition[QUERY_PARAMS_SYMBOL], true);
|
62161 | return routeInfosWithAttributes[routeInfosWithAttributes.length - 1];
|
62162 | });
|
62163 | }
|
62164 |
|
62165 | generateNewState(intent) {
|
62166 | try {
|
62167 | return intent.applyToState(this.state, false);
|
62168 | } catch (e) {
|
62169 | return null;
|
62170 | }
|
62171 | }
|
62172 |
|
62173 | getTransitionByIntent(intent, isIntermediate) {
|
62174 | var wasTransitioning = !!this.activeTransition;
|
62175 | var oldState = wasTransitioning ? this.activeTransition[STATE_SYMBOL] : this.state;
|
62176 | var newTransition;
|
62177 | var newState = intent.applyToState(oldState, isIntermediate);
|
62178 | var queryParamChangelist = getChangelist(oldState.queryParams, newState.queryParams);
|
62179 |
|
62180 | if (routeInfosEqual(newState.routeInfos, oldState.routeInfos)) {
|
62181 | // This is a no-op transition. See if query params changed.
|
62182 | if (queryParamChangelist) {
|
62183 | var _newTransition = this.queryParamsTransition(queryParamChangelist, wasTransitioning, oldState, newState);
|
62184 |
|
62185 | _newTransition.queryParamsOnly = true;
|
62186 | return _newTransition;
|
62187 | } // No-op. No need to create a new transition.
|
62188 |
|
62189 |
|
62190 | return this.activeTransition || new Transition(this, undefined, undefined);
|
62191 | }
|
62192 |
|
62193 | if (isIntermediate) {
|
62194 | var transition = new Transition(this, undefined, undefined);
|
62195 | this.toReadOnlyInfos(transition, newState);
|
62196 | this.setupContexts(newState);
|
62197 | this.routeWillChange(transition);
|
62198 | return this.activeTransition;
|
62199 | } // Create a new transition to the destination route.
|
62200 |
|
62201 |
|
62202 | newTransition = new Transition(this, intent, newState, undefined, this.activeTransition); // transition is to same route with same params, only query params differ.
|
62203 | // not caught above probably because refresh() has been used
|
62204 |
|
62205 | if (routeInfosSameExceptQueryParams(newState.routeInfos, oldState.routeInfos)) {
|
62206 | newTransition.queryParamsOnly = true;
|
62207 | }
|
62208 |
|
62209 | this.toReadOnlyInfos(newTransition, newState); // Abort and usurp any previously active transition.
|
62210 |
|
62211 | if (this.activeTransition) {
|
62212 | this.activeTransition.redirect(newTransition);
|
62213 | }
|
62214 |
|
62215 | this.activeTransition = newTransition; // Transition promises by default resolve with resolved state.
|
62216 | // For our purposes, swap out the promise to resolve
|
62217 | // after the transition has been finalized.
|
62218 |
|
62219 | newTransition.promise = newTransition.promise.then(result => {
|
62220 | return this.finalizeTransition(newTransition, result);
|
62221 | }, null, promiseLabel('Settle transition promise when transition is finalized'));
|
62222 |
|
62223 | if (!wasTransitioning) {
|
62224 | this.notifyExistingHandlers(newState, newTransition);
|
62225 | }
|
62226 |
|
62227 | this.fireQueryParamDidChange(newState, queryParamChangelist);
|
62228 | return newTransition;
|
62229 | }
|
62230 | /**
|
62231 | @private
|
62232 | Begins and returns a Transition based on the provided
|
62233 | arguments. Accepts arguments in the form of both URL
|
62234 | transitions and named transitions.
|
62235 | @param {Router} router
|
62236 | @param {Array[Object]} args arguments passed to transitionTo,
|
62237 | replaceWith, or handleURL
|
62238 | */
|
62239 |
|
62240 |
|
62241 | doTransition(name, modelsArray = [], isIntermediate = false) {
|
62242 | var lastArg = modelsArray[modelsArray.length - 1];
|
62243 | var queryParams = {};
|
62244 |
|
62245 | if (lastArg !== undefined && lastArg.hasOwnProperty('queryParams')) {
|
62246 | queryParams = modelsArray.pop().queryParams;
|
62247 | }
|
62248 |
|
62249 | var intent;
|
62250 |
|
62251 | if (name === undefined) {
|
62252 | log(this, 'Updating query params'); // A query param update is really just a transition
|
62253 | // into the route you're already on.
|
62254 |
|
62255 | var {
|
62256 | routeInfos
|
62257 | } = this.state;
|
62258 | intent = new NamedTransitionIntent(this, routeInfos[routeInfos.length - 1].name, undefined, [], queryParams);
|
62259 | } else if (name.charAt(0) === '/') {
|
62260 | log(this, 'Attempting URL transition to ' + name);
|
62261 | intent = new URLTransitionIntent(this, name);
|
62262 | } else {
|
62263 | log(this, 'Attempting transition to ' + name);
|
62264 | intent = new NamedTransitionIntent(this, name, undefined, modelsArray, queryParams);
|
62265 | }
|
62266 |
|
62267 | return this.transitionByIntent(intent, isIntermediate);
|
62268 | }
|
62269 | /**
|
62270 | @private
|
62271 | Updates the URL (if necessary) and calls `setupContexts`
|
62272 | to update the router's array of `currentRouteInfos`.
|
62273 | */
|
62274 |
|
62275 |
|
62276 | finalizeTransition(transition, newState) {
|
62277 | try {
|
62278 | log(transition.router, transition.sequence, 'Resolved all models on destination route; finalizing transition.');
|
62279 | var routeInfos = newState.routeInfos; // Run all the necessary enter/setup/exit hooks
|
62280 |
|
62281 | this.setupContexts(newState, transition); // Check if a redirect occurred in enter/setup
|
62282 |
|
62283 | if (transition.isAborted) {
|
62284 | // TODO: cleaner way? distinguish b/w targetRouteInfos?
|
62285 | this.state.routeInfos = this.currentRouteInfos;
|
62286 | return _rsvp.Promise.reject(logAbort(transition));
|
62287 | }
|
62288 |
|
62289 | this._updateURL(transition, newState);
|
62290 |
|
62291 | transition.isActive = false;
|
62292 | this.activeTransition = undefined;
|
62293 | this.triggerEvent(this.currentRouteInfos, true, 'didTransition', []);
|
62294 | this.didTransition(this.currentRouteInfos);
|
62295 | this.toInfos(transition, newState.routeInfos, true);
|
62296 | this.routeDidChange(transition);
|
62297 | log(this, transition.sequence, 'TRANSITION COMPLETE.'); // Resolve with the final route.
|
62298 |
|
62299 | return routeInfos[routeInfos.length - 1].route;
|
62300 | } catch (e) {
|
62301 | if (!(e instanceof TransitionAbortedError)) {
|
62302 | var infos = transition[STATE_SYMBOL].routeInfos;
|
62303 | transition.trigger(true, 'error', e, transition, infos[infos.length - 1].route);
|
62304 | transition.abort();
|
62305 | }
|
62306 |
|
62307 | throw e;
|
62308 | }
|
62309 | }
|
62310 | /**
|
62311 | @private
|
62312 | Takes an Array of `RouteInfo`s, figures out which ones are
|
62313 | exiting, entering, or changing contexts, and calls the
|
62314 | proper route hooks.
|
62315 | For example, consider the following tree of routes. Each route is
|
62316 | followed by the URL segment it handles.
|
62317 | ```
|
62318 | |~index ("/")
|
62319 | | |~posts ("/posts")
|
62320 | | | |-showPost ("/:id")
|
62321 | | | |-newPost ("/new")
|
62322 | | | |-editPost ("/edit")
|
62323 | | |~about ("/about/:id")
|
62324 | ```
|
62325 | Consider the following transitions:
|
62326 | 1. A URL transition to `/posts/1`.
|
62327 | 1. Triggers the `*model` callbacks on the
|
62328 | `index`, `posts`, and `showPost` routes
|
62329 | 2. Triggers the `enter` callback on the same
|
62330 | 3. Triggers the `setup` callback on the same
|
62331 | 2. A direct transition to `newPost`
|
62332 | 1. Triggers the `exit` callback on `showPost`
|
62333 | 2. Triggers the `enter` callback on `newPost`
|
62334 | 3. Triggers the `setup` callback on `newPost`
|
62335 | 3. A direct transition to `about` with a specified
|
62336 | context object
|
62337 | 1. Triggers the `exit` callback on `newPost`
|
62338 | and `posts`
|
62339 | 2. Triggers the `serialize` callback on `about`
|
62340 | 3. Triggers the `enter` callback on `about`
|
62341 | 4. Triggers the `setup` callback on `about`
|
62342 | @param {Router} transition
|
62343 | @param {TransitionState} newState
|
62344 | */
|
62345 |
|
62346 |
|
62347 | setupContexts(newState, transition) {
|
62348 | var partition = this.partitionRoutes(this.state, newState);
|
62349 | var i, l, route;
|
62350 |
|
62351 | for (i = 0, l = partition.exited.length; i < l; i++) {
|
62352 | route = partition.exited[i].route;
|
62353 | delete route.context;
|
62354 |
|
62355 | if (route !== undefined) {
|
62356 | if (route._internalReset !== undefined) {
|
62357 | route._internalReset(true, transition);
|
62358 | }
|
62359 |
|
62360 | if (route.exit !== undefined) {
|
62361 | route.exit(transition);
|
62362 | }
|
62363 | }
|
62364 | }
|
62365 |
|
62366 | var oldState = this.oldState = this.state;
|
62367 | this.state = newState;
|
62368 | var currentRouteInfos = this.currentRouteInfos = partition.unchanged.slice();
|
62369 |
|
62370 | try {
|
62371 | for (i = 0, l = partition.reset.length; i < l; i++) {
|
62372 | route = partition.reset[i].route;
|
62373 |
|
62374 | if (route !== undefined) {
|
62375 | if (route._internalReset !== undefined) {
|
62376 | route._internalReset(false, transition);
|
62377 | }
|
62378 | }
|
62379 | }
|
62380 |
|
62381 | for (i = 0, l = partition.updatedContext.length; i < l; i++) {
|
62382 | this.routeEnteredOrUpdated(currentRouteInfos, partition.updatedContext[i], false, transition);
|
62383 | }
|
62384 |
|
62385 | for (i = 0, l = partition.entered.length; i < l; i++) {
|
62386 | this.routeEnteredOrUpdated(currentRouteInfos, partition.entered[i], true, transition);
|
62387 | }
|
62388 | } catch (e) {
|
62389 | this.state = oldState;
|
62390 | this.currentRouteInfos = oldState.routeInfos;
|
62391 | throw e;
|
62392 | }
|
62393 |
|
62394 | this.state.queryParams = this.finalizeQueryParamChange(currentRouteInfos, newState.queryParams, transition);
|
62395 | }
|
62396 | /**
|
62397 | @private
|
62398 | Fires queryParamsDidChange event
|
62399 | */
|
62400 |
|
62401 |
|
62402 | fireQueryParamDidChange(newState, queryParamChangelist) {
|
62403 | // If queryParams changed trigger event
|
62404 | if (queryParamChangelist) {
|
62405 | // This is a little hacky but we need some way of storing
|
62406 | // changed query params given that no activeTransition
|
62407 | // is guaranteed to have occurred.
|
62408 | this._changedQueryParams = queryParamChangelist.all;
|
62409 | this.triggerEvent(newState.routeInfos, true, 'queryParamsDidChange', [queryParamChangelist.changed, queryParamChangelist.all, queryParamChangelist.removed]);
|
62410 | this._changedQueryParams = undefined;
|
62411 | }
|
62412 | }
|
62413 | /**
|
62414 | @private
|
62415 | Helper method used by setupContexts. Handles errors or redirects
|
62416 | that may happen in enter/setup.
|
62417 | */
|
62418 |
|
62419 |
|
62420 | routeEnteredOrUpdated(currentRouteInfos, routeInfo, enter, transition) {
|
62421 | var route = routeInfo.route,
|
62422 | context = routeInfo.context;
|
62423 |
|
62424 | function _routeEnteredOrUpdated(route) {
|
62425 | if (enter) {
|
62426 | if (route.enter !== undefined) {
|
62427 | route.enter(transition);
|
62428 | }
|
62429 | }
|
62430 |
|
62431 | if (transition && transition.isAborted) {
|
62432 | throw new TransitionAbortedError();
|
62433 | }
|
62434 |
|
62435 | route.context = context;
|
62436 |
|
62437 | if (route.contextDidChange !== undefined) {
|
62438 | route.contextDidChange();
|
62439 | }
|
62440 |
|
62441 | if (route.setup !== undefined) {
|
62442 | route.setup(context, transition);
|
62443 | }
|
62444 |
|
62445 | if (transition && transition.isAborted) {
|
62446 | throw new TransitionAbortedError();
|
62447 | }
|
62448 |
|
62449 | currentRouteInfos.push(routeInfo);
|
62450 | return route;
|
62451 | } // If the route doesn't exist, it means we haven't resolved the route promise yet
|
62452 |
|
62453 |
|
62454 | if (route === undefined) {
|
62455 | routeInfo.routePromise = routeInfo.routePromise.then(_routeEnteredOrUpdated);
|
62456 | } else {
|
62457 | _routeEnteredOrUpdated(route);
|
62458 | }
|
62459 |
|
62460 | return true;
|
62461 | }
|
62462 | /**
|
62463 | @private
|
62464 | This function is called when transitioning from one URL to
|
62465 | another to determine which routes are no longer active,
|
62466 | which routes are newly active, and which routes remain
|
62467 | active but have their context changed.
|
62468 | Take a list of old routes and new routes and partition
|
62469 | them into four buckets:
|
62470 | * unchanged: the route was active in both the old and
|
62471 | new URL, and its context remains the same
|
62472 | * updated context: the route was active in both the
|
62473 | old and new URL, but its context changed. The route's
|
62474 | `setup` method, if any, will be called with the new
|
62475 | context.
|
62476 | * exited: the route was active in the old URL, but is
|
62477 | no longer active.
|
62478 | * entered: the route was not active in the old URL, but
|
62479 | is now active.
|
62480 | The PartitionedRoutes structure has four fields:
|
62481 | * `updatedContext`: a list of `RouteInfo` objects that
|
62482 | represent routes that remain active but have a changed
|
62483 | context
|
62484 | * `entered`: a list of `RouteInfo` objects that represent
|
62485 | routes that are newly active
|
62486 | * `exited`: a list of `RouteInfo` objects that are no
|
62487 | longer active.
|
62488 | * `unchanged`: a list of `RouteInfo` objects that remain active.
|
62489 | @param {Array[InternalRouteInfo]} oldRoutes a list of the route
|
62490 | information for the previous URL (or `[]` if this is the
|
62491 | first handled transition)
|
62492 | @param {Array[InternalRouteInfo]} newRoutes a list of the route
|
62493 | information for the new URL
|
62494 | @return {Partition}
|
62495 | */
|
62496 |
|
62497 |
|
62498 | partitionRoutes(oldState, newState) {
|
62499 | var oldRouteInfos = oldState.routeInfos;
|
62500 | var newRouteInfos = newState.routeInfos;
|
62501 | var routes = {
|
62502 | updatedContext: [],
|
62503 | exited: [],
|
62504 | entered: [],
|
62505 | unchanged: [],
|
62506 | reset: []
|
62507 | };
|
62508 | var routeChanged,
|
62509 | contextChanged = false,
|
62510 | i,
|
62511 | l;
|
62512 |
|
62513 | for (i = 0, l = newRouteInfos.length; i < l; i++) {
|
62514 | var oldRouteInfo = oldRouteInfos[i],
|
62515 | newRouteInfo = newRouteInfos[i];
|
62516 |
|
62517 | if (!oldRouteInfo || oldRouteInfo.route !== newRouteInfo.route) {
|
62518 | routeChanged = true;
|
62519 | }
|
62520 |
|
62521 | if (routeChanged) {
|
62522 | routes.entered.push(newRouteInfo);
|
62523 |
|
62524 | if (oldRouteInfo) {
|
62525 | routes.exited.unshift(oldRouteInfo);
|
62526 | }
|
62527 | } else if (contextChanged || oldRouteInfo.context !== newRouteInfo.context) {
|
62528 | contextChanged = true;
|
62529 | routes.updatedContext.push(newRouteInfo);
|
62530 | } else {
|
62531 | routes.unchanged.push(oldRouteInfo);
|
62532 | }
|
62533 | }
|
62534 |
|
62535 | for (i = newRouteInfos.length, l = oldRouteInfos.length; i < l; i++) {
|
62536 | routes.exited.unshift(oldRouteInfos[i]);
|
62537 | }
|
62538 |
|
62539 | routes.reset = routes.updatedContext.slice();
|
62540 | routes.reset.reverse();
|
62541 | return routes;
|
62542 | }
|
62543 |
|
62544 | _updateURL(transition, state) {
|
62545 | var urlMethod = transition.urlMethod;
|
62546 |
|
62547 | if (!urlMethod) {
|
62548 | return;
|
62549 | }
|
62550 |
|
62551 | var {
|
62552 | routeInfos
|
62553 | } = state;
|
62554 | var {
|
62555 | name: routeName
|
62556 | } = routeInfos[routeInfos.length - 1];
|
62557 | var params = {};
|
62558 |
|
62559 | for (var i = routeInfos.length - 1; i >= 0; --i) {
|
62560 | var routeInfo = routeInfos[i];
|
62561 | merge(params, routeInfo.params);
|
62562 |
|
62563 | if (routeInfo.route.inaccessibleByURL) {
|
62564 | urlMethod = null;
|
62565 | }
|
62566 | }
|
62567 |
|
62568 | if (urlMethod) {
|
62569 | params.queryParams = transition._visibleQueryParams || state.queryParams;
|
62570 | var url = this.recognizer.generate(routeName, params); // transitions during the initial transition must always use replaceURL.
|
62571 | // When the app boots, you are at a url, e.g. /foo. If some route
|
62572 | // redirects to bar as part of the initial transition, you don't want to
|
62573 | // add a history entry for /foo. If you do, pressing back will immediately
|
62574 | // hit the redirect again and take you back to /bar, thus killing the back
|
62575 | // button
|
62576 |
|
62577 | var initial = transition.isCausedByInitialTransition; // say you are at / and you click a link to route /foo. In /foo's
|
62578 | // route, the transition is aborted using replacewith('/bar').
|
62579 | // Because the current url is still /, the history entry for / is
|
62580 | // removed from the history. Clicking back will take you to the page
|
62581 | // you were on before /, which is often not even the app, thus killing
|
62582 | // the back button. That's why updateURL is always correct for an
|
62583 | // aborting transition that's not the initial transition
|
62584 |
|
62585 | var replaceAndNotAborting = urlMethod === 'replace' && !transition.isCausedByAbortingTransition; // because calling refresh causes an aborted transition, this needs to be
|
62586 | // special cased - if the initial transition is a replace transition, the
|
62587 | // urlMethod should be honored here.
|
62588 |
|
62589 | var isQueryParamsRefreshTransition = transition.queryParamsOnly && urlMethod === 'replace'; // say you are at / and you a `replaceWith(/foo)` is called. Then, that
|
62590 | // transition is aborted with `replaceWith(/bar)`. At the end, we should
|
62591 | // end up with /bar replacing /. We are replacing the replace. We only
|
62592 | // will replace the initial route if all subsequent aborts are also
|
62593 | // replaces. However, there is some ambiguity around the correct behavior
|
62594 | // here.
|
62595 |
|
62596 | var replacingReplace = urlMethod === 'replace' && transition.isCausedByAbortingReplaceTransition;
|
62597 |
|
62598 | if (initial || replaceAndNotAborting || isQueryParamsRefreshTransition || replacingReplace) {
|
62599 | this.replaceURL(url);
|
62600 | } else {
|
62601 | this.updateURL(url);
|
62602 | }
|
62603 | }
|
62604 | }
|
62605 |
|
62606 | finalizeQueryParamChange(resolvedHandlers, newQueryParams, transition) {
|
62607 | // We fire a finalizeQueryParamChange event which
|
62608 | // gives the new route hierarchy a chance to tell
|
62609 | // us which query params it's consuming and what
|
62610 | // their final values are. If a query param is
|
62611 | // no longer consumed in the final route hierarchy,
|
62612 | // its serialized segment will be removed
|
62613 | // from the URL.
|
62614 | for (var k in newQueryParams) {
|
62615 | if (newQueryParams.hasOwnProperty(k) && newQueryParams[k] === null) {
|
62616 | delete newQueryParams[k];
|
62617 | }
|
62618 | }
|
62619 |
|
62620 | var finalQueryParamsArray = [];
|
62621 | this.triggerEvent(resolvedHandlers, true, 'finalizeQueryParamChange', [newQueryParams, finalQueryParamsArray, transition]);
|
62622 |
|
62623 | if (transition) {
|
62624 | transition._visibleQueryParams = {};
|
62625 | }
|
62626 |
|
62627 | var finalQueryParams = {};
|
62628 |
|
62629 | for (var i = 0, len = finalQueryParamsArray.length; i < len; ++i) {
|
62630 | var qp = finalQueryParamsArray[i];
|
62631 | finalQueryParams[qp.key] = qp.value;
|
62632 |
|
62633 | if (transition && qp.visible !== false) {
|
62634 | transition._visibleQueryParams[qp.key] = qp.value;
|
62635 | }
|
62636 | }
|
62637 |
|
62638 | return finalQueryParams;
|
62639 | }
|
62640 |
|
62641 | toReadOnlyInfos(newTransition, newState) {
|
62642 | var oldRouteInfos = this.state.routeInfos;
|
62643 | this.fromInfos(newTransition, oldRouteInfos);
|
62644 | this.toInfos(newTransition, newState.routeInfos);
|
62645 | this._lastQueryParams = newState.queryParams;
|
62646 | }
|
62647 |
|
62648 | fromInfos(newTransition, oldRouteInfos) {
|
62649 | if (newTransition !== undefined && oldRouteInfos.length > 0) {
|
62650 | var fromInfos = toReadOnlyRouteInfo(oldRouteInfos, (0, _polyfills.assign)({}, this._lastQueryParams), true);
|
62651 | newTransition.from = fromInfos[fromInfos.length - 1] || null;
|
62652 | }
|
62653 | }
|
62654 |
|
62655 | toInfos(newTransition, newRouteInfos, includeAttributes = false) {
|
62656 | if (newTransition !== undefined && newRouteInfos.length > 0) {
|
62657 | var toInfos = toReadOnlyRouteInfo(newRouteInfos, (0, _polyfills.assign)({}, newTransition[QUERY_PARAMS_SYMBOL]), includeAttributes);
|
62658 | newTransition.to = toInfos[toInfos.length - 1] || null;
|
62659 | }
|
62660 | }
|
62661 |
|
62662 | notifyExistingHandlers(newState, newTransition) {
|
62663 | var oldRouteInfos = this.state.routeInfos,
|
62664 | i,
|
62665 | oldRouteInfoLen,
|
62666 | oldHandler,
|
62667 | newRouteInfo;
|
62668 | oldRouteInfoLen = oldRouteInfos.length;
|
62669 |
|
62670 | for (i = 0; i < oldRouteInfoLen; i++) {
|
62671 | oldHandler = oldRouteInfos[i];
|
62672 | newRouteInfo = newState.routeInfos[i];
|
62673 |
|
62674 | if (!newRouteInfo || oldHandler.name !== newRouteInfo.name) {
|
62675 | break;
|
62676 | }
|
62677 |
|
62678 | if (!newRouteInfo.isResolved) {}
|
62679 | }
|
62680 |
|
62681 | this.triggerEvent(oldRouteInfos, true, 'willTransition', [newTransition]);
|
62682 | this.routeWillChange(newTransition);
|
62683 | this.willTransition(oldRouteInfos, newState.routeInfos, newTransition);
|
62684 | }
|
62685 | /**
|
62686 | Clears the current and target route routes and triggers exit
|
62687 | on each of them starting at the leaf and traversing up through
|
62688 | its ancestors.
|
62689 | */
|
62690 |
|
62691 |
|
62692 | reset() {
|
62693 | if (this.state) {
|
62694 | forEach(this.state.routeInfos.slice().reverse(), function (routeInfo) {
|
62695 | var route = routeInfo.route;
|
62696 |
|
62697 | if (route !== undefined) {
|
62698 | if (route.exit !== undefined) {
|
62699 | route.exit();
|
62700 | }
|
62701 | }
|
62702 |
|
62703 | return true;
|
62704 | });
|
62705 | }
|
62706 |
|
62707 | this.oldState = undefined;
|
62708 | this.state = new TransitionState();
|
62709 | this.currentRouteInfos = undefined;
|
62710 | }
|
62711 | /**
|
62712 | let handler = routeInfo.handler;
|
62713 | The entry point for handling a change to the URL (usually
|
62714 | via the back and forward button).
|
62715 | Returns an Array of handlers and the parameters associated
|
62716 | with those parameters.
|
62717 | @param {String} url a URL to process
|
62718 | @return {Array} an Array of `[handler, parameter]` tuples
|
62719 | */
|
62720 |
|
62721 |
|
62722 | handleURL(url) {
|
62723 | // Perform a URL-based transition, but don't change
|
62724 | // the URL afterward, since it already happened.
|
62725 | if (url.charAt(0) !== '/') {
|
62726 | url = '/' + url;
|
62727 | }
|
62728 |
|
62729 | return this.doTransition(url).method(null);
|
62730 | }
|
62731 | /**
|
62732 | Transition into the specified named route.
|
62733 | If necessary, trigger the exit callback on any routes
|
62734 | that are no longer represented by the target route.
|
62735 | @param {String} name the name of the route
|
62736 | */
|
62737 |
|
62738 |
|
62739 | transitionTo(name, ...contexts) {
|
62740 | if (typeof name === 'object') {
|
62741 | contexts.push(name);
|
62742 | return this.doTransition(undefined, contexts, false);
|
62743 | }
|
62744 |
|
62745 | return this.doTransition(name, contexts);
|
62746 | }
|
62747 |
|
62748 | intermediateTransitionTo(name, ...args) {
|
62749 | return this.doTransition(name, args, true);
|
62750 | }
|
62751 |
|
62752 | refresh(pivotRoute) {
|
62753 | var previousTransition = this.activeTransition;
|
62754 | var state = previousTransition ? previousTransition[STATE_SYMBOL] : this.state;
|
62755 | var routeInfos = state.routeInfos;
|
62756 |
|
62757 | if (pivotRoute === undefined) {
|
62758 | pivotRoute = routeInfos[0].route;
|
62759 | }
|
62760 |
|
62761 | log(this, 'Starting a refresh transition');
|
62762 | var name = routeInfos[routeInfos.length - 1].name;
|
62763 | var intent = new NamedTransitionIntent(this, name, pivotRoute, [], this._changedQueryParams || state.queryParams);
|
62764 | var newTransition = this.transitionByIntent(intent, false); // if the previous transition is a replace transition, that needs to be preserved
|
62765 |
|
62766 | if (previousTransition && previousTransition.urlMethod === 'replace') {
|
62767 | newTransition.method(previousTransition.urlMethod);
|
62768 | }
|
62769 |
|
62770 | return newTransition;
|
62771 | }
|
62772 | /**
|
62773 | Identical to `transitionTo` except that the current URL will be replaced
|
62774 | if possible.
|
62775 | This method is intended primarily for use with `replaceState`.
|
62776 | @param {String} name the name of the route
|
62777 | */
|
62778 |
|
62779 |
|
62780 | replaceWith(name) {
|
62781 | return this.doTransition(name).method('replace');
|
62782 | }
|
62783 | /**
|
62784 | Take a named route and context objects and generate a
|
62785 | URL.
|
62786 | @param {String} name the name of the route to generate
|
62787 | a URL for
|
62788 | @param {...Object} objects a list of objects to serialize
|
62789 | @return {String} a URL
|
62790 | */
|
62791 |
|
62792 |
|
62793 | generate(routeName, ...args) {
|
62794 | var partitionedArgs = extractQueryParams(args),
|
62795 | suppliedParams = partitionedArgs[0],
|
62796 | queryParams = partitionedArgs[1]; // Construct a TransitionIntent with the provided params
|
62797 | // and apply it to the present state of the router.
|
62798 |
|
62799 | var intent = new NamedTransitionIntent(this, routeName, undefined, suppliedParams);
|
62800 | var state = intent.applyToState(this.state, false);
|
62801 | var params = {};
|
62802 |
|
62803 | for (var i = 0, len = state.routeInfos.length; i < len; ++i) {
|
62804 | var routeInfo = state.routeInfos[i];
|
62805 | var routeParams = routeInfo.serialize();
|
62806 | merge(params, routeParams);
|
62807 | }
|
62808 |
|
62809 | params.queryParams = queryParams;
|
62810 | return this.recognizer.generate(routeName, params);
|
62811 | }
|
62812 |
|
62813 | applyIntent(routeName, contexts) {
|
62814 | var intent = new NamedTransitionIntent(this, routeName, undefined, contexts);
|
62815 | var state = this.activeTransition && this.activeTransition[STATE_SYMBOL] || this.state;
|
62816 | return intent.applyToState(state, false);
|
62817 | }
|
62818 |
|
62819 | isActiveIntent(routeName, contexts, queryParams, _state) {
|
62820 | var state = _state || this.state,
|
62821 | targetRouteInfos = state.routeInfos,
|
62822 | routeInfo,
|
62823 | len;
|
62824 |
|
62825 | if (!targetRouteInfos.length) {
|
62826 | return false;
|
62827 | }
|
62828 |
|
62829 | var targetHandler = targetRouteInfos[targetRouteInfos.length - 1].name;
|
62830 | var recogHandlers = this.recognizer.handlersFor(targetHandler);
|
62831 | var index = 0;
|
62832 |
|
62833 | for (len = recogHandlers.length; index < len; ++index) {
|
62834 | routeInfo = targetRouteInfos[index];
|
62835 |
|
62836 | if (routeInfo.name === routeName) {
|
62837 | break;
|
62838 | }
|
62839 | }
|
62840 |
|
62841 | if (index === recogHandlers.length) {
|
62842 | // The provided route name isn't even in the route hierarchy.
|
62843 | return false;
|
62844 | }
|
62845 |
|
62846 | var testState = new TransitionState();
|
62847 | testState.routeInfos = targetRouteInfos.slice(0, index + 1);
|
62848 | recogHandlers = recogHandlers.slice(0, index + 1);
|
62849 | var intent = new NamedTransitionIntent(this, targetHandler, undefined, contexts);
|
62850 | var newState = intent.applyToHandlers(testState, recogHandlers, targetHandler, true, true);
|
62851 | var routesEqual = routeInfosEqual(newState.routeInfos, testState.routeInfos);
|
62852 |
|
62853 | if (!queryParams || !routesEqual) {
|
62854 | return routesEqual;
|
62855 | } // Get a hash of QPs that will still be active on new route
|
62856 |
|
62857 |
|
62858 | var activeQPsOnNewHandler = {};
|
62859 | merge(activeQPsOnNewHandler, queryParams);
|
62860 | var activeQueryParams = state.queryParams;
|
62861 |
|
62862 | for (var key in activeQueryParams) {
|
62863 | if (activeQueryParams.hasOwnProperty(key) && activeQPsOnNewHandler.hasOwnProperty(key)) {
|
62864 | activeQPsOnNewHandler[key] = activeQueryParams[key];
|
62865 | }
|
62866 | }
|
62867 |
|
62868 | return routesEqual && !getChangelist(activeQPsOnNewHandler, queryParams);
|
62869 | }
|
62870 |
|
62871 | isActive(routeName, ...args) {
|
62872 | var partitionedArgs = extractQueryParams(args);
|
62873 | return this.isActiveIntent(routeName, partitionedArgs[0], partitionedArgs[1]);
|
62874 | }
|
62875 |
|
62876 | trigger(name, ...args) {
|
62877 | this.triggerEvent(this.currentRouteInfos, false, name, args);
|
62878 | }
|
62879 |
|
62880 | }
|
62881 |
|
62882 | function routeInfosEqual(routeInfos, otherRouteInfos) {
|
62883 | if (routeInfos.length !== otherRouteInfos.length) {
|
62884 | return false;
|
62885 | }
|
62886 |
|
62887 | for (var i = 0, len = routeInfos.length; i < len; ++i) {
|
62888 | if (routeInfos[i] !== otherRouteInfos[i]) {
|
62889 | return false;
|
62890 | }
|
62891 | }
|
62892 |
|
62893 | return true;
|
62894 | }
|
62895 |
|
62896 | function routeInfosSameExceptQueryParams(routeInfos, otherRouteInfos) {
|
62897 | if (routeInfos.length !== otherRouteInfos.length) {
|
62898 | return false;
|
62899 | }
|
62900 |
|
62901 | for (var i = 0, len = routeInfos.length; i < len; ++i) {
|
62902 | if (routeInfos[i].name !== otherRouteInfos[i].name) {
|
62903 | return false;
|
62904 | }
|
62905 |
|
62906 | if (!paramsEqual(routeInfos[i].params, otherRouteInfos[i].params)) {
|
62907 | return false;
|
62908 | }
|
62909 | }
|
62910 |
|
62911 | return true;
|
62912 | }
|
62913 |
|
62914 | function paramsEqual(params, otherParams) {
|
62915 | if (!params && !otherParams) {
|
62916 | return true;
|
62917 | } else if (!params && !!otherParams || !!params && !otherParams) {
|
62918 | // one is falsy but other is not;
|
62919 | return false;
|
62920 | }
|
62921 |
|
62922 | var keys = Object.keys(params);
|
62923 | var otherKeys = Object.keys(otherParams);
|
62924 |
|
62925 | if (keys.length !== otherKeys.length) {
|
62926 | return false;
|
62927 | }
|
62928 |
|
62929 | for (var i = 0, len = keys.length; i < len; ++i) {
|
62930 | var key = keys[i];
|
62931 |
|
62932 | if (params[key] !== otherParams[key]) {
|
62933 | return false;
|
62934 | }
|
62935 | }
|
62936 |
|
62937 | return true;
|
62938 | }
|
62939 |
|
62940 | var _default = Router;
|
62941 | _exports.default = _default;
|
62942 | });
|
62943 | define("rsvp", ["exports"], function (_exports) {
|
62944 | "use strict";
|
62945 |
|
62946 | Object.defineProperty(_exports, "__esModule", {
|
62947 | value: true
|
62948 | });
|
62949 | _exports.asap = asap;
|
62950 | _exports.all = all$1;
|
62951 | _exports.allSettled = allSettled;
|
62952 | _exports.race = race$1;
|
62953 | _exports.hash = hash;
|
62954 | _exports.hashSettled = hashSettled;
|
62955 | _exports.rethrow = rethrow;
|
62956 | _exports.defer = defer;
|
62957 | _exports.denodeify = denodeify;
|
62958 | _exports.configure = configure;
|
62959 | _exports.on = on;
|
62960 | _exports.off = off;
|
62961 | _exports.resolve = resolve$2;
|
62962 | _exports.reject = reject$2;
|
62963 | _exports.map = map;
|
62964 | _exports.filter = filter;
|
62965 | _exports.async = _exports.EventTarget = _exports.Promise = _exports.cast = _exports.default = void 0;
|
62966 |
|
62967 | function callbacksFor(object) {
|
62968 | var callbacks = object._promiseCallbacks;
|
62969 |
|
62970 | if (!callbacks) {
|
62971 | callbacks = object._promiseCallbacks = {};
|
62972 | }
|
62973 |
|
62974 | return callbacks;
|
62975 | }
|
62976 | /**
|
62977 | @class EventTarget
|
62978 | @for rsvp
|
62979 | @public
|
62980 | */
|
62981 |
|
62982 |
|
62983 | var EventTarget = {
|
62984 | /**
|
62985 | `EventTarget.mixin` extends an object with EventTarget methods. For
|
62986 | Example:
|
62987 | ```javascript
|
62988 | import EventTarget from 'rsvp';
|
62989 | let object = {};
|
62990 | EventTarget.mixin(object);
|
62991 | object.on('finished', function(event) {
|
62992 | // handle event
|
62993 | });
|
62994 | object.trigger('finished', { detail: value });
|
62995 | ```
|
62996 | `EventTarget.mixin` also works with prototypes:
|
62997 | ```javascript
|
62998 | import EventTarget from 'rsvp';
|
62999 | let Person = function() {};
|
63000 | EventTarget.mixin(Person.prototype);
|
63001 | let yehuda = new Person();
|
63002 | let tom = new Person();
|
63003 | yehuda.on('poke', function(event) {
|
63004 | console.log('Yehuda says OW');
|
63005 | });
|
63006 | tom.on('poke', function(event) {
|
63007 | console.log('Tom says OW');
|
63008 | });
|
63009 | yehuda.trigger('poke');
|
63010 | tom.trigger('poke');
|
63011 | ```
|
63012 | @method mixin
|
63013 | @for rsvp
|
63014 | @private
|
63015 | @param {Object} object object to extend with EventTarget methods
|
63016 | */
|
63017 | mixin(object) {
|
63018 | object.on = this.on;
|
63019 | object.off = this.off;
|
63020 | object.trigger = this.trigger;
|
63021 | object._promiseCallbacks = undefined;
|
63022 | return object;
|
63023 | },
|
63024 |
|
63025 | /**
|
63026 | Registers a callback to be executed when `eventName` is triggered
|
63027 | ```javascript
|
63028 | object.on('event', function(eventInfo){
|
63029 | // handle the event
|
63030 | });
|
63031 | object.trigger('event');
|
63032 | ```
|
63033 | @method on
|
63034 | @for EventTarget
|
63035 | @private
|
63036 | @param {String} eventName name of the event to listen for
|
63037 | @param {Function} callback function to be called when the event is triggered.
|
63038 | */
|
63039 | on(eventName, callback) {
|
63040 | if (typeof callback !== 'function') {
|
63041 | throw new TypeError('Callback must be a function');
|
63042 | }
|
63043 |
|
63044 | var allCallbacks = callbacksFor(this);
|
63045 | var callbacks = allCallbacks[eventName];
|
63046 |
|
63047 | if (!callbacks) {
|
63048 | callbacks = allCallbacks[eventName] = [];
|
63049 | }
|
63050 |
|
63051 | if (callbacks.indexOf(callback) === -1) {
|
63052 | callbacks.push(callback);
|
63053 | }
|
63054 | },
|
63055 |
|
63056 | /**
|
63057 | You can use `off` to stop firing a particular callback for an event:
|
63058 | ```javascript
|
63059 | function doStuff() { // do stuff! }
|
63060 | object.on('stuff', doStuff);
|
63061 | object.trigger('stuff'); // doStuff will be called
|
63062 | // Unregister ONLY the doStuff callback
|
63063 | object.off('stuff', doStuff);
|
63064 | object.trigger('stuff'); // doStuff will NOT be called
|
63065 | ```
|
63066 | If you don't pass a `callback` argument to `off`, ALL callbacks for the
|
63067 | event will not be executed when the event fires. For example:
|
63068 | ```javascript
|
63069 | let callback1 = function(){};
|
63070 | let callback2 = function(){};
|
63071 | object.on('stuff', callback1);
|
63072 | object.on('stuff', callback2);
|
63073 | object.trigger('stuff'); // callback1 and callback2 will be executed.
|
63074 | object.off('stuff');
|
63075 | object.trigger('stuff'); // callback1 and callback2 will not be executed!
|
63076 | ```
|
63077 | @method off
|
63078 | @for rsvp
|
63079 | @private
|
63080 | @param {String} eventName event to stop listening to
|
63081 | @param {Function} [callback] optional argument. If given, only the function
|
63082 | given will be removed from the event's callback queue. If no `callback`
|
63083 | argument is given, all callbacks will be removed from the event's callback
|
63084 | queue.
|
63085 | */
|
63086 | off(eventName, callback) {
|
63087 | var allCallbacks = callbacksFor(this);
|
63088 |
|
63089 | if (!callback) {
|
63090 | allCallbacks[eventName] = [];
|
63091 | return;
|
63092 | }
|
63093 |
|
63094 | var callbacks = allCallbacks[eventName];
|
63095 | var index = callbacks.indexOf(callback);
|
63096 |
|
63097 | if (index !== -1) {
|
63098 | callbacks.splice(index, 1);
|
63099 | }
|
63100 | },
|
63101 |
|
63102 | /**
|
63103 | Use `trigger` to fire custom events. For example:
|
63104 | ```javascript
|
63105 | object.on('foo', function(){
|
63106 | console.log('foo event happened!');
|
63107 | });
|
63108 | object.trigger('foo');
|
63109 | // 'foo event happened!' logged to the console
|
63110 | ```
|
63111 | You can also pass a value as a second argument to `trigger` that will be
|
63112 | passed as an argument to all event listeners for the event:
|
63113 | ```javascript
|
63114 | object.on('foo', function(value){
|
63115 | console.log(value.name);
|
63116 | });
|
63117 | object.trigger('foo', { name: 'bar' });
|
63118 | // 'bar' logged to the console
|
63119 | ```
|
63120 | @method trigger
|
63121 | @for rsvp
|
63122 | @private
|
63123 | @param {String} eventName name of the event to be triggered
|
63124 | @param {*} [options] optional value to be passed to any event handlers for
|
63125 | the given `eventName`
|
63126 | */
|
63127 | trigger(eventName, options, label) {
|
63128 | var allCallbacks = callbacksFor(this);
|
63129 | var callbacks = allCallbacks[eventName];
|
63130 |
|
63131 | if (callbacks) {
|
63132 | // Don't cache the callbacks.length since it may grow
|
63133 | var callback;
|
63134 |
|
63135 | for (var i = 0; i < callbacks.length; i++) {
|
63136 | callback = callbacks[i];
|
63137 | callback(options, label);
|
63138 | }
|
63139 | }
|
63140 | }
|
63141 |
|
63142 | };
|
63143 | _exports.EventTarget = EventTarget;
|
63144 | var config = {
|
63145 | instrument: false
|
63146 | };
|
63147 | EventTarget['mixin'](config);
|
63148 |
|
63149 | function configure(name, value) {
|
63150 | if (arguments.length === 2) {
|
63151 | config[name] = value;
|
63152 | } else {
|
63153 | return config[name];
|
63154 | }
|
63155 | }
|
63156 |
|
63157 | var queue = [];
|
63158 |
|
63159 | function scheduleFlush() {
|
63160 | setTimeout(() => {
|
63161 | for (var i = 0; i < queue.length; i++) {
|
63162 | var entry = queue[i];
|
63163 | var payload = entry.payload;
|
63164 | payload.guid = payload.key + payload.id;
|
63165 | payload.childGuid = payload.key + payload.childId;
|
63166 |
|
63167 | if (payload.error) {
|
63168 | payload.stack = payload.error.stack;
|
63169 | }
|
63170 |
|
63171 | config['trigger'](entry.name, entry.payload);
|
63172 | }
|
63173 |
|
63174 | queue.length = 0;
|
63175 | }, 50);
|
63176 | }
|
63177 |
|
63178 | function instrument(eventName, promise, child) {
|
63179 | if (1 === queue.push({
|
63180 | name: eventName,
|
63181 | payload: {
|
63182 | key: promise._guidKey,
|
63183 | id: promise._id,
|
63184 | eventName: eventName,
|
63185 | detail: promise._result,
|
63186 | childId: child && child._id,
|
63187 | label: promise._label,
|
63188 | timeStamp: Date.now(),
|
63189 | error: config["instrument-with-stack"] ? new Error(promise._label) : null
|
63190 | }
|
63191 | })) {
|
63192 | scheduleFlush();
|
63193 | }
|
63194 | }
|
63195 | /**
|
63196 | `Promise.resolve` returns a promise that will become resolved with the
|
63197 | passed `value`. It is shorthand for the following:
|
63198 |
|
63199 | ```javascript
|
63200 | import Promise from 'rsvp';
|
63201 |
|
63202 | let promise = new Promise(function(resolve, reject){
|
63203 | resolve(1);
|
63204 | });
|
63205 |
|
63206 | promise.then(function(value){
|
63207 | // value === 1
|
63208 | });
|
63209 | ```
|
63210 |
|
63211 | Instead of writing the above, your code now simply becomes the following:
|
63212 |
|
63213 | ```javascript
|
63214 | import Promise from 'rsvp';
|
63215 |
|
63216 | let promise = RSVP.Promise.resolve(1);
|
63217 |
|
63218 | promise.then(function(value){
|
63219 | // value === 1
|
63220 | });
|
63221 | ```
|
63222 |
|
63223 | @method resolve
|
63224 | @for Promise
|
63225 | @static
|
63226 | @param {*} object value that the returned promise will be resolved with
|
63227 | @param {String} [label] optional string for identifying the returned promise.
|
63228 | Useful for tooling.
|
63229 | @return {Promise} a promise that will become fulfilled with the given
|
63230 | `value`
|
63231 | */
|
63232 |
|
63233 |
|
63234 | function resolve$$1(object, label) {
|
63235 | /*jshint validthis:true */
|
63236 | var Constructor = this;
|
63237 |
|
63238 | if (object && typeof object === 'object' && object.constructor === Constructor) {
|
63239 | return object;
|
63240 | }
|
63241 |
|
63242 | var promise = new Constructor(noop, label);
|
63243 | resolve$1(promise, object);
|
63244 | return promise;
|
63245 | }
|
63246 |
|
63247 | function withOwnPromise() {
|
63248 | return new TypeError('A promises callback cannot return that same promise.');
|
63249 | }
|
63250 |
|
63251 | function objectOrFunction(x) {
|
63252 | var type = typeof x;
|
63253 | return x !== null && (type === 'object' || type === 'function');
|
63254 | }
|
63255 |
|
63256 | function noop() {}
|
63257 |
|
63258 | var PENDING = void 0;
|
63259 | var FULFILLED = 1;
|
63260 | var REJECTED = 2;
|
63261 |
|
63262 | function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
|
63263 | try {
|
63264 | then$$1.call(value, fulfillmentHandler, rejectionHandler);
|
63265 | } catch (e) {
|
63266 | return e;
|
63267 | }
|
63268 | }
|
63269 |
|
63270 | function handleForeignThenable(promise, thenable, then$$1) {
|
63271 | config.async(promise => {
|
63272 | var sealed = false;
|
63273 | var error = tryThen(then$$1, thenable, value => {
|
63274 | if (sealed) {
|
63275 | return;
|
63276 | }
|
63277 |
|
63278 | sealed = true;
|
63279 |
|
63280 | if (thenable === value) {
|
63281 | fulfill(promise, value);
|
63282 | } else {
|
63283 | resolve$1(promise, value);
|
63284 | }
|
63285 | }, reason => {
|
63286 | if (sealed) {
|
63287 | return;
|
63288 | }
|
63289 |
|
63290 | sealed = true;
|
63291 | reject(promise, reason);
|
63292 | }, 'Settle: ' + (promise._label || ' unknown promise'));
|
63293 |
|
63294 | if (!sealed && error) {
|
63295 | sealed = true;
|
63296 | reject(promise, error);
|
63297 | }
|
63298 | }, promise);
|
63299 | }
|
63300 |
|
63301 | function handleOwnThenable(promise, thenable) {
|
63302 | if (thenable._state === FULFILLED) {
|
63303 | fulfill(promise, thenable._result);
|
63304 | } else if (thenable._state === REJECTED) {
|
63305 | thenable._onError = null;
|
63306 | reject(promise, thenable._result);
|
63307 | } else {
|
63308 | subscribe(thenable, undefined, value => {
|
63309 | if (thenable === value) {
|
63310 | fulfill(promise, value);
|
63311 | } else {
|
63312 | resolve$1(promise, value);
|
63313 | }
|
63314 | }, reason => reject(promise, reason));
|
63315 | }
|
63316 | }
|
63317 |
|
63318 | function handleMaybeThenable(promise, maybeThenable, then$$1) {
|
63319 | var isOwnThenable = maybeThenable.constructor === promise.constructor && then$$1 === then && promise.constructor.resolve === resolve$$1;
|
63320 |
|
63321 | if (isOwnThenable) {
|
63322 | handleOwnThenable(promise, maybeThenable);
|
63323 | } else if (typeof then$$1 === 'function') {
|
63324 | handleForeignThenable(promise, maybeThenable, then$$1);
|
63325 | } else {
|
63326 | fulfill(promise, maybeThenable);
|
63327 | }
|
63328 | }
|
63329 |
|
63330 | function resolve$1(promise, value) {
|
63331 | if (promise === value) {
|
63332 | fulfill(promise, value);
|
63333 | } else if (objectOrFunction(value)) {
|
63334 | var then$$1;
|
63335 |
|
63336 | try {
|
63337 | then$$1 = value.then;
|
63338 | } catch (error) {
|
63339 | reject(promise, error);
|
63340 | return;
|
63341 | }
|
63342 |
|
63343 | handleMaybeThenable(promise, value, then$$1);
|
63344 | } else {
|
63345 | fulfill(promise, value);
|
63346 | }
|
63347 | }
|
63348 |
|
63349 | function publishRejection(promise) {
|
63350 | if (promise._onError) {
|
63351 | promise._onError(promise._result);
|
63352 | }
|
63353 |
|
63354 | publish(promise);
|
63355 | }
|
63356 |
|
63357 | function fulfill(promise, value) {
|
63358 | if (promise._state !== PENDING) {
|
63359 | return;
|
63360 | }
|
63361 |
|
63362 | promise._result = value;
|
63363 | promise._state = FULFILLED;
|
63364 |
|
63365 | if (promise._subscribers.length === 0) {
|
63366 | if (config.instrument) {
|
63367 | instrument('fulfilled', promise);
|
63368 | }
|
63369 | } else {
|
63370 | config.async(publish, promise);
|
63371 | }
|
63372 | }
|
63373 |
|
63374 | function reject(promise, reason) {
|
63375 | if (promise._state !== PENDING) {
|
63376 | return;
|
63377 | }
|
63378 |
|
63379 | promise._state = REJECTED;
|
63380 | promise._result = reason;
|
63381 | config.async(publishRejection, promise);
|
63382 | }
|
63383 |
|
63384 | function subscribe(parent, child, onFulfillment, onRejection) {
|
63385 | var subscribers = parent._subscribers;
|
63386 | var length = subscribers.length;
|
63387 | parent._onError = null;
|
63388 | subscribers[length] = child;
|
63389 | subscribers[length + FULFILLED] = onFulfillment;
|
63390 | subscribers[length + REJECTED] = onRejection;
|
63391 |
|
63392 | if (length === 0 && parent._state) {
|
63393 | config.async(publish, parent);
|
63394 | }
|
63395 | }
|
63396 |
|
63397 | function publish(promise) {
|
63398 | var subscribers = promise._subscribers;
|
63399 | var settled = promise._state;
|
63400 |
|
63401 | if (config.instrument) {
|
63402 | instrument(settled === FULFILLED ? 'fulfilled' : 'rejected', promise);
|
63403 | }
|
63404 |
|
63405 | if (subscribers.length === 0) {
|
63406 | return;
|
63407 | }
|
63408 |
|
63409 | var child,
|
63410 | callback,
|
63411 | result = promise._result;
|
63412 |
|
63413 | for (var i = 0; i < subscribers.length; i += 3) {
|
63414 | child = subscribers[i];
|
63415 | callback = subscribers[i + settled];
|
63416 |
|
63417 | if (child) {
|
63418 | invokeCallback(settled, child, callback, result);
|
63419 | } else {
|
63420 | callback(result);
|
63421 | }
|
63422 | }
|
63423 |
|
63424 | promise._subscribers.length = 0;
|
63425 | }
|
63426 |
|
63427 | function invokeCallback(state, promise, callback, result) {
|
63428 | var hasCallback = typeof callback === 'function';
|
63429 | var value,
|
63430 | succeeded = true,
|
63431 | error;
|
63432 |
|
63433 | if (hasCallback) {
|
63434 | try {
|
63435 | value = callback(result);
|
63436 | } catch (e) {
|
63437 | succeeded = false;
|
63438 | error = e;
|
63439 | }
|
63440 | } else {
|
63441 | value = result;
|
63442 | }
|
63443 |
|
63444 | if (promise._state !== PENDING) {// noop
|
63445 | } else if (value === promise) {
|
63446 | reject(promise, withOwnPromise());
|
63447 | } else if (succeeded === false) {
|
63448 | reject(promise, error);
|
63449 | } else if (hasCallback) {
|
63450 | resolve$1(promise, value);
|
63451 | } else if (state === FULFILLED) {
|
63452 | fulfill(promise, value);
|
63453 | } else if (state === REJECTED) {
|
63454 | reject(promise, value);
|
63455 | }
|
63456 | }
|
63457 |
|
63458 | function initializePromise(promise, resolver) {
|
63459 | var resolved = false;
|
63460 |
|
63461 | try {
|
63462 | resolver(value => {
|
63463 | if (resolved) {
|
63464 | return;
|
63465 | }
|
63466 |
|
63467 | resolved = true;
|
63468 | resolve$1(promise, value);
|
63469 | }, reason => {
|
63470 | if (resolved) {
|
63471 | return;
|
63472 | }
|
63473 |
|
63474 | resolved = true;
|
63475 | reject(promise, reason);
|
63476 | });
|
63477 | } catch (e) {
|
63478 | reject(promise, e);
|
63479 | }
|
63480 | }
|
63481 |
|
63482 | function then(onFulfillment, onRejection, label) {
|
63483 | var parent = this;
|
63484 | var state = parent._state;
|
63485 |
|
63486 | if (state === FULFILLED && !onFulfillment || state === REJECTED && !onRejection) {
|
63487 | config.instrument && instrument('chained', parent, parent);
|
63488 | return parent;
|
63489 | }
|
63490 |
|
63491 | parent._onError = null;
|
63492 | var child = new parent.constructor(noop, label);
|
63493 | var result = parent._result;
|
63494 | config.instrument && instrument('chained', parent, child);
|
63495 |
|
63496 | if (state === PENDING) {
|
63497 | subscribe(parent, child, onFulfillment, onRejection);
|
63498 | } else {
|
63499 | var callback = state === FULFILLED ? onFulfillment : onRejection;
|
63500 | config.async(() => invokeCallback(state, child, callback, result));
|
63501 | }
|
63502 |
|
63503 | return child;
|
63504 | }
|
63505 |
|
63506 | class Enumerator {
|
63507 | constructor(Constructor, input, abortOnReject, label) {
|
63508 | this._instanceConstructor = Constructor;
|
63509 | this.promise = new Constructor(noop, label);
|
63510 | this._abortOnReject = abortOnReject;
|
63511 | this._isUsingOwnPromise = Constructor === Promise;
|
63512 | this._isUsingOwnResolve = Constructor.resolve === resolve$$1;
|
63513 |
|
63514 | this._init(...arguments);
|
63515 | }
|
63516 |
|
63517 | _init(Constructor, input) {
|
63518 | var len = input.length || 0;
|
63519 | this.length = len;
|
63520 | this._remaining = len;
|
63521 | this._result = new Array(len);
|
63522 |
|
63523 | this._enumerate(input);
|
63524 | }
|
63525 |
|
63526 | _enumerate(input) {
|
63527 | var length = this.length;
|
63528 | var promise = this.promise;
|
63529 |
|
63530 | for (var i = 0; promise._state === PENDING && i < length; i++) {
|
63531 | this._eachEntry(input[i], i, true);
|
63532 | }
|
63533 |
|
63534 | this._checkFullfillment();
|
63535 | }
|
63536 |
|
63537 | _checkFullfillment() {
|
63538 | if (this._remaining === 0) {
|
63539 | var result = this._result;
|
63540 | fulfill(this.promise, result);
|
63541 | this._result = null;
|
63542 | }
|
63543 | }
|
63544 |
|
63545 | _settleMaybeThenable(entry, i, firstPass) {
|
63546 | var c = this._instanceConstructor;
|
63547 |
|
63548 | if (this._isUsingOwnResolve) {
|
63549 | var then$$1,
|
63550 | error,
|
63551 | succeeded = true;
|
63552 |
|
63553 | try {
|
63554 | then$$1 = entry.then;
|
63555 | } catch (e) {
|
63556 | succeeded = false;
|
63557 | error = e;
|
63558 | }
|
63559 |
|
63560 | if (then$$1 === then && entry._state !== PENDING) {
|
63561 | entry._onError = null;
|
63562 |
|
63563 | this._settledAt(entry._state, i, entry._result, firstPass);
|
63564 | } else if (typeof then$$1 !== 'function') {
|
63565 | this._settledAt(FULFILLED, i, entry, firstPass);
|
63566 | } else if (this._isUsingOwnPromise) {
|
63567 | var promise = new c(noop);
|
63568 |
|
63569 | if (succeeded === false) {
|
63570 | reject(promise, error);
|
63571 | } else {
|
63572 | handleMaybeThenable(promise, entry, then$$1);
|
63573 |
|
63574 | this._willSettleAt(promise, i, firstPass);
|
63575 | }
|
63576 | } else {
|
63577 | this._willSettleAt(new c(resolve => resolve(entry)), i, firstPass);
|
63578 | }
|
63579 | } else {
|
63580 | this._willSettleAt(c.resolve(entry), i, firstPass);
|
63581 | }
|
63582 | }
|
63583 |
|
63584 | _eachEntry(entry, i, firstPass) {
|
63585 | if (entry !== null && typeof entry === 'object') {
|
63586 | this._settleMaybeThenable(entry, i, firstPass);
|
63587 | } else {
|
63588 | this._setResultAt(FULFILLED, i, entry, firstPass);
|
63589 | }
|
63590 | }
|
63591 |
|
63592 | _settledAt(state, i, value, firstPass) {
|
63593 | var promise = this.promise;
|
63594 |
|
63595 | if (promise._state === PENDING) {
|
63596 | if (this._abortOnReject && state === REJECTED) {
|
63597 | reject(promise, value);
|
63598 | } else {
|
63599 | this._setResultAt(state, i, value, firstPass);
|
63600 |
|
63601 | this._checkFullfillment();
|
63602 | }
|
63603 | }
|
63604 | }
|
63605 |
|
63606 | _setResultAt(state, i, value, firstPass) {
|
63607 | this._remaining--;
|
63608 | this._result[i] = value;
|
63609 | }
|
63610 |
|
63611 | _willSettleAt(promise, i, firstPass) {
|
63612 | subscribe(promise, undefined, value => this._settledAt(FULFILLED, i, value, firstPass), reason => this._settledAt(REJECTED, i, reason, firstPass));
|
63613 | }
|
63614 |
|
63615 | }
|
63616 |
|
63617 | function setSettledResult(state, i, value) {
|
63618 | this._remaining--;
|
63619 |
|
63620 | if (state === FULFILLED) {
|
63621 | this._result[i] = {
|
63622 | state: 'fulfilled',
|
63623 | value: value
|
63624 | };
|
63625 | } else {
|
63626 | this._result[i] = {
|
63627 | state: 'rejected',
|
63628 | reason: value
|
63629 | };
|
63630 | }
|
63631 | }
|
63632 | /**
|
63633 | `Promise.all` accepts an array of promises, and returns a new promise which
|
63634 | is fulfilled with an array of fulfillment values for the passed promises, or
|
63635 | rejected with the reason of the first passed promise to be rejected. It casts all
|
63636 | elements of the passed iterable to promises as it runs this algorithm.
|
63637 |
|
63638 | Example:
|
63639 |
|
63640 | ```javascript
|
63641 | import Promise, { resolve } from 'rsvp';
|
63642 |
|
63643 | let promise1 = resolve(1);
|
63644 | let promise2 = resolve(2);
|
63645 | let promise3 = resolve(3);
|
63646 | let promises = [ promise1, promise2, promise3 ];
|
63647 |
|
63648 | Promise.all(promises).then(function(array){
|
63649 | // The array here would be [ 1, 2, 3 ];
|
63650 | });
|
63651 | ```
|
63652 |
|
63653 | If any of the `promises` given to `RSVP.all` are rejected, the first promise
|
63654 | that is rejected will be given as an argument to the returned promises's
|
63655 | rejection handler. For example:
|
63656 |
|
63657 | Example:
|
63658 |
|
63659 | ```javascript
|
63660 | import Promise, { resolve, reject } from 'rsvp';
|
63661 |
|
63662 | let promise1 = resolve(1);
|
63663 | let promise2 = reject(new Error("2"));
|
63664 | let promise3 = reject(new Error("3"));
|
63665 | let promises = [ promise1, promise2, promise3 ];
|
63666 |
|
63667 | Promise.all(promises).then(function(array){
|
63668 | // Code here never runs because there are rejected promises!
|
63669 | }, function(error) {
|
63670 | // error.message === "2"
|
63671 | });
|
63672 | ```
|
63673 |
|
63674 | @method all
|
63675 | @for Promise
|
63676 | @param {Array} entries array of promises
|
63677 | @param {String} [label] optional string for labeling the promise.
|
63678 | Useful for tooling.
|
63679 | @return {Promise} promise that is fulfilled when all `promises` have been
|
63680 | fulfilled, or rejected if any of them become rejected.
|
63681 | @static
|
63682 | */
|
63683 |
|
63684 |
|
63685 | function all(entries, label) {
|
63686 | if (!Array.isArray(entries)) {
|
63687 | return this.reject(new TypeError("Promise.all must be called with an array"), label);
|
63688 | }
|
63689 |
|
63690 | return new Enumerator(this, entries, true
|
63691 | /* abort on reject */
|
63692 | , label).promise;
|
63693 | }
|
63694 | /**
|
63695 | `Promise.race` returns a new promise which is settled in the same way as the
|
63696 | first passed promise to settle.
|
63697 |
|
63698 | Example:
|
63699 |
|
63700 | ```javascript
|
63701 | import Promise from 'rsvp';
|
63702 |
|
63703 | let promise1 = new Promise(function(resolve, reject){
|
63704 | setTimeout(function(){
|
63705 | resolve('promise 1');
|
63706 | }, 200);
|
63707 | });
|
63708 |
|
63709 | let promise2 = new Promise(function(resolve, reject){
|
63710 | setTimeout(function(){
|
63711 | resolve('promise 2');
|
63712 | }, 100);
|
63713 | });
|
63714 |
|
63715 | Promise.race([promise1, promise2]).then(function(result){
|
63716 | // result === 'promise 2' because it was resolved before promise1
|
63717 | // was resolved.
|
63718 | });
|
63719 | ```
|
63720 |
|
63721 | `Promise.race` is deterministic in that only the state of the first
|
63722 | settled promise matters. For example, even if other promises given to the
|
63723 | `promises` array argument are resolved, but the first settled promise has
|
63724 | become rejected before the other promises became fulfilled, the returned
|
63725 | promise will become rejected:
|
63726 |
|
63727 | ```javascript
|
63728 | import Promise from 'rsvp';
|
63729 |
|
63730 | let promise1 = new Promise(function(resolve, reject){
|
63731 | setTimeout(function(){
|
63732 | resolve('promise 1');
|
63733 | }, 200);
|
63734 | });
|
63735 |
|
63736 | let promise2 = new Promise(function(resolve, reject){
|
63737 | setTimeout(function(){
|
63738 | reject(new Error('promise 2'));
|
63739 | }, 100);
|
63740 | });
|
63741 |
|
63742 | Promise.race([promise1, promise2]).then(function(result){
|
63743 | // Code here never runs
|
63744 | }, function(reason){
|
63745 | // reason.message === 'promise 2' because promise 2 became rejected before
|
63746 | // promise 1 became fulfilled
|
63747 | });
|
63748 | ```
|
63749 |
|
63750 | An example real-world use case is implementing timeouts:
|
63751 |
|
63752 | ```javascript
|
63753 | import Promise from 'rsvp';
|
63754 |
|
63755 | Promise.race([ajax('foo.json'), timeout(5000)])
|
63756 | ```
|
63757 |
|
63758 | @method race
|
63759 | @for Promise
|
63760 | @static
|
63761 | @param {Array} entries array of promises to observe
|
63762 | @param {String} [label] optional string for describing the promise returned.
|
63763 | Useful for tooling.
|
63764 | @return {Promise} a promise which settles in the same way as the first passed
|
63765 | promise to settle.
|
63766 | */
|
63767 |
|
63768 |
|
63769 | function race(entries, label) {
|
63770 | /*jshint validthis:true */
|
63771 | var Constructor = this;
|
63772 | var promise = new Constructor(noop, label);
|
63773 |
|
63774 | if (!Array.isArray(entries)) {
|
63775 | reject(promise, new TypeError('Promise.race must be called with an array'));
|
63776 | return promise;
|
63777 | }
|
63778 |
|
63779 | for (var i = 0; promise._state === PENDING && i < entries.length; i++) {
|
63780 | subscribe(Constructor.resolve(entries[i]), undefined, value => resolve$1(promise, value), reason => reject(promise, reason));
|
63781 | }
|
63782 |
|
63783 | return promise;
|
63784 | }
|
63785 | /**
|
63786 | `Promise.reject` returns a promise rejected with the passed `reason`.
|
63787 | It is shorthand for the following:
|
63788 |
|
63789 | ```javascript
|
63790 | import Promise from 'rsvp';
|
63791 |
|
63792 | let promise = new Promise(function(resolve, reject){
|
63793 | reject(new Error('WHOOPS'));
|
63794 | });
|
63795 |
|
63796 | promise.then(function(value){
|
63797 | // Code here doesn't run because the promise is rejected!
|
63798 | }, function(reason){
|
63799 | // reason.message === 'WHOOPS'
|
63800 | });
|
63801 | ```
|
63802 |
|
63803 | Instead of writing the above, your code now simply becomes the following:
|
63804 |
|
63805 | ```javascript
|
63806 | import Promise from 'rsvp';
|
63807 |
|
63808 | let promise = Promise.reject(new Error('WHOOPS'));
|
63809 |
|
63810 | promise.then(function(value){
|
63811 | // Code here doesn't run because the promise is rejected!
|
63812 | }, function(reason){
|
63813 | // reason.message === 'WHOOPS'
|
63814 | });
|
63815 | ```
|
63816 |
|
63817 | @method reject
|
63818 | @for Promise
|
63819 | @static
|
63820 | @param {*} reason value that the returned promise will be rejected with.
|
63821 | @param {String} [label] optional string for identifying the returned promise.
|
63822 | Useful for tooling.
|
63823 | @return {Promise} a promise rejected with the given `reason`.
|
63824 | */
|
63825 |
|
63826 |
|
63827 | function reject$1(reason, label) {
|
63828 | /*jshint validthis:true */
|
63829 | var Constructor = this;
|
63830 | var promise = new Constructor(noop, label);
|
63831 | reject(promise, reason);
|
63832 | return promise;
|
63833 | }
|
63834 |
|
63835 | var guidKey = 'rsvp_' + Date.now() + '-';
|
63836 | var counter = 0;
|
63837 |
|
63838 | function needsResolver() {
|
63839 | throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
|
63840 | }
|
63841 |
|
63842 | function needsNew() {
|
63843 | throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
|
63844 | }
|
63845 | /**
|
63846 | Promise objects represent the eventual result of an asynchronous operation. The
|
63847 | primary way of interacting with a promise is through its `then` method, which
|
63848 | registers callbacks to receive either a promise’s eventual value or the reason
|
63849 | why the promise cannot be fulfilled.
|
63850 |
|
63851 | Terminology
|
63852 | -----------
|
63853 |
|
63854 | - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
|
63855 | - `thenable` is an object or function that defines a `then` method.
|
63856 | - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
|
63857 | - `exception` is a value that is thrown using the throw statement.
|
63858 | - `reason` is a value that indicates why a promise was rejected.
|
63859 | - `settled` the final resting state of a promise, fulfilled or rejected.
|
63860 |
|
63861 | A promise can be in one of three states: pending, fulfilled, or rejected.
|
63862 |
|
63863 | Promises that are fulfilled have a fulfillment value and are in the fulfilled
|
63864 | state. Promises that are rejected have a rejection reason and are in the
|
63865 | rejected state. A fulfillment value is never a thenable.
|
63866 |
|
63867 | Promises can also be said to *resolve* a value. If this value is also a
|
63868 | promise, then the original promise's settled state will match the value's
|
63869 | settled state. So a promise that *resolves* a promise that rejects will
|
63870 | itself reject, and a promise that *resolves* a promise that fulfills will
|
63871 | itself fulfill.
|
63872 |
|
63873 |
|
63874 | Basic Usage:
|
63875 | ------------
|
63876 |
|
63877 | ```js
|
63878 | let promise = new Promise(function(resolve, reject) {
|
63879 | // on success
|
63880 | resolve(value);
|
63881 |
|
63882 | // on failure
|
63883 | reject(reason);
|
63884 | });
|
63885 |
|
63886 | promise.then(function(value) {
|
63887 | // on fulfillment
|
63888 | }, function(reason) {
|
63889 | // on rejection
|
63890 | });
|
63891 | ```
|
63892 |
|
63893 | Advanced Usage:
|
63894 | ---------------
|
63895 |
|
63896 | Promises shine when abstracting away asynchronous interactions such as
|
63897 | `XMLHttpRequest`s.
|
63898 |
|
63899 | ```js
|
63900 | function getJSON(url) {
|
63901 | return new Promise(function(resolve, reject){
|
63902 | let xhr = new XMLHttpRequest();
|
63903 |
|
63904 | xhr.open('GET', url);
|
63905 | xhr.onreadystatechange = handler;
|
63906 | xhr.responseType = 'json';
|
63907 | xhr.setRequestHeader('Accept', 'application/json');
|
63908 | xhr.send();
|
63909 |
|
63910 | function handler() {
|
63911 | if (this.readyState === this.DONE) {
|
63912 | if (this.status === 200) {
|
63913 | resolve(this.response);
|
63914 | } else {
|
63915 | reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
|
63916 | }
|
63917 | }
|
63918 | };
|
63919 | });
|
63920 | }
|
63921 |
|
63922 | getJSON('/posts.json').then(function(json) {
|
63923 | // on fulfillment
|
63924 | }, function(reason) {
|
63925 | // on rejection
|
63926 | });
|
63927 | ```
|
63928 |
|
63929 | Unlike callbacks, promises are great composable primitives.
|
63930 |
|
63931 | ```js
|
63932 | Promise.all([
|
63933 | getJSON('/posts'),
|
63934 | getJSON('/comments')
|
63935 | ]).then(function(values){
|
63936 | values[0] // => postsJSON
|
63937 | values[1] // => commentsJSON
|
63938 |
|
63939 | return values;
|
63940 | });
|
63941 | ```
|
63942 |
|
63943 | @class Promise
|
63944 | @public
|
63945 | @param {function} resolver
|
63946 | @param {String} [label] optional string for labeling the promise.
|
63947 | Useful for tooling.
|
63948 | @constructor
|
63949 | */
|
63950 |
|
63951 |
|
63952 | class Promise {
|
63953 | constructor(resolver, label) {
|
63954 | this._id = counter++;
|
63955 | this._label = label;
|
63956 | this._state = undefined;
|
63957 | this._result = undefined;
|
63958 | this._subscribers = [];
|
63959 | config.instrument && instrument('created', this);
|
63960 |
|
63961 | if (noop !== resolver) {
|
63962 | typeof resolver !== 'function' && needsResolver();
|
63963 | this instanceof Promise ? initializePromise(this, resolver) : needsNew();
|
63964 | }
|
63965 | }
|
63966 |
|
63967 | _onError(reason) {
|
63968 | config.after(() => {
|
63969 | if (this._onError) {
|
63970 | config.trigger('error', reason, this._label);
|
63971 | }
|
63972 | });
|
63973 | }
|
63974 | /**
|
63975 | `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
|
63976 | as the catch block of a try/catch statement.
|
63977 |
|
63978 | ```js
|
63979 | function findAuthor(){
|
63980 | throw new Error('couldn\'t find that author');
|
63981 | }
|
63982 |
|
63983 | // synchronous
|
63984 | try {
|
63985 | findAuthor();
|
63986 | } catch(reason) {
|
63987 | // something went wrong
|
63988 | }
|
63989 |
|
63990 | // async with promises
|
63991 | findAuthor().catch(function(reason){
|
63992 | // something went wrong
|
63993 | });
|
63994 | ```
|
63995 |
|
63996 | @method catch
|
63997 | @param {Function} onRejection
|
63998 | @param {String} [label] optional string for labeling the promise.
|
63999 | Useful for tooling.
|
64000 | @return {Promise}
|
64001 | */
|
64002 |
|
64003 |
|
64004 | catch(onRejection, label) {
|
64005 | return this.then(undefined, onRejection, label);
|
64006 | }
|
64007 | /**
|
64008 | `finally` will be invoked regardless of the promise's fate just as native
|
64009 | try/catch/finally behaves
|
64010 |
|
64011 | Synchronous example:
|
64012 |
|
64013 | ```js
|
64014 | findAuthor() {
|
64015 | if (Math.random() > 0.5) {
|
64016 | throw new Error();
|
64017 | }
|
64018 | return new Author();
|
64019 | }
|
64020 |
|
64021 | try {
|
64022 | return findAuthor(); // succeed or fail
|
64023 | } catch(error) {
|
64024 | return findOtherAuthor();
|
64025 | } finally {
|
64026 | // always runs
|
64027 | // doesn't affect the return value
|
64028 | }
|
64029 | ```
|
64030 |
|
64031 | Asynchronous example:
|
64032 |
|
64033 | ```js
|
64034 | findAuthor().catch(function(reason){
|
64035 | return findOtherAuthor();
|
64036 | }).finally(function(){
|
64037 | // author was either found, or not
|
64038 | });
|
64039 | ```
|
64040 |
|
64041 | @method finally
|
64042 | @param {Function} callback
|
64043 | @param {String} [label] optional string for labeling the promise.
|
64044 | Useful for tooling.
|
64045 | @return {Promise}
|
64046 | */
|
64047 |
|
64048 |
|
64049 | finally(callback, label) {
|
64050 | var promise = this;
|
64051 | var constructor = promise.constructor;
|
64052 |
|
64053 | if (typeof callback === 'function') {
|
64054 | return promise.then(value => constructor.resolve(callback()).then(() => value), reason => constructor.resolve(callback()).then(() => {
|
64055 | throw reason;
|
64056 | }));
|
64057 | }
|
64058 |
|
64059 | return promise.then(callback, callback);
|
64060 | }
|
64061 |
|
64062 | }
|
64063 |
|
64064 | _exports.Promise = Promise;
|
64065 | Promise.cast = resolve$$1; // deprecated
|
64066 |
|
64067 | Promise.all = all;
|
64068 | Promise.race = race;
|
64069 | Promise.resolve = resolve$$1;
|
64070 | Promise.reject = reject$1;
|
64071 | Promise.prototype._guidKey = guidKey;
|
64072 | /**
|
64073 | The primary way of interacting with a promise is through its `then` method,
|
64074 | which registers callbacks to receive either a promise's eventual value or the
|
64075 | reason why the promise cannot be fulfilled.
|
64076 |
|
64077 | ```js
|
64078 | findUser().then(function(user){
|
64079 | // user is available
|
64080 | }, function(reason){
|
64081 | // user is unavailable, and you are given the reason why
|
64082 | });
|
64083 | ```
|
64084 |
|
64085 | Chaining
|
64086 | --------
|
64087 |
|
64088 | The return value of `then` is itself a promise. This second, 'downstream'
|
64089 | promise is resolved with the return value of the first promise's fulfillment
|
64090 | or rejection handler, or rejected if the handler throws an exception.
|
64091 |
|
64092 | ```js
|
64093 | findUser().then(function (user) {
|
64094 | return user.name;
|
64095 | }, function (reason) {
|
64096 | return 'default name';
|
64097 | }).then(function (userName) {
|
64098 | // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
|
64099 | // will be `'default name'`
|
64100 | });
|
64101 |
|
64102 | findUser().then(function (user) {
|
64103 | throw new Error('Found user, but still unhappy');
|
64104 | }, function (reason) {
|
64105 | throw new Error('`findUser` rejected and we\'re unhappy');
|
64106 | }).then(function (value) {
|
64107 | // never reached
|
64108 | }, function (reason) {
|
64109 | // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
|
64110 | // If `findUser` rejected, `reason` will be '`findUser` rejected and we\'re unhappy'.
|
64111 | });
|
64112 | ```
|
64113 | If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
|
64114 |
|
64115 | ```js
|
64116 | findUser().then(function (user) {
|
64117 | throw new PedagogicalException('Upstream error');
|
64118 | }).then(function (value) {
|
64119 | // never reached
|
64120 | }).then(function (value) {
|
64121 | // never reached
|
64122 | }, function (reason) {
|
64123 | // The `PedgagocialException` is propagated all the way down to here
|
64124 | });
|
64125 | ```
|
64126 |
|
64127 | Assimilation
|
64128 | ------------
|
64129 |
|
64130 | Sometimes the value you want to propagate to a downstream promise can only be
|
64131 | retrieved asynchronously. This can be achieved by returning a promise in the
|
64132 | fulfillment or rejection handler. The downstream promise will then be pending
|
64133 | until the returned promise is settled. This is called *assimilation*.
|
64134 |
|
64135 | ```js
|
64136 | findUser().then(function (user) {
|
64137 | return findCommentsByAuthor(user);
|
64138 | }).then(function (comments) {
|
64139 | // The user's comments are now available
|
64140 | });
|
64141 | ```
|
64142 |
|
64143 | If the assimliated promise rejects, then the downstream promise will also reject.
|
64144 |
|
64145 | ```js
|
64146 | findUser().then(function (user) {
|
64147 | return findCommentsByAuthor(user);
|
64148 | }).then(function (comments) {
|
64149 | // If `findCommentsByAuthor` fulfills, we'll have the value here
|
64150 | }, function (reason) {
|
64151 | // If `findCommentsByAuthor` rejects, we'll have the reason here
|
64152 | });
|
64153 | ```
|
64154 |
|
64155 | Simple Example
|
64156 | --------------
|
64157 |
|
64158 | Synchronous Example
|
64159 |
|
64160 | ```javascript
|
64161 | let result;
|
64162 |
|
64163 | try {
|
64164 | result = findResult();
|
64165 | // success
|
64166 | } catch(reason) {
|
64167 | // failure
|
64168 | }
|
64169 | ```
|
64170 |
|
64171 | Errback Example
|
64172 |
|
64173 | ```js
|
64174 | findResult(function(result, err){
|
64175 | if (err) {
|
64176 | // failure
|
64177 | } else {
|
64178 | // success
|
64179 | }
|
64180 | });
|
64181 | ```
|
64182 |
|
64183 | Promise Example;
|
64184 |
|
64185 | ```javascript
|
64186 | findResult().then(function(result){
|
64187 | // success
|
64188 | }, function(reason){
|
64189 | // failure
|
64190 | });
|
64191 | ```
|
64192 |
|
64193 | Advanced Example
|
64194 | --------------
|
64195 |
|
64196 | Synchronous Example
|
64197 |
|
64198 | ```javascript
|
64199 | let author, books;
|
64200 |
|
64201 | try {
|
64202 | author = findAuthor();
|
64203 | books = findBooksByAuthor(author);
|
64204 | // success
|
64205 | } catch(reason) {
|
64206 | // failure
|
64207 | }
|
64208 | ```
|
64209 |
|
64210 | Errback Example
|
64211 |
|
64212 | ```js
|
64213 |
|
64214 | function foundBooks(books) {
|
64215 |
|
64216 | }
|
64217 |
|
64218 | function failure(reason) {
|
64219 |
|
64220 | }
|
64221 |
|
64222 | findAuthor(function(author, err){
|
64223 | if (err) {
|
64224 | failure(err);
|
64225 | // failure
|
64226 | } else {
|
64227 | try {
|
64228 | findBoooksByAuthor(author, function(books, err) {
|
64229 | if (err) {
|
64230 | failure(err);
|
64231 | } else {
|
64232 | try {
|
64233 | foundBooks(books);
|
64234 | } catch(reason) {
|
64235 | failure(reason);
|
64236 | }
|
64237 | }
|
64238 | });
|
64239 | } catch(error) {
|
64240 | failure(err);
|
64241 | }
|
64242 | // success
|
64243 | }
|
64244 | });
|
64245 | ```
|
64246 |
|
64247 | Promise Example;
|
64248 |
|
64249 | ```javascript
|
64250 | findAuthor().
|
64251 | then(findBooksByAuthor).
|
64252 | then(function(books){
|
64253 | // found books
|
64254 | }).catch(function(reason){
|
64255 | // something went wrong
|
64256 | });
|
64257 | ```
|
64258 |
|
64259 | @method then
|
64260 | @param {Function} onFulfillment
|
64261 | @param {Function} onRejection
|
64262 | @param {String} [label] optional string for labeling the promise.
|
64263 | Useful for tooling.
|
64264 | @return {Promise}
|
64265 | */
|
64266 |
|
64267 | Promise.prototype.then = then;
|
64268 |
|
64269 | function makeObject(_, argumentNames) {
|
64270 | var obj = {};
|
64271 | var length = _.length;
|
64272 | var args = new Array(length);
|
64273 |
|
64274 | for (var x = 0; x < length; x++) {
|
64275 | args[x] = _[x];
|
64276 | }
|
64277 |
|
64278 | for (var i = 0; i < argumentNames.length; i++) {
|
64279 | var name = argumentNames[i];
|
64280 | obj[name] = args[i + 1];
|
64281 | }
|
64282 |
|
64283 | return obj;
|
64284 | }
|
64285 |
|
64286 | function arrayResult(_) {
|
64287 | var length = _.length;
|
64288 | var args = new Array(length - 1);
|
64289 |
|
64290 | for (var i = 1; i < length; i++) {
|
64291 | args[i - 1] = _[i];
|
64292 | }
|
64293 |
|
64294 | return args;
|
64295 | }
|
64296 |
|
64297 | function wrapThenable(then, promise) {
|
64298 | return {
|
64299 | then(onFulFillment, onRejection) {
|
64300 | return then.call(promise, onFulFillment, onRejection);
|
64301 | }
|
64302 |
|
64303 | };
|
64304 | }
|
64305 | /**
|
64306 | `denodeify` takes a 'node-style' function and returns a function that
|
64307 | will return an `Promise`. You can use `denodeify` in Node.js or the
|
64308 | browser when you'd prefer to use promises over using callbacks. For example,
|
64309 | `denodeify` transforms the following:
|
64310 |
|
64311 | ```javascript
|
64312 | let fs = require('fs');
|
64313 |
|
64314 | fs.readFile('myfile.txt', function(err, data){
|
64315 | if (err) return handleError(err);
|
64316 | handleData(data);
|
64317 | });
|
64318 | ```
|
64319 |
|
64320 | into:
|
64321 |
|
64322 | ```javascript
|
64323 | let fs = require('fs');
|
64324 | let readFile = denodeify(fs.readFile);
|
64325 |
|
64326 | readFile('myfile.txt').then(handleData, handleError);
|
64327 | ```
|
64328 |
|
64329 | If the node function has multiple success parameters, then `denodeify`
|
64330 | just returns the first one:
|
64331 |
|
64332 | ```javascript
|
64333 | let request = denodeify(require('request'));
|
64334 |
|
64335 | request('http://example.com').then(function(res) {
|
64336 | // ...
|
64337 | });
|
64338 | ```
|
64339 |
|
64340 | However, if you need all success parameters, setting `denodeify`'s
|
64341 | second parameter to `true` causes it to return all success parameters
|
64342 | as an array:
|
64343 |
|
64344 | ```javascript
|
64345 | let request = denodeify(require('request'), true);
|
64346 |
|
64347 | request('http://example.com').then(function(result) {
|
64348 | // result[0] -> res
|
64349 | // result[1] -> body
|
64350 | });
|
64351 | ```
|
64352 |
|
64353 | Or if you pass it an array with names it returns the parameters as a hash:
|
64354 |
|
64355 | ```javascript
|
64356 | let request = denodeify(require('request'), ['res', 'body']);
|
64357 |
|
64358 | request('http://example.com').then(function(result) {
|
64359 | // result.res
|
64360 | // result.body
|
64361 | });
|
64362 | ```
|
64363 |
|
64364 | Sometimes you need to retain the `this`:
|
64365 |
|
64366 | ```javascript
|
64367 | let app = require('express')();
|
64368 | let render = denodeify(app.render.bind(app));
|
64369 | ```
|
64370 |
|
64371 | The denodified function inherits from the original function. It works in all
|
64372 | environments, except IE 10 and below. Consequently all properties of the original
|
64373 | function are available to you. However, any properties you change on the
|
64374 | denodeified function won't be changed on the original function. Example:
|
64375 |
|
64376 | ```javascript
|
64377 | let request = denodeify(require('request')),
|
64378 | cookieJar = request.jar(); // <- Inheritance is used here
|
64379 |
|
64380 | request('http://example.com', {jar: cookieJar}).then(function(res) {
|
64381 | // cookieJar.cookies holds now the cookies returned by example.com
|
64382 | });
|
64383 | ```
|
64384 |
|
64385 | Using `denodeify` makes it easier to compose asynchronous operations instead
|
64386 | of using callbacks. For example, instead of:
|
64387 |
|
64388 | ```javascript
|
64389 | let fs = require('fs');
|
64390 |
|
64391 | fs.readFile('myfile.txt', function(err, data){
|
64392 | if (err) { ... } // Handle error
|
64393 | fs.writeFile('myfile2.txt', data, function(err){
|
64394 | if (err) { ... } // Handle error
|
64395 | console.log('done')
|
64396 | });
|
64397 | });
|
64398 | ```
|
64399 |
|
64400 | you can chain the operations together using `then` from the returned promise:
|
64401 |
|
64402 | ```javascript
|
64403 | let fs = require('fs');
|
64404 | let readFile = denodeify(fs.readFile);
|
64405 | let writeFile = denodeify(fs.writeFile);
|
64406 |
|
64407 | readFile('myfile.txt').then(function(data){
|
64408 | return writeFile('myfile2.txt', data);
|
64409 | }).then(function(){
|
64410 | console.log('done')
|
64411 | }).catch(function(error){
|
64412 | // Handle error
|
64413 | });
|
64414 | ```
|
64415 |
|
64416 | @method denodeify
|
64417 | @public
|
64418 | @static
|
64419 | @for rsvp
|
64420 | @param {Function} nodeFunc a 'node-style' function that takes a callback as
|
64421 | its last argument. The callback expects an error to be passed as its first
|
64422 | argument (if an error occurred, otherwise null), and the value from the
|
64423 | operation as its second argument ('function(err, value){ }').
|
64424 | @param {Boolean|Array} [options] An optional paramter that if set
|
64425 | to `true` causes the promise to fulfill with the callback's success arguments
|
64426 | as an array. This is useful if the node function has multiple success
|
64427 | paramters. If you set this paramter to an array with names, the promise will
|
64428 | fulfill with a hash with these names as keys and the success parameters as
|
64429 | values.
|
64430 | @return {Function} a function that wraps `nodeFunc` to return a `Promise`
|
64431 | */
|
64432 |
|
64433 |
|
64434 | function denodeify(nodeFunc, options) {
|
64435 | var fn = function () {
|
64436 | var l = arguments.length;
|
64437 | var args = new Array(l + 1);
|
64438 | var promiseInput = false;
|
64439 |
|
64440 | for (var i = 0; i < l; ++i) {
|
64441 | var arg = arguments[i]; // TODO: this code really needs to be cleaned up
|
64442 |
|
64443 | if (!promiseInput) {
|
64444 | if (arg !== null && typeof arg === 'object') {
|
64445 | if (arg.constructor === Promise) {
|
64446 | promiseInput = true;
|
64447 | } else {
|
64448 | try {
|
64449 | promiseInput = arg.then;
|
64450 | } catch (error) {
|
64451 | var p = new Promise(noop);
|
64452 | reject(p, error);
|
64453 | return p;
|
64454 | }
|
64455 | }
|
64456 | } else {
|
64457 | promiseInput = false;
|
64458 | }
|
64459 |
|
64460 | if (promiseInput && promiseInput !== true) {
|
64461 | arg = wrapThenable(promiseInput, arg);
|
64462 | }
|
64463 | }
|
64464 |
|
64465 | args[i] = arg;
|
64466 | }
|
64467 |
|
64468 | var promise = new Promise(noop);
|
64469 |
|
64470 | args[l] = function (err, val) {
|
64471 | if (err) {
|
64472 | reject(promise, err);
|
64473 | } else if (options === undefined) {
|
64474 | resolve$1(promise, val);
|
64475 | } else if (options === true) {
|
64476 | resolve$1(promise, arrayResult(arguments));
|
64477 | } else if (Array.isArray(options)) {
|
64478 | resolve$1(promise, makeObject(arguments, options));
|
64479 | } else {
|
64480 | resolve$1(promise, val);
|
64481 | }
|
64482 | };
|
64483 |
|
64484 | if (promiseInput) {
|
64485 | return handlePromiseInput(promise, args, nodeFunc, this);
|
64486 | } else {
|
64487 | return handleValueInput(promise, args, nodeFunc, this);
|
64488 | }
|
64489 | };
|
64490 |
|
64491 | fn.__proto__ = nodeFunc;
|
64492 | return fn;
|
64493 | }
|
64494 |
|
64495 | function handleValueInput(promise, args, nodeFunc, self) {
|
64496 | try {
|
64497 | nodeFunc.apply(self, args);
|
64498 | } catch (error) {
|
64499 | reject(promise, error);
|
64500 | }
|
64501 |
|
64502 | return promise;
|
64503 | }
|
64504 |
|
64505 | function handlePromiseInput(promise, args, nodeFunc, self) {
|
64506 | return Promise.all(args).then(args => handleValueInput(promise, args, nodeFunc, self));
|
64507 | }
|
64508 | /**
|
64509 | This is a convenient alias for `Promise.all`.
|
64510 |
|
64511 | @method all
|
64512 | @public
|
64513 | @static
|
64514 | @for rsvp
|
64515 | @param {Array} array Array of promises.
|
64516 | @param {String} [label] An optional label. This is useful
|
64517 | for tooling.
|
64518 | */
|
64519 |
|
64520 |
|
64521 | function all$1(array, label) {
|
64522 | return Promise.all(array, label);
|
64523 | }
|
64524 | /**
|
64525 | @module rsvp
|
64526 | @public
|
64527 | **/
|
64528 |
|
64529 |
|
64530 | class AllSettled extends Enumerator {
|
64531 | constructor(Constructor, entries, label) {
|
64532 | super(Constructor, entries, false
|
64533 | /* don't abort on reject */
|
64534 | , label);
|
64535 | }
|
64536 |
|
64537 | }
|
64538 |
|
64539 | AllSettled.prototype._setResultAt = setSettledResult;
|
64540 | /**
|
64541 | `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing
|
64542 | a fail-fast method, it waits until all the promises have returned and
|
64543 | shows you all the results. This is useful if you want to handle multiple
|
64544 | promises' failure states together as a set.
|
64545 | Returns a promise that is fulfilled when all the given promises have been
|
64546 | settled. The return promise is fulfilled with an array of the states of
|
64547 | the promises passed into the `promises` array argument.
|
64548 | Each state object will either indicate fulfillment or rejection, and
|
64549 | provide the corresponding value or reason. The states will take one of
|
64550 | the following formats:
|
64551 | ```javascript
|
64552 | { state: 'fulfilled', value: value }
|
64553 | or
|
64554 | { state: 'rejected', reason: reason }
|
64555 | ```
|
64556 | Example:
|
64557 | ```javascript
|
64558 | let promise1 = RSVP.Promise.resolve(1);
|
64559 | let promise2 = RSVP.Promise.reject(new Error('2'));
|
64560 | let promise3 = RSVP.Promise.reject(new Error('3'));
|
64561 | let promises = [ promise1, promise2, promise3 ];
|
64562 | RSVP.allSettled(promises).then(function(array){
|
64563 | // array == [
|
64564 | // { state: 'fulfilled', value: 1 },
|
64565 | // { state: 'rejected', reason: Error },
|
64566 | // { state: 'rejected', reason: Error }
|
64567 | // ]
|
64568 | // Note that for the second item, reason.message will be '2', and for the
|
64569 | // third item, reason.message will be '3'.
|
64570 | }, function(error) {
|
64571 | // Not run. (This block would only be called if allSettled had failed,
|
64572 | // for instance if passed an incorrect argument type.)
|
64573 | });
|
64574 | ```
|
64575 | @method allSettled
|
64576 | @public
|
64577 | @static
|
64578 | @for rsvp
|
64579 | @param {Array} entries
|
64580 | @param {String} [label] - optional string that describes the promise.
|
64581 | Useful for tooling.
|
64582 | @return {Promise} promise that is fulfilled with an array of the settled
|
64583 | states of the constituent promises.
|
64584 | */
|
64585 |
|
64586 | function allSettled(entries, label) {
|
64587 | if (!Array.isArray(entries)) {
|
64588 | return Promise.reject(new TypeError("Promise.allSettled must be called with an array"), label);
|
64589 | }
|
64590 |
|
64591 | return new AllSettled(Promise, entries, label).promise;
|
64592 | }
|
64593 | /**
|
64594 | This is a convenient alias for `Promise.race`.
|
64595 |
|
64596 | @method race
|
64597 | @public
|
64598 | @static
|
64599 | @for rsvp
|
64600 | @param {Array} array Array of promises.
|
64601 | @param {String} [label] An optional label. This is useful
|
64602 | for tooling.
|
64603 | */
|
64604 |
|
64605 |
|
64606 | function race$1(array, label) {
|
64607 | return Promise.race(array, label);
|
64608 | }
|
64609 |
|
64610 | class PromiseHash extends Enumerator {
|
64611 | constructor(Constructor, object, abortOnReject = true, label) {
|
64612 | super(Constructor, object, abortOnReject, label);
|
64613 | }
|
64614 |
|
64615 | _init(Constructor, object) {
|
64616 | this._result = {};
|
64617 |
|
64618 | this._enumerate(object);
|
64619 | }
|
64620 |
|
64621 | _enumerate(input) {
|
64622 | var keys = Object.keys(input);
|
64623 | var length = keys.length;
|
64624 | var promise = this.promise;
|
64625 | this._remaining = length;
|
64626 | var key, val;
|
64627 |
|
64628 | for (var i = 0; promise._state === PENDING && i < length; i++) {
|
64629 | key = keys[i];
|
64630 | val = input[key];
|
64631 |
|
64632 | this._eachEntry(val, key, true);
|
64633 | }
|
64634 |
|
64635 | this._checkFullfillment();
|
64636 | }
|
64637 |
|
64638 | }
|
64639 | /**
|
64640 | `hash` is similar to `all`, but takes an object instead of an array
|
64641 | for its `promises` argument.
|
64642 |
|
64643 | Returns a promise that is fulfilled when all the given promises have been
|
64644 | fulfilled, or rejected if any of them become rejected. The returned promise
|
64645 | is fulfilled with a hash that has the same key names as the `promises` object
|
64646 | argument. If any of the values in the object are not promises, they will
|
64647 | simply be copied over to the fulfilled object.
|
64648 |
|
64649 | Example:
|
64650 |
|
64651 | ```javascript
|
64652 | let promises = {
|
64653 | myPromise: resolve(1),
|
64654 | yourPromise: resolve(2),
|
64655 | theirPromise: resolve(3),
|
64656 | notAPromise: 4
|
64657 | };
|
64658 |
|
64659 | hash(promises).then(function(hash){
|
64660 | // hash here is an object that looks like:
|
64661 | // {
|
64662 | // myPromise: 1,
|
64663 | // yourPromise: 2,
|
64664 | // theirPromise: 3,
|
64665 | // notAPromise: 4
|
64666 | // }
|
64667 | });
|
64668 | ```
|
64669 |
|
64670 | If any of the `promises` given to `hash` are rejected, the first promise
|
64671 | that is rejected will be given as the reason to the rejection handler.
|
64672 |
|
64673 | Example:
|
64674 |
|
64675 | ```javascript
|
64676 | let promises = {
|
64677 | myPromise: resolve(1),
|
64678 | rejectedPromise: reject(new Error('rejectedPromise')),
|
64679 | anotherRejectedPromise: reject(new Error('anotherRejectedPromise')),
|
64680 | };
|
64681 |
|
64682 | hash(promises).then(function(hash){
|
64683 | // Code here never runs because there are rejected promises!
|
64684 | }, function(reason) {
|
64685 | // reason.message === 'rejectedPromise'
|
64686 | });
|
64687 | ```
|
64688 |
|
64689 | An important note: `hash` is intended for plain JavaScript objects that
|
64690 | are just a set of keys and values. `hash` will NOT preserve prototype
|
64691 | chains.
|
64692 |
|
64693 | Example:
|
64694 |
|
64695 | ```javascript
|
64696 | import { hash, resolve } from 'rsvp';
|
64697 | function MyConstructor(){
|
64698 | this.example = resolve('Example');
|
64699 | }
|
64700 |
|
64701 | MyConstructor.prototype = {
|
64702 | protoProperty: resolve('Proto Property')
|
64703 | };
|
64704 |
|
64705 | let myObject = new MyConstructor();
|
64706 |
|
64707 | hash(myObject).then(function(hash){
|
64708 | // protoProperty will not be present, instead you will just have an
|
64709 | // object that looks like:
|
64710 | // {
|
64711 | // example: 'Example'
|
64712 | // }
|
64713 | //
|
64714 | // hash.hasOwnProperty('protoProperty'); // false
|
64715 | // 'undefined' === typeof hash.protoProperty
|
64716 | });
|
64717 | ```
|
64718 |
|
64719 | @method hash
|
64720 | @public
|
64721 | @static
|
64722 | @for rsvp
|
64723 | @param {Object} object
|
64724 | @param {String} [label] optional string that describes the promise.
|
64725 | Useful for tooling.
|
64726 | @return {Promise} promise that is fulfilled when all properties of `promises`
|
64727 | have been fulfilled, or rejected if any of them become rejected.
|
64728 | */
|
64729 |
|
64730 |
|
64731 | function hash(object, label) {
|
64732 | return Promise.resolve(object, label).then(function (object) {
|
64733 | if (object === null || typeof object !== 'object') {
|
64734 | throw new TypeError("Promise.hash must be called with an object");
|
64735 | }
|
64736 |
|
64737 | return new PromiseHash(Promise, object, label).promise;
|
64738 | });
|
64739 | }
|
64740 |
|
64741 | class HashSettled extends PromiseHash {
|
64742 | constructor(Constructor, object, label) {
|
64743 | super(Constructor, object, false, label);
|
64744 | }
|
64745 |
|
64746 | }
|
64747 |
|
64748 | HashSettled.prototype._setResultAt = setSettledResult;
|
64749 | /**
|
64750 | `hashSettled` is similar to `allSettled`, but takes an object
|
64751 | instead of an array for its `promises` argument.
|
64752 |
|
64753 | Unlike `all` or `hash`, which implement a fail-fast method,
|
64754 | but like `allSettled`, `hashSettled` waits until all the
|
64755 | constituent promises have returned and then shows you all the results
|
64756 | with their states and values/reasons. This is useful if you want to
|
64757 | handle multiple promises' failure states together as a set.
|
64758 |
|
64759 | Returns a promise that is fulfilled when all the given promises have been
|
64760 | settled, or rejected if the passed parameters are invalid.
|
64761 |
|
64762 | The returned promise is fulfilled with a hash that has the same key names as
|
64763 | the `promises` object argument. If any of the values in the object are not
|
64764 | promises, they will be copied over to the fulfilled object and marked with state
|
64765 | 'fulfilled'.
|
64766 |
|
64767 | Example:
|
64768 |
|
64769 | ```javascript
|
64770 | import { hashSettled, resolve } from 'rsvp';
|
64771 |
|
64772 | let promises = {
|
64773 | myPromise: resolve(1),
|
64774 | yourPromise: resolve(2),
|
64775 | theirPromise: resolve(3),
|
64776 | notAPromise: 4
|
64777 | };
|
64778 |
|
64779 | hashSettled(promises).then(function(hash){
|
64780 | // hash here is an object that looks like:
|
64781 | // {
|
64782 | // myPromise: { state: 'fulfilled', value: 1 },
|
64783 | // yourPromise: { state: 'fulfilled', value: 2 },
|
64784 | // theirPromise: { state: 'fulfilled', value: 3 },
|
64785 | // notAPromise: { state: 'fulfilled', value: 4 }
|
64786 | // }
|
64787 | });
|
64788 | ```
|
64789 |
|
64790 | If any of the `promises` given to `hash` are rejected, the state will
|
64791 | be set to 'rejected' and the reason for rejection provided.
|
64792 |
|
64793 | Example:
|
64794 |
|
64795 | ```javascript
|
64796 | import { hashSettled, reject, resolve } from 'rsvp';
|
64797 |
|
64798 | let promises = {
|
64799 | myPromise: resolve(1),
|
64800 | rejectedPromise: reject(new Error('rejection')),
|
64801 | anotherRejectedPromise: reject(new Error('more rejection')),
|
64802 | };
|
64803 |
|
64804 | hashSettled(promises).then(function(hash){
|
64805 | // hash here is an object that looks like:
|
64806 | // {
|
64807 | // myPromise: { state: 'fulfilled', value: 1 },
|
64808 | // rejectedPromise: { state: 'rejected', reason: Error },
|
64809 | // anotherRejectedPromise: { state: 'rejected', reason: Error },
|
64810 | // }
|
64811 | // Note that for rejectedPromise, reason.message == 'rejection',
|
64812 | // and for anotherRejectedPromise, reason.message == 'more rejection'.
|
64813 | });
|
64814 | ```
|
64815 |
|
64816 | An important note: `hashSettled` is intended for plain JavaScript objects that
|
64817 | are just a set of keys and values. `hashSettled` will NOT preserve prototype
|
64818 | chains.
|
64819 |
|
64820 | Example:
|
64821 |
|
64822 | ```javascript
|
64823 | import Promise, { hashSettled, resolve } from 'rsvp';
|
64824 |
|
64825 | function MyConstructor(){
|
64826 | this.example = resolve('Example');
|
64827 | }
|
64828 |
|
64829 | MyConstructor.prototype = {
|
64830 | protoProperty: Promise.resolve('Proto Property')
|
64831 | };
|
64832 |
|
64833 | let myObject = new MyConstructor();
|
64834 |
|
64835 | hashSettled(myObject).then(function(hash){
|
64836 | // protoProperty will not be present, instead you will just have an
|
64837 | // object that looks like:
|
64838 | // {
|
64839 | // example: { state: 'fulfilled', value: 'Example' }
|
64840 | // }
|
64841 | //
|
64842 | // hash.hasOwnProperty('protoProperty'); // false
|
64843 | // 'undefined' === typeof hash.protoProperty
|
64844 | });
|
64845 | ```
|
64846 |
|
64847 | @method hashSettled
|
64848 | @public
|
64849 | @for rsvp
|
64850 | @param {Object} object
|
64851 | @param {String} [label] optional string that describes the promise.
|
64852 | Useful for tooling.
|
64853 | @return {Promise} promise that is fulfilled when when all properties of `promises`
|
64854 | have been settled.
|
64855 | @static
|
64856 | */
|
64857 |
|
64858 | function hashSettled(object, label) {
|
64859 | return Promise.resolve(object, label).then(function (object) {
|
64860 | if (object === null || typeof object !== 'object') {
|
64861 | throw new TypeError("hashSettled must be called with an object");
|
64862 | }
|
64863 |
|
64864 | return new HashSettled(Promise, object, false, label).promise;
|
64865 | });
|
64866 | }
|
64867 | /**
|
64868 | `rethrow` will rethrow an error on the next turn of the JavaScript event
|
64869 | loop in order to aid debugging.
|
64870 |
|
64871 | Promises A+ specifies that any exceptions that occur with a promise must be
|
64872 | caught by the promises implementation and bubbled to the last handler. For
|
64873 | this reason, it is recommended that you always specify a second rejection
|
64874 | handler function to `then`. However, `rethrow` will throw the exception
|
64875 | outside of the promise, so it bubbles up to your console if in the browser,
|
64876 | or domain/cause uncaught exception in Node. `rethrow` will also throw the
|
64877 | error again so the error can be handled by the promise per the spec.
|
64878 |
|
64879 | ```javascript
|
64880 | import { rethrow } from 'rsvp';
|
64881 |
|
64882 | function throws(){
|
64883 | throw new Error('Whoops!');
|
64884 | }
|
64885 |
|
64886 | let promise = new Promise(function(resolve, reject){
|
64887 | throws();
|
64888 | });
|
64889 |
|
64890 | promise.catch(rethrow).then(function(){
|
64891 | // Code here doesn't run because the promise became rejected due to an
|
64892 | // error!
|
64893 | }, function (err){
|
64894 | // handle the error here
|
64895 | });
|
64896 | ```
|
64897 |
|
64898 | The 'Whoops' error will be thrown on the next turn of the event loop
|
64899 | and you can watch for it in your console. You can also handle it using a
|
64900 | rejection handler given to `.then` or `.catch` on the returned promise.
|
64901 |
|
64902 | @method rethrow
|
64903 | @public
|
64904 | @static
|
64905 | @for rsvp
|
64906 | @param {Error} reason reason the promise became rejected.
|
64907 | @throws Error
|
64908 | @static
|
64909 | */
|
64910 |
|
64911 |
|
64912 | function rethrow(reason) {
|
64913 | setTimeout(() => {
|
64914 | throw reason;
|
64915 | });
|
64916 | throw reason;
|
64917 | }
|
64918 | /**
|
64919 | `defer` returns an object similar to jQuery's `$.Deferred`.
|
64920 | `defer` should be used when porting over code reliant on `$.Deferred`'s
|
64921 | interface. New code should use the `Promise` constructor instead.
|
64922 |
|
64923 | The object returned from `defer` is a plain object with three properties:
|
64924 |
|
64925 | * promise - an `Promise`.
|
64926 | * reject - a function that causes the `promise` property on this object to
|
64927 | become rejected
|
64928 | * resolve - a function that causes the `promise` property on this object to
|
64929 | become fulfilled.
|
64930 |
|
64931 | Example:
|
64932 |
|
64933 | ```javascript
|
64934 | let deferred = defer();
|
64935 |
|
64936 | deferred.resolve("Success!");
|
64937 |
|
64938 | deferred.promise.then(function(value){
|
64939 | // value here is "Success!"
|
64940 | });
|
64941 | ```
|
64942 |
|
64943 | @method defer
|
64944 | @public
|
64945 | @static
|
64946 | @for rsvp
|
64947 | @param {String} [label] optional string for labeling the promise.
|
64948 | Useful for tooling.
|
64949 | @return {Object}
|
64950 | */
|
64951 |
|
64952 |
|
64953 | function defer(label) {
|
64954 | var deferred = {
|
64955 | resolve: undefined,
|
64956 | reject: undefined
|
64957 | };
|
64958 | deferred.promise = new Promise((resolve, reject) => {
|
64959 | deferred.resolve = resolve;
|
64960 | deferred.reject = reject;
|
64961 | }, label);
|
64962 | return deferred;
|
64963 | }
|
64964 |
|
64965 | class MapEnumerator extends Enumerator {
|
64966 | constructor(Constructor, entries, mapFn, label) {
|
64967 | super(Constructor, entries, true, label, mapFn);
|
64968 | }
|
64969 |
|
64970 | _init(Constructor, input, bool, label, mapFn) {
|
64971 | var len = input.length || 0;
|
64972 | this.length = len;
|
64973 | this._remaining = len;
|
64974 | this._result = new Array(len);
|
64975 | this._mapFn = mapFn;
|
64976 |
|
64977 | this._enumerate(input);
|
64978 | }
|
64979 |
|
64980 | _setResultAt(state, i, value, firstPass) {
|
64981 | if (firstPass) {
|
64982 | try {
|
64983 | this._eachEntry(this._mapFn(value, i), i, false);
|
64984 | } catch (error) {
|
64985 | this._settledAt(REJECTED, i, error, false);
|
64986 | }
|
64987 | } else {
|
64988 | this._remaining--;
|
64989 | this._result[i] = value;
|
64990 | }
|
64991 | }
|
64992 |
|
64993 | }
|
64994 | /**
|
64995 | `map` is similar to JavaScript's native `map` method. `mapFn` is eagerly called
|
64996 | meaning that as soon as any promise resolves its value will be passed to `mapFn`.
|
64997 | `map` returns a promise that will become fulfilled with the result of running
|
64998 | `mapFn` on the values the promises become fulfilled with.
|
64999 |
|
65000 | For example:
|
65001 |
|
65002 | ```javascript
|
65003 | import { map, resolve } from 'rsvp';
|
65004 |
|
65005 | let promise1 = resolve(1);
|
65006 | let promise2 = resolve(2);
|
65007 | let promise3 = resolve(3);
|
65008 | let promises = [ promise1, promise2, promise3 ];
|
65009 |
|
65010 | let mapFn = function(item){
|
65011 | return item + 1;
|
65012 | };
|
65013 |
|
65014 | map(promises, mapFn).then(function(result){
|
65015 | // result is [ 2, 3, 4 ]
|
65016 | });
|
65017 | ```
|
65018 |
|
65019 | If any of the `promises` given to `map` are rejected, the first promise
|
65020 | that is rejected will be given as an argument to the returned promise's
|
65021 | rejection handler. For example:
|
65022 |
|
65023 | ```javascript
|
65024 | import { map, reject, resolve } from 'rsvp';
|
65025 |
|
65026 | let promise1 = resolve(1);
|
65027 | let promise2 = reject(new Error('2'));
|
65028 | let promise3 = reject(new Error('3'));
|
65029 | let promises = [ promise1, promise2, promise3 ];
|
65030 |
|
65031 | let mapFn = function(item){
|
65032 | return item + 1;
|
65033 | };
|
65034 |
|
65035 | map(promises, mapFn).then(function(array){
|
65036 | // Code here never runs because there are rejected promises!
|
65037 | }, function(reason) {
|
65038 | // reason.message === '2'
|
65039 | });
|
65040 | ```
|
65041 |
|
65042 | `map` will also wait if a promise is returned from `mapFn`. For example,
|
65043 | say you want to get all comments from a set of blog posts, but you need
|
65044 | the blog posts first because they contain a url to those comments.
|
65045 |
|
65046 | ```javscript
|
65047 | import { map } from 'rsvp';
|
65048 |
|
65049 | let mapFn = function(blogPost){
|
65050 | // getComments does some ajax and returns an Promise that is fulfilled
|
65051 | // with some comments data
|
65052 | return getComments(blogPost.comments_url);
|
65053 | };
|
65054 |
|
65055 | // getBlogPosts does some ajax and returns an Promise that is fulfilled
|
65056 | // with some blog post data
|
65057 | map(getBlogPosts(), mapFn).then(function(comments){
|
65058 | // comments is the result of asking the server for the comments
|
65059 | // of all blog posts returned from getBlogPosts()
|
65060 | });
|
65061 | ```
|
65062 |
|
65063 | @method map
|
65064 | @public
|
65065 | @static
|
65066 | @for rsvp
|
65067 | @param {Array} promises
|
65068 | @param {Function} mapFn function to be called on each fulfilled promise.
|
65069 | @param {String} [label] optional string for labeling the promise.
|
65070 | Useful for tooling.
|
65071 | @return {Promise} promise that is fulfilled with the result of calling
|
65072 | `mapFn` on each fulfilled promise or value when they become fulfilled.
|
65073 | The promise will be rejected if any of the given `promises` become rejected.
|
65074 | */
|
65075 |
|
65076 |
|
65077 | function map(promises, mapFn, label) {
|
65078 | if (typeof mapFn !== 'function') {
|
65079 | return Promise.reject(new TypeError("map expects a function as a second argument"), label);
|
65080 | }
|
65081 |
|
65082 | return Promise.resolve(promises, label).then(function (promises) {
|
65083 | if (!Array.isArray(promises)) {
|
65084 | throw new TypeError("map must be called with an array");
|
65085 | }
|
65086 |
|
65087 | return new MapEnumerator(Promise, promises, mapFn, label).promise;
|
65088 | });
|
65089 | }
|
65090 | /**
|
65091 | This is a convenient alias for `Promise.resolve`.
|
65092 |
|
65093 | @method resolve
|
65094 | @public
|
65095 | @static
|
65096 | @for rsvp
|
65097 | @param {*} value value that the returned promise will be resolved with
|
65098 | @param {String} [label] optional string for identifying the returned promise.
|
65099 | Useful for tooling.
|
65100 | @return {Promise} a promise that will become fulfilled with the given
|
65101 | `value`
|
65102 | */
|
65103 |
|
65104 |
|
65105 | function resolve$2(value, label) {
|
65106 | return Promise.resolve(value, label);
|
65107 | }
|
65108 | /**
|
65109 | This is a convenient alias for `Promise.reject`.
|
65110 |
|
65111 | @method reject
|
65112 | @public
|
65113 | @static
|
65114 | @for rsvp
|
65115 | @param {*} reason value that the returned promise will be rejected with.
|
65116 | @param {String} [label] optional string for identifying the returned promise.
|
65117 | Useful for tooling.
|
65118 | @return {Promise} a promise rejected with the given `reason`.
|
65119 | */
|
65120 |
|
65121 |
|
65122 | function reject$2(reason, label) {
|
65123 | return Promise.reject(reason, label);
|
65124 | }
|
65125 |
|
65126 | var EMPTY_OBJECT = {};
|
65127 |
|
65128 | class FilterEnumerator extends MapEnumerator {
|
65129 | _checkFullfillment() {
|
65130 | if (this._remaining === 0 && this._result !== null) {
|
65131 | var result = this._result.filter(val => val !== EMPTY_OBJECT);
|
65132 |
|
65133 | fulfill(this.promise, result);
|
65134 | this._result = null;
|
65135 | }
|
65136 | }
|
65137 |
|
65138 | _setResultAt(state, i, value, firstPass) {
|
65139 | if (firstPass) {
|
65140 | this._result[i] = value;
|
65141 | var val,
|
65142 | succeeded = true;
|
65143 |
|
65144 | try {
|
65145 | val = this._mapFn(value, i);
|
65146 | } catch (error) {
|
65147 | succeeded = false;
|
65148 |
|
65149 | this._settledAt(REJECTED, i, error, false);
|
65150 | }
|
65151 |
|
65152 | if (succeeded) {
|
65153 | this._eachEntry(val, i, false);
|
65154 | }
|
65155 | } else {
|
65156 | this._remaining--;
|
65157 |
|
65158 | if (!value) {
|
65159 | this._result[i] = EMPTY_OBJECT;
|
65160 | }
|
65161 | }
|
65162 | }
|
65163 |
|
65164 | }
|
65165 | /**
|
65166 | `filter` is similar to JavaScript's native `filter` method.
|
65167 | `filterFn` is eagerly called meaning that as soon as any promise
|
65168 | resolves its value will be passed to `filterFn`. `filter` returns
|
65169 | a promise that will become fulfilled with the result of running
|
65170 | `filterFn` on the values the promises become fulfilled with.
|
65171 |
|
65172 | For example:
|
65173 |
|
65174 | ```javascript
|
65175 | import { filter, resolve } from 'rsvp';
|
65176 |
|
65177 | let promise1 = resolve(1);
|
65178 | let promise2 = resolve(2);
|
65179 | let promise3 = resolve(3);
|
65180 |
|
65181 | let promises = [promise1, promise2, promise3];
|
65182 |
|
65183 | let filterFn = function(item){
|
65184 | return item > 1;
|
65185 | };
|
65186 |
|
65187 | filter(promises, filterFn).then(function(result){
|
65188 | // result is [ 2, 3 ]
|
65189 | });
|
65190 | ```
|
65191 |
|
65192 | If any of the `promises` given to `filter` are rejected, the first promise
|
65193 | that is rejected will be given as an argument to the returned promise's
|
65194 | rejection handler. For example:
|
65195 |
|
65196 | ```javascript
|
65197 | import { filter, reject, resolve } from 'rsvp';
|
65198 |
|
65199 | let promise1 = resolve(1);
|
65200 | let promise2 = reject(new Error('2'));
|
65201 | let promise3 = reject(new Error('3'));
|
65202 | let promises = [ promise1, promise2, promise3 ];
|
65203 |
|
65204 | let filterFn = function(item){
|
65205 | return item > 1;
|
65206 | };
|
65207 |
|
65208 | filter(promises, filterFn).then(function(array){
|
65209 | // Code here never runs because there are rejected promises!
|
65210 | }, function(reason) {
|
65211 | // reason.message === '2'
|
65212 | });
|
65213 | ```
|
65214 |
|
65215 | `filter` will also wait for any promises returned from `filterFn`.
|
65216 | For instance, you may want to fetch a list of users then return a subset
|
65217 | of those users based on some asynchronous operation:
|
65218 |
|
65219 | ```javascript
|
65220 | import { filter, resolve } from 'rsvp';
|
65221 |
|
65222 | let alice = { name: 'alice' };
|
65223 | let bob = { name: 'bob' };
|
65224 | let users = [ alice, bob ];
|
65225 |
|
65226 | let promises = users.map(function(user){
|
65227 | return resolve(user);
|
65228 | });
|
65229 |
|
65230 | let filterFn = function(user){
|
65231 | // Here, Alice has permissions to create a blog post, but Bob does not.
|
65232 | return getPrivilegesForUser(user).then(function(privs){
|
65233 | return privs.can_create_blog_post === true;
|
65234 | });
|
65235 | };
|
65236 | filter(promises, filterFn).then(function(users){
|
65237 | // true, because the server told us only Alice can create a blog post.
|
65238 | users.length === 1;
|
65239 | // false, because Alice is the only user present in `users`
|
65240 | users[0] === bob;
|
65241 | });
|
65242 | ```
|
65243 |
|
65244 | @method filter
|
65245 | @public
|
65246 | @static
|
65247 | @for rsvp
|
65248 | @param {Array} promises
|
65249 | @param {Function} filterFn - function to be called on each resolved value to
|
65250 | filter the final results.
|
65251 | @param {String} [label] optional string describing the promise. Useful for
|
65252 | tooling.
|
65253 | @return {Promise}
|
65254 | */
|
65255 |
|
65256 |
|
65257 | function filter(promises, filterFn, label) {
|
65258 | if (typeof filterFn !== 'function') {
|
65259 | return Promise.reject(new TypeError("filter expects function as a second argument"), label);
|
65260 | }
|
65261 |
|
65262 | return Promise.resolve(promises, label).then(function (promises) {
|
65263 | if (!Array.isArray(promises)) {
|
65264 | throw new TypeError("filter must be called with an array");
|
65265 | }
|
65266 |
|
65267 | return new FilterEnumerator(Promise, promises, filterFn, label).promise;
|
65268 | });
|
65269 | }
|
65270 |
|
65271 | var len = 0;
|
65272 | var vertxNext;
|
65273 |
|
65274 | function asap(callback, arg) {
|
65275 | queue$1[len] = callback;
|
65276 | queue$1[len + 1] = arg;
|
65277 | len += 2;
|
65278 |
|
65279 | if (len === 2) {
|
65280 | // If len is 1, that means that we need to schedule an async flush.
|
65281 | // If additional callbacks are queued before the queue is flushed, they
|
65282 | // will be processed by this flush that we are scheduling.
|
65283 | scheduleFlush$1();
|
65284 | }
|
65285 | }
|
65286 |
|
65287 | var browserWindow = typeof window !== 'undefined' ? window : undefined;
|
65288 | var browserGlobal = browserWindow || {};
|
65289 | var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
|
65290 | var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; // test for web worker but not in IE10
|
65291 |
|
65292 | var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; // node
|
65293 |
|
65294 | function useNextTick() {
|
65295 | var nextTick = process.nextTick; // node version 0.10.x displays a deprecation warning when nextTick is used recursively
|
65296 | // setImmediate should be used instead instead
|
65297 |
|
65298 | var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
|
65299 |
|
65300 | if (Array.isArray(version) && version[1] === '0' && version[2] === '10') {
|
65301 | nextTick = setImmediate;
|
65302 | }
|
65303 |
|
65304 | return () => nextTick(flush);
|
65305 | } // vertx
|
65306 |
|
65307 |
|
65308 | function useVertxTimer() {
|
65309 | if (typeof vertxNext !== 'undefined') {
|
65310 | return function () {
|
65311 | vertxNext(flush);
|
65312 | };
|
65313 | }
|
65314 |
|
65315 | return useSetTimeout();
|
65316 | }
|
65317 |
|
65318 | function useMutationObserver() {
|
65319 | var iterations = 0;
|
65320 | var observer = new BrowserMutationObserver(flush);
|
65321 | var node = document.createTextNode('');
|
65322 | observer.observe(node, {
|
65323 | characterData: true
|
65324 | });
|
65325 | return () => node.data = iterations = ++iterations % 2;
|
65326 | } // web worker
|
65327 |
|
65328 |
|
65329 | function useMessageChannel() {
|
65330 | var channel = new MessageChannel();
|
65331 | channel.port1.onmessage = flush;
|
65332 | return () => channel.port2.postMessage(0);
|
65333 | }
|
65334 |
|
65335 | function useSetTimeout() {
|
65336 | return () => setTimeout(flush, 1);
|
65337 | }
|
65338 |
|
65339 | var queue$1 = new Array(1000);
|
65340 |
|
65341 | function flush() {
|
65342 | for (var i = 0; i < len; i += 2) {
|
65343 | var callback = queue$1[i];
|
65344 | var arg = queue$1[i + 1];
|
65345 | callback(arg);
|
65346 | queue$1[i] = undefined;
|
65347 | queue$1[i + 1] = undefined;
|
65348 | }
|
65349 |
|
65350 | len = 0;
|
65351 | }
|
65352 |
|
65353 | function attemptVertex() {
|
65354 | try {
|
65355 | var vertx = Function('return this')().require('vertx');
|
65356 |
|
65357 | vertxNext = vertx.runOnLoop || vertx.runOnContext;
|
65358 | return useVertxTimer();
|
65359 | } catch (e) {
|
65360 | return useSetTimeout();
|
65361 | }
|
65362 | }
|
65363 |
|
65364 | var scheduleFlush$1; // Decide what async method to use to triggering processing of queued callbacks:
|
65365 |
|
65366 | if (isNode) {
|
65367 | scheduleFlush$1 = useNextTick();
|
65368 | } else if (BrowserMutationObserver) {
|
65369 | scheduleFlush$1 = useMutationObserver();
|
65370 | } else if (isWorker) {
|
65371 | scheduleFlush$1 = useMessageChannel();
|
65372 | } else if (browserWindow === undefined && typeof require === 'function') {
|
65373 | scheduleFlush$1 = attemptVertex();
|
65374 | } else {
|
65375 | scheduleFlush$1 = useSetTimeout();
|
65376 | } // defaults
|
65377 |
|
65378 |
|
65379 | config.async = asap;
|
65380 |
|
65381 | config.after = cb => setTimeout(cb, 0);
|
65382 |
|
65383 | var cast = resolve$2;
|
65384 | _exports.cast = cast;
|
65385 |
|
65386 | var async = (callback, arg) => config.async(callback, arg);
|
65387 |
|
65388 | _exports.async = async;
|
65389 |
|
65390 | function on() {
|
65391 | config.on(...arguments);
|
65392 | }
|
65393 |
|
65394 | function off() {
|
65395 | config.off(...arguments);
|
65396 | } // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__`
|
65397 |
|
65398 |
|
65399 | if (typeof window !== 'undefined' && typeof window['__PROMISE_INSTRUMENTATION__'] === 'object') {
|
65400 | var callbacks = window['__PROMISE_INSTRUMENTATION__'];
|
65401 | configure('instrument', true);
|
65402 |
|
65403 | for (var eventName in callbacks) {
|
65404 | if (callbacks.hasOwnProperty(eventName)) {
|
65405 | on(eventName, callbacks[eventName]);
|
65406 | }
|
65407 | }
|
65408 | } // the default export here is for backwards compat:
|
65409 | // https://github.com/tildeio/rsvp.js/issues/434
|
65410 |
|
65411 |
|
65412 | var rsvp = {
|
65413 | asap,
|
65414 | cast,
|
65415 | Promise,
|
65416 | EventTarget,
|
65417 | all: all$1,
|
65418 | allSettled,
|
65419 | race: race$1,
|
65420 | hash,
|
65421 | hashSettled,
|
65422 | rethrow,
|
65423 | defer,
|
65424 | denodeify,
|
65425 | configure,
|
65426 | on,
|
65427 | off,
|
65428 | resolve: resolve$2,
|
65429 | reject: reject$2,
|
65430 | map,
|
65431 | async,
|
65432 | filter
|
65433 | };
|
65434 | var _default = rsvp;
|
65435 | _exports.default = _default;
|
65436 | });
|
65437 | require('ember');
|
65438 | }());
|
65439 | //# sourceMappingURL=ember.map
|