proto-table-wc 0.0.501 → 0.0.503

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1112 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () {
13
+ return e[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n['default'] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ const NAMESPACE = 'proto-table-wc';
24
+
25
+ /*
26
+ Stencil Client Platform v4.17.0 | MIT Licensed | https://stenciljs.com
27
+ */
28
+ var __defProp = Object.defineProperty;
29
+ var __export = (target, all) => {
30
+ for (var name in all)
31
+ __defProp(target, name, { get: all[name], enumerable: true });
32
+ };
33
+
34
+ // src/utils/constants.ts
35
+ var EMPTY_OBJ = {};
36
+ var SVG_NS = "http://www.w3.org/2000/svg";
37
+ var HTML_NS = "http://www.w3.org/1999/xhtml";
38
+
39
+ // src/utils/helpers.ts
40
+ var isDef = (v) => v != null;
41
+ var isComplexType = (o) => {
42
+ o = typeof o;
43
+ return o === "object" || o === "function";
44
+ };
45
+
46
+ // src/utils/query-nonce-meta-tag-content.ts
47
+ function queryNonceMetaTagContent(doc2) {
48
+ var _a, _b, _c;
49
+ return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
50
+ }
51
+
52
+ // src/utils/result.ts
53
+ var result_exports = {};
54
+ __export(result_exports, {
55
+ err: () => err,
56
+ map: () => map,
57
+ ok: () => ok,
58
+ unwrap: () => unwrap,
59
+ unwrapErr: () => unwrapErr
60
+ });
61
+ var ok = (value) => ({
62
+ isOk: true,
63
+ isErr: false,
64
+ value
65
+ });
66
+ var err = (value) => ({
67
+ isOk: false,
68
+ isErr: true,
69
+ value
70
+ });
71
+ function map(result, fn) {
72
+ if (result.isOk) {
73
+ const val = fn(result.value);
74
+ if (val instanceof Promise) {
75
+ return val.then((newVal) => ok(newVal));
76
+ } else {
77
+ return ok(val);
78
+ }
79
+ }
80
+ if (result.isErr) {
81
+ const value = result.value;
82
+ return err(value);
83
+ }
84
+ throw "should never get here";
85
+ }
86
+ var unwrap = (result) => {
87
+ if (result.isOk) {
88
+ return result.value;
89
+ } else {
90
+ throw result.value;
91
+ }
92
+ };
93
+ var unwrapErr = (result) => {
94
+ if (result.isErr) {
95
+ return result.value;
96
+ } else {
97
+ throw result.value;
98
+ }
99
+ };
100
+ var createTime = (fnName, tagName = "") => {
101
+ {
102
+ return () => {
103
+ return;
104
+ };
105
+ }
106
+ };
107
+ var uniqueTime = (key, measureText) => {
108
+ {
109
+ return () => {
110
+ return;
111
+ };
112
+ }
113
+ };
114
+ var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
115
+ var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
116
+ var h = (nodeName, vnodeData, ...children) => {
117
+ let child = null;
118
+ let key = null;
119
+ let simple = false;
120
+ let lastSimple = false;
121
+ const vNodeChildren = [];
122
+ const walk = (c) => {
123
+ for (let i2 = 0; i2 < c.length; i2++) {
124
+ child = c[i2];
125
+ if (Array.isArray(child)) {
126
+ walk(child);
127
+ } else if (child != null && typeof child !== "boolean") {
128
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
129
+ child = String(child);
130
+ }
131
+ if (simple && lastSimple) {
132
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
133
+ } else {
134
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
135
+ }
136
+ lastSimple = simple;
137
+ }
138
+ }
139
+ };
140
+ walk(children);
141
+ if (vnodeData) {
142
+ if (vnodeData.key) {
143
+ key = vnodeData.key;
144
+ }
145
+ {
146
+ const classData = vnodeData.className || vnodeData.class;
147
+ if (classData) {
148
+ vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
149
+ }
150
+ }
151
+ }
152
+ const vnode = newVNode(nodeName, null);
153
+ vnode.$attrs$ = vnodeData;
154
+ if (vNodeChildren.length > 0) {
155
+ vnode.$children$ = vNodeChildren;
156
+ }
157
+ {
158
+ vnode.$key$ = key;
159
+ }
160
+ return vnode;
161
+ };
162
+ var newVNode = (tag, text) => {
163
+ const vnode = {
164
+ $flags$: 0,
165
+ $tag$: tag,
166
+ $text$: text,
167
+ $elm$: null,
168
+ $children$: null
169
+ };
170
+ {
171
+ vnode.$attrs$ = null;
172
+ }
173
+ {
174
+ vnode.$key$ = null;
175
+ }
176
+ return vnode;
177
+ };
178
+ var Host = {};
179
+ var isHost = (node) => node && node.$tag$ === Host;
180
+ var parsePropertyValue = (propValue, propType) => {
181
+ if (propValue != null && !isComplexType(propValue)) {
182
+ return propValue;
183
+ }
184
+ return propValue;
185
+ };
186
+ var emitEvent = (elm, name, opts) => {
187
+ const ev = plt.ce(name, opts);
188
+ elm.dispatchEvent(ev);
189
+ return ev;
190
+ };
191
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
192
+ var registerStyle = (scopeId2, cssText, allowCS) => {
193
+ let style = styles.get(scopeId2);
194
+ if (supportsConstructableStylesheets && allowCS) {
195
+ style = style || new CSSStyleSheet();
196
+ if (typeof style === "string") {
197
+ style = cssText;
198
+ } else {
199
+ style.replaceSync(cssText);
200
+ }
201
+ } else {
202
+ style = cssText;
203
+ }
204
+ styles.set(scopeId2, style);
205
+ };
206
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
207
+ var _a;
208
+ const scopeId2 = getScopeId(cmpMeta);
209
+ const style = styles.get(scopeId2);
210
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
211
+ if (style) {
212
+ if (typeof style === "string") {
213
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
214
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
215
+ let styleElm;
216
+ if (!appliedStyles) {
217
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
218
+ }
219
+ if (!appliedStyles.has(scopeId2)) {
220
+ {
221
+ styleElm = doc.createElement("style");
222
+ styleElm.innerHTML = style;
223
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
224
+ if (nonce != null) {
225
+ styleElm.setAttribute("nonce", nonce);
226
+ }
227
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
228
+ }
229
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
230
+ styleElm.innerHTML += SLOT_FB_CSS;
231
+ }
232
+ if (appliedStyles) {
233
+ appliedStyles.add(scopeId2);
234
+ }
235
+ }
236
+ } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
237
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
238
+ }
239
+ }
240
+ return scopeId2;
241
+ };
242
+ var attachStyles = (hostRef) => {
243
+ const cmpMeta = hostRef.$cmpMeta$;
244
+ const elm = hostRef.$hostElement$;
245
+ const flags = cmpMeta.$flags$;
246
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
247
+ const scopeId2 = addStyle(
248
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
249
+ cmpMeta);
250
+ if (flags & 10 /* needsScopedEncapsulation */) {
251
+ elm["s-sc"] = scopeId2;
252
+ elm.classList.add(scopeId2 + "-h");
253
+ }
254
+ endAttachStyles();
255
+ };
256
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
257
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
258
+ if (oldValue !== newValue) {
259
+ let isProp = isMemberInElement(elm, memberName);
260
+ let ln = memberName.toLowerCase();
261
+ if (memberName === "class") {
262
+ const classList = elm.classList;
263
+ const oldClasses = parseClassList(oldValue);
264
+ const newClasses = parseClassList(newValue);
265
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
266
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
267
+ } else if (memberName === "key") ; else if (memberName === "ref") {
268
+ if (newValue) {
269
+ newValue(elm);
270
+ }
271
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
272
+ if (memberName[2] === "-") {
273
+ memberName = memberName.slice(3);
274
+ } else if (isMemberInElement(win, ln)) {
275
+ memberName = ln.slice(2);
276
+ } else {
277
+ memberName = ln[2] + memberName.slice(3);
278
+ }
279
+ if (oldValue || newValue) {
280
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
281
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
282
+ if (oldValue) {
283
+ plt.rel(elm, memberName, oldValue, capture);
284
+ }
285
+ if (newValue) {
286
+ plt.ael(elm, memberName, newValue, capture);
287
+ }
288
+ }
289
+ } else {
290
+ const isComplex = isComplexType(newValue);
291
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
292
+ try {
293
+ if (!elm.tagName.includes("-")) {
294
+ const n = newValue == null ? "" : newValue;
295
+ if (memberName === "list") {
296
+ isProp = false;
297
+ } else if (oldValue == null || elm[memberName] != n) {
298
+ elm[memberName] = n;
299
+ }
300
+ } else {
301
+ elm[memberName] = newValue;
302
+ }
303
+ } catch (e) {
304
+ }
305
+ }
306
+ if (newValue == null || newValue === false) {
307
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
308
+ {
309
+ elm.removeAttribute(memberName);
310
+ }
311
+ }
312
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
313
+ newValue = newValue === true ? "" : newValue;
314
+ {
315
+ elm.setAttribute(memberName, newValue);
316
+ }
317
+ }
318
+ }
319
+ }
320
+ };
321
+ var parseClassListRegex = /\s/;
322
+ var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
323
+ var CAPTURE_EVENT_SUFFIX = "Capture";
324
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
325
+
326
+ // src/runtime/vdom/update-element.ts
327
+ var updateElement = (oldVnode, newVnode, isSvgMode2, memberName) => {
328
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
329
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
330
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
331
+ {
332
+ for (memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
333
+ if (!(memberName in newVnodeAttrs)) {
334
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
335
+ }
336
+ }
337
+ }
338
+ for (memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
339
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
340
+ }
341
+ };
342
+ function sortedAttrNames(attrNames) {
343
+ return attrNames.includes("ref") ? (
344
+ // we need to sort these to ensure that `'ref'` is the last attr
345
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
346
+ ) : (
347
+ // no need to sort, return the original array
348
+ attrNames
349
+ );
350
+ }
351
+
352
+ // src/runtime/vdom/vdom-render.ts
353
+ var scopeId;
354
+ var hostTagName;
355
+ var isSvgMode = false;
356
+ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
357
+ const newVNode2 = newParentVNode.$children$[childIndex];
358
+ let i2 = 0;
359
+ let elm;
360
+ let childNode;
361
+ if (newVNode2.$text$ !== null) {
362
+ elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
363
+ } else {
364
+ if (!isSvgMode) {
365
+ isSvgMode = newVNode2.$tag$ === "svg";
366
+ }
367
+ elm = newVNode2.$elm$ = doc.createElementNS(
368
+ isSvgMode ? SVG_NS : HTML_NS,
369
+ newVNode2.$tag$
370
+ ) ;
371
+ if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
372
+ isSvgMode = false;
373
+ }
374
+ {
375
+ updateElement(null, newVNode2, isSvgMode);
376
+ }
377
+ if (isDef(scopeId) && elm["s-si"] !== scopeId) {
378
+ elm.classList.add(elm["s-si"] = scopeId);
379
+ }
380
+ if (newVNode2.$children$) {
381
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
382
+ childNode = createElm(oldParentVNode, newVNode2, i2);
383
+ if (childNode) {
384
+ elm.appendChild(childNode);
385
+ }
386
+ }
387
+ }
388
+ {
389
+ if (newVNode2.$tag$ === "svg") {
390
+ isSvgMode = false;
391
+ } else if (elm.tagName === "foreignObject") {
392
+ isSvgMode = true;
393
+ }
394
+ }
395
+ }
396
+ elm["s-hn"] = hostTagName;
397
+ return elm;
398
+ };
399
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
400
+ let containerElm = parentElm;
401
+ let childNode;
402
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
403
+ containerElm = containerElm.shadowRoot;
404
+ }
405
+ for (; startIdx <= endIdx; ++startIdx) {
406
+ if (vnodes[startIdx]) {
407
+ childNode = createElm(null, parentVNode, startIdx);
408
+ if (childNode) {
409
+ vnodes[startIdx].$elm$ = childNode;
410
+ containerElm.insertBefore(childNode, before);
411
+ }
412
+ }
413
+ }
414
+ };
415
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
416
+ for (let index = startIdx; index <= endIdx; ++index) {
417
+ const vnode = vnodes[index];
418
+ if (vnode) {
419
+ const elm = vnode.$elm$;
420
+ nullifyVNodeRefs(vnode);
421
+ if (elm) {
422
+ elm.remove();
423
+ }
424
+ }
425
+ }
426
+ };
427
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
428
+ let oldStartIdx = 0;
429
+ let newStartIdx = 0;
430
+ let idxInOld = 0;
431
+ let i2 = 0;
432
+ let oldEndIdx = oldCh.length - 1;
433
+ let oldStartVnode = oldCh[0];
434
+ let oldEndVnode = oldCh[oldEndIdx];
435
+ let newEndIdx = newCh.length - 1;
436
+ let newStartVnode = newCh[0];
437
+ let newEndVnode = newCh[newEndIdx];
438
+ let node;
439
+ let elmToMove;
440
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
441
+ if (oldStartVnode == null) {
442
+ oldStartVnode = oldCh[++oldStartIdx];
443
+ } else if (oldEndVnode == null) {
444
+ oldEndVnode = oldCh[--oldEndIdx];
445
+ } else if (newStartVnode == null) {
446
+ newStartVnode = newCh[++newStartIdx];
447
+ } else if (newEndVnode == null) {
448
+ newEndVnode = newCh[--newEndIdx];
449
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
450
+ patch(oldStartVnode, newStartVnode, isInitialRender);
451
+ oldStartVnode = oldCh[++oldStartIdx];
452
+ newStartVnode = newCh[++newStartIdx];
453
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
454
+ patch(oldEndVnode, newEndVnode, isInitialRender);
455
+ oldEndVnode = oldCh[--oldEndIdx];
456
+ newEndVnode = newCh[--newEndIdx];
457
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
458
+ patch(oldStartVnode, newEndVnode, isInitialRender);
459
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
460
+ oldStartVnode = oldCh[++oldStartIdx];
461
+ newEndVnode = newCh[--newEndIdx];
462
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
463
+ patch(oldEndVnode, newStartVnode, isInitialRender);
464
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
465
+ oldEndVnode = oldCh[--oldEndIdx];
466
+ newStartVnode = newCh[++newStartIdx];
467
+ } else {
468
+ idxInOld = -1;
469
+ {
470
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
471
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
472
+ idxInOld = i2;
473
+ break;
474
+ }
475
+ }
476
+ }
477
+ if (idxInOld >= 0) {
478
+ elmToMove = oldCh[idxInOld];
479
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
480
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
481
+ } else {
482
+ patch(elmToMove, newStartVnode, isInitialRender);
483
+ oldCh[idxInOld] = void 0;
484
+ node = elmToMove.$elm$;
485
+ }
486
+ newStartVnode = newCh[++newStartIdx];
487
+ } else {
488
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
489
+ newStartVnode = newCh[++newStartIdx];
490
+ }
491
+ if (node) {
492
+ {
493
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
494
+ }
495
+ }
496
+ }
497
+ }
498
+ if (oldStartIdx > oldEndIdx) {
499
+ addVnodes(
500
+ parentElm,
501
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
502
+ newVNode2,
503
+ newCh,
504
+ newStartIdx,
505
+ newEndIdx
506
+ );
507
+ } else if (newStartIdx > newEndIdx) {
508
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
509
+ }
510
+ };
511
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
512
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
513
+ if (!isInitialRender) {
514
+ return leftVNode.$key$ === rightVNode.$key$;
515
+ }
516
+ return true;
517
+ }
518
+ return false;
519
+ };
520
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
521
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
522
+ const oldChildren = oldVNode.$children$;
523
+ const newChildren = newVNode2.$children$;
524
+ const tag = newVNode2.$tag$;
525
+ const text = newVNode2.$text$;
526
+ if (text === null) {
527
+ {
528
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
529
+ }
530
+ {
531
+ {
532
+ updateElement(oldVNode, newVNode2, isSvgMode);
533
+ }
534
+ }
535
+ if (oldChildren !== null && newChildren !== null) {
536
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
537
+ } else if (newChildren !== null) {
538
+ if (oldVNode.$text$ !== null) {
539
+ elm.textContent = "";
540
+ }
541
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
542
+ } else if (oldChildren !== null) {
543
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
544
+ }
545
+ if (isSvgMode && tag === "svg") {
546
+ isSvgMode = false;
547
+ }
548
+ } else if (oldVNode.$text$ !== text) {
549
+ elm.data = text;
550
+ }
551
+ };
552
+ var nullifyVNodeRefs = (vNode) => {
553
+ {
554
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
555
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
556
+ }
557
+ };
558
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
559
+ const hostElm = hostRef.$hostElement$;
560
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
561
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
562
+ hostTagName = hostElm.tagName;
563
+ if (isInitialLoad && rootVnode.$attrs$) {
564
+ for (const key of Object.keys(rootVnode.$attrs$)) {
565
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
566
+ rootVnode.$attrs$[key] = hostElm[key];
567
+ }
568
+ }
569
+ }
570
+ rootVnode.$tag$ = null;
571
+ rootVnode.$flags$ |= 4 /* isHost */;
572
+ hostRef.$vnode$ = rootVnode;
573
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
574
+ {
575
+ scopeId = hostElm["s-sc"];
576
+ }
577
+ patch(oldVNode, rootVnode, isInitialLoad);
578
+ };
579
+
580
+ // src/runtime/update-component.ts
581
+ var attachToAncestor = (hostRef, ancestorComponent) => {
582
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
583
+ ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
584
+ }
585
+ };
586
+ var scheduleUpdate = (hostRef, isInitialLoad) => {
587
+ {
588
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
589
+ }
590
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
591
+ hostRef.$flags$ |= 512 /* needsRerender */;
592
+ return;
593
+ }
594
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
595
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
596
+ return writeTask(dispatch) ;
597
+ };
598
+ var dispatchHooks = (hostRef, isInitialLoad) => {
599
+ const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
600
+ const instance = hostRef.$lazyInstance$ ;
601
+ let maybePromise;
602
+ if (isInitialLoad) {
603
+ {
604
+ maybePromise = safeCall(instance, "componentWillLoad");
605
+ }
606
+ }
607
+ endSchedule();
608
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
609
+ };
610
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
611
+ var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
612
+ var updateComponent = async (hostRef, instance, isInitialLoad) => {
613
+ var _a;
614
+ const elm = hostRef.$hostElement$;
615
+ const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
616
+ const rc = elm["s-rc"];
617
+ if (isInitialLoad) {
618
+ attachStyles(hostRef);
619
+ }
620
+ const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
621
+ {
622
+ callRender(hostRef, instance, elm, isInitialLoad);
623
+ }
624
+ if (rc) {
625
+ rc.map((cb) => cb());
626
+ elm["s-rc"] = void 0;
627
+ }
628
+ endRender();
629
+ endUpdate();
630
+ {
631
+ const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
632
+ const postUpdate = () => postUpdateComponent(hostRef);
633
+ if (childrenPromises.length === 0) {
634
+ postUpdate();
635
+ } else {
636
+ Promise.all(childrenPromises).then(postUpdate);
637
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
638
+ childrenPromises.length = 0;
639
+ }
640
+ }
641
+ };
642
+ var callRender = (hostRef, instance, elm, isInitialLoad) => {
643
+ try {
644
+ instance = instance.render() ;
645
+ {
646
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
647
+ }
648
+ {
649
+ hostRef.$flags$ |= 2 /* hasRendered */;
650
+ }
651
+ {
652
+ {
653
+ {
654
+ renderVdom(hostRef, instance, isInitialLoad);
655
+ }
656
+ }
657
+ }
658
+ } catch (e) {
659
+ consoleError(e, hostRef.$hostElement$);
660
+ }
661
+ return null;
662
+ };
663
+ var postUpdateComponent = (hostRef) => {
664
+ const tagName = hostRef.$cmpMeta$.$tagName$;
665
+ const elm = hostRef.$hostElement$;
666
+ const endPostUpdate = createTime("postUpdate", tagName);
667
+ const instance = hostRef.$lazyInstance$ ;
668
+ const ancestorComponent = hostRef.$ancestorComponent$;
669
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
670
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
671
+ {
672
+ addHydratedFlag(elm);
673
+ }
674
+ {
675
+ safeCall(instance, "componentDidLoad");
676
+ }
677
+ endPostUpdate();
678
+ {
679
+ hostRef.$onReadyResolve$(elm);
680
+ if (!ancestorComponent) {
681
+ appDidLoad();
682
+ }
683
+ }
684
+ } else {
685
+ endPostUpdate();
686
+ }
687
+ {
688
+ if (hostRef.$onRenderResolve$) {
689
+ hostRef.$onRenderResolve$();
690
+ hostRef.$onRenderResolve$ = void 0;
691
+ }
692
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
693
+ nextTick(() => scheduleUpdate(hostRef, false));
694
+ }
695
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
696
+ }
697
+ };
698
+ var appDidLoad = (who) => {
699
+ {
700
+ addHydratedFlag(doc.documentElement);
701
+ }
702
+ nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
703
+ };
704
+ var safeCall = (instance, method, arg) => {
705
+ if (instance && instance[method]) {
706
+ try {
707
+ return instance[method](arg);
708
+ } catch (e) {
709
+ consoleError(e);
710
+ }
711
+ }
712
+ return void 0;
713
+ };
714
+ var addHydratedFlag = (elm) => elm.classList.add("hydrated") ;
715
+
716
+ // src/runtime/set-value.ts
717
+ var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
718
+ var setValue = (ref, propName, newVal, cmpMeta) => {
719
+ const hostRef = getHostRef(ref);
720
+ const oldVal = hostRef.$instanceValues$.get(propName);
721
+ const flags = hostRef.$flags$;
722
+ const instance = hostRef.$lazyInstance$ ;
723
+ newVal = parsePropertyValue(newVal);
724
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
725
+ const didValueChange = newVal !== oldVal && !areBothNaN;
726
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
727
+ hostRef.$instanceValues$.set(propName, newVal);
728
+ if (instance) {
729
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
730
+ scheduleUpdate(hostRef, false);
731
+ }
732
+ }
733
+ }
734
+ };
735
+
736
+ // src/runtime/proxy-component.ts
737
+ var proxyComponent = (Cstr, cmpMeta, flags) => {
738
+ var _a;
739
+ const prototype = Cstr.prototype;
740
+ if (cmpMeta.$members$) {
741
+ const members = Object.entries(cmpMeta.$members$);
742
+ members.map(([memberName, [memberFlags]]) => {
743
+ if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
744
+ Object.defineProperty(prototype, memberName, {
745
+ get() {
746
+ return getValue(this, memberName);
747
+ },
748
+ set(newValue) {
749
+ setValue(this, memberName, newValue);
750
+ },
751
+ configurable: true,
752
+ enumerable: true
753
+ });
754
+ }
755
+ });
756
+ if ((flags & 1 /* isElementConstructor */)) {
757
+ const attrNameToPropName = /* @__PURE__ */ new Map();
758
+ prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
759
+ plt.jmp(() => {
760
+ var _a2;
761
+ const propName = attrNameToPropName.get(attrName);
762
+ if (this.hasOwnProperty(propName)) {
763
+ newValue = this[propName];
764
+ delete this[propName];
765
+ } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && this[propName] == newValue) {
766
+ return;
767
+ } else if (propName == null) {
768
+ const hostRef = getHostRef(this);
769
+ const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
770
+ if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
771
+ const instance = hostRef.$lazyInstance$ ;
772
+ const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
773
+ entry == null ? void 0 : entry.forEach((callbackName) => {
774
+ if (instance[callbackName] != null) {
775
+ instance[callbackName].call(instance, newValue, oldValue, attrName);
776
+ }
777
+ });
778
+ }
779
+ return;
780
+ }
781
+ this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
782
+ });
783
+ };
784
+ Cstr.observedAttributes = Array.from(
785
+ /* @__PURE__ */ new Set([
786
+ ...Object.keys((_a = cmpMeta.$watchers$) != null ? _a : {}),
787
+ ...members.filter(([_, m]) => m[0] & 15 /* HasAttribute */).map(([propName, m]) => {
788
+ const attrName = m[1] || propName;
789
+ attrNameToPropName.set(attrName, propName);
790
+ return attrName;
791
+ })
792
+ ])
793
+ );
794
+ }
795
+ }
796
+ return Cstr;
797
+ };
798
+
799
+ // src/runtime/initialize-component.ts
800
+ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
801
+ let Cstr;
802
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
803
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
804
+ const bundleId = cmpMeta.$lazyBundleId$;
805
+ if (bundleId) {
806
+ Cstr = loadModule(cmpMeta);
807
+ if (Cstr.then) {
808
+ const endLoad = uniqueTime();
809
+ Cstr = await Cstr;
810
+ endLoad();
811
+ }
812
+ if (!Cstr.isProxied) {
813
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
814
+ Cstr.isProxied = true;
815
+ }
816
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
817
+ {
818
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
819
+ }
820
+ try {
821
+ new Cstr(hostRef);
822
+ } catch (e) {
823
+ consoleError(e);
824
+ }
825
+ {
826
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
827
+ }
828
+ endNewInstance();
829
+ } else {
830
+ Cstr = elm.constructor;
831
+ customElements.whenDefined(cmpMeta.$tagName$).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
832
+ }
833
+ if (Cstr.style) {
834
+ let style = Cstr.style;
835
+ const scopeId2 = getScopeId(cmpMeta);
836
+ if (!styles.has(scopeId2)) {
837
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
838
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
839
+ endRegisterStyles();
840
+ }
841
+ }
842
+ }
843
+ const ancestorComponent = hostRef.$ancestorComponent$;
844
+ const schedule = () => scheduleUpdate(hostRef, true);
845
+ if (ancestorComponent && ancestorComponent["s-rc"]) {
846
+ ancestorComponent["s-rc"].push(schedule);
847
+ } else {
848
+ schedule();
849
+ }
850
+ };
851
+ var fireConnectedCallback = (instance) => {
852
+ };
853
+
854
+ // src/runtime/connected-callback.ts
855
+ var connectedCallback = (elm) => {
856
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
857
+ const hostRef = getHostRef(elm);
858
+ const cmpMeta = hostRef.$cmpMeta$;
859
+ const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
860
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
861
+ hostRef.$flags$ |= 1 /* hasConnected */;
862
+ {
863
+ let ancestorComponent = elm;
864
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
865
+ if (ancestorComponent["s-p"]) {
866
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
867
+ break;
868
+ }
869
+ }
870
+ }
871
+ if (cmpMeta.$members$) {
872
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
873
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
874
+ const value = elm[memberName];
875
+ delete elm[memberName];
876
+ elm[memberName] = value;
877
+ }
878
+ });
879
+ }
880
+ {
881
+ initializeComponent(elm, hostRef, cmpMeta);
882
+ }
883
+ } else {
884
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
885
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
886
+ }
887
+ }
888
+ endConnected();
889
+ }
890
+ };
891
+ var disconnectInstance = (instance) => {
892
+ };
893
+ var disconnectedCallback = async (elm) => {
894
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
895
+ const hostRef = getHostRef(elm);
896
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
897
+ hostRef.$onReadyPromise$.then(() => disconnectInstance());
898
+ }
899
+ }
900
+ };
901
+
902
+ // src/runtime/bootstrap-lazy.ts
903
+ var bootstrapLazy = (lazyBundles, options = {}) => {
904
+ var _a;
905
+ const endBootstrap = createTime();
906
+ const cmpTags = [];
907
+ const exclude = options.exclude || [];
908
+ const customElements2 = win.customElements;
909
+ const head = doc.head;
910
+ const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
911
+ const dataStyles = /* @__PURE__ */ doc.createElement("style");
912
+ const deferredConnectedCallbacks = [];
913
+ let appLoadFallback;
914
+ let isBootstrapping = true;
915
+ Object.assign(plt, options);
916
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
917
+ let hasSlotRelocation = false;
918
+ lazyBundles.map((lazyBundle) => {
919
+ lazyBundle[1].map((compactMeta) => {
920
+ const cmpMeta = {
921
+ $flags$: compactMeta[0],
922
+ $tagName$: compactMeta[1],
923
+ $members$: compactMeta[2],
924
+ $listeners$: compactMeta[3]
925
+ };
926
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
927
+ hasSlotRelocation = true;
928
+ }
929
+ {
930
+ cmpMeta.$members$ = compactMeta[2];
931
+ }
932
+ const tagName = cmpMeta.$tagName$;
933
+ const HostElement = class extends HTMLElement {
934
+ // StencilLazyHost
935
+ constructor(self) {
936
+ super(self);
937
+ self = this;
938
+ registerHost(self, cmpMeta);
939
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
940
+ {
941
+ {
942
+ self.attachShadow({ mode: "open" });
943
+ }
944
+ }
945
+ }
946
+ }
947
+ connectedCallback() {
948
+ if (appLoadFallback) {
949
+ clearTimeout(appLoadFallback);
950
+ appLoadFallback = null;
951
+ }
952
+ if (isBootstrapping) {
953
+ deferredConnectedCallbacks.push(this);
954
+ } else {
955
+ plt.jmp(() => connectedCallback(this));
956
+ }
957
+ }
958
+ disconnectedCallback() {
959
+ plt.jmp(() => disconnectedCallback(this));
960
+ }
961
+ componentOnReady() {
962
+ return getHostRef(this).$onReadyPromise$;
963
+ }
964
+ };
965
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
966
+ if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
967
+ cmpTags.push(tagName);
968
+ customElements2.define(
969
+ tagName,
970
+ proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)
971
+ );
972
+ }
973
+ });
974
+ });
975
+ if (cmpTags.length > 0) {
976
+ if (hasSlotRelocation) {
977
+ dataStyles.textContent += SLOT_FB_CSS;
978
+ }
979
+ {
980
+ dataStyles.textContent += cmpTags + HYDRATED_CSS;
981
+ }
982
+ if (dataStyles.innerHTML.length) {
983
+ dataStyles.setAttribute("data-styles", "");
984
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
985
+ if (nonce != null) {
986
+ dataStyles.setAttribute("nonce", nonce);
987
+ }
988
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
989
+ }
990
+ }
991
+ isBootstrapping = false;
992
+ if (deferredConnectedCallbacks.length) {
993
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
994
+ } else {
995
+ {
996
+ plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
997
+ }
998
+ }
999
+ endBootstrap();
1000
+ };
1001
+
1002
+ // src/runtime/nonce.ts
1003
+ var setNonce = (nonce) => plt.$nonce$ = nonce;
1004
+
1005
+ // src/client/client-host-ref.ts
1006
+ var hostRefs = /* @__PURE__ */ new WeakMap();
1007
+ var getHostRef = (ref) => hostRefs.get(ref);
1008
+ var registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
1009
+ var registerHost = (hostElement, cmpMeta) => {
1010
+ const hostRef = {
1011
+ $flags$: 0,
1012
+ $hostElement$: hostElement,
1013
+ $cmpMeta$: cmpMeta,
1014
+ $instanceValues$: /* @__PURE__ */ new Map()
1015
+ };
1016
+ {
1017
+ hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
1018
+ hostElement["s-p"] = [];
1019
+ hostElement["s-rc"] = [];
1020
+ }
1021
+ return hostRefs.set(hostElement, hostRef);
1022
+ };
1023
+ var isMemberInElement = (elm, memberName) => memberName in elm;
1024
+ var consoleError = (e, el) => (0, console.error)(e, el);
1025
+
1026
+ // src/client/client-load-module.ts
1027
+ var cmpModules = /* @__PURE__ */ new Map();
1028
+ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1029
+ const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
1030
+ const bundleId = cmpMeta.$lazyBundleId$;
1031
+ const module = cmpModules.get(bundleId) ;
1032
+ if (module) {
1033
+ return module[exportName];
1034
+ }
1035
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1036
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1037
+ /* @vite-ignore */
1038
+ /* webpackInclude: /\.entry\.js$/ */
1039
+ /* webpackExclude: /\.system\.entry\.js$/ */
1040
+ /* webpackMode: "lazy" */
1041
+ `./${bundleId}.entry.js${""}`
1042
+ )); }).then((importedModule) => {
1043
+ {
1044
+ cmpModules.set(bundleId, importedModule);
1045
+ }
1046
+ return importedModule[exportName];
1047
+ }, consoleError);
1048
+ };
1049
+
1050
+ // src/client/client-style.ts
1051
+ var styles = /* @__PURE__ */ new Map();
1052
+ var win = typeof window !== "undefined" ? window : {};
1053
+ var doc = win.document || { head: {} };
1054
+ var plt = {
1055
+ $flags$: 0,
1056
+ $resourcesUrl$: "",
1057
+ jmp: (h2) => h2(),
1058
+ raf: (h2) => requestAnimationFrame(h2),
1059
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1060
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1061
+ ce: (eventName, opts) => new CustomEvent(eventName, opts)
1062
+ };
1063
+ var promiseResolve = (v) => Promise.resolve(v);
1064
+ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
1065
+ try {
1066
+ new CSSStyleSheet();
1067
+ return typeof new CSSStyleSheet().replaceSync === "function";
1068
+ } catch (e) {
1069
+ }
1070
+ return false;
1071
+ })() ;
1072
+ var queuePending = false;
1073
+ var queueDomReads = [];
1074
+ var queueDomWrites = [];
1075
+ var queueTask = (queue, write) => (cb) => {
1076
+ queue.push(cb);
1077
+ if (!queuePending) {
1078
+ queuePending = true;
1079
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1080
+ nextTick(flush);
1081
+ } else {
1082
+ plt.raf(flush);
1083
+ }
1084
+ }
1085
+ };
1086
+ var consume = (queue) => {
1087
+ for (let i2 = 0; i2 < queue.length; i2++) {
1088
+ try {
1089
+ queue[i2](performance.now());
1090
+ } catch (e) {
1091
+ consoleError(e);
1092
+ }
1093
+ }
1094
+ queue.length = 0;
1095
+ };
1096
+ var flush = () => {
1097
+ consume(queueDomReads);
1098
+ {
1099
+ consume(queueDomWrites);
1100
+ if (queuePending = queueDomReads.length > 0) {
1101
+ plt.raf(flush);
1102
+ }
1103
+ }
1104
+ };
1105
+ var nextTick = (cb) => promiseResolve().then(cb);
1106
+ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
1107
+
1108
+ exports.bootstrapLazy = bootstrapLazy;
1109
+ exports.h = h;
1110
+ exports.promiseResolve = promiseResolve;
1111
+ exports.registerInstance = registerInstance;
1112
+ exports.setNonce = setNonce;