@stencil/core 4.20.0 → 4.21.0-dev.1724780308.9f407a8

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Runner v4.20.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Runner v4.21.0-dev.1724780308.9f407a8 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -320,8 +320,8 @@ function jsCaseToCssCase(str) {
320
320
 
321
321
  // src/mock-doc/custom-element-registry.ts
322
322
  var MockCustomElementRegistry = class {
323
- constructor(win) {
324
- this.win = win;
323
+ constructor(win2) {
324
+ this.win = win2;
325
325
  }
326
326
  define(tagName, cstr, options) {
327
327
  if (tagName.toLowerCase() !== tagName) {
@@ -343,19 +343,19 @@ var MockCustomElementRegistry = class {
343
343
  this.__whenDefined.delete(tagName);
344
344
  }
345
345
  }
346
- const doc = this.win.document;
347
- if (doc != null) {
348
- const hosts = doc.querySelectorAll(tagName);
346
+ const doc2 = this.win.document;
347
+ if (doc2 != null) {
348
+ const hosts = doc2.querySelectorAll(tagName);
349
349
  hosts.forEach((host) => {
350
350
  if (upgradedElements.has(host) === false) {
351
- tempDisableCallbacks.add(doc);
352
- const upgradedCmp = createCustomElement(this, doc, tagName);
351
+ tempDisableCallbacks.add(doc2);
352
+ const upgradedCmp = createCustomElement(this, doc2, tagName);
353
353
  for (let i = 0; i < host.childNodes.length; i++) {
354
354
  const childNode = host.childNodes[i];
355
355
  childNode.remove();
356
356
  upgradedCmp.appendChild(childNode);
357
357
  }
358
- tempDisableCallbacks.delete(doc);
358
+ tempDisableCallbacks.delete(doc2);
359
359
  if (proxyElements.has(host)) {
360
360
  proxyElements.set(host, upgradedCmp);
361
361
  }
@@ -409,8 +409,8 @@ var MockCustomElementRegistry = class {
409
409
  });
410
410
  }
411
411
  };
412
- function createCustomElement(customElements, ownerDocument, tagName) {
413
- const Cstr = customElements.get(tagName);
412
+ function createCustomElement(customElements2, ownerDocument, tagName) {
413
+ const Cstr = customElements2.get(tagName);
414
414
  if (Cstr != null) {
415
415
  const cmp = new Cstr(ownerDocument);
416
416
  cmp.nodeName = tagName.toUpperCase();
@@ -458,8 +458,8 @@ function connectNode(ownerDocument, node) {
458
458
  node.ownerDocument = ownerDocument;
459
459
  if (node.nodeType === 1 /* ELEMENT_NODE */) {
460
460
  if (ownerDocument != null && node.nodeName.includes("-")) {
461
- const win = ownerDocument.defaultView;
462
- if (win != null && typeof node.connectedCallback === "function" && node.isConnected) {
461
+ const win2 = ownerDocument.defaultView;
462
+ if (win2 != null && typeof node.connectedCallback === "function" && node.isConnected) {
463
463
  fireConnectedCallback(node);
464
464
  }
465
465
  const shadowRoot = node.shadowRoot;
@@ -4867,7 +4867,7 @@ var OpenElementStack = class {
4867
4867
  get currentTmplContentOrNode() {
4868
4868
  return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
4869
4869
  }
4870
- constructor(document, treeAdapter, handler) {
4870
+ constructor(document2, treeAdapter, handler) {
4871
4871
  this.treeAdapter = treeAdapter;
4872
4872
  this.handler = handler;
4873
4873
  this.items = [];
@@ -4875,7 +4875,7 @@ var OpenElementStack = class {
4875
4875
  this.stackTop = -1;
4876
4876
  this.tmplCount = 0;
4877
4877
  this.currentTagId = TAG_ID.UNKNOWN;
4878
- this.current = document;
4878
+ this.current = document2;
4879
4879
  }
4880
4880
  //Index of element
4881
4881
  _indexOf(element) {
@@ -5292,8 +5292,8 @@ var defaultTreeAdapter = {
5292
5292
  getTemplateContent(templateElement) {
5293
5293
  return templateElement.content;
5294
5294
  },
5295
- setDocumentType(document, name, publicId, systemId) {
5296
- const doctypeNode = document.childNodes.find((node) => node.nodeName === "#documentType");
5295
+ setDocumentType(document2, name, publicId, systemId) {
5296
+ const doctypeNode = document2.childNodes.find((node) => node.nodeName === "#documentType");
5297
5297
  if (doctypeNode) {
5298
5298
  doctypeNode.name = name;
5299
5299
  doctypeNode.publicId = publicId;
@@ -5306,14 +5306,14 @@ var defaultTreeAdapter = {
5306
5306
  systemId,
5307
5307
  parentNode: null
5308
5308
  };
5309
- defaultTreeAdapter.appendChild(document, node);
5309
+ defaultTreeAdapter.appendChild(document2, node);
5310
5310
  }
5311
5311
  },
5312
- setDocumentMode(document, mode) {
5313
- document.mode = mode;
5312
+ setDocumentMode(document2, mode) {
5313
+ document2.mode = mode;
5314
5314
  },
5315
- getDocumentMode(document) {
5316
- return document.mode;
5315
+ getDocumentMode(document2) {
5316
+ return document2.mode;
5317
5317
  },
5318
5318
  detachNode(node) {
5319
5319
  if (node.parentNode) {
@@ -5794,7 +5794,7 @@ var defaultParserOptions = {
5794
5794
  onParseError: null
5795
5795
  };
5796
5796
  var Parser = class {
5797
- constructor(options, document, fragmentContext = null, scriptHandler = null) {
5797
+ constructor(options, document2, fragmentContext = null, scriptHandler = null) {
5798
5798
  this.fragmentContext = fragmentContext;
5799
5799
  this.scriptHandler = scriptHandler;
5800
5800
  this.currentToken = null;
@@ -5819,7 +5819,7 @@ var Parser = class {
5819
5819
  if (this.onParseError) {
5820
5820
  this.options.sourceCodeLocationInfo = true;
5821
5821
  }
5822
- this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument();
5822
+ this.document = document2 !== null && document2 !== void 0 ? document2 : this.treeAdapter.createDocument();
5823
5823
  this.tokenizer = new Tokenizer(this.options, this);
5824
5824
  this.activeFormattingElements = new FormattingElementList(this.treeAdapter);
5825
5825
  this.fragmentContextID = fragmentContext ? getTagID(this.treeAdapter.getTagName(fragmentContext)) : TAG_ID.UNKNOWN;
@@ -8796,11 +8796,11 @@ function parseFragment(fragmentContext, html, options) {
8796
8796
  // src/mock-doc/parse-util.ts
8797
8797
  var docParser = /* @__PURE__ */ new WeakMap();
8798
8798
  function parseDocumentUtil(ownerDocument, html) {
8799
- const doc = parse(html.trim(), getParser(ownerDocument));
8800
- doc.documentElement = doc.firstElementChild;
8801
- doc.head = doc.documentElement.firstElementChild;
8802
- doc.body = doc.head.nextElementSibling;
8803
- return doc;
8799
+ const doc2 = parse(html.trim(), getParser(ownerDocument));
8800
+ doc2.documentElement = doc2.firstElementChild;
8801
+ doc2.head = doc2.documentElement.firstElementChild;
8802
+ doc2.body = doc2.head.nextElementSibling;
8803
+ return doc2;
8804
8804
  }
8805
8805
  function parseFragmentUtil(ownerDocument, html) {
8806
8806
  if (typeof html === "string") {
@@ -8818,9 +8818,9 @@ function getParser(ownerDocument) {
8818
8818
  }
8819
8819
  const treeAdapter = {
8820
8820
  createDocument() {
8821
- const doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
8822
- doc["x-mode"] = "no-quirks";
8823
- return doc;
8821
+ const doc2 = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
8822
+ doc2["x-mode"] = "no-quirks";
8823
+ return doc2;
8824
8824
  },
8825
8825
  setNodeSourceCodeLocation(node, location2) {
8826
8826
  node.sourceCodeLocation = location2;
@@ -8858,22 +8858,22 @@ function getParser(ownerDocument) {
8858
8858
  getTemplateContent(templateElement) {
8859
8859
  return templateElement.content;
8860
8860
  },
8861
- setDocumentType(doc, name, publicId, systemId) {
8862
- let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
8861
+ setDocumentType(doc2, name, publicId, systemId) {
8862
+ let doctypeNode = doc2.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
8863
8863
  if (doctypeNode == null) {
8864
8864
  doctypeNode = ownerDocument.createDocumentTypeNode();
8865
- doc.insertBefore(doctypeNode, doc.firstChild);
8865
+ doc2.insertBefore(doctypeNode, doc2.firstChild);
8866
8866
  }
8867
8867
  doctypeNode.nodeValue = "!DOCTYPE";
8868
8868
  doctypeNode["x-name"] = name;
8869
8869
  doctypeNode["x-publicId"] = publicId;
8870
8870
  doctypeNode["x-systemId"] = systemId;
8871
8871
  },
8872
- setDocumentMode(doc, mode) {
8873
- doc["x-mode"] = mode;
8872
+ setDocumentMode(doc2, mode) {
8873
+ doc2["x-mode"] = mode;
8874
8874
  },
8875
- getDocumentMode(doc) {
8876
- return doc["x-mode"];
8875
+ getDocumentMode(doc2) {
8876
+ return doc2["x-mode"];
8877
8877
  },
8878
8878
  detachNode(node) {
8879
8879
  node.remove();
@@ -9005,9 +9005,9 @@ var jquery_default = (
9005
9005
  nodeName: "HTML"
9006
9006
  }
9007
9007
  }
9008
- }, function(window, noGlobal) {
9008
+ }, function(window2, noGlobal) {
9009
9009
  "use strict";
9010
- if (!window.document) {
9010
+ if (!window2.document) {
9011
9011
  throw new Error("jQuery requires a window with a document");
9012
9012
  }
9013
9013
  var arr = [];
@@ -9042,16 +9042,16 @@ var jquery_default = (
9042
9042
  }
9043
9043
  return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
9044
9044
  }
9045
- var document = window.document;
9045
+ var document2 = window2.document;
9046
9046
  var preservedScriptAttributes = {
9047
9047
  type: true,
9048
9048
  src: true,
9049
9049
  nonce: true,
9050
9050
  noModule: true
9051
9051
  };
9052
- function DOMEval(code, node, doc) {
9053
- doc = doc || document;
9054
- var i2, script = doc.createElement("script");
9052
+ function DOMEval(code, node, doc2) {
9053
+ doc2 = doc2 || document2;
9054
+ var i2, script = doc2.createElement("script");
9055
9055
  script.text = code;
9056
9056
  if (node) {
9057
9057
  for (i2 in preservedScriptAttributes) {
@@ -9060,7 +9060,7 @@ var jquery_default = (
9060
9060
  }
9061
9061
  }
9062
9062
  }
9063
- doc.head.appendChild(script).parentNode.removeChild(script);
9063
+ doc2.head.appendChild(script).parentNode.removeChild(script);
9064
9064
  }
9065
9065
  const jQuery = {};
9066
9066
  var version = "4.0.0-pre+9352011a7.dirty +selector", rhtmlSuffix = /HTML$/i, jQueryOrig = function(selector, context) {
@@ -9197,8 +9197,8 @@ var jquery_default = (
9197
9197
  },
9198
9198
  // Evaluates a script in a provided context; falls back to the global one
9199
9199
  // if not specified.
9200
- globalEval: function(code, options, doc) {
9201
- DOMEval(code, { nonce: options && options.nonce }, doc);
9200
+ globalEval: function(code, options, doc2) {
9201
+ DOMEval(code, { nonce: options && options.nonce }, doc2);
9202
9202
  },
9203
9203
  each: function(obj, callback) {
9204
9204
  var length, i2 = 0;
@@ -9325,9 +9325,9 @@ var jquery_default = (
9325
9325
  }
9326
9326
  var pop = arr.pop;
9327
9327
  var whitespace = "[\\x20\\t\\r\\n\\f]";
9328
- var isIE = document.documentMode;
9328
+ var isIE = document2.documentMode;
9329
9329
  try {
9330
- document.querySelector(":has(*,:jqfake)");
9330
+ document2.querySelector(":has(*,:jqfake)");
9331
9331
  support.cssHas = false;
9332
9332
  } catch (e) {
9333
9333
  support.cssHas = true;
@@ -9359,7 +9359,7 @@ var jquery_default = (
9359
9359
  var rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*");
9360
9360
  var rdescend = new RegExp(whitespace + "|>");
9361
9361
  var rsibling = /[+~]/;
9362
- var documentElement = document.documentElement;
9362
+ var documentElement = document2.documentElement;
9363
9363
  var matches2 = documentElement.matches || documentElement.msMatchesSelector;
9364
9364
  function createCache() {
9365
9365
  var keys = [];
@@ -9528,10 +9528,10 @@ var jquery_default = (
9528
9528
  1
9529
9529
  );
9530
9530
  if (compare & 1) {
9531
- if (a == document || a.ownerDocument == document && jQuery.contains(document, a)) {
9531
+ if (a == document2 || a.ownerDocument == document2 && jQuery.contains(document2, a)) {
9532
9532
  return -1;
9533
9533
  }
9534
- if (b == document || b.ownerDocument == document && jQuery.contains(document, b)) {
9534
+ if (b == document2 || b.ownerDocument == document2 && jQuery.contains(document2, b)) {
9535
9535
  return 1;
9536
9536
  }
9537
9537
  return 0;
@@ -9687,14 +9687,14 @@ var jquery_default = (
9687
9687
  });
9688
9688
  }
9689
9689
  function setDocument(node) {
9690
- var subWindow, doc = node ? node.ownerDocument || node : document;
9691
- if (doc == document$1 || doc.nodeType !== 9) {
9690
+ var subWindow, doc2 = node ? node.ownerDocument || node : document2;
9691
+ if (doc2 == document$1 || doc2.nodeType !== 9) {
9692
9692
  return;
9693
9693
  }
9694
- document$1 = doc;
9694
+ document$1 = doc2;
9695
9695
  documentElement$1 = document$1.documentElement;
9696
9696
  documentIsHTML = !jQuery.isXMLDoc(document$1);
9697
- if (isIE && document != document$1 && (subWindow = document$1.defaultView) && subWindow.top !== subWindow) {
9697
+ if (isIE && document2 != document$1 && (subWindow = document$1.defaultView) && subWindow.top !== subWindow) {
9698
9698
  subWindow.addEventListener("unload", unloadHandler);
9699
9699
  }
9700
9700
  }
@@ -9925,7 +9925,7 @@ var jquery_default = (
9925
9925
  }),
9926
9926
  // Miscellaneous
9927
9927
  target: function(elem) {
9928
- var hash = window.location && window.location.hash;
9928
+ var hash = window2.location && window2.location.hash;
9929
9929
  return hash && hash.slice(1) === elem.id;
9930
9930
  },
9931
9931
  root: function(elem) {
@@ -11915,9 +11915,9 @@ function createElement(ownerDocument, tagName) {
11915
11915
  return new MockUListElement(ownerDocument);
11916
11916
  }
11917
11917
  if (ownerDocument != null && tagName.includes("-")) {
11918
- const win = ownerDocument.defaultView;
11919
- if (win != null && win.customElements != null) {
11920
- return createCustomElement(win.customElements, ownerDocument, tagName);
11918
+ const win2 = ownerDocument.defaultView;
11919
+ if (win2 != null && win2.customElements != null) {
11920
+ return createCustomElement(win2.customElements, ownerDocument, tagName);
11921
11921
  }
11922
11922
  }
11923
11923
  return new MockHTMLElement(ownerDocument, tagName);
@@ -11980,6 +11980,11 @@ patchPropAttributes(
11980
11980
  type: "submit"
11981
11981
  }
11982
11982
  );
11983
+ Object.defineProperty(MockButtonElement.prototype, "form", {
11984
+ get() {
11985
+ return this.hasAttribute("form") ? this.getAttribute("form") : null;
11986
+ }
11987
+ });
11983
11988
  var MockImageElement = class extends MockHTMLElement {
11984
11989
  constructor(ownerDocument) {
11985
11990
  super(ownerDocument, "img");
@@ -12334,9 +12339,9 @@ var CanvasRenderingContext = class {
12334
12339
  }
12335
12340
  clearRect() {
12336
12341
  }
12337
- getImageData(_, __, w, h) {
12342
+ getImageData(_, __, w, h2) {
12338
12343
  return {
12339
- data: new Array(w * h * 4)
12344
+ data: new Array(w * h2 * 4)
12340
12345
  };
12341
12346
  }
12342
12347
  toDataURL() {
@@ -12398,9 +12403,9 @@ var MockCanvasElement = class extends MockHTMLElement {
12398
12403
  function fullUrl(elm, attrName) {
12399
12404
  const val = elm.getAttribute(attrName) || "";
12400
12405
  if (elm.ownerDocument != null) {
12401
- const win = elm.ownerDocument.defaultView;
12402
- if (win != null) {
12403
- const loc = win.location;
12406
+ const win2 = elm.ownerDocument.defaultView;
12407
+ if (win2 != null) {
12408
+ const loc = win2.location;
12404
12409
  if (loc != null) {
12405
12410
  try {
12406
12411
  const url = new URL(val, loc.href);
@@ -13105,10 +13110,10 @@ var MockWindow = class {
13105
13110
  }
13106
13111
  get Document() {
13107
13112
  if (this.__docCstr == null) {
13108
- const win = this;
13113
+ const win2 = this;
13109
13114
  this.__docCstr = class extends MockDocument {
13110
13115
  constructor() {
13111
- super(false, win);
13116
+ super(false, win2);
13112
13117
  throw new Error("Illegal constructor: cannot construct Document");
13113
13118
  }
13114
13119
  };
@@ -13625,14 +13630,14 @@ var MockWindow = class {
13625
13630
  }
13626
13631
  };
13627
13632
  addGlobalsToWindowPrototype(MockWindow.prototype);
13628
- function resetWindowDefaults(win) {
13629
- win.__clearInterval = nativeClearInterval;
13630
- win.__clearTimeout = nativeClearTimeout;
13631
- win.__setInterval = nativeSetInterval;
13632
- win.__setTimeout = nativeSetTimeout;
13633
- win.__maxTimeout = 3e4;
13634
- win.__allowInterval = true;
13635
- win.URL = nativeURL;
13633
+ function resetWindowDefaults(win2) {
13634
+ win2.__clearInterval = nativeClearInterval;
13635
+ win2.__clearTimeout = nativeClearTimeout;
13636
+ win2.__setInterval = nativeSetInterval;
13637
+ win2.__setTimeout = nativeSetTimeout;
13638
+ win2.__maxTimeout = 3e4;
13639
+ win2.__allowInterval = true;
13640
+ win2.URL = nativeURL;
13636
13641
  }
13637
13642
  function cloneWindow(srcWin, opts = {}) {
13638
13643
  if (srcWin == null) {
@@ -13651,72 +13656,72 @@ function cloneWindow(srcWin, opts = {}) {
13651
13656
  }
13652
13657
  return clonedWin;
13653
13658
  }
13654
- function constrainTimeouts(win) {
13655
- win.__allowInterval = false;
13656
- win.__maxTimeout = 0;
13659
+ function constrainTimeouts(win2) {
13660
+ win2.__allowInterval = false;
13661
+ win2.__maxTimeout = 0;
13657
13662
  }
13658
- function resetWindow(win) {
13659
- if (win != null) {
13660
- if (win.__timeouts) {
13661
- win.__timeouts.forEach((timeoutId) => {
13663
+ function resetWindow(win2) {
13664
+ if (win2 != null) {
13665
+ if (win2.__timeouts) {
13666
+ win2.__timeouts.forEach((timeoutId) => {
13662
13667
  nativeClearInterval(timeoutId);
13663
13668
  nativeClearTimeout(timeoutId);
13664
13669
  });
13665
- win.__timeouts.clear();
13670
+ win2.__timeouts.clear();
13666
13671
  }
13667
- if (win.customElements && win.customElements.clear) {
13668
- win.customElements.clear();
13672
+ if (win2.customElements && win2.customElements.clear) {
13673
+ win2.customElements.clear();
13669
13674
  }
13670
- resetDocument(win.document);
13671
- resetPerformance(win.performance);
13672
- for (const key in win) {
13673
- if (win.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
13674
- delete win[key];
13675
+ resetDocument(win2.document);
13676
+ resetPerformance(win2.performance);
13677
+ for (const key in win2) {
13678
+ if (win2.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
13679
+ delete win2[key];
13675
13680
  }
13676
13681
  }
13677
- resetWindowDefaults(win);
13678
- resetWindowDimensions(win);
13679
- resetEventListeners(win);
13680
- if (win.document != null) {
13682
+ resetWindowDefaults(win2);
13683
+ resetWindowDimensions(win2);
13684
+ resetEventListeners(win2);
13685
+ if (win2.document != null) {
13681
13686
  try {
13682
- win.document.defaultView = win;
13687
+ win2.document.defaultView = win2;
13683
13688
  } catch (e) {
13684
13689
  }
13685
13690
  }
13686
- win.fetch = null;
13687
- win.Headers = null;
13688
- win.Request = null;
13689
- win.Response = null;
13690
- win.FetchError = null;
13691
+ win2.fetch = null;
13692
+ win2.Headers = null;
13693
+ win2.Request = null;
13694
+ win2.Response = null;
13695
+ win2.FetchError = null;
13691
13696
  }
13692
13697
  }
13693
- function resetWindowDimensions(win) {
13698
+ function resetWindowDimensions(win2) {
13694
13699
  try {
13695
- win.devicePixelRatio = 1;
13696
- win.innerHeight = 768;
13697
- win.innerWidth = 1366;
13698
- win.pageXOffset = 0;
13699
- win.pageYOffset = 0;
13700
- win.screenLeft = 0;
13701
- win.screenTop = 0;
13702
- win.screenX = 0;
13703
- win.screenY = 0;
13704
- win.scrollX = 0;
13705
- win.scrollY = 0;
13706
- win.screen = {
13707
- availHeight: win.innerHeight,
13700
+ win2.devicePixelRatio = 1;
13701
+ win2.innerHeight = 768;
13702
+ win2.innerWidth = 1366;
13703
+ win2.pageXOffset = 0;
13704
+ win2.pageYOffset = 0;
13705
+ win2.screenLeft = 0;
13706
+ win2.screenTop = 0;
13707
+ win2.screenX = 0;
13708
+ win2.screenY = 0;
13709
+ win2.scrollX = 0;
13710
+ win2.scrollY = 0;
13711
+ win2.screen = {
13712
+ availHeight: win2.innerHeight,
13708
13713
  availLeft: 0,
13709
13714
  availTop: 0,
13710
- availWidth: win.innerWidth,
13715
+ availWidth: win2.innerWidth,
13711
13716
  colorDepth: 24,
13712
- height: win.innerHeight,
13717
+ height: win2.innerHeight,
13713
13718
  keepAwake: false,
13714
13719
  orientation: {
13715
13720
  angle: 0,
13716
13721
  type: "portrait-primary"
13717
13722
  },
13718
13723
  pixelDepth: 24,
13719
- width: win.innerWidth
13724
+ width: win2.innerWidth
13720
13725
  };
13721
13726
  } catch (e) {
13722
13727
  }
@@ -13724,11 +13729,11 @@ function resetWindowDimensions(win) {
13724
13729
 
13725
13730
  // src/mock-doc/document.ts
13726
13731
  var MockDocument = class _MockDocument extends MockHTMLElement {
13727
- constructor(html = null, win = null) {
13732
+ constructor(html = null, win2 = null) {
13728
13733
  super(null, null);
13729
13734
  this.nodeName = "#document" /* DOCUMENT_NODE */;
13730
13735
  this.nodeType = 9 /* DOCUMENT_NODE */;
13731
- this.defaultView = win;
13736
+ this.defaultView = win2;
13732
13737
  this.cookie = "";
13733
13738
  this.referrer = "";
13734
13739
  this.appendChild(this.createDocumentTypeNode());
@@ -13875,10 +13880,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
13875
13880
  }
13876
13881
  createElement(tagName) {
13877
13882
  if (tagName === "#document" /* DOCUMENT_NODE */) {
13878
- const doc = new _MockDocument(false);
13879
- doc.nodeName = tagName;
13880
- doc.parentNode = null;
13881
- return doc;
13883
+ const doc2 = new _MockDocument(false);
13884
+ doc2.nodeName = tagName;
13885
+ doc2.parentNode = null;
13886
+ return doc2;
13882
13887
  }
13883
13888
  return createElement(this, tagName);
13884
13889
  }
@@ -13918,10 +13923,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
13918
13923
  title.textContent = value;
13919
13924
  }
13920
13925
  };
13921
- function resetDocument(doc) {
13922
- if (doc != null) {
13923
- resetEventListeners(doc);
13924
- const documentElement = doc.documentElement;
13926
+ function resetDocument(doc2) {
13927
+ if (doc2 != null) {
13928
+ resetEventListeners(doc2);
13929
+ const documentElement = doc2.documentElement;
13925
13930
  if (documentElement != null) {
13926
13931
  resetElement(documentElement);
13927
13932
  for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
@@ -13930,25 +13935,25 @@ function resetDocument(doc) {
13930
13935
  childNode.childNodes.length = 0;
13931
13936
  }
13932
13937
  }
13933
- for (const key in doc) {
13934
- if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
13935
- delete doc[key];
13938
+ for (const key in doc2) {
13939
+ if (doc2.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
13940
+ delete doc2[key];
13936
13941
  }
13937
13942
  }
13938
13943
  try {
13939
- doc.nodeName = "#document" /* DOCUMENT_NODE */;
13944
+ doc2.nodeName = "#document" /* DOCUMENT_NODE */;
13940
13945
  } catch (e) {
13941
13946
  }
13942
13947
  try {
13943
- doc.nodeType = 9 /* DOCUMENT_NODE */;
13948
+ doc2.nodeType = 9 /* DOCUMENT_NODE */;
13944
13949
  } catch (e) {
13945
13950
  }
13946
13951
  try {
13947
- doc.cookie = "";
13952
+ doc2.cookie = "";
13948
13953
  } catch (e) {
13949
13954
  }
13950
13955
  try {
13951
- doc.referrer = "";
13956
+ doc2.referrer = "";
13952
13957
  } catch (e) {
13953
13958
  }
13954
13959
  }
@@ -14004,14 +14009,65 @@ function createWindowFromHtml(templateHtml, uniqueId) {
14004
14009
  templateWindow = new MockWindow(templateHtml);
14005
14010
  templateWindows.set(uniqueId, templateWindow);
14006
14011
  }
14007
- const win = cloneWindow(templateWindow);
14008
- return win;
14012
+ const win2 = cloneWindow(templateWindow);
14013
+ return win2;
14009
14014
  }
14010
14015
 
14011
14016
  // src/hydrate/runner/render.ts
14012
14017
  import { Readable } from "stream";
14013
14018
  import { hydrateFactory } from "@stencil/core/hydrate-factory";
14014
14019
 
14020
+ // src/client/client-build.ts
14021
+ import { BUILD } from "@stencil/core/internal/app-data";
14022
+ var Build = {
14023
+ isDev: BUILD.isDev ? true : false,
14024
+ isBrowser: true,
14025
+ isServer: false,
14026
+ isTesting: BUILD.isTesting ? true : false
14027
+ };
14028
+
14029
+ // src/client/client-host-ref.ts
14030
+ import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
14031
+ var hostRefs = BUILD2.hotModuleReplacement ? window.__STENCIL_HOSTREFS__ || (window.__STENCIL_HOSTREFS__ = /* @__PURE__ */ new WeakMap()) : /* @__PURE__ */ new WeakMap();
14032
+
14033
+ // src/client/client-load-module.ts
14034
+ import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
14035
+
14036
+ // src/client/client-log.ts
14037
+ import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
14038
+ var STENCIL_DEV_MODE = BUILD3.isTesting ? ["STENCIL:"] : [
14039
+ "%cstencil",
14040
+ "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
14041
+ ];
14042
+
14043
+ // src/client/client-style.ts
14044
+ var modeResolutionChain = [];
14045
+
14046
+ // src/client/client-task-queue.ts
14047
+ import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
14048
+
14049
+ // src/client/client-window.ts
14050
+ import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
14051
+ var win = typeof window !== "undefined" ? window : {};
14052
+ var doc = win.document || { head: {} };
14053
+ var H = win.HTMLElement || class {
14054
+ };
14055
+ var supportsShadow = BUILD5.shadowDom;
14056
+ var supportsConstructableStylesheets = BUILD5.constructableCSS ? /* @__PURE__ */ (() => {
14057
+ try {
14058
+ new CSSStyleSheet();
14059
+ return typeof new CSSStyleSheet().replaceSync === "function";
14060
+ } catch (e) {
14061
+ }
14062
+ return false;
14063
+ })() : false;
14064
+
14065
+ // src/client/index.ts
14066
+ import { BUILD as BUILD27, Env, NAMESPACE as NAMESPACE2 } from "@stencil/core/internal/app-data";
14067
+
14068
+ // src/runtime/bootstrap-custom-element.ts
14069
+ import { BUILD as BUILD24 } from "@stencil/core/internal/app-data";
14070
+
14015
14071
  // src/utils/helpers.ts
14016
14072
  var isString = (v) => typeof v === "string";
14017
14073
 
@@ -14102,15 +14158,77 @@ var unwrapErr = (result) => {
14102
14158
  }
14103
14159
  };
14104
14160
 
14161
+ // src/runtime/connected-callback.ts
14162
+ import { BUILD as BUILD21 } from "@stencil/core/internal/app-data";
14163
+
14164
+ // src/runtime/client-hydrate.ts
14165
+ import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
14166
+
14167
+ // src/runtime/profile.ts
14168
+ import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
14169
+
14170
+ // src/runtime/vdom/h.ts
14171
+ import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
14172
+
14173
+ // src/runtime/initialize-component.ts
14174
+ import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
14175
+
14176
+ // src/runtime/mode.ts
14177
+ var setMode = (handler) => modeResolutionChain.push(handler);
14178
+
14179
+ // src/runtime/proxy-component.ts
14180
+ import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
14181
+
14182
+ // src/runtime/set-value.ts
14183
+ import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
14184
+
14185
+ // src/runtime/parse-property-value.ts
14186
+ import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
14187
+
14188
+ // src/runtime/update-component.ts
14189
+ import { BUILD as BUILD17, NAMESPACE } from "@stencil/core/internal/app-data";
14190
+
14191
+ // src/runtime/event-emitter.ts
14192
+ import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
14193
+
14194
+ // src/runtime/element.ts
14195
+ import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
14196
+
14197
+ // src/runtime/styles.ts
14198
+ import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
14199
+
14200
+ // src/runtime/vdom/vdom-render.ts
14201
+ import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
14202
+
14203
+ // src/runtime/vdom/update-element.ts
14204
+ import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
14205
+
14206
+ // src/runtime/vdom/set-accessor.ts
14207
+ import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
14208
+ var CAPTURE_EVENT_SUFFIX = "Capture";
14209
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
14210
+
14211
+ // src/runtime/disconnected-callback.ts
14212
+ import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
14213
+
14214
+ // src/runtime/dom-extras.ts
14215
+ import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
14216
+
14217
+ // src/runtime/bootstrap-lazy.ts
14218
+ import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
14219
+
14220
+ // src/runtime/host-listener.ts
14221
+ import { BUILD as BUILD26 } from "@stencil/core/internal/app-data";
14222
+
14105
14223
  // src/compiler/html/canonical-link.ts
14106
- var updateCanonicalLink = (doc, href) => {
14224
+ var updateCanonicalLink = (doc2, href) => {
14107
14225
  var _a2;
14108
- let canonicalLinkElm = doc.head.querySelector('link[rel="canonical"]');
14226
+ let canonicalLinkElm = doc2.head.querySelector('link[rel="canonical"]');
14109
14227
  if (typeof href === "string") {
14110
14228
  if (canonicalLinkElm == null) {
14111
- canonicalLinkElm = doc.createElement("link");
14229
+ canonicalLinkElm = doc2.createElement("link");
14112
14230
  canonicalLinkElm.setAttribute("rel", "canonical");
14113
- doc.head.appendChild(canonicalLinkElm);
14231
+ doc2.head.appendChild(canonicalLinkElm);
14114
14232
  }
14115
14233
  canonicalLinkElm.setAttribute("href", href);
14116
14234
  } else {
@@ -14124,11 +14242,11 @@ var updateCanonicalLink = (doc, href) => {
14124
14242
  };
14125
14243
 
14126
14244
  // src/compiler/html/relocate-meta-charset.ts
14127
- var relocateMetaCharset = (doc) => {
14128
- const head = doc.head;
14245
+ var relocateMetaCharset = (doc2) => {
14246
+ const head = doc2.head;
14129
14247
  let charsetElm = head.querySelector("meta[charset]");
14130
14248
  if (charsetElm == null) {
14131
- charsetElm = doc.createElement("meta");
14249
+ charsetElm = doc2.createElement("meta");
14132
14250
  charsetElm.setAttribute("charset", "utf-8");
14133
14251
  } else {
14134
14252
  charsetElm.remove();
@@ -14403,13 +14521,13 @@ var parseCss = (css, filePath) => {
14403
14521
  const m = match(/^@([-\w]+)?document *([^{]+)/);
14404
14522
  if (!m) return null;
14405
14523
  const vendor = trim(m[1]);
14406
- const doc = trim(m[2]);
14524
+ const doc2 = trim(m[2]);
14407
14525
  if (!open()) return error(`@document missing '{'`);
14408
14526
  const style = comments().concat(rules());
14409
14527
  if (!close()) return error(`@document missing '}'`);
14410
14528
  return pos({
14411
14529
  type: 3 /* Document */,
14412
- document: doc,
14530
+ document: doc2,
14413
14531
  vendor,
14414
14532
  rules: style
14415
14533
  });
@@ -14735,11 +14853,11 @@ var serializeCssPage = (opts, node) => {
14735
14853
  };
14736
14854
  var serializeCssDocument = (opts, node) => {
14737
14855
  const documentCss = serializeCssMapVisit(opts, node.rules);
14738
- const doc = "@" + (node.vendor || "") + "document " + node.document;
14856
+ const doc2 = "@" + (node.vendor || "") + "document " + node.document;
14739
14857
  if (documentCss === "") {
14740
14858
  return "";
14741
14859
  }
14742
- return doc + "{" + documentCss + "}";
14860
+ return doc2 + "{" + documentCss + "}";
14743
14861
  };
14744
14862
  var serializeCssMapVisit = (opts, nodes) => {
14745
14863
  let rtn = "";
@@ -14837,12 +14955,12 @@ var collectUsedSelectors = (usedSelectors, elm) => {
14837
14955
  };
14838
14956
 
14839
14957
  // src/compiler/html/remove-unused-styles.ts
14840
- var removeUnusedStyles = (doc, diagnostics) => {
14958
+ var removeUnusedStyles = (doc2, diagnostics) => {
14841
14959
  try {
14842
- const styleElms = doc.head.querySelectorAll(`style[data-styles]`);
14960
+ const styleElms = doc2.head.querySelectorAll(`style[data-styles]`);
14843
14961
  const styleLen = styleElms.length;
14844
14962
  if (styleLen > 0) {
14845
- const usedSelectors = getUsedSelectors(doc.documentElement);
14963
+ const usedSelectors = getUsedSelectors(doc2.documentElement);
14846
14964
  for (let i = 0; i < styleLen; i++) {
14847
14965
  removeUnusedStyleText(usedSelectors, diagnostics, styleElms[i]);
14848
14966
  }
@@ -14975,49 +15093,49 @@ function collectAttributes(node) {
14975
15093
  var SKIP_ATTRS = /* @__PURE__ */ new Set(["s-id", "c-id"]);
14976
15094
 
14977
15095
  // src/hydrate/runner/patch-dom-implementation.ts
14978
- function patchDomImplementation(doc, opts) {
14979
- let win;
14980
- if (doc.defaultView != null) {
15096
+ function patchDomImplementation(doc2, opts) {
15097
+ let win2;
15098
+ if (doc2.defaultView != null) {
14981
15099
  opts.destroyWindow = true;
14982
- patchWindow(doc.defaultView);
14983
- win = doc.defaultView;
15100
+ patchWindow(doc2.defaultView);
15101
+ win2 = doc2.defaultView;
14984
15102
  } else {
14985
15103
  opts.destroyWindow = true;
14986
15104
  opts.destroyDocument = false;
14987
- win = new MockWindow(false);
15105
+ win2 = new MockWindow(false);
14988
15106
  }
14989
- if (win.document !== doc) {
14990
- win.document = doc;
15107
+ if (win2.document !== doc2) {
15108
+ win2.document = doc2;
14991
15109
  }
14992
- if (doc.defaultView !== win) {
14993
- doc.defaultView = win;
15110
+ if (doc2.defaultView !== win2) {
15111
+ doc2.defaultView = win2;
14994
15112
  }
14995
- const HTMLElement = doc.documentElement.constructor.prototype;
14996
- if (typeof HTMLElement.getRootNode !== "function") {
14997
- const elm = doc.createElement("unknown-element");
15113
+ const HTMLElement2 = doc2.documentElement.constructor.prototype;
15114
+ if (typeof HTMLElement2.getRootNode !== "function") {
15115
+ const elm = doc2.createElement("unknown-element");
14998
15116
  const HTMLUnknownElement = elm.constructor.prototype;
14999
15117
  HTMLUnknownElement.getRootNode = getRootNode;
15000
15118
  }
15001
- if (typeof doc.createEvent === "function") {
15002
- const CustomEvent = doc.createEvent("CustomEvent").constructor;
15003
- if (win.CustomEvent !== CustomEvent) {
15004
- win.CustomEvent = CustomEvent;
15119
+ if (typeof doc2.createEvent === "function") {
15120
+ const CustomEvent2 = doc2.createEvent("CustomEvent").constructor;
15121
+ if (win2.CustomEvent !== CustomEvent2) {
15122
+ win2.CustomEvent = CustomEvent2;
15005
15123
  }
15006
15124
  }
15007
15125
  try {
15008
- win.__stencil_baseURI = doc.baseURI;
15126
+ win2.__stencil_baseURI = doc2.baseURI;
15009
15127
  } catch (e) {
15010
- Object.defineProperty(doc, "baseURI", {
15128
+ Object.defineProperty(doc2, "baseURI", {
15011
15129
  get() {
15012
- const baseElm = doc.querySelector("base[href]");
15130
+ const baseElm = doc2.querySelector("base[href]");
15013
15131
  if (baseElm) {
15014
- return new URL(baseElm.getAttribute("href"), win.location.href).href;
15132
+ return new URL(baseElm.getAttribute("href"), win2.location.href).href;
15015
15133
  }
15016
- return win.location.href;
15134
+ return win2.location.href;
15017
15135
  }
15018
15136
  });
15019
15137
  }
15020
- return win;
15138
+ return win2;
15021
15139
  }
15022
15140
  function getRootNode(opts) {
15023
15141
  const isComposed = opts != null && opts.composed === true;
@@ -15170,10 +15288,10 @@ function renderCatchError(results, err2) {
15170
15288
  }
15171
15289
 
15172
15290
  // src/hydrate/runner/runtime-log.ts
15173
- function runtimeLogging(win, opts, results) {
15291
+ function runtimeLogging(win2, opts, results) {
15174
15292
  try {
15175
- const pathname = win.location.pathname;
15176
- win.console.error = (...msgs) => {
15293
+ const pathname = win2.location.pathname;
15294
+ win2.console.error = (...msgs) => {
15177
15295
  const errMsg = msgs.reduce((errMsg2, m) => {
15178
15296
  if (m) {
15179
15297
  if (m.stack != null) {
@@ -15193,7 +15311,7 @@ function runtimeLogging(win, opts, results) {
15193
15311
  }
15194
15312
  }
15195
15313
  };
15196
- win.console.debug = (...msgs) => {
15314
+ win2.console.debug = (...msgs) => {
15197
15315
  renderBuildDiagnostic(results, "debug", "Hydrate Debug", [...msgs].join(", "));
15198
15316
  if (opts.runtimeLogging) {
15199
15317
  runtimeLog(pathname, "debug", msgs);
@@ -15201,7 +15319,7 @@ function runtimeLogging(win, opts, results) {
15201
15319
  };
15202
15320
  if (opts.runtimeLogging) {
15203
15321
  ["log", "warn", "assert", "info", "trace"].forEach((type) => {
15204
- win.console[type] = (...msgs) => {
15322
+ win2.console[type] = (...msgs) => {
15205
15323
  runtimeLog(pathname, type, msgs);
15206
15324
  };
15207
15325
  });
@@ -15215,58 +15333,58 @@ function runtimeLog(pathname, type, msgs) {
15215
15333
  }
15216
15334
 
15217
15335
  // src/hydrate/runner/window-initialize.ts
15218
- function initializeWindow(win, doc, opts, results) {
15336
+ function initializeWindow(win2, doc2, opts, results) {
15219
15337
  if (typeof opts.url === "string") {
15220
15338
  try {
15221
- win.location.href = opts.url;
15339
+ win2.location.href = opts.url;
15222
15340
  } catch (e) {
15223
15341
  }
15224
15342
  }
15225
15343
  if (typeof opts.userAgent === "string") {
15226
15344
  try {
15227
- win.navigator.userAgent = opts.userAgent;
15345
+ win2.navigator.userAgent = opts.userAgent;
15228
15346
  } catch (e) {
15229
15347
  }
15230
15348
  }
15231
15349
  if (typeof opts.cookie === "string") {
15232
15350
  try {
15233
- doc.cookie = opts.cookie;
15351
+ doc2.cookie = opts.cookie;
15234
15352
  } catch (e) {
15235
15353
  }
15236
15354
  }
15237
15355
  if (typeof opts.referrer === "string") {
15238
15356
  try {
15239
- doc.referrer = opts.referrer;
15357
+ doc2.referrer = opts.referrer;
15240
15358
  } catch (e) {
15241
15359
  }
15242
15360
  }
15243
15361
  if (typeof opts.direction === "string") {
15244
15362
  try {
15245
- doc.documentElement.setAttribute("dir", opts.direction);
15363
+ doc2.documentElement.setAttribute("dir", opts.direction);
15246
15364
  } catch (e) {
15247
15365
  }
15248
15366
  }
15249
15367
  if (typeof opts.language === "string") {
15250
15368
  try {
15251
- doc.documentElement.setAttribute("lang", opts.language);
15369
+ doc2.documentElement.setAttribute("lang", opts.language);
15252
15370
  } catch (e) {
15253
15371
  }
15254
15372
  }
15255
15373
  if (typeof opts.buildId === "string") {
15256
15374
  try {
15257
- doc.documentElement.setAttribute("data-stencil-build", opts.buildId);
15375
+ doc2.documentElement.setAttribute("data-stencil-build", opts.buildId);
15258
15376
  } catch (e) {
15259
15377
  }
15260
15378
  }
15261
15379
  try {
15262
- win.customElements = null;
15380
+ win2.customElements = null;
15263
15381
  } catch (e) {
15264
15382
  }
15265
15383
  if (opts.constrainTimeouts) {
15266
- constrainTimeouts(win);
15384
+ constrainTimeouts(win2);
15267
15385
  }
15268
- runtimeLogging(win, opts, results);
15269
- return win;
15386
+ runtimeLogging(win2, opts, results);
15387
+ return win2;
15270
15388
  }
15271
15389
 
15272
15390
  // src/hydrate/runner/render.ts
@@ -15283,44 +15401,44 @@ function renderToString(html, options, asStream) {
15283
15401
  opts.constrainTimeouts = false;
15284
15402
  return hydrateDocument(html, opts, asStream);
15285
15403
  }
15286
- function hydrateDocument(doc, options, asStream) {
15404
+ function hydrateDocument(doc2, options, asStream) {
15287
15405
  const opts = normalizeHydrateOptions(options);
15288
- let win = null;
15406
+ let win2 = null;
15289
15407
  const results = generateHydrateResults(opts);
15290
15408
  if (hasError(results.diagnostics)) {
15291
15409
  return Promise.resolve(results);
15292
15410
  }
15293
- if (typeof doc === "string") {
15411
+ if (typeof doc2 === "string") {
15294
15412
  try {
15295
15413
  opts.destroyWindow = true;
15296
15414
  opts.destroyDocument = true;
15297
- win = new MockWindow(doc);
15415
+ win2 = new MockWindow(doc2);
15298
15416
  if (!asStream) {
15299
- return render(win, opts, results).then(() => results);
15417
+ return render(win2, opts, results).then(() => results);
15300
15418
  }
15301
- return renderStream(win, opts, results);
15419
+ return renderStream(win2, opts, results);
15302
15420
  } catch (e) {
15303
- if (win && win.close) {
15304
- win.close();
15421
+ if (win2 && win2.close) {
15422
+ win2.close();
15305
15423
  }
15306
- win = null;
15424
+ win2 = null;
15307
15425
  renderCatchError(results, e);
15308
15426
  return Promise.resolve(results);
15309
15427
  }
15310
15428
  }
15311
- if (isValidDocument(doc)) {
15429
+ if (isValidDocument(doc2)) {
15312
15430
  try {
15313
15431
  opts.destroyDocument = false;
15314
- win = patchDomImplementation(doc, opts);
15432
+ win2 = patchDomImplementation(doc2, opts);
15315
15433
  if (!asStream) {
15316
- return render(win, opts, results).then(() => results);
15434
+ return render(win2, opts, results).then(() => results);
15317
15435
  }
15318
- return renderStream(win, opts, results);
15436
+ return renderStream(win2, opts, results);
15319
15437
  } catch (e) {
15320
- if (win && win.close) {
15321
- win.close();
15438
+ if (win2 && win2.close) {
15439
+ win2.close();
15322
15440
  }
15323
- win = null;
15441
+ win2 = null;
15324
15442
  renderCatchError(results, e);
15325
15443
  return Promise.resolve(results);
15326
15444
  }
@@ -15328,75 +15446,81 @@ function hydrateDocument(doc, options, asStream) {
15328
15446
  renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
15329
15447
  return Promise.resolve(results);
15330
15448
  }
15331
- async function render(win, opts, results) {
15449
+ async function render(win2, opts, results) {
15332
15450
  if ("process" in globalThis && typeof process.on === "function" && !process.__stencilErrors) {
15333
15451
  process.__stencilErrors = true;
15334
15452
  process.on("unhandledRejection", (e) => {
15335
15453
  console.log("unhandledRejection", e);
15336
15454
  });
15337
15455
  }
15338
- initializeWindow(win, win.document, opts, results);
15456
+ initializeWindow(win2, win2.document, opts, results);
15339
15457
  const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate : NOOP;
15340
15458
  try {
15341
- await Promise.resolve(beforeHydrateFn(win.document));
15342
- return new Promise((resolve) => hydrateFactory(win, opts, results, afterHydrate, resolve));
15459
+ await Promise.resolve(beforeHydrateFn(win2.document));
15460
+ return new Promise((resolve) => {
15461
+ if (typeof opts.mode === "function") {
15462
+ modeResolutionChain.length = 0;
15463
+ setMode(opts.mode);
15464
+ }
15465
+ return hydrateFactory(win2, opts, results, afterHydrate, resolve);
15466
+ });
15343
15467
  } catch (e) {
15344
15468
  renderCatchError(results, e);
15345
- return finalizeHydrate(win, win.document, opts, results);
15469
+ return finalizeHydrate(win2, win2.document, opts, results);
15346
15470
  }
15347
15471
  }
15348
- function renderStream(win, opts, results) {
15472
+ function renderStream(win2, opts, results) {
15349
15473
  async function* processRender() {
15350
- const renderResult = await render(win, opts, results);
15474
+ const renderResult = await render(win2, opts, results);
15351
15475
  yield renderResult.html;
15352
15476
  }
15353
15477
  return Readable.from(processRender());
15354
15478
  }
15355
- async function afterHydrate(win, opts, results, resolve) {
15479
+ async function afterHydrate(win2, opts, results, resolve) {
15356
15480
  const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate : NOOP;
15357
15481
  try {
15358
- await Promise.resolve(afterHydrateFn(win.document));
15359
- return resolve(finalizeHydrate(win, win.document, opts, results));
15482
+ await Promise.resolve(afterHydrateFn(win2.document));
15483
+ return resolve(finalizeHydrate(win2, win2.document, opts, results));
15360
15484
  } catch (e) {
15361
15485
  renderCatchError(results, e);
15362
- return resolve(finalizeHydrate(win, win.document, opts, results));
15486
+ return resolve(finalizeHydrate(win2, win2.document, opts, results));
15363
15487
  }
15364
15488
  }
15365
- function finalizeHydrate(win, doc, opts, results) {
15489
+ function finalizeHydrate(win2, doc2, opts, results) {
15366
15490
  try {
15367
- inspectElement(results, doc.documentElement, 0);
15491
+ inspectElement(results, doc2.documentElement, 0);
15368
15492
  if (opts.removeUnusedStyles !== false) {
15369
15493
  try {
15370
- removeUnusedStyles(doc, results.diagnostics);
15494
+ removeUnusedStyles(doc2, results.diagnostics);
15371
15495
  } catch (e) {
15372
15496
  renderCatchError(results, e);
15373
15497
  }
15374
15498
  }
15375
15499
  if (typeof opts.title === "string") {
15376
15500
  try {
15377
- doc.title = opts.title;
15501
+ doc2.title = opts.title;
15378
15502
  } catch (e) {
15379
15503
  renderCatchError(results, e);
15380
15504
  }
15381
15505
  }
15382
- results.title = doc.title;
15506
+ results.title = doc2.title;
15383
15507
  if (opts.removeScripts) {
15384
- removeScripts(doc.documentElement);
15508
+ removeScripts(doc2.documentElement);
15385
15509
  }
15386
15510
  try {
15387
- updateCanonicalLink(doc, opts.canonicalUrl);
15511
+ updateCanonicalLink(doc2, opts.canonicalUrl);
15388
15512
  } catch (e) {
15389
15513
  renderCatchError(results, e);
15390
15514
  }
15391
15515
  try {
15392
- relocateMetaCharset(doc);
15516
+ relocateMetaCharset(doc2);
15393
15517
  } catch (e) {
15394
15518
  }
15395
15519
  if (!hasError(results.diagnostics)) {
15396
15520
  results.httpStatus = 200;
15397
15521
  }
15398
15522
  try {
15399
- const metaStatus = doc.head.querySelector('meta[http-equiv="status"]');
15523
+ const metaStatus = doc2.head.querySelector('meta[http-equiv="status"]');
15400
15524
  if (metaStatus != null) {
15401
15525
  const metaStatusContent = metaStatus.getAttribute("content");
15402
15526
  if (metaStatusContent && metaStatusContent.length > 0) {
@@ -15406,35 +15530,35 @@ function finalizeHydrate(win, doc, opts, results) {
15406
15530
  } catch (e) {
15407
15531
  }
15408
15532
  if (opts.clientHydrateAnnotations) {
15409
- doc.documentElement.classList.add("hydrated");
15533
+ doc2.documentElement.classList.add("hydrated");
15410
15534
  }
15411
15535
  if (opts.serializeToHtml) {
15412
- results.html = serializeDocumentToString(doc, opts);
15536
+ results.html = serializeDocumentToString(doc2, opts);
15413
15537
  }
15414
15538
  } catch (e) {
15415
15539
  renderCatchError(results, e);
15416
15540
  }
15417
- destroyWindow(win, doc, opts, results);
15541
+ destroyWindow(win2, doc2, opts, results);
15418
15542
  return results;
15419
15543
  }
15420
- function destroyWindow(win, doc, opts, results) {
15544
+ function destroyWindow(win2, doc2, opts, results) {
15421
15545
  if (!opts.destroyWindow) {
15422
15546
  return;
15423
15547
  }
15424
15548
  try {
15425
15549
  if (!opts.destroyDocument) {
15426
- win.document = null;
15427
- doc.defaultView = null;
15550
+ win2.document = null;
15551
+ doc2.defaultView = null;
15428
15552
  }
15429
- if (win.close) {
15430
- win.close();
15553
+ if (win2.close) {
15554
+ win2.close();
15431
15555
  }
15432
15556
  } catch (e) {
15433
15557
  renderCatchError(results, e);
15434
15558
  }
15435
15559
  }
15436
- function serializeDocumentToString(doc, opts) {
15437
- return serializeNodeToHtml(doc, {
15560
+ function serializeDocumentToString(doc2, opts) {
15561
+ return serializeNodeToHtml(doc2, {
15438
15562
  approximateLineWidth: opts.approximateLineWidth,
15439
15563
  outerHtml: false,
15440
15564
  prettyHtml: opts.prettyHtml,
@@ -15446,8 +15570,8 @@ function serializeDocumentToString(doc, opts) {
15446
15570
  fullDocument: opts.fullDocument
15447
15571
  });
15448
15572
  }
15449
- function isValidDocument(doc) {
15450
- return doc != null && doc.nodeType === 9 && doc.documentElement != null && doc.documentElement.nodeType === 1 && doc.body != null && doc.body.nodeType === 1;
15573
+ function isValidDocument(doc2) {
15574
+ return doc2 != null && doc2.nodeType === 9 && doc2.documentElement != null && doc2.documentElement.nodeType === 1 && doc2.body != null && doc2.body.nodeType === 1;
15451
15575
  }
15452
15576
  function removeScripts(elm) {
15453
15577
  const children = elm.children;