@epam/ai-dial-attachment-canvas 1.2.0-dev.99 → 1.2.0-rc.0

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