@rindo/core 4.27.0 → 4.27.1

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
- Rindo Client Platform v4.27.0 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Client Platform v4.27.1 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -180,7 +180,6 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
180
180
  // src/client/client-window.ts
181
181
  import { BUILD as BUILD6 } from "@rindo/core/internal/app-data";
182
182
  var win = typeof window !== "undefined" ? window : {};
183
- var doc = win.document || { head: {} };
184
183
  var H = win.HTMLElement || class {
185
184
  };
186
185
  var plt = {
@@ -197,9 +196,10 @@ var setPlatformHelpers = (helpers) => {
197
196
  };
198
197
  var supportsShadow = BUILD6.shadowDom;
199
198
  var supportsListenerOptions = /* @__PURE__ */ (() => {
199
+ var _a;
200
200
  let supportsListenerOptions2 = false;
201
201
  try {
202
- doc.addEventListener(
202
+ (_a = win.document) == null ? void 0 : _a.addEventListener(
203
203
  "e",
204
204
  null,
205
205
  Object.defineProperty({}, "passive", {
@@ -315,9 +315,9 @@ var isComplexType = (o) => {
315
315
  };
316
316
 
317
317
  // src/utils/query-nonce-meta-tag-content.ts
318
- function queryNonceMetaTagContent(doc2) {
318
+ function queryNonceMetaTagContent(doc) {
319
319
  var _a, _b, _c;
320
- return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
320
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
321
321
  }
322
322
 
323
323
  // src/utils/regular-expression.ts
@@ -1145,8 +1145,8 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1145
1145
  delete hostElm["s-sc"];
1146
1146
  }
1147
1147
  }
1148
- if (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size) {
1149
- initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1148
+ if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
1149
+ initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1150
1150
  }
1151
1151
  hostElm[HYDRATE_ID] = hostId;
1152
1152
  hostElm.removeAttribute(HYDRATE_ID);
@@ -1472,8 +1472,8 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1472
1472
  childVNode.$name$ = slotName || null;
1473
1473
  childVNode.$tag$ = "slot";
1474
1474
  const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1475
- if (BUILD12.shadowDom && shadowRootNodes) {
1476
- const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1475
+ if (BUILD12.shadowDom && shadowRootNodes && win.document) {
1476
+ const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1477
1477
  if (childVNode.$name$) {
1478
1478
  childVNode.$elm$.setAttribute("name", slotName);
1479
1479
  }
@@ -1956,10 +1956,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1956
1956
  var _a;
1957
1957
  const scopeId2 = getScopeId(cmpMeta, mode);
1958
1958
  const style = styles.get(scopeId2);
1959
- if (!BUILD16.attachStyles) {
1959
+ if (!BUILD16.attachStyles || !win.document) {
1960
1960
  return scopeId2;
1961
1961
  }
1962
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
1962
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
1963
1963
  if (style) {
1964
1964
  if (typeof style === "string") {
1965
1965
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -1972,9 +1972,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1972
1972
  if (BUILD16.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1973
1973
  styleElm.innerHTML = style;
1974
1974
  } else {
1975
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
1975
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
1976
1976
  styleElm.innerHTML = style;
1977
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1977
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1978
1978
  if (nonce != null) {
1979
1979
  styleElm.setAttribute("nonce", nonce);
1980
1980
  }
@@ -2042,7 +2042,10 @@ var attachStyles = (hostRef) => {
2042
2042
  var getScopeId = (cmp, mode) => "sc-" + (BUILD16.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2043
2043
  var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2044
2044
  var hydrateScopedToShadow = () => {
2045
- const styles2 = doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2045
+ if (!win.document) {
2046
+ return;
2047
+ }
2048
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2046
2049
  let i2 = 0;
2047
2050
  for (; i2 < styles2.length; i2++) {
2048
2051
  registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
@@ -2259,9 +2262,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2259
2262
  );
2260
2263
  }
2261
2264
  if (BUILD19.vdomText && newVNode2.$text$ !== null) {
2262
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
2265
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
2263
2266
  } else if (BUILD19.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
2264
- elm = newVNode2.$elm$ = BUILD19.isDebug || BUILD19.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
2267
+ elm = newVNode2.$elm$ = BUILD19.isDebug || BUILD19.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : win.document.createTextNode("");
2265
2268
  if (BUILD19.vdomAttribute) {
2266
2269
  updateElement(null, newVNode2, isSvgMode);
2267
2270
  }
@@ -2269,10 +2272,15 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2269
2272
  if (BUILD19.svg && !isSvgMode) {
2270
2273
  isSvgMode = newVNode2.$tag$ === "svg";
2271
2274
  }
2272
- elm = newVNode2.$elm$ = BUILD19.svg ? doc.createElementNS(
2275
+ if (!win.document) {
2276
+ throw new Error(
2277
+ "You are trying to render a Rindo component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
2278
+ );
2279
+ }
2280
+ elm = newVNode2.$elm$ = BUILD19.svg ? win.document.createElementNS(
2273
2281
  isSvgMode ? SVG_NS : HTML_NS,
2274
2282
  !useNativeShadowDom && BUILD19.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
2275
- ) : doc.createElement(
2283
+ ) : win.document.createElement(
2276
2284
  !useNativeShadowDom && BUILD19.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
2277
2285
  );
2278
2286
  if (BUILD19.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
@@ -2707,8 +2715,8 @@ render() {
2707
2715
  markSlotContentForRelocation(rootVnode.$elm$);
2708
2716
  for (const relocateData of relocateNodes) {
2709
2717
  const nodeToRelocate = relocateData.$nodeToRelocate$;
2710
- if (!nodeToRelocate["s-ol"]) {
2711
- const orgLocationNode = BUILD19.isDebug || BUILD19.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
2718
+ if (!nodeToRelocate["s-ol"] && win.document) {
2719
+ const orgLocationNode = BUILD19.isDebug || BUILD19.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : win.document.createTextNode("");
2712
2720
  orgLocationNode["s-nr"] = nodeToRelocate;
2713
2721
  insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
2714
2722
  }
@@ -2779,10 +2787,10 @@ render() {
2779
2787
  }
2780
2788
  contentRef = void 0;
2781
2789
  };
2782
- var slotReferenceDebugNode = (slotVNode) => doc.createComment(
2790
+ var slotReferenceDebugNode = (slotVNode) => win.document.createComment(
2783
2791
  `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
2784
2792
  );
2785
- var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
2793
+ var originalLocationDebugNode = (nodeToRelocate) => win.document.createComment(
2786
2794
  `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
2787
2795
  );
2788
2796
 
@@ -3463,7 +3471,10 @@ var connectedCallback = (elm) => {
3463
3471
  }
3464
3472
  };
3465
3473
  var setContentReference = (elm) => {
3466
- const contentRefElm = elm["s-cr"] = doc.createComment(
3474
+ if (!win.document) {
3475
+ return;
3476
+ }
3477
+ const contentRefElm = elm["s-cr"] = win.document.createComment(
3467
3478
  BUILD24.isDebug ? `content-ref (host=${elm.localName})` : ""
3468
3479
  );
3469
3480
  contentRefElm["s-cn"] = true;
@@ -3637,18 +3648,22 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3637
3648
  performance.mark("st:app:start");
3638
3649
  }
3639
3650
  installDevTools();
3651
+ if (!win.document) {
3652
+ console.warn("Rindo: No document found. Skipping bootstrapping lazy components.");
3653
+ return;
3654
+ }
3640
3655
  const endBootstrap = createTime("bootstrapLazy");
3641
3656
  const cmpTags = [];
3642
3657
  const exclude = options.exclude || [];
3643
3658
  const customElements2 = win.customElements;
3644
- const head = doc.head;
3659
+ const head = win.document.head;
3645
3660
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
3646
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
3661
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
3647
3662
  const deferredConnectedCallbacks = [];
3648
3663
  let appLoadFallback;
3649
3664
  let isBootstrapping = true;
3650
3665
  Object.assign(plt, options);
3651
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
3666
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
3652
3667
  if (BUILD27.asyncQueue) {
3653
3668
  if (options.syncQueue) {
3654
3669
  plt.$flags$ |= 4 /* queueSync */;
@@ -3798,7 +3813,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3798
3813
  }
3799
3814
  if (dataStyles.innerHTML.length) {
3800
3815
  dataStyles.setAttribute("data-styles", "");
3801
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
3816
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
3802
3817
  if (nonce != null) {
3803
3818
  dataStyles.setAttribute("nonce", nonce);
3804
3819
  }
@@ -3824,7 +3839,7 @@ var Fragment = (_, children) => children;
3824
3839
  // src/runtime/host-listener.ts
3825
3840
  import { BUILD as BUILD28 } from "@rindo/core/internal/app-data";
3826
3841
  var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
3827
- if (BUILD28.hostListener && listeners) {
3842
+ if (BUILD28.hostListener && listeners && win.document) {
3828
3843
  if (BUILD28.hostListenerTargetParent) {
3829
3844
  if (attachParentListeners) {
3830
3845
  listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
@@ -3833,7 +3848,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
3833
3848
  }
3834
3849
  }
3835
3850
  listeners.map(([flags, name, method]) => {
3836
- const target = BUILD28.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
3851
+ const target = BUILD28.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
3837
3852
  const handler = hostListenerProxy(hostRef, method);
3838
3853
  const opts = hostListenerOpts(flags);
3839
3854
  plt.ael(target, name, handler, opts);
@@ -3857,12 +3872,19 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
3857
3872
  consoleError(e, hostRef.$hostElement$);
3858
3873
  }
3859
3874
  };
3860
- var getHostListenerTarget = (elm, flags) => {
3861
- if (BUILD28.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
3862
- if (BUILD28.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
3863
- if (BUILD28.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
3864
- if (BUILD28.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement)
3875
+ var getHostListenerTarget = (doc, elm, flags) => {
3876
+ if (BUILD28.hostListenerTargetDocument && flags & 4 /* TargetDocument */) {
3877
+ return doc;
3878
+ }
3879
+ if (BUILD28.hostListenerTargetWindow && flags & 8 /* TargetWindow */) {
3880
+ return win;
3881
+ }
3882
+ if (BUILD28.hostListenerTargetBody && flags & 16 /* TargetBody */) {
3883
+ return doc.body;
3884
+ }
3885
+ if (BUILD28.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement) {
3865
3886
  return elm.parentElement;
3887
+ }
3866
3888
  return elm;
3867
3889
  };
3868
3890
  var hostListenerOpts = (flags) => supportsListenerOptions ? {
@@ -3877,12 +3899,12 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
3877
3899
  var setPlatformOptions = (opts) => Object.assign(plt, opts);
3878
3900
 
3879
3901
  // src/runtime/vdom/vdom-annotations.ts
3880
- var insertVdomAnnotations = (doc2, staticComponents) => {
3881
- if (doc2 != null) {
3882
- const docData = RINDO_DOC_DATA in doc2 ? doc2[RINDO_DOC_DATA] : { ...DEFAULT_DOC_DATA };
3902
+ var insertVdomAnnotations = (doc, staticComponents) => {
3903
+ if (doc != null) {
3904
+ const docData = RINDO_DOC_DATA in doc ? doc[RINDO_DOC_DATA] : { ...DEFAULT_DOC_DATA };
3883
3905
  docData.staticComponents = new Set(staticComponents);
3884
3906
  const orgLocationNodes = [];
3885
- parseVNodeAnnotations(doc2, doc2.body, docData, orgLocationNodes);
3907
+ parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
3886
3908
  orgLocationNodes.forEach((orgLocationNode) => {
3887
3909
  var _a;
3888
3910
  if (orgLocationNode != null && orgLocationNode["s-nr"]) {
@@ -3908,11 +3930,11 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
3908
3930
  return;
3909
3931
  }
3910
3932
  }
3911
- const commentBeforeTextNode = doc2.createComment(childId);
3933
+ const commentBeforeTextNode = doc.createComment(childId);
3912
3934
  commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
3913
3935
  insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
3914
3936
  } else if (nodeRef.nodeType === 8 /* CommentNode */) {
3915
- const commentBeforeTextNode = doc2.createComment(childId);
3937
+ const commentBeforeTextNode = doc.createComment(childId);
3916
3938
  commentBeforeTextNode.nodeValue = `${COMMENT_NODE_ID}.${childId}`;
3917
3939
  nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
3918
3940
  }
@@ -3931,7 +3953,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
3931
3953
  });
3932
3954
  }
3933
3955
  };
3934
- var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
3956
+ var parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
3935
3957
  var _a;
3936
3958
  if (node == null) {
3937
3959
  return;
@@ -3947,13 +3969,13 @@ var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
3947
3969
  const cmpData = {
3948
3970
  nodeIds: 0
3949
3971
  };
3950
- insertVNodeAnnotations(doc2, childNode, hostRef.$vnode$, docData, cmpData);
3972
+ insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
3951
3973
  }
3952
- parseVNodeAnnotations(doc2, childNode, docData, orgLocationNodes);
3974
+ parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
3953
3975
  });
3954
3976
  }
3955
3977
  };
3956
- var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
3978
+ var insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
3957
3979
  if (vnode != null) {
3958
3980
  const hostId = ++docData.hostIds;
3959
3981
  hostElm.setAttribute(HYDRATE_ID, hostId);
@@ -3963,7 +3985,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
3963
3985
  if (vnode.$children$ != null) {
3964
3986
  const depth = 0;
3965
3987
  vnode.$children$.forEach((vnodeChild, index) => {
3966
- insertChildVNodeAnnotations(doc2, vnodeChild, cmpData, hostId, depth, index);
3988
+ insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
3967
3989
  });
3968
3990
  }
3969
3991
  if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
@@ -3984,7 +4006,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
3984
4006
  }
3985
4007
  }
3986
4008
  };
3987
- var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, index) => {
4009
+ var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
3988
4010
  const childElm = vnodeChild.$elm$;
3989
4011
  if (childElm == null) {
3990
4012
  return;
@@ -4003,7 +4025,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
4003
4025
  const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
4004
4026
  if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
4005
4027
  const textNodeId = `${TEXT_NODE_ID}.${childId}`;
4006
- const commentBeforeTextNode = doc2.createComment(textNodeId);
4028
+ const commentBeforeTextNode = doc.createComment(textNodeId);
4007
4029
  insertBefore(parentNode, commentBeforeTextNode, childElm);
4008
4030
  }
4009
4031
  } else if (childElm.nodeType === 8 /* CommentNode */) {
@@ -4016,7 +4038,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
4016
4038
  if (vnodeChild.$children$ != null) {
4017
4039
  const childDepth = depth + 1;
4018
4040
  vnodeChild.$children$.forEach((vnode, index2) => {
4019
- insertChildVNodeAnnotations(doc2, vnode, cmpData, hostId, childDepth, index2);
4041
+ insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index2);
4020
4042
  });
4021
4043
  }
4022
4044
  };
@@ -4041,7 +4063,6 @@ export {
4041
4063
  createEvent,
4042
4064
  defineCustomElement,
4043
4065
  disconnectedCallback,
4044
- doc,
4045
4066
  forceModeUpdate,
4046
4067
  forceUpdate,
4047
4068
  getAssetPath,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/internal/client",
3
- "version": "4.27.0",
3
+ "version": "4.27.1",
4
4
  "description": "Rindo internal client platform to be imported by the Rindo Compiler and internal runtime. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "exports": "./index.js",
@@ -1,10 +1,10 @@
1
1
  /*
2
- Rindo Client Patch Browser v4.27.0 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Client Patch Browser v4.27.1 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
 
5
5
  // src/client/client-patch-browser.ts
6
6
  import { BUILD, NAMESPACE } from "@rindo/core/internal/app-data";
7
- import { consoleDevInfo, doc, H, promiseResolve } from "@rindo/core";
7
+ import { consoleDevInfo, H, promiseResolve, win } from "@rindo/core";
8
8
  var patchBrowser = () => {
9
9
  if (BUILD.isDev && !BUILD.isTesting) {
10
10
  consoleDevInfo("Running in development mode.");
@@ -12,7 +12,7 @@ var patchBrowser = () => {
12
12
  if (BUILD.cloneNodeFix) {
13
13
  patchCloneNodeFix(H.prototype);
14
14
  }
15
- const scriptElm = BUILD.scriptDataOpts ? Array.from(doc.querySelectorAll("script")).find(
15
+ const scriptElm = BUILD.scriptDataOpts ? win.document && Array.from(win.document.querySelectorAll("script")).find(
16
16
  (s) => new RegExp(`/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || s.getAttribute("data-rindo-namespace") === NAMESPACE
17
17
  ) : null;
18
18
  const importMeta = import.meta.url;