@everymatrix/player-elevate-card 1.31.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/cjs/general-styling-wrapper_5.cjs.entry.js +3162 -0
  2. package/dist/cjs/index-234565f1.js +1645 -0
  3. package/dist/cjs/index.cjs.js +2 -0
  4. package/dist/cjs/loader.cjs.js +21 -0
  5. package/dist/cjs/player-elevate-card.cjs.js +19 -0
  6. package/dist/collection/collection-manifest.json +22 -0
  7. package/dist/collection/components/player-elevate-card/player-elevate-card-items.js +43 -0
  8. package/dist/collection/components/player-elevate-card/player-elevate-card.css +65 -0
  9. package/dist/collection/components/player-elevate-card/player-elevate-card.js +282 -0
  10. package/dist/collection/components/player-elevate-card-data/player-elevate-card-data.css +189 -0
  11. package/dist/collection/components/player-elevate-card-data/player-elevate-card-data.js +208 -0
  12. package/dist/collection/components/player-elevate-loyaltycard/player-elevate-loyaltycard.css +68 -0
  13. package/dist/collection/components/player-elevate-loyaltycard/player-elevate-loyaltycard.js +287 -0
  14. package/dist/collection/components/player-elevate-pointcard/player-elevate-pointcard.css +70 -0
  15. package/dist/collection/components/player-elevate-pointcard/player-elevate-pointcard.js +323 -0
  16. package/dist/collection/components/static/button-default.svg +42 -0
  17. package/dist/collection/components/static/button-disabled.svg +4 -0
  18. package/dist/collection/components/static/button-hover.svg +4 -0
  19. package/dist/collection/components/static/button-level.svg +27 -0
  20. package/dist/collection/components/static/button-pressed.svg +18 -0
  21. package/dist/collection/components/static/button-redeem.svg +36 -0
  22. package/dist/collection/components/static/card-ground-over.png +0 -0
  23. package/dist/collection/components/static/card-ground-over.svg +903 -0
  24. package/dist/collection/components/static/card-ground.png +0 -0
  25. package/dist/collection/components/static/card-ground.svg +34 -0
  26. package/dist/collection/components/static/info.svg +4 -0
  27. package/dist/collection/components/static/level-badge.png +0 -0
  28. package/dist/collection/components/static/level-percent.svg +80 -0
  29. package/dist/collection/components/static/tips-info.svg +21 -0
  30. package/dist/collection/components/static/user.svg +3 -0
  31. package/dist/collection/index.js +1 -0
  32. package/dist/collection/models/player-elevate.js +1 -0
  33. package/dist/collection/utils/locale.utils.js +144 -0
  34. package/dist/collection/utils/utils.js +47 -0
  35. package/dist/components/general-styling-wrapper.js +6 -0
  36. package/dist/components/general-styling-wrapper2.js +103 -0
  37. package/dist/components/index.d.ts +26 -0
  38. package/dist/components/index.js +1 -0
  39. package/dist/components/player-elevate-card-data.d.ts +11 -0
  40. package/dist/components/player-elevate-card-data.js +6 -0
  41. package/dist/components/player-elevate-card-data2.js +624 -0
  42. package/dist/components/player-elevate-card-items.js +2250 -0
  43. package/dist/components/player-elevate-card.d.ts +11 -0
  44. package/dist/components/player-elevate-card.js +118 -0
  45. package/dist/components/player-elevate-loyaltycard.d.ts +11 -0
  46. package/dist/components/player-elevate-loyaltycard.js +124 -0
  47. package/dist/components/player-elevate-pointcard.d.ts +11 -0
  48. package/dist/components/player-elevate-pointcard.js +127 -0
  49. package/dist/components/static/button-default.svg +42 -0
  50. package/dist/components/static/button-disabled.svg +4 -0
  51. package/dist/components/static/button-hover.svg +4 -0
  52. package/dist/components/static/button-level.svg +27 -0
  53. package/dist/components/static/button-pressed.svg +18 -0
  54. package/dist/components/static/button-redeem.svg +36 -0
  55. package/dist/components/static/card-ground-over.png +0 -0
  56. package/dist/components/static/card-ground-over.svg +903 -0
  57. package/dist/components/static/card-ground.png +0 -0
  58. package/dist/components/static/card-ground.svg +34 -0
  59. package/dist/components/static/info.svg +4 -0
  60. package/dist/components/static/level-badge.png +0 -0
  61. package/dist/components/static/level-percent.svg +80 -0
  62. package/dist/components/static/tips-info.svg +21 -0
  63. package/dist/components/static/user.svg +3 -0
  64. package/dist/esm/general-styling-wrapper_5.entry.js +3154 -0
  65. package/dist/esm/index-747197fd.js +1616 -0
  66. package/dist/esm/index.js +1 -0
  67. package/dist/esm/loader.js +17 -0
  68. package/dist/esm/player-elevate-card.js +17 -0
  69. package/dist/esm/polyfills/core-js.js +11 -0
  70. package/dist/esm/polyfills/css-shim.js +1 -0
  71. package/dist/esm/polyfills/dom.js +79 -0
  72. package/dist/esm/polyfills/es5-html-element.js +1 -0
  73. package/dist/esm/polyfills/index.js +34 -0
  74. package/dist/esm/polyfills/system.js +6 -0
  75. package/dist/index.cjs.js +1 -0
  76. package/dist/index.js +1 -0
  77. package/dist/player-elevate-card/index.esm.js +0 -0
  78. package/dist/player-elevate-card/p-56620f7c.entry.js +1 -0
  79. package/dist/player-elevate-card/p-afe7b72e.js +1 -0
  80. package/dist/player-elevate-card/player-elevate-card.esm.js +1 -0
  81. package/dist/static/button-default.svg +42 -0
  82. package/dist/static/button-disabled.svg +4 -0
  83. package/dist/static/button-hover.svg +4 -0
  84. package/dist/static/button-level.svg +27 -0
  85. package/dist/static/button-pressed.svg +18 -0
  86. package/dist/static/button-redeem.svg +36 -0
  87. package/dist/static/card-ground-over.png +0 -0
  88. package/dist/static/card-ground-over.svg +903 -0
  89. package/dist/static/card-ground.png +0 -0
  90. package/dist/static/card-ground.svg +34 -0
  91. package/dist/static/info.svg +4 -0
  92. package/dist/static/level-badge.png +0 -0
  93. package/dist/static/level-percent.svg +80 -0
  94. package/dist/static/tips-info.svg +21 -0
  95. package/dist/static/user.svg +3 -0
  96. package/dist/stencil.config.js +32 -0
  97. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/player-elevate-card/.stencil/packages/player-elevate-card/stencil.config.d.ts +2 -0
  98. package/dist/types/components/player-elevate-card/player-elevate-card-items.d.ts +19 -0
  99. package/dist/types/components/player-elevate-card/player-elevate-card.d.ts +53 -0
  100. package/dist/types/components/player-elevate-card-data/player-elevate-card-data.d.ts +22 -0
  101. package/dist/types/components/player-elevate-loyaltycard/player-elevate-loyaltycard.d.ts +53 -0
  102. package/dist/types/components/player-elevate-pointcard/player-elevate-pointcard.d.ts +66 -0
  103. package/dist/types/components.d.ts +335 -0
  104. package/dist/types/index.d.ts +1 -0
  105. package/dist/types/models/player-elevate.d.ts +40 -0
  106. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  107. package/dist/types/utils/locale.utils.d.ts +15 -0
  108. package/dist/types/utils/utils.d.ts +1 -0
  109. package/loader/cdn.js +3 -0
  110. package/loader/index.cjs.js +3 -0
  111. package/loader/index.d.ts +12 -0
  112. package/loader/index.es2017.js +3 -0
  113. package/loader/index.js +4 -0
  114. package/loader/package.json +10 -0
  115. package/package.json +24 -0
@@ -0,0 +1,1645 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () {
13
+ return e[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n['default'] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ const NAMESPACE = 'player-elevate-card';
24
+
25
+ let scopeId;
26
+ let contentRef;
27
+ let hostTagName;
28
+ let useNativeShadowDom = false;
29
+ let checkSlotFallbackVisibility = false;
30
+ let checkSlotRelocate = false;
31
+ let isSvgMode = false;
32
+ let queuePending = false;
33
+ const win = typeof window !== 'undefined' ? window : {};
34
+ const doc = win.document || { head: {} };
35
+ const plt = {
36
+ $flags$: 0,
37
+ $resourcesUrl$: '',
38
+ jmp: (h) => h(),
39
+ raf: (h) => requestAnimationFrame(h),
40
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
41
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
42
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
43
+ };
44
+ const promiseResolve = (v) => Promise.resolve(v);
45
+ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
46
+ try {
47
+ new CSSStyleSheet();
48
+ return typeof new CSSStyleSheet().replace === 'function';
49
+ }
50
+ catch (e) { }
51
+ return false;
52
+ })()
53
+ ;
54
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
55
+ if (listeners) {
56
+ listeners.map(([flags, name, method]) => {
57
+ const target = getHostListenerTarget(elm, flags) ;
58
+ const handler = hostListenerProxy(hostRef, method);
59
+ const opts = hostListenerOpts(flags);
60
+ plt.ael(target, name, handler, opts);
61
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
62
+ });
63
+ }
64
+ };
65
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
66
+ try {
67
+ {
68
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
69
+ // instance is ready, let's call it's member method for this event
70
+ hostRef.$lazyInstance$[methodName](ev);
71
+ }
72
+ else {
73
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
74
+ }
75
+ }
76
+ }
77
+ catch (e) {
78
+ consoleError(e);
79
+ }
80
+ };
81
+ const getHostListenerTarget = (elm, flags) => {
82
+ if (flags & 8 /* TargetWindow */)
83
+ return win;
84
+ return elm;
85
+ };
86
+ // prettier-ignore
87
+ const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
88
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
89
+ const createTime = (fnName, tagName = '') => {
90
+ {
91
+ return () => {
92
+ return;
93
+ };
94
+ }
95
+ };
96
+ const uniqueTime = (key, measureText) => {
97
+ {
98
+ return () => {
99
+ return;
100
+ };
101
+ }
102
+ };
103
+ const rootAppliedStyles = new WeakMap();
104
+ const registerStyle = (scopeId, cssText, allowCS) => {
105
+ let style = styles.get(scopeId);
106
+ if (supportsConstructibleStylesheets && allowCS) {
107
+ style = (style || new CSSStyleSheet());
108
+ style.replace(cssText);
109
+ }
110
+ else {
111
+ style = cssText;
112
+ }
113
+ styles.set(scopeId, style);
114
+ };
115
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
116
+ let scopeId = getScopeId(cmpMeta);
117
+ let style = styles.get(scopeId);
118
+ // if an element is NOT connected then getRootNode() will return the wrong root node
119
+ // so the fallback is to always use the document for the root node in those cases
120
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
121
+ if (style) {
122
+ if (typeof style === 'string') {
123
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
124
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
125
+ let styleElm;
126
+ if (!appliedStyles) {
127
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
128
+ }
129
+ if (!appliedStyles.has(scopeId)) {
130
+ {
131
+ {
132
+ styleElm = doc.createElement('style');
133
+ styleElm.innerHTML = style;
134
+ }
135
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
136
+ }
137
+ if (appliedStyles) {
138
+ appliedStyles.add(scopeId);
139
+ }
140
+ }
141
+ }
142
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
143
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
144
+ }
145
+ }
146
+ return scopeId;
147
+ };
148
+ const attachStyles = (hostRef) => {
149
+ const cmpMeta = hostRef.$cmpMeta$;
150
+ const elm = hostRef.$hostElement$;
151
+ const flags = cmpMeta.$flags$;
152
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
153
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
154
+ if (flags & 10 /* needsScopedEncapsulation */) {
155
+ // only required when we're NOT using native shadow dom (slot)
156
+ // or this browser doesn't support native shadow dom
157
+ // and this host element was NOT created with SSR
158
+ // let's pick out the inner content for slot projection
159
+ // create a node to represent where the original
160
+ // content was first placed, which is useful later on
161
+ // DOM WRITE!!
162
+ elm['s-sc'] = scopeId;
163
+ elm.classList.add(scopeId + '-h');
164
+ }
165
+ endAttachStyles();
166
+ };
167
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
168
+ /**
169
+ * Default style mode id
170
+ */
171
+ /**
172
+ * Reusable empty obj/array
173
+ * Don't add values to these!!
174
+ */
175
+ const EMPTY_OBJ = {};
176
+ const isDef = (v) => v != null;
177
+ const isComplexType = (o) => {
178
+ // https://jsperf.com/typeof-fn-object/5
179
+ o = typeof o;
180
+ return o === 'object' || o === 'function';
181
+ };
182
+ /**
183
+ * Production h() function based on Preact by
184
+ * Jason Miller (@developit)
185
+ * Licensed under the MIT License
186
+ * https://github.com/developit/preact/blob/master/LICENSE
187
+ *
188
+ * Modified for Stencil's compiler and vdom
189
+ */
190
+ // const stack: any[] = [];
191
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
192
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
193
+ const h = (nodeName, vnodeData, ...children) => {
194
+ let child = null;
195
+ let slotName = null;
196
+ let simple = false;
197
+ let lastSimple = false;
198
+ let vNodeChildren = [];
199
+ const walk = (c) => {
200
+ for (let i = 0; i < c.length; i++) {
201
+ child = c[i];
202
+ if (Array.isArray(child)) {
203
+ walk(child);
204
+ }
205
+ else if (child != null && typeof child !== 'boolean') {
206
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
207
+ child = String(child);
208
+ }
209
+ if (simple && lastSimple) {
210
+ // If the previous child was simple (string), we merge both
211
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
212
+ }
213
+ else {
214
+ // Append a new vNode, if it's text, we create a text vNode
215
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
216
+ }
217
+ lastSimple = simple;
218
+ }
219
+ }
220
+ };
221
+ walk(children);
222
+ if (vnodeData) {
223
+ if (vnodeData.name) {
224
+ slotName = vnodeData.name;
225
+ }
226
+ {
227
+ const classData = vnodeData.className || vnodeData.class;
228
+ if (classData) {
229
+ vnodeData.class =
230
+ typeof classData !== 'object'
231
+ ? classData
232
+ : Object.keys(classData)
233
+ .filter((k) => classData[k])
234
+ .join(' ');
235
+ }
236
+ }
237
+ }
238
+ if (typeof nodeName === 'function') {
239
+ // nodeName is a functional component
240
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
241
+ }
242
+ const vnode = newVNode(nodeName, null);
243
+ vnode.$attrs$ = vnodeData;
244
+ if (vNodeChildren.length > 0) {
245
+ vnode.$children$ = vNodeChildren;
246
+ }
247
+ {
248
+ vnode.$name$ = slotName;
249
+ }
250
+ return vnode;
251
+ };
252
+ const newVNode = (tag, text) => {
253
+ const vnode = {
254
+ $flags$: 0,
255
+ $tag$: tag,
256
+ $text$: text,
257
+ $elm$: null,
258
+ $children$: null,
259
+ };
260
+ {
261
+ vnode.$attrs$ = null;
262
+ }
263
+ {
264
+ vnode.$name$ = null;
265
+ }
266
+ return vnode;
267
+ };
268
+ const Host = {};
269
+ const isHost = (node) => node && node.$tag$ === Host;
270
+ const vdomFnUtils = {
271
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
272
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
273
+ };
274
+ const convertToPublic = (node) => ({
275
+ vattrs: node.$attrs$,
276
+ vchildren: node.$children$,
277
+ vkey: node.$key$,
278
+ vname: node.$name$,
279
+ vtag: node.$tag$,
280
+ vtext: node.$text$,
281
+ });
282
+ const convertToPrivate = (node) => {
283
+ if (typeof node.vtag === 'function') {
284
+ const vnodeData = Object.assign({}, node.vattrs);
285
+ if (node.vkey) {
286
+ vnodeData.key = node.vkey;
287
+ }
288
+ if (node.vname) {
289
+ vnodeData.name = node.vname;
290
+ }
291
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
292
+ }
293
+ const vnode = newVNode(node.vtag, node.vtext);
294
+ vnode.$attrs$ = node.vattrs;
295
+ vnode.$children$ = node.vchildren;
296
+ vnode.$key$ = node.vkey;
297
+ vnode.$name$ = node.vname;
298
+ return vnode;
299
+ };
300
+ /**
301
+ * Production setAccessor() function based on Preact by
302
+ * Jason Miller (@developit)
303
+ * Licensed under the MIT License
304
+ * https://github.com/developit/preact/blob/master/LICENSE
305
+ *
306
+ * Modified for Stencil's compiler and vdom
307
+ */
308
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
309
+ if (oldValue !== newValue) {
310
+ let isProp = isMemberInElement(elm, memberName);
311
+ let ln = memberName.toLowerCase();
312
+ if (memberName === 'class') {
313
+ const classList = elm.classList;
314
+ const oldClasses = parseClassList(oldValue);
315
+ const newClasses = parseClassList(newValue);
316
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
317
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
318
+ }
319
+ else if (memberName === 'style') {
320
+ // update style attribute, css properties and values
321
+ {
322
+ for (const prop in oldValue) {
323
+ if (!newValue || newValue[prop] == null) {
324
+ if (prop.includes('-')) {
325
+ elm.style.removeProperty(prop);
326
+ }
327
+ else {
328
+ elm.style[prop] = '';
329
+ }
330
+ }
331
+ }
332
+ }
333
+ for (const prop in newValue) {
334
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
335
+ if (prop.includes('-')) {
336
+ elm.style.setProperty(prop, newValue[prop]);
337
+ }
338
+ else {
339
+ elm.style[prop] = newValue[prop];
340
+ }
341
+ }
342
+ }
343
+ }
344
+ else if ((!isProp ) &&
345
+ memberName[0] === 'o' &&
346
+ memberName[1] === 'n') {
347
+ // Event Handlers
348
+ // so if the member name starts with "on" and the 3rd characters is
349
+ // a capital letter, and it's not already a member on the element,
350
+ // then we're assuming it's an event listener
351
+ if (memberName[2] === '-') {
352
+ // on- prefixed events
353
+ // allows to be explicit about the dom event to listen without any magic
354
+ // under the hood:
355
+ // <my-cmp on-click> // listens for "click"
356
+ // <my-cmp on-Click> // listens for "Click"
357
+ // <my-cmp on-ionChange> // listens for "ionChange"
358
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
359
+ memberName = memberName.slice(3);
360
+ }
361
+ else if (isMemberInElement(win, ln)) {
362
+ // standard event
363
+ // the JSX attribute could have been "onMouseOver" and the
364
+ // member name "onmouseover" is on the window's prototype
365
+ // so let's add the listener "mouseover", which is all lowercased
366
+ memberName = ln.slice(2);
367
+ }
368
+ else {
369
+ // custom event
370
+ // the JSX attribute could have been "onMyCustomEvent"
371
+ // so let's trim off the "on" prefix and lowercase the first character
372
+ // and add the listener "myCustomEvent"
373
+ // except for the first character, we keep the event name case
374
+ memberName = ln[2] + memberName.slice(3);
375
+ }
376
+ if (oldValue) {
377
+ plt.rel(elm, memberName, oldValue, false);
378
+ }
379
+ if (newValue) {
380
+ plt.ael(elm, memberName, newValue, false);
381
+ }
382
+ }
383
+ else {
384
+ // Set property if it exists and it's not a SVG
385
+ const isComplex = isComplexType(newValue);
386
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
387
+ try {
388
+ if (!elm.tagName.includes('-')) {
389
+ let n = newValue == null ? '' : newValue;
390
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
391
+ if (memberName === 'list') {
392
+ isProp = false;
393
+ }
394
+ else if (oldValue == null || elm[memberName] != n) {
395
+ elm[memberName] = n;
396
+ }
397
+ }
398
+ else {
399
+ elm[memberName] = newValue;
400
+ }
401
+ }
402
+ catch (e) { }
403
+ }
404
+ if (newValue == null || newValue === false) {
405
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
406
+ {
407
+ elm.removeAttribute(memberName);
408
+ }
409
+ }
410
+ }
411
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
412
+ newValue = newValue === true ? '' : newValue;
413
+ {
414
+ elm.setAttribute(memberName, newValue);
415
+ }
416
+ }
417
+ }
418
+ }
419
+ };
420
+ const parseClassListRegex = /\s/;
421
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
422
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
423
+ // if the element passed in is a shadow root, which is a document fragment
424
+ // then we want to be adding attrs/props to the shadow root's "host" element
425
+ // if it's not a shadow root, then we add attrs/props to the same element
426
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
427
+ ? newVnode.$elm$.host
428
+ : newVnode.$elm$;
429
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
430
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
431
+ {
432
+ // remove attributes no longer present on the vnode by setting them to undefined
433
+ for (memberName in oldVnodeAttrs) {
434
+ if (!(memberName in newVnodeAttrs)) {
435
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
436
+ }
437
+ }
438
+ }
439
+ // add new & update changed attributes
440
+ for (memberName in newVnodeAttrs) {
441
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
442
+ }
443
+ };
444
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
445
+ // tslint:disable-next-line: prefer-const
446
+ let newVNode = newParentVNode.$children$[childIndex];
447
+ let i = 0;
448
+ let elm;
449
+ let childNode;
450
+ let oldVNode;
451
+ if (!useNativeShadowDom) {
452
+ // remember for later we need to check to relocate nodes
453
+ checkSlotRelocate = true;
454
+ if (newVNode.$tag$ === 'slot') {
455
+ if (scopeId) {
456
+ // scoped css needs to add its scoped id to the parent element
457
+ parentElm.classList.add(scopeId + '-s');
458
+ }
459
+ newVNode.$flags$ |= newVNode.$children$
460
+ ? // slot element has fallback content
461
+ 2 /* isSlotFallback */
462
+ : // slot element does not have fallback content
463
+ 1 /* isSlotReference */;
464
+ }
465
+ }
466
+ if (newVNode.$text$ !== null) {
467
+ // create text node
468
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
469
+ }
470
+ else if (newVNode.$flags$ & 1 /* isSlotReference */) {
471
+ // create a slot reference node
472
+ elm = newVNode.$elm$ =
473
+ doc.createTextNode('');
474
+ }
475
+ else {
476
+ // create element
477
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
478
+ ? 'slot-fb'
479
+ : newVNode.$tag$));
480
+ // add css classes, attrs, props, listeners, etc.
481
+ {
482
+ updateElement(null, newVNode, isSvgMode);
483
+ }
484
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
485
+ // if there is a scopeId and this is the initial render
486
+ // then let's add the scopeId as a css class
487
+ elm.classList.add((elm['s-si'] = scopeId));
488
+ }
489
+ if (newVNode.$children$) {
490
+ for (i = 0; i < newVNode.$children$.length; ++i) {
491
+ // create the node
492
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
493
+ // return node could have been null
494
+ if (childNode) {
495
+ // append our new node
496
+ elm.appendChild(childNode);
497
+ }
498
+ }
499
+ }
500
+ }
501
+ {
502
+ elm['s-hn'] = hostTagName;
503
+ if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
504
+ // remember the content reference comment
505
+ elm['s-sr'] = true;
506
+ // remember the content reference comment
507
+ elm['s-cr'] = contentRef;
508
+ // remember the slot name, or empty string for default slot
509
+ elm['s-sn'] = newVNode.$name$ || '';
510
+ // check if we've got an old vnode for this slot
511
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
512
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
513
+ // we've got an old slot vnode and the wrapper is being replaced
514
+ // so let's move the old slot content back to it's original location
515
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
516
+ }
517
+ }
518
+ }
519
+ return elm;
520
+ };
521
+ const putBackInOriginalLocation = (parentElm, recursive) => {
522
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
523
+ const oldSlotChildNodes = parentElm.childNodes;
524
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
525
+ const childNode = oldSlotChildNodes[i];
526
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
527
+ // // this child node in the old element is from another component
528
+ // // remove this node from the old slot's parent
529
+ // childNode.remove();
530
+ // and relocate it back to it's original location
531
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
532
+ // remove the old original location comment entirely
533
+ // later on the patch function will know what to do
534
+ // and move this to the correct spot in need be
535
+ childNode['s-ol'].remove();
536
+ childNode['s-ol'] = undefined;
537
+ checkSlotRelocate = true;
538
+ }
539
+ if (recursive) {
540
+ putBackInOriginalLocation(childNode, recursive);
541
+ }
542
+ }
543
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
544
+ };
545
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
546
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
547
+ let childNode;
548
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
549
+ containerElm = containerElm.shadowRoot;
550
+ }
551
+ for (; startIdx <= endIdx; ++startIdx) {
552
+ if (vnodes[startIdx]) {
553
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
554
+ if (childNode) {
555
+ vnodes[startIdx].$elm$ = childNode;
556
+ containerElm.insertBefore(childNode, referenceNode(before) );
557
+ }
558
+ }
559
+ }
560
+ };
561
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
562
+ for (; startIdx <= endIdx; ++startIdx) {
563
+ if ((vnode = vnodes[startIdx])) {
564
+ elm = vnode.$elm$;
565
+ {
566
+ // we're removing this element
567
+ // so it's possible we need to show slot fallback content now
568
+ checkSlotFallbackVisibility = true;
569
+ if (elm['s-ol']) {
570
+ // remove the original location comment
571
+ elm['s-ol'].remove();
572
+ }
573
+ else {
574
+ // it's possible that child nodes of the node
575
+ // that's being removed are slot nodes
576
+ putBackInOriginalLocation(elm, true);
577
+ }
578
+ }
579
+ // remove the vnode's element from the dom
580
+ elm.remove();
581
+ }
582
+ }
583
+ };
584
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
585
+ let oldStartIdx = 0;
586
+ let newStartIdx = 0;
587
+ let oldEndIdx = oldCh.length - 1;
588
+ let oldStartVnode = oldCh[0];
589
+ let oldEndVnode = oldCh[oldEndIdx];
590
+ let newEndIdx = newCh.length - 1;
591
+ let newStartVnode = newCh[0];
592
+ let newEndVnode = newCh[newEndIdx];
593
+ let node;
594
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
595
+ if (oldStartVnode == null) {
596
+ // Vnode might have been moved left
597
+ oldStartVnode = oldCh[++oldStartIdx];
598
+ }
599
+ else if (oldEndVnode == null) {
600
+ oldEndVnode = oldCh[--oldEndIdx];
601
+ }
602
+ else if (newStartVnode == null) {
603
+ newStartVnode = newCh[++newStartIdx];
604
+ }
605
+ else if (newEndVnode == null) {
606
+ newEndVnode = newCh[--newEndIdx];
607
+ }
608
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
609
+ patch(oldStartVnode, newStartVnode);
610
+ oldStartVnode = oldCh[++oldStartIdx];
611
+ newStartVnode = newCh[++newStartIdx];
612
+ }
613
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
614
+ patch(oldEndVnode, newEndVnode);
615
+ oldEndVnode = oldCh[--oldEndIdx];
616
+ newEndVnode = newCh[--newEndIdx];
617
+ }
618
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
619
+ // Vnode moved right
620
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
621
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
622
+ }
623
+ patch(oldStartVnode, newEndVnode);
624
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
625
+ oldStartVnode = oldCh[++oldStartIdx];
626
+ newEndVnode = newCh[--newEndIdx];
627
+ }
628
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
629
+ // Vnode moved left
630
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
631
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
632
+ }
633
+ patch(oldEndVnode, newStartVnode);
634
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
635
+ oldEndVnode = oldCh[--oldEndIdx];
636
+ newStartVnode = newCh[++newStartIdx];
637
+ }
638
+ else {
639
+ {
640
+ // new element
641
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
642
+ newStartVnode = newCh[++newStartIdx];
643
+ }
644
+ if (node) {
645
+ {
646
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
647
+ }
648
+ }
649
+ }
650
+ }
651
+ if (oldStartIdx > oldEndIdx) {
652
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
653
+ }
654
+ else if (newStartIdx > newEndIdx) {
655
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
656
+ }
657
+ };
658
+ const isSameVnode = (vnode1, vnode2) => {
659
+ // compare if two vnode to see if they're "technically" the same
660
+ // need to have the same element tag, and same key to be the same
661
+ if (vnode1.$tag$ === vnode2.$tag$) {
662
+ if (vnode1.$tag$ === 'slot') {
663
+ return vnode1.$name$ === vnode2.$name$;
664
+ }
665
+ return true;
666
+ }
667
+ return false;
668
+ };
669
+ const referenceNode = (node) => {
670
+ // this node was relocated to a new location in the dom
671
+ // because of some other component's slot
672
+ // but we still have an html comment in place of where
673
+ // it's original location was according to it's original vdom
674
+ return (node && node['s-ol']) || node;
675
+ };
676
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
677
+ const patch = (oldVNode, newVNode) => {
678
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
679
+ const oldChildren = oldVNode.$children$;
680
+ const newChildren = newVNode.$children$;
681
+ const tag = newVNode.$tag$;
682
+ const text = newVNode.$text$;
683
+ let defaultHolder;
684
+ if (text === null) {
685
+ // element node
686
+ {
687
+ if (tag === 'slot')
688
+ ;
689
+ else {
690
+ // either this is the first render of an element OR it's an update
691
+ // AND we already know it's possible it could have changed
692
+ // this updates the element's css classes, attrs, props, listeners, etc.
693
+ updateElement(oldVNode, newVNode, isSvgMode);
694
+ }
695
+ }
696
+ if (oldChildren !== null && newChildren !== null) {
697
+ // looks like there's child vnodes for both the old and new vnodes
698
+ updateChildren(elm, oldChildren, newVNode, newChildren);
699
+ }
700
+ else if (newChildren !== null) {
701
+ // no old child vnodes, but there are new child vnodes to add
702
+ if (oldVNode.$text$ !== null) {
703
+ // the old vnode was text, so be sure to clear it out
704
+ elm.textContent = '';
705
+ }
706
+ // add the new vnode children
707
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
708
+ }
709
+ else if (oldChildren !== null) {
710
+ // no new child vnodes, but there are old child vnodes to remove
711
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
712
+ }
713
+ }
714
+ else if ((defaultHolder = elm['s-cr'])) {
715
+ // this element has slotted content
716
+ defaultHolder.parentNode.textContent = text;
717
+ }
718
+ else if (oldVNode.$text$ !== text) {
719
+ // update the text content for the text only vnode
720
+ // and also only if the text is different than before
721
+ elm.data = text;
722
+ }
723
+ };
724
+ const updateFallbackSlotVisibility = (elm) => {
725
+ // tslint:disable-next-line: prefer-const
726
+ let childNodes = elm.childNodes;
727
+ let childNode;
728
+ let i;
729
+ let ilen;
730
+ let j;
731
+ let slotNameAttr;
732
+ let nodeType;
733
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
734
+ childNode = childNodes[i];
735
+ if (childNode.nodeType === 1 /* ElementNode */) {
736
+ if (childNode['s-sr']) {
737
+ // this is a slot fallback node
738
+ // get the slot name for this slot reference node
739
+ slotNameAttr = childNode['s-sn'];
740
+ // by default always show a fallback slot node
741
+ // then hide it if there are other slots in the light dom
742
+ childNode.hidden = false;
743
+ for (j = 0; j < ilen; j++) {
744
+ nodeType = childNodes[j].nodeType;
745
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
746
+ // this sibling node is from a different component OR is a named fallback slot node
747
+ if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
748
+ childNode.hidden = true;
749
+ break;
750
+ }
751
+ }
752
+ else {
753
+ // this is a default fallback slot node
754
+ // any element or text node (with content)
755
+ // should hide the default fallback slot node
756
+ if (nodeType === 1 /* ElementNode */ ||
757
+ (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
758
+ childNode.hidden = true;
759
+ break;
760
+ }
761
+ }
762
+ }
763
+ }
764
+ // keep drilling down
765
+ updateFallbackSlotVisibility(childNode);
766
+ }
767
+ }
768
+ };
769
+ const relocateNodes = [];
770
+ const relocateSlotContent = (elm) => {
771
+ // tslint:disable-next-line: prefer-const
772
+ let childNode;
773
+ let node;
774
+ let hostContentNodes;
775
+ let slotNameAttr;
776
+ let relocateNodeData;
777
+ let j;
778
+ let i = 0;
779
+ let childNodes = elm.childNodes;
780
+ let ilen = childNodes.length;
781
+ for (; i < ilen; i++) {
782
+ childNode = childNodes[i];
783
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
784
+ // first got the content reference comment node
785
+ // then we got it's parent, which is where all the host content is in now
786
+ hostContentNodes = node.parentNode.childNodes;
787
+ slotNameAttr = childNode['s-sn'];
788
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
789
+ node = hostContentNodes[j];
790
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
791
+ // let's do some relocating to its new home
792
+ // but never relocate a content reference node
793
+ // that is suppose to always represent the original content location
794
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
795
+ // it's possible we've already decided to relocate this node
796
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
797
+ // made some changes to slots
798
+ // let's make sure we also double check
799
+ // fallbacks are correctly hidden or shown
800
+ checkSlotFallbackVisibility = true;
801
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
802
+ if (relocateNodeData) {
803
+ // previously we never found a slot home for this node
804
+ // but turns out we did, so let's remember it now
805
+ relocateNodeData.$slotRefNode$ = childNode;
806
+ }
807
+ else {
808
+ // add to our list of nodes to relocate
809
+ relocateNodes.push({
810
+ $slotRefNode$: childNode,
811
+ $nodeToRelocate$: node,
812
+ });
813
+ }
814
+ if (node['s-sr']) {
815
+ relocateNodes.map((relocateNode) => {
816
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
817
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
818
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
819
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
820
+ }
821
+ }
822
+ });
823
+ }
824
+ }
825
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
826
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
827
+ // if we never find a home for this element then we'll need to hide it
828
+ relocateNodes.push({
829
+ $nodeToRelocate$: node,
830
+ });
831
+ }
832
+ }
833
+ }
834
+ }
835
+ if (childNode.nodeType === 1 /* ElementNode */) {
836
+ relocateSlotContent(childNode);
837
+ }
838
+ }
839
+ };
840
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
841
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
842
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
843
+ return true;
844
+ }
845
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
846
+ return true;
847
+ }
848
+ return false;
849
+ }
850
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
851
+ return true;
852
+ }
853
+ return slotNameAttr === '';
854
+ };
855
+ const renderVdom = (hostRef, renderFnResults) => {
856
+ const hostElm = hostRef.$hostElement$;
857
+ const cmpMeta = hostRef.$cmpMeta$;
858
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
859
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
860
+ hostTagName = hostElm.tagName;
861
+ if (cmpMeta.$attrsToReflect$) {
862
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
863
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
864
+ }
865
+ rootVnode.$tag$ = null;
866
+ rootVnode.$flags$ |= 4 /* isHost */;
867
+ hostRef.$vnode$ = rootVnode;
868
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
869
+ {
870
+ scopeId = hostElm['s-sc'];
871
+ }
872
+ {
873
+ contentRef = hostElm['s-cr'];
874
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
875
+ // always reset
876
+ checkSlotFallbackVisibility = false;
877
+ }
878
+ // synchronous patch
879
+ patch(oldVNode, rootVnode);
880
+ {
881
+ // while we're moving nodes around existing nodes, temporarily disable
882
+ // the disconnectCallback from working
883
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
884
+ if (checkSlotRelocate) {
885
+ relocateSlotContent(rootVnode.$elm$);
886
+ let relocateData;
887
+ let nodeToRelocate;
888
+ let orgLocationNode;
889
+ let parentNodeRef;
890
+ let insertBeforeNode;
891
+ let refNode;
892
+ let i = 0;
893
+ for (; i < relocateNodes.length; i++) {
894
+ relocateData = relocateNodes[i];
895
+ nodeToRelocate = relocateData.$nodeToRelocate$;
896
+ if (!nodeToRelocate['s-ol']) {
897
+ // add a reference node marking this node's original location
898
+ // keep a reference to this node for later lookups
899
+ orgLocationNode =
900
+ doc.createTextNode('');
901
+ orgLocationNode['s-nr'] = nodeToRelocate;
902
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
903
+ }
904
+ }
905
+ for (i = 0; i < relocateNodes.length; i++) {
906
+ relocateData = relocateNodes[i];
907
+ nodeToRelocate = relocateData.$nodeToRelocate$;
908
+ if (relocateData.$slotRefNode$) {
909
+ // by default we're just going to insert it directly
910
+ // after the slot reference node
911
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
912
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
913
+ orgLocationNode = nodeToRelocate['s-ol'];
914
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
915
+ refNode = orgLocationNode['s-nr'];
916
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
917
+ refNode = refNode.nextSibling;
918
+ if (!refNode || !refNode['s-nr']) {
919
+ insertBeforeNode = refNode;
920
+ break;
921
+ }
922
+ }
923
+ }
924
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
925
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
926
+ // we've checked that it's worth while to relocate
927
+ // since that the node to relocate
928
+ // has a different next sibling or parent relocated
929
+ if (nodeToRelocate !== insertBeforeNode) {
930
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
931
+ // probably a component in the index.html that doesn't have it's hostname set
932
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
933
+ }
934
+ // add it back to the dom but in its new home
935
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
936
+ }
937
+ }
938
+ }
939
+ else {
940
+ // this node doesn't have a slot home to go to, so let's hide it
941
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
942
+ nodeToRelocate.hidden = true;
943
+ }
944
+ }
945
+ }
946
+ }
947
+ if (checkSlotFallbackVisibility) {
948
+ updateFallbackSlotVisibility(rootVnode.$elm$);
949
+ }
950
+ // done moving nodes around
951
+ // allow the disconnect callback to work again
952
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
953
+ // always reset
954
+ relocateNodes.length = 0;
955
+ }
956
+ };
957
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
958
+ const createEvent = (ref, name, flags) => {
959
+ const elm = getElement(ref);
960
+ return {
961
+ emit: (detail) => {
962
+ return emitEvent(elm, name, {
963
+ bubbles: !!(flags & 4 /* Bubbles */),
964
+ composed: !!(flags & 2 /* Composed */),
965
+ cancelable: !!(flags & 1 /* Cancellable */),
966
+ detail,
967
+ });
968
+ },
969
+ };
970
+ };
971
+ /**
972
+ * Helper function to create & dispatch a custom Event on a provided target
973
+ * @param elm the target of the Event
974
+ * @param name the name to give the custom Event
975
+ * @param opts options for configuring a custom Event
976
+ * @returns the custom Event
977
+ */
978
+ const emitEvent = (elm, name, opts) => {
979
+ const ev = plt.ce(name, opts);
980
+ elm.dispatchEvent(ev);
981
+ return ev;
982
+ };
983
+ const attachToAncestor = (hostRef, ancestorComponent) => {
984
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
985
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
986
+ }
987
+ };
988
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
989
+ {
990
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
991
+ }
992
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
993
+ hostRef.$flags$ |= 512 /* needsRerender */;
994
+ return;
995
+ }
996
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
997
+ // there is no ancestor component or the ancestor component
998
+ // has already fired off its lifecycle update then
999
+ // fire off the initial update
1000
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1001
+ return writeTask(dispatch) ;
1002
+ };
1003
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1004
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1005
+ const instance = hostRef.$lazyInstance$ ;
1006
+ let promise;
1007
+ if (isInitialLoad) {
1008
+ {
1009
+ hostRef.$flags$ |= 256 /* isListenReady */;
1010
+ if (hostRef.$queuedListeners$) {
1011
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1012
+ hostRef.$queuedListeners$ = null;
1013
+ }
1014
+ }
1015
+ {
1016
+ promise = safeCall(instance, 'componentWillLoad');
1017
+ }
1018
+ }
1019
+ {
1020
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1021
+ }
1022
+ endSchedule();
1023
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1024
+ };
1025
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1026
+ // updateComponent
1027
+ const elm = hostRef.$hostElement$;
1028
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1029
+ const rc = elm['s-rc'];
1030
+ if (isInitialLoad) {
1031
+ // DOM WRITE!
1032
+ attachStyles(hostRef);
1033
+ }
1034
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1035
+ {
1036
+ callRender(hostRef, instance);
1037
+ }
1038
+ if (rc) {
1039
+ // ok, so turns out there are some child host elements
1040
+ // waiting on this parent element to load
1041
+ // let's fire off all update callbacks waiting
1042
+ rc.map((cb) => cb());
1043
+ elm['s-rc'] = undefined;
1044
+ }
1045
+ endRender();
1046
+ endUpdate();
1047
+ {
1048
+ const childrenPromises = elm['s-p'];
1049
+ const postUpdate = () => postUpdateComponent(hostRef);
1050
+ if (childrenPromises.length === 0) {
1051
+ postUpdate();
1052
+ }
1053
+ else {
1054
+ Promise.all(childrenPromises).then(postUpdate);
1055
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1056
+ childrenPromises.length = 0;
1057
+ }
1058
+ }
1059
+ };
1060
+ const callRender = (hostRef, instance, elm) => {
1061
+ try {
1062
+ instance = instance.render && instance.render();
1063
+ {
1064
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1065
+ }
1066
+ {
1067
+ hostRef.$flags$ |= 2 /* hasRendered */;
1068
+ }
1069
+ {
1070
+ {
1071
+ // looks like we've got child nodes to render into this host element
1072
+ // or we need to update the css class/attrs on the host element
1073
+ // DOM WRITE!
1074
+ {
1075
+ renderVdom(hostRef, instance);
1076
+ }
1077
+ }
1078
+ }
1079
+ }
1080
+ catch (e) {
1081
+ consoleError(e, hostRef.$hostElement$);
1082
+ }
1083
+ return null;
1084
+ };
1085
+ const postUpdateComponent = (hostRef) => {
1086
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1087
+ const elm = hostRef.$hostElement$;
1088
+ const endPostUpdate = createTime('postUpdate', tagName);
1089
+ const instance = hostRef.$lazyInstance$ ;
1090
+ const ancestorComponent = hostRef.$ancestorComponent$;
1091
+ {
1092
+ safeCall(instance, 'componentDidRender');
1093
+ }
1094
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1095
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1096
+ {
1097
+ // DOM WRITE!
1098
+ addHydratedFlag(elm);
1099
+ }
1100
+ endPostUpdate();
1101
+ {
1102
+ hostRef.$onReadyResolve$(elm);
1103
+ if (!ancestorComponent) {
1104
+ appDidLoad();
1105
+ }
1106
+ }
1107
+ }
1108
+ else {
1109
+ endPostUpdate();
1110
+ }
1111
+ // load events fire from bottom to top
1112
+ // the deepest elements load first then bubbles up
1113
+ {
1114
+ if (hostRef.$onRenderResolve$) {
1115
+ hostRef.$onRenderResolve$();
1116
+ hostRef.$onRenderResolve$ = undefined;
1117
+ }
1118
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
1119
+ nextTick(() => scheduleUpdate(hostRef, false));
1120
+ }
1121
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1122
+ }
1123
+ // ( •_•)
1124
+ // ( •_•)>⌐■-■
1125
+ // (⌐■_■)
1126
+ };
1127
+ const appDidLoad = (who) => {
1128
+ // on appload
1129
+ // we have finish the first big initial render
1130
+ {
1131
+ addHydratedFlag(doc.documentElement);
1132
+ }
1133
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1134
+ };
1135
+ const safeCall = (instance, method, arg) => {
1136
+ if (instance && instance[method]) {
1137
+ try {
1138
+ return instance[method](arg);
1139
+ }
1140
+ catch (e) {
1141
+ consoleError(e);
1142
+ }
1143
+ }
1144
+ return undefined;
1145
+ };
1146
+ const then = (promise, thenFn) => {
1147
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1148
+ };
1149
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1150
+ ;
1151
+ /**
1152
+ * Parse a new property value for a given property type.
1153
+ *
1154
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1155
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1156
+ * 1. `any`, the type given to `propValue` in the function signature
1157
+ * 2. the type stored from `propType`.
1158
+ *
1159
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1160
+ *
1161
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1162
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1163
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1164
+ * ```tsx
1165
+ * <my-cmp prop-val={0}></my-cmp>
1166
+ * ```
1167
+ *
1168
+ * HTML prop values on the other hand, will always a string
1169
+ *
1170
+ * @param propValue the new value to coerce to some type
1171
+ * @param propType the type of the prop, expressed as a binary number
1172
+ * @returns the parsed/coerced value
1173
+ */
1174
+ const parsePropertyValue = (propValue, propType) => {
1175
+ // ensure this value is of the correct prop type
1176
+ if (propValue != null && !isComplexType(propValue)) {
1177
+ if (propType & 1 /* String */) {
1178
+ // could have been passed as a number or boolean
1179
+ // but we still want it as a string
1180
+ return String(propValue);
1181
+ }
1182
+ // redundant return here for better minification
1183
+ return propValue;
1184
+ }
1185
+ // not sure exactly what type we want
1186
+ // so no need to change to a different type
1187
+ return propValue;
1188
+ };
1189
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1190
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1191
+ // check our new property value against our internal value
1192
+ const hostRef = getHostRef(ref);
1193
+ const oldVal = hostRef.$instanceValues$.get(propName);
1194
+ const flags = hostRef.$flags$;
1195
+ const instance = hostRef.$lazyInstance$ ;
1196
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1197
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1198
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1199
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1200
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1201
+ // gadzooks! the property's value has changed!!
1202
+ // set our new value!
1203
+ hostRef.$instanceValues$.set(propName, newVal);
1204
+ if (instance) {
1205
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1206
+ // looks like this value actually changed, so we've got work to do!
1207
+ // but only if we've already rendered, otherwise just chill out
1208
+ // queue that we need to do an update, but don't worry about queuing
1209
+ // up millions cuz this function ensures it only runs once
1210
+ scheduleUpdate(hostRef, false);
1211
+ }
1212
+ }
1213
+ }
1214
+ };
1215
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1216
+ if (cmpMeta.$members$) {
1217
+ // It's better to have a const than two Object.entries()
1218
+ const members = Object.entries(cmpMeta.$members$);
1219
+ const prototype = Cstr.prototype;
1220
+ members.map(([memberName, [memberFlags]]) => {
1221
+ if ((memberFlags & 31 /* Prop */ ||
1222
+ ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1223
+ // proxyComponent - prop
1224
+ Object.defineProperty(prototype, memberName, {
1225
+ get() {
1226
+ // proxyComponent, get value
1227
+ return getValue(this, memberName);
1228
+ },
1229
+ set(newValue) {
1230
+ // proxyComponent, set value
1231
+ setValue(this, memberName, newValue, cmpMeta);
1232
+ },
1233
+ configurable: true,
1234
+ enumerable: true,
1235
+ });
1236
+ }
1237
+ });
1238
+ if ((flags & 1 /* isElementConstructor */)) {
1239
+ const attrNameToPropName = new Map();
1240
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1241
+ plt.jmp(() => {
1242
+ const propName = attrNameToPropName.get(attrName);
1243
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1244
+ // in the case where an attribute was set inline.
1245
+ // ```html
1246
+ // <my-component some-attribute="some-value"></my-component>
1247
+ // ```
1248
+ //
1249
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1250
+ // programmatically changes it before it has been upgraded as shown below:
1251
+ //
1252
+ // ```html
1253
+ // <!-- this component has _not_ been upgraded yet -->
1254
+ // <my-component id="test" some-attribute="some-value"></my-component>
1255
+ // <script>
1256
+ // // grab non-upgraded component
1257
+ // el = document.querySelector("#test");
1258
+ // el.someAttribute = "another-value";
1259
+ // // upgrade component
1260
+ // customElements.define('my-component', MyComponent);
1261
+ // </script>
1262
+ // ```
1263
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1264
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1265
+ // to the value that was set inline i.e. "some-value" from above example. When
1266
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1267
+ //
1268
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1269
+ // by connectedCallback as this attributeChangedCallback will not fire.
1270
+ //
1271
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1272
+ //
1273
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1274
+ // properties here given that this goes against best practices outlined here
1275
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1276
+ if (this.hasOwnProperty(propName)) {
1277
+ newValue = this[propName];
1278
+ delete this[propName];
1279
+ }
1280
+ else if (prototype.hasOwnProperty(propName) &&
1281
+ typeof this[propName] === 'number' &&
1282
+ this[propName] == newValue) {
1283
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1284
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1285
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1286
+ return;
1287
+ }
1288
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1289
+ });
1290
+ };
1291
+ // create an array of attributes to observe
1292
+ // and also create a map of html attribute name to js property name
1293
+ Cstr.observedAttributes = members
1294
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1295
+ .map(([propName, m]) => {
1296
+ const attrName = m[1] || propName;
1297
+ attrNameToPropName.set(attrName, propName);
1298
+ if (m[0] & 512 /* ReflectAttr */) {
1299
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1300
+ }
1301
+ return attrName;
1302
+ });
1303
+ }
1304
+ }
1305
+ return Cstr;
1306
+ };
1307
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1308
+ // initializeComponent
1309
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1310
+ {
1311
+ // we haven't initialized this element yet
1312
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1313
+ // lazy loaded components
1314
+ // request the component's implementation to be
1315
+ // wired up with the host element
1316
+ Cstr = loadModule(cmpMeta);
1317
+ if (Cstr.then) {
1318
+ // Await creates a micro-task avoid if possible
1319
+ const endLoad = uniqueTime();
1320
+ Cstr = await Cstr;
1321
+ endLoad();
1322
+ }
1323
+ if (!Cstr.isProxied) {
1324
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1325
+ Cstr.isProxied = true;
1326
+ }
1327
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1328
+ // ok, time to construct the instance
1329
+ // but let's keep track of when we start and stop
1330
+ // so that the getters/setters don't incorrectly step on data
1331
+ {
1332
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1333
+ }
1334
+ // construct the lazy-loaded component implementation
1335
+ // passing the hostRef is very important during
1336
+ // construction in order to directly wire together the
1337
+ // host element and the lazy-loaded instance
1338
+ try {
1339
+ new Cstr(hostRef);
1340
+ }
1341
+ catch (e) {
1342
+ consoleError(e);
1343
+ }
1344
+ {
1345
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1346
+ }
1347
+ endNewInstance();
1348
+ }
1349
+ if (Cstr.style) {
1350
+ // this component has styles but we haven't registered them yet
1351
+ let style = Cstr.style;
1352
+ const scopeId = getScopeId(cmpMeta);
1353
+ if (!styles.has(scopeId)) {
1354
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1355
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1356
+ endRegisterStyles();
1357
+ }
1358
+ }
1359
+ }
1360
+ // we've successfully created a lazy instance
1361
+ const ancestorComponent = hostRef.$ancestorComponent$;
1362
+ const schedule = () => scheduleUpdate(hostRef, true);
1363
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1364
+ // this is the initial load and this component it has an ancestor component
1365
+ // but the ancestor component has NOT fired its will update lifecycle yet
1366
+ // so let's just cool our jets and wait for the ancestor to continue first
1367
+ // this will get fired off when the ancestor component
1368
+ // finally gets around to rendering its lazy self
1369
+ // fire off the initial update
1370
+ ancestorComponent['s-rc'].push(schedule);
1371
+ }
1372
+ else {
1373
+ schedule();
1374
+ }
1375
+ };
1376
+ const connectedCallback = (elm) => {
1377
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1378
+ const hostRef = getHostRef(elm);
1379
+ const cmpMeta = hostRef.$cmpMeta$;
1380
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1381
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1382
+ // first time this component has connected
1383
+ hostRef.$flags$ |= 1 /* hasConnected */;
1384
+ {
1385
+ // initUpdate
1386
+ // if the slot polyfill is required we'll need to put some nodes
1387
+ // in here to act as original content anchors as we move nodes around
1388
+ // host element has been connected to the DOM
1389
+ if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1390
+ setContentReference(elm);
1391
+ }
1392
+ }
1393
+ {
1394
+ // find the first ancestor component (if there is one) and register
1395
+ // this component as one of the actively loading child components for its ancestor
1396
+ let ancestorComponent = elm;
1397
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1398
+ // climb up the ancestors looking for the first
1399
+ // component that hasn't finished its lifecycle update yet
1400
+ if (ancestorComponent['s-p']) {
1401
+ // we found this components first ancestor component
1402
+ // keep a reference to this component's ancestor component
1403
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1404
+ break;
1405
+ }
1406
+ }
1407
+ }
1408
+ // Lazy properties
1409
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1410
+ if (cmpMeta.$members$) {
1411
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1412
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1413
+ const value = elm[memberName];
1414
+ delete elm[memberName];
1415
+ elm[memberName] = value;
1416
+ }
1417
+ });
1418
+ }
1419
+ {
1420
+ initializeComponent(elm, hostRef, cmpMeta);
1421
+ }
1422
+ }
1423
+ else {
1424
+ // not the first time this has connected
1425
+ // reattach any event listeners to the host
1426
+ // since they would have been removed when disconnected
1427
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1428
+ }
1429
+ endConnected();
1430
+ }
1431
+ };
1432
+ const setContentReference = (elm) => {
1433
+ // only required when we're NOT using native shadow dom (slot)
1434
+ // or this browser doesn't support native shadow dom
1435
+ // and this host element was NOT created with SSR
1436
+ // let's pick out the inner content for slot projection
1437
+ // create a node to represent where the original
1438
+ // content was first placed, which is useful later on
1439
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1440
+ contentRefElm['s-cn'] = true;
1441
+ elm.insertBefore(contentRefElm, elm.firstChild);
1442
+ };
1443
+ const disconnectedCallback = (elm) => {
1444
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1445
+ const hostRef = getHostRef(elm);
1446
+ {
1447
+ if (hostRef.$rmListeners$) {
1448
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1449
+ hostRef.$rmListeners$ = undefined;
1450
+ }
1451
+ }
1452
+ }
1453
+ };
1454
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1455
+ const endBootstrap = createTime();
1456
+ const cmpTags = [];
1457
+ const exclude = options.exclude || [];
1458
+ const customElements = win.customElements;
1459
+ const head = doc.head;
1460
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1461
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1462
+ const deferredConnectedCallbacks = [];
1463
+ let appLoadFallback;
1464
+ let isBootstrapping = true;
1465
+ Object.assign(plt, options);
1466
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1467
+ lazyBundles.map((lazyBundle) => {
1468
+ lazyBundle[1].map((compactMeta) => {
1469
+ const cmpMeta = {
1470
+ $flags$: compactMeta[0],
1471
+ $tagName$: compactMeta[1],
1472
+ $members$: compactMeta[2],
1473
+ $listeners$: compactMeta[3],
1474
+ };
1475
+ {
1476
+ cmpMeta.$members$ = compactMeta[2];
1477
+ }
1478
+ {
1479
+ cmpMeta.$listeners$ = compactMeta[3];
1480
+ }
1481
+ {
1482
+ cmpMeta.$attrsToReflect$ = [];
1483
+ }
1484
+ const tagName = cmpMeta.$tagName$;
1485
+ const HostElement = class extends HTMLElement {
1486
+ // StencilLazyHost
1487
+ constructor(self) {
1488
+ // @ts-ignore
1489
+ super(self);
1490
+ self = this;
1491
+ registerHost(self, cmpMeta);
1492
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1493
+ // this component is using shadow dom
1494
+ // and this browser supports shadow dom
1495
+ // add the read-only property "shadowRoot" to the host element
1496
+ // adding the shadow root build conditionals to minimize runtime
1497
+ {
1498
+ {
1499
+ self.attachShadow({ mode: 'open' });
1500
+ }
1501
+ }
1502
+ }
1503
+ }
1504
+ connectedCallback() {
1505
+ if (appLoadFallback) {
1506
+ clearTimeout(appLoadFallback);
1507
+ appLoadFallback = null;
1508
+ }
1509
+ if (isBootstrapping) {
1510
+ // connectedCallback will be processed once all components have been registered
1511
+ deferredConnectedCallbacks.push(this);
1512
+ }
1513
+ else {
1514
+ plt.jmp(() => connectedCallback(this));
1515
+ }
1516
+ }
1517
+ disconnectedCallback() {
1518
+ plt.jmp(() => disconnectedCallback(this));
1519
+ }
1520
+ componentOnReady() {
1521
+ return getHostRef(this).$onReadyPromise$;
1522
+ }
1523
+ };
1524
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1525
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1526
+ cmpTags.push(tagName);
1527
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1528
+ }
1529
+ });
1530
+ });
1531
+ {
1532
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1533
+ visibilityStyle.setAttribute('data-styles', '');
1534
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1535
+ }
1536
+ // Process deferred connectedCallbacks now all components have been registered
1537
+ isBootstrapping = false;
1538
+ if (deferredConnectedCallbacks.length) {
1539
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1540
+ }
1541
+ else {
1542
+ {
1543
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1544
+ }
1545
+ }
1546
+ // Fallback appLoad event
1547
+ endBootstrap();
1548
+ };
1549
+ const getAssetPath = (path) => {
1550
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
1551
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
1552
+ };
1553
+ const Fragment = (_, children) => children;
1554
+ const hostRefs = new WeakMap();
1555
+ const getHostRef = (ref) => hostRefs.get(ref);
1556
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1557
+ const registerHost = (elm, cmpMeta) => {
1558
+ const hostRef = {
1559
+ $flags$: 0,
1560
+ $hostElement$: elm,
1561
+ $cmpMeta$: cmpMeta,
1562
+ $instanceValues$: new Map(),
1563
+ };
1564
+ {
1565
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1566
+ elm['s-p'] = [];
1567
+ elm['s-rc'] = [];
1568
+ }
1569
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1570
+ return hostRefs.set(elm, hostRef);
1571
+ };
1572
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1573
+ const consoleError = (e, el) => (0, console.error)(e, el);
1574
+ const cmpModules = /*@__PURE__*/ new Map();
1575
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1576
+ // loadModuleImport
1577
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1578
+ const bundleId = cmpMeta.$lazyBundleId$;
1579
+ const module = cmpModules.get(bundleId) ;
1580
+ if (module) {
1581
+ return module[exportName];
1582
+ }
1583
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1584
+ /* webpackInclude: /\.entry\.js$/ */
1585
+ /* webpackExclude: /\.system\.entry\.js$/ */
1586
+ /* webpackMode: "lazy" */
1587
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1588
+ {
1589
+ cmpModules.set(bundleId, importedModule);
1590
+ }
1591
+ return importedModule[exportName];
1592
+ }, consoleError);
1593
+ };
1594
+ const styles = new Map();
1595
+ const queueDomReads = [];
1596
+ const queueDomWrites = [];
1597
+ const queueTask = (queue, write) => (cb) => {
1598
+ queue.push(cb);
1599
+ if (!queuePending) {
1600
+ queuePending = true;
1601
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1602
+ nextTick(flush);
1603
+ }
1604
+ else {
1605
+ plt.raf(flush);
1606
+ }
1607
+ }
1608
+ };
1609
+ const consume = (queue) => {
1610
+ for (let i = 0; i < queue.length; i++) {
1611
+ try {
1612
+ queue[i](performance.now());
1613
+ }
1614
+ catch (e) {
1615
+ consoleError(e);
1616
+ }
1617
+ }
1618
+ queue.length = 0;
1619
+ };
1620
+ const flush = () => {
1621
+ // always force a bunch of medium callbacks to run, but still have
1622
+ // a throttle on how many can run in a certain time
1623
+ // DOM READS!!!
1624
+ consume(queueDomReads);
1625
+ // DOM WRITES!!!
1626
+ {
1627
+ consume(queueDomWrites);
1628
+ if ((queuePending = queueDomReads.length > 0)) {
1629
+ // still more to do yet, but we've run out of time
1630
+ // let's let this thing cool off and try again in the next tick
1631
+ plt.raf(flush);
1632
+ }
1633
+ }
1634
+ };
1635
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1636
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1637
+
1638
+ exports.Fragment = Fragment;
1639
+ exports.bootstrapLazy = bootstrapLazy;
1640
+ exports.createEvent = createEvent;
1641
+ exports.getAssetPath = getAssetPath;
1642
+ exports.getElement = getElement;
1643
+ exports.h = h;
1644
+ exports.promiseResolve = promiseResolve;
1645
+ exports.registerInstance = registerInstance;