@epam/ai-dial-attachment-canvas 1.2.0-dev.28 → 1.2.0-dev.284

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