@everymatrix/lottery-grid 0.0.3

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