solid-panes 5.1.0-3 → 5.1.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.
Files changed (174) hide show
  1. package/dist/RDFXMLPane.d.ts.map +1 -1
  2. package/dist/RDFXMLPane2.cjs.js +1 -1
  3. package/dist/RDFXMLPane2.cjs.js.map +1 -1
  4. package/dist/RDFXMLPane2.esm.js +3 -3
  5. package/dist/RDFXMLPane2.esm.js.map +1 -1
  6. package/dist/components/editor-card/EditorCard.cjs.js +2 -2
  7. package/dist/components/editor-card/EditorCard.cjs.js.map +1 -1
  8. package/dist/components/editor-card/EditorCard.d.ts +2 -0
  9. package/dist/components/editor-card/EditorCard.d.ts.map +1 -1
  10. package/dist/components/editor-card/EditorCard.esm.js +68 -43
  11. package/dist/components/editor-card/EditorCard.esm.js.map +1 -1
  12. package/dist/components/editor-card/EditorCard.styles.cjs.js.map +1 -1
  13. package/dist/components/editor-card/EditorCard.styles.esm.js.map +1 -1
  14. package/dist/components/header/Header.cjs.js.map +1 -1
  15. package/dist/components/header/Header.esm.js.map +1 -1
  16. package/dist/components/header/Header.styles.cjs.js.map +1 -1
  17. package/dist/components/header/Header.styles.esm.js.map +1 -1
  18. package/dist/components/navbar/Navbar.cjs.js.map +1 -1
  19. package/dist/components/navbar/Navbar.esm.js.map +1 -1
  20. package/dist/components/navbar/Navbar.styles.cjs.js.map +1 -1
  21. package/dist/components/navbar/Navbar.styles.esm.js.map +1 -1
  22. package/dist/components/profile-heading/ProfileHeading.cjs.js +4 -4
  23. package/dist/components/profile-heading/ProfileHeading.cjs.js.map +1 -1
  24. package/dist/components/profile-heading/ProfileHeading.d.ts +4 -0
  25. package/dist/components/profile-heading/ProfileHeading.d.ts.map +1 -1
  26. package/dist/components/profile-heading/ProfileHeading.esm.js +123 -107
  27. package/dist/components/profile-heading/ProfileHeading.esm.js.map +1 -1
  28. package/dist/components/profile-heading/ProfileHeading.styles.cjs.js.map +1 -1
  29. package/dist/components/profile-heading/ProfileHeading.styles.esm.js.map +1 -1
  30. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js +19 -19
  31. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js.map +1 -1
  32. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js +86 -86
  33. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js.map +1 -1
  34. package/dist/components/profile-heading/editor/sections/heading/dateHelpers.cjs.js.map +1 -1
  35. package/dist/components/profile-heading/editor/sections/heading/dateHelpers.esm.js.map +1 -1
  36. package/dist/components/profile-heading/editor/sections/heading/imageHelpers.cjs.js.map +1 -1
  37. package/dist/components/profile-heading/editor/sections/heading/imagePreview.cjs.js.map +1 -1
  38. package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js +1 -1
  39. package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js.map +1 -1
  40. package/dist/components/profile-heading/editor/sections/heading/mutations.esm.js +61 -61
  41. package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.cjs.js.map +1 -1
  42. package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.esm.js.map +1 -1
  43. package/dist/components/profile-heading/editor/sections/shared/idNodeFactory.cjs.js.map +1 -1
  44. package/dist/components/profile-heading/editor/sections/shared/phoneCountries.cjs.js.map +1 -1
  45. package/dist/components/profile-heading/editor/sections/shared/phoneCountries.esm.js.map +1 -1
  46. package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.cjs.js.map +1 -1
  47. package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.esm.js.map +1 -1
  48. package/dist/components/profile-heading/editor/sections/shared/rowState.cjs.js.map +1 -1
  49. package/dist/components/profile-heading/editor/sections/shared/rowState.esm.js.map +1 -1
  50. package/dist/components/profile-heading/editor/sections/shared/sanitizeUtils.cjs.js.map +1 -1
  51. package/dist/components/profile-heading/editor/textUtils.cjs.js.map +1 -1
  52. package/dist/components/profile-heading/editor/textUtils.esm.js.map +1 -1
  53. package/dist/components/profile-heading/editor/texts/dialogTexts.cjs.js.map +1 -1
  54. package/dist/components/profile-heading/editor/texts/dialogTexts.esm.js.map +1 -1
  55. package/dist/components/profile-heading/editor/texts/messageTexts.cjs.js.map +1 -1
  56. package/dist/components/profile-heading/editor/texts/messageTexts.esm.js.map +1 -1
  57. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js +1 -1
  58. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js.map +1 -1
  59. package/dist/components/profile-heading/editor/ui/dialog2.esm.js +1 -1
  60. package/dist/components/profile-heading/editor/ui/dialog2.esm.js.map +1 -1
  61. package/dist/components/profile-heading/friendActions.cjs.js +1 -1
  62. package/dist/components/profile-heading/friendActions.cjs.js.map +1 -1
  63. package/dist/components/profile-heading/friendActions.esm.js +5 -5
  64. package/dist/components/profile-heading/profileHeadingData.cjs.js.map +1 -1
  65. package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js +33 -0
  66. package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js.map +1 -0
  67. package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts +16 -0
  68. package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts.map +1 -0
  69. package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js +309 -0
  70. package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js.map +1 -0
  71. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js +2 -0
  72. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js.map +1 -0
  73. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js +6 -0
  74. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js.map +1 -0
  75. package/dist/dataContentPane.d.ts.map +1 -1
  76. package/dist/dataContentPane2.cjs.js +1 -1
  77. package/dist/dataContentPane2.cjs.js.map +1 -1
  78. package/dist/dataContentPane2.esm.js +90 -78
  79. package/dist/dataContentPane2.esm.js.map +1 -1
  80. package/dist/humanReadablePane.d.ts +1 -0
  81. package/dist/humanReadablePane.d.ts.map +1 -1
  82. package/dist/humanReadablePane2.cjs.js +147 -15
  83. package/dist/humanReadablePane2.cjs.js.map +1 -1
  84. package/dist/humanReadablePane2.esm.js +281 -114
  85. package/dist/humanReadablePane2.esm.js.map +1 -1
  86. package/dist/imagePane.d.ts.map +1 -1
  87. package/dist/imagePane2.cjs.js +1 -1
  88. package/dist/imagePane2.cjs.js.map +1 -1
  89. package/dist/imagePane2.esm.js +9 -7
  90. package/dist/imagePane2.esm.js.map +1 -1
  91. package/dist/index.cjs.js +1 -1
  92. package/dist/index.cjs.js.map +1 -1
  93. package/dist/index.esm.js +3 -3
  94. package/dist/internal/internalPane.d.ts.map +1 -1
  95. package/dist/internal/internalPane2.cjs.js +1 -1
  96. package/dist/internal/internalPane2.cjs.js.map +1 -1
  97. package/dist/internal/internalPane2.esm.js +55 -60
  98. package/dist/internal/internalPane2.esm.js.map +1 -1
  99. package/dist/mainPage/header.cjs.js +1 -1
  100. package/dist/mainPage/header.esm.js +2 -2
  101. package/dist/mainPage/index.cjs.js +1 -1
  102. package/dist/mainPage/index.cjs.js.map +1 -1
  103. package/dist/mainPage/index.d.ts.map +1 -1
  104. package/dist/mainPage/index.esm.js +35 -26
  105. package/dist/mainPage/index.esm.js.map +1 -1
  106. package/dist/mainPage/navbar.cjs.js +1 -1
  107. package/dist/mainPage/navbar.cjs.js.map +1 -1
  108. package/dist/mainPage/navbar.esm.js +15 -15
  109. package/dist/mainPage/navigation.cjs.js +1 -1
  110. package/dist/mainPage/navigation.cjs.js.map +1 -1
  111. package/dist/mainPage/navigation.esm.js +4 -4
  112. package/dist/mainPage/profileHeading.d.ts.map +1 -1
  113. package/dist/mainPage/profileHeading2.cjs.js +1 -1
  114. package/dist/mainPage/profileHeading2.cjs.js.map +1 -1
  115. package/dist/mainPage/profileHeading2.esm.js +14 -14
  116. package/dist/mainPage/profileHeading2.esm.js.map +1 -1
  117. package/dist/n3Pane.d.ts.map +1 -1
  118. package/dist/n3Pane2.cjs.js +1 -1
  119. package/dist/n3Pane2.cjs.js.map +1 -1
  120. package/dist/n3Pane2.esm.js +1 -1
  121. package/dist/n3Pane2.esm.js.map +1 -1
  122. package/dist/navigation/browserEvents.cjs.js +1 -1
  123. package/dist/navigation/browserEvents.cjs.js.map +1 -1
  124. package/dist/navigation/browserEvents.d.ts.map +1 -1
  125. package/dist/navigation/browserEvents.esm.js +17 -17
  126. package/dist/navigation/browserEvents.esm.js.map +1 -1
  127. package/dist/navigation/chrome.cjs.js +1 -1
  128. package/dist/navigation/chrome.cjs.js.map +1 -1
  129. package/dist/navigation/chrome.d.ts +2 -2
  130. package/dist/navigation/chrome.d.ts.map +1 -1
  131. package/dist/navigation/chrome.esm.js +2 -2
  132. package/dist/navigation/chrome.esm.js.map +1 -1
  133. package/dist/navigation/controller.cjs.js +1 -1
  134. package/dist/navigation/controller.cjs.js.map +1 -1
  135. package/dist/navigation/controller.esm.js +37 -37
  136. package/dist/navigation/podContext.cjs.js +1 -1
  137. package/dist/navigation/podContext.cjs.js.map +1 -1
  138. package/dist/navigation/podContext.esm.js +5 -5
  139. package/dist/navigation/state.cjs.js +1 -1
  140. package/dist/navigation/state.cjs.js.map +1 -1
  141. package/dist/navigation/state.d.ts +4 -0
  142. package/dist/navigation/state.d.ts.map +1 -1
  143. package/dist/navigation/state.esm.js +18 -5
  144. package/dist/navigation/state.esm.js.map +1 -1
  145. package/dist/outline/fileExplorerHelpers.cjs.js +1 -1
  146. package/dist/outline/fileExplorerHelpers.cjs.js.map +1 -1
  147. package/dist/outline/fileExplorerHelpers.d.ts +2 -5
  148. package/dist/outline/fileExplorerHelpers.d.ts.map +1 -1
  149. package/dist/outline/fileExplorerHelpers.esm.js +11 -13
  150. package/dist/outline/fileExplorerHelpers.esm.js.map +1 -1
  151. package/dist/outline/manager2.cjs.js +1 -1
  152. package/dist/outline/manager2.cjs.js.map +1 -1
  153. package/dist/outline/manager2.esm.js +355 -327
  154. package/dist/outline/manager2.esm.js.map +1 -1
  155. package/dist/registerPanes.cjs.js +1 -1
  156. package/dist/registerPanes.cjs.js.map +1 -1
  157. package/dist/registerPanes.esm.js +1 -1
  158. package/dist/registerPanes.esm.js.map +1 -1
  159. package/dist/slideshow/slideshowPane.cjs.js +1 -1
  160. package/dist/slideshow/slideshowPane.cjs.js.map +1 -1
  161. package/dist/slideshow/slideshowPane.esm.js +30 -30
  162. package/dist/slideshow/slideshowPane.esm.js.map +1 -1
  163. package/dist/social/socialPane2.cjs.js +1 -1
  164. package/dist/social/socialPane2.esm.js +1 -1
  165. package/dist/social/socialSections.cjs.js +1 -1
  166. package/dist/social/socialSections.esm.js +1 -1
  167. package/dist/utils/paneUtils.cjs.js +1 -1
  168. package/dist/utils/paneUtils.cjs.js.map +1 -1
  169. package/dist/utils/paneUtils.esm.js +15 -15
  170. package/dist/versionInfo.cjs.js +1 -1
  171. package/dist/versionInfo.cjs.js.map +1 -1
  172. package/dist/versionInfo.esm.js +9 -9
  173. package/dist/versionInfo.esm.js.map +1 -1
  174. package/package.json +12 -13
@@ -1,22 +1,34 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.human-readable-pane{box-sizing:border-box;flex-direction:column;width:100%;min-width:0;max-width:100%;margin:0;padding:0 40px;display:flex;overflow:hidden}.human-readable-pane__container{box-sizing:border-box;width:100%;min-width:0;max-width:100%;margin:0;padding:0;display:block;overflow-x:hidden}.human-readable-pane__frame{border:1px solid var(--solid-ui-color-slate-200,#e2e8f0);height:var(--human-readable-pane-height,30rem);box-sizing:border-box;resize:both;width:100%;min-width:0;max-width:100%;padding:1rem;display:block;overflow:auto}.human-readable-pane__frame--iframe{box-sizing:border-box;background:var(--color-background,white);width:100%;max-width:100%;min-height:18rem;padding:0;display:block;overflow:auto}.human-readable-pane--iframe,solid-ui-file-explorer-provider>.paneDiv.human-readable-pane--iframe{flex:1;height:100%;min-height:0;display:flex;overflow:hidden}.human-readable-pane__container--iframe{flex-direction:column;flex:auto;min-height:0;display:flex}.human-readable-pane__container--iframe>.human-readable-pane__frame--iframe{resize:none;flex:1;height:auto;min-height:0}.human-readable-pane__frame--markdown{overflow-wrap:anywhere;word-break:break-word}.human-readable-pane__frame--plain-text{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;margin:0;font-family:monospace}.human-readable-pane__frame--markdown>*{box-sizing:border-box;max-width:100%}.human-readable-pane__frame--markdown img,.human-readable-pane__frame--markdown video,.human-readable-pane__frame--markdown canvas,.human-readable-pane__frame--markdown iframe{max-width:100%;height:auto}.human-readable-pane__frame--markdown pre,.human-readable-pane__frame--markdown code{overflow-wrap:anywhere;word-break:break-word;max-width:100%}.human-readable-pane__frame--markdown pre{white-space:pre-wrap}.human-readable-pane__frame--markdown table{box-sizing:border-box;width:100%;max-width:100%;display:block;overflow-x:auto}.human-readable-pane__frame--markdown th,.human-readable-pane__frame--markdown td{white-space:normal;overflow-wrap:anywhere;word-break:break-word}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame{resize:none;min-width:0;padding:.75rem}.human-readable-pane[data-layout=mobile]{padding:0}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--markdown,.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--plain-text{overflow-wrap:anywhere;word-break:break-word}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--iframe{width:100%;max-width:100%;min-height:0;height:max(16rem, min(var(--human-readable-pane-height,30rem), 75vh))}@media (width<=576px){.human-readable-pane{padding:0}.human-readable-pane__frame{resize:none;min-width:0;padding:.75rem}.human-readable-pane__frame--markdown,.human-readable-pane__frame--plain-text{overflow-wrap:anywhere;word-break:break-word}.human-readable-pane__frame--iframe{width:100%;max-width:100%;min-height:0;height:max(16rem, min(var(--human-readable-pane-height,30rem), 75vh))}}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.human-readable-pane{box-sizing:border-box;flex-direction:column;flex:auto;width:100%;min-width:0;max-width:100%;height:100%;min-height:0;margin:0;padding:0 40px;display:flex;overflow:auto}.human-readable-pane__container{box-sizing:border-box;flex-direction:column;flex:auto;width:100%;min-width:0;max-width:100%;min-height:0;margin:0;padding:0;display:flex;overflow-x:hidden}.human-readable-pane__frame{border:1px solid var(--solid-ui-color-slate-200,#e2e8f0);height:var(--human-readable-pane-height,480px);box-sizing:border-box;resize:both;width:100%;min-width:0;max-width:100%;padding:1rem;display:block;overflow:auto}.human-readable-pane__frame--markdown,.human-readable-pane__frame--plain-text{resize:none;flex:auto;height:auto;min-height:100%;max-height:100%}.human-readable-pane__frame--iframe{box-sizing:border-box;background:var(--color-background,white);width:100%;max-width:100%;min-height:0;padding:0;display:block;overflow:hidden}.human-readable-pane--iframe,solid-ui-file-explorer-provider>.paneDiv.human-readable-pane--iframe{flex:1;height:100%;min-height:0;display:flex;overflow:visible}.human-readable-pane__container--iframe{flex-direction:column;flex:auto;min-height:0;display:flex}.human-readable-pane__container--iframe>.human-readable-pane__frame--iframe{resize:none;flex:auto;height:480px;min-height:288px}.human-readable-pane__frame--markdown,.human-readable-pane__frame--plain-text{max-height:none;overflow:visible}.human-readable-pane__frame--markdown{overflow-wrap:anywhere;word-break:break-word}.human-readable-pane__frame--plain-text{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;margin:0;font-family:monospace}.human-readable-pane__frame--markdown>*{box-sizing:border-box;max-width:100%}.human-readable-pane__frame--markdown img,.human-readable-pane__frame--markdown video,.human-readable-pane__frame--markdown canvas,.human-readable-pane__frame--markdown iframe{max-width:100%;height:auto}.human-readable-pane__frame--markdown pre,.human-readable-pane__frame--markdown code{overflow-wrap:anywhere;word-break:break-word;max-width:100%}.human-readable-pane__frame--markdown pre{white-space:pre-wrap}.human-readable-pane__frame--markdown table{box-sizing:border-box;width:100%;max-width:100%;display:block;overflow-x:auto}.human-readable-pane__frame--markdown th,.human-readable-pane__frame--markdown td{white-space:normal;overflow-wrap:anywhere;word-break:break-word}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame{resize:none;min-width:0;padding:.75rem}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--markdown,.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--plain-text{min-height:100%;max-height:none}.human-readable-pane[data-layout=mobile]{padding:0}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--markdown,.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--plain-text{overflow-wrap:anywhere;word-break:break-word}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--iframe{flex:none;width:100%;max-width:100%;height:100vh;min-height:100vh}@media (width<=576px){.human-readable-pane{padding:0}.human-readable-pane__frame{resize:none;min-width:0;padding:.75rem}.human-readable-pane__frame--markdown,.human-readable-pane__frame--plain-text{overflow-wrap:anywhere;word-break:break-word}.human-readable-pane__frame--iframe{flex:none;width:100%;max-width:100%;height:100vh;min-height:100vh}}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
2
  import { icons as e, ns as t } from "solid-ui";
3
- import { Util as n } from "rdflib";
4
- import { marked as r } from "marked";
5
- import i from "dompurify";
3
+ import { authn as n } from "solid-logic";
4
+ import { Util as r } from "rdflib";
5
+ import { marked as i } from "marked";
6
+ import a from "dompurify";
6
7
  // src/humanReadablePane.ts
7
- var a = (e) => {
8
+ function o() {
9
+ try {
10
+ return n.currentUser()?.value ?? null;
11
+ } catch {
12
+ return null;
13
+ }
14
+ }
15
+ var s = (e) => {
8
16
  if (!e) return !1;
9
17
  let t = e.split("?")[0].split("#")[0];
10
18
  return /\.(md|markdown|mdown|mkd|mkdn)$/i.test(t);
11
- }, o = /* @__PURE__ */ new Map();
12
- function s(e, t, n) {
13
- e.className = "", e.classList.add("human-readable-pane__frame"), e.classList.add(`human-readable-pane__frame--${t}`), n !== void 0 && e.style.setProperty("--human-readable-pane-height", `${n}em`);
19
+ }, c = (e) => {
20
+ if (!e) return !1;
21
+ let t = e.split("?")[0].split("#")[0];
22
+ return /\.json$/i.test(t);
23
+ }, l = /* @__PURE__ */ new Map();
24
+ function u(e, t, n) {
25
+ e.className = "", e.classList.add("human-readable-pane__frame"), e.classList.add(`human-readable-pane__frame--${t}`), n !== void 0 && e.style.setProperty("--human-readable-pane-height", `${n * 16}px`);
14
26
  }
15
- var c = "solidos-human-readable-preview", l = "allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals", u = (e) => e.includes("<script src=\"https://dokie.li/scripts/dokieli.js\">") || e.includes("dokieli.css");
16
- function d(e) {
27
+ var d = "solidos-human-readable-preview", f = "allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals", p = (e) => e.includes("<script src=\"https://dokie.li/scripts/dokieli.js\">") || e.includes("dokieli.css");
28
+ function m(e) {
17
29
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
18
30
  }
19
- function f(e, t) {
31
+ function h(e, t) {
20
32
  let n = e.match(/<base(\s[^>]*)?>/i);
21
33
  if (n && n.index !== void 0) {
22
34
  let r = n[0].match(/\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i), i = r?.[1] ?? r?.[2] ?? r?.[3];
@@ -27,17 +39,21 @@ function f(e, t) {
27
39
  } catch {
28
40
  return e;
29
41
  }
30
- let o = n[0].replace(r[0], `href="${d(a)}"`);
42
+ let o = n[0].replace(r[0], `href="${m(a)}"`);
31
43
  return e.slice(0, n.index) + o + e.slice(n.index + n[0].length);
32
44
  }
33
- let r = `<base href="${d(t)}">`, i = e.match(/<head(\s[^>]*)?>/i);
45
+ let r = `<base href="${m(t)}">`, i = e.match(/<head(\s[^>]*)?>/i);
34
46
  if (i && i.index !== void 0) {
35
47
  let t = i.index + i[0].length;
36
48
  return e.slice(0, t) + r + e.slice(t);
37
49
  }
38
50
  return r + e;
39
51
  }
40
- function p(e) {
52
+ function g(e) {
53
+ let t = "<script>\n(() => {\n const style = document.createElement('style')\n style.textContent = 'html, body { height: auto !important; min-height: 0 !important; max-height: none !important; overflow: visible !important; }'\n document.head?.appendChild(style)\n const reportHeight = () => {\n const elements = Array.from(document.querySelectorAll('*'))\n const height = Math.max(\n document.documentElement.scrollHeight,\n document.body ? document.body.scrollHeight : 0,\n ...elements.map(element => Math.max(\n element.scrollHeight,\n Math.ceil(element.getBoundingClientRect().bottom + window.scrollY)\n ))\n )\n window.parent.postMessage({ type: 'solidos-preview-size', height }, '*')\n }\n window.addEventListener('load', reportHeight)\n new ResizeObserver(reportHeight).observe(document.documentElement)\n document.addEventListener('DOMContentLoaded', () => {\n if (document.body) new ResizeObserver(reportHeight).observe(document.body)\n new MutationObserver(reportHeight).observe(document.body || document.documentElement, {\n childList: true,\n subtree: true,\n attributes: true\n })\n reportHeight()\n })\n window.setInterval(reportHeight, 500)\n reportHeight()\n})()\n<\/script>", n = e.replace(/<\/body\s*>/i, `${t}$&`);
54
+ return n === e ? `${e}${t}` : n;
55
+ }
56
+ function _(e) {
41
57
  let t = e.split("/").pop() || e;
42
58
  try {
43
59
  return decodeURIComponent(t);
@@ -45,32 +61,67 @@ function p(e) {
45
61
  return t;
46
62
  }
47
63
  }
48
- function m(e, t) {
49
- let n = p(t);
64
+ function v(e, t) {
65
+ let n = _(t);
50
66
  try {
51
67
  return new DOMParser().parseFromString(e, "text/html").querySelector("title")?.textContent?.trim() || n;
52
68
  } catch {
53
69
  return n;
54
70
  }
55
71
  }
56
- var h = "solidos-preview-request", g = "solidos-preview-response", _ = /* @__PURE__ */ new Set([
57
- "GET",
72
+ var y = "solidos-preview-request", b = "solidos-preview-response", x = "data-solidos-preview-bridge", S = /* @__PURE__ */ new Set(["GET", "HEAD"]), C = /* @__PURE__ */ new Set([
58
73
  "PUT",
59
74
  "PATCH",
60
75
  "DELETE"
61
76
  ]);
62
- function v(e) {
77
+ function w(e) {
78
+ if (typeof e != "string" || !e.includes(y)) return e;
79
+ let t = new DOMParser().parseFromString(e, "text/html"), n = !1;
80
+ for (let e of t.querySelectorAll("script")) {
81
+ let t = e.textContent || "";
82
+ (e.hasAttribute(x) || t.includes(y) && t.includes(b) && t.includes("const pending = new Map()")) && (e.remove(), n = !0);
83
+ }
84
+ if (!n) return e;
85
+ let r = e.match(/<!doctype[^>]*>/i)?.[0];
86
+ return `${r ? `${r}\n` : ""}${t.documentElement.outerHTML}`;
87
+ }
88
+ function T(e) {
63
89
  return e === "about:srcdoc" || /^file:\/\/srcdoc\/?(?:[?#].*)?$/i.test(e);
64
90
  }
65
- function y(e, t) {
91
+ function E(e, t) {
66
92
  let n = new URL(e, t).href;
67
- return v(n) ? t : n;
93
+ return T(n) ? t : n;
94
+ }
95
+ function D(e) {
96
+ if (e) try {
97
+ let t = new URL(e);
98
+ return t.hash = "", t.href;
99
+ } catch {
100
+ return;
101
+ }
102
+ }
103
+ function O(e, t, n, r = null) {
104
+ let i, a;
105
+ try {
106
+ i = new URL(E(e, n)), a = new URL(n);
107
+ } catch {
108
+ return !1;
109
+ }
110
+ if (i.origin !== a.origin) return !1;
111
+ let o = t.toUpperCase(), s = new URL(i.href);
112
+ s.hash = "";
113
+ let c = new URL(a.href);
114
+ c.hash = "";
115
+ let l = s.href === c.href, u = i.href === a.href, d = i.pathname === "/profile/card" || s.href === D(r);
116
+ return S.has(o) && (l || d) || u && C.has(o);
68
117
  }
69
- function b(e, t, n) {
70
- let r = `<script>
118
+ function k(e, t, n, r = null) {
119
+ let i = `<script ${x}="true">
71
120
  (() => {
72
121
  const documentUri = ${JSON.stringify(t)}
122
+ const documentOrigin = new URL(documentUri).origin
73
123
  const nonce = ${JSON.stringify(n)}
124
+ const viewerWebId = ${JSON.stringify(r)}
74
125
  const pending = new Map()
75
126
  let requestId = 0
76
127
  try {
@@ -126,19 +177,19 @@ function b(e, t, n) {
126
177
  })
127
178
  return operation
128
179
  }
129
- return {
130
- get: key => run(store.get(key)),
131
- getAll: () => run(Array.from(store.values())),
132
- getAllKeys: () => run(Array.from(store.keys())),
133
- count: () => run(store.size),
134
- openKeyCursor () {
180
+ const openCursor = (withValue) => {
135
181
  const keys = Array.from(store.keys())
136
182
  const operation = request(null)
137
183
  pending++
138
184
  let index = 0
139
185
  const emit = () => {
140
186
  operation.result = index < keys.length
141
- ? { key: keys[index], continue: () => { index++; queueMicrotask(emit) } }
187
+ ? {
188
+ key: keys[index],
189
+ primaryKey: keys[index],
190
+ value: withValue ? store.get(keys[index]) : undefined,
191
+ continue: () => { index++; queueMicrotask(emit) }
192
+ }
142
193
  : null
143
194
  operation.onsuccess?.({ target: operation })
144
195
  if (!operation.result) {
@@ -151,7 +202,15 @@ function b(e, t, n) {
151
202
  }
152
203
  queueMicrotask(emit)
153
204
  return operation
154
- },
205
+ }
206
+ return {
207
+ transaction,
208
+ get: key => run(store.get(key)),
209
+ getAll: () => run(Array.from(store.values())),
210
+ getAllKeys: () => run(Array.from(store.keys())),
211
+ count: () => run(store.size),
212
+ openCursor: () => openCursor(true),
213
+ openKeyCursor: () => openCursor(false),
155
214
  put: (value, key) => run(undefined, () => store.set(key, value)),
156
215
  add: (value, key) => run(undefined, () => store.set(key, value)),
157
216
  delete: key => run(undefined, () => store.delete(key)),
@@ -179,6 +238,27 @@ function b(e, t, n) {
179
238
  }
180
239
  Object.defineProperty(window, 'indexedDB', { configurable: true, value: isolatedIndexedDB })
181
240
  }
241
+ const createMemoryStorage = () => {
242
+ const values = new Map()
243
+ return {
244
+ get length () { return values.size },
245
+ key: index => Array.from(values.keys())[index] ?? null,
246
+ getItem: key => values.get(String(key)) ?? null,
247
+ setItem: (key, value) => values.set(String(key), String(value)),
248
+ removeItem: key => values.delete(String(key)),
249
+ clear: () => values.clear()
250
+ }
251
+ }
252
+ for (const storageName of ['localStorage', 'sessionStorage']) {
253
+ try {
254
+ window[storageName].getItem('__solidos_probe__')
255
+ } catch {
256
+ Object.defineProperty(window, storageName, {
257
+ configurable: true,
258
+ value: createMemoryStorage()
259
+ })
260
+ }
261
+ }
182
262
  const nativeFetch = window.fetch.bind(window)
183
263
 
184
264
  function isSrcdocUrl (url) {
@@ -197,7 +277,7 @@ function b(e, t, n) {
197
277
  return new Promise((resolve, reject) => {
198
278
  pending.set(id, { resolve, reject })
199
279
  window.parent.postMessage({
200
- type: ${JSON.stringify(h)},
280
+ type: ${JSON.stringify(y)},
201
281
  nonce,
202
282
  id,
203
283
  url,
@@ -210,7 +290,7 @@ function b(e, t, n) {
210
290
 
211
291
  window.addEventListener('message', event => {
212
292
  const message = event.data
213
- if (!message || message.type !== ${JSON.stringify(g)} || message.nonce !== nonce) return
293
+ if (!message || message.type !== ${JSON.stringify(b)} || message.nonce !== nonce) return
214
294
  const entry = pending.get(message.id)
215
295
  if (!entry) return
216
296
  pending.delete(message.id)
@@ -225,11 +305,38 @@ function b(e, t, n) {
225
305
  }))
226
306
  })
227
307
 
308
+ const reportHeight = () => {
309
+ const elements = Array.from(document.querySelectorAll('*'))
310
+ const height = Math.max(
311
+ document.documentElement.scrollHeight,
312
+ document.body ? document.body.scrollHeight : 0,
313
+ ...elements.map(element => Math.max(
314
+ element.scrollHeight,
315
+ Math.ceil(element.getBoundingClientRect().bottom + window.scrollY)
316
+ ))
317
+ )
318
+ window.parent.postMessage({ type: 'solidos-preview-size', height }, '*')
319
+ }
320
+ window.addEventListener('load', reportHeight)
321
+ new ResizeObserver(reportHeight).observe(document.documentElement)
322
+ if (document.body) new ResizeObserver(reportHeight).observe(document.body)
323
+ new MutationObserver(reportHeight).observe(document.body || document.documentElement, {
324
+ childList: true,
325
+ subtree: true,
326
+ attributes: true
327
+ })
328
+ window.setInterval(reportHeight, 500)
329
+ reportHeight()
330
+
228
331
  window.fetch = async (input, init = {}) => {
229
332
  const request = input instanceof Request ? input : null
230
333
  const url = documentRequestUrl(request ? request.url : input)
231
334
  const method = (init.method || (request && request.method) || 'GET').toUpperCase()
232
- if (url !== documentUri || !${JSON.stringify(Array.from(_))}.includes(method)) {
335
+ const sameOrigin = new URL(url).origin === documentOrigin
336
+ const allowed = sameOrigin &&
337
+ (${JSON.stringify(Array.from(S))}.includes(method) ||
338
+ (url === documentUri && ${JSON.stringify(Array.from(C))}.includes(method)))
339
+ if (!allowed) {
233
340
  return nativeFetch(input, init)
234
341
  }
235
342
  const headers = new Headers(request ? request.headers : undefined)
@@ -273,8 +380,10 @@ function b(e, t, n) {
273
380
  const resolvedUrl = documentRequestUrl(url)
274
381
  this._method = String(method || 'GET').toUpperCase()
275
382
  this._url = resolvedUrl
276
- this._intercepted = resolvedUrl === documentUri &&
277
- ${JSON.stringify(Array.from(_))}.includes(this._method)
383
+ const sameOrigin = new URL(resolvedUrl).origin === documentOrigin
384
+ this._intercepted = sameOrigin &&
385
+ (${JSON.stringify(Array.from(S))}.includes(this._method) ||
386
+ (resolvedUrl === documentUri && ${JSON.stringify(Array.from(C))}.includes(this._method)))
278
387
  if (!this._intercepted) {
279
388
  this._native.open(method, url, async, user, password)
280
389
  for (const type of ['abort', 'error', 'load', 'loadend', 'progress', 'readystatechange', 'timeout']) {
@@ -341,30 +450,71 @@ function b(e, t, n) {
341
450
  : ''
342
451
  }
343
452
  }
453
+
454
+ // Dokieli's own OIDC session cannot be restored in an opaque-origin
455
+ // sandbox, so it would always show "Sign in". Give it the SolidOS viewer
456
+ // through the same session shape Dokieli uses for its WebExtension mode;
457
+ // requests still go through the restricted bridge above.
458
+ const bridgedSession = viewerWebId
459
+ ? {
460
+ isActive: true,
461
+ webId: viewerWebId,
462
+ authFetch: (input, init) => window.fetch(input, init),
463
+ handleRedirectFromLogin: async () => {},
464
+ restore: async () => {},
465
+ login: async () => {},
466
+ logout: async () => {
467
+ bridgedSession.isActive = false
468
+ bridgedSession.webId = undefined
469
+ }
470
+ }
471
+ : null
472
+ let dokieliHooksInstalled = false
473
+ const installDokieliHooks = () => {
474
+ const config = window.DO && window.DO.C
475
+ if (!config || dokieliHooksInstalled) return
476
+ dokieliHooksInstalled = true
477
+ if (bridgedSession) config.Session = bridgedSession
478
+ // Dokieli skips requests for file: URLs, which is how srcdoc reports
479
+ // its location, so keep its document URL pointing at the resource.
480
+ let documentUrl = config.DocumentURL
481
+ Object.defineProperty(config, 'DocumentURL', {
482
+ configurable: true,
483
+ enumerable: true,
484
+ get: () => documentUrl,
485
+ set: value => {
486
+ documentUrl = typeof value === 'string' && isSrcdocUrl(value) ? documentUri : value
487
+ }
488
+ })
489
+ config.DocumentURL = documentUrl
490
+ }
491
+ // Registered before dokieli.js runs, so this precedes Dokieli's init.
492
+ document.addEventListener('DOMContentLoaded', installDokieliHooks)
493
+ window.addEventListener('load', installDokieliHooks)
344
494
  })()
345
495
  <\/script>`;
346
- return f(e, t).replace(/<head(\s[^>]*)?>/i, (e) => `${e}${r}`);
496
+ return h(w(e) ?? e, t).replace(/<head(\s[^>]*)?>/i, (e) => `${e}${i}`);
347
497
  }
348
- function x(e, t, n, r) {
349
- let i = e.ownerDocument.defaultView;
350
- if (!i) return;
351
- let a = /* @__PURE__ */ new Uint32Array(4);
352
- i.crypto.getRandomValues(a);
353
- let o = Array.from(a, (e) => e.toString(16)).join("-"), s = new URL(t).href;
354
- i.addEventListener("message", (t) => {
498
+ function A(e, t, n, r, i = null) {
499
+ let a = e.ownerDocument.defaultView;
500
+ if (!a) return;
501
+ let o = /* @__PURE__ */ new Uint32Array(4);
502
+ a.crypto.getRandomValues(o);
503
+ let s = Array.from(o, (e) => e.toString(16)).join("-"), c = new URL(t).href;
504
+ a.addEventListener("message", (t) => {
355
505
  let n = t.data;
356
- if (t.source !== e.contentWindow || !n || n.type !== h || n.nonce !== o || y(n.url, s) !== s || !_.has(n.method)) return;
357
- let i = (t) => {
506
+ if (t.source !== e.contentWindow || !n || n.type !== y || n.nonce !== s) return;
507
+ let a = (t) => {
358
508
  e.contentWindow?.postMessage(t, "*");
359
509
  };
360
- r(s, {
510
+ O(n.url, n.method, c, i) ? r(E(n.url, c), {
361
511
  method: n.method,
362
512
  headers: n.headers,
363
- body: n.method === "GET" ? void 0 : n.body
513
+ body: S.has(n.method) ? void 0 : w(n.body)
364
514
  }).then(async (e) => {
365
- i({
366
- type: g,
367
- nonce: o,
515
+ a({
516
+ type: b,
517
+ nonce: s,
368
518
  id: n.id,
369
519
  ok: e.ok,
370
520
  status: e.status,
@@ -372,9 +522,9 @@ function x(e, t, n, r) {
372
522
  body: await e.text()
373
523
  });
374
524
  }).catch((e) => {
375
- i({
376
- type: g,
377
- nonce: o,
525
+ a({
526
+ type: b,
527
+ nonce: s,
378
528
  id: n.id,
379
529
  ok: !1,
380
530
  status: 0,
@@ -382,139 +532,156 @@ function x(e, t, n, r) {
382
532
  body: "",
383
533
  error: e instanceof Error ? e.message : String(e)
384
534
  });
535
+ }) : a({
536
+ type: b,
537
+ nonce: s,
538
+ id: n.id,
539
+ ok: !1,
540
+ status: 403,
541
+ headers: [],
542
+ body: "",
543
+ error: "Request not permitted by the SolidOS preview"
385
544
  });
386
- }), e.setAttribute("sandbox", l), e.srcdoc = b(n, s, o);
545
+ }), e.setAttribute("sandbox", f), e.srcdoc = k(n, c, s, i);
546
+ }
547
+ function j(e, t) {
548
+ let n = (t) => {
549
+ let n = t.data;
550
+ t.source === e.contentWindow && n?.type === "solidos-preview-size" && typeof n.height == "number" && Number.isFinite(n.height) && (e.style.height = `${Math.max(1, Math.ceil(n.height))}px`, e.style.flexShrink = "0");
551
+ };
552
+ return t.addEventListener("message", n), () => t.removeEventListener("message", n);
387
553
  }
388
- var S = {
554
+ var M = {
389
555
  icon: function(t, n) {
390
- if (t && a(t.uri)) return e.iconBase + "markdown.svg";
556
+ if (t && s(t.uri)) return e.iconBase + "markdown.svg";
391
557
  if (t) {
392
- let r = n.session.store, i = o.get(t.uri);
558
+ let r = n.session.store, i = l.get(t.uri);
393
559
  if (i === "dokieli") return e.iconBase + "dokieli-logo.png";
394
560
  if (i === "html") return e.originalIconBase + "tango/22-text-x-generic.png";
395
561
  let a = r.fetcher.getHeader(t.doc(), "content");
396
562
  if (a && a.length > 0) {
397
563
  let n = a[0], r = n.includes("<script src=\"https://dokie.li/scripts/dokieli.js\">") || n.includes("dokieli.css");
398
- return o.set(t.uri, r ? "dokieli" : "html"), r ? e.iconBase + "dokieli-logo.png" : e.originalIconBase + "tango/22-text-x-generic.png";
564
+ return l.set(t.uri, r ? "dokieli" : "html"), r ? e.iconBase + "dokieli-logo.png" : e.originalIconBase + "tango/22-text-x-generic.png";
399
565
  }
400
- let s = r.fetcher.getHeader(t.doc(), "content-type");
401
- if ((s ? s[0].split(";", 1)[0].trim() : null) === "text/html") return r.fetcher._fetch(t.uri).then((e) => e.text()).then((n) => {
566
+ let o = r.fetcher.getHeader(t.doc(), "content-type");
567
+ if ((o ? o[0].split(";", 1)[0].trim() : null) === "text/html") return r.fetcher._fetch(t.uri).then((e) => e.text()).then((n) => {
402
568
  let r = n.includes("<script src=\"https://dokie.li/scripts/dokieli.js\">") || n.includes("dokieli.css");
403
- return o.set(t.uri, r ? "dokieli" : "html"), r ? e.iconBase + "dokieli-logo.png" : e.originalIconBase + "tango/22-text-x-generic.png";
404
- }).catch(() => (o.set(t.uri, "html"), e.originalIconBase + "tango/22-text-x-generic.png"));
569
+ return l.set(t.uri, r ? "dokieli" : "html"), r ? e.iconBase + "dokieli-logo.png" : e.originalIconBase + "tango/22-text-x-generic.png";
570
+ }).catch(() => (l.set(t.uri, "html"), e.originalIconBase + "tango/22-text-x-generic.png"));
405
571
  }
406
572
  return e.originalIconBase + "tango/22-text-x-generic.png";
407
573
  },
408
574
  name: "humanReadable",
409
- label: function(e, r) {
410
- let i = r.session.store, s = [
575
+ label: function(e, n) {
576
+ let i = n.session.store, a = [
411
577
  "text/plain",
412
578
  "text/html",
413
579
  "text/markdown",
580
+ "application/json",
414
581
  "application/xhtml+xml",
415
582
  "application/pdf",
416
583
  "video/mp4"
417
- ], c = function(e, t, n) {
584
+ ], o = function(e, t, n) {
418
585
  let r = e.fetcher.getHeader(t, "content-type");
419
586
  if (r) {
420
587
  for (let e = 0; e < r.length; e++) for (let t = 0; t < n.length; t++) if (r[e].indexOf(n[t]) >= 0) return !0;
421
588
  }
422
589
  return !1;
423
- }, l = function(e, t, r) {
590
+ }, c = function(e, t, n) {
424
591
  let i = e.findTypeURIs(t);
425
- for (let e = 0; e < r.length; e++) if (n.mediaTypeClass(r[e]).uri in i) return !0;
592
+ for (let e = 0; e < n.length; e++) if (r.mediaTypeClass(n[e]).uri in i) return !0;
426
593
  return !1;
427
594
  };
428
595
  if (!e.uri) return null;
429
596
  if (i.findTypeURIs(e)[t.link("WebPage").uri]) return "Webpage";
430
- if (a(e.uri)) return "View";
431
- if (c(i, e, s) || l(i, e, s)) {
597
+ if (s(e.uri)) return "View";
598
+ if (o(i, e, a) || c(i, e, a)) {
432
599
  let t = i.fetcher.getHeader(e.doc(), "content-type");
433
- return (t ? t[0].split(";", 1)[0].trim() : null) === "text/html" && !o.has(e.uri) && i.fetcher._fetch(e.uri).then((e) => e.text()).then((t) => {
600
+ return (t ? t[0].split(";", 1)[0].trim() : null) === "text/html" && !l.has(e.uri) && i.fetcher._fetch(e.uri).then((e) => e.text()).then((t) => {
434
601
  let n = t.includes("<script src=\"https://dokie.li/scripts/dokieli.js\">") || t.includes("dokieli.css");
435
- o.set(e.uri, n ? "dokieli" : "html");
602
+ l.set(e.uri, n ? "dokieli" : "html");
436
603
  }).catch(() => {
437
- o.set(e.uri, "html");
604
+ l.set(e.uri, "html");
438
605
  }), "View";
439
606
  }
440
607
  return null;
441
608
  },
442
609
  render: function(e, t) {
443
- let n = t.dom, h = n.createElement("div"), g = t.session.store;
444
- function _(e) {
610
+ let n = t.dom, r = n.createElement("div"), y = t.session.store;
611
+ function b(e) {
445
612
  let n = t.environment ?? {};
446
613
  e.dataset.layout = n.layout ?? "desktop";
447
614
  }
448
- let v = g.fetcher.getHeader(e.doc(), "content-type"), y = v ? v[0].split(";", 1)[0].trim() : null, b = y === "text/markdown" || a(e.uri), S = y === "text/plain";
449
- y || console.log("humanReadablePane: unknown content-type?"), h.classList.add("human-readable-pane"), _(h);
450
- let C = function(t) {
451
- g.fetcher.webOperation("GET", e.uri).then((e) => {
452
- let n = e.responseText ?? "", a = Math.min(30, n.split(/\n/).length + 5), o = r.parse(n, { async: !1 });
453
- t.innerHTML = i.sanitize(o), s(t, "markdown", a);
615
+ let x = y.fetcher.getHeader(e.doc(), "content-type"), S = x ? x[0].split(";", 1)[0].trim() : null, C = S === "text/markdown" || s(e.uri), w = S === "text/plain" || S === "application/json" || !S && c(e.uri);
616
+ S || console.log("humanReadablePane: unknown content-type?"), r.classList.add("human-readable-pane"), b(r);
617
+ let T = function(t) {
618
+ y.fetcher.webOperation("GET", e.uri).then((e) => {
619
+ let n = e.responseText ?? "", r = Math.min(30, n.split(/\n/).length + 5), o = i.parse(n, { async: !1 });
620
+ t.innerHTML = a.sanitize(o), u(t, "markdown", r);
454
621
  }).catch((e) => {
455
622
  console.error("Error fetching markdown content:", e), t.innerHTML = "<p>Error loading content</p>";
456
623
  });
457
- }, w = function(t) {
458
- g.fetcher.webOperation("GET", e.uri).then((e) => {
624
+ }, E = function(t) {
625
+ y.fetcher.webOperation("GET", e.uri).then((e) => {
459
626
  let n = e.responseText ?? "", r = Math.min(30, n.split(/\n/).length + 5);
460
- t.textContent = n, s(t, "plain-text", r);
627
+ t.textContent = n, u(t, "plain-text", r);
461
628
  }).catch((e) => {
462
629
  console.error("Error fetching plain text content:", e), t.textContent = "Error loading content";
463
630
  });
464
631
  };
465
- if (b) {
632
+ if (C) {
466
633
  let e = n.createElement("div");
467
- C(e);
634
+ T(e);
468
635
  let t = n.createElement("div");
469
- t.classList.add("human-readable-pane__container"), t.appendChild(e), h.appendChild(t);
470
- } else if (S) {
636
+ t.classList.add("human-readable-pane__container"), t.appendChild(e), r.appendChild(t);
637
+ } else if (w) {
471
638
  let e = n.createElement("pre");
472
- w(e);
639
+ E(e);
473
640
  let t = n.createElement("div");
474
- t.classList.add("human-readable-pane__container"), t.appendChild(e), h.appendChild(t);
641
+ t.classList.add("human-readable-pane__container"), t.appendChild(e), r.appendChild(t);
475
642
  } else {
476
643
  let t = n.createElement("iframe");
477
- t.name = c, t.title = p(e.uri), s(t, "iframe");
478
- let r = y === "text/html" || y === "application/xhtml+xml", i = null, a = !1, _ = !1, v = typeof MutationObserver > "u" ? null : new MutationObserver((e) => {
479
- let t = e.some((e) => Array.from(e.addedNodes).some((e) => e === h || e.nodeType === Node.ELEMENT_NODE && e.contains(h)));
480
- h.isConnected ? _ = !0 : (_ || t) && (a = !0, i &&= (URL.revokeObjectURL(i), null), v?.disconnect());
644
+ t.name = d, t.title = _(e.uri), u(t, "iframe");
645
+ let i = n.defaultView, a = i ? j(t, i) : () => {}, s = S === "text/html" || S === "application/xhtml+xml", c = null, b = !1, x = !1, C = typeof MutationObserver > "u" ? null : new MutationObserver((e) => {
646
+ let t = e.some((e) => Array.from(e.addedNodes).some((e) => e === r || e.nodeType === Node.ELEMENT_NODE && e.contains(r)));
647
+ r.isConnected ? x = !0 : (x || t) && (b = !0, c &&= (URL.revokeObjectURL(c), null), a(), C?.disconnect());
481
648
  });
482
- v?.observe(n, {
649
+ C?.observe(n, {
483
650
  childList: !0,
484
651
  subtree: !0
485
652
  });
486
- let b = (e) => {
487
- t.removeAttribute("src"), t.setAttribute("sandbox", ""), t.srcdoc = `<p style="font-family: sans-serif">${d(e)}</p>`;
653
+ let w = (e) => {
654
+ t.removeAttribute("src"), t.setAttribute("sandbox", ""), t.srcdoc = `<p style="font-family: sans-serif">${m(e)}</p>`;
488
655
  };
489
- r ? g.fetcher.webOperation("GET", e.uri).then((n) => {
656
+ s ? y.fetcher.webOperation("GET", e.uri).then((n) => {
490
657
  let r = n.responseText ?? "";
491
- t.title = m(r, e.uri);
492
- let i = u(r);
493
- o.set(e.uri, i ? "dokieli" : "html"), i ? x(t, e.uri, r, (e, t) => g.fetcher._fetch(e, t)) : (t.setAttribute("sandbox", l), t.srcdoc = f(r, e.uri));
658
+ t.title = v(r, e.uri);
659
+ let i = p(r);
660
+ l.set(e.uri, i ? "dokieli" : "html"), i ? A(t, e.uri, r, (e, t) => y.fetcher._fetch(e, t), o()) : (t.setAttribute("sandbox", f), t.srcdoc = g(h(r, e.uri)));
494
661
  }).catch((e) => {
495
- console.error("Error fetching HTML content:", e), b("Error loading content");
496
- }) : g.fetcher._fetch(e.uri).then(async (n) => {
662
+ console.error("Error fetching HTML content:", e), w("Error loading content");
663
+ }) : y.fetcher._fetch(e.uri).then(async (n) => {
497
664
  if (!n.ok) throw Error(`HTTP ${n.status}`);
498
665
  let r = n.headers.get("content-type")?.split(";", 1)[0].trim().toLowerCase();
499
666
  if (r === "text/html" || r === "application/xhtml+xml") {
500
667
  let r = await n.text();
501
- t.title = m(r, e.uri);
502
- let i = u(r);
503
- o.set(e.uri, i ? "dokieli" : "html"), i ? x(t, e.uri, r, (e, t) => g.fetcher._fetch(e, t)) : (t.setAttribute("sandbox", l), t.srcdoc = f(r, e.uri));
668
+ t.title = v(r, e.uri);
669
+ let i = p(r);
670
+ l.set(e.uri, i ? "dokieli" : "html"), i ? A(t, e.uri, r, (e, t) => y.fetcher._fetch(e, t), o()) : (t.setAttribute("sandbox", f), t.srcdoc = g(h(r, e.uri)));
504
671
  return;
505
672
  }
506
- t.setAttribute("sandbox", l);
507
- let s = URL.createObjectURL(await n.blob());
508
- a ? URL.revokeObjectURL(s) : (i = s, t.src = s);
673
+ r !== "application/pdf" && t.setAttribute("sandbox", f);
674
+ let i = URL.createObjectURL(await n.blob());
675
+ b ? URL.revokeObjectURL(i) : (c = i, t.src = i);
509
676
  }).catch((e) => {
510
- console.error("Error fetching content:", e), b("Error loading content");
677
+ console.error("Error fetching content:", e), w("Error loading content");
511
678
  });
512
- let S = n.createElement("div");
513
- S.classList.add("human-readable-pane__container"), S.classList.add("human-readable-pane__container--iframe"), S.appendChild(t), h.appendChild(S), h.classList.add("human-readable-pane--iframe");
679
+ let T = n.createElement("div");
680
+ T.classList.add("human-readable-pane__container"), T.classList.add("human-readable-pane__container--iframe"), T.appendChild(t), r.appendChild(T), r.classList.add("human-readable-pane--iframe");
514
681
  }
515
- return h;
682
+ return r;
516
683
  }
517
684
  };
518
- export { c as HUMAN_READABLE_PREVIEW_FRAME_NAME, S as default, y as previewRequestUrl, f as withBaseHref };
685
+ export { d as HUMAN_READABLE_PREVIEW_FRAME_NAME, M as default, O as isAllowedPreviewRequest, E as previewRequestUrl, h as withBaseHref };
519
686
 
520
687
  //# sourceMappingURL=humanReadablePane2.esm.js.map