@stencil/core 4.21.0-dev.1724734910.f741f44 → 4.21.0-dev.1724797245.5ff5ee2

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.21.0-dev.1724734910.f741f44 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Runner v4.21.0-dev.1724797245.5ff5ee2 | 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);
@@ -12339,9 +12339,9 @@ var CanvasRenderingContext = class {
12339
12339
  }
12340
12340
  clearRect() {
12341
12341
  }
12342
- getImageData(_, __, w, h) {
12342
+ getImageData(_, __, w, h2) {
12343
12343
  return {
12344
- data: new Array(w * h * 4)
12344
+ data: new Array(w * h2 * 4)
12345
12345
  };
12346
12346
  }
12347
12347
  toDataURL() {
@@ -12403,9 +12403,9 @@ var MockCanvasElement = class extends MockHTMLElement {
12403
12403
  function fullUrl(elm, attrName) {
12404
12404
  const val = elm.getAttribute(attrName) || "";
12405
12405
  if (elm.ownerDocument != null) {
12406
- const win = elm.ownerDocument.defaultView;
12407
- if (win != null) {
12408
- const loc = win.location;
12406
+ const win2 = elm.ownerDocument.defaultView;
12407
+ if (win2 != null) {
12408
+ const loc = win2.location;
12409
12409
  if (loc != null) {
12410
12410
  try {
12411
12411
  const url = new URL(val, loc.href);
@@ -13110,10 +13110,10 @@ var MockWindow = class {
13110
13110
  }
13111
13111
  get Document() {
13112
13112
  if (this.__docCstr == null) {
13113
- const win = this;
13113
+ const win2 = this;
13114
13114
  this.__docCstr = class extends MockDocument {
13115
13115
  constructor() {
13116
- super(false, win);
13116
+ super(false, win2);
13117
13117
  throw new Error("Illegal constructor: cannot construct Document");
13118
13118
  }
13119
13119
  };
@@ -13630,14 +13630,14 @@ var MockWindow = class {
13630
13630
  }
13631
13631
  };
13632
13632
  addGlobalsToWindowPrototype(MockWindow.prototype);
13633
- function resetWindowDefaults(win) {
13634
- win.__clearInterval = nativeClearInterval;
13635
- win.__clearTimeout = nativeClearTimeout;
13636
- win.__setInterval = nativeSetInterval;
13637
- win.__setTimeout = nativeSetTimeout;
13638
- win.__maxTimeout = 3e4;
13639
- win.__allowInterval = true;
13640
- 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;
13641
13641
  }
13642
13642
  function cloneWindow(srcWin, opts = {}) {
13643
13643
  if (srcWin == null) {
@@ -13656,72 +13656,72 @@ function cloneWindow(srcWin, opts = {}) {
13656
13656
  }
13657
13657
  return clonedWin;
13658
13658
  }
13659
- function constrainTimeouts(win) {
13660
- win.__allowInterval = false;
13661
- win.__maxTimeout = 0;
13659
+ function constrainTimeouts(win2) {
13660
+ win2.__allowInterval = false;
13661
+ win2.__maxTimeout = 0;
13662
13662
  }
13663
- function resetWindow(win) {
13664
- if (win != null) {
13665
- if (win.__timeouts) {
13666
- win.__timeouts.forEach((timeoutId) => {
13663
+ function resetWindow(win2) {
13664
+ if (win2 != null) {
13665
+ if (win2.__timeouts) {
13666
+ win2.__timeouts.forEach((timeoutId) => {
13667
13667
  nativeClearInterval(timeoutId);
13668
13668
  nativeClearTimeout(timeoutId);
13669
13669
  });
13670
- win.__timeouts.clear();
13670
+ win2.__timeouts.clear();
13671
13671
  }
13672
- if (win.customElements && win.customElements.clear) {
13673
- win.customElements.clear();
13672
+ if (win2.customElements && win2.customElements.clear) {
13673
+ win2.customElements.clear();
13674
13674
  }
13675
- resetDocument(win.document);
13676
- resetPerformance(win.performance);
13677
- for (const key in win) {
13678
- if (win.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
13679
- 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];
13680
13680
  }
13681
13681
  }
13682
- resetWindowDefaults(win);
13683
- resetWindowDimensions(win);
13684
- resetEventListeners(win);
13685
- if (win.document != null) {
13682
+ resetWindowDefaults(win2);
13683
+ resetWindowDimensions(win2);
13684
+ resetEventListeners(win2);
13685
+ if (win2.document != null) {
13686
13686
  try {
13687
- win.document.defaultView = win;
13687
+ win2.document.defaultView = win2;
13688
13688
  } catch (e) {
13689
13689
  }
13690
13690
  }
13691
- win.fetch = null;
13692
- win.Headers = null;
13693
- win.Request = null;
13694
- win.Response = null;
13695
- win.FetchError = null;
13691
+ win2.fetch = null;
13692
+ win2.Headers = null;
13693
+ win2.Request = null;
13694
+ win2.Response = null;
13695
+ win2.FetchError = null;
13696
13696
  }
13697
13697
  }
13698
- function resetWindowDimensions(win) {
13698
+ function resetWindowDimensions(win2) {
13699
13699
  try {
13700
- win.devicePixelRatio = 1;
13701
- win.innerHeight = 768;
13702
- win.innerWidth = 1366;
13703
- win.pageXOffset = 0;
13704
- win.pageYOffset = 0;
13705
- win.screenLeft = 0;
13706
- win.screenTop = 0;
13707
- win.screenX = 0;
13708
- win.screenY = 0;
13709
- win.scrollX = 0;
13710
- win.scrollY = 0;
13711
- win.screen = {
13712
- 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,
13713
13713
  availLeft: 0,
13714
13714
  availTop: 0,
13715
- availWidth: win.innerWidth,
13715
+ availWidth: win2.innerWidth,
13716
13716
  colorDepth: 24,
13717
- height: win.innerHeight,
13717
+ height: win2.innerHeight,
13718
13718
  keepAwake: false,
13719
13719
  orientation: {
13720
13720
  angle: 0,
13721
13721
  type: "portrait-primary"
13722
13722
  },
13723
13723
  pixelDepth: 24,
13724
- width: win.innerWidth
13724
+ width: win2.innerWidth
13725
13725
  };
13726
13726
  } catch (e) {
13727
13727
  }
@@ -13729,11 +13729,11 @@ function resetWindowDimensions(win) {
13729
13729
 
13730
13730
  // src/mock-doc/document.ts
13731
13731
  var MockDocument = class _MockDocument extends MockHTMLElement {
13732
- constructor(html = null, win = null) {
13732
+ constructor(html = null, win2 = null) {
13733
13733
  super(null, null);
13734
13734
  this.nodeName = "#document" /* DOCUMENT_NODE */;
13735
13735
  this.nodeType = 9 /* DOCUMENT_NODE */;
13736
- this.defaultView = win;
13736
+ this.defaultView = win2;
13737
13737
  this.cookie = "";
13738
13738
  this.referrer = "";
13739
13739
  this.appendChild(this.createDocumentTypeNode());
@@ -13880,10 +13880,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
13880
13880
  }
13881
13881
  createElement(tagName) {
13882
13882
  if (tagName === "#document" /* DOCUMENT_NODE */) {
13883
- const doc = new _MockDocument(false);
13884
- doc.nodeName = tagName;
13885
- doc.parentNode = null;
13886
- return doc;
13883
+ const doc2 = new _MockDocument(false);
13884
+ doc2.nodeName = tagName;
13885
+ doc2.parentNode = null;
13886
+ return doc2;
13887
13887
  }
13888
13888
  return createElement(this, tagName);
13889
13889
  }
@@ -13923,10 +13923,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
13923
13923
  title.textContent = value;
13924
13924
  }
13925
13925
  };
13926
- function resetDocument(doc) {
13927
- if (doc != null) {
13928
- resetEventListeners(doc);
13929
- const documentElement = doc.documentElement;
13926
+ function resetDocument(doc2) {
13927
+ if (doc2 != null) {
13928
+ resetEventListeners(doc2);
13929
+ const documentElement = doc2.documentElement;
13930
13930
  if (documentElement != null) {
13931
13931
  resetElement(documentElement);
13932
13932
  for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
@@ -13935,25 +13935,25 @@ function resetDocument(doc) {
13935
13935
  childNode.childNodes.length = 0;
13936
13936
  }
13937
13937
  }
13938
- for (const key in doc) {
13939
- if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
13940
- delete doc[key];
13938
+ for (const key in doc2) {
13939
+ if (doc2.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
13940
+ delete doc2[key];
13941
13941
  }
13942
13942
  }
13943
13943
  try {
13944
- doc.nodeName = "#document" /* DOCUMENT_NODE */;
13944
+ doc2.nodeName = "#document" /* DOCUMENT_NODE */;
13945
13945
  } catch (e) {
13946
13946
  }
13947
13947
  try {
13948
- doc.nodeType = 9 /* DOCUMENT_NODE */;
13948
+ doc2.nodeType = 9 /* DOCUMENT_NODE */;
13949
13949
  } catch (e) {
13950
13950
  }
13951
13951
  try {
13952
- doc.cookie = "";
13952
+ doc2.cookie = "";
13953
13953
  } catch (e) {
13954
13954
  }
13955
13955
  try {
13956
- doc.referrer = "";
13956
+ doc2.referrer = "";
13957
13957
  } catch (e) {
13958
13958
  }
13959
13959
  }
@@ -14009,14 +14009,65 @@ function createWindowFromHtml(templateHtml, uniqueId) {
14009
14009
  templateWindow = new MockWindow(templateHtml);
14010
14010
  templateWindows.set(uniqueId, templateWindow);
14011
14011
  }
14012
- const win = cloneWindow(templateWindow);
14013
- return win;
14012
+ const win2 = cloneWindow(templateWindow);
14013
+ return win2;
14014
14014
  }
14015
14015
 
14016
14016
  // src/hydrate/runner/render.ts
14017
14017
  import { Readable } from "stream";
14018
14018
  import { hydrateFactory } from "@stencil/core/hydrate-factory";
14019
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
+
14020
14071
  // src/utils/helpers.ts
14021
14072
  var isString = (v) => typeof v === "string";
14022
14073
 
@@ -14107,15 +14158,77 @@ var unwrapErr = (result) => {
14107
14158
  }
14108
14159
  };
14109
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
+
14110
14223
  // src/compiler/html/canonical-link.ts
14111
- var updateCanonicalLink = (doc, href) => {
14224
+ var updateCanonicalLink = (doc2, href) => {
14112
14225
  var _a2;
14113
- let canonicalLinkElm = doc.head.querySelector('link[rel="canonical"]');
14226
+ let canonicalLinkElm = doc2.head.querySelector('link[rel="canonical"]');
14114
14227
  if (typeof href === "string") {
14115
14228
  if (canonicalLinkElm == null) {
14116
- canonicalLinkElm = doc.createElement("link");
14229
+ canonicalLinkElm = doc2.createElement("link");
14117
14230
  canonicalLinkElm.setAttribute("rel", "canonical");
14118
- doc.head.appendChild(canonicalLinkElm);
14231
+ doc2.head.appendChild(canonicalLinkElm);
14119
14232
  }
14120
14233
  canonicalLinkElm.setAttribute("href", href);
14121
14234
  } else {
@@ -14129,11 +14242,11 @@ var updateCanonicalLink = (doc, href) => {
14129
14242
  };
14130
14243
 
14131
14244
  // src/compiler/html/relocate-meta-charset.ts
14132
- var relocateMetaCharset = (doc) => {
14133
- const head = doc.head;
14245
+ var relocateMetaCharset = (doc2) => {
14246
+ const head = doc2.head;
14134
14247
  let charsetElm = head.querySelector("meta[charset]");
14135
14248
  if (charsetElm == null) {
14136
- charsetElm = doc.createElement("meta");
14249
+ charsetElm = doc2.createElement("meta");
14137
14250
  charsetElm.setAttribute("charset", "utf-8");
14138
14251
  } else {
14139
14252
  charsetElm.remove();
@@ -14408,13 +14521,13 @@ var parseCss = (css, filePath) => {
14408
14521
  const m = match(/^@([-\w]+)?document *([^{]+)/);
14409
14522
  if (!m) return null;
14410
14523
  const vendor = trim(m[1]);
14411
- const doc = trim(m[2]);
14524
+ const doc2 = trim(m[2]);
14412
14525
  if (!open()) return error(`@document missing '{'`);
14413
14526
  const style = comments().concat(rules());
14414
14527
  if (!close()) return error(`@document missing '}'`);
14415
14528
  return pos({
14416
14529
  type: 3 /* Document */,
14417
- document: doc,
14530
+ document: doc2,
14418
14531
  vendor,
14419
14532
  rules: style
14420
14533
  });
@@ -14740,11 +14853,11 @@ var serializeCssPage = (opts, node) => {
14740
14853
  };
14741
14854
  var serializeCssDocument = (opts, node) => {
14742
14855
  const documentCss = serializeCssMapVisit(opts, node.rules);
14743
- const doc = "@" + (node.vendor || "") + "document " + node.document;
14856
+ const doc2 = "@" + (node.vendor || "") + "document " + node.document;
14744
14857
  if (documentCss === "") {
14745
14858
  return "";
14746
14859
  }
14747
- return doc + "{" + documentCss + "}";
14860
+ return doc2 + "{" + documentCss + "}";
14748
14861
  };
14749
14862
  var serializeCssMapVisit = (opts, nodes) => {
14750
14863
  let rtn = "";
@@ -14842,12 +14955,12 @@ var collectUsedSelectors = (usedSelectors, elm) => {
14842
14955
  };
14843
14956
 
14844
14957
  // src/compiler/html/remove-unused-styles.ts
14845
- var removeUnusedStyles = (doc, diagnostics) => {
14958
+ var removeUnusedStyles = (doc2, diagnostics) => {
14846
14959
  try {
14847
- const styleElms = doc.head.querySelectorAll(`style[data-styles]`);
14960
+ const styleElms = doc2.head.querySelectorAll(`style[data-styles]`);
14848
14961
  const styleLen = styleElms.length;
14849
14962
  if (styleLen > 0) {
14850
- const usedSelectors = getUsedSelectors(doc.documentElement);
14963
+ const usedSelectors = getUsedSelectors(doc2.documentElement);
14851
14964
  for (let i = 0; i < styleLen; i++) {
14852
14965
  removeUnusedStyleText(usedSelectors, diagnostics, styleElms[i]);
14853
14966
  }
@@ -14980,49 +15093,49 @@ function collectAttributes(node) {
14980
15093
  var SKIP_ATTRS = /* @__PURE__ */ new Set(["s-id", "c-id"]);
14981
15094
 
14982
15095
  // src/hydrate/runner/patch-dom-implementation.ts
14983
- function patchDomImplementation(doc, opts) {
14984
- let win;
14985
- if (doc.defaultView != null) {
15096
+ function patchDomImplementation(doc2, opts) {
15097
+ let win2;
15098
+ if (doc2.defaultView != null) {
14986
15099
  opts.destroyWindow = true;
14987
- patchWindow(doc.defaultView);
14988
- win = doc.defaultView;
15100
+ patchWindow(doc2.defaultView);
15101
+ win2 = doc2.defaultView;
14989
15102
  } else {
14990
15103
  opts.destroyWindow = true;
14991
15104
  opts.destroyDocument = false;
14992
- win = new MockWindow(false);
15105
+ win2 = new MockWindow(false);
14993
15106
  }
14994
- if (win.document !== doc) {
14995
- win.document = doc;
15107
+ if (win2.document !== doc2) {
15108
+ win2.document = doc2;
14996
15109
  }
14997
- if (doc.defaultView !== win) {
14998
- doc.defaultView = win;
15110
+ if (doc2.defaultView !== win2) {
15111
+ doc2.defaultView = win2;
14999
15112
  }
15000
- const HTMLElement = doc.documentElement.constructor.prototype;
15001
- if (typeof HTMLElement.getRootNode !== "function") {
15002
- 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");
15003
15116
  const HTMLUnknownElement = elm.constructor.prototype;
15004
15117
  HTMLUnknownElement.getRootNode = getRootNode;
15005
15118
  }
15006
- if (typeof doc.createEvent === "function") {
15007
- const CustomEvent = doc.createEvent("CustomEvent").constructor;
15008
- if (win.CustomEvent !== CustomEvent) {
15009
- 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;
15010
15123
  }
15011
15124
  }
15012
15125
  try {
15013
- win.__stencil_baseURI = doc.baseURI;
15126
+ win2.__stencil_baseURI = doc2.baseURI;
15014
15127
  } catch (e) {
15015
- Object.defineProperty(doc, "baseURI", {
15128
+ Object.defineProperty(doc2, "baseURI", {
15016
15129
  get() {
15017
- const baseElm = doc.querySelector("base[href]");
15130
+ const baseElm = doc2.querySelector("base[href]");
15018
15131
  if (baseElm) {
15019
- return new URL(baseElm.getAttribute("href"), win.location.href).href;
15132
+ return new URL(baseElm.getAttribute("href"), win2.location.href).href;
15020
15133
  }
15021
- return win.location.href;
15134
+ return win2.location.href;
15022
15135
  }
15023
15136
  });
15024
15137
  }
15025
- return win;
15138
+ return win2;
15026
15139
  }
15027
15140
  function getRootNode(opts) {
15028
15141
  const isComposed = opts != null && opts.composed === true;
@@ -15175,10 +15288,10 @@ function renderCatchError(results, err2) {
15175
15288
  }
15176
15289
 
15177
15290
  // src/hydrate/runner/runtime-log.ts
15178
- function runtimeLogging(win, opts, results) {
15291
+ function runtimeLogging(win2, opts, results) {
15179
15292
  try {
15180
- const pathname = win.location.pathname;
15181
- win.console.error = (...msgs) => {
15293
+ const pathname = win2.location.pathname;
15294
+ win2.console.error = (...msgs) => {
15182
15295
  const errMsg = msgs.reduce((errMsg2, m) => {
15183
15296
  if (m) {
15184
15297
  if (m.stack != null) {
@@ -15198,7 +15311,7 @@ function runtimeLogging(win, opts, results) {
15198
15311
  }
15199
15312
  }
15200
15313
  };
15201
- win.console.debug = (...msgs) => {
15314
+ win2.console.debug = (...msgs) => {
15202
15315
  renderBuildDiagnostic(results, "debug", "Hydrate Debug", [...msgs].join(", "));
15203
15316
  if (opts.runtimeLogging) {
15204
15317
  runtimeLog(pathname, "debug", msgs);
@@ -15206,7 +15319,7 @@ function runtimeLogging(win, opts, results) {
15206
15319
  };
15207
15320
  if (opts.runtimeLogging) {
15208
15321
  ["log", "warn", "assert", "info", "trace"].forEach((type) => {
15209
- win.console[type] = (...msgs) => {
15322
+ win2.console[type] = (...msgs) => {
15210
15323
  runtimeLog(pathname, type, msgs);
15211
15324
  };
15212
15325
  });
@@ -15220,58 +15333,58 @@ function runtimeLog(pathname, type, msgs) {
15220
15333
  }
15221
15334
 
15222
15335
  // src/hydrate/runner/window-initialize.ts
15223
- function initializeWindow(win, doc, opts, results) {
15336
+ function initializeWindow(win2, doc2, opts, results) {
15224
15337
  if (typeof opts.url === "string") {
15225
15338
  try {
15226
- win.location.href = opts.url;
15339
+ win2.location.href = opts.url;
15227
15340
  } catch (e) {
15228
15341
  }
15229
15342
  }
15230
15343
  if (typeof opts.userAgent === "string") {
15231
15344
  try {
15232
- win.navigator.userAgent = opts.userAgent;
15345
+ win2.navigator.userAgent = opts.userAgent;
15233
15346
  } catch (e) {
15234
15347
  }
15235
15348
  }
15236
15349
  if (typeof opts.cookie === "string") {
15237
15350
  try {
15238
- doc.cookie = opts.cookie;
15351
+ doc2.cookie = opts.cookie;
15239
15352
  } catch (e) {
15240
15353
  }
15241
15354
  }
15242
15355
  if (typeof opts.referrer === "string") {
15243
15356
  try {
15244
- doc.referrer = opts.referrer;
15357
+ doc2.referrer = opts.referrer;
15245
15358
  } catch (e) {
15246
15359
  }
15247
15360
  }
15248
15361
  if (typeof opts.direction === "string") {
15249
15362
  try {
15250
- doc.documentElement.setAttribute("dir", opts.direction);
15363
+ doc2.documentElement.setAttribute("dir", opts.direction);
15251
15364
  } catch (e) {
15252
15365
  }
15253
15366
  }
15254
15367
  if (typeof opts.language === "string") {
15255
15368
  try {
15256
- doc.documentElement.setAttribute("lang", opts.language);
15369
+ doc2.documentElement.setAttribute("lang", opts.language);
15257
15370
  } catch (e) {
15258
15371
  }
15259
15372
  }
15260
15373
  if (typeof opts.buildId === "string") {
15261
15374
  try {
15262
- doc.documentElement.setAttribute("data-stencil-build", opts.buildId);
15375
+ doc2.documentElement.setAttribute("data-stencil-build", opts.buildId);
15263
15376
  } catch (e) {
15264
15377
  }
15265
15378
  }
15266
15379
  try {
15267
- win.customElements = null;
15380
+ win2.customElements = null;
15268
15381
  } catch (e) {
15269
15382
  }
15270
15383
  if (opts.constrainTimeouts) {
15271
- constrainTimeouts(win);
15384
+ constrainTimeouts(win2);
15272
15385
  }
15273
- runtimeLogging(win, opts, results);
15274
- return win;
15386
+ runtimeLogging(win2, opts, results);
15387
+ return win2;
15275
15388
  }
15276
15389
 
15277
15390
  // src/hydrate/runner/render.ts
@@ -15288,44 +15401,44 @@ function renderToString(html, options, asStream) {
15288
15401
  opts.constrainTimeouts = false;
15289
15402
  return hydrateDocument(html, opts, asStream);
15290
15403
  }
15291
- function hydrateDocument(doc, options, asStream) {
15404
+ function hydrateDocument(doc2, options, asStream) {
15292
15405
  const opts = normalizeHydrateOptions(options);
15293
- let win = null;
15406
+ let win2 = null;
15294
15407
  const results = generateHydrateResults(opts);
15295
15408
  if (hasError(results.diagnostics)) {
15296
15409
  return Promise.resolve(results);
15297
15410
  }
15298
- if (typeof doc === "string") {
15411
+ if (typeof doc2 === "string") {
15299
15412
  try {
15300
15413
  opts.destroyWindow = true;
15301
15414
  opts.destroyDocument = true;
15302
- win = new MockWindow(doc);
15415
+ win2 = new MockWindow(doc2);
15303
15416
  if (!asStream) {
15304
- return render(win, opts, results).then(() => results);
15417
+ return render(win2, opts, results).then(() => results);
15305
15418
  }
15306
- return renderStream(win, opts, results);
15419
+ return renderStream(win2, opts, results);
15307
15420
  } catch (e) {
15308
- if (win && win.close) {
15309
- win.close();
15421
+ if (win2 && win2.close) {
15422
+ win2.close();
15310
15423
  }
15311
- win = null;
15424
+ win2 = null;
15312
15425
  renderCatchError(results, e);
15313
15426
  return Promise.resolve(results);
15314
15427
  }
15315
15428
  }
15316
- if (isValidDocument(doc)) {
15429
+ if (isValidDocument(doc2)) {
15317
15430
  try {
15318
15431
  opts.destroyDocument = false;
15319
- win = patchDomImplementation(doc, opts);
15432
+ win2 = patchDomImplementation(doc2, opts);
15320
15433
  if (!asStream) {
15321
- return render(win, opts, results).then(() => results);
15434
+ return render(win2, opts, results).then(() => results);
15322
15435
  }
15323
- return renderStream(win, opts, results);
15436
+ return renderStream(win2, opts, results);
15324
15437
  } catch (e) {
15325
- if (win && win.close) {
15326
- win.close();
15438
+ if (win2 && win2.close) {
15439
+ win2.close();
15327
15440
  }
15328
- win = null;
15441
+ win2 = null;
15329
15442
  renderCatchError(results, e);
15330
15443
  return Promise.resolve(results);
15331
15444
  }
@@ -15333,75 +15446,81 @@ function hydrateDocument(doc, options, asStream) {
15333
15446
  renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
15334
15447
  return Promise.resolve(results);
15335
15448
  }
15336
- async function render(win, opts, results) {
15449
+ async function render(win2, opts, results) {
15337
15450
  if ("process" in globalThis && typeof process.on === "function" && !process.__stencilErrors) {
15338
15451
  process.__stencilErrors = true;
15339
15452
  process.on("unhandledRejection", (e) => {
15340
15453
  console.log("unhandledRejection", e);
15341
15454
  });
15342
15455
  }
15343
- initializeWindow(win, win.document, opts, results);
15456
+ initializeWindow(win2, win2.document, opts, results);
15344
15457
  const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate : NOOP;
15345
15458
  try {
15346
- await Promise.resolve(beforeHydrateFn(win.document));
15347
- return new Promise((resolve) => hydrateFactory(win, opts, results, afterHydrate, resolve));
15459
+ await Promise.resolve(beforeHydrateFn(win2.document));
15460
+ return new Promise((resolve) => {
15461
+ if (Array.isArray(opts.modes)) {
15462
+ modeResolutionChain.length = 0;
15463
+ opts.modes.forEach((mode) => setMode(mode));
15464
+ }
15465
+ return hydrateFactory(win2, opts, results, afterHydrate, resolve);
15466
+ });
15348
15467
  } catch (e) {
15349
15468
  renderCatchError(results, e);
15350
- return finalizeHydrate(win, win.document, opts, results);
15469
+ return finalizeHydrate(win2, win2.document, opts, results);
15351
15470
  }
15352
15471
  }
15353
- function renderStream(win, opts, results) {
15472
+ function renderStream(win2, opts, results) {
15354
15473
  async function* processRender() {
15355
- const renderResult = await render(win, opts, results);
15474
+ const renderResult = await render(win2, opts, results);
15356
15475
  yield renderResult.html;
15357
15476
  }
15358
15477
  return Readable.from(processRender());
15359
15478
  }
15360
- async function afterHydrate(win, opts, results, resolve) {
15479
+ async function afterHydrate(win2, opts, results, resolve) {
15361
15480
  const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate : NOOP;
15362
15481
  try {
15363
- await Promise.resolve(afterHydrateFn(win.document));
15364
- return resolve(finalizeHydrate(win, win.document, opts, results));
15482
+ await Promise.resolve(afterHydrateFn(win2.document));
15483
+ return resolve(finalizeHydrate(win2, win2.document, opts, results));
15365
15484
  } catch (e) {
15366
15485
  renderCatchError(results, e);
15367
- return resolve(finalizeHydrate(win, win.document, opts, results));
15486
+ return resolve(finalizeHydrate(win2, win2.document, opts, results));
15368
15487
  }
15369
15488
  }
15370
- function finalizeHydrate(win, doc, opts, results) {
15489
+ function finalizeHydrate(win2, doc2, opts, results) {
15371
15490
  try {
15372
- inspectElement(results, doc.documentElement, 0);
15491
+ inspectElement(results, doc2.documentElement, 0);
15373
15492
  if (opts.removeUnusedStyles !== false) {
15374
15493
  try {
15375
- removeUnusedStyles(doc, results.diagnostics);
15494
+ removeUnusedStyles(doc2, results.diagnostics);
15376
15495
  } catch (e) {
15377
15496
  renderCatchError(results, e);
15378
15497
  }
15379
15498
  }
15380
15499
  if (typeof opts.title === "string") {
15381
15500
  try {
15382
- doc.title = opts.title;
15501
+ doc2.title = opts.title;
15383
15502
  } catch (e) {
15384
15503
  renderCatchError(results, e);
15385
15504
  }
15386
15505
  }
15387
- results.title = doc.title;
15506
+ results.title = doc2.title;
15388
15507
  if (opts.removeScripts) {
15389
- removeScripts(doc.documentElement);
15508
+ removeScripts(doc2.documentElement);
15390
15509
  }
15391
15510
  try {
15392
- updateCanonicalLink(doc, opts.canonicalUrl);
15511
+ updateCanonicalLink(doc2, opts.canonicalUrl);
15393
15512
  } catch (e) {
15394
15513
  renderCatchError(results, e);
15395
15514
  }
15396
15515
  try {
15397
- relocateMetaCharset(doc);
15516
+ relocateMetaCharset(doc2);
15398
15517
  } catch (e) {
15399
15518
  }
15400
15519
  if (!hasError(results.diagnostics)) {
15401
15520
  results.httpStatus = 200;
15402
15521
  }
15403
15522
  try {
15404
- const metaStatus = doc.head.querySelector('meta[http-equiv="status"]');
15523
+ const metaStatus = doc2.head.querySelector('meta[http-equiv="status"]');
15405
15524
  if (metaStatus != null) {
15406
15525
  const metaStatusContent = metaStatus.getAttribute("content");
15407
15526
  if (metaStatusContent && metaStatusContent.length > 0) {
@@ -15411,35 +15530,35 @@ function finalizeHydrate(win, doc, opts, results) {
15411
15530
  } catch (e) {
15412
15531
  }
15413
15532
  if (opts.clientHydrateAnnotations) {
15414
- doc.documentElement.classList.add("hydrated");
15533
+ doc2.documentElement.classList.add("hydrated");
15415
15534
  }
15416
15535
  if (opts.serializeToHtml) {
15417
- results.html = serializeDocumentToString(doc, opts);
15536
+ results.html = serializeDocumentToString(doc2, opts);
15418
15537
  }
15419
15538
  } catch (e) {
15420
15539
  renderCatchError(results, e);
15421
15540
  }
15422
- destroyWindow(win, doc, opts, results);
15541
+ destroyWindow(win2, doc2, opts, results);
15423
15542
  return results;
15424
15543
  }
15425
- function destroyWindow(win, doc, opts, results) {
15544
+ function destroyWindow(win2, doc2, opts, results) {
15426
15545
  if (!opts.destroyWindow) {
15427
15546
  return;
15428
15547
  }
15429
15548
  try {
15430
15549
  if (!opts.destroyDocument) {
15431
- win.document = null;
15432
- doc.defaultView = null;
15550
+ win2.document = null;
15551
+ doc2.defaultView = null;
15433
15552
  }
15434
- if (win.close) {
15435
- win.close();
15553
+ if (win2.close) {
15554
+ win2.close();
15436
15555
  }
15437
15556
  } catch (e) {
15438
15557
  renderCatchError(results, e);
15439
15558
  }
15440
15559
  }
15441
- function serializeDocumentToString(doc, opts) {
15442
- return serializeNodeToHtml(doc, {
15560
+ function serializeDocumentToString(doc2, opts) {
15561
+ return serializeNodeToHtml(doc2, {
15443
15562
  approximateLineWidth: opts.approximateLineWidth,
15444
15563
  outerHtml: false,
15445
15564
  prettyHtml: opts.prettyHtml,
@@ -15451,8 +15570,8 @@ function serializeDocumentToString(doc, opts) {
15451
15570
  fullDocument: opts.fullDocument
15452
15571
  });
15453
15572
  }
15454
- function isValidDocument(doc) {
15455
- 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;
15456
15575
  }
15457
15576
  function removeScripts(elm) {
15458
15577
  const children = elm.children;