@everymatrix/casino-engagement-suite-challenges-list 1.35.0

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