@epam/ai-dial-attachment-canvas 1.4.0-dev.12 → 1.4.0-dev.34

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