genesys-spark-chart-components 4.155.0 → 4.156.0

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 (54) hide show
  1. package/dist/cjs/color-palette-DguVB2fN.js +96 -0
  2. package/dist/cjs/genesys-chart-webcomponents.cjs.js +7 -8
  3. package/dist/cjs/gux-chart-column-beta.cjs.entry.js +4 -7
  4. package/dist/cjs/gux-chart-donut-beta.cjs.entry.js +5 -8
  5. package/dist/cjs/gux-chart-line-beta.cjs.entry.js +5 -8
  6. package/dist/cjs/gux-chart-pie-beta.cjs.entry.js +5 -8
  7. package/dist/cjs/gux-chart-scatter-plot-beta.cjs.entry.js +5 -8
  8. package/dist/cjs/gux-visualization-beta.cjs.entry.js +45549 -40654
  9. package/dist/cjs/{index-e390a39a.js → index-D32B1d05.js} +390 -304
  10. package/dist/cjs/loader.cjs.js +3 -6
  11. package/dist/collection/collection-manifest.json +1 -1
  12. package/dist/collection/components/beta/gux-chart-column/gux-chart-column.js +13 -10
  13. package/dist/collection/components/beta/gux-chart-donut/gux-chart-donut.js +19 -16
  14. package/dist/collection/components/beta/gux-chart-line/gux-chart-line.js +16 -14
  15. package/dist/collection/components/beta/gux-chart-pie/gux-chart-pie.js +9 -7
  16. package/dist/collection/components/beta/gux-chart-scatter-plot/gux-chart-scatter-plot.js +14 -12
  17. package/dist/collection/components/beta/gux-visualization/gux-visualization.js +2 -0
  18. package/dist/esm/color-palette-C3ohlwPT.js +91 -0
  19. package/dist/esm/genesys-chart-webcomponents.js +5 -5
  20. package/dist/esm/gux-chart-column-beta.entry.js +4 -5
  21. package/dist/esm/gux-chart-donut-beta.entry.js +5 -6
  22. package/dist/esm/gux-chart-line-beta.entry.js +5 -6
  23. package/dist/esm/gux-chart-pie-beta.entry.js +5 -6
  24. package/dist/esm/gux-chart-scatter-plot-beta.entry.js +5 -6
  25. package/dist/esm/gux-visualization-beta.entry.js +45550 -40653
  26. package/dist/esm/{index-eabc38b4.js → index-7ILyl2XS.js} +387 -300
  27. package/dist/esm/loader.js +3 -4
  28. package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.esm.js +1 -1
  29. package/dist/genesys-chart-webcomponents/p-49ac1324.entry.js +1 -0
  30. package/dist/genesys-chart-webcomponents/p-711e444a.entry.js +1 -0
  31. package/dist/genesys-chart-webcomponents/p-7352f717.entry.js +11 -0
  32. package/dist/genesys-chart-webcomponents/p-7ILyl2XS.js +2 -0
  33. package/dist/genesys-chart-webcomponents/{p-19d6feca.entry.js → p-97d9c60c.entry.js} +1 -1
  34. package/dist/genesys-chart-webcomponents/p-C3ohlwPT.js +1 -0
  35. package/dist/genesys-chart-webcomponents/{p-4d99a574.entry.js → p-af84a21b.entry.js} +1 -1
  36. package/dist/genesys-chart-webcomponents/p-d9b0ef63.entry.js +1 -0
  37. package/dist/types/components.d.ts +48 -0
  38. package/dist/types/stencil-public-runtime.d.ts +23 -1
  39. package/package.json +13 -17
  40. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  41. package/dist/cjs/color-palette-d3da8bf7.js +0 -223
  42. package/dist/esm/app-globals-0f993ce5.js +0 -3
  43. package/dist/esm/color-palette-a79b1aac.js +0 -218
  44. package/dist/genesys-chart-webcomponents/p-22c066a2.js +0 -1
  45. package/dist/genesys-chart-webcomponents/p-3c039745.entry.js +0 -1
  46. package/dist/genesys-chart-webcomponents/p-7e5fa729.entry.js +0 -11
  47. package/dist/genesys-chart-webcomponents/p-9617a5da.entry.js +0 -1
  48. package/dist/genesys-chart-webcomponents/p-977a4087.js +0 -2
  49. package/dist/genesys-chart-webcomponents/p-e1255160.js +0 -1
  50. package/dist/genesys-chart-webcomponents/p-ec37c345.entry.js +0 -1
  51. package/dist/loader/package.json +0 -11
  52. /package/dist/cjs/{log-error-8f448752.js → log-error-BMPVm36Q.js} +0 -0
  53. /package/dist/esm/{log-error-fbbfc3ab.js → log-error-nsqlWzyl.js} +0 -0
  54. /package/dist/genesys-chart-webcomponents/{p-23610106.js → p-nsqlWzyl.js} +0 -0
@@ -9,22 +9,23 @@ function _interopNamespace(e) {
9
9
  var d = Object.getOwnPropertyDescriptor(e, k);
10
10
  Object.defineProperty(n, k, d.get ? d : {
11
11
  enumerable: true,
12
- get: function () {
13
- return e[k];
14
- }
12
+ get: function () { return e[k]; }
15
13
  });
16
14
  }
17
15
  });
18
16
  }
19
- n['default'] = e;
17
+ n.default = e;
20
18
  return Object.freeze(n);
21
19
  }
22
20
 
23
21
  const NAMESPACE = 'genesys-chart-webcomponents';
24
- const BUILD = /* genesys-chart-webcomponents */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: true, hydratedClass: false, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: false, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: false, vdomText: false, vdomXlink: false, watchCallback: true };
22
+ const BUILD = /* genesys-chart-webcomponents */ { hydratedSelectorName: "hydrated", lazyLoad: true, updatable: true};
23
+
24
+ const globalScripts = () => {};
25
+ const globalStyles = "";
25
26
 
26
27
  /*
27
- Stencil Client Platform v4.23.2 | MIT Licensed | https://stenciljs.com
28
+ Stencil Client Platform v4.35.1 | MIT Licensed | https://stenciljs.com
28
29
  */
29
30
  var __defProp = Object.defineProperty;
30
31
  var __export = (target, all) => {
@@ -33,10 +34,15 @@ var __export = (target, all) => {
33
34
  };
34
35
 
35
36
  // src/client/client-host-ref.ts
36
- var hostRefs = /* @__PURE__ */ new WeakMap();
37
- var getHostRef = (ref) => hostRefs.get(ref);
37
+ var getHostRef = (ref) => {
38
+ if (ref.__stencil__getHostRef) {
39
+ return ref.__stencil__getHostRef();
40
+ }
41
+ return void 0;
42
+ };
38
43
  var registerInstance = (lazyInstance, hostRef) => {
39
- hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
44
+ lazyInstance.__stencil__getHostRef = () => hostRef;
45
+ hostRef.$lazyInstance$ = lazyInstance;
40
46
  };
41
47
  var registerHost = (hostElement, cmpMeta) => {
42
48
  const hostRef = {
@@ -50,7 +56,8 @@ var registerHost = (hostElement, cmpMeta) => {
50
56
  hostElement["s-p"] = [];
51
57
  hostElement["s-rc"] = [];
52
58
  }
53
- const ref = hostRefs.set(hostElement, hostRef);
59
+ const ref = hostRef;
60
+ hostElement.__stencil__getHostRef = () => ref;
54
61
  return ref;
55
62
  };
56
63
  var isMemberInElement = (elm, memberName) => memberName in elm;
@@ -102,27 +109,30 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
102
109
  './gux-visualization-beta.cjs.entry.js')); }).then(processMod, consoleError);
103
110
  }
104
111
  }
105
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
112
+ return (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(
106
113
  /* @vite-ignore */
107
114
  /* webpackInclude: /\.entry\.js$/ */
108
115
  /* webpackExclude: /\.system\.entry\.js$/ */
109
116
  /* webpackMode: "lazy" */
110
117
  `./${bundleId}.entry.js${""}`
111
- )); }).then((importedModule) => {
112
- {
113
- cmpModules.set(bundleId, importedModule);
118
+ ).then(
119
+ (importedModule) => {
120
+ {
121
+ cmpModules.set(bundleId, importedModule);
122
+ }
123
+ return importedModule[exportName];
124
+ },
125
+ (e) => {
126
+ consoleError(e, hostRef.$hostElement$);
114
127
  }
115
- return importedModule[exportName];
116
- }, consoleError);
128
+ );
117
129
  };
118
130
 
119
131
  // src/client/client-style.ts
120
132
  var styles = /* @__PURE__ */ new Map();
121
- var HYDRATED_STYLE_ID = "sty-id";
122
133
  var HYDRATED_CSS = "{visibility:hidden}[hydrated]{visibility:inherit}";
123
134
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
124
135
  var win = typeof window !== "undefined" ? window : {};
125
- var doc = win.document || { head: {} };
126
136
  var plt = {
127
137
  $flags$: 0,
128
138
  $resourcesUrl$: "",
@@ -182,11 +192,16 @@ var isComplexType = (o) => {
182
192
  };
183
193
 
184
194
  // src/utils/query-nonce-meta-tag-content.ts
185
- function queryNonceMetaTagContent(doc2) {
195
+ function queryNonceMetaTagContent(doc) {
186
196
  var _a, _b, _c;
187
- 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;
197
+ 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;
188
198
  }
189
199
 
200
+ // src/utils/regular-expression.ts
201
+ var escapeRegExpSpecialCharacters = (text) => {
202
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
203
+ };
204
+
190
205
  // src/utils/result.ts
191
206
  var result_exports = {};
192
207
  __export(result_exports, {
@@ -235,6 +250,28 @@ var unwrapErr = (result) => {
235
250
  throw result.value;
236
251
  }
237
252
  };
253
+ function createShadowRoot(cmpMeta) {
254
+ const shadowRoot = this.attachShadow({ mode: "open" });
255
+ if (supportsConstructableStylesheets) {
256
+ const sheet = new CSSStyleSheet();
257
+ sheet.replaceSync(globalStyles);
258
+ shadowRoot.adoptedStyleSheets.push(sheet);
259
+ }
260
+ }
261
+ var createTime = (fnName, tagName = "") => {
262
+ {
263
+ return () => {
264
+ return;
265
+ };
266
+ }
267
+ };
268
+ var uniqueTime = (key, measureText) => {
269
+ {
270
+ return () => {
271
+ return;
272
+ };
273
+ }
274
+ };
238
275
  var h = (nodeName, vnodeData, ...children) => {
239
276
  let child = null;
240
277
  let key = null;
@@ -299,91 +336,242 @@ var newVNode = (tag, text) => {
299
336
  };
300
337
  var Host = {};
301
338
  var isHost = (node) => node && node.$tag$ === Host;
302
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
303
- if (oldValue !== newValue) {
304
- let isProp = isMemberInElement(elm, memberName);
305
- memberName.toLowerCase();
306
- if (memberName === "class") {
307
- const classList = elm.classList;
308
- const oldClasses = parseClassList(oldValue);
309
- let newClasses = parseClassList(newValue);
310
- if (elm["s-si"]) {
311
- newClasses.push(elm["s-si"]);
312
- oldClasses.forEach((c) => {
313
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
314
- });
315
- newClasses = [...new Set(newClasses)];
316
- classList.add(...newClasses);
317
- delete elm["s-si"];
318
- } else {
319
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
320
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
321
- }
322
- } else if (memberName === "key") ; else if (memberName === "ref") {
323
- if (newValue) {
324
- newValue(elm);
339
+ var createSupportsRuleRe = (selector) => {
340
+ const safeSelector2 = escapeRegExpSpecialCharacters(selector);
341
+ return new RegExp(
342
+ // First capture group: match any context before the selector that's not inside @supports selector()
343
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
344
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
345
+ "g"
346
+ );
347
+ };
348
+ createSupportsRuleRe("::slotted");
349
+ createSupportsRuleRe(":host");
350
+ createSupportsRuleRe(":host-context");
351
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
352
+ if (propValue != null && !isComplexType(propValue)) {
353
+ if (propType & 4 /* Boolean */) {
354
+ {
355
+ return propValue === "false" ? false : propValue === "" || !!propValue;
325
356
  }
357
+ }
358
+ if (propType & 2 /* Number */) {
359
+ return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
360
+ }
361
+ if (propType & 1 /* String */) {
362
+ return String(propValue);
363
+ }
364
+ return propValue;
365
+ }
366
+ return propValue;
367
+ };
368
+ var getElement = (ref) => getHostRef(ref).$hostElement$ ;
369
+
370
+ // src/runtime/event-emitter.ts
371
+ var createEvent = (ref, name, flags) => {
372
+ const elm = getElement(ref);
373
+ return {
374
+ emit: (detail) => {
375
+ return emitEvent(elm, name, {
376
+ bubbles: true,
377
+ composed: true,
378
+ cancelable: true,
379
+ detail
380
+ });
381
+ }
382
+ };
383
+ };
384
+ var emitEvent = (elm, name, opts) => {
385
+ const ev = plt.ce(name, opts);
386
+ elm.dispatchEvent(ev);
387
+ return ev;
388
+ };
389
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
390
+ var registerStyle = (scopeId2, cssText, allowCS) => {
391
+ let style = styles.get(scopeId2);
392
+ if (supportsConstructableStylesheets && allowCS) {
393
+ style = style || new CSSStyleSheet();
394
+ if (typeof style === "string") {
395
+ style = cssText;
326
396
  } else {
327
- const isComplex = isComplexType(newValue);
328
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
329
- try {
330
- if (!elm.tagName.includes("-")) {
331
- const n = newValue == null ? "" : newValue;
332
- if (memberName === "list") {
333
- isProp = false;
334
- } else if (oldValue == null || elm[memberName] != n) {
335
- if (typeof elm.__lookupSetter__(memberName) === "function") {
336
- elm[memberName] = n;
397
+ style.replaceSync(cssText);
398
+ }
399
+ } else {
400
+ style = cssText;
401
+ }
402
+ styles.set(scopeId2, style);
403
+ };
404
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
405
+ var _a;
406
+ const scopeId2 = getScopeId(cmpMeta);
407
+ const style = styles.get(scopeId2);
408
+ if (!win.document) {
409
+ return scopeId2;
410
+ }
411
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
412
+ if (style) {
413
+ if (typeof style === "string") {
414
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
415
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
416
+ let styleElm;
417
+ if (!appliedStyles) {
418
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
419
+ }
420
+ if (!appliedStyles.has(scopeId2)) {
421
+ {
422
+ styleElm = win.document.createElement("style");
423
+ styleElm.innerHTML = style;
424
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
425
+ if (nonce != null) {
426
+ styleElm.setAttribute("nonce", nonce);
427
+ }
428
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
429
+ if (styleContainerNode.nodeName === "HEAD") {
430
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
431
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
432
+ styleContainerNode.insertBefore(
433
+ styleElm,
434
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
435
+ );
436
+ } else if ("host" in styleContainerNode) {
437
+ if (supportsConstructableStylesheets) {
438
+ const stylesheet = new CSSStyleSheet();
439
+ stylesheet.replaceSync(style);
440
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
337
441
  } else {
338
- elm.setAttribute(memberName, n);
442
+ const existingStyleContainer = styleContainerNode.querySelector("style");
443
+ if (existingStyleContainer) {
444
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
445
+ } else {
446
+ styleContainerNode.prepend(styleElm);
447
+ }
339
448
  }
449
+ } else {
450
+ styleContainerNode.append(styleElm);
340
451
  }
341
- } else {
342
- elm[memberName] = newValue;
343
452
  }
344
- } catch (e) {
453
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
454
+ styleContainerNode.insertBefore(styleElm, null);
455
+ }
456
+ }
457
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
458
+ styleElm.innerHTML += SLOT_FB_CSS;
459
+ }
460
+ if (appliedStyles) {
461
+ appliedStyles.add(scopeId2);
345
462
  }
346
463
  }
347
- if (newValue == null || newValue === false) {
348
- if (newValue !== false || elm.getAttribute(memberName) === "") {
349
- {
350
- elm.removeAttribute(memberName);
464
+ } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
465
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
466
+ }
467
+ }
468
+ return scopeId2;
469
+ };
470
+ var attachStyles = (hostRef) => {
471
+ const cmpMeta = hostRef.$cmpMeta$;
472
+ const elm = hostRef.$hostElement$;
473
+ const flags = cmpMeta.$flags$;
474
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
475
+ const scopeId2 = addStyle(
476
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
477
+ cmpMeta);
478
+ if (flags & 10 /* needsScopedEncapsulation */) {
479
+ elm["s-sc"] = scopeId2;
480
+ elm.classList.add(scopeId2 + "-h");
481
+ }
482
+ endAttachStyles();
483
+ };
484
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
485
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
486
+ if (oldValue === newValue) {
487
+ return;
488
+ }
489
+ let isProp = isMemberInElement(elm, memberName);
490
+ memberName.toLowerCase();
491
+ if (memberName === "class") {
492
+ const classList = elm.classList;
493
+ const oldClasses = parseClassList(oldValue);
494
+ let newClasses = parseClassList(newValue);
495
+ {
496
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
497
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
498
+ }
499
+ } else if (memberName === "key") ; else if (memberName === "ref") {
500
+ if (newValue) {
501
+ newValue(elm);
502
+ }
503
+ } else {
504
+ const isComplex = isComplexType(newValue);
505
+ if ((isProp || isComplex && newValue !== null) && true) {
506
+ try {
507
+ if (!elm.tagName.includes("-")) {
508
+ const n = newValue == null ? "" : newValue;
509
+ if (memberName === "list") {
510
+ isProp = false;
511
+ } else if (oldValue == null || elm[memberName] != n) {
512
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
513
+ elm[memberName] = n;
514
+ } else {
515
+ elm.setAttribute(memberName, n);
516
+ }
351
517
  }
518
+ } else if (elm[memberName] !== newValue) {
519
+ elm[memberName] = newValue;
352
520
  }
353
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
354
- newValue = newValue === true ? "" : newValue;
521
+ } catch (e) {
522
+ }
523
+ }
524
+ if (newValue == null || newValue === false) {
525
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
355
526
  {
356
- elm.setAttribute(memberName, newValue);
527
+ elm.removeAttribute(memberName);
357
528
  }
358
529
  }
530
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
531
+ newValue = newValue === true ? "" : newValue;
532
+ {
533
+ elm.setAttribute(memberName, newValue);
534
+ }
359
535
  }
360
536
  }
361
537
  };
362
538
  var parseClassListRegex = /\s/;
363
539
  var parseClassList = (value) => {
364
- if (typeof value === "object" && "baseVal" in value) {
540
+ if (typeof value === "object" && value && "baseVal" in value) {
365
541
  value = value.baseVal;
366
542
  }
367
- if (!value) {
543
+ if (!value || typeof value !== "string") {
368
544
  return [];
369
545
  }
370
546
  return value.split(parseClassListRegex);
371
547
  };
372
548
 
373
549
  // src/runtime/vdom/update-element.ts
374
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
550
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
375
551
  const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
376
552
  const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
377
553
  const newVnodeAttrs = newVnode.$attrs$ || {};
378
554
  {
379
555
  for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
380
556
  if (!(memberName in newVnodeAttrs)) {
381
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
557
+ setAccessor(
558
+ elm,
559
+ memberName,
560
+ oldVnodeAttrs[memberName],
561
+ void 0,
562
+ isSvgMode2,
563
+ newVnode.$flags$);
382
564
  }
383
565
  }
384
566
  }
385
567
  for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
386
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
568
+ setAccessor(
569
+ elm,
570
+ memberName,
571
+ oldVnodeAttrs[memberName],
572
+ newVnodeAttrs[memberName],
573
+ isSvgMode2,
574
+ newVnode.$flags$);
387
575
  }
388
576
  };
389
577
  function sortedAttrNames(attrNames) {
@@ -396,7 +584,6 @@ function sortedAttrNames(attrNames) {
396
584
  );
397
585
  }
398
586
  var hostTagName;
399
- var useNativeShadowDom = false;
400
587
  var isSvgMode = false;
401
588
  var createElm = (oldParentVNode, newParentVNode, childIndex) => {
402
589
  const newVNode2 = newParentVNode.$children$[childIndex];
@@ -404,8 +591,13 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
404
591
  let elm;
405
592
  let childNode;
406
593
  {
407
- elm = newVNode2.$elm$ = doc.createElement(
408
- !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
594
+ if (!win.document) {
595
+ throw new Error(
596
+ "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
597
+ );
598
+ }
599
+ elm = newVNode2.$elm$ = win.document.createElement(
600
+ newVNode2.$tag$
409
601
  );
410
602
  {
411
603
  updateElement(null, newVNode2, isSvgMode);
@@ -552,9 +744,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
552
744
  const newChildren = newVNode2.$children$;
553
745
  {
554
746
  {
555
- {
556
- updateElement(oldVNode, newVNode2, isSvgMode);
557
- }
747
+ updateElement(oldVNode, newVNode2, isSvgMode);
558
748
  }
559
749
  if (oldChildren !== null && newChildren !== null) {
560
750
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -575,14 +765,15 @@ var nullifyVNodeRefs = (vNode) => {
575
765
  }
576
766
  };
577
767
  var insertBefore = (parent, newNode, reference) => {
578
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
579
- return inserted;
768
+ {
769
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
770
+ }
580
771
  };
581
772
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
582
773
  const hostElm = hostRef.$hostElement$;
583
- const cmpMeta = hostRef.$cmpMeta$;
584
774
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
585
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
775
+ const isHostElement = isHost(renderFnResults);
776
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
586
777
  hostTagName = hostElm.tagName;
587
778
  if (isInitialLoad && rootVnode.$attrs$) {
588
779
  for (const key of Object.keys(rootVnode.$attrs$)) {
@@ -595,154 +786,20 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
595
786
  rootVnode.$flags$ |= 4 /* isHost */;
596
787
  hostRef.$vnode$ = rootVnode;
597
788
  rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
598
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
599
789
  patch(oldVNode, rootVnode, isInitialLoad);
600
790
  };
601
- var createTime = (fnName, tagName = "") => {
602
- {
603
- return () => {
604
- return;
605
- };
606
- }
607
- };
608
- var uniqueTime = (key, measureText) => {
609
- {
610
- return () => {
611
- return;
612
- };
613
- }
614
- };
615
- var parsePropertyValue = (propValue, propType) => {
616
- if (propValue != null && !isComplexType(propValue)) {
617
- if (propType & 4 /* Boolean */) {
618
- return propValue === "false" ? false : propValue === "" || !!propValue;
619
- }
620
- if (propType & 2 /* Number */) {
621
- return parseFloat(propValue);
622
- }
623
- if (propType & 1 /* String */) {
624
- return String(propValue);
625
- }
626
- return propValue;
627
- }
628
- return propValue;
629
- };
630
- var getElement = (ref) => getHostRef(ref).$hostElement$ ;
631
-
632
- // src/runtime/event-emitter.ts
633
- var createEvent = (ref, name, flags) => {
634
- const elm = getElement(ref);
635
- return {
636
- emit: (detail) => {
637
- return emitEvent(elm, name, {
638
- bubbles: !!(flags & 4 /* Bubbles */),
639
- composed: !!(flags & 2 /* Composed */),
640
- cancelable: !!(flags & 1 /* Cancellable */),
641
- detail
642
- });
643
- }
644
- };
645
- };
646
- var emitEvent = (elm, name, opts) => {
647
- const ev = plt.ce(name, opts);
648
- elm.dispatchEvent(ev);
649
- return ev;
650
- };
651
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
652
- var registerStyle = (scopeId2, cssText, allowCS) => {
653
- let style = styles.get(scopeId2);
654
- if (supportsConstructableStylesheets && allowCS) {
655
- style = style || new CSSStyleSheet();
656
- if (typeof style === "string") {
657
- style = cssText;
658
- } else {
659
- style.replaceSync(cssText);
660
- }
661
- } else {
662
- style = cssText;
663
- }
664
- styles.set(scopeId2, style);
665
- };
666
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
667
- var _a;
668
- const scopeId2 = getScopeId(cmpMeta);
669
- const style = styles.get(scopeId2);
670
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
671
- if (style) {
672
- if (typeof style === "string") {
673
- styleContainerNode = styleContainerNode.head || styleContainerNode;
674
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
675
- let styleElm;
676
- if (!appliedStyles) {
677
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
678
- }
679
- if (!appliedStyles.has(scopeId2)) {
680
- {
681
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
682
- styleElm.innerHTML = style;
683
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
684
- if (nonce != null) {
685
- styleElm.setAttribute("nonce", nonce);
686
- }
687
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
688
- if (styleContainerNode.nodeName === "HEAD") {
689
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
690
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
691
- styleContainerNode.insertBefore(styleElm, referenceNode2);
692
- } else if ("host" in styleContainerNode) {
693
- if (supportsConstructableStylesheets) {
694
- const stylesheet = new CSSStyleSheet();
695
- stylesheet.replaceSync(style);
696
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
697
- } else {
698
- const existingStyleContainer = styleContainerNode.querySelector("style");
699
- if (existingStyleContainer) {
700
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
701
- } else {
702
- styleContainerNode.prepend(styleElm);
703
- }
704
- }
705
- } else {
706
- styleContainerNode.append(styleElm);
707
- }
708
- }
709
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
710
- styleContainerNode.insertBefore(styleElm, null);
711
- }
712
- }
713
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
714
- styleElm.innerHTML += SLOT_FB_CSS;
715
- }
716
- if (appliedStyles) {
717
- appliedStyles.add(scopeId2);
718
- }
719
- }
720
- } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
721
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
722
- }
723
- }
724
- return scopeId2;
725
- };
726
- var attachStyles = (hostRef) => {
727
- const cmpMeta = hostRef.$cmpMeta$;
728
- const elm = hostRef.$hostElement$;
729
- const flags = cmpMeta.$flags$;
730
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
731
- const scopeId2 = addStyle(
732
- elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
733
- cmpMeta);
734
- if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
735
- elm["s-sc"] = scopeId2;
736
- elm.classList.add(scopeId2 + "-h");
737
- }
738
- endAttachStyles();
739
- };
740
- var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
741
791
 
742
792
  // src/runtime/update-component.ts
743
793
  var attachToAncestor = (hostRef, ancestorComponent) => {
744
794
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
745
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
795
+ const index = ancestorComponent["s-p"].push(
796
+ new Promise(
797
+ (r) => hostRef.$onRenderResolve$ = () => {
798
+ ancestorComponent["s-p"].splice(index - 1, 1);
799
+ r();
800
+ }
801
+ )
802
+ );
746
803
  }
747
804
  };
748
805
  var scheduleUpdate = (hostRef, isInitialLoad) => {
@@ -768,10 +825,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
768
825
  }
769
826
  let maybePromise;
770
827
  if (isInitialLoad) {
771
- {
772
- maybePromise = safeCall(instance, "componentWillLoad");
773
- }
828
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
829
+ } else {
830
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
774
831
  }
832
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
775
833
  endSchedule();
776
834
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
777
835
  };
@@ -814,7 +872,7 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
814
872
  try {
815
873
  instance = instance.render() ;
816
874
  {
817
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
875
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
818
876
  }
819
877
  {
820
878
  hostRef.$flags$ |= 2 /* hasRendered */;
@@ -837,17 +895,13 @@ var postUpdateComponent = (hostRef) => {
837
895
  const endPostUpdate = createTime("postUpdate", tagName);
838
896
  const instance = hostRef.$lazyInstance$ ;
839
897
  const ancestorComponent = hostRef.$ancestorComponent$;
840
- {
841
- safeCall(instance, "componentDidRender");
842
- }
898
+ safeCall(instance, "componentDidRender", void 0, elm);
843
899
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
844
900
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
845
901
  {
846
902
  addHydratedFlag(elm);
847
903
  }
848
- {
849
- safeCall(instance, "componentDidLoad");
850
- }
904
+ safeCall(instance, "componentDidLoad", void 0, elm);
851
905
  endPostUpdate();
852
906
  {
853
907
  hostRef.$onReadyResolve$(elm);
@@ -856,6 +910,7 @@ var postUpdateComponent = (hostRef) => {
856
910
  }
857
911
  }
858
912
  } else {
913
+ safeCall(instance, "componentDidUpdate", void 0, elm);
859
914
  endPostUpdate();
860
915
  }
861
916
  {
@@ -866,21 +921,18 @@ var postUpdateComponent = (hostRef) => {
866
921
  if (hostRef.$flags$ & 512 /* needsRerender */) {
867
922
  nextTick(() => scheduleUpdate(hostRef, false));
868
923
  }
869
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
924
+ hostRef.$flags$ &= -517;
870
925
  }
871
926
  };
872
927
  var appDidLoad = (who) => {
873
- {
874
- addHydratedFlag(doc.documentElement);
875
- }
876
928
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
877
929
  };
878
- var safeCall = (instance, method, arg) => {
930
+ var safeCall = (instance, method, arg, elm) => {
879
931
  if (instance && instance[method]) {
880
932
  try {
881
933
  return instance[method](arg);
882
934
  } catch (e) {
883
- consoleError(e);
935
+ consoleError(e, elm);
884
936
  }
885
937
  }
886
938
  return void 0;
@@ -896,14 +948,16 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
896
948
  const hostRef = getHostRef(ref);
897
949
  if (!hostRef) {
898
950
  throw new Error(
899
- `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/ionic-team/stencil/issues/5457).`
951
+ `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).`
900
952
  );
901
953
  }
902
954
  const elm = hostRef.$hostElement$ ;
903
955
  const oldVal = hostRef.$instanceValues$.get(propName);
904
956
  const flags = hostRef.$flags$;
905
957
  const instance = hostRef.$lazyInstance$ ;
906
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
958
+ newVal = parsePropertyValue(
959
+ newVal,
960
+ cmpMeta.$members$[propName][0]);
907
961
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
908
962
  const didValueChange = newVal !== oldVal && !areBothNaN;
909
963
  if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
@@ -922,6 +976,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
922
976
  }
923
977
  }
924
978
  if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
979
+ if (instance.componentShouldUpdate) {
980
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
981
+ return;
982
+ }
983
+ }
925
984
  scheduleUpdate(hostRef, false);
926
985
  }
927
986
  }
@@ -939,62 +998,75 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
939
998
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
940
999
  members.map(([memberName, [memberFlags]]) => {
941
1000
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
942
- if ((memberFlags & 2048 /* Getter */) === 0) {
1001
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
1002
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
1003
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
1004
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
943
1005
  Object.defineProperty(prototype, memberName, {
944
1006
  get() {
945
- return getValue(this, memberName);
946
- },
947
- set(newValue) {
948
- setValue(this, memberName, newValue, cmpMeta);
949
- },
950
- configurable: true,
951
- enumerable: true
952
- });
953
- } else if (flags & 1 /* isElementConstructor */ && memberFlags & 2048 /* Getter */) {
954
- {
955
- Object.defineProperty(prototype, memberName, {
956
- get() {
1007
+ {
1008
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
1009
+ return getValue(this, memberName);
1010
+ }
957
1011
  const ref = getHostRef(this);
958
1012
  const instance = ref ? ref.$lazyInstance$ : prototype;
959
1013
  if (!instance) return;
960
1014
  return instance[memberName];
961
- },
962
- configurable: true,
963
- enumerable: true
964
- });
965
- }
966
- if (memberFlags & 4096 /* Setter */) {
967
- const origSetter = Object.getOwnPropertyDescriptor(prototype, memberName).set;
968
- Object.defineProperty(prototype, memberName, {
969
- set(newValue) {
970
- const ref = getHostRef(this);
971
- if (origSetter) {
972
- const currentValue = ref.$hostElement$[memberName];
973
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
974
- ref.$instanceValues$.set(memberName, currentValue);
975
- }
976
- origSetter.apply(this, [parsePropertyValue(newValue, cmpMeta.$members$[memberName][0])]);
977
- setValue(this, memberName, ref.$hostElement$[memberName], cmpMeta);
978
- return;
1015
+ }
1016
+ },
1017
+ configurable: true,
1018
+ enumerable: true
1019
+ });
1020
+ }
1021
+ Object.defineProperty(prototype, memberName, {
1022
+ set(newValue) {
1023
+ const ref = getHostRef(this);
1024
+ if (origSetter) {
1025
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1026
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
1027
+ newValue = ref.$instanceValues$.get(memberName);
1028
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
1029
+ ref.$instanceValues$.set(memberName, currentValue);
1030
+ }
1031
+ origSetter.apply(this, [
1032
+ parsePropertyValue(
1033
+ newValue,
1034
+ memberFlags)
1035
+ ]);
1036
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1037
+ setValue(this, memberName, newValue, cmpMeta);
1038
+ return;
1039
+ }
1040
+ {
1041
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
1042
+ setValue(this, memberName, newValue, cmpMeta);
1043
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
1044
+ ref.$onReadyPromise$.then(() => {
1045
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
1046
+ ref.$lazyInstance$[memberName] = newValue;
1047
+ }
1048
+ });
979
1049
  }
980
- if (!ref) return;
981
- const setterSetVal = () => {
982
- const currentValue = ref.$lazyInstance$[memberName];
983
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
984
- ref.$instanceValues$.set(memberName, currentValue);
985
- }
986
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, cmpMeta.$members$[memberName][0]);
987
- setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
988
- };
989
- if (ref.$lazyInstance$) {
990
- setterSetVal();
991
- } else {
992
- ref.$onReadyPromise$.then(() => setterSetVal());
1050
+ return;
1051
+ }
1052
+ const setterSetVal = () => {
1053
+ const currentValue = ref.$lazyInstance$[memberName];
1054
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
1055
+ ref.$instanceValues$.set(memberName, currentValue);
993
1056
  }
1057
+ ref.$lazyInstance$[memberName] = parsePropertyValue(
1058
+ newValue,
1059
+ memberFlags);
1060
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1061
+ };
1062
+ if (ref.$lazyInstance$) {
1063
+ setterSetVal();
1064
+ } else {
1065
+ ref.$onReadyPromise$.then(() => setterSetVal());
994
1066
  }
995
- });
1067
+ }
996
1068
  }
997
- }
1069
+ });
998
1070
  }
999
1071
  });
1000
1072
  if ((flags & 1 /* isElementConstructor */)) {
@@ -1024,8 +1096,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1024
1096
  return;
1025
1097
  }
1026
1098
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1027
- if (!propDesc.get || !!propDesc.set) {
1028
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
1099
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
1100
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
1101
+ this[propName] = newValue;
1029
1102
  }
1030
1103
  });
1031
1104
  };
@@ -1051,7 +1124,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1051
1124
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1052
1125
  const bundleId = cmpMeta.$lazyBundleId$;
1053
1126
  if (bundleId) {
1054
- const CstrImport = loadModule(cmpMeta);
1127
+ const CstrImport = loadModule(cmpMeta, hostRef);
1055
1128
  if (CstrImport && "then" in CstrImport) {
1056
1129
  const endLoad = uniqueTime();
1057
1130
  Cstr = await CstrImport;
@@ -1076,15 +1149,16 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1076
1149
  try {
1077
1150
  new Cstr(hostRef);
1078
1151
  } catch (e) {
1079
- consoleError(e);
1152
+ consoleError(e, elm);
1080
1153
  }
1081
1154
  {
1082
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1155
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
1083
1156
  }
1084
1157
  {
1085
1158
  hostRef.$flags$ |= 128 /* isWatchReady */;
1086
1159
  }
1087
1160
  endNewInstance();
1161
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1088
1162
  } else {
1089
1163
  Cstr = elm.constructor;
1090
1164
  const cmpTag = elm.localName;
@@ -1111,7 +1185,10 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1111
1185
  schedule();
1112
1186
  }
1113
1187
  };
1114
- var fireConnectedCallback = (instance) => {
1188
+ var fireConnectedCallback = (instance, elm) => {
1189
+ {
1190
+ safeCall(instance, "connectedCallback", void 0, elm);
1191
+ }
1115
1192
  };
1116
1193
 
1117
1194
  // src/runtime/connected-callback.ts
@@ -1144,25 +1221,27 @@ var connectedCallback = (elm) => {
1144
1221
  initializeComponent(elm, hostRef, cmpMeta);
1145
1222
  }
1146
1223
  } else {
1147
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1148
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1224
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1225
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1226
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1227
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1149
1228
  }
1150
1229
  }
1151
1230
  endConnected();
1152
1231
  }
1153
1232
  };
1154
- var disconnectInstance = (instance) => {
1233
+ var disconnectInstance = (instance, elm) => {
1155
1234
  {
1156
- safeCall(instance, "disconnectedCallback");
1235
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1157
1236
  }
1158
1237
  };
1159
1238
  var disconnectedCallback = async (elm) => {
1160
1239
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1161
1240
  const hostRef = getHostRef(elm);
1162
1241
  if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1163
- disconnectInstance(hostRef.$lazyInstance$);
1242
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1164
1243
  } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1165
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
1244
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1166
1245
  }
1167
1246
  }
1168
1247
  if (rootAppliedStyles.has(elm)) {
@@ -1176,18 +1255,22 @@ var disconnectedCallback = async (elm) => {
1176
1255
  // src/runtime/bootstrap-lazy.ts
1177
1256
  var bootstrapLazy = (lazyBundles, options = {}) => {
1178
1257
  var _a;
1258
+ if (!win.document) {
1259
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1260
+ return;
1261
+ }
1179
1262
  const endBootstrap = createTime();
1180
1263
  const cmpTags = [];
1181
1264
  const exclude = options.exclude || [];
1182
1265
  const customElements2 = win.customElements;
1183
- const head = doc.head;
1266
+ const head = win.document.head;
1184
1267
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1185
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
1268
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1186
1269
  const deferredConnectedCallbacks = [];
1187
1270
  let appLoadFallback;
1188
1271
  let isBootstrapping = true;
1189
1272
  Object.assign(plt, options);
1190
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
1273
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1191
1274
  let hasSlotRelocation = false;
1192
1275
  lazyBundles.map((lazyBundle) => {
1193
1276
  lazyBundle[1].map((compactMeta) => {
@@ -1218,9 +1301,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1218
1301
  if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1219
1302
  {
1220
1303
  if (!self.shadowRoot) {
1221
- {
1222
- self.attachShadow({ mode: "open" });
1223
- }
1304
+ createShadowRoot.call(self, cmpMeta);
1224
1305
  } else {
1225
1306
  if (self.shadowRoot.mode !== "open") {
1226
1307
  throw new Error(
@@ -1251,6 +1332,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1251
1332
  plt.raf(() => {
1252
1333
  var _a3;
1253
1334
  const hostRef = getHostRef(this);
1335
+ const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
1336
+ if (i2 > -1) {
1337
+ deferredConnectedCallbacks.splice(i2, 1);
1338
+ }
1254
1339
  if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1255
1340
  delete hostRef.$vnode$.$elm$;
1256
1341
  }
@@ -1279,7 +1364,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1279
1364
  }
1280
1365
  if (dataStyles.innerHTML.length) {
1281
1366
  dataStyles.setAttribute("data-styles", "");
1282
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1367
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1283
1368
  if (nonce != null) {
1284
1369
  dataStyles.setAttribute("nonce", nonce);
1285
1370
  }
@@ -1303,6 +1388,7 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
1303
1388
  exports.bootstrapLazy = bootstrapLazy;
1304
1389
  exports.createEvent = createEvent;
1305
1390
  exports.getElement = getElement;
1391
+ exports.globalScripts = globalScripts;
1306
1392
  exports.h = h;
1307
1393
  exports.promiseResolve = promiseResolve;
1308
1394
  exports.registerInstance = registerInstance;