@epam/ai-dial-attachment-canvas 1.3.0-dev.34 → 1.3.0-dev.343

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