@everymatrix/helper-filters 0.0.3

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