@everymatrix/casino-engagement-suite-jackpot-details 1.36.1

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 (53) hide show
  1. package/dist/casino-engagement-suite-jackpot-details/casino-engagement-suite-jackpot-details.esm.js +1 -0
  2. package/dist/casino-engagement-suite-jackpot-details/index.esm.js +0 -0
  3. package/dist/casino-engagement-suite-jackpot-details/p-9764b08b.entry.js +1 -0
  4. package/dist/casino-engagement-suite-jackpot-details/p-e36472df.js +1 -0
  5. package/dist/casino-engagement-suite-jackpot-details/p-e8978b77.entry.js +1 -0
  6. package/dist/cjs/casino-engagement-suite-jackpot-details.cjs.entry.js +285 -0
  7. package/dist/cjs/casino-engagement-suite-jackpot-details.cjs.js +19 -0
  8. package/dist/cjs/casino-engagement-suite-progress-bar.cjs.entry.js +76 -0
  9. package/dist/cjs/index-8f767151.js +1317 -0
  10. package/dist/cjs/index.cjs.js +2 -0
  11. package/dist/cjs/loader.cjs.js +21 -0
  12. package/dist/collection/collection-manifest.json +19 -0
  13. package/dist/collection/components/casino-engagement-suite-jackpot-details/casino-engagement-suite-jackpot-details.css +358 -0
  14. package/dist/collection/components/casino-engagement-suite-jackpot-details/casino-engagement-suite-jackpot-details.js +460 -0
  15. package/dist/collection/index.js +1 -0
  16. package/dist/collection/models/index.js +1 -0
  17. package/dist/collection/utils/index.js +5 -0
  18. package/dist/collection/utils/locale.utils.js +22 -0
  19. package/dist/components/casino-engagement-suite-jackpot-details.d.ts +11 -0
  20. package/dist/components/casino-engagement-suite-jackpot-details.js +316 -0
  21. package/dist/components/casino-engagement-suite-progress-bar.js +97 -0
  22. package/dist/components/index.d.ts +26 -0
  23. package/dist/components/index.js +1 -0
  24. package/dist/esm/casino-engagement-suite-jackpot-details.entry.js +281 -0
  25. package/dist/esm/casino-engagement-suite-jackpot-details.js +17 -0
  26. package/dist/esm/casino-engagement-suite-progress-bar.entry.js +72 -0
  27. package/dist/esm/index-ec30ecaa.js +1290 -0
  28. package/dist/esm/index.js +1 -0
  29. package/dist/esm/loader.js +17 -0
  30. package/dist/esm/polyfills/core-js.js +11 -0
  31. package/dist/esm/polyfills/css-shim.js +1 -0
  32. package/dist/esm/polyfills/dom.js +79 -0
  33. package/dist/esm/polyfills/es5-html-element.js +1 -0
  34. package/dist/esm/polyfills/index.js +34 -0
  35. package/dist/esm/polyfills/system.js +6 -0
  36. package/dist/index.cjs.js +1 -0
  37. package/dist/index.js +1 -0
  38. package/dist/stencil.config.js +22 -0
  39. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-engagement-suite-jackpot-details/.stencil/packages/casino-engagement-suite-jackpot-details/stencil.config.d.ts +2 -0
  40. package/dist/types/components/casino-engagement-suite-jackpot-details/casino-engagement-suite-jackpot-details.d.ts +82 -0
  41. package/dist/types/components.d.ts +88 -0
  42. package/dist/types/index.d.ts +1 -0
  43. package/dist/types/models/index.d.ts +49 -0
  44. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  45. package/dist/types/utils/index.d.ts +1 -0
  46. package/dist/types/utils/locale.utils.d.ts +1 -0
  47. package/loader/cdn.js +3 -0
  48. package/loader/index.cjs.js +3 -0
  49. package/loader/index.d.ts +12 -0
  50. package/loader/index.es2017.js +3 -0
  51. package/loader/index.js +4 -0
  52. package/loader/package.json +10 -0
  53. package/package.json +19 -0
@@ -0,0 +1,1290 @@
1
+ const NAMESPACE = 'casino-engagement-suite-jackpot-details';
2
+
3
+ let scopeId;
4
+ let hostTagName;
5
+ let isSvgMode = false;
6
+ let queuePending = false;
7
+ const win = typeof window !== 'undefined' ? window : {};
8
+ const doc = win.document || { head: {} };
9
+ const plt = {
10
+ $flags$: 0,
11
+ $resourcesUrl$: '',
12
+ jmp: (h) => h(),
13
+ raf: (h) => requestAnimationFrame(h),
14
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
15
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
16
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
17
+ };
18
+ const promiseResolve = (v) => Promise.resolve(v);
19
+ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
20
+ try {
21
+ new CSSStyleSheet();
22
+ return typeof new CSSStyleSheet().replace === 'function';
23
+ }
24
+ catch (e) { }
25
+ return false;
26
+ })()
27
+ ;
28
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
29
+ if (listeners) {
30
+ listeners.map(([flags, name, method]) => {
31
+ const target = getHostListenerTarget(elm, flags) ;
32
+ const handler = hostListenerProxy(hostRef, method);
33
+ const opts = hostListenerOpts(flags);
34
+ plt.ael(target, name, handler, opts);
35
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
36
+ });
37
+ }
38
+ };
39
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
40
+ try {
41
+ {
42
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
43
+ // instance is ready, let's call it's member method for this event
44
+ hostRef.$lazyInstance$[methodName](ev);
45
+ }
46
+ else {
47
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
48
+ }
49
+ }
50
+ }
51
+ catch (e) {
52
+ consoleError(e);
53
+ }
54
+ };
55
+ const getHostListenerTarget = (elm, flags) => {
56
+ if (flags & 8 /* TargetWindow */)
57
+ return win;
58
+ return elm;
59
+ };
60
+ // prettier-ignore
61
+ const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
62
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
63
+ const createTime = (fnName, tagName = '') => {
64
+ {
65
+ return () => {
66
+ return;
67
+ };
68
+ }
69
+ };
70
+ const uniqueTime = (key, measureText) => {
71
+ {
72
+ return () => {
73
+ return;
74
+ };
75
+ }
76
+ };
77
+ const rootAppliedStyles = new WeakMap();
78
+ const registerStyle = (scopeId, cssText, allowCS) => {
79
+ let style = styles.get(scopeId);
80
+ if (supportsConstructibleStylesheets && allowCS) {
81
+ style = (style || new CSSStyleSheet());
82
+ style.replace(cssText);
83
+ }
84
+ else {
85
+ style = cssText;
86
+ }
87
+ styles.set(scopeId, style);
88
+ };
89
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
90
+ let scopeId = getScopeId(cmpMeta);
91
+ let style = styles.get(scopeId);
92
+ // if an element is NOT connected then getRootNode() will return the wrong root node
93
+ // so the fallback is to always use the document for the root node in those cases
94
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
95
+ if (style) {
96
+ if (typeof style === 'string') {
97
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
98
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
99
+ let styleElm;
100
+ if (!appliedStyles) {
101
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
102
+ }
103
+ if (!appliedStyles.has(scopeId)) {
104
+ {
105
+ {
106
+ styleElm = doc.createElement('style');
107
+ styleElm.innerHTML = style;
108
+ }
109
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
110
+ }
111
+ if (appliedStyles) {
112
+ appliedStyles.add(scopeId);
113
+ }
114
+ }
115
+ }
116
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
117
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
118
+ }
119
+ }
120
+ return scopeId;
121
+ };
122
+ const attachStyles = (hostRef) => {
123
+ const cmpMeta = hostRef.$cmpMeta$;
124
+ const elm = hostRef.$hostElement$;
125
+ const flags = cmpMeta.$flags$;
126
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
127
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
128
+ if (flags & 10 /* needsScopedEncapsulation */) {
129
+ // only required when we're NOT using native shadow dom (slot)
130
+ // or this browser doesn't support native shadow dom
131
+ // and this host element was NOT created with SSR
132
+ // let's pick out the inner content for slot projection
133
+ // create a node to represent where the original
134
+ // content was first placed, which is useful later on
135
+ // DOM WRITE!!
136
+ elm['s-sc'] = scopeId;
137
+ elm.classList.add(scopeId + '-h');
138
+ }
139
+ endAttachStyles();
140
+ };
141
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
142
+ /**
143
+ * Default style mode id
144
+ */
145
+ /**
146
+ * Reusable empty obj/array
147
+ * Don't add values to these!!
148
+ */
149
+ const EMPTY_OBJ = {};
150
+ const isDef = (v) => v != null;
151
+ const isComplexType = (o) => {
152
+ // https://jsperf.com/typeof-fn-object/5
153
+ o = typeof o;
154
+ return o === 'object' || o === 'function';
155
+ };
156
+ /**
157
+ * Production h() function based on Preact by
158
+ * Jason Miller (@developit)
159
+ * Licensed under the MIT License
160
+ * https://github.com/developit/preact/blob/master/LICENSE
161
+ *
162
+ * Modified for Stencil's compiler and vdom
163
+ */
164
+ // const stack: any[] = [];
165
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
166
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
167
+ const h = (nodeName, vnodeData, ...children) => {
168
+ let child = null;
169
+ let key = null;
170
+ let simple = false;
171
+ let lastSimple = false;
172
+ let vNodeChildren = [];
173
+ const walk = (c) => {
174
+ for (let i = 0; i < c.length; i++) {
175
+ child = c[i];
176
+ if (Array.isArray(child)) {
177
+ walk(child);
178
+ }
179
+ else if (child != null && typeof child !== 'boolean') {
180
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
181
+ child = String(child);
182
+ }
183
+ if (simple && lastSimple) {
184
+ // If the previous child was simple (string), we merge both
185
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
186
+ }
187
+ else {
188
+ // Append a new vNode, if it's text, we create a text vNode
189
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
190
+ }
191
+ lastSimple = simple;
192
+ }
193
+ }
194
+ };
195
+ walk(children);
196
+ if (vnodeData) {
197
+ // normalize class / classname attributes
198
+ if (vnodeData.key) {
199
+ key = vnodeData.key;
200
+ }
201
+ {
202
+ const classData = vnodeData.className || vnodeData.class;
203
+ if (classData) {
204
+ vnodeData.class =
205
+ typeof classData !== 'object'
206
+ ? classData
207
+ : Object.keys(classData)
208
+ .filter((k) => classData[k])
209
+ .join(' ');
210
+ }
211
+ }
212
+ }
213
+ const vnode = newVNode(nodeName, null);
214
+ vnode.$attrs$ = vnodeData;
215
+ if (vNodeChildren.length > 0) {
216
+ vnode.$children$ = vNodeChildren;
217
+ }
218
+ {
219
+ vnode.$key$ = key;
220
+ }
221
+ return vnode;
222
+ };
223
+ const newVNode = (tag, text) => {
224
+ const vnode = {
225
+ $flags$: 0,
226
+ $tag$: tag,
227
+ $text$: text,
228
+ $elm$: null,
229
+ $children$: null,
230
+ };
231
+ {
232
+ vnode.$attrs$ = null;
233
+ }
234
+ {
235
+ vnode.$key$ = null;
236
+ }
237
+ return vnode;
238
+ };
239
+ const Host = {};
240
+ const isHost = (node) => node && node.$tag$ === Host;
241
+ /**
242
+ * Production setAccessor() function based on Preact by
243
+ * Jason Miller (@developit)
244
+ * Licensed under the MIT License
245
+ * https://github.com/developit/preact/blob/master/LICENSE
246
+ *
247
+ * Modified for Stencil's compiler and vdom
248
+ */
249
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
250
+ if (oldValue !== newValue) {
251
+ let isProp = isMemberInElement(elm, memberName);
252
+ let ln = memberName.toLowerCase();
253
+ if (memberName === 'class') {
254
+ const classList = elm.classList;
255
+ const oldClasses = parseClassList(oldValue);
256
+ const newClasses = parseClassList(newValue);
257
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
258
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
259
+ }
260
+ else if (memberName === 'style') {
261
+ // update style attribute, css properties and values
262
+ {
263
+ for (const prop in oldValue) {
264
+ if (!newValue || newValue[prop] == null) {
265
+ if (prop.includes('-')) {
266
+ elm.style.removeProperty(prop);
267
+ }
268
+ else {
269
+ elm.style[prop] = '';
270
+ }
271
+ }
272
+ }
273
+ }
274
+ for (const prop in newValue) {
275
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
276
+ if (prop.includes('-')) {
277
+ elm.style.setProperty(prop, newValue[prop]);
278
+ }
279
+ else {
280
+ elm.style[prop] = newValue[prop];
281
+ }
282
+ }
283
+ }
284
+ }
285
+ else if (memberName === 'key')
286
+ ;
287
+ else if (memberName === 'ref') {
288
+ // minifier will clean this up
289
+ if (newValue) {
290
+ newValue(elm);
291
+ }
292
+ }
293
+ else if ((!isProp ) &&
294
+ memberName[0] === 'o' &&
295
+ memberName[1] === 'n') {
296
+ // Event Handlers
297
+ // so if the member name starts with "on" and the 3rd characters is
298
+ // a capital letter, and it's not already a member on the element,
299
+ // then we're assuming it's an event listener
300
+ if (memberName[2] === '-') {
301
+ // on- prefixed events
302
+ // allows to be explicit about the dom event to listen without any magic
303
+ // under the hood:
304
+ // <my-cmp on-click> // listens for "click"
305
+ // <my-cmp on-Click> // listens for "Click"
306
+ // <my-cmp on-ionChange> // listens for "ionChange"
307
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
308
+ memberName = memberName.slice(3);
309
+ }
310
+ else if (isMemberInElement(win, ln)) {
311
+ // standard event
312
+ // the JSX attribute could have been "onMouseOver" and the
313
+ // member name "onmouseover" is on the window's prototype
314
+ // so let's add the listener "mouseover", which is all lowercased
315
+ memberName = ln.slice(2);
316
+ }
317
+ else {
318
+ // custom event
319
+ // the JSX attribute could have been "onMyCustomEvent"
320
+ // so let's trim off the "on" prefix and lowercase the first character
321
+ // and add the listener "myCustomEvent"
322
+ // except for the first character, we keep the event name case
323
+ memberName = ln[2] + memberName.slice(3);
324
+ }
325
+ if (oldValue) {
326
+ plt.rel(elm, memberName, oldValue, false);
327
+ }
328
+ if (newValue) {
329
+ plt.ael(elm, memberName, newValue, false);
330
+ }
331
+ }
332
+ else {
333
+ // Set property if it exists and it's not a SVG
334
+ const isComplex = isComplexType(newValue);
335
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
336
+ try {
337
+ if (!elm.tagName.includes('-')) {
338
+ let n = newValue == null ? '' : newValue;
339
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
340
+ if (memberName === 'list') {
341
+ isProp = false;
342
+ }
343
+ else if (oldValue == null || elm[memberName] != n) {
344
+ elm[memberName] = n;
345
+ }
346
+ }
347
+ else {
348
+ elm[memberName] = newValue;
349
+ }
350
+ }
351
+ catch (e) { }
352
+ }
353
+ if (newValue == null || newValue === false) {
354
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
355
+ {
356
+ elm.removeAttribute(memberName);
357
+ }
358
+ }
359
+ }
360
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
361
+ newValue = newValue === true ? '' : newValue;
362
+ {
363
+ elm.setAttribute(memberName, newValue);
364
+ }
365
+ }
366
+ }
367
+ }
368
+ };
369
+ const parseClassListRegex = /\s/;
370
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
371
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
372
+ // if the element passed in is a shadow root, which is a document fragment
373
+ // then we want to be adding attrs/props to the shadow root's "host" element
374
+ // if it's not a shadow root, then we add attrs/props to the same element
375
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
376
+ ? newVnode.$elm$.host
377
+ : newVnode.$elm$;
378
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
379
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
380
+ {
381
+ // remove attributes no longer present on the vnode by setting them to undefined
382
+ for (memberName in oldVnodeAttrs) {
383
+ if (!(memberName in newVnodeAttrs)) {
384
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
385
+ }
386
+ }
387
+ }
388
+ // add new & update changed attributes
389
+ for (memberName in newVnodeAttrs) {
390
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
391
+ }
392
+ };
393
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
394
+ // tslint:disable-next-line: prefer-const
395
+ let newVNode = newParentVNode.$children$[childIndex];
396
+ let i = 0;
397
+ let elm;
398
+ let childNode;
399
+ if (newVNode.$text$ !== null) {
400
+ // create text node
401
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
402
+ }
403
+ else {
404
+ // create element
405
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
406
+ // add css classes, attrs, props, listeners, etc.
407
+ {
408
+ updateElement(null, newVNode, isSvgMode);
409
+ }
410
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
411
+ // if there is a scopeId and this is the initial render
412
+ // then let's add the scopeId as a css class
413
+ elm.classList.add((elm['s-si'] = scopeId));
414
+ }
415
+ if (newVNode.$children$) {
416
+ for (i = 0; i < newVNode.$children$.length; ++i) {
417
+ // create the node
418
+ childNode = createElm(oldParentVNode, newVNode, i);
419
+ // return node could have been null
420
+ if (childNode) {
421
+ // append our new node
422
+ elm.appendChild(childNode);
423
+ }
424
+ }
425
+ }
426
+ }
427
+ return elm;
428
+ };
429
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
430
+ let containerElm = (parentElm);
431
+ let childNode;
432
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
433
+ containerElm = containerElm.shadowRoot;
434
+ }
435
+ for (; startIdx <= endIdx; ++startIdx) {
436
+ if (vnodes[startIdx]) {
437
+ childNode = createElm(null, parentVNode, startIdx);
438
+ if (childNode) {
439
+ vnodes[startIdx].$elm$ = childNode;
440
+ containerElm.insertBefore(childNode, before);
441
+ }
442
+ }
443
+ }
444
+ };
445
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
446
+ for (; startIdx <= endIdx; ++startIdx) {
447
+ if ((vnode = vnodes[startIdx])) {
448
+ elm = vnode.$elm$;
449
+ callNodeRefs(vnode);
450
+ // remove the vnode's element from the dom
451
+ elm.remove();
452
+ }
453
+ }
454
+ };
455
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
456
+ let oldStartIdx = 0;
457
+ let newStartIdx = 0;
458
+ let idxInOld = 0;
459
+ let i = 0;
460
+ let oldEndIdx = oldCh.length - 1;
461
+ let oldStartVnode = oldCh[0];
462
+ let oldEndVnode = oldCh[oldEndIdx];
463
+ let newEndIdx = newCh.length - 1;
464
+ let newStartVnode = newCh[0];
465
+ let newEndVnode = newCh[newEndIdx];
466
+ let node;
467
+ let elmToMove;
468
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
469
+ if (oldStartVnode == null) {
470
+ // Vnode might have been moved left
471
+ oldStartVnode = oldCh[++oldStartIdx];
472
+ }
473
+ else if (oldEndVnode == null) {
474
+ oldEndVnode = oldCh[--oldEndIdx];
475
+ }
476
+ else if (newStartVnode == null) {
477
+ newStartVnode = newCh[++newStartIdx];
478
+ }
479
+ else if (newEndVnode == null) {
480
+ newEndVnode = newCh[--newEndIdx];
481
+ }
482
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
483
+ patch(oldStartVnode, newStartVnode);
484
+ oldStartVnode = oldCh[++oldStartIdx];
485
+ newStartVnode = newCh[++newStartIdx];
486
+ }
487
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
488
+ patch(oldEndVnode, newEndVnode);
489
+ oldEndVnode = oldCh[--oldEndIdx];
490
+ newEndVnode = newCh[--newEndIdx];
491
+ }
492
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
493
+ patch(oldStartVnode, newEndVnode);
494
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
495
+ oldStartVnode = oldCh[++oldStartIdx];
496
+ newEndVnode = newCh[--newEndIdx];
497
+ }
498
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
499
+ patch(oldEndVnode, newStartVnode);
500
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
501
+ oldEndVnode = oldCh[--oldEndIdx];
502
+ newStartVnode = newCh[++newStartIdx];
503
+ }
504
+ else {
505
+ // createKeyToOldIdx
506
+ idxInOld = -1;
507
+ {
508
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
509
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
510
+ idxInOld = i;
511
+ break;
512
+ }
513
+ }
514
+ }
515
+ if (idxInOld >= 0) {
516
+ elmToMove = oldCh[idxInOld];
517
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
518
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
519
+ }
520
+ else {
521
+ patch(elmToMove, newStartVnode);
522
+ oldCh[idxInOld] = undefined;
523
+ node = elmToMove.$elm$;
524
+ }
525
+ newStartVnode = newCh[++newStartIdx];
526
+ }
527
+ else {
528
+ // new element
529
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
530
+ newStartVnode = newCh[++newStartIdx];
531
+ }
532
+ if (node) {
533
+ {
534
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
535
+ }
536
+ }
537
+ }
538
+ }
539
+ if (oldStartIdx > oldEndIdx) {
540
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
541
+ }
542
+ else if (newStartIdx > newEndIdx) {
543
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
544
+ }
545
+ };
546
+ const isSameVnode = (vnode1, vnode2) => {
547
+ // compare if two vnode to see if they're "technically" the same
548
+ // need to have the same element tag, and same key to be the same
549
+ if (vnode1.$tag$ === vnode2.$tag$) {
550
+ {
551
+ return vnode1.$key$ === vnode2.$key$;
552
+ }
553
+ }
554
+ return false;
555
+ };
556
+ const patch = (oldVNode, newVNode) => {
557
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
558
+ const oldChildren = oldVNode.$children$;
559
+ const newChildren = newVNode.$children$;
560
+ const tag = newVNode.$tag$;
561
+ const text = newVNode.$text$;
562
+ if (text === null) {
563
+ // element node
564
+ {
565
+ if (tag === 'slot')
566
+ ;
567
+ else {
568
+ // either this is the first render of an element OR it's an update
569
+ // AND we already know it's possible it could have changed
570
+ // this updates the element's css classes, attrs, props, listeners, etc.
571
+ updateElement(oldVNode, newVNode, isSvgMode);
572
+ }
573
+ }
574
+ if (oldChildren !== null && newChildren !== null) {
575
+ // looks like there's child vnodes for both the old and new vnodes
576
+ updateChildren(elm, oldChildren, newVNode, newChildren);
577
+ }
578
+ else if (newChildren !== null) {
579
+ // no old child vnodes, but there are new child vnodes to add
580
+ if (oldVNode.$text$ !== null) {
581
+ // the old vnode was text, so be sure to clear it out
582
+ elm.textContent = '';
583
+ }
584
+ // add the new vnode children
585
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
586
+ }
587
+ else if (oldChildren !== null) {
588
+ // no new child vnodes, but there are old child vnodes to remove
589
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
590
+ }
591
+ }
592
+ else if (oldVNode.$text$ !== text) {
593
+ // update the text content for the text only vnode
594
+ // and also only if the text is different than before
595
+ elm.data = text;
596
+ }
597
+ };
598
+ const callNodeRefs = (vNode) => {
599
+ {
600
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
601
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
602
+ }
603
+ };
604
+ const renderVdom = (hostRef, renderFnResults) => {
605
+ const hostElm = hostRef.$hostElement$;
606
+ const cmpMeta = hostRef.$cmpMeta$;
607
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
608
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
609
+ hostTagName = hostElm.tagName;
610
+ if (cmpMeta.$attrsToReflect$) {
611
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
612
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
613
+ }
614
+ rootVnode.$tag$ = null;
615
+ rootVnode.$flags$ |= 4 /* isHost */;
616
+ hostRef.$vnode$ = rootVnode;
617
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
618
+ {
619
+ scopeId = hostElm['s-sc'];
620
+ }
621
+ // synchronous patch
622
+ patch(oldVNode, rootVnode);
623
+ };
624
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
625
+ const createEvent = (ref, name, flags) => {
626
+ const elm = getElement(ref);
627
+ return {
628
+ emit: (detail) => {
629
+ return emitEvent(elm, name, {
630
+ bubbles: !!(flags & 4 /* Bubbles */),
631
+ composed: !!(flags & 2 /* Composed */),
632
+ cancelable: !!(flags & 1 /* Cancellable */),
633
+ detail,
634
+ });
635
+ },
636
+ };
637
+ };
638
+ /**
639
+ * Helper function to create & dispatch a custom Event on a provided target
640
+ * @param elm the target of the Event
641
+ * @param name the name to give the custom Event
642
+ * @param opts options for configuring a custom Event
643
+ * @returns the custom Event
644
+ */
645
+ const emitEvent = (elm, name, opts) => {
646
+ const ev = plt.ce(name, opts);
647
+ elm.dispatchEvent(ev);
648
+ return ev;
649
+ };
650
+ const attachToAncestor = (hostRef, ancestorComponent) => {
651
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
652
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
653
+ }
654
+ };
655
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
656
+ {
657
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
658
+ }
659
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
660
+ hostRef.$flags$ |= 512 /* needsRerender */;
661
+ return;
662
+ }
663
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
664
+ // there is no ancestor component or the ancestor component
665
+ // has already fired off its lifecycle update then
666
+ // fire off the initial update
667
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
668
+ return writeTask(dispatch) ;
669
+ };
670
+ const dispatchHooks = (hostRef, isInitialLoad) => {
671
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
672
+ const instance = hostRef.$lazyInstance$ ;
673
+ let promise;
674
+ if (isInitialLoad) {
675
+ {
676
+ hostRef.$flags$ |= 256 /* isListenReady */;
677
+ if (hostRef.$queuedListeners$) {
678
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
679
+ hostRef.$queuedListeners$ = null;
680
+ }
681
+ }
682
+ {
683
+ promise = safeCall(instance, 'componentWillLoad');
684
+ }
685
+ }
686
+ endSchedule();
687
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
688
+ };
689
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
690
+ // updateComponent
691
+ const elm = hostRef.$hostElement$;
692
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
693
+ const rc = elm['s-rc'];
694
+ if (isInitialLoad) {
695
+ // DOM WRITE!
696
+ attachStyles(hostRef);
697
+ }
698
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
699
+ {
700
+ callRender(hostRef, instance);
701
+ }
702
+ if (rc) {
703
+ // ok, so turns out there are some child host elements
704
+ // waiting on this parent element to load
705
+ // let's fire off all update callbacks waiting
706
+ rc.map((cb) => cb());
707
+ elm['s-rc'] = undefined;
708
+ }
709
+ endRender();
710
+ endUpdate();
711
+ {
712
+ const childrenPromises = elm['s-p'];
713
+ const postUpdate = () => postUpdateComponent(hostRef);
714
+ if (childrenPromises.length === 0) {
715
+ postUpdate();
716
+ }
717
+ else {
718
+ Promise.all(childrenPromises).then(postUpdate);
719
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
720
+ childrenPromises.length = 0;
721
+ }
722
+ }
723
+ };
724
+ const callRender = (hostRef, instance, elm) => {
725
+ try {
726
+ instance = instance.render() ;
727
+ {
728
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
729
+ }
730
+ {
731
+ hostRef.$flags$ |= 2 /* hasRendered */;
732
+ }
733
+ {
734
+ {
735
+ // looks like we've got child nodes to render into this host element
736
+ // or we need to update the css class/attrs on the host element
737
+ // DOM WRITE!
738
+ {
739
+ renderVdom(hostRef, instance);
740
+ }
741
+ }
742
+ }
743
+ }
744
+ catch (e) {
745
+ consoleError(e, hostRef.$hostElement$);
746
+ }
747
+ return null;
748
+ };
749
+ const postUpdateComponent = (hostRef) => {
750
+ const tagName = hostRef.$cmpMeta$.$tagName$;
751
+ const elm = hostRef.$hostElement$;
752
+ const endPostUpdate = createTime('postUpdate', tagName);
753
+ const instance = hostRef.$lazyInstance$ ;
754
+ const ancestorComponent = hostRef.$ancestorComponent$;
755
+ {
756
+ safeCall(instance, 'componentDidRender');
757
+ }
758
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
759
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
760
+ {
761
+ // DOM WRITE!
762
+ addHydratedFlag(elm);
763
+ }
764
+ endPostUpdate();
765
+ {
766
+ hostRef.$onReadyResolve$(elm);
767
+ if (!ancestorComponent) {
768
+ appDidLoad();
769
+ }
770
+ }
771
+ }
772
+ else {
773
+ endPostUpdate();
774
+ }
775
+ // load events fire from bottom to top
776
+ // the deepest elements load first then bubbles up
777
+ {
778
+ if (hostRef.$onRenderResolve$) {
779
+ hostRef.$onRenderResolve$();
780
+ hostRef.$onRenderResolve$ = undefined;
781
+ }
782
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
783
+ nextTick(() => scheduleUpdate(hostRef, false));
784
+ }
785
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
786
+ }
787
+ // ( •_•)
788
+ // ( •_•)>⌐■-■
789
+ // (⌐■_■)
790
+ };
791
+ const appDidLoad = (who) => {
792
+ // on appload
793
+ // we have finish the first big initial render
794
+ {
795
+ addHydratedFlag(doc.documentElement);
796
+ }
797
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
798
+ };
799
+ const safeCall = (instance, method, arg) => {
800
+ if (instance && instance[method]) {
801
+ try {
802
+ return instance[method](arg);
803
+ }
804
+ catch (e) {
805
+ consoleError(e);
806
+ }
807
+ }
808
+ return undefined;
809
+ };
810
+ const then = (promise, thenFn) => {
811
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
812
+ };
813
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
814
+ ;
815
+ /**
816
+ * Parse a new property value for a given property type.
817
+ *
818
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
819
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
820
+ * 1. `any`, the type given to `propValue` in the function signature
821
+ * 2. the type stored from `propType`.
822
+ *
823
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
824
+ *
825
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
826
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
827
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
828
+ * ```tsx
829
+ * <my-cmp prop-val={0}></my-cmp>
830
+ * ```
831
+ *
832
+ * HTML prop values on the other hand, will always a string
833
+ *
834
+ * @param propValue the new value to coerce to some type
835
+ * @param propType the type of the prop, expressed as a binary number
836
+ * @returns the parsed/coerced value
837
+ */
838
+ const parsePropertyValue = (propValue, propType) => {
839
+ // ensure this value is of the correct prop type
840
+ if (propValue != null && !isComplexType(propValue)) {
841
+ if (propType & 4 /* Boolean */) {
842
+ // per the HTML spec, any string value means it is a boolean true value
843
+ // but we'll cheat here and say that the string "false" is the boolean false
844
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
845
+ }
846
+ if (propType & 2 /* Number */) {
847
+ // force it to be a number
848
+ return parseFloat(propValue);
849
+ }
850
+ if (propType & 1 /* String */) {
851
+ // could have been passed as a number or boolean
852
+ // but we still want it as a string
853
+ return String(propValue);
854
+ }
855
+ // redundant return here for better minification
856
+ return propValue;
857
+ }
858
+ // not sure exactly what type we want
859
+ // so no need to change to a different type
860
+ return propValue;
861
+ };
862
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
863
+ const setValue = (ref, propName, newVal, cmpMeta) => {
864
+ // check our new property value against our internal value
865
+ const hostRef = getHostRef(ref);
866
+ const oldVal = hostRef.$instanceValues$.get(propName);
867
+ const flags = hostRef.$flags$;
868
+ const instance = hostRef.$lazyInstance$ ;
869
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
870
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
871
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
872
+ const didValueChange = newVal !== oldVal && !areBothNaN;
873
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
874
+ // gadzooks! the property's value has changed!!
875
+ // set our new value!
876
+ hostRef.$instanceValues$.set(propName, newVal);
877
+ if (instance) {
878
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
879
+ // looks like this value actually changed, so we've got work to do!
880
+ // but only if we've already rendered, otherwise just chill out
881
+ // queue that we need to do an update, but don't worry about queuing
882
+ // up millions cuz this function ensures it only runs once
883
+ scheduleUpdate(hostRef, false);
884
+ }
885
+ }
886
+ }
887
+ };
888
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
889
+ if (cmpMeta.$members$) {
890
+ // It's better to have a const than two Object.entries()
891
+ const members = Object.entries(cmpMeta.$members$);
892
+ const prototype = Cstr.prototype;
893
+ members.map(([memberName, [memberFlags]]) => {
894
+ if ((memberFlags & 31 /* Prop */ ||
895
+ ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
896
+ // proxyComponent - prop
897
+ Object.defineProperty(prototype, memberName, {
898
+ get() {
899
+ // proxyComponent, get value
900
+ return getValue(this, memberName);
901
+ },
902
+ set(newValue) {
903
+ // proxyComponent, set value
904
+ setValue(this, memberName, newValue, cmpMeta);
905
+ },
906
+ configurable: true,
907
+ enumerable: true,
908
+ });
909
+ }
910
+ });
911
+ if ((flags & 1 /* isElementConstructor */)) {
912
+ const attrNameToPropName = new Map();
913
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
914
+ plt.jmp(() => {
915
+ const propName = attrNameToPropName.get(attrName);
916
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
917
+ // in the case where an attribute was set inline.
918
+ // ```html
919
+ // <my-component some-attribute="some-value"></my-component>
920
+ // ```
921
+ //
922
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
923
+ // programmatically changes it before it has been upgraded as shown below:
924
+ //
925
+ // ```html
926
+ // <!-- this component has _not_ been upgraded yet -->
927
+ // <my-component id="test" some-attribute="some-value"></my-component>
928
+ // <script>
929
+ // // grab non-upgraded component
930
+ // el = document.querySelector("#test");
931
+ // el.someAttribute = "another-value";
932
+ // // upgrade component
933
+ // customElements.define('my-component', MyComponent);
934
+ // </script>
935
+ // ```
936
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
937
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
938
+ // to the value that was set inline i.e. "some-value" from above example. When
939
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
940
+ //
941
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
942
+ // by connectedCallback as this attributeChangedCallback will not fire.
943
+ //
944
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
945
+ //
946
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
947
+ // properties here given that this goes against best practices outlined here
948
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
949
+ if (this.hasOwnProperty(propName)) {
950
+ newValue = this[propName];
951
+ delete this[propName];
952
+ }
953
+ else if (prototype.hasOwnProperty(propName) &&
954
+ typeof this[propName] === 'number' &&
955
+ this[propName] == newValue) {
956
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
957
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
958
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
959
+ return;
960
+ }
961
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
962
+ });
963
+ };
964
+ // create an array of attributes to observe
965
+ // and also create a map of html attribute name to js property name
966
+ Cstr.observedAttributes = members
967
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
968
+ .map(([propName, m]) => {
969
+ const attrName = m[1] || propName;
970
+ attrNameToPropName.set(attrName, propName);
971
+ if (m[0] & 512 /* ReflectAttr */) {
972
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
973
+ }
974
+ return attrName;
975
+ });
976
+ }
977
+ }
978
+ return Cstr;
979
+ };
980
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
981
+ // initializeComponent
982
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
983
+ {
984
+ // we haven't initialized this element yet
985
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
986
+ // lazy loaded components
987
+ // request the component's implementation to be
988
+ // wired up with the host element
989
+ Cstr = loadModule(cmpMeta);
990
+ if (Cstr.then) {
991
+ // Await creates a micro-task avoid if possible
992
+ const endLoad = uniqueTime();
993
+ Cstr = await Cstr;
994
+ endLoad();
995
+ }
996
+ if (!Cstr.isProxied) {
997
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
998
+ Cstr.isProxied = true;
999
+ }
1000
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1001
+ // ok, time to construct the instance
1002
+ // but let's keep track of when we start and stop
1003
+ // so that the getters/setters don't incorrectly step on data
1004
+ {
1005
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1006
+ }
1007
+ // construct the lazy-loaded component implementation
1008
+ // passing the hostRef is very important during
1009
+ // construction in order to directly wire together the
1010
+ // host element and the lazy-loaded instance
1011
+ try {
1012
+ new Cstr(hostRef);
1013
+ }
1014
+ catch (e) {
1015
+ consoleError(e);
1016
+ }
1017
+ {
1018
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1019
+ }
1020
+ endNewInstance();
1021
+ }
1022
+ if (Cstr.style) {
1023
+ // this component has styles but we haven't registered them yet
1024
+ let style = Cstr.style;
1025
+ const scopeId = getScopeId(cmpMeta);
1026
+ if (!styles.has(scopeId)) {
1027
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1028
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1029
+ endRegisterStyles();
1030
+ }
1031
+ }
1032
+ }
1033
+ // we've successfully created a lazy instance
1034
+ const ancestorComponent = hostRef.$ancestorComponent$;
1035
+ const schedule = () => scheduleUpdate(hostRef, true);
1036
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1037
+ // this is the initial load and this component it has an ancestor component
1038
+ // but the ancestor component has NOT fired its will update lifecycle yet
1039
+ // so let's just cool our jets and wait for the ancestor to continue first
1040
+ // this will get fired off when the ancestor component
1041
+ // finally gets around to rendering its lazy self
1042
+ // fire off the initial update
1043
+ ancestorComponent['s-rc'].push(schedule);
1044
+ }
1045
+ else {
1046
+ schedule();
1047
+ }
1048
+ };
1049
+ const connectedCallback = (elm) => {
1050
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1051
+ const hostRef = getHostRef(elm);
1052
+ const cmpMeta = hostRef.$cmpMeta$;
1053
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1054
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1055
+ // first time this component has connected
1056
+ hostRef.$flags$ |= 1 /* hasConnected */;
1057
+ {
1058
+ // find the first ancestor component (if there is one) and register
1059
+ // this component as one of the actively loading child components for its ancestor
1060
+ let ancestorComponent = elm;
1061
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1062
+ // climb up the ancestors looking for the first
1063
+ // component that hasn't finished its lifecycle update yet
1064
+ if (ancestorComponent['s-p']) {
1065
+ // we found this components first ancestor component
1066
+ // keep a reference to this component's ancestor component
1067
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1068
+ break;
1069
+ }
1070
+ }
1071
+ }
1072
+ // Lazy properties
1073
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1074
+ if (cmpMeta.$members$) {
1075
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1076
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1077
+ const value = elm[memberName];
1078
+ delete elm[memberName];
1079
+ elm[memberName] = value;
1080
+ }
1081
+ });
1082
+ }
1083
+ {
1084
+ initializeComponent(elm, hostRef, cmpMeta);
1085
+ }
1086
+ }
1087
+ else {
1088
+ // not the first time this has connected
1089
+ // reattach any event listeners to the host
1090
+ // since they would have been removed when disconnected
1091
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1092
+ }
1093
+ endConnected();
1094
+ }
1095
+ };
1096
+ const disconnectedCallback = (elm) => {
1097
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1098
+ const hostRef = getHostRef(elm);
1099
+ const instance = hostRef.$lazyInstance$ ;
1100
+ {
1101
+ if (hostRef.$rmListeners$) {
1102
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1103
+ hostRef.$rmListeners$ = undefined;
1104
+ }
1105
+ }
1106
+ {
1107
+ safeCall(instance, 'disconnectedCallback');
1108
+ }
1109
+ }
1110
+ };
1111
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1112
+ const endBootstrap = createTime();
1113
+ const cmpTags = [];
1114
+ const exclude = options.exclude || [];
1115
+ const customElements = win.customElements;
1116
+ const head = doc.head;
1117
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1118
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1119
+ const deferredConnectedCallbacks = [];
1120
+ let appLoadFallback;
1121
+ let isBootstrapping = true;
1122
+ Object.assign(plt, options);
1123
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1124
+ lazyBundles.map((lazyBundle) => {
1125
+ lazyBundle[1].map((compactMeta) => {
1126
+ const cmpMeta = {
1127
+ $flags$: compactMeta[0],
1128
+ $tagName$: compactMeta[1],
1129
+ $members$: compactMeta[2],
1130
+ $listeners$: compactMeta[3],
1131
+ };
1132
+ {
1133
+ cmpMeta.$members$ = compactMeta[2];
1134
+ }
1135
+ {
1136
+ cmpMeta.$listeners$ = compactMeta[3];
1137
+ }
1138
+ {
1139
+ cmpMeta.$attrsToReflect$ = [];
1140
+ }
1141
+ const tagName = cmpMeta.$tagName$;
1142
+ const HostElement = class extends HTMLElement {
1143
+ // StencilLazyHost
1144
+ constructor(self) {
1145
+ // @ts-ignore
1146
+ super(self);
1147
+ self = this;
1148
+ registerHost(self, cmpMeta);
1149
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1150
+ // this component is using shadow dom
1151
+ // and this browser supports shadow dom
1152
+ // add the read-only property "shadowRoot" to the host element
1153
+ // adding the shadow root build conditionals to minimize runtime
1154
+ {
1155
+ {
1156
+ self.attachShadow({ mode: 'open' });
1157
+ }
1158
+ }
1159
+ }
1160
+ }
1161
+ connectedCallback() {
1162
+ if (appLoadFallback) {
1163
+ clearTimeout(appLoadFallback);
1164
+ appLoadFallback = null;
1165
+ }
1166
+ if (isBootstrapping) {
1167
+ // connectedCallback will be processed once all components have been registered
1168
+ deferredConnectedCallbacks.push(this);
1169
+ }
1170
+ else {
1171
+ plt.jmp(() => connectedCallback(this));
1172
+ }
1173
+ }
1174
+ disconnectedCallback() {
1175
+ plt.jmp(() => disconnectedCallback(this));
1176
+ }
1177
+ componentOnReady() {
1178
+ return getHostRef(this).$onReadyPromise$;
1179
+ }
1180
+ };
1181
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1182
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1183
+ cmpTags.push(tagName);
1184
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1185
+ }
1186
+ });
1187
+ });
1188
+ {
1189
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1190
+ visibilityStyle.setAttribute('data-styles', '');
1191
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1192
+ }
1193
+ // Process deferred connectedCallbacks now all components have been registered
1194
+ isBootstrapping = false;
1195
+ if (deferredConnectedCallbacks.length) {
1196
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1197
+ }
1198
+ else {
1199
+ {
1200
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1201
+ }
1202
+ }
1203
+ // Fallback appLoad event
1204
+ endBootstrap();
1205
+ };
1206
+ const hostRefs = new WeakMap();
1207
+ const getHostRef = (ref) => hostRefs.get(ref);
1208
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1209
+ const registerHost = (elm, cmpMeta) => {
1210
+ const hostRef = {
1211
+ $flags$: 0,
1212
+ $hostElement$: elm,
1213
+ $cmpMeta$: cmpMeta,
1214
+ $instanceValues$: new Map(),
1215
+ };
1216
+ {
1217
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1218
+ elm['s-p'] = [];
1219
+ elm['s-rc'] = [];
1220
+ }
1221
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1222
+ return hostRefs.set(elm, hostRef);
1223
+ };
1224
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1225
+ const consoleError = (e, el) => (0, console.error)(e, el);
1226
+ const cmpModules = /*@__PURE__*/ new Map();
1227
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1228
+ // loadModuleImport
1229
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1230
+ const bundleId = cmpMeta.$lazyBundleId$;
1231
+ const module = cmpModules.get(bundleId) ;
1232
+ if (module) {
1233
+ return module[exportName];
1234
+ }
1235
+ return import(
1236
+ /* webpackInclude: /\.entry\.js$/ */
1237
+ /* webpackExclude: /\.system\.entry\.js$/ */
1238
+ /* webpackMode: "lazy" */
1239
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
1240
+ {
1241
+ cmpModules.set(bundleId, importedModule);
1242
+ }
1243
+ return importedModule[exportName];
1244
+ }, consoleError);
1245
+ };
1246
+ const styles = new Map();
1247
+ const queueDomReads = [];
1248
+ const queueDomWrites = [];
1249
+ const queueTask = (queue, write) => (cb) => {
1250
+ queue.push(cb);
1251
+ if (!queuePending) {
1252
+ queuePending = true;
1253
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1254
+ nextTick(flush);
1255
+ }
1256
+ else {
1257
+ plt.raf(flush);
1258
+ }
1259
+ }
1260
+ };
1261
+ const consume = (queue) => {
1262
+ for (let i = 0; i < queue.length; i++) {
1263
+ try {
1264
+ queue[i](performance.now());
1265
+ }
1266
+ catch (e) {
1267
+ consoleError(e);
1268
+ }
1269
+ }
1270
+ queue.length = 0;
1271
+ };
1272
+ const flush = () => {
1273
+ // always force a bunch of medium callbacks to run, but still have
1274
+ // a throttle on how many can run in a certain time
1275
+ // DOM READS!!!
1276
+ consume(queueDomReads);
1277
+ // DOM WRITES!!!
1278
+ {
1279
+ consume(queueDomWrites);
1280
+ if ((queuePending = queueDomReads.length > 0)) {
1281
+ // still more to do yet, but we've run out of time
1282
+ // let's let this thing cool off and try again in the next tick
1283
+ plt.raf(flush);
1284
+ }
1285
+ }
1286
+ };
1287
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1288
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1289
+
1290
+ export { bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };