@xplortech/apollo-data 0.0.3-draft.64d0fa1

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 (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +112 -0
  3. package/dist/apollo-data/apollo-data.esm.js +1 -0
  4. package/dist/apollo-data/index.esm.js +1 -0
  5. package/dist/apollo-data/p-Bb2nY-Tf.js +2 -0
  6. package/dist/apollo-data/p-DQuL1Twl.js +1 -0
  7. package/dist/apollo-data/p-e6584598.entry.js +11 -0
  8. package/dist/cjs/apollo-data-bar-chart_2.cjs.entry.js +68368 -0
  9. package/dist/cjs/apollo-data.cjs.js +25 -0
  10. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  11. package/dist/cjs/index-Cl7HgRm0.js +1198 -0
  12. package/dist/cjs/index.cjs.js +7 -0
  13. package/dist/cjs/loader.cjs.js +13 -0
  14. package/dist/collection/apollo-data-base.js +38 -0
  15. package/dist/collection/collection-manifest.json +13 -0
  16. package/dist/collection/components/apollo-data-bar/apollo-data-bar.js +367 -0
  17. package/dist/collection/components/apollo-data-donut/apollo-data-donut.js +479 -0
  18. package/dist/collection/examples/apollo-data-bar.examples.js +160 -0
  19. package/dist/collection/examples/apollo-data-donut.examples.js +100 -0
  20. package/dist/collection/examples/index.js +2 -0
  21. package/dist/collection/index.js +10 -0
  22. package/dist/collection/utils/code-generator.js +240 -0
  23. package/dist/collection/utils/constants.js +2 -0
  24. package/dist/collection/utils/utils.js +3 -0
  25. package/dist/components/apollo-data-bar-chart.d.ts +11 -0
  26. package/dist/components/apollo-data-bar-chart.js +1 -0
  27. package/dist/components/apollo-data-donut-chart.d.ts +11 -0
  28. package/dist/components/apollo-data-donut-chart.js +1 -0
  29. package/dist/components/index.d.ts +35 -0
  30. package/dist/components/index.js +1 -0
  31. package/dist/components/p-7XF5Cax8.js +11 -0
  32. package/dist/components/p-Dws5s-Xe.js +1 -0
  33. package/dist/esm/apollo-data-bar-chart_2.entry.js +68365 -0
  34. package/dist/esm/apollo-data.js +21 -0
  35. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  36. package/dist/esm/index-Bb2nY-Tf.js +1190 -0
  37. package/dist/esm/index.js +5 -0
  38. package/dist/esm/loader.js +11 -0
  39. package/dist/index.cjs.js +1 -0
  40. package/dist/index.js +1 -0
  41. package/dist/types/apollo-data-base.d.ts +7 -0
  42. package/dist/types/components/apollo-data-bar/apollo-data-bar.d.ts +298 -0
  43. package/dist/types/components/apollo-data-donut/apollo-data-donut.d.ts +533 -0
  44. package/dist/types/components.d.ts +102 -0
  45. package/dist/types/examples/apollo-data-bar.examples.d.ts +12 -0
  46. package/dist/types/examples/apollo-data-donut.examples.d.ts +11 -0
  47. package/dist/types/examples/index.d.ts +2 -0
  48. package/dist/types/index.d.ts +11 -0
  49. package/dist/types/stencil-public-runtime.d.ts +1839 -0
  50. package/dist/types/utils/code-generator.d.ts +12 -0
  51. package/dist/types/utils/constants.d.ts +2 -0
  52. package/dist/types/utils/utils.d.ts +1 -0
  53. package/loader/cdn.js +1 -0
  54. package/loader/index.cjs.js +1 -0
  55. package/loader/index.d.ts +24 -0
  56. package/loader/index.es2017.js +1 -0
  57. package/loader/index.js +2 -0
  58. package/package.json +92 -0
  59. package/src/examples/apollo-data-bar.examples.ts +172 -0
  60. package/src/examples/apollo-data-donut.examples.ts +118 -0
  61. package/src/examples/index.ts +2 -0
@@ -0,0 +1,1198 @@
1
+ 'use strict';
2
+
3
+ const NAMESPACE = 'apollo-data';
4
+ const BUILD = /* apollo-data */ { hydratedSelectorName: "hydrated", lazyLoad: true, prop: true, propChangeCallback: false, updatable: true};
5
+
6
+ /*
7
+ Stencil Client Platform v4.41.3 | MIT Licensed | https://stenciljs.com
8
+ */
9
+
10
+ var reWireGetterSetter = (instance, hostRef) => {
11
+ var _a;
12
+ const cmpMeta = hostRef.$cmpMeta$;
13
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
14
+ members.map(([memberName, [memberFlags]]) => {
15
+ if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
16
+ const ogValue = instance[memberName];
17
+ const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
18
+ if (ogDescriptor) {
19
+ Object.defineProperty(instance, memberName, {
20
+ get() {
21
+ return ogDescriptor.get.call(this);
22
+ },
23
+ set(newValue) {
24
+ ogDescriptor.set.call(this, newValue);
25
+ },
26
+ configurable: true,
27
+ enumerable: true
28
+ });
29
+ }
30
+ instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
31
+ }
32
+ });
33
+ };
34
+ function getPropertyDescriptor(obj, memberName) {
35
+ while (obj) {
36
+ const desc = Object.getOwnPropertyDescriptor(obj, memberName);
37
+ if (desc == null ? void 0 : desc.get) return desc;
38
+ obj = Object.getPrototypeOf(obj);
39
+ }
40
+ return void 0;
41
+ }
42
+
43
+ // src/client/client-host-ref.ts
44
+ var getHostRef = (ref) => {
45
+ if (ref.__stencil__getHostRef) {
46
+ return ref.__stencil__getHostRef();
47
+ }
48
+ return void 0;
49
+ };
50
+ var registerInstance = (lazyInstance, hostRef) => {
51
+ if (!hostRef) return;
52
+ lazyInstance.__stencil__getHostRef = () => hostRef;
53
+ hostRef.$lazyInstance$ = lazyInstance;
54
+ if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.prop)) {
55
+ reWireGetterSetter(lazyInstance, hostRef);
56
+ }
57
+ };
58
+ var registerHost = (hostElement, cmpMeta) => {
59
+ const hostRef = {
60
+ $flags$: 0,
61
+ $hostElement$: hostElement,
62
+ $cmpMeta$: cmpMeta,
63
+ $instanceValues$: /* @__PURE__ */ new Map(),
64
+ $serializerValues$: /* @__PURE__ */ new Map()
65
+ };
66
+ {
67
+ hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
68
+ hostElement["s-p"] = [];
69
+ hostElement["s-rc"] = [];
70
+ }
71
+ {
72
+ hostRef.$fetchedCbList$ = [];
73
+ }
74
+ const ref = hostRef;
75
+ hostElement.__stencil__getHostRef = () => ref;
76
+ return ref;
77
+ };
78
+ var isMemberInElement = (elm, memberName) => memberName in elm;
79
+ var consoleError = (e, el) => (0, console.error)(e, el);
80
+
81
+ // src/client/client-load-module.ts
82
+ var cmpModules = /* @__PURE__ */ new Map();
83
+ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
84
+ const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
85
+ const bundleId = cmpMeta.$lazyBundleId$;
86
+ if (!bundleId) {
87
+ return void 0;
88
+ }
89
+ const module = cmpModules.get(bundleId) ;
90
+ if (module) {
91
+ return module[exportName];
92
+ }
93
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
94
+ return import(
95
+ /* @vite-ignore */
96
+ /* webpackInclude: /\.entry\.js$/ */
97
+ /* webpackExclude: /\.system\.entry\.js$/ */
98
+ /* webpackMode: "lazy" */
99
+ `./${bundleId}.entry.js${""}`
100
+ ).then(
101
+ (importedModule) => {
102
+ {
103
+ cmpModules.set(bundleId, importedModule);
104
+ }
105
+ return importedModule[exportName];
106
+ },
107
+ (e) => {
108
+ consoleError(e, hostRef.$hostElement$);
109
+ }
110
+ );
111
+ };
112
+ var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
113
+ var win = typeof window !== "undefined" ? window : {};
114
+ var plt = {
115
+ $flags$: 0,
116
+ $resourcesUrl$: "",
117
+ jmp: (h2) => h2(),
118
+ raf: (h2) => requestAnimationFrame(h2),
119
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
120
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
121
+ ce: (eventName, opts) => new CustomEvent(eventName, opts)
122
+ };
123
+ var promiseResolve = (v) => Promise.resolve(v);
124
+ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
125
+ try {
126
+ if (!win.document.adoptedStyleSheets) {
127
+ return false;
128
+ }
129
+ new CSSStyleSheet();
130
+ return typeof new CSSStyleSheet().replaceSync === "function";
131
+ } catch (e) {
132
+ }
133
+ return false;
134
+ })() ;
135
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
136
+ var queuePending = false;
137
+ var queueDomReads = [];
138
+ var queueDomWrites = [];
139
+ var queueTask = (queue, write) => (cb) => {
140
+ queue.push(cb);
141
+ if (!queuePending) {
142
+ queuePending = true;
143
+ if (write && plt.$flags$ & 4 /* queueSync */) {
144
+ nextTick(flush);
145
+ } else {
146
+ plt.raf(flush);
147
+ }
148
+ }
149
+ };
150
+ var consume = (queue) => {
151
+ for (let i2 = 0; i2 < queue.length; i2++) {
152
+ try {
153
+ queue[i2](performance.now());
154
+ } catch (e) {
155
+ consoleError(e);
156
+ }
157
+ }
158
+ queue.length = 0;
159
+ };
160
+ var flush = () => {
161
+ consume(queueDomReads);
162
+ {
163
+ consume(queueDomWrites);
164
+ if (queuePending = queueDomReads.length > 0) {
165
+ plt.raf(flush);
166
+ }
167
+ }
168
+ };
169
+ var nextTick = (cb) => promiseResolve().then(cb);
170
+ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
171
+
172
+ // src/utils/style.ts
173
+ function createStyleSheetIfNeededAndSupported(styles2) {
174
+ return void 0;
175
+ }
176
+
177
+ // src/utils/shadow-root.ts
178
+ var globalStyleSheet;
179
+ function createShadowRoot(cmpMeta) {
180
+ var _a;
181
+ const opts = { mode: "open" };
182
+ const shadowRoot = this.attachShadow(opts);
183
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
184
+ if (globalStyleSheet) {
185
+ if (supportsMutableAdoptedStyleSheets) {
186
+ shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
187
+ } else {
188
+ shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
189
+ }
190
+ }
191
+ }
192
+ var createTime = (fnName, tagName = "") => {
193
+ {
194
+ return () => {
195
+ return;
196
+ };
197
+ }
198
+ };
199
+ var uniqueTime = (key, measureText) => {
200
+ {
201
+ return () => {
202
+ return;
203
+ };
204
+ }
205
+ };
206
+
207
+ // src/utils/query-nonce-meta-tag-content.ts
208
+ function queryNonceMetaTagContent(doc) {
209
+ var _a, _b, _c;
210
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
211
+ }
212
+
213
+ // src/runtime/styles.ts
214
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
215
+ var isComplexType = (o) => {
216
+ o = typeof o;
217
+ return o === "object" || o === "function";
218
+ };
219
+
220
+ // src/runtime/vdom/h.ts
221
+ var h = (nodeName, vnodeData, ...children) => {
222
+ if (typeof nodeName === "string") {
223
+ nodeName = transformTag(nodeName);
224
+ }
225
+ let child = null;
226
+ let key = null;
227
+ let simple = false;
228
+ let lastSimple = false;
229
+ const vNodeChildren = [];
230
+ const walk = (c) => {
231
+ for (let i2 = 0; i2 < c.length; i2++) {
232
+ child = c[i2];
233
+ if (Array.isArray(child)) {
234
+ walk(child);
235
+ } else if (child != null && typeof child !== "boolean") {
236
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
237
+ child = String(child);
238
+ }
239
+ if (simple && lastSimple) {
240
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
241
+ } else {
242
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
243
+ }
244
+ lastSimple = simple;
245
+ }
246
+ }
247
+ };
248
+ walk(children);
249
+ if (vnodeData) {
250
+ if (vnodeData.key) {
251
+ key = vnodeData.key;
252
+ }
253
+ }
254
+ const vnode = newVNode(nodeName, null);
255
+ vnode.$attrs$ = vnodeData;
256
+ if (vNodeChildren.length > 0) {
257
+ vnode.$children$ = vNodeChildren;
258
+ }
259
+ {
260
+ vnode.$key$ = key;
261
+ }
262
+ return vnode;
263
+ };
264
+ var newVNode = (tag, text) => {
265
+ const vnode = {
266
+ $flags$: 0,
267
+ $tag$: tag,
268
+ // Normalize undefined to null to prevent rendering "undefined" as text
269
+ $text$: text != null ? text : null,
270
+ $elm$: null,
271
+ $children$: null
272
+ };
273
+ {
274
+ vnode.$attrs$ = null;
275
+ }
276
+ {
277
+ vnode.$key$ = null;
278
+ }
279
+ return vnode;
280
+ };
281
+ var Host = {};
282
+ var isHost = (node) => node && node.$tag$ === Host;
283
+
284
+ // src/runtime/parse-property-value.ts
285
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
286
+ if (propValue != null && !isComplexType(propValue)) {
287
+ if (propType & 1 /* String */) {
288
+ return String(propValue);
289
+ }
290
+ return propValue;
291
+ }
292
+ return propValue;
293
+ };
294
+ var getElement = (ref) => {
295
+ var _a;
296
+ return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
297
+ };
298
+ var emitEvent = (elm, name, opts) => {
299
+ const ev = plt.ce(name, opts);
300
+ elm.dispatchEvent(ev);
301
+ return ev;
302
+ };
303
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
304
+ if (oldValue === newValue) {
305
+ return;
306
+ }
307
+ let isProp = isMemberInElement(elm, memberName);
308
+ memberName.toLowerCase();
309
+ if (memberName === "style") {
310
+ {
311
+ for (const prop in oldValue) {
312
+ if (!newValue || newValue[prop] == null) {
313
+ if (prop.includes("-")) {
314
+ elm.style.removeProperty(prop);
315
+ } else {
316
+ elm.style[prop] = "";
317
+ }
318
+ }
319
+ }
320
+ }
321
+ for (const prop in newValue) {
322
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
323
+ if (prop.includes("-")) {
324
+ elm.style.setProperty(prop, newValue[prop]);
325
+ } else {
326
+ elm.style[prop] = newValue[prop];
327
+ }
328
+ }
329
+ }
330
+ } else if (memberName === "key") ; else {
331
+ const isComplex = isComplexType(newValue);
332
+ if ((isProp || isComplex && newValue !== null) && true) {
333
+ try {
334
+ if (!elm.tagName.includes("-")) {
335
+ const n = newValue == null ? "" : newValue;
336
+ if (memberName === "list") {
337
+ isProp = false;
338
+ } else if (oldValue == null || elm[memberName] != n) {
339
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
340
+ elm[memberName] = n;
341
+ } else {
342
+ elm.setAttribute(memberName, n);
343
+ }
344
+ }
345
+ } else if (elm[memberName] !== newValue) {
346
+ elm[memberName] = newValue;
347
+ }
348
+ } catch (e) {
349
+ }
350
+ }
351
+ if (newValue == null || newValue === false) {
352
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
353
+ {
354
+ elm.removeAttribute(memberName);
355
+ }
356
+ }
357
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
358
+ newValue = newValue === true ? "" : newValue;
359
+ {
360
+ elm.setAttribute(memberName, newValue);
361
+ }
362
+ }
363
+ }
364
+ };
365
+
366
+ // src/runtime/vdom/update-element.ts
367
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
368
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
369
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
370
+ const newVnodeAttrs = newVnode.$attrs$ || {};
371
+ {
372
+ for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
373
+ if (!(memberName in newVnodeAttrs)) {
374
+ setAccessor(
375
+ elm,
376
+ memberName,
377
+ oldVnodeAttrs[memberName],
378
+ void 0,
379
+ isSvgMode2,
380
+ newVnode.$flags$);
381
+ }
382
+ }
383
+ }
384
+ for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
385
+ setAccessor(
386
+ elm,
387
+ memberName,
388
+ oldVnodeAttrs[memberName],
389
+ newVnodeAttrs[memberName],
390
+ isSvgMode2,
391
+ newVnode.$flags$);
392
+ }
393
+ };
394
+ function sortedAttrNames(attrNames) {
395
+ return attrNames.includes("ref") ? (
396
+ // we need to sort these to ensure that `'ref'` is the last attr
397
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
398
+ ) : (
399
+ // no need to sort, return the original array
400
+ attrNames
401
+ );
402
+ }
403
+ var hostTagName;
404
+ var isSvgMode = false;
405
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
406
+ const newVNode2 = newParentVNode.$children$[childIndex];
407
+ let i2 = 0;
408
+ let elm;
409
+ let childNode;
410
+ {
411
+ if (!win.document) {
412
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
413
+ }
414
+ elm = newVNode2.$elm$ = win.document.createElement(
415
+ newVNode2.$tag$
416
+ );
417
+ {
418
+ updateElement(null, newVNode2, isSvgMode);
419
+ }
420
+ if (newVNode2.$children$) {
421
+ const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
422
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
423
+ childNode = createElm(oldParentVNode, newVNode2, i2);
424
+ if (childNode) {
425
+ appendTarget.appendChild(childNode);
426
+ }
427
+ }
428
+ }
429
+ }
430
+ elm["s-hn"] = hostTagName;
431
+ return elm;
432
+ };
433
+ var 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
+ if (parentVNode.$tag$ === "template") {
440
+ containerElm = containerElm.content;
441
+ }
442
+ for (; startIdx <= endIdx; ++startIdx) {
443
+ if (vnodes[startIdx]) {
444
+ childNode = createElm(null, parentVNode, startIdx);
445
+ if (childNode) {
446
+ vnodes[startIdx].$elm$ = childNode;
447
+ insertBefore(containerElm, childNode, before);
448
+ }
449
+ }
450
+ }
451
+ };
452
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
453
+ for (let index = startIdx; index <= endIdx; ++index) {
454
+ const vnode = vnodes[index];
455
+ if (vnode) {
456
+ const elm = vnode.$elm$;
457
+ if (elm) {
458
+ elm.remove();
459
+ }
460
+ }
461
+ }
462
+ };
463
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
464
+ let oldStartIdx = 0;
465
+ let newStartIdx = 0;
466
+ let idxInOld = 0;
467
+ let i2 = 0;
468
+ let oldEndIdx = oldCh.length - 1;
469
+ let oldStartVnode = oldCh[0];
470
+ let oldEndVnode = oldCh[oldEndIdx];
471
+ let newEndIdx = newCh.length - 1;
472
+ let newStartVnode = newCh[0];
473
+ let newEndVnode = newCh[newEndIdx];
474
+ let node;
475
+ let elmToMove;
476
+ const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
477
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
478
+ if (oldStartVnode == null) {
479
+ oldStartVnode = oldCh[++oldStartIdx];
480
+ } else if (oldEndVnode == null) {
481
+ oldEndVnode = oldCh[--oldEndIdx];
482
+ } else if (newStartVnode == null) {
483
+ newStartVnode = newCh[++newStartIdx];
484
+ } else if (newEndVnode == null) {
485
+ newEndVnode = newCh[--newEndIdx];
486
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
487
+ patch(oldStartVnode, newStartVnode, isInitialRender);
488
+ oldStartVnode = oldCh[++oldStartIdx];
489
+ newStartVnode = newCh[++newStartIdx];
490
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
491
+ patch(oldEndVnode, newEndVnode, isInitialRender);
492
+ oldEndVnode = oldCh[--oldEndIdx];
493
+ newEndVnode = newCh[--newEndIdx];
494
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
495
+ patch(oldStartVnode, newEndVnode, isInitialRender);
496
+ insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
497
+ oldStartVnode = oldCh[++oldStartIdx];
498
+ newEndVnode = newCh[--newEndIdx];
499
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
500
+ patch(oldEndVnode, newStartVnode, isInitialRender);
501
+ insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
502
+ oldEndVnode = oldCh[--oldEndIdx];
503
+ newStartVnode = newCh[++newStartIdx];
504
+ } else {
505
+ idxInOld = -1;
506
+ {
507
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
508
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
509
+ idxInOld = i2;
510
+ break;
511
+ }
512
+ }
513
+ }
514
+ if (idxInOld >= 0) {
515
+ elmToMove = oldCh[idxInOld];
516
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
517
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
518
+ } else {
519
+ patch(elmToMove, newStartVnode, isInitialRender);
520
+ oldCh[idxInOld] = void 0;
521
+ node = elmToMove.$elm$;
522
+ }
523
+ newStartVnode = newCh[++newStartIdx];
524
+ } else {
525
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
526
+ newStartVnode = newCh[++newStartIdx];
527
+ }
528
+ if (node) {
529
+ {
530
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
531
+ }
532
+ }
533
+ }
534
+ }
535
+ if (oldStartIdx > oldEndIdx) {
536
+ addVnodes(
537
+ parentElm,
538
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
539
+ newVNode2,
540
+ newCh,
541
+ newStartIdx,
542
+ newEndIdx
543
+ );
544
+ } else if (newStartIdx > newEndIdx) {
545
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
546
+ }
547
+ };
548
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
549
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
550
+ if (!isInitialRender) {
551
+ return leftVNode.$key$ === rightVNode.$key$;
552
+ }
553
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
554
+ leftVNode.$key$ = rightVNode.$key$;
555
+ }
556
+ return true;
557
+ }
558
+ return false;
559
+ };
560
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
561
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
562
+ const oldChildren = oldVNode.$children$;
563
+ const newChildren = newVNode2.$children$;
564
+ {
565
+ {
566
+ updateElement(oldVNode, newVNode2, isSvgMode);
567
+ }
568
+ if (oldChildren !== null && newChildren !== null) {
569
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
570
+ } else if (newChildren !== null) {
571
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
572
+ } else if (
573
+ // don't do this on initial render as it can cause non-hydrated content to be removed
574
+ !isInitialRender && BUILD.updatable && oldChildren !== null
575
+ ) {
576
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
577
+ } else ;
578
+ }
579
+ };
580
+ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
581
+ if (parent.__insertBefore) {
582
+ return parent.__insertBefore(newNode, reference);
583
+ } else {
584
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
585
+ }
586
+ };
587
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
588
+ const hostElm = hostRef.$hostElement$;
589
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
590
+ const isHostElement = isHost(renderFnResults);
591
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
592
+ hostTagName = hostElm.tagName;
593
+ if (isInitialLoad && rootVnode.$attrs$) {
594
+ for (const key of Object.keys(rootVnode.$attrs$)) {
595
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
596
+ rootVnode.$attrs$[key] = hostElm[key];
597
+ }
598
+ }
599
+ }
600
+ rootVnode.$tag$ = null;
601
+ rootVnode.$flags$ |= 4 /* isHost */;
602
+ hostRef.$vnode$ = rootVnode;
603
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
604
+ patch(oldVNode, rootVnode, isInitialLoad);
605
+ };
606
+
607
+ // src/runtime/update-component.ts
608
+ var attachToAncestor = (hostRef, ancestorComponent) => {
609
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
610
+ const index = ancestorComponent["s-p"].push(
611
+ new Promise(
612
+ (r) => hostRef.$onRenderResolve$ = () => {
613
+ ancestorComponent["s-p"].splice(index - 1, 1);
614
+ r();
615
+ }
616
+ )
617
+ );
618
+ }
619
+ };
620
+ var scheduleUpdate = (hostRef, isInitialLoad) => {
621
+ {
622
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
623
+ }
624
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
625
+ hostRef.$flags$ |= 512 /* needsRerender */;
626
+ return;
627
+ }
628
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
629
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
630
+ if (isInitialLoad) {
631
+ queueMicrotask(() => {
632
+ dispatch();
633
+ });
634
+ return;
635
+ }
636
+ return writeTask(dispatch) ;
637
+ };
638
+ var dispatchHooks = (hostRef, isInitialLoad) => {
639
+ const elm = hostRef.$hostElement$;
640
+ const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
641
+ const instance = hostRef.$lazyInstance$ ;
642
+ if (!instance) {
643
+ throw new Error(
644
+ `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
645
+ );
646
+ }
647
+ let maybePromise;
648
+ if (isInitialLoad) {
649
+ {
650
+ if (hostRef.$fetchedCbList$.length) {
651
+ hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
652
+ }
653
+ }
654
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
655
+ } else {
656
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
657
+ }
658
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
659
+ endSchedule();
660
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
661
+ };
662
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
663
+ console.error(err);
664
+ fn();
665
+ }) : fn();
666
+ var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
667
+ var updateComponent = async (hostRef, instance, isInitialLoad) => {
668
+ var _a;
669
+ const elm = hostRef.$hostElement$;
670
+ const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
671
+ const rc = elm["s-rc"];
672
+ const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
673
+ {
674
+ callRender(hostRef, instance, elm, isInitialLoad);
675
+ }
676
+ if (rc) {
677
+ rc.map((cb) => cb());
678
+ elm["s-rc"] = void 0;
679
+ }
680
+ endRender();
681
+ endUpdate();
682
+ {
683
+ const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
684
+ const postUpdate = () => postUpdateComponent(hostRef);
685
+ if (childrenPromises.length === 0) {
686
+ postUpdate();
687
+ } else {
688
+ Promise.all(childrenPromises).then(postUpdate);
689
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
690
+ childrenPromises.length = 0;
691
+ }
692
+ }
693
+ };
694
+ var callRender = (hostRef, instance, elm, isInitialLoad) => {
695
+ try {
696
+ instance = instance.render() ;
697
+ {
698
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
699
+ }
700
+ {
701
+ hostRef.$flags$ |= 2 /* hasRendered */;
702
+ }
703
+ {
704
+ {
705
+ {
706
+ renderVdom(hostRef, instance, isInitialLoad);
707
+ }
708
+ }
709
+ }
710
+ } catch (e) {
711
+ consoleError(e, hostRef.$hostElement$);
712
+ }
713
+ return null;
714
+ };
715
+ var postUpdateComponent = (hostRef) => {
716
+ const tagName = hostRef.$cmpMeta$.$tagName$;
717
+ const elm = hostRef.$hostElement$;
718
+ const endPostUpdate = createTime("postUpdate", tagName);
719
+ const instance = hostRef.$lazyInstance$ ;
720
+ const ancestorComponent = hostRef.$ancestorComponent$;
721
+ safeCall(instance, "componentDidRender", void 0, elm);
722
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
723
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
724
+ {
725
+ addHydratedFlag(elm);
726
+ }
727
+ safeCall(instance, "componentDidLoad", void 0, elm);
728
+ endPostUpdate();
729
+ {
730
+ hostRef.$onReadyResolve$(elm);
731
+ if (!ancestorComponent) {
732
+ appDidLoad();
733
+ }
734
+ }
735
+ } else {
736
+ safeCall(instance, "componentDidUpdate", void 0, elm);
737
+ endPostUpdate();
738
+ }
739
+ {
740
+ if (hostRef.$onRenderResolve$) {
741
+ hostRef.$onRenderResolve$();
742
+ hostRef.$onRenderResolve$ = void 0;
743
+ }
744
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
745
+ nextTick(() => scheduleUpdate(hostRef, false));
746
+ }
747
+ hostRef.$flags$ &= -517;
748
+ }
749
+ };
750
+ var appDidLoad = (who) => {
751
+ nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
752
+ };
753
+ var safeCall = (instance, method, arg, elm) => {
754
+ if (instance && instance[method]) {
755
+ try {
756
+ return instance[method](arg);
757
+ } catch (e) {
758
+ consoleError(e, elm);
759
+ }
760
+ }
761
+ return void 0;
762
+ };
763
+ var addHydratedFlag = (elm) => {
764
+ var _a;
765
+ return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
766
+ };
767
+
768
+ // src/runtime/set-value.ts
769
+ var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
770
+ var setValue = (ref, propName, newVal, cmpMeta) => {
771
+ const hostRef = getHostRef(ref);
772
+ if (!hostRef) {
773
+ return;
774
+ }
775
+ if (!hostRef) {
776
+ throw new Error(
777
+ `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
778
+ );
779
+ }
780
+ const oldVal = hostRef.$instanceValues$.get(propName);
781
+ const flags = hostRef.$flags$;
782
+ const instance = hostRef.$lazyInstance$ ;
783
+ newVal = parsePropertyValue(
784
+ newVal,
785
+ cmpMeta.$members$[propName][0]);
786
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
787
+ const didValueChange = newVal !== oldVal && !areBothNaN;
788
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
789
+ hostRef.$instanceValues$.set(propName, newVal);
790
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
791
+ if (instance.componentShouldUpdate) {
792
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
793
+ return;
794
+ }
795
+ }
796
+ scheduleUpdate(hostRef, false);
797
+ }
798
+ }
799
+ };
800
+
801
+ // src/runtime/proxy-component.ts
802
+ var proxyComponent = (Cstr, cmpMeta, flags) => {
803
+ var _a, _b;
804
+ const prototype = Cstr.prototype;
805
+ if (cmpMeta.$members$ || BUILD.propChangeCallback) {
806
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
807
+ members.map(([memberName, [memberFlags]]) => {
808
+ if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
809
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
810
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
811
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
812
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
813
+ Object.defineProperty(prototype, memberName, {
814
+ get() {
815
+ {
816
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
817
+ return getValue(this, memberName);
818
+ }
819
+ const ref = getHostRef(this);
820
+ const instance = ref ? ref.$lazyInstance$ : prototype;
821
+ if (!instance) return;
822
+ return instance[memberName];
823
+ }
824
+ },
825
+ configurable: true,
826
+ enumerable: true
827
+ });
828
+ }
829
+ Object.defineProperty(prototype, memberName, {
830
+ set(newValue) {
831
+ const ref = getHostRef(this);
832
+ if (!ref) {
833
+ return;
834
+ }
835
+ if (origSetter) {
836
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
837
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
838
+ newValue = ref.$instanceValues$.get(memberName);
839
+ }
840
+ origSetter.apply(this, [
841
+ parsePropertyValue(
842
+ newValue,
843
+ memberFlags)
844
+ ]);
845
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
846
+ setValue(this, memberName, newValue, cmpMeta);
847
+ return;
848
+ }
849
+ {
850
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
851
+ setValue(this, memberName, newValue, cmpMeta);
852
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
853
+ ref.$fetchedCbList$.push(() => {
854
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
855
+ ref.$lazyInstance$[memberName] = newValue;
856
+ }
857
+ });
858
+ }
859
+ return;
860
+ }
861
+ const setterSetVal = () => {
862
+ const currentValue = ref.$lazyInstance$[memberName];
863
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
864
+ ref.$instanceValues$.set(memberName, currentValue);
865
+ }
866
+ ref.$lazyInstance$[memberName] = parsePropertyValue(
867
+ newValue,
868
+ memberFlags);
869
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
870
+ };
871
+ if (ref.$lazyInstance$) {
872
+ setterSetVal();
873
+ } else {
874
+ ref.$fetchedCbList$.push(() => {
875
+ setterSetVal();
876
+ });
877
+ }
878
+ }
879
+ }
880
+ });
881
+ }
882
+ });
883
+ if ((flags & 1 /* isElementConstructor */)) {
884
+ const attrNameToPropName = /* @__PURE__ */ new Map();
885
+ prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
886
+ plt.jmp(() => {
887
+ var _a2;
888
+ const propName = attrNameToPropName.get(attrName);
889
+ const hostRef = getHostRef(this);
890
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
891
+ newValue = this[propName];
892
+ delete this[propName];
893
+ }
894
+ if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
895
+ this[propName] == newValue) {
896
+ return;
897
+ } else if (propName == null) {
898
+ const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
899
+ if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
900
+ const instance = hostRef.$lazyInstance$ ;
901
+ const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
902
+ entry == null ? void 0 : entry.forEach((watcher) => {
903
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
904
+ if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
905
+ instance[watchMethodName].call(instance, newValue, oldValue, attrName);
906
+ }
907
+ });
908
+ }
909
+ return;
910
+ }
911
+ const propFlags = members.find(([m]) => m === propName);
912
+ if (propFlags && propFlags[1][0] & 4 /* Boolean */) {
913
+ newValue = newValue === null || newValue === "false" ? false : true;
914
+ }
915
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
916
+ if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
917
+ this[propName] = newValue;
918
+ }
919
+ });
920
+ };
921
+ Cstr.observedAttributes = Array.from(
922
+ /* @__PURE__ */ new Set([
923
+ ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
924
+ ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
925
+ const attrName = m[1] || propName;
926
+ attrNameToPropName.set(attrName, propName);
927
+ return attrName;
928
+ })
929
+ ])
930
+ );
931
+ }
932
+ }
933
+ return Cstr;
934
+ };
935
+
936
+ // src/runtime/initialize-component.ts
937
+ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
938
+ let Cstr;
939
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
940
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
941
+ const bundleId = cmpMeta.$lazyBundleId$;
942
+ if (bundleId) {
943
+ const CstrImport = loadModule(cmpMeta, hostRef);
944
+ if (CstrImport && "then" in CstrImport) {
945
+ const endLoad = uniqueTime();
946
+ Cstr = await CstrImport;
947
+ endLoad();
948
+ } else {
949
+ Cstr = CstrImport;
950
+ }
951
+ if (!Cstr) {
952
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
953
+ }
954
+ if (!Cstr.isProxied) {
955
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
956
+ Cstr.isProxied = true;
957
+ }
958
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
959
+ {
960
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
961
+ }
962
+ try {
963
+ new Cstr(hostRef);
964
+ } catch (e) {
965
+ consoleError(e, elm);
966
+ }
967
+ {
968
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
969
+ }
970
+ endNewInstance();
971
+ {
972
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
973
+ }
974
+ } else {
975
+ Cstr = elm.constructor;
976
+ const cmpTag = elm.localName;
977
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
978
+ }
979
+ }
980
+ const ancestorComponent = hostRef.$ancestorComponent$;
981
+ const schedule = () => scheduleUpdate(hostRef, true);
982
+ if (ancestorComponent && ancestorComponent["s-rc"]) {
983
+ ancestorComponent["s-rc"].push(schedule);
984
+ } else {
985
+ schedule();
986
+ }
987
+ };
988
+ var fireConnectedCallback = (instance, elm) => {
989
+ {
990
+ safeCall(instance, "connectedCallback", void 0, elm);
991
+ }
992
+ };
993
+
994
+ // src/runtime/connected-callback.ts
995
+ var connectedCallback = (elm) => {
996
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
997
+ const hostRef = getHostRef(elm);
998
+ if (!hostRef) {
999
+ return;
1000
+ }
1001
+ const cmpMeta = hostRef.$cmpMeta$;
1002
+ const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1003
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1004
+ hostRef.$flags$ |= 1 /* hasConnected */;
1005
+ {
1006
+ let ancestorComponent = elm;
1007
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1008
+ if (ancestorComponent["s-p"]) {
1009
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1010
+ break;
1011
+ }
1012
+ }
1013
+ }
1014
+ if (cmpMeta.$members$) {
1015
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1016
+ if (memberFlags & 31 /* Prop */ && memberName in elm && elm[memberName] !== Object.prototype[memberName]) {
1017
+ const value = elm[memberName];
1018
+ delete elm[memberName];
1019
+ elm[memberName] = value;
1020
+ }
1021
+ });
1022
+ }
1023
+ {
1024
+ initializeComponent(elm, hostRef, cmpMeta);
1025
+ }
1026
+ } else {
1027
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1028
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1029
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1030
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1031
+ }
1032
+ }
1033
+ endConnected();
1034
+ }
1035
+ };
1036
+ var disconnectInstance = (instance, elm) => {
1037
+ {
1038
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1039
+ }
1040
+ };
1041
+ var disconnectedCallback = async (elm) => {
1042
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1043
+ const hostRef = getHostRef(elm);
1044
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1045
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1046
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1047
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1048
+ }
1049
+ }
1050
+ if (rootAppliedStyles.has(elm)) {
1051
+ rootAppliedStyles.delete(elm);
1052
+ }
1053
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1054
+ rootAppliedStyles.delete(elm.shadowRoot);
1055
+ }
1056
+ };
1057
+
1058
+ // src/runtime/bootstrap-lazy.ts
1059
+ var bootstrapLazy = (lazyBundles, options = {}) => {
1060
+ var _a;
1061
+ if (!win.document) {
1062
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1063
+ return;
1064
+ }
1065
+ const endBootstrap = createTime();
1066
+ const cmpTags = [];
1067
+ const exclude = options.exclude || [];
1068
+ const customElements2 = win.customElements;
1069
+ const head = win.document.head;
1070
+ const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1071
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1072
+ const deferredConnectedCallbacks = [];
1073
+ let appLoadFallback;
1074
+ let isBootstrapping = true;
1075
+ Object.assign(plt, options);
1076
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1077
+ lazyBundles.map((lazyBundle) => {
1078
+ lazyBundle[1].map((compactMeta) => {
1079
+ const cmpMeta = {
1080
+ $flags$: compactMeta[0],
1081
+ $tagName$: compactMeta[1],
1082
+ $members$: compactMeta[2],
1083
+ $listeners$: compactMeta[3]
1084
+ };
1085
+ {
1086
+ cmpMeta.$members$ = compactMeta[2];
1087
+ }
1088
+ const tagName = transformTag(cmpMeta.$tagName$);
1089
+ const HostElement = class extends HTMLElement {
1090
+ ["s-p"];
1091
+ ["s-rc"];
1092
+ hasRegisteredEventListeners = false;
1093
+ // StencilLazyHost
1094
+ constructor(self) {
1095
+ super(self);
1096
+ self = this;
1097
+ registerHost(self, cmpMeta);
1098
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1099
+ {
1100
+ if (!self.shadowRoot) {
1101
+ createShadowRoot.call(self, cmpMeta);
1102
+ } else {
1103
+ if (self.shadowRoot.mode !== "open") {
1104
+ throw new Error(
1105
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
1106
+ );
1107
+ }
1108
+ }
1109
+ }
1110
+ }
1111
+ }
1112
+ connectedCallback() {
1113
+ const hostRef = getHostRef(this);
1114
+ if (!hostRef) {
1115
+ return;
1116
+ }
1117
+ if (!this.hasRegisteredEventListeners) {
1118
+ this.hasRegisteredEventListeners = true;
1119
+ }
1120
+ if (appLoadFallback) {
1121
+ clearTimeout(appLoadFallback);
1122
+ appLoadFallback = null;
1123
+ }
1124
+ if (isBootstrapping) {
1125
+ deferredConnectedCallbacks.push(this);
1126
+ } else {
1127
+ plt.jmp(() => connectedCallback(this));
1128
+ }
1129
+ }
1130
+ disconnectedCallback() {
1131
+ plt.jmp(() => disconnectedCallback(this));
1132
+ plt.raf(() => {
1133
+ var _a3;
1134
+ const hostRef = getHostRef(this);
1135
+ if (!hostRef) {
1136
+ return;
1137
+ }
1138
+ const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
1139
+ if (i2 > -1) {
1140
+ deferredConnectedCallbacks.splice(i2, 1);
1141
+ }
1142
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1143
+ delete hostRef.$vnode$.$elm$;
1144
+ }
1145
+ });
1146
+ }
1147
+ componentOnReady() {
1148
+ var _a3;
1149
+ return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
1150
+ }
1151
+ };
1152
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1153
+ if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
1154
+ cmpTags.push(tagName);
1155
+ customElements2.define(
1156
+ tagName,
1157
+ proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)
1158
+ );
1159
+ }
1160
+ });
1161
+ });
1162
+ if (cmpTags.length > 0) {
1163
+ {
1164
+ dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
1165
+ }
1166
+ if (dataStyles.innerHTML.length) {
1167
+ dataStyles.setAttribute("data-styles", "");
1168
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1169
+ if (nonce != null) {
1170
+ dataStyles.setAttribute("nonce", nonce);
1171
+ }
1172
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1173
+ }
1174
+ }
1175
+ isBootstrapping = false;
1176
+ if (deferredConnectedCallbacks.length) {
1177
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1178
+ } else {
1179
+ {
1180
+ plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
1181
+ }
1182
+ }
1183
+ endBootstrap();
1184
+ };
1185
+
1186
+ // src/runtime/nonce.ts
1187
+ var setNonce = (nonce) => plt.$nonce$ = nonce;
1188
+ function transformTag(tag) {
1189
+ return tag;
1190
+ }
1191
+
1192
+ exports.Host = Host;
1193
+ exports.bootstrapLazy = bootstrapLazy;
1194
+ exports.getElement = getElement;
1195
+ exports.h = h;
1196
+ exports.promiseResolve = promiseResolve;
1197
+ exports.registerInstance = registerInstance;
1198
+ exports.setNonce = setNonce;