sentikit-webcomponents 0.1.3

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