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

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 (60) hide show
  1. package/{LazyContentBoundary-CRXN6PG3.js → LazyContentBoundary-tNE1ExbI.js} +2 -1
  2. package/{PdfContent-D71LPAe3.js → PdfContent-BoAtghsO.js} +1 -1
  3. package/PdfContent.css +1 -1
  4. package/{attachment-canvas-nvhW3tKV.js → attachment-canvas-BgwyzrRC.js} +2 -2
  5. package/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
  6. package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -1
  7. package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
  8. package/components/InlineGroupedVisualizer/InlineGroupedVisualizer.d.ts +36 -0
  9. package/components/InlineGroupedVisualizer/InlineGroupedVisualizer.d.ts.map +1 -0
  10. package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts +3 -0
  11. package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts.map +1 -1
  12. package/components/PdfContent/PdfContent.d.ts.map +1 -1
  13. package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts +5 -3
  14. package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts.map +1 -1
  15. package/constants/public-class-names.d.ts +11 -0
  16. package/constants/public-class-names.d.ts.map +1 -0
  17. package/context/AttachmentCanvasContext.d.ts.map +1 -1
  18. package/hooks/useMcpAppBridge/useMcpAppBridge.d.ts.map +1 -1
  19. package/hooks/useOpenAttachmentCanvas/useOpenAttachmentCanvas.d.ts +14 -1
  20. package/hooks/useOpenAttachmentCanvas/useOpenAttachmentCanvas.d.ts.map +1 -1
  21. package/index.css +2 -1
  22. package/index.d.ts +7 -3
  23. package/index.d.ts.map +1 -1
  24. package/index.js +574 -468
  25. package/models/attachment-canvas.d.ts +52 -11
  26. package/models/attachment-canvas.d.ts.map +1 -1
  27. package/{ooxml-highlight-surfaces-CaMjx8u-.js → ooxml-highlight-surfaces-BzgOKpBV.js} +182 -74
  28. package/package.json +5 -5
  29. package/types/attachment-canvas.d.ts +6 -1
  30. package/types/attachment-canvas.d.ts.map +1 -1
  31. package/utils/content.d.ts +16 -2
  32. package/utils/content.d.ts.map +1 -1
  33. package/utils/download.d.ts.map +1 -1
  34. package/utils/ooxml-highlight-surfaces.d.ts.map +1 -1
  35. package/utils/ooxml-table-row-highlight.d.ts +8 -0
  36. package/utils/ooxml-table-row-highlight.d.ts.map +1 -0
  37. package/utils/visualizer.d.ts +29 -1
  38. package/utils/visualizer.d.ts.map +1 -1
  39. package/utils/vite-external-matcher.d.ts +5 -5
  40. package/utils/vite-external-matcher.d.ts.map +1 -1
  41. package/bounded-raw-part-cache-Cg1BsSZQ-DN8p45IK.js +0 -37900
  42. package/chart-ex-DsESBs97.js +0 -1009
  43. package/comment-occurrence-C8Y2uoVr-C1cxz2TU.js +0 -6
  44. package/comment-ui-runtime-BfE7MJZn-DhQ_eg15.js +0 -112
  45. package/comment-ui-runtime-BsK8pmUT-EgWiymew.js +0 -2
  46. package/comment-ui-runtime-DcJOYlw--B15auUq-.js +0 -170
  47. package/comments-Diid5ujN-BdQhRNjI.js +0 -282
  48. package/delimited-text-worker-host-BVY-Ecni-AimUmSn0.js +0 -25
  49. package/docx-B-VcIRoc.js +0 -29870
  50. package/line-distribute-Dtudnqhs--BYZNgzX.js +0 -1237
  51. package/line-metrics-B60C86uh-DfQUk7X1.js +0 -60
  52. package/pptx-CnoDB8Fv.js +0 -9211
  53. package/read-only-comment-decoration-Dz7eTQ4d-Cl3RKKH6.js +0 -94
  54. package/read-only-comment-margin-DkgzASAl-BbDxMI5E.js +0 -189
  55. package/render-worker-host-BfbnEChF-D2thMRGX.js +0 -7
  56. package/render-worker-host-DNL9dWRh-Bky38ZHE.js +0 -7
  57. package/render-worker-host-IkHrYOci-DbjyHK7U.js +0 -7
  58. package/renderer-module-contract-D91rkYHH-BtfSKxb4.js +0 -10063
  59. package/visible-index-BgiHEc1z-BOzE9X5U.js +0 -162
  60. package/xlsx-Dn0XSlTO.js +0 -8610
package/index.js CHANGED
@@ -1,42 +1,43 @@
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";
1
+ import { a as e, i as t, n, r, t as i } from "./attachment-canvas-BgwyzrRC.js";
2
+ import { i as a, o, t as s } from "./LazyContentBoundary-tNE1ExbI.js";
3
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
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
- import { JsonView as oe, defaultStyles as se } from "react-json-view-lite";
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";
5
+ import { DIAL_ICON_SIZE as x, DIAL_KIT_ICON_STROKE as S, ElementSize as C, GhostIconButton as w, LinkButton as T, Spinner as E } from "@epam/ai-dial-ui-kit";
6
+ import { IconAlertTriangle as D, IconArrowsMaximize as O, IconCheck as k, IconCode as ee, IconCopy as A, IconDownload as te, IconEye as ne, IconLock as re, IconMarkdown as ie, IconRefresh as ae } from "@tabler/icons-react";
7
+ import { createContext as j, lazy as M, memo as N, useCallback as P, useContext as oe, useEffect as F, useMemo as I, useRef as L, useState as R } from "react";
8
+ import { JsonView as se, defaultStyles as ce } from "react-json-view-lite";
9
+ import { Fragment as le, jsx as z, jsxs as B } from "react/jsx-runtime";
10
+ import { AppBridge as V, AppFrame as H } from "@mcp-ui/client";
11
11
  import { McpUiHostContextChangedNotificationSchema as ue } from "@modelcontextprotocol/ext-apps/app-bridge";
12
- import { VisualizerConnectorRequests as V } from "@epam/ai-dial-shared";
13
- import { VisualizerConnector as H } from "@epam/ai-dial-visualizer-connector";
14
- var de = {
12
+ import { VisualizerConnectorRequests as de } from "@epam/ai-dial-shared";
13
+ import { VisualizerConnector as fe } from "@epam/ai-dial-visualizer-connector";
14
+ //#region src/constants/public-class-names.ts
15
+ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
15
16
  container: "_container_1nhig_1",
16
17
  containerLight: "_containerLight_1nhig_5"
17
- }, fe = {
18
+ }, he = {
18
19
  [l.Dark]: _,
19
20
  [l.Light]: _
20
- }, pe = () => A(async () => {
21
+ }, U = () => M(async () => {
21
22
  let { Prism: e } = await import("react-syntax-highlighter");
22
23
  return { default: e };
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(() => {
24
+ }), ge = N(({ content: e, codeBlockTheme: t = l.Light, labels: n }) => {
25
+ let { text: r, language: i } = e, a = i == null || i === "plaintext", o = he[t], c = t === l.Light, [u, d] = R(0), f = I(U, [u]), p = P(() => {
25
26
  d((e) => e + 1);
26
- }, []), m = /* @__PURE__ */ R("pre", {
27
+ }, []), m = /* @__PURE__ */ z("pre", {
27
28
  className: "whitespace-pre-wrap break-words p-4",
28
29
  children: r
29
30
  });
30
- return /* @__PURE__ */ R("div", {
31
+ return /* @__PURE__ */ z("div", {
31
32
  dir: "ltr",
32
- className: g("h-full overflow-auto", de.container, c && de.containerLight),
33
- children: a ? m : /* @__PURE__ */ R(s, {
33
+ className: g("h-full overflow-auto", me.container, c && me.containerLight),
34
+ children: a ? m : /* @__PURE__ */ z(s, {
34
35
  retryKey: u,
35
36
  onRetry: p,
36
37
  pendingContent: m,
37
38
  errorContent: m,
38
39
  labels: n,
39
- children: /* @__PURE__ */ R(f, {
40
+ children: /* @__PURE__ */ z(f, {
40
41
  language: i,
41
42
  style: o,
42
43
  customStyle: {
@@ -53,21 +54,21 @@ var de = {
53
54
  })
54
55
  })
55
56
  });
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(() => {
57
+ }), _e = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ve = N(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
58
+ let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = R(!0), [d, f] = R(!1), p = L(null);
59
+ F(() => {
59
60
  u(!0), f(!1);
60
61
  }, [e]);
61
- let m = M((t) => {
62
+ let m = P((t) => {
62
63
  if (u(!1), e.srcdoc == null) try {
63
64
  p.current?.contentDocument ?? f(!0);
64
65
  } catch {
65
66
  f(!0);
66
67
  }
67
- }, [e.srcdoc]), h = M(() => {
68
+ }, [e.srcdoc]), h = P(() => {
68
69
  u(!1), f(!0);
69
70
  }, []);
70
- if (n && e.srcdoc != null) return /* @__PURE__ */ R(me, {
71
+ if (n && e.srcdoc != null) return /* @__PURE__ */ z(ge, {
71
72
  content: {
72
73
  type: i.Code,
73
74
  text: e.srcdoc,
@@ -75,26 +76,26 @@ var de = {
75
76
  },
76
77
  codeBlockTheme: a
77
78
  });
78
- if (d) return /* @__PURE__ */ z("div", {
79
+ if (d) return /* @__PURE__ */ B("div", {
79
80
  className: "flex h-full flex-col items-center justify-center gap-3 p-4",
80
- children: [/* @__PURE__ */ R("p", {
81
+ children: [/* @__PURE__ */ z("p", {
81
82
  className: "text-center",
82
83
  children: s
83
- }), e.url != null && /* @__PURE__ */ R(w, {
84
+ }), e.url != null && /* @__PURE__ */ z(T, {
84
85
  href: e.url,
85
86
  target: "_blank",
86
87
  label: c,
87
- className: he.openInNewTabButton,
88
+ className: _e.openInNewTabButton,
88
89
  textClassName: o
89
90
  })]
90
91
  });
91
92
  let _ = e.srcdoc != null, v = _ ? void 0 : e.url, y = _ ? e.srcdoc : void 0;
92
- return /* @__PURE__ */ z("div", {
93
+ return /* @__PURE__ */ B("div", {
93
94
  className: "relative h-full",
94
- children: [l && /* @__PURE__ */ R("div", {
95
+ children: [l && /* @__PURE__ */ z("div", {
95
96
  className: "absolute inset-0 flex items-center justify-center",
96
- children: /* @__PURE__ */ R(T, {})
97
- }), /* @__PURE__ */ R("iframe", {
97
+ children: /* @__PURE__ */ z(E, {})
98
+ }), /* @__PURE__ */ z("iframe", {
98
99
  ref: p,
99
100
  title: r,
100
101
  src: v,
@@ -105,10 +106,10 @@ var de = {
105
106
  onError: h
106
107
  })]
107
108
  });
108
- }), _e = {
109
+ }), ye = {
109
110
  name: "MCP-UI Host",
110
111
  version: "1.0.0"
111
- }, ve = { openLinks: {} }, U = (e) => {
112
+ }, be = { openLinks: {} }, xe = (e) => {
112
113
  let t;
113
114
  try {
114
115
  t = new URL(e);
@@ -122,31 +123,38 @@ var de = {
122
123
  return !1;
123
124
  }
124
125
  return !0;
125
- }, ye = (e, t, n) => {
126
+ }, Se = (e, t, n) => {
126
127
  if (n) {
127
128
  e.style.maxWidth = "", e.style.maxHeight = "";
128
129
  return;
129
130
  }
130
131
  let r = t;
131
132
  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
- }, be = (e, t, n) => {
133
- let r = I(e);
134
- P(() => {
133
+ }, Ce = (e, t, n) => {
134
+ let r = L(e);
135
+ F(() => {
135
136
  r.current = e;
136
137
  });
137
- let [i, a] = L(null), [o, s] = L(!1);
138
- return P(() => {
138
+ let [i, a] = R(null), [o, s] = R(!1);
139
+ return F(() => {
139
140
  let e = null;
140
141
  try {
141
- e = new B(null, _e, ve, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
142
+ let n = t.current?.getBoundingClientRect(), i = n != null && n.width > 0 && n.height > 0 ? {
143
+ ...r.current.hostContext,
144
+ containerDimensions: {
145
+ width: Math.round(n.width),
146
+ height: Math.round(n.height)
147
+ }
148
+ } : r.current.hostContext;
149
+ e = new V(null, r.current.hostInfo ?? ye, be, { hostContext: i }), e.onopenlink = async ({ url: e }) => {
142
150
  let t = r.current.onOpenLink;
143
- return (t == null ? U(e) : t(e)) === !1 ? { isError: !0 } : {};
151
+ return (t == null ? xe(e) : t(e)) === !1 ? { isError: !0 } : {};
144
152
  }, e.onrequestdisplaymode = async ({ mode: e }) => {
145
153
  let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
146
154
  return { mode: t?.(e) ?? n };
147
155
  }, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(ue, ({ params: e }) => {
148
156
  let n = t.current?.querySelector("iframe");
149
- n != null && ye(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
157
+ n != null && Se(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
150
158
  }), a(e);
151
159
  } catch (e) {
152
160
  console.error("[useMcpAppBridge] Error creating AppBridge:", e), s(!0);
@@ -154,8 +162,8 @@ var de = {
154
162
  return () => {
155
163
  e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
156
164
  };
157
- }, [t]), P(() => {
158
- i != null && n != null && i.setHostContext(n);
165
+ }, [t]), F(() => {
166
+ i != null && i.transport != null && n != null && i.setHostContext(n);
159
167
  }, [i, n]), {
160
168
  appBridge: i,
161
169
  hasFailed: o
@@ -165,51 +173,53 @@ var de = {
165
173
  fullscreenFrame: "_fullscreenFrame_1aric_20",
166
174
  statusLabel: "_statusLabel_1aric_27",
167
175
  errorIcon: "_errorIcon_1aric_31"
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
- let e = d.current;
176
+ }, we = ({ content: e, errorLabel: t = "Failed to load app", onAppInfo: n }) => {
177
+ let [r, i] = R("loading"), { html: a, sandboxUrl: o, toolInput: s, toolResult: c, hostContext: l } = e, u = I(() => ({ url: new URL(o) }), [o]), d = l?.displayMode === "fullscreen", f = L(null), [p, m] = R();
178
+ F(() => {
179
+ let e = f.current;
172
180
  if (!e) return;
173
181
  let t = new ResizeObserver(([e]) => {
174
182
  if (!e) return;
175
183
  let { width: t, height: n } = e.contentRect;
176
- p({
184
+ m({
177
185
  width: Math.round(t),
178
186
  height: Math.round(n)
179
187
  });
180
188
  });
181
189
  return t.observe(e), () => t.disconnect();
182
190
  }, []);
183
- let { appBridge: m, hasFailed: h } = be(e, d, F(() => c == null || f == null ? c : {
184
- ...c,
185
- containerDimensions: f
186
- }, [c, f])), _ = h || n === "error";
187
- return /* @__PURE__ */ z("div", {
188
- ref: d,
189
- className: g("relative h-full w-full", u && W.fullscreenFrame),
191
+ let { appBridge: h, hasFailed: _ } = Ce(e, f, I(() => l == null || p == null ? l : {
192
+ ...l,
193
+ containerDimensions: p
194
+ }, [l, p])), v = _ || r === "error";
195
+ return /* @__PURE__ */ B("div", {
196
+ ref: f,
197
+ className: g("relative h-full min-h-[200px] w-full", d && W.fullscreenFrame),
190
198
  children: [
191
- m != null && /* @__PURE__ */ R(le, {
192
- html: i,
193
- sandbox: l,
194
- appBridge: m,
195
- toolInput: o,
196
- toolResult: s,
197
- onSizeChanged: () => r("ready"),
198
- onInitialized: () => r("ready"),
199
- onError: () => r("error")
199
+ h != null && /* @__PURE__ */ z(H, {
200
+ html: a,
201
+ sandbox: u,
202
+ appBridge: h,
203
+ toolInput: s,
204
+ toolResult: c,
205
+ onSizeChanged: () => i("ready"),
206
+ onInitialized: (e) => {
207
+ i("ready"), e.appVersion != null && n?.(e.appVersion);
208
+ },
209
+ onError: () => i("error")
200
210
  }),
201
- !_ && n === "loading" && /* @__PURE__ */ R("div", {
211
+ !v && r === "loading" && /* @__PURE__ */ z("div", {
202
212
  className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", W.loadingOverlay),
203
- children: /* @__PURE__ */ R(T, {})
213
+ children: /* @__PURE__ */ z(E, {})
204
214
  }),
205
- _ && /* @__PURE__ */ z("div", {
215
+ v && /* @__PURE__ */ B("div", {
206
216
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
207
- children: [/* @__PURE__ */ R(E, {
217
+ children: [/* @__PURE__ */ z(D, {
208
218
  size: 60,
209
219
  stroke: S,
210
220
  "aria-hidden": !0,
211
221
  className: W.errorIcon
212
- }), /* @__PURE__ */ R("p", {
222
+ }), /* @__PURE__ */ z("p", {
213
223
  role: "alert",
214
224
  className: g("text-center", W.statusLabel),
215
225
  children: t
@@ -225,16 +235,16 @@ var de = {
225
235
  statusOverlay: "_statusOverlay_1w97n_24",
226
236
  errorIcon: "_errorIcon_1w97n_29",
227
237
  highlight: "_highlight_1w97n_37"
228
- }, Se = (e) => {
238
+ }, Te = (e) => {
229
239
  if (e?.kind !== "range") return "";
230
240
  let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
231
241
  if (n == null) return "";
232
242
  let r = n.formula;
233
243
  return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
234
- }, Ce = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
244
+ }, Ee = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
235
245
  switch (t) {
236
246
  case r.Docx: {
237
- let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("./docx-B-VcIRoc.js"), import("./chart-ex-DsESBs97.js")]);
247
+ let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/docx"), import("@silurus/ooxml/chart-ex")]);
238
248
  return new t(e, {
239
249
  enableTextSelection: !0,
240
250
  refitOnResize: !0,
@@ -243,7 +253,7 @@ var de = {
243
253
  });
244
254
  }
245
255
  case r.Xlsx: {
246
- let [{ XlsxViewer: t }, { chartEx: r }] = await Promise.all([import("./xlsx-Dn0XSlTO.js"), import("./chart-ex-DsESBs97.js")]);
256
+ let [{ XlsxViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/xlsx"), import("@silurus/ooxml/chart-ex")]);
247
257
  return new t(e, {
248
258
  showZoomSlider: !0,
249
259
  chartEx: r,
@@ -252,7 +262,7 @@ var de = {
252
262
  });
253
263
  }
254
264
  case r.Csv: {
255
- let { XlsxSheetViewer: t } = await import("./xlsx-Dn0XSlTO.js"), r = document.createElement("canvas");
265
+ let { XlsxSheetViewer: t } = await import("@silurus/ooxml/xlsx"), r = document.createElement("canvas");
256
266
  r.className = G.spreadsheetCanvas, e.replaceChildren(r);
257
267
  let i = new t(r, {
258
268
  showScrollbars: !0,
@@ -264,7 +274,7 @@ var de = {
264
274
  };
265
275
  }
266
276
  case r.Pptx: {
267
- let [{ PptxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("./pptx-CnoDB8Fv.js"), import("./chart-ex-DsESBs97.js")]);
277
+ let [{ PptxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/pptx"), import("@silurus/ooxml/chart-ex")]);
268
278
  return new t(e, {
269
279
  enableTextSelection: !0,
270
280
  refitOnResize: !0,
@@ -273,16 +283,16 @@ var de = {
273
283
  });
274
284
  }
275
285
  }
276
- }, we = async (e, t, n, i) => {
286
+ }, De = async (e, t, n, i) => {
277
287
  let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = n;
278
288
  switch (t.format) {
279
289
  case r.Docx: {
280
290
  let [{ DocxDocument: n, DocxScrollViewer: r }, { chartEx: o }, { createDocxHighlightSurface: c }] = await Promise.all([
281
- import("./docx-B-VcIRoc.js"),
282
- import("./chart-ex-DsESBs97.js"),
283
- import("./ooxml-highlight-surfaces-CaMjx8u-.js")
291
+ import("@silurus/ooxml/docx"),
292
+ import("@silurus/ooxml/chart-ex"),
293
+ import("./ooxml-highlight-surfaces-BzgOKpBV.js")
284
294
  ]), l = await n.load(t.url, { chartEx: o });
285
- if (i()) throw l.destroy(), new Te();
295
+ if (i()) throw l.destroy(), new Oe();
286
296
  let u = r.fromDocument(e, l, {
287
297
  enableTextSelection: !0,
288
298
  refitOnResize: !0,
@@ -298,11 +308,11 @@ var de = {
298
308
  }
299
309
  case r.Pptx: {
300
310
  let [{ PptxPresentation: n, PptxScrollViewer: r }, { chartEx: o }, { createPptxHighlightSurface: c }] = await Promise.all([
301
- import("./pptx-CnoDB8Fv.js"),
302
- import("./chart-ex-DsESBs97.js"),
303
- import("./ooxml-highlight-surfaces-CaMjx8u-.js")
311
+ import("@silurus/ooxml/pptx"),
312
+ import("@silurus/ooxml/chart-ex"),
313
+ import("./ooxml-highlight-surfaces-BzgOKpBV.js")
304
314
  ]), l = await n.load(t.url, { chartEx: o });
305
- if (i()) throw l.destroy(), new Te();
315
+ if (i()) throw l.destroy(), new Oe();
306
316
  let u = r.fromPresentation(e, l, {
307
317
  enableTextSelection: !0,
308
318
  refitOnResize: !0,
@@ -318,9 +328,9 @@ var de = {
318
328
  }
319
329
  case r.Xlsx: {
320
330
  let [{ XlsxViewer: n }, { chartEx: r }, { createXlsxHighlightSurface: c }] = await Promise.all([
321
- import("./xlsx-Dn0XSlTO.js"),
322
- import("./chart-ex-DsESBs97.js"),
323
- import("./ooxml-highlight-surfaces-CaMjx8u-.js")
331
+ import("@silurus/ooxml/xlsx"),
332
+ import("@silurus/ooxml/chart-ex"),
333
+ import("./ooxml-highlight-surfaces-BzgOKpBV.js")
324
334
  ]), l = new n(e, {
325
335
  showZoomSlider: !0,
326
336
  chartEx: r,
@@ -336,15 +346,15 @@ var de = {
336
346
  };
337
347
  }
338
348
  case r.Csv: {
339
- let r = await Ce(e, t.format, n);
349
+ let r = await Ee(e, t.format, n);
340
350
  return await r.load(t.url), { viewer: r };
341
351
  }
342
352
  }
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);
353
+ }, Oe = class extends Error {}, ke = ({ content: t, fileName: n, loadErrorLabel: i, formulaLabel: a, formulaLabelClassName: o, highlightsLabel: s = "Cited locations", highlightNavigatedLabel: c = "Scrolled to the cited location" }) => {
354
+ let l = L(null), [u, d] = R(!0), [f, p] = R(!1), [m, h] = R(""), [_, v] = R([]), [y, b] = R(!1), { highlights: x, selectedHighlightId: C } = t, w = x != null && x.length > 0, T = L(void 0), O = L(x);
345
355
  O.current = x;
346
- let k = I(void 0);
347
- return P(() => {
356
+ let k = L(void 0);
357
+ return F(() => {
348
358
  let e = l.current;
349
359
  if (e == null) return;
350
360
  let n, r, i = !1, a, o = () => i;
@@ -366,7 +376,7 @@ var de = {
366
376
  i || (d(!1), p(!0));
367
377
  },
368
378
  onXlsxSelectionContextChange: (e) => {
369
- i || h(Se(e));
379
+ i || h(Te(e));
370
380
  },
371
381
  onGeometryInvalidated: s
372
382
  }, f = () => {
@@ -375,38 +385,38 @@ var de = {
375
385
  return e.addEventListener("scroll", s, !0), k.current = s, (async () => {
376
386
  try {
377
387
  if (w) {
378
- let r = await we(e, t, u, o);
388
+ let r = await De(e, t, u, o);
379
389
  if (i) {
380
390
  r.viewer.destroy(), r.engine?.destroy();
381
391
  return;
382
392
  }
383
- n = r, D.current = r.highlights, f();
393
+ n = r, T.current = r.highlights, f();
384
394
  } else {
385
- let r = await Ce(e, t.format, u);
395
+ let r = await Ee(e, t.format, u);
386
396
  if (i) {
387
397
  r.destroy();
388
398
  return;
389
399
  }
390
- n = { viewer: r }, D.current = void 0, f(), await r.load(t.url);
400
+ n = { viewer: r }, T.current = void 0, f(), await r.load(t.url);
391
401
  }
392
402
  if (i) return;
393
403
  d(!1), await c();
394
404
  } 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);
405
+ if (t instanceof Oe || i) return;
406
+ n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, T.current = void 0, e.replaceChildren(), d(!1), p(!0);
397
407
  }
398
408
  })(), () => {
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();
409
+ i = !0, e.removeEventListener("scroll", s, !0), a != null && cancelAnimationFrame(a), k.current = void 0, r?.disconnect(), n?.viewer.destroy(), n?.engine?.destroy(), T.current = void 0, e.replaceChildren();
400
410
  };
401
411
  }, [
402
412
  t.format,
403
413
  t.url,
404
414
  w
405
- ]), P(() => {
415
+ ]), F(() => {
406
416
  k.current?.();
407
- }, [x]), P(() => {
417
+ }, [x]), F(() => {
408
418
  b(!1);
409
- let t = D.current;
419
+ let t = T.current;
410
420
  if (t == null || u) return;
411
421
  let n = (O.current?.find(({ id: e }) => e === C))?.locations.at(0);
412
422
  if (n == null) return;
@@ -422,18 +432,18 @@ var de = {
422
432
  })(), () => {
423
433
  r = !0;
424
434
  };
425
- }, [C, u]), /* @__PURE__ */ z("div", {
435
+ }, [C, u]), /* @__PURE__ */ B("div", {
426
436
  className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
427
437
  children: [
428
- t.format === r.Xlsx && /* @__PURE__ */ z("div", {
438
+ t.format === r.Xlsx && /* @__PURE__ */ B("div", {
429
439
  role: "region",
430
440
  "aria-label": a,
431
441
  className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", G.formulaPanel),
432
- children: [/* @__PURE__ */ R("span", {
442
+ children: [/* @__PURE__ */ z("span", {
433
443
  "aria-hidden": "true",
434
444
  className: g("shrink-0", o),
435
445
  children: "fx"
436
- }), /* @__PURE__ */ R("code", {
446
+ }), /* @__PURE__ */ z("code", {
437
447
  dir: "ltr",
438
448
  tabIndex: 0,
439
449
  "aria-live": "polite",
@@ -441,19 +451,19 @@ var de = {
441
451
  children: m
442
452
  })]
443
453
  }),
444
- /* @__PURE__ */ z("div", {
454
+ /* @__PURE__ */ B("div", {
445
455
  className: "relative min-h-0 w-full flex-1",
446
- children: [/* @__PURE__ */ R("div", {
456
+ children: [/* @__PURE__ */ z("div", {
447
457
  ref: l,
448
458
  role: "document",
449
459
  "aria-label": n,
450
460
  "aria-busy": u,
451
461
  className: g("h-full w-full overflow-hidden", G.viewer)
452
- }), _.length > 0 && /* @__PURE__ */ R("div", {
462
+ }), _.length > 0 && /* @__PURE__ */ z("div", {
453
463
  role: "region",
454
464
  "aria-label": s,
455
465
  className: "pointer-events-none absolute inset-0 overflow-hidden",
456
- children: _.map((e, t) => /* @__PURE__ */ R("div", {
466
+ children: _.map((e, t) => /* @__PURE__ */ z("div", {
457
467
  "aria-hidden": "true",
458
468
  style: {
459
469
  left: `${e.left}px`,
@@ -467,24 +477,24 @@ var de = {
467
477
  }, `${e.highlightId}-${t}`))
468
478
  })]
469
479
  }),
470
- /* @__PURE__ */ R("div", {
480
+ /* @__PURE__ */ z("div", {
471
481
  role: "status",
472
482
  "aria-live": "polite",
473
483
  className: "sr-only",
474
484
  children: y ? c : ""
475
485
  }),
476
- (u || f) && /* @__PURE__ */ R("div", {
486
+ (u || f) && /* @__PURE__ */ z("div", {
477
487
  role: f ? "alert" : void 0,
478
488
  "aria-live": "polite",
479
489
  className: g("absolute inset-0 flex items-center justify-center", G.statusOverlay),
480
- children: u ? /* @__PURE__ */ R(T, { size: 48 }) : /* @__PURE__ */ z("div", {
490
+ children: u ? /* @__PURE__ */ z(E, { size: 48 }) : /* @__PURE__ */ B("div", {
481
491
  className: "flex flex-col items-center gap-2",
482
- children: [/* @__PURE__ */ R(E, {
492
+ children: [/* @__PURE__ */ z(D, {
483
493
  "aria-hidden": "true",
484
494
  size: 60,
485
495
  stroke: S,
486
496
  className: G.errorIcon
487
- }), /* @__PURE__ */ R("p", {
497
+ }), /* @__PURE__ */ z("p", {
488
498
  className: "text-center",
489
499
  children: i
490
500
  })]
@@ -492,70 +502,86 @@ var de = {
492
502
  })
493
503
  ]
494
504
  });
495
- }, De = {
505
+ }, Ae = {
496
506
  loadingOverlay: "_loadingOverlay_12637_1",
497
507
  statusLabel: "_statusLabel_12637_5",
498
508
  errorIcon: "_errorIcon_12637_9"
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
- let e = i.current;
509
+ }, je = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: a }) => {
510
+ let o = L(null), [s, c] = R("loading"), { url: l, visualizerName: u, requestTimeout: d } = e, f = L(e);
511
+ return f.current = e, F(() => {
512
+ let e = o.current;
503
513
  if (!e) return;
504
- o("loading");
505
- let t = new H(e, {
506
- domain: s,
514
+ c("loading");
515
+ let t = new fe(e, {
516
+ domain: l,
507
517
  hostDomain: window.location.origin,
508
- visualizerName: c,
509
- requestTimeout: l
518
+ visualizerName: u,
519
+ requestTimeout: d
510
520
  }), n = !0;
511
521
  return (async () => {
512
522
  if (await t.ready(), !n) return;
513
- let { mimeType: e, layout: r, data: i } = u.current, a = {
514
- layout: r,
515
- ...typeof i == "object" && i ? i : {}
516
- };
517
- await t.send(V.sendVisualizeData, {
518
- mimeType: e,
519
- visualizerData: a
520
- }), n && o("ready");
523
+ let e = f.current;
524
+ if (e.type === i.GroupedVisualizer) await t.send(de.sendGroupedVisualizeData, {
525
+ attachments: e.attachments,
526
+ layout: e.layout
527
+ });
528
+ else {
529
+ let { mimeType: n, layout: r, data: i } = e, a = {
530
+ layout: r,
531
+ ...typeof i == "object" && i ? i : {}
532
+ };
533
+ await t.send(de.sendVisualizeData, {
534
+ mimeType: n,
535
+ visualizerData: a
536
+ });
537
+ }
538
+ n && c("ready");
521
539
  })().catch(() => {
522
- n && o("error");
540
+ n && c("error");
523
541
  }), () => {
524
542
  n = !1, t.destroy();
525
543
  };
526
544
  }, [
527
- s,
528
- c,
529
- l
530
- ]), /* @__PURE__ */ z("div", {
545
+ l,
546
+ u,
547
+ d
548
+ ]), F(() => {
549
+ let e = r ?? u.trim();
550
+ e !== "" && o.current?.querySelector("iframe")?.setAttribute("title", e);
551
+ }, [
552
+ r,
553
+ u,
554
+ l,
555
+ d
556
+ ]), /* @__PURE__ */ B("div", {
531
557
  className: "relative h-full w-full",
532
558
  style: m({
533
- "--vs-loading-bg": r?.loadingBackground,
534
- "--vs-status-text": r?.statusText,
535
- "--vs-error-icon": r?.errorIcon
559
+ "--vs-loading-bg": a?.loadingBackground,
560
+ "--vs-status-text": a?.statusText,
561
+ "--vs-error-icon": a?.errorIcon
536
562
  }),
537
563
  children: [
538
- /* @__PURE__ */ R("div", {
539
- ref: i,
564
+ /* @__PURE__ */ z("div", {
565
+ ref: o,
540
566
  className: "h-full w-full"
541
567
  }),
542
- a === "loading" && /* @__PURE__ */ z("div", {
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),
568
+ s === "loading" && /* @__PURE__ */ B("div", {
569
+ className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", Ae.loadingOverlay),
570
+ children: [/* @__PURE__ */ z(E, {}), t && /* @__PURE__ */ z("p", {
571
+ className: g("text-center", Ae.statusLabel),
546
572
  children: t
547
573
  })]
548
574
  }),
549
- a === "error" && /* @__PURE__ */ z("div", {
575
+ s === "error" && /* @__PURE__ */ B("div", {
550
576
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
551
- children: [/* @__PURE__ */ R(E, {
577
+ children: [/* @__PURE__ */ z(D, {
552
578
  size: 60,
553
579
  stroke: S,
554
580
  "aria-hidden": !0,
555
- className: De.errorIcon
556
- }), /* @__PURE__ */ R("p", {
581
+ className: Ae.errorIcon
582
+ }), /* @__PURE__ */ z("p", {
557
583
  role: "alert",
558
- className: g("text-center", De.statusLabel),
584
+ className: g("text-center", Ae.statusLabel),
559
585
  children: n
560
586
  })]
561
587
  })
@@ -576,34 +602,34 @@ var de = {
576
602
  jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
577
603
  jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
578
604
  jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
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(() => {
605
+ }, Me = () => M(async () => ({ default: (await import("./PdfContent-BoAtghsO.js")).PdfContent })), Ne = ({ url: e, fileName: t, loadErrorLabel: n }) => {
606
+ let [r, i] = R(!1);
607
+ return F(() => {
582
608
  i(!1);
583
- }, [e]), r ? /* @__PURE__ */ z("div", {
609
+ }, [e]), r ? /* @__PURE__ */ B("div", {
584
610
  className: "flex flex-col items-center gap-2",
585
- children: [/* @__PURE__ */ R(E, {
611
+ children: [/* @__PURE__ */ z(D, {
586
612
  size: 60,
587
613
  stroke: S,
588
614
  className: K.errorIcon
589
- }), /* @__PURE__ */ R("p", {
615
+ }), /* @__PURE__ */ z("p", {
590
616
  className: g("text-center", K.statusLabel),
591
617
  children: n
592
618
  })]
593
- }) : /* @__PURE__ */ R("img", {
619
+ }) : /* @__PURE__ */ z("img", {
594
620
  src: e,
595
621
  alt: t ?? "",
596
622
  className: "max-h-full max-w-full object-contain",
597
623
  onError: () => i(!0)
598
624
  });
599
- }, je = new Set([
625
+ }, Pe = new Set([
600
626
  i.PlainText,
601
627
  i.Code,
602
628
  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
- he((e) => e + 1);
606
- }, []), U = H?.fontClassName != null, ye = F(() => ({
629
+ ]), Fe = N(({ 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: T = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: k, codeContentRetryLabel: ee, tableCopyLabel: A, tableCopiedLabel: te, tableDownloadCsvLabel: ne, ooxmlHighlightsLabel: ie, ooxmlHighlightNavigatedLabel: ae } = {}, styles: j, codeBlockTheme: M, tableDownloadFilename: N, loadPdf: oe, hidePdfToolbar: F = !1, configurePdfWorker: L, onAppInfo: le }) => {
630
+ let { colors: V, typography: H, bodyClassName: ue, cssVars: de } = j ?? {}, [fe, pe] = R(0), me = I(Me, [fe]), he = P(() => {
631
+ pe((e) => e + 1);
632
+ }, []), U = H?.fontClassName != null, _e = I(() => ({
607
633
  ...m({
608
634
  "--ac-text": V?.text,
609
635
  "--ac-status-text": V?.statusText,
@@ -634,8 +660,8 @@ var de = {
634
660
  "--ac-line-height": U ? void 0 : H?.lineHeight,
635
661
  "--ac-letter-spacing": U ? void 0 : H?.letterSpacing
636
662
  }),
637
- ...fe
638
- }), [P]), be = F(() => {
663
+ ...de
664
+ }), [j]), ye = I(() => {
639
665
  switch (e.type) {
640
666
  case i.Image:
641
667
  case i.Audio:
@@ -645,6 +671,7 @@ var de = {
645
671
  case i.Pdf:
646
672
  case i.Ooxml:
647
673
  case i.Visualizer:
674
+ case i.GroupedVisualizer:
648
675
  case i.McpApp:
649
676
  case i.Code:
650
677
  case i.Html: return "h-full overflow-hidden";
@@ -652,38 +679,38 @@ var de = {
652
679
  case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
653
680
  default: return "h-full overflow-auto p-4";
654
681
  }
655
- }, [e.type]), W = F(() => {
682
+ }, [e.type]), be = I(() => {
656
683
  switch (e.type) {
657
- case i.PlainText: return /* @__PURE__ */ R("pre", {
684
+ case i.PlainText: return /* @__PURE__ */ z("pre", {
658
685
  className: g("whitespace-pre-wrap break-words", K.body, H?.fontClassName),
659
686
  children: e.text
660
687
  });
661
- case i.Image: return /* @__PURE__ */ R(Ae, {
688
+ case i.Image: return /* @__PURE__ */ z(Ne, {
662
689
  url: e.url,
663
690
  fileName: r,
664
691
  loadErrorLabel: c
665
692
  });
666
- case i.Audio: return /* @__PURE__ */ R("audio", {
693
+ case i.Audio: return /* @__PURE__ */ z("audio", {
667
694
  controls: !0,
668
695
  src: e.url,
669
696
  "aria-label": r ?? "Audio attachment",
670
697
  className: "w-full max-w-sm",
671
698
  preload: "metadata",
672
- children: e.mimeType && /* @__PURE__ */ R("source", {
699
+ children: e.mimeType && /* @__PURE__ */ z("source", {
673
700
  src: e.url,
674
701
  type: e.mimeType
675
702
  })
676
703
  });
677
- case i.Markdown: return /* @__PURE__ */ R(p, {
704
+ case i.Markdown: return /* @__PURE__ */ z(p, {
678
705
  content: e.text,
679
706
  isStreaming: !1,
680
- codeBlockTheme: I,
707
+ codeBlockTheme: M,
681
708
  classNames: u
682
709
  });
683
- case i.MarkdownTable: return /* @__PURE__ */ R(p, {
710
+ case i.MarkdownTable: return /* @__PURE__ */ z(p, {
684
711
  content: e.text,
685
712
  isStreaming: !1,
686
- codeBlockTheme: I,
713
+ codeBlockTheme: M,
687
714
  containerClassName: "flex h-full min-h-0 flex-col",
688
715
  classNames: {
689
716
  ...u,
@@ -691,24 +718,22 @@ var de = {
691
718
  tableScrollContainer: "max-h-full"
692
719
  },
693
720
  tableActionLabels: {
694
- copyCsvLabel: te,
695
- copyTxtLabel: re,
696
- copyMarkdownLabel: ie,
697
- copiedLabel: ae,
698
- downloadCsvLabel: A
721
+ copyLabel: A,
722
+ copiedLabel: te,
723
+ downloadCsvLabel: ne
699
724
  },
700
- tableDownloadFilename: ce
725
+ tableDownloadFilename: N
701
726
  });
702
- case i.Json: return /* @__PURE__ */ R("div", {
727
+ case i.Json: return /* @__PURE__ */ z("div", {
703
728
  dir: "ltr",
704
729
  className: "h-full overflow-auto",
705
- children: /* @__PURE__ */ R("div", {
730
+ children: /* @__PURE__ */ z("div", {
706
731
  className: g("m-3 overflow-auto rounded-md border", K.jsonWrapper),
707
- children: /* @__PURE__ */ R(oe, {
732
+ children: /* @__PURE__ */ z(se, {
708
733
  data: e.value,
709
734
  style: {
710
735
  container: g("whitespace-pre-wrap break-words p-2", H?.jsonClassName ?? "dial-code-text"),
711
- basicChildStyle: se.basicChildStyle,
736
+ basicChildStyle: ce.basicChildStyle,
712
737
  childFieldsContainer: "m-0 ps-3",
713
738
  label: g("me-1 font-semibold", K.jsonLabel),
714
739
  clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", K.jsonClickableLabel),
@@ -726,16 +751,16 @@ var de = {
726
751
  })
727
752
  })
728
753
  });
729
- case i.Code: return /* @__PURE__ */ R(me, {
754
+ case i.Code: return /* @__PURE__ */ z(ge, {
730
755
  content: e,
731
- codeBlockTheme: I,
756
+ codeBlockTheme: M,
732
757
  labels: {
733
758
  loadingLabel: O,
734
759
  errorLabel: k,
735
760
  retryLabel: ee
736
761
  }
737
762
  });
738
- case i.Html: return /* @__PURE__ */ R(ge, {
763
+ case i.Html: return /* @__PURE__ */ z(ve, {
739
764
  content: e,
740
765
  labels: {
741
766
  htmlFrameBlockedLabel: f,
@@ -743,25 +768,25 @@ var de = {
743
768
  },
744
769
  isSourceView: a,
745
770
  title: r,
746
- codeBlockTheme: I
771
+ codeBlockTheme: M
747
772
  });
748
- case i.Pdf: return /* @__PURE__ */ R(s, {
749
- retryKey: pe,
750
- onRetry: ve,
773
+ case i.Pdf: return /* @__PURE__ */ z(s, {
774
+ retryKey: fe,
775
+ onRetry: he,
751
776
  labels: {
752
777
  loadingLabel: x,
753
778
  errorLabel: C,
754
779
  retryLabel: w
755
780
  },
756
- children: /* @__PURE__ */ R(_e, {
781
+ children: /* @__PURE__ */ z(me, {
757
782
  fileName: r,
758
783
  url: e.url,
759
784
  highlights: e.highlights ?? [],
760
785
  selectedHighlightId: e.selectedHighlightId,
761
786
  selectedPageNumber: e.page,
762
- loadPdf: B,
763
- hideHeader: le,
764
- configurePdfWorker: ue,
787
+ loadPdf: oe,
788
+ hideHeader: F,
789
+ configurePdfWorker: L,
765
790
  labels: {
766
791
  thumbnailsLabel: _,
767
792
  showThumbnailsLabel: v,
@@ -773,33 +798,37 @@ var de = {
773
798
  }
774
799
  })
775
800
  }, e.url);
776
- case i.Ooxml: return /* @__PURE__ */ R(Ee, {
801
+ case i.Ooxml: return /* @__PURE__ */ z(ke, {
777
802
  content: e,
778
803
  fileName: r,
779
804
  loadErrorLabel: c,
780
- formulaLabel: D,
805
+ formulaLabel: T,
781
806
  formulaLabelClassName: H?.xlsxFormulaLabelClassName ?? "dial-italic-text",
782
- highlightsLabel: j,
783
- highlightNavigatedLabel: N
807
+ highlightsLabel: ie,
808
+ highlightNavigatedLabel: ae
784
809
  });
785
- case i.Visualizer: return /* @__PURE__ */ R(Oe, {
810
+ case i.Visualizer:
811
+ case i.GroupedVisualizer: return /* @__PURE__ */ z(je, {
786
812
  content: e,
787
813
  errorLabel: d
788
814
  });
789
- case i.McpApp: return /* @__PURE__ */ R(xe, { content: e });
790
- case i.Unsupported: return /* @__PURE__ */ R("p", {
815
+ case i.McpApp: return /* @__PURE__ */ z(we, {
816
+ content: e,
817
+ onAppInfo: le
818
+ });
819
+ case i.Unsupported: return /* @__PURE__ */ z("p", {
791
820
  className: g("text-center", K.statusLabel),
792
821
  children: o
793
822
  });
794
823
  case i.Error: {
795
824
  let t = e.errorType === n.Forbidden;
796
- return /* @__PURE__ */ z("div", {
825
+ return /* @__PURE__ */ B("div", {
797
826
  className: "flex flex-col items-center gap-2",
798
- children: [R(t ? ne : E, {
827
+ children: [z(t ? re : D, {
799
828
  size: 60,
800
829
  stroke: S,
801
830
  className: K.errorIcon
802
- }), /* @__PURE__ */ R("p", {
831
+ }), /* @__PURE__ */ z("p", {
803
832
  className: g("text-center", K.statusLabel),
804
833
  children: t ? l : c
805
834
  })]
@@ -812,7 +841,7 @@ var de = {
812
841
  H?.jsonClassName,
813
842
  H?.xlsxFormulaLabelClassName,
814
843
  r,
815
- I,
844
+ M,
816
845
  o,
817
846
  c,
818
847
  l,
@@ -820,10 +849,11 @@ var de = {
820
849
  f,
821
850
  h,
822
851
  a,
823
- ce,
824
- B,
852
+ N,
853
+ oe,
854
+ F,
855
+ L,
825
856
  le,
826
- ue,
827
857
  _,
828
858
  v,
829
859
  y,
@@ -831,68 +861,86 @@ var de = {
831
861
  x,
832
862
  C,
833
863
  w,
834
- D,
864
+ T,
835
865
  O,
836
866
  k,
837
867
  ee,
838
- _e,
839
- pe,
840
- ve,
868
+ me,
869
+ fe,
870
+ he,
871
+ A,
841
872
  te,
842
- re,
873
+ ne,
843
874
  ie,
844
- ae,
845
- A,
846
- j,
847
- N
875
+ ae
848
876
  ]);
849
- return /* @__PURE__ */ R("div", {
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
877
+ return /* @__PURE__ */ z("div", {
878
+ style: !t && Pe.has(e.type) ? _e : void 0,
879
+ className: g(t ? "flex h-full items-center justify-center" : ye, ue),
880
+ children: t ? /* @__PURE__ */ z(E, {}) : be
853
881
  });
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(() => () => {
882
+ }), Ie = {
883
+ mcpAppDivider: "_mcpAppDivider_1jh5p_1",
884
+ mcpAppVersion: "_mcpAppVersion_1jh5p_5"
885
+ }, Le = 2e3, Re = N(({ 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: h = "Copied!", copyJsonLabel: _ = "Copy as JSON", copiedJsonLabel: v = "Copied!", visualizerErrorLabel: C, unsupportedLabel: T = "Preview is not supported for this file", loadErrorLabel: E = "Failed to load file", forbiddenErrorLabel: D = "You don't have permission to access this file", htmlFrameBlockedLabel: O = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: re = "Open in new tab", htmlViewSourceLabel: j = "View source", htmlViewRenderedLabel: M = "View rendered", mcpAppReloadLabel: N = "Reload", pdfThumbnailsLabel: oe, pdfShowThumbnailsLabel: se, pdfHideThumbnailsLabel: ce, pdfPageNumberLabel: V, pdfContentLoadingLabel: H, pdfContentErrorLabel: ue, pdfContentRetryLabel: de, xlsxFormulaLabel: fe, codeContentLoadingLabel: me, codeContentErrorLabel: he, codeContentRetryLabel: U, tableCopyLabel: ge, tableCopiedLabel: _e, tableDownloadCsvLabel: ve, ooxmlHighlightsLabel: ye, ooxmlHighlightNavigatedLabel: be }, onDownload: xe, onCopyText: Se, onCopyMarkdown: Ce, onCopyJson: W, tableDownloadFilename: we, isMobile: G = !1, defaultWidth: Te, minWidth: Ee = 600, maxWidth: De = 1500, onResizeStop: Oe, styles: ke, codeBlockTheme: Ae, loadPdf: je, configurePdfWorker: K }) => {
886
+ let [Me, Ne] = R(!1), [Pe, Re] = R(!1), [ze, q] = R(!1), [J, Be] = R(!1), [Ve, He] = R(void 0), Y = L(null), X = L(null), Z = L(null), Ue = P(() => {
887
+ Se?.(), Y.current != null && clearTimeout(Y.current), Ne(!0), Y.current = setTimeout(() => Ne(!1), Le);
888
+ }, [Se]), We = P(() => {
889
+ Ce?.(), X.current != null && clearTimeout(X.current), Re(!0), X.current = setTimeout(() => Re(!1), Le);
890
+ }, [Ce]), Ge = P(() => {
891
+ W?.(), Z.current != null && clearTimeout(Z.current), q(!0), Z.current = setTimeout(() => q(!1), Le);
892
+ }, [W]);
893
+ F(() => () => {
863
894
  Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
864
895
  }, []);
865
- let Q = M(() => {
866
- Re((e) => !e);
896
+ let Ke = P(() => {
897
+ Be((e) => !e);
867
898
  }, []);
868
- P(() => {
869
- Re(!1);
899
+ F(() => {
900
+ Be(!1), He(void 0);
870
901
  }, [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, {
902
+ let { className: Q, panelStyles: qe, ...Je } = ke ?? {}, { colors: $, typography: Ye } = Je, Xe = I(() => m({
903
+ "--ac-mcp-app-divider": $?.mcpAppDividerColor,
904
+ "--ac-mcp-app-version": $?.mcpAppVersionColor
905
+ }), [$?.mcpAppDividerColor, $?.mcpAppVersionColor]), Ze = r.type === i.McpApp && Ve != null ? /* @__PURE__ */ B("span", {
906
+ style: Xe,
907
+ children: [
908
+ /* @__PURE__ */ z("span", { children: a }),
909
+ /* @__PURE__ */ z("span", {
910
+ "aria-hidden": !0,
911
+ className: g("mx-1.5 inline-block h-3 w-0 border-s align-middle", Ie.mcpAppDivider)
912
+ }),
913
+ /* @__PURE__ */ z("span", { children: Ve.name }),
914
+ Ve.version && /* @__PURE__ */ z("span", {
915
+ className: g("ms-2", Ye?.mcpAppVersionClassName ?? "dial-caption-text", Ie.mcpAppVersion),
916
+ children: Ve.version
917
+ })
918
+ ]
919
+ }) : a, Qe = !t && r.type === i.Html && r.srcdoc != null, $e = !t && Se != null && (r.type === i.PlainText || r.type === i.Code), et = !t && Ce != null && r.type === i.Markdown, tt = !t && W != null && r.type === i.Json, nt = !t && xe != null && o(r), rt = !t && r.type === i.McpApp && r.onReload != null;
920
+ return /* @__PURE__ */ z(b, {
873
921
  isOpen: e,
874
922
  orientation: y.Right,
875
- title: a,
923
+ title: Ze,
876
924
  labels: {
877
925
  ariaLabel: s,
878
926
  closeLabel: c,
879
927
  resizeLabel: l
880
928
  },
881
929
  onClose: n,
882
- resizable: !Ce,
883
- defaultWidth: we,
884
- minWidth: Te,
885
- maxWidth: Ee,
886
- onResizeStop: De,
930
+ resizable: !G,
931
+ defaultWidth: Te,
932
+ minWidth: Ee,
933
+ maxWidth: De,
934
+ onResizeStop: Oe,
887
935
  styles: {
888
- ...Ue,
889
- titleClassName: Ue?.titleClassName ?? "dial-h3-text",
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)
936
+ ...qe,
937
+ titleClassName: qe?.titleClassName ?? "dial-h3-text",
938
+ headerClassName: g("border-b border-tertiary", qe?.headerClassName),
939
+ className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", Q, qe?.className, pe.panel)
892
940
  },
893
- rightActions: Ge || Ke || qe || $ || Je || Ye ? /* @__PURE__ */ z(ce, { children: [
894
- Ye && /* @__PURE__ */ R(C, {
895
- icon: /* @__PURE__ */ R(ie, {
941
+ rightActions: Qe || $e || et || tt || nt || rt ? /* @__PURE__ */ B(le, { children: [
942
+ rt && /* @__PURE__ */ z(w, {
943
+ icon: /* @__PURE__ */ z(ae, {
896
944
  size: x.LG,
897
945
  stroke: S,
898
946
  "aria-hidden": !0
@@ -901,239 +949,131 @@ var de = {
901
949
  tooltipProps: { tooltip: N },
902
950
  onClick: r.type === i.McpApp ? r.onReload : void 0
903
951
  }),
904
- Ge && /* @__PURE__ */ R(C, {
905
- icon: R(J ? te : O, {
952
+ Qe && /* @__PURE__ */ z(w, {
953
+ icon: z(J ? ne : ee, {
906
954
  size: x.LG,
907
955
  stroke: S,
908
956
  "aria-hidden": !0
909
957
  }),
910
- "aria-label": J ? j : A,
958
+ "aria-label": J ? M : j,
911
959
  "aria-pressed": J,
912
- tooltipProps: { tooltip: J ? j : A },
913
- onClick: Q
960
+ tooltipProps: { tooltip: J ? M : j },
961
+ onClick: Ke
914
962
  }),
915
- Ke && /* @__PURE__ */ R(C, {
916
- icon: R(je ? D : k, {
963
+ $e && /* @__PURE__ */ z(w, {
964
+ icon: z(Me ? k : A, {
917
965
  size: x.LG,
918
966
  stroke: S,
919
967
  "aria-hidden": !0
920
968
  }),
921
- "aria-label": je ? f : d,
922
- tooltipProps: { tooltip: je ? f : d },
923
- onClick: ze
969
+ "aria-label": Me ? f : d,
970
+ tooltipProps: { tooltip: Me ? f : d },
971
+ onClick: Ue
924
972
  }),
925
- qe && /* @__PURE__ */ R(C, {
926
- icon: R(Fe ? D : re, {
973
+ et && /* @__PURE__ */ z(w, {
974
+ icon: z(Pe ? k : ie, {
927
975
  size: x.LG,
928
976
  stroke: S,
929
977
  "aria-hidden": !0
930
978
  }),
931
- "aria-label": Fe ? m : p,
932
- tooltipProps: { tooltip: Fe ? m : p },
933
- onClick: Be
979
+ "aria-label": Pe ? h : p,
980
+ tooltipProps: { tooltip: Pe ? h : p },
981
+ onClick: We
934
982
  }),
935
- $ && /* @__PURE__ */ R(C, {
936
- icon: R(q ? D : k, {
983
+ tt && /* @__PURE__ */ z(w, {
984
+ icon: z(ze ? k : A, {
937
985
  size: x.LG,
938
986
  stroke: S,
939
987
  "aria-hidden": !0
940
988
  }),
941
- "aria-label": q ? _ : h,
942
- tooltipProps: { tooltip: q ? _ : h },
943
- onClick: Ve
989
+ "aria-label": ze ? v : _,
990
+ tooltipProps: { tooltip: ze ? v : _ },
991
+ onClick: Ge
944
992
  }),
945
- Je && /* @__PURE__ */ R(C, {
946
- icon: /* @__PURE__ */ R(ee, {
993
+ nt && /* @__PURE__ */ z(w, {
994
+ icon: /* @__PURE__ */ z(te, {
947
995
  size: x.LG,
948
996
  stroke: S
949
997
  }),
950
998
  "aria-label": u,
951
999
  tooltipProps: { tooltip: u },
952
- onClick: be
1000
+ onClick: xe
953
1001
  })
954
1002
  ] }) : null,
955
- children: /* @__PURE__ */ R(Me, {
1003
+ children: /* @__PURE__ */ z(Fe, {
956
1004
  content: r,
957
1005
  isLoading: t,
958
1006
  fileName: a,
959
1007
  isHtmlSourceView: J,
1008
+ onAppInfo: r.type === i.McpApp ? He : void 0,
960
1009
  labels: {
961
- unsupportedLabel: w,
962
- loadErrorLabel: T,
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,
1010
+ unsupportedLabel: T,
1011
+ loadErrorLabel: E,
1012
+ forbiddenErrorLabel: D,
1013
+ visualizerErrorLabel: C,
1014
+ htmlFrameBlockedLabel: O,
1015
+ htmlOpenInNewTabLabel: re,
1016
+ pdfThumbnailsLabel: oe,
1017
+ pdfShowThumbnailsLabel: se,
1018
+ pdfHideThumbnailsLabel: ce,
1019
+ pdfPageNumberLabel: V,
1020
+ pdfContentLoadingLabel: H,
972
1021
  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,
1022
+ pdfContentRetryLabel: de,
1023
+ xlsxFormulaLabel: fe,
1024
+ codeContentLoadingLabel: me,
1025
+ codeContentErrorLabel: he,
1026
+ codeContentRetryLabel: U,
1027
+ tableCopyLabel: ge,
981
1028
  tableCopiedLabel: _e,
982
1029
  tableDownloadCsvLabel: ve,
983
- ooxmlHighlightsLabel: U,
984
- ooxmlHighlightNavigatedLabel: ye
1030
+ ooxmlHighlightsLabel: ye,
1031
+ ooxmlHighlightNavigatedLabel: be
985
1032
  },
986
- styles: We,
987
- codeBlockTheme: K,
988
- tableDownloadFilename: Se,
989
- loadPdf: ke,
990
- configurePdfWorker: Ae
1033
+ styles: Je,
1034
+ codeBlockTheme: Ae,
1035
+ tableDownloadFilename: we,
1036
+ loadPdf: je,
1037
+ configurePdfWorker: K
991
1038
  })
992
1039
  });
993
- }), Fe = {
994
- type: i.PlainText,
995
- text: ""
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
- c(e), u(t), i(!0), n(!0);
1003
- }, []), f = M((e, t, r) => {
1004
- o(e), c(t), u(r), i(!1), n(!0);
1005
- }, []), p = M(() => {
1006
- o(Fe), n(!1), i(!1), u(void 0);
1007
- }, []);
1008
- return P(() => () => {
1009
- let e = Ie(a);
1010
- e != null && URL.revokeObjectURL(e);
1011
- }, [a]), /* @__PURE__ */ R(q.Provider, {
1012
- value: F(() => ({
1013
- isOpen: t,
1014
- isLoading: r,
1015
- content: a,
1016
- fileName: s,
1017
- attachmentId: l,
1018
- openCanvasLoading: d,
1019
- openCanvas: f,
1020
- closeCanvas: p
1021
- }), [
1022
- t,
1023
- r,
1024
- a,
1025
- s,
1026
- l,
1027
- d,
1028
- f,
1029
- p
1030
- ]),
1031
- children: e
1032
- });
1033
- }, J = () => {
1034
- let e = N(q);
1035
- if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
1036
- return e;
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
- labels: {
1054
- ariaLabel: l,
1055
- closeLabel: u,
1056
- downloadLabel: d,
1057
- copyTextLabel: g,
1058
- copiedTextLabel: _,
1059
- copyMarkdownLabel: v,
1060
- copiedMarkdownLabel: y,
1061
- copyJsonLabel: b,
1062
- copiedJsonLabel: x,
1063
- unsupportedLabel: f,
1064
- loadErrorLabel: p,
1065
- forbiddenErrorLabel: m,
1066
- htmlFrameBlockedLabel: S,
1067
- htmlOpenInNewTabLabel: C,
1068
- htmlViewSourceLabel: w,
1069
- htmlViewRenderedLabel: T,
1070
- pdfThumbnailsLabel: E,
1071
- pdfShowThumbnailsLabel: D,
1072
- pdfHideThumbnailsLabel: O,
1073
- pdfPageNumberLabel: k,
1074
- pdfContentLoadingLabel: ee,
1075
- pdfContentErrorLabel: te,
1076
- pdfContentRetryLabel: ne,
1077
- xlsxFormulaLabel: re,
1078
- codeContentLoadingLabel: ie,
1079
- codeContentErrorLabel: ae,
1080
- codeContentRetryLabel: A,
1081
- tableCopyCsvLabel: j,
1082
- tableCopyTxtLabel: N,
1083
- tableCopyMarkdownLabel: P,
1084
- tableCopiedLabel: F,
1085
- tableDownloadCsvLabel: I,
1086
- ooxmlHighlightsLabel: L,
1087
- ooxmlHighlightNavigatedLabel: oe
1088
- },
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
- tableDownloadFilename: s,
1094
- isMobile: t,
1095
- defaultWidth: n,
1096
- maxWidth: r,
1097
- codeBlockTheme: o,
1098
- configurePdfWorker: c
1099
- });
1100
- }), Y = new Set(["html", "htm"]), X = {
1040
+ }), ze = new Set(["html", "htm"]), q = {
1101
1041
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1102
1042
  xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1103
1043
  pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
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 = {
1044
+ }, J = 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(".")), Be = {
1105
1045
  docx: r.Docx,
1106
1046
  xlsx: r.Xlsx,
1107
1047
  pptx: r.Pptx,
1108
1048
  csv: r.Csv
1109
- }, Be = {
1110
- [X.docx]: r.Docx,
1111
- [X.xlsx]: r.Xlsx,
1112
- [X.pptx]: r.Pptx,
1113
- [f.CSV]: r.Csv
1114
1049
  }, Ve = {
1115
- [r.Docx]: X.docx,
1116
- [r.Xlsx]: X.xlsx,
1117
- [r.Pptx]: X.pptx,
1050
+ [q.docx]: r.Docx,
1051
+ [q.xlsx]: r.Xlsx,
1052
+ [q.pptx]: r.Pptx,
1053
+ [f.CSV]: r.Csv
1054
+ }, He = {
1055
+ [r.Docx]: q.docx,
1056
+ [r.Xlsx]: q.xlsx,
1057
+ [r.Pptx]: q.pptx,
1118
1058
  [r.Csv]: f.CSV
1119
- }, Q = (e, t) => {
1059
+ }, Y = (e, t) => {
1120
1060
  let n = t?.split(";", 1)[0].trim().toLowerCase();
1121
1061
  if (n != null) {
1122
- let e = Be[n];
1062
+ let e = Ve[n];
1123
1063
  if (e != null) return e;
1124
1064
  }
1125
1065
  let r = e.lastIndexOf(".");
1126
- if (r !== -1) return ze[e.slice(r + 1).toLowerCase()];
1127
- }, He = (e, t) => Q(e, t) != null, Ue = (e, t) => {
1128
- let n = Q(e, t);
1129
- return n == null ? void 0 : Ve[n];
1130
- }, We = (e) => {
1066
+ if (r !== -1) return Be[e.slice(r + 1).toLowerCase()];
1067
+ }, X = (e, t) => Y(e, t) != null, Z = (e, t) => {
1068
+ let n = Y(e, t);
1069
+ return n == null ? void 0 : He[n];
1070
+ }, Ue = (e) => {
1131
1071
  let t = e.lastIndexOf(".");
1132
- return t === -1 ? !1 : Z.has(e.slice(t + 1).toLowerCase());
1133
- }, Ge = (e) => {
1072
+ return t === -1 ? !1 : J.has(e.slice(t + 1).toLowerCase());
1073
+ }, We = (e) => {
1134
1074
  let t = e.lastIndexOf(".");
1135
- return t === -1 ? !1 : Y.has(e.slice(t + 1).toLowerCase());
1136
- }, Ke = {
1075
+ return t === -1 ? !1 : ze.has(e.slice(t + 1).toLowerCase());
1076
+ }, Ge = {
1137
1077
  xml: "xml",
1138
1078
  csv: "plaintext",
1139
1079
  tsv: "plaintext",
@@ -1181,21 +1121,187 @@ var Le = ({ children: e }) => {
1181
1121
  gitignore: "plaintext",
1182
1122
  dockerfile: "plaintext",
1183
1123
  makefile: "plaintext"
1184
- }, qe = (e) => Ke[e], $ = (e) => ({
1124
+ }, Ke = (e) => Ge[e], Q = (e) => ({
1185
1125
  type: i.Unsupported,
1186
1126
  ...e != null && { url: e }
1187
- }), Je = (e) => ({
1127
+ }), qe = (e) => ({
1188
1128
  type: i.Error,
1189
1129
  errorType: n.LoadFailed,
1190
1130
  ...e != null && { url: e }
1191
- }), Ye = (e) => ({
1131
+ }), Je = (e) => ({
1192
1132
  type: i.Error,
1193
1133
  errorType: n.Forbidden,
1194
1134
  ...e != null && { url: e }
1195
- }), Xe = (e, t) => {
1135
+ }), $ = (e) => {
1136
+ 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;
1137
+ }, Ye = (e) => {
1138
+ let t = $(e);
1139
+ t != null && URL.revokeObjectURL(t);
1140
+ }, Xe = {
1141
+ type: i.PlainText,
1142
+ text: ""
1143
+ }, Ze = j(void 0);
1144
+ Ze.displayName = "AttachmentCanvasContext";
1145
+ var Qe = ({ children: e }) => {
1146
+ let [t, n] = R(!1), [r, i] = R(!1), [a, o] = R(Xe), [s, c] = R(void 0), [l, u] = R(void 0), d = P((e, t) => {
1147
+ c(e), u(t), i(!0), n(!0);
1148
+ }, []), f = P((e, t, r) => {
1149
+ o(e), c(t), u(r), i(!1), n(!0);
1150
+ }, []), p = P(() => {
1151
+ o(Xe), n(!1), i(!1), u(void 0);
1152
+ }, []);
1153
+ return F(() => () => {
1154
+ let e = $(a);
1155
+ e != null && URL.revokeObjectURL(e);
1156
+ }, [a]), /* @__PURE__ */ z(Ze.Provider, {
1157
+ value: I(() => ({
1158
+ isOpen: t,
1159
+ isLoading: r,
1160
+ content: a,
1161
+ fileName: s,
1162
+ attachmentId: l,
1163
+ openCanvasLoading: d,
1164
+ openCanvas: f,
1165
+ closeCanvas: p
1166
+ }), [
1167
+ t,
1168
+ r,
1169
+ a,
1170
+ s,
1171
+ l,
1172
+ d,
1173
+ f,
1174
+ p
1175
+ ]),
1176
+ children: e
1177
+ });
1178
+ }, $e = () => {
1179
+ let e = oe(Ze);
1180
+ if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
1181
+ return e;
1182
+ }, et = N(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
1183
+ 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: A, pdfContentRetryLabel: te, xlsxFormulaLabel: ne, codeContentLoadingLabel: re, codeContentErrorLabel: ie, codeContentRetryLabel: ae, tableCopyLabel: j, tableCopiedLabel: M, tableDownloadCsvLabel: N, ooxmlHighlightsLabel: oe, ooxmlHighlightNavigatedLabel: F } = e ?? {}, { isOpen: I, isLoading: L, content: R, fileName: se, closeCanvas: ce } = $e(), le = P(() => {
1184
+ a(R, se);
1185
+ }, [R, se]), B = P(() => {
1186
+ (R.type === i.PlainText || R.type === i.Code) && h(R.text);
1187
+ }, [R]), V = P(() => {
1188
+ R.type === i.Markdown && h(R.text);
1189
+ }, [R]), H = P(() => {
1190
+ R.type === i.Json && h(JSON.stringify(R.value, null, 2));
1191
+ }, [R]);
1192
+ return /* @__PURE__ */ z(Re, {
1193
+ isOpen: I,
1194
+ isLoading: L,
1195
+ onClose: ce,
1196
+ content: R,
1197
+ fileName: se,
1198
+ labels: {
1199
+ ariaLabel: l,
1200
+ closeLabel: u,
1201
+ downloadLabel: d,
1202
+ copyTextLabel: g,
1203
+ copiedTextLabel: _,
1204
+ copyMarkdownLabel: v,
1205
+ copiedMarkdownLabel: y,
1206
+ copyJsonLabel: b,
1207
+ copiedJsonLabel: x,
1208
+ unsupportedLabel: f,
1209
+ loadErrorLabel: p,
1210
+ forbiddenErrorLabel: m,
1211
+ htmlFrameBlockedLabel: S,
1212
+ htmlOpenInNewTabLabel: C,
1213
+ htmlViewSourceLabel: w,
1214
+ htmlViewRenderedLabel: T,
1215
+ pdfThumbnailsLabel: E,
1216
+ pdfShowThumbnailsLabel: D,
1217
+ pdfHideThumbnailsLabel: O,
1218
+ pdfPageNumberLabel: k,
1219
+ pdfContentLoadingLabel: ee,
1220
+ pdfContentErrorLabel: A,
1221
+ pdfContentRetryLabel: te,
1222
+ xlsxFormulaLabel: ne,
1223
+ codeContentLoadingLabel: re,
1224
+ codeContentErrorLabel: ie,
1225
+ codeContentRetryLabel: ae,
1226
+ tableCopyLabel: j,
1227
+ tableCopiedLabel: M,
1228
+ tableDownloadCsvLabel: N,
1229
+ ooxmlHighlightsLabel: oe,
1230
+ ooxmlHighlightNavigatedLabel: F
1231
+ },
1232
+ onDownload: le,
1233
+ onCopyText: R.type === i.PlainText || R.type === i.Code ? B : void 0,
1234
+ onCopyMarkdown: R.type === i.Markdown ? V : void 0,
1235
+ onCopyJson: R.type === i.Json ? H : void 0,
1236
+ tableDownloadFilename: s,
1237
+ isMobile: t,
1238
+ defaultWidth: n,
1239
+ maxWidth: r,
1240
+ codeBlockTheme: o,
1241
+ configurePdfWorker: c
1242
+ });
1243
+ }), tt = {
1244
+ frame: "_frame_g47g7_1",
1245
+ header: "_header_g47g7_6",
1246
+ title: "_title_g47g7_10"
1247
+ }, nt = N(({ content: e, height: t, onExpand: n, expandAriaLabel: r, actionsGroupAriaLabel: i = "Visualizer actions", frameTitle: a, loadingLabel: o, errorLabel: s, titleClassName: c = "dial-small-semi-text", colors: l }) => {
1248
+ let u = e.visualizerName.trim();
1249
+ return /* @__PURE__ */ B("div", {
1250
+ className: g("flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", tt.frame),
1251
+ style: m({
1252
+ "--igv-bg": l?.background,
1253
+ "--igv-border": l?.border,
1254
+ "--igv-title-text": l?.titleText
1255
+ }),
1256
+ children: [/* @__PURE__ */ B("div", {
1257
+ className: g("flex min-h-10 items-center justify-between gap-2 border-b px-4 py-2", tt.header),
1258
+ children: [/* @__PURE__ */ z("span", {
1259
+ className: g("min-w-0 truncate", c, tt.title),
1260
+ children: u
1261
+ }), /* @__PURE__ */ z("div", {
1262
+ role: "toolbar",
1263
+ "aria-label": i,
1264
+ className: "flex items-center gap-1",
1265
+ children: /* @__PURE__ */ z(w, {
1266
+ icon: /* @__PURE__ */ z(O, {
1267
+ size: x.SM,
1268
+ stroke: S,
1269
+ "aria-hidden": !0
1270
+ }),
1271
+ "aria-label": r,
1272
+ size: C.Small,
1273
+ onClick: n
1274
+ })
1275
+ })]
1276
+ }), /* @__PURE__ */ z("div", {
1277
+ className: "w-full",
1278
+ style: { height: `${t}px` },
1279
+ children: /* @__PURE__ */ z(je, {
1280
+ content: e,
1281
+ loadingLabel: o,
1282
+ errorLabel: s,
1283
+ frameTitle: a
1284
+ })
1285
+ })]
1286
+ });
1287
+ }), rt = (e, t) => {
1196
1288
  let n = e.toLowerCase();
1197
1289
  return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
1198
- }, Ze = (e) => {
1290
+ }, it = (e, t) => {
1291
+ if (!(e == null || e === "")) return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
1292
+ }, at = (e) => `${e}:grouped-visualizer`, ot = (e, t) => {
1293
+ let n = (t.contentType ?? "").split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""), r = [], i = [];
1294
+ return e.forEach((e) => {
1295
+ if (e.url != null && e.url !== "" && (n.length === 0 || n.includes(e.contentType.toLowerCase()))) {
1296
+ r.push(e);
1297
+ return;
1298
+ }
1299
+ i.push(e);
1300
+ }), {
1301
+ claimed: r,
1302
+ unclaimed: i
1303
+ };
1304
+ }, st = (e) => {
1199
1305
  let t;
1200
1306
  try {
1201
1307
  t = new URL(e).pathname;
@@ -1208,63 +1314,63 @@ var Le = ({ children: e }) => {
1208
1314
  } catch {
1209
1315
  return n;
1210
1316
  }
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) => {
1317
+ }, ct = (e, t) => {
1318
+ let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = $e(), { customVisualizers: o, themeId: s, onBeforeOpen: l } = t, u = P(async (t, n, r) => {
1213
1319
  if (t.url == null && t.referenceUrl != null) {
1214
1320
  let i = e.resolveReferencePdfContent(t);
1215
- if (i != null) return n(i, t.name, r), !0;
1321
+ if (i != null) return r(i, t.name, n);
1216
1322
  }
1217
- let a = t.contentType.toLowerCase(), c = Xe(a, o);
1323
+ let a = t.contentType.toLowerCase(), c = rt(a, o);
1218
1324
  if (c != null) {
1219
1325
  let i = await e.resolveVisualizerContent(t, c, s);
1220
- if (i != null) return n(i, t.name, r), !0;
1326
+ if (i != null) return r(i, t.name, n);
1221
1327
  }
1222
1328
  if (!a && t.data != null) {
1223
1329
  let i = await e.resolveTextContent(t);
1224
- if (i != null) return n(i, t.name, r), !0;
1330
+ if (i != null) return r(i, t.name, n);
1225
1331
  }
1226
- let l = Q("", a);
1227
- if (l != null) return n(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1332
+ let l = Y("", a);
1333
+ if (l != null) return r(await e.resolveOoxmlContent(t, l) ?? Q(e.resolveContentUrl(t)), t.name, n);
1228
1334
  switch (a) {
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;
1335
+ case f.PDF: return r(await e.resolvePdfContent(t) ?? Q(e.resolveContentUrl(t)), t.name, n);
1336
+ case f.Markdown: return r(await e.resolveMarkdownContent(t) ?? Q(e.resolveContentUrl(t)), t.name, n);
1337
+ case f.JSON: return r(await e.resolveJsonContent(t) ?? Q(e.resolveContentUrl(t)), t.name, n);
1232
1338
  }
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;
1339
+ let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h = Y(u);
1340
+ if (h != null) return r(await e.resolveOoxmlContent(t, h) ?? Q(e.resolveContentUrl(t)), t.name, n);
1235
1341
  switch (m) {
1236
1342
  case d.Markdown:
1237
1343
  case d.MarkdownAlt: {
1238
1344
  let i = await e.resolveMarkdownContent(t);
1239
- return i == null ? !1 : (n(i, t.name, r), !0);
1345
+ return i == null ? !1 : r(i, t.name, n);
1240
1346
  }
1241
1347
  case d.JSON: {
1242
1348
  let i = await e.resolveJsonContent(t);
1243
- return i == null ? !1 : (n(i, t.name, r), !0);
1349
+ return i == null ? !1 : r(i, t.name, n);
1244
1350
  }
1245
1351
  case d.PDF: {
1246
1352
  let i = await e.resolvePdfContent(t);
1247
- return i == null ? !1 : (n(i, t.name, r), !0);
1353
+ return i == null ? !1 : r(i, t.name, n);
1248
1354
  }
1249
1355
  }
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;
1356
+ let g = t.name != null && We(t.name) || t.url != null && We(st(t.url));
1357
+ if (t.name != null && !Ue(t.name) && !g) return r(Q(e.resolveContentUrl(t)), t.name, n);
1252
1358
  if (g) {
1253
1359
  let a = await e.resolveHtmlContent(t);
1254
- return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, r), !0) : t.url == null ? !1 : (n({
1360
+ return a == null ? e.hasTextSource(t) ? r(Q(e.resolveContentUrl(t)), t.name, n) : t.url == null ? !1 : r({
1255
1361
  type: i.Html,
1256
1362
  url: t.url
1257
- }, t.name, r), !0) : (n(a, t.name, r), !0);
1363
+ }, t.name, n) : r(a, t.name, n);
1258
1364
  }
1259
- let _ = await e.resolveCodeContent(t, qe(m));
1260
- return _ == null ? !1 : (n(_, t.name, r), !0);
1365
+ let _ = await e.resolveCodeContent(t, Ke(m));
1366
+ return _ == null ? !1 : r(_, t.name, n);
1261
1367
  }, [
1262
- n,
1263
1368
  o,
1264
1369
  s,
1265
1370
  e
1266
1371
  ]);
1267
- return { openAttachmentCanvas: M(async (t, o = t.id) => {
1372
+ return { openAttachmentCanvas: P(async (t, o = t.id, s) => {
1373
+ let d = () => s == null || s(), f = (e, t, r) => d() ? (n(e, t, r), !0) : (Ye(e), !1);
1268
1374
  switch (t.type) {
1269
1375
  case c.Image: {
1270
1376
  let r = e.resolveImageContent(t);
@@ -1280,14 +1386,14 @@ var Le = ({ children: e }) => {
1280
1386
  }
1281
1387
  case c.File: {
1282
1388
  l?.(), r(t.name, o);
1283
- let e = await u(t, o);
1284
- return e || a(), e;
1389
+ let e = await u(t, o, f);
1390
+ return !e && d() && a(), e;
1285
1391
  }
1286
1392
  case c.Pasted:
1287
1393
  case c.Prompt: {
1288
1394
  l?.(), r(t.name, o);
1289
- let i = await e.resolveTextContent(t);
1290
- return i == null ? (a(), !1) : (n(i, t.name, o), !0);
1395
+ let n = await e.resolveTextContent(t);
1396
+ return n == null ? (d() && a(), !1) : f(n, t.name, o);
1291
1397
  }
1292
1398
  default: return !1;
1293
1399
  }
@@ -1301,4 +1407,4 @@ var Le = ({ children: e }) => {
1301
1407
  ]) };
1302
1408
  };
1303
1409
  //#endregion
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 };
1410
+ export { pe as ATTACHMENT_CANVAS_CLASS, Re as AttachmentCanvas, Fe as AttachmentCanvasBody, et as AttachmentCanvasContainer, Qe as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, ge as CodeContent, nt as InlineGroupedVisualizer, we as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, Je as createForbiddenCanvasContent, qe as createLoadErrorCanvasContent, Q as createUnsupportedCanvasContent, a as downloadAttachmentContent, Ke as extensionToLanguage, it as findVisualizerForApplication, rt as findVisualizerForMime, Y as getOoxmlFileType, Z as getOoxmlMimeType, at as groupedVisualizerCanvasKey, o as isDownloadable, We as isHtmlPreviewable, X as isOoxmlPreviewable, Ue as isTextPreviewable, ot as partitionAttachmentsForApplicationVisualizer, $e as useAttachmentCanvas, ct as useOpenAttachmentCanvas };