@everymatrix/casino-engagement-suite-container 1.35.0

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