@epam/ai-dial-attachment-canvas 1.3.0-dev.96 → 1.3.0-rc.0

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