@epam/ai-dial-attachment-canvas 1.2.0-dev.2 → 1.2.0-dev.6

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 (41) hide show
  1. package/{LazyContentBoundary-CL7J_W9c.js → LazyContentBoundary-CRXN6PG3.js} +1 -1
  2. package/{PdfContent-DhfjgYL-.js → PdfContent-D71LPAe3.js} +1 -1
  3. package/{attachment-canvas-Bp6WeQws.js → attachment-canvas-nvhW3tKV.js} +3 -1
  4. package/{bounded-raw-part-cache-BfbSxRIL-DD07NKh9.js → bounded-raw-part-cache-Cg1BsSZQ-DN8p45IK.js} +1111 -1043
  5. package/{chart-ex-B0DgG3Dt.js → chart-ex-DsESBs97.js} +1 -1
  6. package/{comment-occurrence-CqejEuts-7SeKCBXk.js → comment-occurrence-C8Y2uoVr-C1cxz2TU.js} +1 -1
  7. package/{comment-ui-runtime-lXwVOgjW-Be4RALsI.js → comment-ui-runtime-BfE7MJZn-DhQ_eg15.js} +29 -29
  8. package/comment-ui-runtime-BsK8pmUT-EgWiymew.js +2 -0
  9. package/{comment-ui-runtime-DEtgcmj7-B1G7PH4z.js → comment-ui-runtime-DcJOYlw--B15auUq-.js} +52 -52
  10. package/{comments-CAn2A_Xh-CdgNAj0h.js → comments-Diid5ujN-BdQhRNjI.js} +2 -2
  11. package/components/OoxmlContent/OoxmlContent.d.ts.map +1 -1
  12. package/{delimited-text-worker-host-DcHj_JZt-DWJmaPag.js → delimited-text-worker-host-BVY-Ecni-AimUmSn0.js} +1 -1
  13. package/{docx-B9qBTEkj.js → docx-B-VcIRoc.js} +4628 -4580
  14. package/index.js +564 -564
  15. package/line-distribute-Dtudnqhs--BYZNgzX.js +1237 -0
  16. package/{line-metrics-CBbw80Ko-DoOuwYxZ.js → line-metrics-B60C86uh-DfQUk7X1.js} +1 -1
  17. package/ooxml-highlight-surfaces-CaMjx8u-.js +351 -0
  18. package/package.json +4 -4
  19. package/{pptx-dkJw0-Vx.js → pptx-CnoDB8Fv.js} +955 -923
  20. package/{read-only-comment-decoration-BTnWEeo5-BNhbteYc.js → read-only-comment-decoration-Dz7eTQ4d-Cl3RKKH6.js} +1 -1
  21. package/{read-only-comment-margin-plStyGfE-mggNAMB_.js → read-only-comment-margin-DkgzASAl-BbDxMI5E.js} +1 -1
  22. package/render-worker-host-BfbnEChF-D2thMRGX.js +7 -0
  23. package/render-worker-host-DNL9dWRh-Bky38ZHE.js +7 -0
  24. package/render-worker-host-IkHrYOci-DbjyHK7U.js +7 -0
  25. package/{renderer-module-contract-Cu-GKuPd-Bt0YZuzB.js → renderer-module-contract-D91rkYHH-BtfSKxb4.js} +1 -1
  26. package/test-setup.d.ts +10 -1
  27. package/test-setup.d.ts.map +1 -1
  28. package/types/attachment-canvas.d.ts +17 -0
  29. package/types/attachment-canvas.d.ts.map +1 -1
  30. package/utils/ooxml-highlight-geometry.d.ts +87 -3
  31. package/utils/ooxml-highlight-geometry.d.ts.map +1 -1
  32. package/utils/ooxml-highlight-surfaces.d.ts +33 -6
  33. package/utils/ooxml-highlight-surfaces.d.ts.map +1 -1
  34. package/{visible-index-DPoQYSDt-9lRc-2Ik.js → visible-index-BgiHEc1z-BOzE9X5U.js} +7 -7
  35. package/{xlsx-BAXMTJTG.js → xlsx-Dn0XSlTO.js} +1581 -1556
  36. package/comment-ui-runtime-TLHustXJ-DWCXG2mL.js +0 -2
  37. package/line-distribute-IsUGfHXm-DeITjLzJ.js +0 -1234
  38. package/ooxml-highlight-surfaces-DhK1KJcR.js +0 -294
  39. package/render-worker-host-BEfLZvSL-COy91Rd8.js +0 -7
  40. package/render-worker-host-Ba6Fchqr-DZeKpMWD.js +0 -7
  41. package/render-worker-host-C3xwtHnv-BBGHFdo9.js +0 -7
package/index.js CHANGED
@@ -1,27 +1,27 @@
1
- import { i as e, n as t, r as n, t as r } from "./attachment-canvas-Bp6WeQws.js";
2
- import { i, o as a, t as o } from "./LazyContentBoundary-CL7J_W9c.js";
3
- import { AttachmentType as s, CodeBlockTheme as c, DEFAULT_MARKDOWN_CLASS_NAMES as l, FileExtension as u, MIMEType as d, MarkdownRenderer as f, buildCssVars as p, copyToClipboard as m, mergeClasses as h, restrainedSyntaxTheme as g, stripUrlQueryAndFragment as _ } from "@epam/ai-dial-chat-shared";
4
- import { SidebarOrientation as v, SidebarPanel as y } from "@epam/ai-dial-sidebar";
5
- import { DIAL_ICON_SIZE as b, DIAL_KIT_ICON_STROKE as x, GhostIconButton as S, LinkButton as C, Spinner as w } from "@epam/ai-dial-ui-kit";
6
- import { IconAlertTriangle as T, IconCheck as E, IconCode as D, IconCopy as O, IconDownload as ee, IconEye as te, IconLock as ne, IconMarkdown as re, IconRefresh as ie } from "@tabler/icons-react";
7
- import { createContext as ae, lazy as k, memo as A, useCallback as j, useContext as M, useEffect as N, useMemo as P, useRef as F, useState as I } from "react";
1
+ import { a as e, i as t, n, r, t as i } from "./attachment-canvas-nvhW3tKV.js";
2
+ import { i as a, o, t as s } from "./LazyContentBoundary-CRXN6PG3.js";
3
+ import { AttachmentType as c, CodeBlockTheme as l, DEFAULT_MARKDOWN_CLASS_NAMES as u, FileExtension as d, MIMEType as f, MarkdownRenderer as p, buildCssVars as m, copyToClipboard as h, mergeClasses as g, restrainedSyntaxTheme as _, stripUrlQueryAndFragment as v } from "@epam/ai-dial-chat-shared";
4
+ import { SidebarOrientation as y, SidebarPanel as b } from "@epam/ai-dial-sidebar";
5
+ import { DIAL_ICON_SIZE as x, DIAL_KIT_ICON_STROKE as S, GhostIconButton as C, LinkButton as w, Spinner as T } from "@epam/ai-dial-ui-kit";
6
+ import { IconAlertTriangle as E, IconCheck as D, IconCode as O, IconCopy as k, IconDownload as ee, IconEye as te, IconLock as ne, IconMarkdown as re, IconRefresh as ie } from "@tabler/icons-react";
7
+ import { createContext as ae, lazy as A, memo as j, useCallback as M, useContext as N, useEffect as P, useMemo as F, useRef as I, useState as L } from "react";
8
8
  import { JsonView as oe, defaultStyles as se } from "react-json-view-lite";
9
- import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
10
- import { AppBridge as B, AppFrame as V } from "@mcp-ui/client";
11
- import { McpUiHostContextChangedNotificationSchema as ce } from "@modelcontextprotocol/ext-apps/app-bridge";
12
- import { VisualizerConnectorRequests as le } from "@epam/ai-dial-shared";
9
+ import { Fragment as ce, jsx as R, jsxs as z } from "react/jsx-runtime";
10
+ import { AppBridge as B, AppFrame as le } from "@mcp-ui/client";
11
+ import { McpUiHostContextChangedNotificationSchema as ue } from "@modelcontextprotocol/ext-apps/app-bridge";
12
+ import { VisualizerConnectorRequests as V } from "@epam/ai-dial-shared";
13
13
  import { VisualizerConnector as H } from "@epam/ai-dial-visualizer-connector";
14
- var U = {
14
+ var de = {
15
15
  container: "_container_1nhig_1",
16
16
  containerLight: "_containerLight_1nhig_5"
17
- }, ue = {
18
- [c.Dark]: g,
19
- [c.Light]: g
20
- }, de = () => k(async () => {
17
+ }, fe = {
18
+ [l.Dark]: _,
19
+ [l.Light]: _
20
+ }, pe = () => A(async () => {
21
21
  let { Prism: e } = await import("react-syntax-highlighter");
22
22
  return { default: e };
23
- }), fe = A(({ content: e, codeBlockTheme: t = c.Light, labels: n }) => {
24
- let { text: r, language: i } = e, a = i == null || i === "plaintext", s = ue[t], l = t === c.Light, [u, d] = I(0), f = P(de, [u]), p = j(() => {
23
+ }), me = j(({ content: e, codeBlockTheme: t = l.Light, labels: n }) => {
24
+ let { text: r, language: i } = e, a = i == null || i === "plaintext", o = fe[t], c = t === l.Light, [u, d] = L(0), f = F(pe, [u]), p = M(() => {
25
25
  d((e) => e + 1);
26
26
  }, []), m = /* @__PURE__ */ R("pre", {
27
27
  className: "whitespace-pre-wrap break-words p-4",
@@ -29,8 +29,8 @@ var U = {
29
29
  });
30
30
  return /* @__PURE__ */ R("div", {
31
31
  dir: "ltr",
32
- className: h("h-full overflow-auto", U.container, l && U.containerLight),
33
- children: a ? m : /* @__PURE__ */ R(o, {
32
+ className: g("h-full overflow-auto", de.container, c && de.containerLight),
33
+ children: a ? m : /* @__PURE__ */ R(s, {
34
34
  retryKey: u,
35
35
  onRetry: p,
36
36
  pendingContent: m,
@@ -38,7 +38,7 @@ var U = {
38
38
  labels: n,
39
39
  children: /* @__PURE__ */ R(f, {
40
40
  language: i,
41
- style: s,
41
+ style: o,
42
42
  customStyle: {
43
43
  margin: 0,
44
44
  borderRadius: 0,
@@ -53,23 +53,23 @@ var U = {
53
53
  })
54
54
  })
55
55
  });
56
- }), pe = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, me = A(({ content: e, labels: t, isSourceView: n, title: i, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
57
- let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = I(!0), [d, f] = I(!1), p = F(null);
58
- N(() => {
56
+ }), he = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ge = j(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
57
+ let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = L(!0), [d, f] = L(!1), p = I(null);
58
+ P(() => {
59
59
  u(!0), f(!1);
60
60
  }, [e]);
61
- let m = j((t) => {
61
+ let m = M((t) => {
62
62
  if (u(!1), e.srcdoc == null) try {
63
63
  p.current?.contentDocument ?? f(!0);
64
64
  } catch {
65
65
  f(!0);
66
66
  }
67
- }, [e.srcdoc]), g = j(() => {
67
+ }, [e.srcdoc]), h = M(() => {
68
68
  u(!1), f(!0);
69
69
  }, []);
70
- if (n && e.srcdoc != null) return /* @__PURE__ */ R(fe, {
70
+ if (n && e.srcdoc != null) return /* @__PURE__ */ R(me, {
71
71
  content: {
72
- type: r.Code,
72
+ type: i.Code,
73
73
  text: e.srcdoc,
74
74
  language: "html"
75
75
  },
@@ -80,11 +80,11 @@ var U = {
80
80
  children: [/* @__PURE__ */ R("p", {
81
81
  className: "text-center",
82
82
  children: s
83
- }), e.url != null && /* @__PURE__ */ R(C, {
83
+ }), e.url != null && /* @__PURE__ */ R(w, {
84
84
  href: e.url,
85
85
  target: "_blank",
86
86
  label: c,
87
- className: pe.openInNewTabButton,
87
+ className: he.openInNewTabButton,
88
88
  textClassName: o
89
89
  })]
90
90
  });
@@ -93,22 +93,22 @@ var U = {
93
93
  className: "relative h-full",
94
94
  children: [l && /* @__PURE__ */ R("div", {
95
95
  className: "absolute inset-0 flex items-center justify-center",
96
- children: /* @__PURE__ */ R(w, {})
96
+ children: /* @__PURE__ */ R(T, {})
97
97
  }), /* @__PURE__ */ R("iframe", {
98
98
  ref: p,
99
- title: i,
99
+ title: r,
100
100
  src: v,
101
101
  srcDoc: y,
102
102
  sandbox: _ ? "allow-scripts" : "allow-scripts allow-same-origin",
103
- className: h("h-full w-full border-none", l ? "invisible" : ""),
103
+ className: g("h-full w-full border-none", l ? "invisible" : ""),
104
104
  onLoad: m,
105
- onError: g
105
+ onError: h
106
106
  })]
107
107
  });
108
- }), he = {
108
+ }), _e = {
109
109
  name: "MCP-UI Host",
110
110
  version: "1.0.0"
111
- }, ge = { openLinks: {} }, _e = (e) => {
111
+ }, ve = { openLinks: {} }, U = (e) => {
112
112
  let t;
113
113
  try {
114
114
  t = new URL(e);
@@ -122,31 +122,31 @@ var U = {
122
122
  return !1;
123
123
  }
124
124
  return !0;
125
- }, W = (e, t, n) => {
125
+ }, ye = (e, t, n) => {
126
126
  if (n) {
127
127
  e.style.maxWidth = "", e.style.maxHeight = "";
128
128
  return;
129
129
  }
130
130
  let r = t;
131
131
  r != null && (r.width != null && (e.style.width = `${r.width}px`), r.maxWidth != null && (e.style.maxWidth = `${r.maxWidth}px`), r.height != null && (e.style.height = `${r.height}px`), r.maxHeight != null && (e.style.maxHeight = `${r.maxHeight}px`));
132
- }, ve = (e, t, n) => {
133
- let r = F(e);
134
- N(() => {
132
+ }, be = (e, t, n) => {
133
+ let r = I(e);
134
+ P(() => {
135
135
  r.current = e;
136
136
  });
137
- let [i, a] = I(null), [o, s] = I(!1);
138
- return N(() => {
137
+ let [i, a] = L(null), [o, s] = L(!1);
138
+ return P(() => {
139
139
  let e = null;
140
140
  try {
141
- e = new B(null, he, ge, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
141
+ e = new B(null, _e, ve, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
142
142
  let t = r.current.onOpenLink;
143
- return (t == null ? _e(e) : t(e)) === !1 ? { isError: !0 } : {};
143
+ return (t == null ? U(e) : t(e)) === !1 ? { isError: !0 } : {};
144
144
  }, e.onrequestdisplaymode = async ({ mode: e }) => {
145
145
  let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
146
146
  return { mode: t?.(e) ?? n };
147
- }, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(ce, ({ params: e }) => {
147
+ }, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(ue, ({ params: e }) => {
148
148
  let n = t.current?.querySelector("iframe");
149
- n != null && W(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
149
+ n != null && ye(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
150
150
  }), a(e);
151
151
  } catch (e) {
152
152
  console.error("[useMcpAppBridge] Error creating AppBridge:", e), s(!0);
@@ -154,20 +154,20 @@ var U = {
154
154
  return () => {
155
155
  e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
156
156
  };
157
- }, [t]), N(() => {
157
+ }, [t]), P(() => {
158
158
  i != null && n != null && i.setHostContext(n);
159
159
  }, [i, n]), {
160
160
  appBridge: i,
161
161
  hasFailed: o
162
162
  };
163
- }, G = {
163
+ }, W = {
164
164
  loadingOverlay: "_loadingOverlay_1aric_1",
165
165
  fullscreenFrame: "_fullscreenFrame_1aric_20",
166
166
  statusLabel: "_statusLabel_1aric_27",
167
167
  errorIcon: "_errorIcon_1aric_31"
168
- }, ye = ({ content: e, errorLabel: t = "Failed to load app" }) => {
169
- let [n, r] = I("loading"), { html: i, sandboxUrl: a, toolInput: o, toolResult: s, hostContext: c } = e, l = P(() => ({ url: new URL(a) }), [a]), u = c?.displayMode === "fullscreen", d = F(null), [f, p] = I();
170
- N(() => {
168
+ }, xe = ({ content: e, errorLabel: t = "Failed to load app" }) => {
169
+ let [n, r] = L("loading"), { html: i, sandboxUrl: a, toolInput: o, toolResult: s, hostContext: c } = e, l = F(() => ({ url: new URL(a) }), [a]), u = c?.displayMode === "fullscreen", d = I(null), [f, p] = L();
170
+ P(() => {
171
171
  let e = d.current;
172
172
  if (!e) return;
173
173
  let t = new ResizeObserver(([e]) => {
@@ -180,15 +180,15 @@ var U = {
180
180
  });
181
181
  return t.observe(e), () => t.disconnect();
182
182
  }, []);
183
- let { appBridge: m, hasFailed: g } = ve(e, d, P(() => c == null || f == null ? c : {
183
+ let { appBridge: m, hasFailed: h } = be(e, d, F(() => c == null || f == null ? c : {
184
184
  ...c,
185
185
  containerDimensions: f
186
- }, [c, f])), _ = g || n === "error";
186
+ }, [c, f])), _ = h || n === "error";
187
187
  return /* @__PURE__ */ z("div", {
188
188
  ref: d,
189
- className: h("relative h-full w-full", u && G.fullscreenFrame),
189
+ className: g("relative h-full w-full", u && W.fullscreenFrame),
190
190
  children: [
191
- m != null && /* @__PURE__ */ R(V, {
191
+ m != null && /* @__PURE__ */ R(le, {
192
192
  html: i,
193
193
  sandbox: l,
194
194
  appBridge: m,
@@ -199,25 +199,25 @@ var U = {
199
199
  onError: () => r("error")
200
200
  }),
201
201
  !_ && n === "loading" && /* @__PURE__ */ R("div", {
202
- className: h("absolute inset-0 flex flex-col items-center justify-center gap-2", G.loadingOverlay),
203
- children: /* @__PURE__ */ R(w, {})
202
+ className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", W.loadingOverlay),
203
+ children: /* @__PURE__ */ R(T, {})
204
204
  }),
205
205
  _ && /* @__PURE__ */ z("div", {
206
206
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
207
- children: [/* @__PURE__ */ R(T, {
207
+ children: [/* @__PURE__ */ R(E, {
208
208
  size: 60,
209
- stroke: x,
209
+ stroke: S,
210
210
  "aria-hidden": !0,
211
- className: G.errorIcon
211
+ className: W.errorIcon
212
212
  }), /* @__PURE__ */ R("p", {
213
213
  role: "alert",
214
- className: h("text-center", G.statusLabel),
214
+ className: g("text-center", W.statusLabel),
215
215
  children: t
216
216
  })]
217
217
  })
218
218
  ]
219
219
  });
220
- }, K = {
220
+ }, G = {
221
221
  viewer: "_viewer_1w97n_2",
222
222
  spreadsheetCanvas: "_spreadsheetCanvas_1w97n_6",
223
223
  formulaPanel: "_formulaPanel_1w97n_12",
@@ -225,64 +225,64 @@ var U = {
225
225
  statusOverlay: "_statusOverlay_1w97n_24",
226
226
  errorIcon: "_errorIcon_1w97n_29",
227
227
  highlight: "_highlight_1w97n_37"
228
- }, be = (e) => {
228
+ }, Se = (e) => {
229
229
  if (e?.kind !== "range") return "";
230
230
  let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
231
231
  if (n == null) return "";
232
232
  let r = n.formula;
233
233
  return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
234
- }, xe = async (e, t, { onError: r, onXlsxSelectionContextChange: i }) => {
234
+ }, Ce = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
235
235
  switch (t) {
236
- case n.Docx: {
237
- let [{ DocxScrollViewer: t }, { chartEx: n }] = await Promise.all([import("./docx-B9qBTEkj.js"), import("./chart-ex-B0DgG3Dt.js")]);
236
+ case r.Docx: {
237
+ let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("./docx-B-VcIRoc.js"), import("./chart-ex-DsESBs97.js")]);
238
238
  return new t(e, {
239
239
  enableTextSelection: !0,
240
240
  refitOnResize: !0,
241
- chartEx: n,
242
- onError: r
241
+ chartEx: r,
242
+ onError: n
243
243
  });
244
244
  }
245
- case n.Xlsx: {
246
- let [{ XlsxViewer: t }, { chartEx: n }] = await Promise.all([import("./xlsx-BAXMTJTG.js"), import("./chart-ex-B0DgG3Dt.js")]);
245
+ case r.Xlsx: {
246
+ let [{ XlsxViewer: t }, { chartEx: r }] = await Promise.all([import("./xlsx-Dn0XSlTO.js"), import("./chart-ex-DsESBs97.js")]);
247
247
  return new t(e, {
248
248
  showZoomSlider: !0,
249
- chartEx: n,
250
- onError: r,
249
+ chartEx: r,
250
+ onError: n,
251
251
  onSelectionContextChange: i
252
252
  });
253
253
  }
254
- case n.Csv: {
255
- let { XlsxSheetViewer: t } = await import("./xlsx-BAXMTJTG.js"), n = document.createElement("canvas");
256
- n.className = K.spreadsheetCanvas, e.replaceChildren(n);
257
- let i = new t(n, {
254
+ case r.Csv: {
255
+ let { XlsxSheetViewer: t } = await import("./xlsx-Dn0XSlTO.js"), r = document.createElement("canvas");
256
+ r.className = G.spreadsheetCanvas, e.replaceChildren(r);
257
+ let i = new t(r, {
258
258
  showScrollbars: !0,
259
- onError: r
259
+ onError: n
260
260
  });
261
261
  return {
262
262
  load: (e) => i.load(e, { format: "csv" }),
263
263
  destroy: () => i.destroy()
264
264
  };
265
265
  }
266
- case n.Pptx: {
267
- let [{ PptxScrollViewer: t }, { chartEx: n }] = await Promise.all([import("./pptx-dkJw0-Vx.js"), import("./chart-ex-B0DgG3Dt.js")]);
266
+ case r.Pptx: {
267
+ let [{ PptxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("./pptx-CnoDB8Fv.js"), import("./chart-ex-DsESBs97.js")]);
268
268
  return new t(e, {
269
269
  enableTextSelection: !0,
270
270
  refitOnResize: !0,
271
- chartEx: n,
272
- onError: r
271
+ chartEx: r,
272
+ onError: n
273
273
  });
274
274
  }
275
275
  }
276
- }, Se = async (e, t, r, i) => {
277
- let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = r;
276
+ }, we = async (e, t, n, i) => {
277
+ let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = n;
278
278
  switch (t.format) {
279
- case n.Docx: {
279
+ case r.Docx: {
280
280
  let [{ DocxDocument: n, DocxScrollViewer: r }, { chartEx: o }, { createDocxHighlightSurface: c }] = await Promise.all([
281
- import("./docx-B9qBTEkj.js"),
282
- import("./chart-ex-B0DgG3Dt.js"),
283
- import("./ooxml-highlight-surfaces-DhK1KJcR.js")
281
+ import("./docx-B-VcIRoc.js"),
282
+ import("./chart-ex-DsESBs97.js"),
283
+ import("./ooxml-highlight-surfaces-CaMjx8u-.js")
284
284
  ]), l = await n.load(t.url, { chartEx: o });
285
- if (i()) throw l.destroy(), new Ce();
285
+ if (i()) throw l.destroy(), new Te();
286
286
  let u = r.fromDocument(e, l, {
287
287
  enableTextSelection: !0,
288
288
  refitOnResize: !0,
@@ -296,13 +296,13 @@ var U = {
296
296
  highlights: c(e, l, u, i)
297
297
  };
298
298
  }
299
- case n.Pptx: {
299
+ case r.Pptx: {
300
300
  let [{ PptxPresentation: n, PptxScrollViewer: r }, { chartEx: o }, { createPptxHighlightSurface: c }] = await Promise.all([
301
- import("./pptx-dkJw0-Vx.js"),
302
- import("./chart-ex-B0DgG3Dt.js"),
303
- import("./ooxml-highlight-surfaces-DhK1KJcR.js")
301
+ import("./pptx-CnoDB8Fv.js"),
302
+ import("./chart-ex-DsESBs97.js"),
303
+ import("./ooxml-highlight-surfaces-CaMjx8u-.js")
304
304
  ]), l = await n.load(t.url, { chartEx: o });
305
- if (i()) throw l.destroy(), new Ce();
305
+ if (i()) throw l.destroy(), new Te();
306
306
  let u = r.fromPresentation(e, l, {
307
307
  enableTextSelection: !0,
308
308
  refitOnResize: !0,
@@ -316,11 +316,11 @@ var U = {
316
316
  highlights: c(e, l, u, i)
317
317
  };
318
318
  }
319
- case n.Xlsx: {
319
+ case r.Xlsx: {
320
320
  let [{ XlsxViewer: n }, { chartEx: r }, { createXlsxHighlightSurface: c }] = await Promise.all([
321
- import("./xlsx-BAXMTJTG.js"),
322
- import("./chart-ex-B0DgG3Dt.js"),
323
- import("./ooxml-highlight-surfaces-DhK1KJcR.js")
321
+ import("./xlsx-Dn0XSlTO.js"),
322
+ import("./chart-ex-DsESBs97.js"),
323
+ import("./ooxml-highlight-surfaces-CaMjx8u-.js")
324
324
  ]), l = new n(e, {
325
325
  showZoomSlider: !0,
326
326
  chartEx: r,
@@ -335,125 +335,125 @@ var U = {
335
335
  highlights: c(e, l, i)
336
336
  };
337
337
  }
338
- case n.Csv: {
339
- let n = await xe(e, t.format, r);
340
- return await n.load(t.url), { viewer: n };
338
+ case r.Csv: {
339
+ let r = await Ce(e, t.format, n);
340
+ return await r.load(t.url), { viewer: r };
341
341
  }
342
342
  }
343
- }, Ce = class extends Error {}, we = ({ content: e, fileName: t, loadErrorLabel: r, formulaLabel: i, formulaLabelClassName: a, highlightsLabel: o = "Cited locations", highlightNavigatedLabel: s = "Scrolled to the cited location" }) => {
344
- let c = F(null), [l, u] = I(!0), [d, f] = I(!1), [p, m] = I(""), [g, _] = I([]), [v, y] = I(!1), { highlights: b, selectedHighlightId: S } = e, C = b != null && b.length > 0, E = F(void 0), D = F(b);
345
- D.current = b;
346
- let O = F(void 0);
347
- return N(() => {
348
- let t = c.current;
349
- if (t == null) return;
350
- let n, r = !1, i, a = () => r;
351
- u(!0), f(!1), m(""), _([]), y(!1);
352
- let o = () => {
353
- r || i != null || (i = requestAnimationFrame(() => {
354
- i = void 0, s();
343
+ }, Te = class extends Error {}, Ee = ({ content: t, fileName: n, loadErrorLabel: i, formulaLabel: a, formulaLabelClassName: o, highlightsLabel: s = "Cited locations", highlightNavigatedLabel: c = "Scrolled to the cited location" }) => {
344
+ let l = I(null), [u, d] = L(!0), [f, p] = L(!1), [m, h] = L(""), [_, v] = L([]), [y, b] = L(!1), { highlights: x, selectedHighlightId: C } = t, w = x != null && x.length > 0, D = I(void 0), O = I(x);
345
+ O.current = x;
346
+ let k = I(void 0);
347
+ return P(() => {
348
+ let e = l.current;
349
+ if (e == null) return;
350
+ let n, r, i = !1, a, o = () => i;
351
+ d(!0), p(!1), h(""), v([]), b(!1);
352
+ let s = () => {
353
+ i || a != null || (a = requestAnimationFrame(() => {
354
+ a = void 0, c();
355
355
  }));
356
- }, s = async () => {
357
- let e = n?.highlights, t = D.current;
358
- if (!(r || e == null || t == null)) try {
356
+ }, c = async () => {
357
+ let e = n?.highlights, t = O.current;
358
+ if (!(i || e == null || t == null)) try {
359
359
  let n = await e.measure(t);
360
- r || _(n);
360
+ i || v(n);
361
361
  } catch {
362
- r || _([]);
362
+ i || v([]);
363
363
  }
364
- }, l = {
364
+ }, u = {
365
365
  onError: () => {
366
- r || (u(!1), f(!0));
366
+ i || (d(!1), p(!0));
367
367
  },
368
368
  onXlsxSelectionContextChange: (e) => {
369
- r || m(be(e));
369
+ i || h(Se(e));
370
370
  },
371
- onGeometryInvalidated: o
371
+ onGeometryInvalidated: s
372
+ }, f = () => {
373
+ i || (r = new ResizeObserver(s), r.observe(e));
372
374
  };
373
- return t.addEventListener("scroll", o, !0), O.current = o, (async () => {
375
+ return e.addEventListener("scroll", s, !0), k.current = s, (async () => {
374
376
  try {
375
- if (C) {
376
- let i = await Se(t, e, l, a);
377
- if (r) {
378
- i.viewer.destroy(), i.engine?.destroy();
377
+ if (w) {
378
+ let r = await we(e, t, u, o);
379
+ if (i) {
380
+ r.viewer.destroy(), r.engine?.destroy();
379
381
  return;
380
382
  }
381
- n = i, E.current = i.highlights;
383
+ n = r, D.current = r.highlights, f();
382
384
  } else {
383
- let i = await xe(t, e.format, l);
384
- if (r) {
385
- i.destroy();
385
+ let r = await Ce(e, t.format, u);
386
+ if (i) {
387
+ r.destroy();
386
388
  return;
387
389
  }
388
- n = { viewer: i }, E.current = void 0, await i.load(e.url);
390
+ n = { viewer: r }, D.current = void 0, f(), await r.load(t.url);
389
391
  }
390
- if (r) return;
391
- u(!1), await s();
392
- } catch (e) {
393
- if (e instanceof Ce || r) return;
394
- n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, E.current = void 0, t.replaceChildren(), u(!1), f(!0);
392
+ if (i) return;
393
+ d(!1), await c();
394
+ } catch (t) {
395
+ if (t instanceof Te || i) return;
396
+ n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, D.current = void 0, e.replaceChildren(), d(!1), p(!0);
395
397
  }
396
398
  })(), () => {
397
- r = !0, t.removeEventListener("scroll", o, !0), i != null && cancelAnimationFrame(i), O.current = void 0, n?.viewer.destroy(), n?.engine?.destroy(), E.current = void 0, t.replaceChildren();
399
+ i = !0, e.removeEventListener("scroll", s, !0), a != null && cancelAnimationFrame(a), k.current = void 0, r?.disconnect(), n?.viewer.destroy(), n?.engine?.destroy(), D.current = void 0, e.replaceChildren();
398
400
  };
399
401
  }, [
400
- e.format,
401
- e.url,
402
- C
403
- ]), N(() => {
404
- O.current?.();
405
- }, [b]), N(() => {
406
- let e = E.current;
407
- if (e == null || l) return;
408
- let t = (b?.find(({ id: e }) => e === S))?.locations.at(0);
409
- if (t == null) return;
410
- let n = !1;
402
+ t.format,
403
+ t.url,
404
+ w
405
+ ]), P(() => {
406
+ k.current?.();
407
+ }, [x]), P(() => {
408
+ b(!1);
409
+ let t = D.current;
410
+ if (t == null || u) return;
411
+ let n = (O.current?.find(({ id: e }) => e === C))?.locations.at(0);
412
+ if (n == null) return;
413
+ let r = !1;
411
414
  return (async () => {
415
+ let i;
412
416
  try {
413
- await e.navigate(t);
417
+ i = await t.navigate(n);
414
418
  } catch {
415
419
  return;
416
420
  }
417
- n || y(!0);
421
+ r || i !== e.Navigated || b(!0);
418
422
  })(), () => {
419
- n = !0;
423
+ r = !0;
420
424
  };
421
- }, [
422
- b,
423
- S,
424
- l
425
- ]), /* @__PURE__ */ z("div", {
425
+ }, [C, u]), /* @__PURE__ */ z("div", {
426
426
  className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
427
427
  children: [
428
- e.format === n.Xlsx && /* @__PURE__ */ z("div", {
428
+ t.format === r.Xlsx && /* @__PURE__ */ z("div", {
429
429
  role: "region",
430
- "aria-label": i,
431
- className: h("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", K.formulaPanel),
430
+ "aria-label": a,
431
+ className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", G.formulaPanel),
432
432
  children: [/* @__PURE__ */ R("span", {
433
433
  "aria-hidden": "true",
434
- className: h("shrink-0", a),
434
+ className: g("shrink-0", o),
435
435
  children: "fx"
436
436
  }), /* @__PURE__ */ R("code", {
437
437
  dir: "ltr",
438
438
  tabIndex: 0,
439
439
  "aria-live": "polite",
440
- className: h("h-8 min-w-0 flex-1 overflow-x-auto whitespace-nowrap rounded border px-2 py-1 text-sm focus-visible:outline focus-visible:outline-focus", K.formulaValue),
441
- children: p
440
+ className: g("h-8 min-w-0 flex-1 overflow-x-auto whitespace-nowrap rounded border px-2 py-1 text-sm focus-visible:outline focus-visible:outline-focus", G.formulaValue),
441
+ children: m
442
442
  })]
443
443
  }),
444
444
  /* @__PURE__ */ z("div", {
445
445
  className: "relative min-h-0 w-full flex-1",
446
446
  children: [/* @__PURE__ */ R("div", {
447
- ref: c,
447
+ ref: l,
448
448
  role: "document",
449
- "aria-label": t,
450
- "aria-busy": l,
451
- className: h("h-full w-full overflow-hidden", K.viewer)
452
- }), g.length > 0 && /* @__PURE__ */ R("div", {
449
+ "aria-label": n,
450
+ "aria-busy": u,
451
+ className: g("h-full w-full overflow-hidden", G.viewer)
452
+ }), _.length > 0 && /* @__PURE__ */ R("div", {
453
453
  role: "region",
454
- "aria-label": o,
454
+ "aria-label": s,
455
455
  className: "pointer-events-none absolute inset-0 overflow-hidden",
456
- children: g.map((e, t) => /* @__PURE__ */ R("div", {
456
+ children: _.map((e, t) => /* @__PURE__ */ R("div", {
457
457
  "aria-hidden": "true",
458
458
  style: {
459
459
  left: `${e.left}px`,
@@ -461,9 +461,9 @@ var U = {
461
461
  width: `${e.width}px`,
462
462
  height: `${e.height}px`
463
463
  },
464
- "data-selected": e.highlightId === S,
464
+ "data-selected": e.highlightId === C,
465
465
  "data-clipped": e.isClippedAtEnd === !0,
466
- className: h("absolute", K.highlight)
466
+ className: g("absolute", G.highlight)
467
467
  }, `${e.highlightId}-${t}`))
468
468
  })]
469
469
  }),
@@ -471,34 +471,34 @@ var U = {
471
471
  role: "status",
472
472
  "aria-live": "polite",
473
473
  className: "sr-only",
474
- children: v ? s : ""
474
+ children: y ? c : ""
475
475
  }),
476
- (l || d) && /* @__PURE__ */ R("div", {
477
- role: d ? "alert" : void 0,
476
+ (u || f) && /* @__PURE__ */ R("div", {
477
+ role: f ? "alert" : void 0,
478
478
  "aria-live": "polite",
479
- className: h("absolute inset-0 flex items-center justify-center", K.statusOverlay),
480
- children: l ? /* @__PURE__ */ R(w, { size: 48 }) : /* @__PURE__ */ z("div", {
479
+ className: g("absolute inset-0 flex items-center justify-center", G.statusOverlay),
480
+ children: u ? /* @__PURE__ */ R(T, { size: 48 }) : /* @__PURE__ */ z("div", {
481
481
  className: "flex flex-col items-center gap-2",
482
- children: [/* @__PURE__ */ R(T, {
482
+ children: [/* @__PURE__ */ R(E, {
483
483
  "aria-hidden": "true",
484
484
  size: 60,
485
- stroke: x,
486
- className: K.errorIcon
485
+ stroke: S,
486
+ className: G.errorIcon
487
487
  }), /* @__PURE__ */ R("p", {
488
488
  className: "text-center",
489
- children: r
489
+ children: i
490
490
  })]
491
491
  })
492
492
  })
493
493
  ]
494
494
  });
495
- }, Te = {
495
+ }, De = {
496
496
  loadingOverlay: "_loadingOverlay_12637_1",
497
497
  statusLabel: "_statusLabel_12637_5",
498
498
  errorIcon: "_errorIcon_12637_9"
499
- }, Ee = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
500
- let i = F(null), [a, o] = I("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = F(e);
501
- return u.current = e, N(() => {
499
+ }, Oe = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
500
+ let i = I(null), [a, o] = L("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = I(e);
501
+ return u.current = e, P(() => {
502
502
  let e = i.current;
503
503
  if (!e) return;
504
504
  o("loading");
@@ -514,7 +514,7 @@ var U = {
514
514
  layout: r,
515
515
  ...typeof i == "object" && i ? i : {}
516
516
  };
517
- await t.send(le.sendVisualizeData, {
517
+ await t.send(V.sendVisualizeData, {
518
518
  mimeType: e,
519
519
  visualizerData: a
520
520
  }), n && o("ready");
@@ -529,7 +529,7 @@ var U = {
529
529
  l
530
530
  ]), /* @__PURE__ */ z("div", {
531
531
  className: "relative h-full w-full",
532
- style: p({
532
+ style: m({
533
533
  "--vs-loading-bg": r?.loadingBackground,
534
534
  "--vs-status-text": r?.statusText,
535
535
  "--vs-error-icon": r?.errorIcon
@@ -540,28 +540,28 @@ var U = {
540
540
  className: "h-full w-full"
541
541
  }),
542
542
  a === "loading" && /* @__PURE__ */ z("div", {
543
- className: h("absolute inset-0 flex flex-col items-center justify-center gap-2", Te.loadingOverlay),
544
- children: [/* @__PURE__ */ R(w, {}), t && /* @__PURE__ */ R("p", {
545
- className: h("text-center", Te.statusLabel),
543
+ className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", De.loadingOverlay),
544
+ children: [/* @__PURE__ */ R(T, {}), t && /* @__PURE__ */ R("p", {
545
+ className: g("text-center", De.statusLabel),
546
546
  children: t
547
547
  })]
548
548
  }),
549
549
  a === "error" && /* @__PURE__ */ z("div", {
550
550
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
551
- children: [/* @__PURE__ */ R(T, {
551
+ children: [/* @__PURE__ */ R(E, {
552
552
  size: 60,
553
- stroke: x,
553
+ stroke: S,
554
554
  "aria-hidden": !0,
555
- className: Te.errorIcon
555
+ className: De.errorIcon
556
556
  }), /* @__PURE__ */ R("p", {
557
557
  role: "alert",
558
- className: h("text-center", Te.statusLabel),
558
+ className: g("text-center", De.statusLabel),
559
559
  children: n
560
560
  })]
561
561
  })
562
562
  ]
563
563
  });
564
- }, q = {
564
+ }, K = {
565
565
  body: "_body_13ogb_4",
566
566
  statusLabel: "_statusLabel_13ogb_13",
567
567
  errorIcon: "_errorIcon_13ogb_17",
@@ -576,18 +576,18 @@ var U = {
576
576
  jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
577
577
  jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
578
578
  jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
579
- }, De = () => k(async () => ({ default: (await import("./PdfContent-DhfjgYL-.js")).PdfContent })), Oe = ({ url: e, fileName: t, loadErrorLabel: n }) => {
580
- let [r, i] = I(!1);
581
- return N(() => {
579
+ }, ke = () => A(async () => ({ default: (await import("./PdfContent-D71LPAe3.js")).PdfContent })), Ae = ({ url: e, fileName: t, loadErrorLabel: n }) => {
580
+ let [r, i] = L(!1);
581
+ return P(() => {
582
582
  i(!1);
583
583
  }, [e]), r ? /* @__PURE__ */ z("div", {
584
584
  className: "flex flex-col items-center gap-2",
585
- children: [/* @__PURE__ */ R(T, {
585
+ children: [/* @__PURE__ */ R(E, {
586
586
  size: 60,
587
- stroke: x,
588
- className: q.errorIcon
587
+ stroke: S,
588
+ className: K.errorIcon
589
589
  }), /* @__PURE__ */ R("p", {
590
- className: h("text-center", q.statusLabel),
590
+ className: g("text-center", K.statusLabel),
591
591
  children: n
592
592
  })]
593
593
  }) : /* @__PURE__ */ R("img", {
@@ -596,77 +596,77 @@ var U = {
596
596
  className: "max-h-full max-w-full object-contain",
597
597
  onError: () => i(!0)
598
598
  });
599
- }, ke = new Set([
600
- r.PlainText,
601
- r.Code,
602
- r.Ooxml
603
- ]), Ae = A(({ content: e, isLoading: n = !1, fileName: i, isHtmlSourceView: a = !1, labels: { unsupportedLabel: s = "Preview is not supported for this file", loadErrorLabel: c = "Failed to load file", forbiddenErrorLabel: u = "You don't have permission to access this file", visualizerErrorLabel: d, htmlFrameBlockedLabel: m = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: g = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: S, pdfContentErrorLabel: C, pdfContentRetryLabel: E, xlsxFormulaLabel: D = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: ee, codeContentRetryLabel: te, tableCopyCsvLabel: re, tableCopyTxtLabel: ie, tableCopyMarkdownLabel: ae, tableCopiedLabel: k, tableDownloadCsvLabel: A, ooxmlHighlightsLabel: M, ooxmlHighlightNavigatedLabel: N } = {}, styles: F, codeBlockTheme: L, tableDownloadFilename: B, loadPdf: V, hidePdfToolbar: ce = !1, configurePdfWorker: le }) => {
604
- let { colors: H, typography: U, bodyClassName: ue, cssVars: de } = F ?? {}, [pe, he] = I(0), ge = P(De, [pe]), _e = j(() => {
599
+ }, je = new Set([
600
+ i.PlainText,
601
+ i.Code,
602
+ i.Ooxml
603
+ ]), Me = j(({ content: e, isLoading: t = !1, fileName: r, isHtmlSourceView: a = !1, labels: { unsupportedLabel: o = "Preview is not supported for this file", loadErrorLabel: c = "Failed to load file", forbiddenErrorLabel: l = "You don't have permission to access this file", visualizerErrorLabel: d, htmlFrameBlockedLabel: f = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: h = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: C, pdfContentRetryLabel: w, xlsxFormulaLabel: D = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: k, codeContentRetryLabel: ee, tableCopyCsvLabel: te, tableCopyTxtLabel: re, tableCopyMarkdownLabel: ie, tableCopiedLabel: ae, tableDownloadCsvLabel: A, ooxmlHighlightsLabel: j, ooxmlHighlightNavigatedLabel: N } = {}, styles: P, codeBlockTheme: I, tableDownloadFilename: ce, loadPdf: B, hidePdfToolbar: le = !1, configurePdfWorker: ue }) => {
604
+ let { colors: V, typography: H, bodyClassName: de, cssVars: fe } = P ?? {}, [pe, he] = L(0), _e = F(ke, [pe]), ve = M(() => {
605
605
  he((e) => e + 1);
606
- }, []), W = U?.fontClassName != null, ve = P(() => ({
607
- ...p({
608
- "--ac-text": H?.text,
609
- "--ac-status-text": H?.statusText,
610
- "--ac-error-icon": H?.errorIcon,
611
- "--ac-open-in-new-tab-text": H?.openInNewTabText,
612
- "--ac-json-border": H?.jsonBorder,
613
- "--ac-json-bg": H?.jsonBackground,
614
- "--ac-json-label": H?.jsonLabel,
615
- "--ac-json-clickable-label": H?.jsonClickableLabel,
616
- "--ac-json-punctuation": H?.jsonPunctuation,
617
- "--ac-json-string": H?.jsonString,
618
- "--ac-json-number": H?.jsonNumber,
619
- "--ac-json-boolean": H?.jsonBoolean,
620
- "--ac-json-null": H?.jsonNull,
621
- "--ac-json-toggle-icon": H?.jsonToggleIcon,
622
- "--ac-json-toggle-icon-hover": H?.jsonToggleIconHover,
623
- "--ac-ooxml-bg": H?.ooxmlBackground,
624
- "--ac-ooxml-formula-border": H?.ooxmlFormulaBorder,
625
- "--ac-ooxml-formula-bg": H?.ooxmlFormulaBackground,
626
- "--ac-ooxml-formula-text": H?.ooxmlFormulaText,
627
- "--ac-ooxml-highlight-border": H?.ooxmlHighlightBorder,
628
- "--ac-ooxml-highlight-bg": H?.ooxmlHighlightBackground,
629
- "--ac-json-collapsed-text": H?.jsonCollapsedText,
630
- "--ac-json-collapsed-bg": H?.jsonCollapsedBackground,
631
- "--ac-font-family": W ? void 0 : U?.fontFamily,
632
- "--ac-font-size": W ? void 0 : U?.fontSize,
633
- "--ac-font-weight": W ? void 0 : U?.fontWeight,
634
- "--ac-line-height": W ? void 0 : U?.lineHeight,
635
- "--ac-letter-spacing": W ? void 0 : U?.letterSpacing
606
+ }, []), U = H?.fontClassName != null, ye = F(() => ({
607
+ ...m({
608
+ "--ac-text": V?.text,
609
+ "--ac-status-text": V?.statusText,
610
+ "--ac-error-icon": V?.errorIcon,
611
+ "--ac-open-in-new-tab-text": V?.openInNewTabText,
612
+ "--ac-json-border": V?.jsonBorder,
613
+ "--ac-json-bg": V?.jsonBackground,
614
+ "--ac-json-label": V?.jsonLabel,
615
+ "--ac-json-clickable-label": V?.jsonClickableLabel,
616
+ "--ac-json-punctuation": V?.jsonPunctuation,
617
+ "--ac-json-string": V?.jsonString,
618
+ "--ac-json-number": V?.jsonNumber,
619
+ "--ac-json-boolean": V?.jsonBoolean,
620
+ "--ac-json-null": V?.jsonNull,
621
+ "--ac-json-toggle-icon": V?.jsonToggleIcon,
622
+ "--ac-json-toggle-icon-hover": V?.jsonToggleIconHover,
623
+ "--ac-ooxml-bg": V?.ooxmlBackground,
624
+ "--ac-ooxml-formula-border": V?.ooxmlFormulaBorder,
625
+ "--ac-ooxml-formula-bg": V?.ooxmlFormulaBackground,
626
+ "--ac-ooxml-formula-text": V?.ooxmlFormulaText,
627
+ "--ac-ooxml-highlight-border": V?.ooxmlHighlightBorder,
628
+ "--ac-ooxml-highlight-bg": V?.ooxmlHighlightBackground,
629
+ "--ac-json-collapsed-text": V?.jsonCollapsedText,
630
+ "--ac-json-collapsed-bg": V?.jsonCollapsedBackground,
631
+ "--ac-font-family": U ? void 0 : H?.fontFamily,
632
+ "--ac-font-size": U ? void 0 : H?.fontSize,
633
+ "--ac-font-weight": U ? void 0 : H?.fontWeight,
634
+ "--ac-line-height": U ? void 0 : H?.lineHeight,
635
+ "--ac-letter-spacing": U ? void 0 : H?.letterSpacing
636
636
  }),
637
- ...de
638
- }), [F]), G = P(() => {
637
+ ...fe
638
+ }), [P]), be = F(() => {
639
639
  switch (e.type) {
640
- case r.Image:
641
- case r.Audio:
642
- case r.Unsupported:
643
- case r.Error: return "h-full overflow-auto p-4 flex items-center justify-center";
644
- case r.Json: return "h-full overflow-auto";
645
- case r.Pdf:
646
- case r.Ooxml:
647
- case r.Visualizer:
648
- case r.McpApp:
649
- case r.Code:
650
- case r.Html: return "h-full overflow-hidden";
651
- case r.Markdown: return "h-full overflow-auto p-4";
652
- case r.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
640
+ case i.Image:
641
+ case i.Audio:
642
+ case i.Unsupported:
643
+ case i.Error: return "h-full overflow-auto p-4 flex items-center justify-center";
644
+ case i.Json: return "h-full overflow-auto";
645
+ case i.Pdf:
646
+ case i.Ooxml:
647
+ case i.Visualizer:
648
+ case i.McpApp:
649
+ case i.Code:
650
+ case i.Html: return "h-full overflow-hidden";
651
+ case i.Markdown: return "h-full overflow-auto p-4";
652
+ case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
653
653
  default: return "h-full overflow-auto p-4";
654
654
  }
655
- }, [e.type]), K = P(() => {
655
+ }, [e.type]), W = F(() => {
656
656
  switch (e.type) {
657
- case r.PlainText: return /* @__PURE__ */ R("pre", {
658
- className: h("whitespace-pre-wrap break-words", q.body, U?.fontClassName),
657
+ case i.PlainText: return /* @__PURE__ */ R("pre", {
658
+ className: g("whitespace-pre-wrap break-words", K.body, H?.fontClassName),
659
659
  children: e.text
660
660
  });
661
- case r.Image: return /* @__PURE__ */ R(Oe, {
661
+ case i.Image: return /* @__PURE__ */ R(Ae, {
662
662
  url: e.url,
663
- fileName: i,
663
+ fileName: r,
664
664
  loadErrorLabel: c
665
665
  });
666
- case r.Audio: return /* @__PURE__ */ R("audio", {
666
+ case i.Audio: return /* @__PURE__ */ R("audio", {
667
667
  controls: !0,
668
668
  src: e.url,
669
- "aria-label": i ?? "Audio attachment",
669
+ "aria-label": r ?? "Audio attachment",
670
670
  className: "w-full max-w-sm",
671
671
  preload: "metadata",
672
672
  children: e.mimeType && /* @__PURE__ */ R("source", {
@@ -674,342 +674,342 @@ var U = {
674
674
  type: e.mimeType
675
675
  })
676
676
  });
677
- case r.Markdown: return /* @__PURE__ */ R(f, {
677
+ case i.Markdown: return /* @__PURE__ */ R(p, {
678
678
  content: e.text,
679
679
  isStreaming: !1,
680
- codeBlockTheme: L,
681
- classNames: l
680
+ codeBlockTheme: I,
681
+ classNames: u
682
682
  });
683
- case r.MarkdownTable: return /* @__PURE__ */ R(f, {
683
+ case i.MarkdownTable: return /* @__PURE__ */ R(p, {
684
684
  content: e.text,
685
685
  isStreaming: !1,
686
- codeBlockTheme: L,
686
+ codeBlockTheme: I,
687
687
  containerClassName: "flex h-full min-h-0 flex-col",
688
688
  classNames: {
689
- ...l,
689
+ ...u,
690
690
  tableWrapper: "my-0 max-h-full",
691
691
  tableScrollContainer: "max-h-full"
692
692
  },
693
693
  tableActionLabels: {
694
- copyCsvLabel: re,
695
- copyTxtLabel: ie,
696
- copyMarkdownLabel: ae,
697
- copiedLabel: k,
694
+ copyCsvLabel: te,
695
+ copyTxtLabel: re,
696
+ copyMarkdownLabel: ie,
697
+ copiedLabel: ae,
698
698
  downloadCsvLabel: A
699
699
  },
700
- tableDownloadFilename: B
700
+ tableDownloadFilename: ce
701
701
  });
702
- case r.Json: return /* @__PURE__ */ R("div", {
702
+ case i.Json: return /* @__PURE__ */ R("div", {
703
703
  dir: "ltr",
704
704
  className: "h-full overflow-auto",
705
705
  children: /* @__PURE__ */ R("div", {
706
- className: h("m-3 overflow-auto rounded-md border", q.jsonWrapper),
706
+ className: g("m-3 overflow-auto rounded-md border", K.jsonWrapper),
707
707
  children: /* @__PURE__ */ R(oe, {
708
708
  data: e.value,
709
709
  style: {
710
- container: h("whitespace-pre-wrap break-words p-2", U?.jsonClassName ?? "dial-code-text"),
710
+ container: g("whitespace-pre-wrap break-words p-2", H?.jsonClassName ?? "dial-code-text"),
711
711
  basicChildStyle: se.basicChildStyle,
712
712
  childFieldsContainer: "m-0 ps-3",
713
- label: h("me-1 font-semibold", q.jsonLabel),
714
- clickableLabel: h("me-1 cursor-pointer font-semibold hover:underline", q.jsonClickableLabel),
715
- nullValue: h("italic", q.jsonNullValue),
716
- undefinedValue: h("italic", q.jsonNullValue),
717
- stringValue: q.jsonStringValue,
718
- booleanValue: q.jsonBooleanValue,
719
- numberValue: q.jsonNumberValue,
720
- otherValue: h("italic", q.jsonNullValue),
721
- punctuation: h("me-1", q.jsonPunctuation),
722
- collapseIcon: h("me-1 cursor-pointer select-none transition-colors", q.jsonCollapseIcon),
723
- expandIcon: h("me-1 cursor-pointer select-none transition-colors", q.jsonExpandIcon),
724
- collapsedContent: h("me-1 cursor-pointer rounded px-1", q.jsonCollapsedContent)
713
+ label: g("me-1 font-semibold", K.jsonLabel),
714
+ clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", K.jsonClickableLabel),
715
+ nullValue: g("italic", K.jsonNullValue),
716
+ undefinedValue: g("italic", K.jsonNullValue),
717
+ stringValue: K.jsonStringValue,
718
+ booleanValue: K.jsonBooleanValue,
719
+ numberValue: K.jsonNumberValue,
720
+ otherValue: g("italic", K.jsonNullValue),
721
+ punctuation: g("me-1", K.jsonPunctuation),
722
+ collapseIcon: g("me-1 cursor-pointer select-none transition-colors", K.jsonCollapseIcon),
723
+ expandIcon: g("me-1 cursor-pointer select-none transition-colors", K.jsonExpandIcon),
724
+ collapsedContent: g("me-1 cursor-pointer rounded px-1", K.jsonCollapsedContent)
725
725
  }
726
726
  })
727
727
  })
728
728
  });
729
- case r.Code: return /* @__PURE__ */ R(fe, {
729
+ case i.Code: return /* @__PURE__ */ R(me, {
730
730
  content: e,
731
- codeBlockTheme: L,
731
+ codeBlockTheme: I,
732
732
  labels: {
733
733
  loadingLabel: O,
734
- errorLabel: ee,
735
- retryLabel: te
734
+ errorLabel: k,
735
+ retryLabel: ee
736
736
  }
737
737
  });
738
- case r.Html: return /* @__PURE__ */ R(me, {
738
+ case i.Html: return /* @__PURE__ */ R(ge, {
739
739
  content: e,
740
740
  labels: {
741
- htmlFrameBlockedLabel: m,
742
- htmlOpenInNewTabLabel: g
741
+ htmlFrameBlockedLabel: f,
742
+ htmlOpenInNewTabLabel: h
743
743
  },
744
744
  isSourceView: a,
745
- title: i,
746
- codeBlockTheme: L
745
+ title: r,
746
+ codeBlockTheme: I
747
747
  });
748
- case r.Pdf: return /* @__PURE__ */ R(o, {
748
+ case i.Pdf: return /* @__PURE__ */ R(s, {
749
749
  retryKey: pe,
750
- onRetry: _e,
750
+ onRetry: ve,
751
751
  labels: {
752
- loadingLabel: S,
752
+ loadingLabel: x,
753
753
  errorLabel: C,
754
- retryLabel: E
754
+ retryLabel: w
755
755
  },
756
- children: /* @__PURE__ */ R(ge, {
757
- fileName: i,
756
+ children: /* @__PURE__ */ R(_e, {
757
+ fileName: r,
758
758
  url: e.url,
759
759
  highlights: e.highlights ?? [],
760
760
  selectedHighlightId: e.selectedHighlightId,
761
761
  selectedPageNumber: e.page,
762
- loadPdf: V,
763
- hideHeader: ce,
764
- configurePdfWorker: le,
762
+ loadPdf: B,
763
+ hideHeader: le,
764
+ configurePdfWorker: ue,
765
765
  labels: {
766
766
  thumbnailsLabel: _,
767
767
  showThumbnailsLabel: v,
768
768
  hideThumbnailsLabel: y,
769
769
  pageNumberLabel: b,
770
- loadingLabel: S,
770
+ loadingLabel: x,
771
771
  errorLabel: C,
772
- retryLabel: E
772
+ retryLabel: w
773
773
  }
774
774
  })
775
775
  }, e.url);
776
- case r.Ooxml: return /* @__PURE__ */ R(we, {
776
+ case i.Ooxml: return /* @__PURE__ */ R(Ee, {
777
777
  content: e,
778
- fileName: i,
778
+ fileName: r,
779
779
  loadErrorLabel: c,
780
780
  formulaLabel: D,
781
- formulaLabelClassName: U?.xlsxFormulaLabelClassName ?? "dial-italic-text",
782
- highlightsLabel: M,
781
+ formulaLabelClassName: H?.xlsxFormulaLabelClassName ?? "dial-italic-text",
782
+ highlightsLabel: j,
783
783
  highlightNavigatedLabel: N
784
784
  });
785
- case r.Visualizer: return /* @__PURE__ */ R(Ee, {
785
+ case i.Visualizer: return /* @__PURE__ */ R(Oe, {
786
786
  content: e,
787
787
  errorLabel: d
788
788
  });
789
- case r.McpApp: return /* @__PURE__ */ R(ye, { content: e });
790
- case r.Unsupported: return /* @__PURE__ */ R("p", {
791
- className: h("text-center", q.statusLabel),
792
- children: s
789
+ case i.McpApp: return /* @__PURE__ */ R(xe, { content: e });
790
+ case i.Unsupported: return /* @__PURE__ */ R("p", {
791
+ className: g("text-center", K.statusLabel),
792
+ children: o
793
793
  });
794
- case r.Error: {
795
- let n = e.errorType === t.Forbidden;
794
+ case i.Error: {
795
+ let t = e.errorType === n.Forbidden;
796
796
  return /* @__PURE__ */ z("div", {
797
797
  className: "flex flex-col items-center gap-2",
798
- children: [R(n ? ne : T, {
798
+ children: [R(t ? ne : E, {
799
799
  size: 60,
800
- stroke: x,
801
- className: q.errorIcon
800
+ stroke: S,
801
+ className: K.errorIcon
802
802
  }), /* @__PURE__ */ R("p", {
803
- className: h("text-center", q.statusLabel),
804
- children: n ? u : c
803
+ className: g("text-center", K.statusLabel),
804
+ children: t ? l : c
805
805
  })]
806
806
  });
807
807
  }
808
808
  }
809
809
  }, [
810
810
  e,
811
- U?.fontClassName,
812
- U?.jsonClassName,
813
- U?.xlsxFormulaLabelClassName,
814
- i,
815
- L,
816
- s,
811
+ H?.fontClassName,
812
+ H?.jsonClassName,
813
+ H?.xlsxFormulaLabelClassName,
814
+ r,
815
+ I,
816
+ o,
817
817
  c,
818
- u,
818
+ l,
819
819
  d,
820
- m,
821
- g,
820
+ f,
821
+ h,
822
822
  a,
823
- B,
824
- V,
825
823
  ce,
824
+ B,
826
825
  le,
826
+ ue,
827
827
  _,
828
828
  v,
829
829
  y,
830
830
  b,
831
- S,
831
+ x,
832
832
  C,
833
- E,
833
+ w,
834
834
  D,
835
835
  O,
836
+ k,
836
837
  ee,
837
- te,
838
- ge,
839
- pe,
840
838
  _e,
839
+ pe,
840
+ ve,
841
+ te,
841
842
  re,
842
843
  ie,
843
844
  ae,
844
- k,
845
845
  A,
846
- M,
846
+ j,
847
847
  N
848
848
  ]);
849
849
  return /* @__PURE__ */ R("div", {
850
- style: !n && ke.has(e.type) ? ve : void 0,
851
- className: h(n ? "flex h-full items-center justify-center" : G, ue),
852
- children: n ? /* @__PURE__ */ R(w, {}) : K
850
+ style: !t && je.has(e.type) ? ye : void 0,
851
+ className: g(t ? "flex h-full items-center justify-center" : be, de),
852
+ children: t ? /* @__PURE__ */ R(T, {}) : W
853
853
  });
854
- }), je = 2e3, Me = A(({ isOpen: e, isLoading: t = !1, onClose: n, content: i, fileName: o, labels: { ariaLabel: s, closeLabel: c = "Close", resizeLabel: l = "Resize panel", downloadLabel: u = "Download", copyTextLabel: d = "Copy text", copiedTextLabel: f = "Copied!", copyMarkdownLabel: p = "Copy as Markdown", copiedMarkdownLabel: m = "Copied!", copyJsonLabel: g = "Copy as JSON", copiedJsonLabel: _ = "Copied!", visualizerErrorLabel: C, unsupportedLabel: w = "Preview is not supported for this file", loadErrorLabel: T = "Failed to load file", forbiddenErrorLabel: ne = "You don't have permission to access this file", htmlFrameBlockedLabel: ae = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: k = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: M = "View rendered", mcpAppReloadLabel: P = "Reload", pdfThumbnailsLabel: oe, pdfShowThumbnailsLabel: se, pdfHideThumbnailsLabel: B, pdfPageNumberLabel: V, pdfContentLoadingLabel: ce, pdfContentErrorLabel: le, pdfContentRetryLabel: H, xlsxFormulaLabel: U, codeContentLoadingLabel: ue, codeContentErrorLabel: de, codeContentRetryLabel: fe, tableCopyCsvLabel: pe, tableCopyTxtLabel: me, tableCopyMarkdownLabel: he, tableCopiedLabel: ge, tableDownloadCsvLabel: _e, ooxmlHighlightsLabel: W, ooxmlHighlightNavigatedLabel: ve }, onDownload: G, onCopyText: ye, onCopyMarkdown: K, onCopyJson: be, tableDownloadFilename: xe, isMobile: Se = !1, defaultWidth: Ce, minWidth: we = 600, maxWidth: Te = 1500, onResizeStop: Ee, styles: q, codeBlockTheme: De, loadPdf: Oe, configurePdfWorker: ke }) => {
855
- let [Me, Ne] = I(!1), [Pe, Fe] = I(!1), [Ie, Le] = I(!1), [J, Re] = I(!1), Y = F(null), X = F(null), Z = F(null), ze = j(() => {
856
- ye?.(), Y.current != null && clearTimeout(Y.current), Ne(!0), Y.current = setTimeout(() => Ne(!1), je);
857
- }, [ye]), Be = j(() => {
858
- K?.(), X.current != null && clearTimeout(X.current), Fe(!0), X.current = setTimeout(() => Fe(!1), je);
859
- }, [K]), Q = j(() => {
860
- be?.(), Z.current != null && clearTimeout(Z.current), Le(!0), Z.current = setTimeout(() => Le(!1), je);
861
- }, [be]);
862
- N(() => () => {
854
+ }), Ne = 2e3, Pe = j(({ isOpen: e, isLoading: t = !1, onClose: n, content: r, fileName: a, labels: { ariaLabel: s, closeLabel: c = "Close", resizeLabel: l = "Resize panel", downloadLabel: u = "Download", copyTextLabel: d = "Copy text", copiedTextLabel: f = "Copied!", copyMarkdownLabel: p = "Copy as Markdown", copiedMarkdownLabel: m = "Copied!", copyJsonLabel: h = "Copy as JSON", copiedJsonLabel: _ = "Copied!", visualizerErrorLabel: v, unsupportedLabel: w = "Preview is not supported for this file", loadErrorLabel: T = "Failed to load file", forbiddenErrorLabel: E = "You don't have permission to access this file", htmlFrameBlockedLabel: ne = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: ae = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: N = "Reload", pdfThumbnailsLabel: F, pdfShowThumbnailsLabel: oe, pdfHideThumbnailsLabel: se, pdfPageNumberLabel: B, pdfContentLoadingLabel: le, pdfContentErrorLabel: ue, pdfContentRetryLabel: V, xlsxFormulaLabel: H, codeContentLoadingLabel: de, codeContentErrorLabel: fe, codeContentRetryLabel: pe, tableCopyCsvLabel: me, tableCopyTxtLabel: he, tableCopyMarkdownLabel: ge, tableCopiedLabel: _e, tableDownloadCsvLabel: ve, ooxmlHighlightsLabel: U, ooxmlHighlightNavigatedLabel: ye }, onDownload: be, onCopyText: W, onCopyMarkdown: xe, onCopyJson: G, tableDownloadFilename: Se, isMobile: Ce = !1, defaultWidth: we, minWidth: Te = 600, maxWidth: Ee = 1500, onResizeStop: De, styles: Oe, codeBlockTheme: K, loadPdf: ke, configurePdfWorker: Ae }) => {
855
+ let [je, Pe] = L(!1), [Fe, Ie] = L(!1), [q, Le] = L(!1), [J, Re] = L(!1), Y = I(null), X = I(null), Z = I(null), ze = M(() => {
856
+ W?.(), Y.current != null && clearTimeout(Y.current), Pe(!0), Y.current = setTimeout(() => Pe(!1), Ne);
857
+ }, [W]), Be = M(() => {
858
+ xe?.(), X.current != null && clearTimeout(X.current), Ie(!0), X.current = setTimeout(() => Ie(!1), Ne);
859
+ }, [xe]), Ve = M(() => {
860
+ G?.(), Z.current != null && clearTimeout(Z.current), Le(!0), Z.current = setTimeout(() => Le(!1), Ne);
861
+ }, [G]);
862
+ P(() => () => {
863
863
  Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
864
864
  }, []);
865
- let Ve = j(() => {
865
+ let Q = M(() => {
866
866
  Re((e) => !e);
867
867
  }, []);
868
- N(() => {
868
+ P(() => {
869
869
  Re(!1);
870
- }, [i]);
871
- let { className: He, panelStyles: Ue, ...We } = q ?? {}, Ge = !t && i.type === r.Html && i.srcdoc != null, Ke = !t && ye != null && (i.type === r.PlainText || i.type === r.Code), $ = !t && K != null && i.type === r.Markdown, qe = !t && be != null && i.type === r.Json, Je = !t && G != null && a(i), Ye = !t && i.type === r.McpApp && i.onReload != null;
872
- return /* @__PURE__ */ R(y, {
870
+ }, [r]);
871
+ let { className: He, panelStyles: Ue, ...We } = Oe ?? {}, Ge = !t && r.type === i.Html && r.srcdoc != null, Ke = !t && W != null && (r.type === i.PlainText || r.type === i.Code), qe = !t && xe != null && r.type === i.Markdown, $ = !t && G != null && r.type === i.Json, Je = !t && be != null && o(r), Ye = !t && r.type === i.McpApp && r.onReload != null;
872
+ return /* @__PURE__ */ R(b, {
873
873
  isOpen: e,
874
- orientation: v.Right,
875
- title: o,
874
+ orientation: y.Right,
875
+ title: a,
876
876
  labels: {
877
877
  ariaLabel: s,
878
878
  closeLabel: c,
879
879
  resizeLabel: l
880
880
  },
881
881
  onClose: n,
882
- resizable: !Se,
883
- defaultWidth: Ce,
884
- minWidth: we,
885
- maxWidth: Te,
886
- onResizeStop: Ee,
882
+ resizable: !Ce,
883
+ defaultWidth: we,
884
+ minWidth: Te,
885
+ maxWidth: Ee,
886
+ onResizeStop: De,
887
887
  styles: {
888
888
  ...Ue,
889
889
  titleClassName: Ue?.titleClassName ?? "dial-h3-text",
890
- headerClassName: h("border-b border-tertiary", Ue?.headerClassName),
891
- className: h(e ? "mobile:w-full mobile:max-w-full" : "w-0", He, Ue?.className)
890
+ headerClassName: g("border-b border-tertiary", Ue?.headerClassName),
891
+ className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", He, Ue?.className)
892
892
  },
893
- rightActions: Ge || Ke || $ || qe || Je || Ye ? /* @__PURE__ */ z(L, { children: [
894
- Ye && /* @__PURE__ */ R(S, {
893
+ rightActions: Ge || Ke || qe || $ || Je || Ye ? /* @__PURE__ */ z(ce, { children: [
894
+ Ye && /* @__PURE__ */ R(C, {
895
895
  icon: /* @__PURE__ */ R(ie, {
896
- size: b.LG,
897
- stroke: x,
896
+ size: x.LG,
897
+ stroke: S,
898
898
  "aria-hidden": !0
899
899
  }),
900
- "aria-label": P,
901
- tooltipProps: { tooltip: P },
902
- onClick: i.type === r.McpApp ? i.onReload : void 0
900
+ "aria-label": N,
901
+ tooltipProps: { tooltip: N },
902
+ onClick: r.type === i.McpApp ? r.onReload : void 0
903
903
  }),
904
- Ge && /* @__PURE__ */ R(S, {
905
- icon: R(J ? te : D, {
906
- size: b.LG,
907
- stroke: x,
904
+ Ge && /* @__PURE__ */ R(C, {
905
+ icon: R(J ? te : O, {
906
+ size: x.LG,
907
+ stroke: S,
908
908
  "aria-hidden": !0
909
909
  }),
910
- "aria-label": J ? M : A,
910
+ "aria-label": J ? j : A,
911
911
  "aria-pressed": J,
912
- tooltipProps: { tooltip: J ? M : A },
913
- onClick: Ve
912
+ tooltipProps: { tooltip: J ? j : A },
913
+ onClick: Q
914
914
  }),
915
- Ke && /* @__PURE__ */ R(S, {
916
- icon: R(Me ? E : O, {
917
- size: b.LG,
918
- stroke: x,
915
+ Ke && /* @__PURE__ */ R(C, {
916
+ icon: R(je ? D : k, {
917
+ size: x.LG,
918
+ stroke: S,
919
919
  "aria-hidden": !0
920
920
  }),
921
- "aria-label": Me ? f : d,
922
- tooltipProps: { tooltip: Me ? f : d },
921
+ "aria-label": je ? f : d,
922
+ tooltipProps: { tooltip: je ? f : d },
923
923
  onClick: ze
924
924
  }),
925
- $ && /* @__PURE__ */ R(S, {
926
- icon: R(Pe ? E : re, {
927
- size: b.LG,
928
- stroke: x,
925
+ qe && /* @__PURE__ */ R(C, {
926
+ icon: R(Fe ? D : re, {
927
+ size: x.LG,
928
+ stroke: S,
929
929
  "aria-hidden": !0
930
930
  }),
931
- "aria-label": Pe ? m : p,
932
- tooltipProps: { tooltip: Pe ? m : p },
931
+ "aria-label": Fe ? m : p,
932
+ tooltipProps: { tooltip: Fe ? m : p },
933
933
  onClick: Be
934
934
  }),
935
- qe && /* @__PURE__ */ R(S, {
936
- icon: R(Ie ? E : O, {
937
- size: b.LG,
938
- stroke: x,
935
+ $ && /* @__PURE__ */ R(C, {
936
+ icon: R(q ? D : k, {
937
+ size: x.LG,
938
+ stroke: S,
939
939
  "aria-hidden": !0
940
940
  }),
941
- "aria-label": Ie ? _ : g,
942
- tooltipProps: { tooltip: Ie ? _ : g },
943
- onClick: Q
941
+ "aria-label": q ? _ : h,
942
+ tooltipProps: { tooltip: q ? _ : h },
943
+ onClick: Ve
944
944
  }),
945
- Je && /* @__PURE__ */ R(S, {
945
+ Je && /* @__PURE__ */ R(C, {
946
946
  icon: /* @__PURE__ */ R(ee, {
947
- size: b.LG,
948
- stroke: x
947
+ size: x.LG,
948
+ stroke: S
949
949
  }),
950
950
  "aria-label": u,
951
951
  tooltipProps: { tooltip: u },
952
- onClick: G
952
+ onClick: be
953
953
  })
954
954
  ] }) : null,
955
- children: /* @__PURE__ */ R(Ae, {
956
- content: i,
955
+ children: /* @__PURE__ */ R(Me, {
956
+ content: r,
957
957
  isLoading: t,
958
- fileName: o,
958
+ fileName: a,
959
959
  isHtmlSourceView: J,
960
960
  labels: {
961
961
  unsupportedLabel: w,
962
962
  loadErrorLabel: T,
963
- forbiddenErrorLabel: ne,
964
- visualizerErrorLabel: C,
965
- htmlFrameBlockedLabel: ae,
966
- htmlOpenInNewTabLabel: k,
967
- pdfThumbnailsLabel: oe,
968
- pdfShowThumbnailsLabel: se,
969
- pdfHideThumbnailsLabel: B,
970
- pdfPageNumberLabel: V,
971
- pdfContentLoadingLabel: ce,
972
- pdfContentErrorLabel: le,
973
- pdfContentRetryLabel: H,
974
- xlsxFormulaLabel: U,
975
- codeContentLoadingLabel: ue,
976
- codeContentErrorLabel: de,
977
- codeContentRetryLabel: fe,
978
- tableCopyCsvLabel: pe,
979
- tableCopyTxtLabel: me,
980
- tableCopyMarkdownLabel: he,
981
- tableCopiedLabel: ge,
982
- tableDownloadCsvLabel: _e,
983
- ooxmlHighlightsLabel: W,
984
- ooxmlHighlightNavigatedLabel: ve
963
+ forbiddenErrorLabel: E,
964
+ visualizerErrorLabel: v,
965
+ htmlFrameBlockedLabel: ne,
966
+ htmlOpenInNewTabLabel: ae,
967
+ pdfThumbnailsLabel: F,
968
+ pdfShowThumbnailsLabel: oe,
969
+ pdfHideThumbnailsLabel: se,
970
+ pdfPageNumberLabel: B,
971
+ pdfContentLoadingLabel: le,
972
+ pdfContentErrorLabel: ue,
973
+ pdfContentRetryLabel: V,
974
+ xlsxFormulaLabel: H,
975
+ codeContentLoadingLabel: de,
976
+ codeContentErrorLabel: fe,
977
+ codeContentRetryLabel: pe,
978
+ tableCopyCsvLabel: me,
979
+ tableCopyTxtLabel: he,
980
+ tableCopyMarkdownLabel: ge,
981
+ tableCopiedLabel: _e,
982
+ tableDownloadCsvLabel: ve,
983
+ ooxmlHighlightsLabel: U,
984
+ ooxmlHighlightNavigatedLabel: ye
985
985
  },
986
986
  styles: We,
987
- codeBlockTheme: De,
988
- tableDownloadFilename: xe,
989
- loadPdf: Oe,
990
- configurePdfWorker: ke
987
+ codeBlockTheme: K,
988
+ tableDownloadFilename: Se,
989
+ loadPdf: ke,
990
+ configurePdfWorker: Ae
991
991
  })
992
992
  });
993
- }), Ne = {
994
- type: r.PlainText,
993
+ }), Fe = {
994
+ type: i.PlainText,
995
995
  text: ""
996
- }, Pe = (e) => {
997
- if (!(e.type !== r.Image && e.type !== r.Audio && e.type !== r.Pdf && e.type !== r.Ooxml)) return e.url.startsWith("blob:") ? e.url : void 0;
998
- }, Fe = ae(void 0);
999
- Fe.displayName = "AttachmentCanvasContext";
1000
- var Ie = ({ children: e }) => {
1001
- let [t, n] = I(!1), [r, i] = I(!1), [a, o] = I(Ne), [s, c] = I(void 0), [l, u] = I(void 0), d = j((e, t) => {
996
+ }, Ie = (e) => {
997
+ if (!(e.type !== i.Image && e.type !== i.Audio && e.type !== i.Pdf && e.type !== i.Ooxml)) return e.url.startsWith("blob:") ? e.url : void 0;
998
+ }, q = ae(void 0);
999
+ q.displayName = "AttachmentCanvasContext";
1000
+ var Le = ({ children: e }) => {
1001
+ let [t, n] = L(!1), [r, i] = L(!1), [a, o] = L(Fe), [s, c] = L(void 0), [l, u] = L(void 0), d = M((e, t) => {
1002
1002
  c(e), u(t), i(!0), n(!0);
1003
- }, []), f = j((e, t, r) => {
1003
+ }, []), f = M((e, t, r) => {
1004
1004
  o(e), c(t), u(r), i(!1), n(!0);
1005
- }, []), p = j(() => {
1006
- o(Ne), n(!1), i(!1), u(void 0);
1005
+ }, []), p = M(() => {
1006
+ o(Fe), n(!1), i(!1), u(void 0);
1007
1007
  }, []);
1008
- return N(() => () => {
1009
- let e = Pe(a);
1008
+ return P(() => () => {
1009
+ let e = Ie(a);
1010
1010
  e != null && URL.revokeObjectURL(e);
1011
- }, [a]), /* @__PURE__ */ R(Fe.Provider, {
1012
- value: P(() => ({
1011
+ }, [a]), /* @__PURE__ */ R(q.Provider, {
1012
+ value: F(() => ({
1013
1013
  isOpen: t,
1014
1014
  isLoading: r,
1015
1015
  content: a,
@@ -1030,26 +1030,26 @@ var Ie = ({ children: e }) => {
1030
1030
  ]),
1031
1031
  children: e
1032
1032
  });
1033
- }, Le = () => {
1034
- let e = M(Fe);
1033
+ }, J = () => {
1034
+ let e = N(q);
1035
1035
  if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
1036
1036
  return e;
1037
- }, J = A(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: a, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
1038
- let { ariaLabel: l = "Attachment preview", closeLabel: u = "Close", downloadLabel: d = "Download", unsupportedLabel: f = "Preview is not supported for this file", loadErrorLabel: p = "Failed to load file", forbiddenErrorLabel: h = "You don't have permission to access this file", copyTextLabel: g, copiedTextLabel: _, copyMarkdownLabel: v, copiedMarkdownLabel: y, copyJsonLabel: b, copiedJsonLabel: x, htmlFrameBlockedLabel: S, htmlOpenInNewTabLabel: C, htmlViewSourceLabel: w, htmlViewRenderedLabel: T, pdfThumbnailsLabel: E, pdfShowThumbnailsLabel: D, pdfHideThumbnailsLabel: O, pdfPageNumberLabel: ee, pdfContentLoadingLabel: te, pdfContentErrorLabel: ne, pdfContentRetryLabel: re, xlsxFormulaLabel: ie, codeContentLoadingLabel: ae, codeContentErrorLabel: k, codeContentRetryLabel: A, tableCopyCsvLabel: M, tableCopyTxtLabel: N, tableCopyMarkdownLabel: P, tableCopiedLabel: F, tableDownloadCsvLabel: I, ooxmlHighlightsLabel: oe, ooxmlHighlightNavigatedLabel: se } = e ?? {}, { isOpen: L, isLoading: z, content: B, fileName: V, closeCanvas: ce } = Le(), le = j(() => {
1039
- i(B, V);
1040
- }, [B, V]), H = j(() => {
1041
- (B.type === r.PlainText || B.type === r.Code) && m(B.text);
1042
- }, [B]), U = j(() => {
1043
- B.type === r.Markdown && m(B.text);
1044
- }, [B]), ue = j(() => {
1045
- B.type === r.Json && m(JSON.stringify(B.value, null, 2));
1046
- }, [B]);
1047
- return /* @__PURE__ */ R(Me, {
1048
- isOpen: L,
1049
- isLoading: z,
1050
- onClose: ce,
1051
- content: B,
1052
- fileName: V,
1037
+ }, Re = j(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
1038
+ let { ariaLabel: l = "Attachment preview", closeLabel: u = "Close", downloadLabel: d = "Download", unsupportedLabel: f = "Preview is not supported for this file", loadErrorLabel: p = "Failed to load file", forbiddenErrorLabel: m = "You don't have permission to access this file", copyTextLabel: g, copiedTextLabel: _, copyMarkdownLabel: v, copiedMarkdownLabel: y, copyJsonLabel: b, copiedJsonLabel: x, htmlFrameBlockedLabel: S, htmlOpenInNewTabLabel: C, htmlViewSourceLabel: w, htmlViewRenderedLabel: T, pdfThumbnailsLabel: E, pdfShowThumbnailsLabel: D, pdfHideThumbnailsLabel: O, pdfPageNumberLabel: k, pdfContentLoadingLabel: ee, pdfContentErrorLabel: te, pdfContentRetryLabel: ne, xlsxFormulaLabel: re, codeContentLoadingLabel: ie, codeContentErrorLabel: ae, codeContentRetryLabel: A, tableCopyCsvLabel: j, tableCopyTxtLabel: N, tableCopyMarkdownLabel: P, tableCopiedLabel: F, tableDownloadCsvLabel: I, ooxmlHighlightsLabel: L, ooxmlHighlightNavigatedLabel: oe } = e ?? {}, { isOpen: se, isLoading: ce, content: z, fileName: B, closeCanvas: le } = J(), ue = M(() => {
1039
+ a(z, B);
1040
+ }, [z, B]), V = M(() => {
1041
+ (z.type === i.PlainText || z.type === i.Code) && h(z.text);
1042
+ }, [z]), H = M(() => {
1043
+ z.type === i.Markdown && h(z.text);
1044
+ }, [z]), de = M(() => {
1045
+ z.type === i.Json && h(JSON.stringify(z.value, null, 2));
1046
+ }, [z]);
1047
+ return /* @__PURE__ */ R(Pe, {
1048
+ isOpen: se,
1049
+ isLoading: ce,
1050
+ onClose: le,
1051
+ content: z,
1052
+ fileName: B,
1053
1053
  labels: {
1054
1054
  ariaLabel: l,
1055
1055
  closeLabel: u,
@@ -1062,7 +1062,7 @@ var Ie = ({ children: e }) => {
1062
1062
  copiedJsonLabel: x,
1063
1063
  unsupportedLabel: f,
1064
1064
  loadErrorLabel: p,
1065
- forbiddenErrorLabel: h,
1065
+ forbiddenErrorLabel: m,
1066
1066
  htmlFrameBlockedLabel: S,
1067
1067
  htmlOpenInNewTabLabel: C,
1068
1068
  htmlViewSourceLabel: w,
@@ -1070,70 +1070,70 @@ var Ie = ({ children: e }) => {
1070
1070
  pdfThumbnailsLabel: E,
1071
1071
  pdfShowThumbnailsLabel: D,
1072
1072
  pdfHideThumbnailsLabel: O,
1073
- pdfPageNumberLabel: ee,
1074
- pdfContentLoadingLabel: te,
1075
- pdfContentErrorLabel: ne,
1076
- pdfContentRetryLabel: re,
1077
- xlsxFormulaLabel: ie,
1078
- codeContentLoadingLabel: ae,
1079
- codeContentErrorLabel: k,
1073
+ pdfPageNumberLabel: k,
1074
+ pdfContentLoadingLabel: ee,
1075
+ pdfContentErrorLabel: te,
1076
+ pdfContentRetryLabel: ne,
1077
+ xlsxFormulaLabel: re,
1078
+ codeContentLoadingLabel: ie,
1079
+ codeContentErrorLabel: ae,
1080
1080
  codeContentRetryLabel: A,
1081
- tableCopyCsvLabel: M,
1081
+ tableCopyCsvLabel: j,
1082
1082
  tableCopyTxtLabel: N,
1083
1083
  tableCopyMarkdownLabel: P,
1084
1084
  tableCopiedLabel: F,
1085
1085
  tableDownloadCsvLabel: I,
1086
- ooxmlHighlightsLabel: oe,
1087
- ooxmlHighlightNavigatedLabel: se
1086
+ ooxmlHighlightsLabel: L,
1087
+ ooxmlHighlightNavigatedLabel: oe
1088
1088
  },
1089
- onDownload: le,
1090
- onCopyText: B.type === r.PlainText || B.type === r.Code ? H : void 0,
1091
- onCopyMarkdown: B.type === r.Markdown ? U : void 0,
1092
- onCopyJson: B.type === r.Json ? ue : void 0,
1089
+ onDownload: ue,
1090
+ onCopyText: z.type === i.PlainText || z.type === i.Code ? V : void 0,
1091
+ onCopyMarkdown: z.type === i.Markdown ? H : void 0,
1092
+ onCopyJson: z.type === i.Json ? de : void 0,
1093
1093
  tableDownloadFilename: s,
1094
1094
  isMobile: t,
1095
1095
  defaultWidth: n,
1096
- maxWidth: a,
1096
+ maxWidth: r,
1097
1097
  codeBlockTheme: o,
1098
1098
  configurePdfWorker: c
1099
1099
  });
1100
- }), Re = new Set(["html", "htm"]), Y = {
1100
+ }), Y = new Set(["html", "htm"]), X = {
1101
1101
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1102
1102
  xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1103
1103
  pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
1104
- }, X = new Set(/* @__PURE__ */ "txt.md.markdown.json.jsonl.ndjson.xml.csv.tsv.yaml.yml.toml.ini.conf.cfg.css.scss.sass.less.js.jsx.ts.tsx.mjs.cjs.mts.cts.py.rb.go.rs.java.kt.swift.c.h.cpp.cs.sh.bash.zsh.fish.ps1.log.env.gitignore.dockerfile.makefile.sql".split(".")), Z = {
1105
- docx: n.Docx,
1106
- xlsx: n.Xlsx,
1107
- pptx: n.Pptx,
1108
- csv: n.Csv
1109
- }, ze = {
1110
- [Y.docx]: n.Docx,
1111
- [Y.xlsx]: n.Xlsx,
1112
- [Y.pptx]: n.Pptx,
1113
- [d.CSV]: n.Csv
1104
+ }, Z = new Set(/* @__PURE__ */ "txt.md.markdown.json.jsonl.ndjson.xml.csv.tsv.yaml.yml.toml.ini.conf.cfg.css.scss.sass.less.js.jsx.ts.tsx.mjs.cjs.mts.cts.py.rb.go.rs.java.kt.swift.c.h.cpp.cs.sh.bash.zsh.fish.ps1.log.env.gitignore.dockerfile.makefile.sql".split(".")), ze = {
1105
+ docx: r.Docx,
1106
+ xlsx: r.Xlsx,
1107
+ pptx: r.Pptx,
1108
+ csv: r.Csv
1114
1109
  }, Be = {
1115
- [n.Docx]: Y.docx,
1116
- [n.Xlsx]: Y.xlsx,
1117
- [n.Pptx]: Y.pptx,
1118
- [n.Csv]: d.CSV
1110
+ [X.docx]: r.Docx,
1111
+ [X.xlsx]: r.Xlsx,
1112
+ [X.pptx]: r.Pptx,
1113
+ [f.CSV]: r.Csv
1114
+ }, Ve = {
1115
+ [r.Docx]: X.docx,
1116
+ [r.Xlsx]: X.xlsx,
1117
+ [r.Pptx]: X.pptx,
1118
+ [r.Csv]: f.CSV
1119
1119
  }, Q = (e, t) => {
1120
1120
  let n = t?.split(";", 1)[0].trim().toLowerCase();
1121
1121
  if (n != null) {
1122
- let e = ze[n];
1122
+ let e = Be[n];
1123
1123
  if (e != null) return e;
1124
1124
  }
1125
1125
  let r = e.lastIndexOf(".");
1126
- if (r !== -1) return Z[e.slice(r + 1).toLowerCase()];
1127
- }, Ve = (e, t) => Q(e, t) != null, He = (e, t) => {
1126
+ if (r !== -1) return ze[e.slice(r + 1).toLowerCase()];
1127
+ }, He = (e, t) => Q(e, t) != null, Ue = (e, t) => {
1128
1128
  let n = Q(e, t);
1129
- return n == null ? void 0 : Be[n];
1130
- }, Ue = (e) => {
1131
- let t = e.lastIndexOf(".");
1132
- return t === -1 ? !1 : X.has(e.slice(t + 1).toLowerCase());
1129
+ return n == null ? void 0 : Ve[n];
1133
1130
  }, We = (e) => {
1134
1131
  let t = e.lastIndexOf(".");
1135
- return t === -1 ? !1 : Re.has(e.slice(t + 1).toLowerCase());
1136
- }, Ge = {
1132
+ return t === -1 ? !1 : Z.has(e.slice(t + 1).toLowerCase());
1133
+ }, Ge = (e) => {
1134
+ let t = e.lastIndexOf(".");
1135
+ return t === -1 ? !1 : Y.has(e.slice(t + 1).toLowerCase());
1136
+ }, Ke = {
1137
1137
  xml: "xml",
1138
1138
  csv: "plaintext",
1139
1139
  tsv: "plaintext",
@@ -1181,26 +1181,26 @@ var Ie = ({ children: e }) => {
1181
1181
  gitignore: "plaintext",
1182
1182
  dockerfile: "plaintext",
1183
1183
  makefile: "plaintext"
1184
- }, Ke = (e) => Ge[e], $ = (e) => ({
1185
- type: r.Unsupported,
1186
- ...e != null && { url: e }
1187
- }), qe = (e) => ({
1188
- type: r.Error,
1189
- errorType: t.LoadFailed,
1184
+ }, qe = (e) => Ke[e], $ = (e) => ({
1185
+ type: i.Unsupported,
1190
1186
  ...e != null && { url: e }
1191
1187
  }), Je = (e) => ({
1192
- type: r.Error,
1193
- errorType: t.Forbidden,
1188
+ type: i.Error,
1189
+ errorType: n.LoadFailed,
1190
+ ...e != null && { url: e }
1191
+ }), Ye = (e) => ({
1192
+ type: i.Error,
1193
+ errorType: n.Forbidden,
1194
1194
  ...e != null && { url: e }
1195
- }), Ye = (e, t) => {
1195
+ }), Xe = (e, t) => {
1196
1196
  let n = e.toLowerCase();
1197
1197
  return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
1198
- }, Xe = (e) => {
1198
+ }, Ze = (e) => {
1199
1199
  let t;
1200
1200
  try {
1201
1201
  t = new URL(e).pathname;
1202
1202
  } catch {
1203
- t = _(e);
1203
+ t = v(e);
1204
1204
  }
1205
1205
  let n = t.split("/").filter(Boolean).pop() ?? "";
1206
1206
  try {
@@ -1208,97 +1208,97 @@ var Ie = ({ children: e }) => {
1208
1208
  } catch {
1209
1209
  return n;
1210
1210
  }
1211
- }, Ze = (e, t) => {
1212
- let { openCanvas: n, openCanvasLoading: i, closeCanvas: a } = Le(), { customVisualizers: o, themeId: c, onBeforeOpen: l } = t, f = j(async (t, i) => {
1211
+ }, Qe = (e, t) => {
1212
+ let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = J(), { customVisualizers: o, themeId: s, onBeforeOpen: l } = t, u = M(async (t, r) => {
1213
1213
  if (t.url == null && t.referenceUrl != null) {
1214
- let r = e.resolveReferencePdfContent(t);
1215
- if (r != null) return n(r, t.name, i), !0;
1214
+ let i = e.resolveReferencePdfContent(t);
1215
+ if (i != null) return n(i, t.name, r), !0;
1216
1216
  }
1217
- let a = t.contentType.toLowerCase(), s = Ye(a, o);
1218
- if (s != null) {
1219
- let r = await e.resolveVisualizerContent(t, s, c);
1220
- if (r != null) return n(r, t.name, i), !0;
1217
+ let a = t.contentType.toLowerCase(), c = Xe(a, o);
1218
+ if (c != null) {
1219
+ let i = await e.resolveVisualizerContent(t, c, s);
1220
+ if (i != null) return n(i, t.name, r), !0;
1221
1221
  }
1222
1222
  if (!a && t.data != null) {
1223
- let r = await e.resolveTextContent(t);
1224
- if (r != null) return n(r, t.name, i), !0;
1223
+ let i = await e.resolveTextContent(t);
1224
+ if (i != null) return n(i, t.name, r), !0;
1225
1225
  }
1226
1226
  let l = Q("", a);
1227
- if (l != null) return n(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1227
+ if (l != null) return n(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1228
1228
  switch (a) {
1229
- case d.PDF: return n(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1230
- case d.Markdown: return n(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1231
- case d.JSON: return n(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1229
+ case f.PDF: return n(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1230
+ case f.Markdown: return n(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1231
+ case f.JSON: return n(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1232
1232
  }
1233
- let f = t.name ?? "", p = f.lastIndexOf("."), m = p === -1 ? "" : f.slice(p + 1).toLowerCase(), h = Q(f);
1234
- if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1233
+ let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h = Q(u);
1234
+ if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1235
1235
  switch (m) {
1236
- case u.Markdown:
1237
- case u.MarkdownAlt: {
1238
- let r = await e.resolveMarkdownContent(t);
1239
- return r == null ? !1 : (n(r, t.name, i), !0);
1236
+ case d.Markdown:
1237
+ case d.MarkdownAlt: {
1238
+ let i = await e.resolveMarkdownContent(t);
1239
+ return i == null ? !1 : (n(i, t.name, r), !0);
1240
1240
  }
1241
- case u.JSON: {
1242
- let r = await e.resolveJsonContent(t);
1243
- return r == null ? !1 : (n(r, t.name, i), !0);
1241
+ case d.JSON: {
1242
+ let i = await e.resolveJsonContent(t);
1243
+ return i == null ? !1 : (n(i, t.name, r), !0);
1244
1244
  }
1245
- case u.PDF: {
1246
- let r = await e.resolvePdfContent(t);
1247
- return r == null ? !1 : (n(r, t.name, i), !0);
1245
+ case d.PDF: {
1246
+ let i = await e.resolvePdfContent(t);
1247
+ return i == null ? !1 : (n(i, t.name, r), !0);
1248
1248
  }
1249
1249
  }
1250
- let g = t.name != null && We(t.name) || t.url != null && We(Xe(t.url));
1251
- if (t.name != null && !Ue(t.name) && !g) return n($(e.resolveContentUrl(t)), t.name, i), !0;
1250
+ let g = t.name != null && Ge(t.name) || t.url != null && Ge(Ze(t.url));
1251
+ if (t.name != null && !We(t.name) && !g) return n($(e.resolveContentUrl(t)), t.name, r), !0;
1252
1252
  if (g) {
1253
1253
  let a = await e.resolveHtmlContent(t);
1254
- return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, i), !0) : t.url == null ? !1 : (n({
1255
- type: r.Html,
1254
+ return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, r), !0) : t.url == null ? !1 : (n({
1255
+ type: i.Html,
1256
1256
  url: t.url
1257
- }, t.name, i), !0) : (n(a, t.name, i), !0);
1257
+ }, t.name, r), !0) : (n(a, t.name, r), !0);
1258
1258
  }
1259
- let _ = await e.resolveCodeContent(t, Ke(m));
1260
- return _ == null ? !1 : (n(_, t.name, i), !0);
1259
+ let _ = await e.resolveCodeContent(t, qe(m));
1260
+ return _ == null ? !1 : (n(_, t.name, r), !0);
1261
1261
  }, [
1262
1262
  n,
1263
1263
  o,
1264
- c,
1264
+ s,
1265
1265
  e
1266
1266
  ]);
1267
- return { openAttachmentCanvas: j(async (t, o = t.id) => {
1267
+ return { openAttachmentCanvas: M(async (t, o = t.id) => {
1268
1268
  switch (t.type) {
1269
- case s.Image: {
1269
+ case c.Image: {
1270
1270
  let r = e.resolveImageContent(t);
1271
1271
  return r == null ? !1 : (l?.(), n(r, t.name, o), !0);
1272
1272
  }
1273
- case s.Audio: {
1273
+ case c.Audio: {
1274
1274
  let e = t.playUrl ?? t.url;
1275
1275
  return e == null ? !1 : (n({
1276
- type: r.Audio,
1276
+ type: i.Audio,
1277
1277
  url: e,
1278
1278
  mimeType: t.contentType || void 0
1279
1279
  }, t.name, o), !0);
1280
1280
  }
1281
- case s.File: {
1282
- l?.(), i(t.name, o);
1283
- let e = await f(t, o);
1281
+ case c.File: {
1282
+ l?.(), r(t.name, o);
1283
+ let e = await u(t, o);
1284
1284
  return e || a(), e;
1285
1285
  }
1286
- case s.Pasted:
1287
- case s.Prompt: {
1288
- l?.(), i(t.name, o);
1289
- let r = await e.resolveTextContent(t);
1290
- return r == null ? (a(), !1) : (n(r, t.name, o), !0);
1286
+ case c.Pasted:
1287
+ case c.Prompt: {
1288
+ l?.(), r(t.name, o);
1289
+ let i = await e.resolveTextContent(t);
1290
+ return i == null ? (a(), !1) : (n(i, t.name, o), !0);
1291
1291
  }
1292
1292
  default: return !1;
1293
1293
  }
1294
1294
  }, [
1295
1295
  n,
1296
- i,
1296
+ r,
1297
1297
  a,
1298
1298
  l,
1299
- f,
1299
+ u,
1300
1300
  e
1301
1301
  ]) };
1302
1302
  };
1303
1303
  //#endregion
1304
- export { Me as AttachmentCanvas, Ae as AttachmentCanvasBody, J as AttachmentCanvasContainer, Ie as AttachmentCanvasProvider, r as AttachmentContentType, t as AttachmentErrorType, fe as CodeContent, ye as McpAppCanvasRenderer, n as OoxmlFileType, e as OoxmlHighlightKind, Je as createForbiddenCanvasContent, qe as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, i as downloadAttachmentContent, Ke as extensionToLanguage, Ye as findVisualizerForMime, Q as getOoxmlFileType, He as getOoxmlMimeType, a as isDownloadable, We as isHtmlPreviewable, Ve as isOoxmlPreviewable, Ue as isTextPreviewable, Le as useAttachmentCanvas, Ze as useOpenAttachmentCanvas };
1304
+ export { Pe as AttachmentCanvas, Me as AttachmentCanvasBody, Re as AttachmentCanvasContainer, Le as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, me as CodeContent, xe as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, Ye as createForbiddenCanvasContent, Je as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, a as downloadAttachmentContent, qe as extensionToLanguage, Xe as findVisualizerForMime, Q as getOoxmlFileType, Ue as getOoxmlMimeType, o as isDownloadable, Ge as isHtmlPreviewable, He as isOoxmlPreviewable, We as isTextPreviewable, J as useAttachmentCanvas, Qe as useOpenAttachmentCanvas };