@everymatrix/casino-tournament-banner 1.16.1

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