@epam/ai-dial-attachment-canvas 1.4.0-dev.66 → 1.4.0-dev.68

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