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