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

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