@epam/ai-dial-attachment-canvas 1.1.0-dev.432 → 1.1.0-dev.435

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,42 +1,43 @@
1
- import { c as e, i as t, l as n, o as r, s as i, t as a } from "./LazyContentBoundary-9fvYBGuL.js";
2
- import { AttachmentType as o, CodeBlockTheme as s, DEFAULT_MARKDOWN_CLASS_NAMES as c, FileExtension as l, MIMEType as u, MarkdownRenderer as d, buildCssVars as f, copyToClipboard as p, mergeClasses as m, restrainedSyntaxTheme as h, stripUrlQueryAndFragment as g } from "@epam/ai-dial-chat-shared";
3
- import { SidebarOrientation as _, SidebarPanel as v } from "@epam/ai-dial-sidebar";
4
- import { DIAL_ICON_SIZE as y, DIAL_KIT_ICON_STROKE as b, GhostIconButton as x, LinkButton as S, Spinner as C } from "@epam/ai-dial-ui-kit";
5
- import { IconAlertTriangle as w, IconCheck as T, IconCode as E, IconCopy as D, IconDownload as ee, IconEye as te, IconLock as ne, IconMarkdown as re, IconRefresh as ie } from "@tabler/icons-react";
6
- import { createContext as O, lazy as k, memo as A, useCallback as j, useContext as M, useEffect as N, useMemo as P, useRef as F, useState as I } from "react";
7
- import { JsonView as ae, defaultStyles as oe } from "react-json-view-lite";
8
- import { Fragment as se, jsx as L, jsxs as R } from "react/jsx-runtime";
1
+ import { i as e, n as t, r as n, t as r } from "./attachment-canvas-Bp6WeQws.js";
2
+ import { i, o as a, t as o } from "./LazyContentBoundary-CL7J_W9c.js";
3
+ import { AttachmentType as s, CodeBlockTheme as c, DEFAULT_MARKDOWN_CLASS_NAMES as l, FileExtension as u, MIMEType as d, MarkdownRenderer as f, buildCssVars as p, copyToClipboard as m, mergeClasses as h, restrainedSyntaxTheme as g, stripUrlQueryAndFragment as _ } from "@epam/ai-dial-chat-shared";
4
+ import { SidebarOrientation as v, SidebarPanel as y } from "@epam/ai-dial-sidebar";
5
+ import { DIAL_ICON_SIZE as b, DIAL_KIT_ICON_STROKE as x, GhostIconButton as S, LinkButton as C, Spinner as w } from "@epam/ai-dial-ui-kit";
6
+ import { IconAlertTriangle as T, IconCheck as E, IconCode as D, IconCopy as O, IconDownload as ee, IconEye as te, IconLock as ne, IconMarkdown as re, IconRefresh as ie } from "@tabler/icons-react";
7
+ import { createContext as ae, lazy as oe, memo as k, useCallback as A, useContext as j, useEffect as M, useMemo as N, useRef as P, useState as F } from "react";
8
+ import { JsonView as se, defaultStyles as ce } from "react-json-view-lite";
9
+ import { Fragment as I, jsx as L, jsxs as R } from "react/jsx-runtime";
9
10
  import { AppRenderer as z } from "@mcp-ui/client";
10
11
  import { VisualizerConnectorRequests as B } from "@epam/ai-dial-shared";
11
- import { VisualizerConnector as ce } from "@epam/ai-dial-visualizer-connector";
12
+ import { VisualizerConnector as le } from "@epam/ai-dial-visualizer-connector";
12
13
  var V = {
13
14
  container: "_container_1nhig_1",
14
15
  containerLight: "_containerLight_1nhig_5"
15
16
  }, H = {
16
- [s.Dark]: h,
17
- [s.Light]: h
18
- }, le = () => k(async () => {
17
+ [c.Dark]: g,
18
+ [c.Light]: g
19
+ }, U = () => oe(async () => {
19
20
  let { Prism: e } = await import("react-syntax-highlighter");
20
21
  return { default: e };
21
- }), ue = A(({ content: e, codeBlockTheme: t = s.Light, labels: n }) => {
22
- let { text: r, language: i } = e, o = i == null || i === "plaintext", c = H[t], l = t === s.Light, [u, d] = I(0), f = P(le, [u]), p = j(() => {
22
+ }), ue = k(({ content: e, codeBlockTheme: t = c.Light, labels: n }) => {
23
+ let { text: r, language: i } = e, a = i == null || i === "plaintext", s = H[t], l = t === c.Light, [u, d] = F(0), f = N(U, [u]), p = A(() => {
23
24
  d((e) => e + 1);
24
- }, []), h = /* @__PURE__ */ L("pre", {
25
+ }, []), m = /* @__PURE__ */ L("pre", {
25
26
  className: "whitespace-pre-wrap break-words p-4",
26
27
  children: r
27
28
  });
28
29
  return /* @__PURE__ */ L("div", {
29
30
  dir: "ltr",
30
- className: m("h-full overflow-auto", V.container, l && V.containerLight),
31
- children: o ? h : /* @__PURE__ */ L(a, {
31
+ className: h("h-full overflow-auto", V.container, l && V.containerLight),
32
+ children: a ? m : /* @__PURE__ */ L(o, {
32
33
  retryKey: u,
33
34
  onRetry: p,
34
- pendingContent: h,
35
- errorContent: h,
35
+ pendingContent: m,
36
+ errorContent: m,
36
37
  labels: n,
37
38
  children: /* @__PURE__ */ L(f, {
38
39
  language: i,
39
- style: c,
40
+ style: s,
40
41
  customStyle: {
41
42
  margin: 0,
42
43
  borderRadius: 0,
@@ -51,23 +52,23 @@ var V = {
51
52
  })
52
53
  })
53
54
  });
54
- }), de = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, fe = A(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
55
- let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = I(!0), [d, f] = I(!1), p = F(null);
56
- N(() => {
55
+ }), de = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, fe = k(({ content: e, labels: t, isSourceView: n, title: i, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
56
+ let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = F(!0), [d, f] = F(!1), p = P(null);
57
+ M(() => {
57
58
  u(!0), f(!1);
58
59
  }, [e]);
59
- let h = j((t) => {
60
+ let m = A((t) => {
60
61
  if (u(!1), e.srcdoc == null) try {
61
62
  p.current?.contentDocument ?? f(!0);
62
63
  } catch {
63
64
  f(!0);
64
65
  }
65
- }, [e.srcdoc]), g = j(() => {
66
+ }, [e.srcdoc]), g = A(() => {
66
67
  u(!1), f(!0);
67
68
  }, []);
68
69
  if (n && e.srcdoc != null) return /* @__PURE__ */ L(ue, {
69
70
  content: {
70
- type: i.Code,
71
+ type: r.Code,
71
72
  text: e.srcdoc,
72
73
  language: "html"
73
74
  },
@@ -78,7 +79,7 @@ var V = {
78
79
  children: [/* @__PURE__ */ L("p", {
79
80
  className: "text-center",
80
81
  children: s
81
- }), e.url != null && /* @__PURE__ */ L(S, {
82
+ }), e.url != null && /* @__PURE__ */ L(C, {
82
83
  href: e.url,
83
84
  target: "_blank",
84
85
  label: c,
@@ -91,26 +92,26 @@ var V = {
91
92
  className: "relative h-full",
92
93
  children: [l && /* @__PURE__ */ L("div", {
93
94
  className: "absolute inset-0 flex items-center justify-center",
94
- children: /* @__PURE__ */ L(C, {})
95
+ children: /* @__PURE__ */ L(w, {})
95
96
  }), /* @__PURE__ */ L("iframe", {
96
97
  ref: p,
97
- title: r,
98
+ title: i,
98
99
  src: v,
99
100
  srcDoc: y,
100
101
  sandbox: _ ? "allow-scripts" : "allow-scripts allow-same-origin",
101
- className: m("h-full w-full border-none", l ? "invisible" : ""),
102
- onLoad: h,
102
+ className: h("h-full w-full border-none", l ? "invisible" : ""),
103
+ onLoad: m,
103
104
  onError: g
104
105
  })]
105
106
  });
106
- }), U = {
107
+ }), W = {
107
108
  loadingOverlay: "_loadingOverlay_72o98_1",
108
109
  fullscreenFrame: "_fullscreenFrame_72o98_14",
109
110
  statusLabel: "_statusLabel_72o98_19",
110
111
  errorIcon: "_errorIcon_72o98_23"
111
112
  }, pe = ({ content: e, errorLabel: t = "Failed to load app" }) => {
112
- let [n, r] = I("loading"), { html: i, sandboxUrl: a, toolName: o, toolInput: s, toolResult: c, hostContext: l, onToolCall: u } = e, d = P(() => ({ url: new URL(a) }), [a]), f = l?.displayMode === "fullscreen", p = F(null), [h, g] = I();
113
- N(() => {
113
+ let [n, r] = F("loading"), { html: i, sandboxUrl: a, toolName: o, toolInput: s, toolResult: c, hostContext: l, onToolCall: u } = e, d = N(() => ({ url: new URL(a) }), [a]), f = l?.displayMode === "fullscreen", p = P(null), [m, g] = F();
114
+ M(() => {
114
115
  let e = p.current;
115
116
  if (!e) return;
116
117
  let t = new ResizeObserver(([e]) => {
@@ -123,13 +124,13 @@ var V = {
123
124
  });
124
125
  return t.observe(e), () => t.disconnect();
125
126
  }, []);
126
- let _ = P(() => l == null || h == null ? l : {
127
+ let _ = N(() => l == null || m == null ? l : {
127
128
  ...l,
128
- containerDimensions: h
129
- }, [l, h]);
129
+ containerDimensions: m
130
+ }, [l, m]);
130
131
  return /* @__PURE__ */ R("div", {
131
132
  ref: p,
132
- className: m("relative h-full w-full", f && U.fullscreenFrame),
133
+ className: h("relative h-full w-full", f && W.fullscreenFrame),
133
134
  children: [
134
135
  /* @__PURE__ */ L(z, {
135
136
  html: i,
@@ -143,38 +144,39 @@ var V = {
143
144
  onError: () => r("error")
144
145
  }),
145
146
  n === "loading" && /* @__PURE__ */ L("div", {
146
- className: m("absolute inset-0 flex flex-col items-center justify-center gap-2", U.loadingOverlay),
147
- children: /* @__PURE__ */ L(C, {})
147
+ className: h("absolute inset-0 flex flex-col items-center justify-center gap-2", W.loadingOverlay),
148
+ children: /* @__PURE__ */ L(w, {})
148
149
  }),
149
150
  n === "error" && /* @__PURE__ */ R("div", {
150
151
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
151
- children: [/* @__PURE__ */ L(w, {
152
+ children: [/* @__PURE__ */ L(T, {
152
153
  size: 60,
153
- stroke: b,
154
+ stroke: x,
154
155
  "aria-hidden": !0,
155
- className: U.errorIcon
156
+ className: W.errorIcon
156
157
  }), /* @__PURE__ */ L("p", {
157
158
  role: "alert",
158
- className: m("text-center", U.statusLabel),
159
+ className: h("text-center", W.statusLabel),
159
160
  children: t
160
161
  })]
161
162
  })
162
163
  ]
163
164
  });
164
- }, W = {
165
- viewer: "_viewer_1npwu_1",
166
- spreadsheetCanvas: "_spreadsheetCanvas_1npwu_5",
167
- formulaPanel: "_formulaPanel_1npwu_11",
168
- formulaValue: "_formulaValue_1npwu_17",
169
- statusOverlay: "_statusOverlay_1npwu_23",
170
- errorIcon: "_errorIcon_1npwu_28"
165
+ }, G = {
166
+ viewer: "_viewer_1w97n_2",
167
+ spreadsheetCanvas: "_spreadsheetCanvas_1w97n_6",
168
+ formulaPanel: "_formulaPanel_1w97n_12",
169
+ formulaValue: "_formulaValue_1w97n_18",
170
+ statusOverlay: "_statusOverlay_1w97n_24",
171
+ errorIcon: "_errorIcon_1w97n_29",
172
+ highlight: "_highlight_1w97n_37"
171
173
  }, me = (e) => {
172
174
  if (e?.kind !== "range") return "";
173
175
  let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
174
176
  if (n == null) return "";
175
177
  let r = n.formula;
176
178
  return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
177
- }, he = async (e, t, r, i) => {
179
+ }, he = async (e, t, { onError: r, onXlsxSelectionContextChange: i }) => {
178
180
  switch (t) {
179
181
  case n.Docx: {
180
182
  let [{ DocxScrollViewer: t }, { chartEx: n }] = await Promise.all([import("./docx-B9qBTEkj.js"), import("./chart-ex-B0DgG3Dt.js")]);
@@ -196,7 +198,7 @@ var V = {
196
198
  }
197
199
  case n.Csv: {
198
200
  let { XlsxSheetViewer: t } = await import("./xlsx-BAXMTJTG.js"), n = document.createElement("canvas");
199
- n.className = W.spreadsheetCanvas, e.replaceChildren(n);
201
+ n.className = G.spreadsheetCanvas, e.replaceChildren(n);
200
202
  let i = new t(n, {
201
203
  showScrollbars: !0,
202
204
  onError: r
@@ -216,67 +218,217 @@ var V = {
216
218
  });
217
219
  }
218
220
  }
219
- }, ge = ({ content: e, fileName: t, loadErrorLabel: r, formulaLabel: i, formulaLabelClassName: a }) => {
220
- let o = F(null), [s, c] = I(!0), [l, u] = I(!1), [d, f] = I("");
221
- return N(() => {
222
- let t = o.current;
221
+ }, ge = async (e, t, r, i) => {
222
+ let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = r;
223
+ switch (t.format) {
224
+ case n.Docx: {
225
+ let [{ DocxDocument: n, DocxScrollViewer: r }, { chartEx: o }, { createDocxHighlightSurface: c }] = await Promise.all([
226
+ import("./docx-B9qBTEkj.js"),
227
+ import("./chart-ex-B0DgG3Dt.js"),
228
+ import("./ooxml-highlight-surfaces-BhfVZvru.js")
229
+ ]), l = await n.load(t.url, { chartEx: o });
230
+ if (i()) throw l.destroy(), new K();
231
+ let u = r.fromDocument(e, l, {
232
+ enableTextSelection: !0,
233
+ refitOnResize: !0,
234
+ onError: a,
235
+ onScaleChange: s,
236
+ onVisiblePageChange: s
237
+ });
238
+ return {
239
+ viewer: u,
240
+ engine: l,
241
+ highlights: c(e, l, u, i)
242
+ };
243
+ }
244
+ case n.Pptx: {
245
+ let [{ PptxPresentation: n, PptxScrollViewer: r }, { chartEx: o }, { createPptxHighlightSurface: c }] = await Promise.all([
246
+ import("./pptx-dkJw0-Vx.js"),
247
+ import("./chart-ex-B0DgG3Dt.js"),
248
+ import("./ooxml-highlight-surfaces-BhfVZvru.js")
249
+ ]), l = await n.load(t.url, { chartEx: o });
250
+ if (i()) throw l.destroy(), new K();
251
+ let u = r.fromPresentation(e, l, {
252
+ enableTextSelection: !0,
253
+ refitOnResize: !0,
254
+ onError: a,
255
+ onScaleChange: s,
256
+ onVisibleSlideChange: s
257
+ });
258
+ return {
259
+ viewer: u,
260
+ engine: l,
261
+ highlights: c(e, l, u, i)
262
+ };
263
+ }
264
+ case n.Xlsx: {
265
+ let [{ XlsxViewer: n }, { chartEx: r }, { createXlsxHighlightSurface: c }] = await Promise.all([
266
+ import("./xlsx-BAXMTJTG.js"),
267
+ import("./chart-ex-B0DgG3Dt.js"),
268
+ import("./ooxml-highlight-surfaces-BhfVZvru.js")
269
+ ]), l = new n(e, {
270
+ showZoomSlider: !0,
271
+ chartEx: r,
272
+ onError: a,
273
+ onSelectionContextChange: o,
274
+ onViewportChange: s,
275
+ onScaleChange: s,
276
+ onSheetChange: s
277
+ });
278
+ return await l.load(t.url), {
279
+ viewer: l,
280
+ highlights: c(e, l, i)
281
+ };
282
+ }
283
+ case n.Csv: {
284
+ let n = await he(e, t.format, r);
285
+ return await n.load(t.url), { viewer: n };
286
+ }
287
+ }
288
+ }, K = class extends Error {}, _e = ({ content: e, fileName: t, loadErrorLabel: r, formulaLabel: i, formulaLabelClassName: a, highlightsLabel: o = "Cited locations", highlightNavigatedLabel: s = "Scrolled to the cited location" }) => {
289
+ let c = P(null), [l, u] = F(!0), [d, f] = F(!1), [p, m] = F(""), [g, _] = F([]), [v, y] = F(!1), { highlights: b, selectedHighlightId: S } = e, C = b != null && b.length > 0, E = P(void 0), D = P(b);
290
+ D.current = b;
291
+ let O = P(void 0);
292
+ return M(() => {
293
+ let t = c.current;
223
294
  if (t == null) return;
224
- let n, r = !1;
225
- return c(!0), u(!1), f(""), (async () => {
295
+ let n, r = !1, i, a = () => r;
296
+ u(!0), f(!1), m(""), _([]), y(!1);
297
+ let o = () => {
298
+ r || i != null || (i = requestAnimationFrame(() => {
299
+ i = void 0, s();
300
+ }));
301
+ }, s = async () => {
302
+ let e = n?.highlights, t = D.current;
303
+ if (!(r || e == null || t == null)) try {
304
+ let n = await e.measure(t);
305
+ r || _(n);
306
+ } catch {
307
+ r || _([]);
308
+ }
309
+ }, l = {
310
+ onError: () => {
311
+ r || (u(!1), f(!0));
312
+ },
313
+ onXlsxSelectionContextChange: (e) => {
314
+ r || m(me(e));
315
+ },
316
+ onGeometryInvalidated: o
317
+ };
318
+ return t.addEventListener("scroll", o, !0), O.current = o, (async () => {
226
319
  try {
227
- let i = await he(t, e.format, () => {
228
- r || (c(!1), u(!0));
229
- }, (e) => {
230
- r || f(me(e));
231
- });
232
- if (r) {
233
- i.destroy();
234
- return;
320
+ if (C) {
321
+ let i = await ge(t, e, l, a);
322
+ if (r) {
323
+ i.viewer.destroy(), i.engine?.destroy();
324
+ return;
325
+ }
326
+ n = i, E.current = i.highlights;
327
+ } else {
328
+ let i = await he(t, e.format, l);
329
+ if (r) {
330
+ i.destroy();
331
+ return;
332
+ }
333
+ n = { viewer: i }, E.current = void 0, await i.load(e.url);
235
334
  }
236
- n = i, await n.load(e.url), r || c(!1);
335
+ if (r) return;
336
+ u(!1), await s();
337
+ } catch (e) {
338
+ if (e instanceof K || r) return;
339
+ n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, E.current = void 0, t.replaceChildren(), u(!1), f(!0);
340
+ }
341
+ })(), () => {
342
+ r = !0, t.removeEventListener("scroll", o, !0), i != null && cancelAnimationFrame(i), O.current = void 0, n?.viewer.destroy(), n?.engine?.destroy(), E.current = void 0, t.replaceChildren();
343
+ };
344
+ }, [
345
+ e.format,
346
+ e.url,
347
+ C
348
+ ]), M(() => {
349
+ O.current?.();
350
+ }, [b]), M(() => {
351
+ let e = E.current;
352
+ if (e == null || l) return;
353
+ let t = (b?.find(({ id: e }) => e === S))?.locations.at(0);
354
+ if (t == null) return;
355
+ let n = !1;
356
+ return (async () => {
357
+ try {
358
+ await e.navigate(t);
237
359
  } catch {
238
- r || (n?.destroy(), n = void 0, t.replaceChildren(), c(!1), u(!0));
360
+ return;
239
361
  }
362
+ n || y(!0);
240
363
  })(), () => {
241
- r = !0, n?.destroy(), t.replaceChildren();
364
+ n = !0;
242
365
  };
243
- }, [e.format, e.url]), /* @__PURE__ */ R("div", {
366
+ }, [
367
+ b,
368
+ S,
369
+ l
370
+ ]), /* @__PURE__ */ R("div", {
244
371
  className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
245
372
  children: [
246
373
  e.format === n.Xlsx && /* @__PURE__ */ R("div", {
247
374
  role: "region",
248
375
  "aria-label": i,
249
- className: m("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", W.formulaPanel),
376
+ className: h("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", G.formulaPanel),
250
377
  children: [/* @__PURE__ */ L("span", {
251
378
  "aria-hidden": "true",
252
- className: m("shrink-0", a),
379
+ className: h("shrink-0", a),
253
380
  children: "fx"
254
381
  }), /* @__PURE__ */ L("code", {
255
382
  dir: "ltr",
256
383
  tabIndex: 0,
257
384
  "aria-live": "polite",
258
- className: m("h-8 min-w-0 flex-1 overflow-x-auto whitespace-nowrap rounded border px-2 py-1 text-sm focus-visible:outline focus-visible:outline-focus", W.formulaValue),
259
- children: d
385
+ className: h("h-8 min-w-0 flex-1 overflow-x-auto whitespace-nowrap rounded border px-2 py-1 text-sm focus-visible:outline focus-visible:outline-focus", G.formulaValue),
386
+ children: p
387
+ })]
388
+ }),
389
+ /* @__PURE__ */ R("div", {
390
+ className: "relative min-h-0 w-full flex-1",
391
+ children: [/* @__PURE__ */ L("div", {
392
+ ref: c,
393
+ role: "document",
394
+ "aria-label": t,
395
+ "aria-busy": l,
396
+ className: h("h-full w-full overflow-hidden", G.viewer)
397
+ }), g.length > 0 && /* @__PURE__ */ L("div", {
398
+ role: "region",
399
+ "aria-label": o,
400
+ className: "pointer-events-none absolute inset-0 overflow-hidden",
401
+ children: g.map((e, t) => /* @__PURE__ */ L("div", {
402
+ "aria-hidden": "true",
403
+ style: {
404
+ left: `${e.left}px`,
405
+ top: `${e.top}px`,
406
+ width: `${e.width}px`,
407
+ height: `${e.height}px`
408
+ },
409
+ "data-selected": e.highlightId === S,
410
+ "data-clipped": e.isClippedAtEnd === !0,
411
+ className: h("absolute", G.highlight)
412
+ }, `${e.highlightId}-${t}`))
260
413
  })]
261
414
  }),
262
415
  /* @__PURE__ */ L("div", {
263
- ref: o,
264
- role: "document",
265
- "aria-label": t,
266
- "aria-busy": s,
267
- className: m("min-h-0 w-full flex-1 overflow-hidden", W.viewer)
416
+ role: "status",
417
+ "aria-live": "polite",
418
+ className: "sr-only",
419
+ children: v ? s : ""
268
420
  }),
269
- (s || l) && /* @__PURE__ */ L("div", {
270
- role: l ? "alert" : void 0,
421
+ (l || d) && /* @__PURE__ */ L("div", {
422
+ role: d ? "alert" : void 0,
271
423
  "aria-live": "polite",
272
- className: m("absolute inset-0 flex items-center justify-center", W.statusOverlay),
273
- children: s ? /* @__PURE__ */ L(C, { size: 48 }) : /* @__PURE__ */ R("div", {
424
+ className: h("absolute inset-0 flex items-center justify-center", G.statusOverlay),
425
+ children: l ? /* @__PURE__ */ L(w, { size: 48 }) : /* @__PURE__ */ R("div", {
274
426
  className: "flex flex-col items-center gap-2",
275
- children: [/* @__PURE__ */ L(w, {
427
+ children: [/* @__PURE__ */ L(T, {
276
428
  "aria-hidden": "true",
277
429
  size: 60,
278
- stroke: b,
279
- className: W.errorIcon
430
+ stroke: x,
431
+ className: G.errorIcon
280
432
  }), /* @__PURE__ */ L("p", {
281
433
  className: "text-center",
282
434
  children: r
@@ -285,17 +437,17 @@ var V = {
285
437
  })
286
438
  ]
287
439
  });
288
- }, G = {
440
+ }, q = {
289
441
  loadingOverlay: "_loadingOverlay_12637_1",
290
442
  statusLabel: "_statusLabel_12637_5",
291
443
  errorIcon: "_errorIcon_12637_9"
292
- }, _e = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
293
- let i = F(null), [a, o] = I("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = F(e);
294
- return u.current = e, N(() => {
444
+ }, ve = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
445
+ let i = P(null), [a, o] = F("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = P(e);
446
+ return u.current = e, M(() => {
295
447
  let e = i.current;
296
448
  if (!e) return;
297
449
  o("loading");
298
- let t = new ce(e, {
450
+ let t = new le(e, {
299
451
  domain: s,
300
452
  hostDomain: window.location.origin,
301
453
  visualizerName: c,
@@ -322,7 +474,7 @@ var V = {
322
474
  l
323
475
  ]), /* @__PURE__ */ R("div", {
324
476
  className: "relative h-full w-full",
325
- style: f({
477
+ style: p({
326
478
  "--vs-loading-bg": r?.loadingBackground,
327
479
  "--vs-status-text": r?.statusText,
328
480
  "--vs-error-icon": r?.errorIcon
@@ -333,28 +485,28 @@ var V = {
333
485
  className: "h-full w-full"
334
486
  }),
335
487
  a === "loading" && /* @__PURE__ */ R("div", {
336
- className: m("absolute inset-0 flex flex-col items-center justify-center gap-2", G.loadingOverlay),
337
- children: [/* @__PURE__ */ L(C, {}), t && /* @__PURE__ */ L("p", {
338
- className: m("text-center", G.statusLabel),
488
+ className: h("absolute inset-0 flex flex-col items-center justify-center gap-2", q.loadingOverlay),
489
+ children: [/* @__PURE__ */ L(w, {}), t && /* @__PURE__ */ L("p", {
490
+ className: h("text-center", q.statusLabel),
339
491
  children: t
340
492
  })]
341
493
  }),
342
494
  a === "error" && /* @__PURE__ */ R("div", {
343
495
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
344
- children: [/* @__PURE__ */ L(w, {
496
+ children: [/* @__PURE__ */ L(T, {
345
497
  size: 60,
346
- stroke: b,
498
+ stroke: x,
347
499
  "aria-hidden": !0,
348
- className: G.errorIcon
500
+ className: q.errorIcon
349
501
  }), /* @__PURE__ */ L("p", {
350
502
  role: "alert",
351
- className: m("text-center", G.statusLabel),
503
+ className: h("text-center", q.statusLabel),
352
504
  children: n
353
505
  })]
354
506
  })
355
507
  ]
356
508
  });
357
- }, K = {
509
+ }, J = {
358
510
  body: "_body_13ogb_4",
359
511
  statusLabel: "_statusLabel_13ogb_13",
360
512
  errorIcon: "_errorIcon_13ogb_17",
@@ -369,18 +521,18 @@ var V = {
369
521
  jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
370
522
  jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
371
523
  jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
372
- }, ve = () => k(async () => ({ default: (await import("./PdfContent-BexpRNO0.js")).PdfContent })), ye = ({ url: e, fileName: t, loadErrorLabel: n }) => {
373
- let [r, i] = I(!1);
374
- return N(() => {
524
+ }, ye = () => oe(async () => ({ default: (await import("./PdfContent-solOLCRi.js")).PdfContent })), be = ({ url: e, fileName: t, loadErrorLabel: n }) => {
525
+ let [r, i] = F(!1);
526
+ return M(() => {
375
527
  i(!1);
376
528
  }, [e]), r ? /* @__PURE__ */ R("div", {
377
529
  className: "flex flex-col items-center gap-2",
378
- children: [/* @__PURE__ */ L(w, {
530
+ children: [/* @__PURE__ */ L(T, {
379
531
  size: 60,
380
- stroke: b,
381
- className: K.errorIcon
532
+ stroke: x,
533
+ className: J.errorIcon
382
534
  }), /* @__PURE__ */ L("p", {
383
- className: m("text-center", K.statusLabel),
535
+ className: h("text-center", J.statusLabel),
384
536
  children: n
385
537
  })]
386
538
  }) : /* @__PURE__ */ L("img", {
@@ -389,416 +541,425 @@ var V = {
389
541
  className: "max-h-full max-w-full object-contain",
390
542
  onError: () => i(!0)
391
543
  });
392
- }, be = new Set([
393
- i.PlainText,
394
- i.Code,
395
- i.Ooxml
396
- ]), xe = A(({ content: t, isLoading: n = !1, fileName: r, isHtmlSourceView: o = !1, labels: { unsupportedLabel: s = "Preview is not supported for this file", loadErrorLabel: l = "Failed to load file", forbiddenErrorLabel: u = "You don't have permission to access this file", visualizerErrorLabel: p, htmlFrameBlockedLabel: h = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: g = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: x, pdfContentLoadingLabel: S, pdfContentErrorLabel: T, pdfContentRetryLabel: E, xlsxFormulaLabel: D = "Formula", codeContentLoadingLabel: ee, codeContentErrorLabel: te, codeContentRetryLabel: re, tableCopyCsvLabel: ie, tableCopyTxtLabel: O, tableCopyMarkdownLabel: k, tableCopiedLabel: A, tableDownloadCsvLabel: M } = {}, styles: N, codeBlockTheme: F, tableDownloadFilename: se, loadPdf: z, hidePdfToolbar: B = !1, configurePdfWorker: ce }) => {
397
- let { colors: V, typography: H, bodyClassName: le, cssVars: de } = N ?? {}, [U, W] = I(0), me = P(ve, [U]), he = j(() => {
398
- W((e) => e + 1);
399
- }, []), G = H?.fontClassName != null, xe = P(() => ({
400
- ...f({
401
- "--ac-text": V?.text,
402
- "--ac-status-text": V?.statusText,
403
- "--ac-error-icon": V?.errorIcon,
404
- "--ac-open-in-new-tab-text": V?.openInNewTabText,
405
- "--ac-json-border": V?.jsonBorder,
406
- "--ac-json-bg": V?.jsonBackground,
407
- "--ac-json-label": V?.jsonLabel,
408
- "--ac-json-clickable-label": V?.jsonClickableLabel,
409
- "--ac-json-punctuation": V?.jsonPunctuation,
410
- "--ac-json-string": V?.jsonString,
411
- "--ac-json-number": V?.jsonNumber,
412
- "--ac-json-boolean": V?.jsonBoolean,
413
- "--ac-json-null": V?.jsonNull,
414
- "--ac-json-toggle-icon": V?.jsonToggleIcon,
415
- "--ac-json-toggle-icon-hover": V?.jsonToggleIconHover,
416
- "--ac-ooxml-bg": V?.ooxmlBackground,
417
- "--ac-ooxml-formula-border": V?.ooxmlFormulaBorder,
418
- "--ac-ooxml-formula-bg": V?.ooxmlFormulaBackground,
419
- "--ac-ooxml-formula-text": V?.ooxmlFormulaText,
420
- "--ac-json-collapsed-text": V?.jsonCollapsedText,
421
- "--ac-json-collapsed-bg": V?.jsonCollapsedBackground,
422
- "--ac-font-family": G ? void 0 : H?.fontFamily,
423
- "--ac-font-size": G ? void 0 : H?.fontSize,
424
- "--ac-font-weight": G ? void 0 : H?.fontWeight,
425
- "--ac-line-height": G ? void 0 : H?.lineHeight,
426
- "--ac-letter-spacing": G ? void 0 : H?.letterSpacing
544
+ }, xe = new Set([
545
+ r.PlainText,
546
+ r.Code,
547
+ r.Ooxml
548
+ ]), Se = k(({ content: e, isLoading: n = !1, fileName: i, isHtmlSourceView: a = !1, labels: { unsupportedLabel: s = "Preview is not supported for this file", loadErrorLabel: c = "Failed to load file", forbiddenErrorLabel: u = "You don't have permission to access this file", visualizerErrorLabel: d, htmlFrameBlockedLabel: m = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: g = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: S, pdfContentErrorLabel: C, pdfContentRetryLabel: E, xlsxFormulaLabel: D = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: ee, codeContentRetryLabel: te, tableCopyCsvLabel: re, tableCopyTxtLabel: ie, tableCopyMarkdownLabel: ae, tableCopiedLabel: oe, tableDownloadCsvLabel: k, ooxmlHighlightsLabel: j, ooxmlHighlightNavigatedLabel: M } = {}, styles: P, codeBlockTheme: I, tableDownloadFilename: z, loadPdf: B, hidePdfToolbar: le = !1, configurePdfWorker: V }) => {
549
+ let { colors: H, typography: U, bodyClassName: de, cssVars: W } = P ?? {}, [G, me] = F(0), he = N(ye, [G]), ge = A(() => {
550
+ me((e) => e + 1);
551
+ }, []), K = U?.fontClassName != null, q = N(() => ({
552
+ ...p({
553
+ "--ac-text": H?.text,
554
+ "--ac-status-text": H?.statusText,
555
+ "--ac-error-icon": H?.errorIcon,
556
+ "--ac-open-in-new-tab-text": H?.openInNewTabText,
557
+ "--ac-json-border": H?.jsonBorder,
558
+ "--ac-json-bg": H?.jsonBackground,
559
+ "--ac-json-label": H?.jsonLabel,
560
+ "--ac-json-clickable-label": H?.jsonClickableLabel,
561
+ "--ac-json-punctuation": H?.jsonPunctuation,
562
+ "--ac-json-string": H?.jsonString,
563
+ "--ac-json-number": H?.jsonNumber,
564
+ "--ac-json-boolean": H?.jsonBoolean,
565
+ "--ac-json-null": H?.jsonNull,
566
+ "--ac-json-toggle-icon": H?.jsonToggleIcon,
567
+ "--ac-json-toggle-icon-hover": H?.jsonToggleIconHover,
568
+ "--ac-ooxml-bg": H?.ooxmlBackground,
569
+ "--ac-ooxml-formula-border": H?.ooxmlFormulaBorder,
570
+ "--ac-ooxml-formula-bg": H?.ooxmlFormulaBackground,
571
+ "--ac-ooxml-formula-text": H?.ooxmlFormulaText,
572
+ "--ac-ooxml-highlight-border": H?.ooxmlHighlightBorder,
573
+ "--ac-ooxml-highlight-bg": H?.ooxmlHighlightBackground,
574
+ "--ac-json-collapsed-text": H?.jsonCollapsedText,
575
+ "--ac-json-collapsed-bg": H?.jsonCollapsedBackground,
576
+ "--ac-font-family": K ? void 0 : U?.fontFamily,
577
+ "--ac-font-size": K ? void 0 : U?.fontSize,
578
+ "--ac-font-weight": K ? void 0 : U?.fontWeight,
579
+ "--ac-line-height": K ? void 0 : U?.lineHeight,
580
+ "--ac-letter-spacing": K ? void 0 : U?.letterSpacing
427
581
  }),
428
- ...de
429
- }), [N]), Se = P(() => {
430
- switch (t.type) {
431
- case i.Image:
432
- case i.Audio:
433
- case i.Unsupported:
434
- case i.Error: return "h-full overflow-auto p-4 flex items-center justify-center";
435
- case i.Json: return "h-full overflow-auto";
436
- case i.Pdf:
437
- case i.Ooxml:
438
- case i.Visualizer:
439
- case i.McpApp:
440
- case i.Code:
441
- case i.Html: return "h-full overflow-hidden";
442
- case i.Markdown:
443
- case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
582
+ ...W
583
+ }), [P]), Se = N(() => {
584
+ switch (e.type) {
585
+ case r.Image:
586
+ case r.Audio:
587
+ case r.Unsupported:
588
+ case r.Error: return "h-full overflow-auto p-4 flex items-center justify-center";
589
+ case r.Json: return "h-full overflow-auto";
590
+ case r.Pdf:
591
+ case r.Ooxml:
592
+ case r.Visualizer:
593
+ case r.McpApp:
594
+ case r.Code:
595
+ case r.Html: return "h-full overflow-hidden";
596
+ case r.Markdown:
597
+ case r.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
444
598
  default: return "h-full overflow-auto p-4";
445
599
  }
446
- }, [t.type]), Ce = P(() => {
447
- switch (t.type) {
448
- case i.PlainText: return /* @__PURE__ */ L("pre", {
449
- className: m("whitespace-pre-wrap break-words", K.body, H?.fontClassName),
450
- children: t.text
600
+ }, [e.type]), Ce = N(() => {
601
+ switch (e.type) {
602
+ case r.PlainText: return /* @__PURE__ */ L("pre", {
603
+ className: h("whitespace-pre-wrap break-words", J.body, U?.fontClassName),
604
+ children: e.text
451
605
  });
452
- case i.Image: return /* @__PURE__ */ L(ye, {
453
- url: t.url,
454
- fileName: r,
455
- loadErrorLabel: l
606
+ case r.Image: return /* @__PURE__ */ L(be, {
607
+ url: e.url,
608
+ fileName: i,
609
+ loadErrorLabel: c
456
610
  });
457
- case i.Audio: return /* @__PURE__ */ L("audio", {
611
+ case r.Audio: return /* @__PURE__ */ L("audio", {
458
612
  controls: !0,
459
- src: t.url,
460
- "aria-label": r ?? "Audio attachment",
613
+ src: e.url,
614
+ "aria-label": i ?? "Audio attachment",
461
615
  className: "w-full max-w-sm",
462
616
  preload: "metadata",
463
- children: t.mimeType && /* @__PURE__ */ L("source", {
464
- src: t.url,
465
- type: t.mimeType
617
+ children: e.mimeType && /* @__PURE__ */ L("source", {
618
+ src: e.url,
619
+ type: e.mimeType
466
620
  })
467
621
  });
468
- case i.Markdown: return /* @__PURE__ */ L(d, {
469
- content: t.text,
622
+ case r.Markdown: return /* @__PURE__ */ L(f, {
623
+ content: e.text,
470
624
  isStreaming: !1,
471
- codeBlockTheme: F,
625
+ codeBlockTheme: I,
472
626
  containerClassName: "flex h-full min-h-0 flex-col",
473
627
  classNames: {
474
- ...c,
628
+ ...l,
475
629
  tableWrapper: "my-0 max-h-full",
476
630
  tableScrollContainer: "max-h-full"
477
631
  }
478
632
  });
479
- case i.MarkdownTable: return /* @__PURE__ */ L(d, {
480
- content: t.text,
633
+ case r.MarkdownTable: return /* @__PURE__ */ L(f, {
634
+ content: e.text,
481
635
  isStreaming: !1,
482
- codeBlockTheme: F,
636
+ codeBlockTheme: I,
483
637
  containerClassName: "flex h-full min-h-0 flex-col",
484
638
  classNames: {
485
- ...c,
639
+ ...l,
486
640
  tableWrapper: "my-0 max-h-full",
487
641
  tableScrollContainer: "max-h-full"
488
642
  },
489
643
  tableActionLabels: {
490
- copyCsvLabel: ie,
491
- copyTxtLabel: O,
492
- copyMarkdownLabel: k,
493
- copiedLabel: A,
494
- downloadCsvLabel: M
644
+ copyCsvLabel: re,
645
+ copyTxtLabel: ie,
646
+ copyMarkdownLabel: ae,
647
+ copiedLabel: oe,
648
+ downloadCsvLabel: k
495
649
  },
496
- tableDownloadFilename: se
650
+ tableDownloadFilename: z
497
651
  });
498
- case i.Json: return /* @__PURE__ */ L("div", {
652
+ case r.Json: return /* @__PURE__ */ L("div", {
499
653
  dir: "ltr",
500
654
  className: "h-full overflow-auto",
501
655
  children: /* @__PURE__ */ L("div", {
502
- className: m("m-3 overflow-auto rounded-md border", K.jsonWrapper),
503
- children: /* @__PURE__ */ L(ae, {
504
- data: t.value,
656
+ className: h("m-3 overflow-auto rounded-md border", J.jsonWrapper),
657
+ children: /* @__PURE__ */ L(se, {
658
+ data: e.value,
505
659
  style: {
506
- container: m("whitespace-pre-wrap break-words p-2", H?.jsonClassName ?? "dial-code-text"),
507
- basicChildStyle: oe.basicChildStyle,
660
+ container: h("whitespace-pre-wrap break-words p-2", U?.jsonClassName ?? "dial-code-text"),
661
+ basicChildStyle: ce.basicChildStyle,
508
662
  childFieldsContainer: "m-0 ps-3",
509
- label: m("me-1 font-semibold", K.jsonLabel),
510
- clickableLabel: m("me-1 cursor-pointer font-semibold hover:underline", K.jsonClickableLabel),
511
- nullValue: m("italic", K.jsonNullValue),
512
- undefinedValue: m("italic", K.jsonNullValue),
513
- stringValue: K.jsonStringValue,
514
- booleanValue: K.jsonBooleanValue,
515
- numberValue: K.jsonNumberValue,
516
- otherValue: m("italic", K.jsonNullValue),
517
- punctuation: m("me-1", K.jsonPunctuation),
518
- collapseIcon: m("me-1 cursor-pointer select-none transition-colors", K.jsonCollapseIcon),
519
- expandIcon: m("me-1 cursor-pointer select-none transition-colors", K.jsonExpandIcon),
520
- collapsedContent: m("me-1 cursor-pointer rounded px-1", K.jsonCollapsedContent)
663
+ label: h("me-1 font-semibold", J.jsonLabel),
664
+ clickableLabel: h("me-1 cursor-pointer font-semibold hover:underline", J.jsonClickableLabel),
665
+ nullValue: h("italic", J.jsonNullValue),
666
+ undefinedValue: h("italic", J.jsonNullValue),
667
+ stringValue: J.jsonStringValue,
668
+ booleanValue: J.jsonBooleanValue,
669
+ numberValue: J.jsonNumberValue,
670
+ otherValue: h("italic", J.jsonNullValue),
671
+ punctuation: h("me-1", J.jsonPunctuation),
672
+ collapseIcon: h("me-1 cursor-pointer select-none transition-colors", J.jsonCollapseIcon),
673
+ expandIcon: h("me-1 cursor-pointer select-none transition-colors", J.jsonExpandIcon),
674
+ collapsedContent: h("me-1 cursor-pointer rounded px-1", J.jsonCollapsedContent)
521
675
  }
522
676
  })
523
677
  })
524
678
  });
525
- case i.Code: return /* @__PURE__ */ L(ue, {
526
- content: t,
527
- codeBlockTheme: F,
679
+ case r.Code: return /* @__PURE__ */ L(ue, {
680
+ content: e,
681
+ codeBlockTheme: I,
528
682
  labels: {
529
- loadingLabel: ee,
530
- errorLabel: te,
531
- retryLabel: re
683
+ loadingLabel: O,
684
+ errorLabel: ee,
685
+ retryLabel: te
532
686
  }
533
687
  });
534
- case i.Html: return /* @__PURE__ */ L(fe, {
535
- content: t,
688
+ case r.Html: return /* @__PURE__ */ L(fe, {
689
+ content: e,
536
690
  labels: {
537
- htmlFrameBlockedLabel: h,
691
+ htmlFrameBlockedLabel: m,
538
692
  htmlOpenInNewTabLabel: g
539
693
  },
540
- isSourceView: o,
541
- title: r,
542
- codeBlockTheme: F
694
+ isSourceView: a,
695
+ title: i,
696
+ codeBlockTheme: I
543
697
  });
544
- case i.Pdf: return /* @__PURE__ */ L(a, {
545
- retryKey: U,
546
- onRetry: he,
698
+ case r.Pdf: return /* @__PURE__ */ L(o, {
699
+ retryKey: G,
700
+ onRetry: ge,
547
701
  labels: {
548
702
  loadingLabel: S,
549
- errorLabel: T,
703
+ errorLabel: C,
550
704
  retryLabel: E
551
705
  },
552
- children: /* @__PURE__ */ L(me, {
553
- fileName: r,
554
- url: t.url,
555
- highlights: t.highlights ?? [],
556
- selectedHighlightId: t.selectedHighlightId,
557
- selectedPageNumber: t.page,
558
- loadPdf: z,
559
- hideHeader: B,
560
- configurePdfWorker: ce,
706
+ children: /* @__PURE__ */ L(he, {
707
+ fileName: i,
708
+ url: e.url,
709
+ highlights: e.highlights ?? [],
710
+ selectedHighlightId: e.selectedHighlightId,
711
+ selectedPageNumber: e.page,
712
+ loadPdf: B,
713
+ hideHeader: le,
714
+ configurePdfWorker: V,
561
715
  labels: {
562
716
  thumbnailsLabel: _,
563
717
  showThumbnailsLabel: v,
564
718
  hideThumbnailsLabel: y,
565
- pageNumberLabel: x,
719
+ pageNumberLabel: b,
566
720
  loadingLabel: S,
567
- errorLabel: T,
721
+ errorLabel: C,
568
722
  retryLabel: E
569
723
  }
570
724
  })
571
- }, t.url);
572
- case i.Ooxml: return /* @__PURE__ */ L(ge, {
573
- content: t,
574
- fileName: r,
575
- loadErrorLabel: l,
725
+ }, e.url);
726
+ case r.Ooxml: return /* @__PURE__ */ L(_e, {
727
+ content: e,
728
+ fileName: i,
729
+ loadErrorLabel: c,
576
730
  formulaLabel: D,
577
- formulaLabelClassName: H?.xlsxFormulaLabelClassName ?? "dial-italic-text"
731
+ formulaLabelClassName: U?.xlsxFormulaLabelClassName ?? "dial-italic-text",
732
+ highlightsLabel: j,
733
+ highlightNavigatedLabel: M
578
734
  });
579
- case i.Visualizer: return /* @__PURE__ */ L(_e, {
580
- content: t,
581
- errorLabel: p
735
+ case r.Visualizer: return /* @__PURE__ */ L(ve, {
736
+ content: e,
737
+ errorLabel: d
582
738
  });
583
- case i.McpApp: return /* @__PURE__ */ L(pe, { content: t });
584
- case i.Unsupported: return /* @__PURE__ */ L("p", {
585
- className: m("text-center", K.statusLabel),
739
+ case r.McpApp: return /* @__PURE__ */ L(pe, { content: e });
740
+ case r.Unsupported: return /* @__PURE__ */ L("p", {
741
+ className: h("text-center", J.statusLabel),
586
742
  children: s
587
743
  });
588
- case i.Error: {
589
- let n = t.errorType === e.Forbidden;
744
+ case r.Error: {
745
+ let n = e.errorType === t.Forbidden;
590
746
  return /* @__PURE__ */ R("div", {
591
747
  className: "flex flex-col items-center gap-2",
592
- children: [L(n ? ne : w, {
748
+ children: [L(n ? ne : T, {
593
749
  size: 60,
594
- stroke: b,
595
- className: K.errorIcon
750
+ stroke: x,
751
+ className: J.errorIcon
596
752
  }), /* @__PURE__ */ L("p", {
597
- className: m("text-center", K.statusLabel),
598
- children: n ? u : l
753
+ className: h("text-center", J.statusLabel),
754
+ children: n ? u : c
599
755
  })]
600
756
  });
601
757
  }
602
758
  }
603
759
  }, [
604
- t,
605
- H?.fontClassName,
606
- H?.jsonClassName,
607
- H?.xlsxFormulaLabelClassName,
608
- r,
609
- F,
760
+ e,
761
+ U?.fontClassName,
762
+ U?.jsonClassName,
763
+ U?.xlsxFormulaLabelClassName,
764
+ i,
765
+ I,
610
766
  s,
611
- l,
767
+ c,
612
768
  u,
613
- p,
614
- h,
769
+ d,
770
+ m,
615
771
  g,
616
- o,
617
- se,
772
+ a,
618
773
  z,
619
774
  B,
620
- ce,
775
+ le,
776
+ V,
621
777
  _,
622
778
  v,
623
779
  y,
624
- x,
780
+ b,
625
781
  S,
626
- T,
782
+ C,
627
783
  E,
628
784
  D,
785
+ O,
629
786
  ee,
630
787
  te,
631
- re,
632
- me,
633
- U,
634
788
  he,
789
+ G,
790
+ ge,
791
+ re,
635
792
  ie,
636
- O,
793
+ ae,
794
+ oe,
637
795
  k,
638
- A,
796
+ j,
639
797
  M
640
798
  ]);
641
799
  return /* @__PURE__ */ L("div", {
642
- style: !n && be.has(t.type) ? xe : void 0,
643
- className: m(n ? "flex h-full items-center justify-center" : Se, le),
644
- children: n ? /* @__PURE__ */ L(C, {}) : Ce
800
+ style: !n && xe.has(e.type) ? q : void 0,
801
+ className: h(n ? "flex h-full items-center justify-center" : Se, de),
802
+ children: n ? /* @__PURE__ */ L(w, {}) : Ce
645
803
  });
646
- }), Se = 2e3, Ce = A(({ isOpen: e, isLoading: t = !1, onClose: n, content: a, fileName: o, labels: { ariaLabel: s, closeLabel: c = "Close", downloadLabel: l = "Download", copyTextLabel: u = "Copy text", copiedTextLabel: d = "Copied!", copyMarkdownLabel: f = "Copy as Markdown", copiedMarkdownLabel: p = "Copied!", copyJsonLabel: h = "Copy as JSON", copiedJsonLabel: g = "Copied!", visualizerErrorLabel: S, unsupportedLabel: C = "Preview is not supported for this file", loadErrorLabel: w = "Failed to load file", forbiddenErrorLabel: ne = "You don't have permission to access this file", htmlFrameBlockedLabel: O = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: k = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: M = "View rendered", mcpAppReloadLabel: P = "Reload", pdfThumbnailsLabel: ae, pdfShowThumbnailsLabel: oe, pdfHideThumbnailsLabel: z, pdfPageNumberLabel: B, pdfContentLoadingLabel: ce, pdfContentErrorLabel: V, pdfContentRetryLabel: H, xlsxFormulaLabel: le, codeContentLoadingLabel: ue, codeContentErrorLabel: de, codeContentRetryLabel: fe, tableCopyCsvLabel: U, tableCopyTxtLabel: pe, tableCopyMarkdownLabel: W, tableCopiedLabel: me, tableDownloadCsvLabel: he }, onDownload: ge, onCopyText: G, onCopyMarkdown: _e, onCopyJson: K, tableDownloadFilename: ve, isMobile: ye = !1, defaultWidth: be, minWidth: Ce = 600, maxWidth: we = 1500, onResizeStop: Te, styles: Ee, codeBlockTheme: De, loadPdf: Oe, configurePdfWorker: ke }) => {
647
- let [Ae, q] = I(!1), [je, Me] = I(!1), [Ne, Pe] = I(!1), [J, Fe] = I(!1), Y = F(null), X = F(null), Z = F(null), Ie = j(() => {
648
- G?.(), Y.current != null && clearTimeout(Y.current), q(!0), Y.current = setTimeout(() => q(!1), Se);
649
- }, [G]), Le = j(() => {
650
- _e?.(), X.current != null && clearTimeout(X.current), Me(!0), X.current = setTimeout(() => Me(!1), Se);
651
- }, [_e]), Q = j(() => {
652
- K?.(), Z.current != null && clearTimeout(Z.current), Pe(!0), Z.current = setTimeout(() => Pe(!1), Se);
653
- }, [K]);
654
- N(() => () => {
655
- Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
804
+ }), Ce = 2e3, we = k(({ isOpen: e, isLoading: t = !1, onClose: n, content: i, fileName: o, labels: { ariaLabel: s, closeLabel: c = "Close", resizeLabel: l = "Resize panel", downloadLabel: u = "Download", copyTextLabel: d = "Copy text", copiedTextLabel: f = "Copied!", copyMarkdownLabel: p = "Copy as Markdown", copiedMarkdownLabel: m = "Copied!", copyJsonLabel: g = "Copy as JSON", copiedJsonLabel: _ = "Copied!", visualizerErrorLabel: C, unsupportedLabel: w = "Preview is not supported for this file", loadErrorLabel: T = "Failed to load file", forbiddenErrorLabel: ne = "You don't have permission to access this file", htmlFrameBlockedLabel: ae = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: oe = "Open in new tab", htmlViewSourceLabel: k = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: N = "Reload", pdfThumbnailsLabel: se, pdfShowThumbnailsLabel: ce, pdfHideThumbnailsLabel: z, pdfPageNumberLabel: B, pdfContentLoadingLabel: le, pdfContentErrorLabel: V, pdfContentRetryLabel: H, xlsxFormulaLabel: U, codeContentLoadingLabel: ue, codeContentErrorLabel: de, codeContentRetryLabel: fe, tableCopyCsvLabel: W, tableCopyTxtLabel: pe, tableCopyMarkdownLabel: G, tableCopiedLabel: me, tableDownloadCsvLabel: he, ooxmlHighlightsLabel: ge, ooxmlHighlightNavigatedLabel: K }, onDownload: _e, onCopyText: q, onCopyMarkdown: ve, onCopyJson: J, tableDownloadFilename: ye, isMobile: be = !1, defaultWidth: xe, minWidth: we = 600, maxWidth: Te = 1500, onResizeStop: Ee, styles: De, codeBlockTheme: Oe, loadPdf: ke, configurePdfWorker: Ae }) => {
805
+ let [je, Y] = F(!1), [Me, Ne] = F(!1), [Pe, Fe] = F(!1), [X, Ie] = F(!1), Le = P(null), Z = P(null), Q = P(null), Re = A(() => {
806
+ q?.(), Le.current != null && clearTimeout(Le.current), Y(!0), Le.current = setTimeout(() => Y(!1), Ce);
807
+ }, [q]), ze = A(() => {
808
+ ve?.(), Z.current != null && clearTimeout(Z.current), Ne(!0), Z.current = setTimeout(() => Ne(!1), Ce);
809
+ }, [ve]), $ = A(() => {
810
+ J?.(), Q.current != null && clearTimeout(Q.current), Fe(!0), Q.current = setTimeout(() => Fe(!1), Ce);
811
+ }, [J]);
812
+ M(() => () => {
813
+ Le.current != null && clearTimeout(Le.current), Z.current != null && clearTimeout(Z.current), Q.current != null && clearTimeout(Q.current);
656
814
  }, []);
657
- let Re = j(() => {
658
- Fe((e) => !e);
815
+ let Be = A(() => {
816
+ Ie((e) => !e);
659
817
  }, []);
660
- N(() => {
661
- Fe(!1);
662
- }, [a]);
663
- let { className: ze, panelStyles: $, ...Be } = Ee ?? {}, Ve = !t && a.type === i.Html && a.srcdoc != null, He = !t && G != null && (a.type === i.PlainText || a.type === i.Code), Ue = !t && _e != null && a.type === i.Markdown, We = !t && K != null && a.type === i.Json, Ge = !t && ge != null && r(a), Ke = !t && a.type === i.McpApp && a.onReload != null;
664
- return /* @__PURE__ */ L(v, {
818
+ M(() => {
819
+ Ie(!1);
820
+ }, [i]);
821
+ let { className: Ve, panelStyles: He, ...Ue } = De ?? {}, We = !t && i.type === r.Html && i.srcdoc != null, Ge = !t && q != null && (i.type === r.PlainText || i.type === r.Code), Ke = !t && ve != null && i.type === r.Markdown, qe = !t && J != null && i.type === r.Json, Je = !t && _e != null && a(i), Ye = !t && i.type === r.McpApp && i.onReload != null;
822
+ return /* @__PURE__ */ L(y, {
665
823
  isOpen: e,
666
- orientation: _.Right,
824
+ orientation: v.Right,
667
825
  title: o,
668
826
  labels: {
669
827
  ariaLabel: s,
670
- closeLabel: c
828
+ closeLabel: c,
829
+ resizeLabel: l
671
830
  },
672
831
  onClose: n,
673
- resizable: !ye,
674
- defaultWidth: be,
675
- minWidth: Ce,
676
- maxWidth: we,
677
- onResizeStop: Te,
832
+ resizable: !be,
833
+ defaultWidth: xe,
834
+ minWidth: we,
835
+ maxWidth: Te,
836
+ onResizeStop: Ee,
678
837
  styles: {
679
- ...$,
680
- titleClassName: $?.titleClassName ?? "dial-h3-text",
681
- headerClassName: m("border-b border-tertiary", $?.headerClassName),
682
- className: m(e ? "mobile:w-full mobile:max-w-full" : "w-0", ze, $?.className)
838
+ ...He,
839
+ titleClassName: He?.titleClassName ?? "dial-h3-text",
840
+ headerClassName: h("border-b border-tertiary", He?.headerClassName),
841
+ className: h(e ? "mobile:w-full mobile:max-w-full" : "w-0", Ve, He?.className)
683
842
  },
684
- rightActions: Ve || He || Ue || We || Ge || Ke ? /* @__PURE__ */ R(se, { children: [
685
- Ke && /* @__PURE__ */ L(x, {
843
+ rightActions: We || Ge || Ke || qe || Je || Ye ? /* @__PURE__ */ R(I, { children: [
844
+ Ye && /* @__PURE__ */ L(S, {
686
845
  icon: /* @__PURE__ */ L(ie, {
687
- size: y.LG,
688
- stroke: b,
846
+ size: b.LG,
847
+ stroke: x,
689
848
  "aria-hidden": !0
690
849
  }),
691
- "aria-label": P,
692
- tooltipProps: { tooltip: P },
693
- onClick: a.type === i.McpApp ? a.onReload : void 0
850
+ "aria-label": N,
851
+ tooltipProps: { tooltip: N },
852
+ onClick: i.type === r.McpApp ? i.onReload : void 0
694
853
  }),
695
- Ve && /* @__PURE__ */ L(x, {
696
- icon: L(J ? te : E, {
697
- size: y.LG,
698
- stroke: b,
854
+ We && /* @__PURE__ */ L(S, {
855
+ icon: L(X ? te : D, {
856
+ size: b.LG,
857
+ stroke: x,
699
858
  "aria-hidden": !0
700
859
  }),
701
- "aria-label": J ? M : A,
702
- "aria-pressed": J,
703
- tooltipProps: { tooltip: J ? M : A },
704
- onClick: Re
860
+ "aria-label": X ? j : k,
861
+ "aria-pressed": X,
862
+ tooltipProps: { tooltip: X ? j : k },
863
+ onClick: Be
705
864
  }),
706
- He && /* @__PURE__ */ L(x, {
707
- icon: L(Ae ? T : D, {
708
- size: y.LG,
709
- stroke: b,
865
+ Ge && /* @__PURE__ */ L(S, {
866
+ icon: L(je ? E : O, {
867
+ size: b.LG,
868
+ stroke: x,
710
869
  "aria-hidden": !0
711
870
  }),
712
- "aria-label": Ae ? d : u,
713
- tooltipProps: { tooltip: Ae ? d : u },
714
- onClick: Ie
871
+ "aria-label": je ? f : d,
872
+ tooltipProps: { tooltip: je ? f : d },
873
+ onClick: Re
715
874
  }),
716
- Ue && /* @__PURE__ */ L(x, {
717
- icon: L(je ? T : re, {
718
- size: y.LG,
719
- stroke: b,
875
+ Ke && /* @__PURE__ */ L(S, {
876
+ icon: L(Me ? E : re, {
877
+ size: b.LG,
878
+ stroke: x,
720
879
  "aria-hidden": !0
721
880
  }),
722
- "aria-label": je ? p : f,
723
- tooltipProps: { tooltip: je ? p : f },
724
- onClick: Le
881
+ "aria-label": Me ? m : p,
882
+ tooltipProps: { tooltip: Me ? m : p },
883
+ onClick: ze
725
884
  }),
726
- We && /* @__PURE__ */ L(x, {
727
- icon: L(Ne ? T : D, {
728
- size: y.LG,
729
- stroke: b,
885
+ qe && /* @__PURE__ */ L(S, {
886
+ icon: L(Pe ? E : O, {
887
+ size: b.LG,
888
+ stroke: x,
730
889
  "aria-hidden": !0
731
890
  }),
732
- "aria-label": Ne ? g : h,
733
- tooltipProps: { tooltip: Ne ? g : h },
734
- onClick: Q
891
+ "aria-label": Pe ? _ : g,
892
+ tooltipProps: { tooltip: Pe ? _ : g },
893
+ onClick: $
735
894
  }),
736
- Ge && /* @__PURE__ */ L(x, {
895
+ Je && /* @__PURE__ */ L(S, {
737
896
  icon: /* @__PURE__ */ L(ee, {
738
- size: y.LG,
739
- stroke: b
897
+ size: b.LG,
898
+ stroke: x
740
899
  }),
741
- "aria-label": l,
742
- tooltipProps: { tooltip: l },
743
- onClick: ge
900
+ "aria-label": u,
901
+ tooltipProps: { tooltip: u },
902
+ onClick: _e
744
903
  })
745
904
  ] }) : null,
746
- children: /* @__PURE__ */ L(xe, {
747
- content: a,
905
+ children: /* @__PURE__ */ L(Se, {
906
+ content: i,
748
907
  isLoading: t,
749
908
  fileName: o,
750
- isHtmlSourceView: J,
909
+ isHtmlSourceView: X,
751
910
  labels: {
752
- unsupportedLabel: C,
753
- loadErrorLabel: w,
911
+ unsupportedLabel: w,
912
+ loadErrorLabel: T,
754
913
  forbiddenErrorLabel: ne,
755
- visualizerErrorLabel: S,
756
- htmlFrameBlockedLabel: O,
757
- htmlOpenInNewTabLabel: k,
758
- pdfThumbnailsLabel: ae,
759
- pdfShowThumbnailsLabel: oe,
914
+ visualizerErrorLabel: C,
915
+ htmlFrameBlockedLabel: ae,
916
+ htmlOpenInNewTabLabel: oe,
917
+ pdfThumbnailsLabel: se,
918
+ pdfShowThumbnailsLabel: ce,
760
919
  pdfHideThumbnailsLabel: z,
761
920
  pdfPageNumberLabel: B,
762
- pdfContentLoadingLabel: ce,
921
+ pdfContentLoadingLabel: le,
763
922
  pdfContentErrorLabel: V,
764
923
  pdfContentRetryLabel: H,
765
- xlsxFormulaLabel: le,
924
+ xlsxFormulaLabel: U,
766
925
  codeContentLoadingLabel: ue,
767
926
  codeContentErrorLabel: de,
768
927
  codeContentRetryLabel: fe,
769
- tableCopyCsvLabel: U,
928
+ tableCopyCsvLabel: W,
770
929
  tableCopyTxtLabel: pe,
771
- tableCopyMarkdownLabel: W,
930
+ tableCopyMarkdownLabel: G,
772
931
  tableCopiedLabel: me,
773
- tableDownloadCsvLabel: he
932
+ tableDownloadCsvLabel: he,
933
+ ooxmlHighlightsLabel: ge,
934
+ ooxmlHighlightNavigatedLabel: K
774
935
  },
775
- styles: Be,
776
- codeBlockTheme: De,
777
- tableDownloadFilename: ve,
778
- loadPdf: Oe,
779
- configurePdfWorker: ke
936
+ styles: Ue,
937
+ codeBlockTheme: Oe,
938
+ tableDownloadFilename: ye,
939
+ loadPdf: ke,
940
+ configurePdfWorker: Ae
780
941
  })
781
942
  });
782
- }), we = {
783
- type: i.PlainText,
943
+ }), Te = {
944
+ type: r.PlainText,
784
945
  text: ""
785
- }, Te = (e) => {
786
- 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;
787
- }, Ee = O(void 0);
788
- Ee.displayName = "AttachmentCanvasContext";
789
- var De = ({ children: e }) => {
790
- let [t, n] = I(!1), [r, i] = I(!1), [a, o] = I(we), [s, c] = I(void 0), [l, u] = I(void 0), d = j((e, t) => {
946
+ }, Ee = (e) => {
947
+ if (!(e.type !== r.Image && e.type !== r.Audio && e.type !== r.Pdf && e.type !== r.Ooxml)) return e.url.startsWith("blob:") ? e.url : void 0;
948
+ }, De = ae(void 0);
949
+ De.displayName = "AttachmentCanvasContext";
950
+ var Oe = ({ children: e }) => {
951
+ let [t, n] = F(!1), [r, i] = F(!1), [a, o] = F(Te), [s, c] = F(void 0), [l, u] = F(void 0), d = A((e, t) => {
791
952
  c(e), u(t), i(!0), n(!0);
792
- }, []), f = j((e, t, r) => {
953
+ }, []), f = A((e, t, r) => {
793
954
  o(e), c(t), u(r), i(!1), n(!0);
794
- }, []), p = j(() => {
795
- o(we), n(!1), i(!1), u(void 0);
955
+ }, []), p = A(() => {
956
+ o(Te), n(!1), i(!1), u(void 0);
796
957
  }, []);
797
- return N(() => () => {
798
- let e = Te(a);
958
+ return M(() => () => {
959
+ let e = Ee(a);
799
960
  e != null && URL.revokeObjectURL(e);
800
- }, [a]), /* @__PURE__ */ L(Ee.Provider, {
801
- value: P(() => ({
961
+ }, [a]), /* @__PURE__ */ L(De.Provider, {
962
+ value: N(() => ({
802
963
  isOpen: t,
803
964
  isLoading: r,
804
965
  content: a,
@@ -819,26 +980,26 @@ var De = ({ children: e }) => {
819
980
  ]),
820
981
  children: e
821
982
  });
822
- }, Oe = () => {
823
- let e = M(Ee);
983
+ }, ke = () => {
984
+ let e = j(De);
824
985
  if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
825
986
  return e;
826
- }, ke = A(({ labels: e, isMobile: n = !1, defaultWidth: r, maxWidth: a, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
827
- let { ariaLabel: l = "Attachment preview", closeLabel: u = "Close", downloadLabel: d = "Download", unsupportedLabel: f = "Preview is not supported for this file", loadErrorLabel: m = "Failed to load file", forbiddenErrorLabel: h = "You don't have permission to access this file", copyTextLabel: g, copiedTextLabel: _, copyMarkdownLabel: v, copiedMarkdownLabel: y, copyJsonLabel: b, copiedJsonLabel: x, htmlFrameBlockedLabel: S, htmlOpenInNewTabLabel: C, htmlViewSourceLabel: w, htmlViewRenderedLabel: T, pdfThumbnailsLabel: E, pdfShowThumbnailsLabel: D, pdfHideThumbnailsLabel: ee, pdfPageNumberLabel: te, pdfContentLoadingLabel: ne, pdfContentErrorLabel: re, pdfContentRetryLabel: ie, xlsxFormulaLabel: O, codeContentLoadingLabel: k, codeContentErrorLabel: A, codeContentRetryLabel: M, tableCopyCsvLabel: N, tableCopyTxtLabel: P, tableCopyMarkdownLabel: F, tableCopiedLabel: I, tableDownloadCsvLabel: ae } = e ?? {}, { isOpen: oe, isLoading: se, content: R, fileName: z, closeCanvas: B } = Oe(), ce = j(() => {
828
- t(R, z);
829
- }, [R, z]), V = j(() => {
830
- (R.type === i.PlainText || R.type === i.Code) && p(R.text);
831
- }, [R]), H = j(() => {
832
- R.type === i.Markdown && p(R.text);
833
- }, [R]), le = j(() => {
834
- R.type === i.Json && p(JSON.stringify(R.value, null, 2));
835
- }, [R]);
836
- return /* @__PURE__ */ L(Ce, {
837
- isOpen: oe,
838
- isLoading: se,
839
- onClose: B,
840
- content: R,
841
- fileName: z,
987
+ }, Ae = k(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: a, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
988
+ let { ariaLabel: l = "Attachment preview", closeLabel: u = "Close", downloadLabel: d = "Download", unsupportedLabel: f = "Preview is not supported for this file", loadErrorLabel: p = "Failed to load file", forbiddenErrorLabel: h = "You don't have permission to access this file", copyTextLabel: g, copiedTextLabel: _, copyMarkdownLabel: v, copiedMarkdownLabel: y, copyJsonLabel: b, copiedJsonLabel: x, htmlFrameBlockedLabel: S, htmlOpenInNewTabLabel: C, htmlViewSourceLabel: w, htmlViewRenderedLabel: T, pdfThumbnailsLabel: E, pdfShowThumbnailsLabel: D, pdfHideThumbnailsLabel: O, pdfPageNumberLabel: ee, pdfContentLoadingLabel: te, pdfContentErrorLabel: ne, pdfContentRetryLabel: re, xlsxFormulaLabel: ie, codeContentLoadingLabel: ae, codeContentErrorLabel: oe, codeContentRetryLabel: k, tableCopyCsvLabel: j, tableCopyTxtLabel: M, tableCopyMarkdownLabel: N, tableCopiedLabel: P, tableDownloadCsvLabel: F, ooxmlHighlightsLabel: se, ooxmlHighlightNavigatedLabel: ce } = e ?? {}, { isOpen: I, isLoading: R, content: z, fileName: B, closeCanvas: le } = ke(), V = A(() => {
989
+ i(z, B);
990
+ }, [z, B]), H = A(() => {
991
+ (z.type === r.PlainText || z.type === r.Code) && m(z.text);
992
+ }, [z]), U = A(() => {
993
+ z.type === r.Markdown && m(z.text);
994
+ }, [z]), ue = A(() => {
995
+ z.type === r.Json && m(JSON.stringify(z.value, null, 2));
996
+ }, [z]);
997
+ return /* @__PURE__ */ L(we, {
998
+ isOpen: I,
999
+ isLoading: R,
1000
+ onClose: le,
1001
+ content: z,
1002
+ fileName: B,
842
1003
  labels: {
843
1004
  ariaLabel: l,
844
1005
  closeLabel: u,
@@ -850,7 +1011,7 @@ var De = ({ children: e }) => {
850
1011
  copyJsonLabel: b,
851
1012
  copiedJsonLabel: x,
852
1013
  unsupportedLabel: f,
853
- loadErrorLabel: m,
1014
+ loadErrorLabel: p,
854
1015
  forbiddenErrorLabel: h,
855
1016
  htmlFrameBlockedLabel: S,
856
1017
  htmlOpenInNewTabLabel: C,
@@ -858,69 +1019,71 @@ var De = ({ children: e }) => {
858
1019
  htmlViewRenderedLabel: T,
859
1020
  pdfThumbnailsLabel: E,
860
1021
  pdfShowThumbnailsLabel: D,
861
- pdfHideThumbnailsLabel: ee,
862
- pdfPageNumberLabel: te,
863
- pdfContentLoadingLabel: ne,
864
- pdfContentErrorLabel: re,
865
- pdfContentRetryLabel: ie,
866
- xlsxFormulaLabel: O,
867
- codeContentLoadingLabel: k,
868
- codeContentErrorLabel: A,
869
- codeContentRetryLabel: M,
870
- tableCopyCsvLabel: N,
871
- tableCopyTxtLabel: P,
872
- tableCopyMarkdownLabel: F,
873
- tableCopiedLabel: I,
874
- tableDownloadCsvLabel: ae
1022
+ pdfHideThumbnailsLabel: O,
1023
+ pdfPageNumberLabel: ee,
1024
+ pdfContentLoadingLabel: te,
1025
+ pdfContentErrorLabel: ne,
1026
+ pdfContentRetryLabel: re,
1027
+ xlsxFormulaLabel: ie,
1028
+ codeContentLoadingLabel: ae,
1029
+ codeContentErrorLabel: oe,
1030
+ codeContentRetryLabel: k,
1031
+ tableCopyCsvLabel: j,
1032
+ tableCopyTxtLabel: M,
1033
+ tableCopyMarkdownLabel: N,
1034
+ tableCopiedLabel: P,
1035
+ tableDownloadCsvLabel: F,
1036
+ ooxmlHighlightsLabel: se,
1037
+ ooxmlHighlightNavigatedLabel: ce
875
1038
  },
876
- onDownload: ce,
877
- onCopyText: R.type === i.PlainText || R.type === i.Code ? V : void 0,
878
- onCopyMarkdown: R.type === i.Markdown ? H : void 0,
879
- onCopyJson: R.type === i.Json ? le : void 0,
1039
+ onDownload: V,
1040
+ onCopyText: z.type === r.PlainText || z.type === r.Code ? H : void 0,
1041
+ onCopyMarkdown: z.type === r.Markdown ? U : void 0,
1042
+ onCopyJson: z.type === r.Json ? ue : void 0,
880
1043
  tableDownloadFilename: s,
881
- isMobile: n,
882
- defaultWidth: r,
1044
+ isMobile: t,
1045
+ defaultWidth: n,
883
1046
  maxWidth: a,
884
1047
  codeBlockTheme: o,
885
1048
  configurePdfWorker: c
886
1049
  });
887
- }), Ae = new Set(["html", "htm"]), q = {
1050
+ }), je = new Set(["html", "htm"]), Y = {
888
1051
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
889
1052
  xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
890
1053
  pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
891
- }, je = 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(".")), Me = {
1054
+ }, Me = 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(".")), Ne = {
892
1055
  docx: n.Docx,
893
1056
  xlsx: n.Xlsx,
894
1057
  pptx: n.Pptx,
895
1058
  csv: n.Csv
896
- }, Ne = {
897
- [q.docx]: n.Docx,
898
- [q.xlsx]: n.Xlsx,
899
- [q.pptx]: n.Pptx,
900
- [u.CSV]: n.Csv
901
1059
  }, Pe = {
902
- [n.Docx]: q.docx,
903
- [n.Xlsx]: q.xlsx,
904
- [n.Pptx]: q.pptx,
905
- [n.Csv]: u.CSV
906
- }, J = (e, t) => {
1060
+ [Y.docx]: n.Docx,
1061
+ [Y.xlsx]: n.Xlsx,
1062
+ [Y.pptx]: n.Pptx,
1063
+ [d.CSV]: n.Csv
1064
+ }, Fe = {
1065
+ [n.Docx]: Y.docx,
1066
+ [n.Xlsx]: Y.xlsx,
1067
+ [n.Pptx]: Y.pptx,
1068
+ [n.Csv]: d.CSV
1069
+ }, X = (e, t) => {
907
1070
  let n = t?.split(";", 1)[0].trim().toLowerCase();
908
1071
  if (n != null) {
909
- let e = Ne[n];
1072
+ let e = Pe[n];
910
1073
  if (e != null) return e;
911
1074
  }
912
1075
  let r = e.lastIndexOf(".");
913
- if (r !== -1) return Me[e.slice(r + 1).toLowerCase()];
914
- }, Fe = (e, t) => J(e, t) != null, Y = (e, t) => {
915
- let n = J(e, t);
916
- return n == null ? void 0 : Pe[n];
917
- }, X = (e) => {
918
- let t = e.lastIndexOf(".");
919
- return t === -1 ? !1 : je.has(e.slice(t + 1).toLowerCase());
1076
+ if (r !== -1) return Ne[e.slice(r + 1).toLowerCase()];
1077
+ }, Ie = (e, t) => X(e, t) != null, Le = (e, t) => {
1078
+ let n = X(e, t);
1079
+ return n == null ? void 0 : Fe[n];
920
1080
  }, Z = (e) => {
921
1081
  let t = e.lastIndexOf(".");
922
- return t === -1 ? !1 : Ae.has(e.slice(t + 1).toLowerCase());
923
- }, Ie = {
1082
+ return t === -1 ? !1 : Me.has(e.slice(t + 1).toLowerCase());
1083
+ }, Q = (e) => {
1084
+ let t = e.lastIndexOf(".");
1085
+ return t === -1 ? !1 : je.has(e.slice(t + 1).toLowerCase());
1086
+ }, Re = {
924
1087
  xml: "xml",
925
1088
  csv: "plaintext",
926
1089
  tsv: "plaintext",
@@ -968,26 +1131,26 @@ var De = ({ children: e }) => {
968
1131
  gitignore: "plaintext",
969
1132
  dockerfile: "plaintext",
970
1133
  makefile: "plaintext"
971
- }, Le = (e) => Ie[e], Q = (e) => ({
972
- type: i.Unsupported,
1134
+ }, ze = (e) => Re[e], $ = (e) => ({
1135
+ type: r.Unsupported,
1136
+ ...e != null && { url: e }
1137
+ }), Be = (e) => ({
1138
+ type: r.Error,
1139
+ errorType: t.LoadFailed,
1140
+ ...e != null && { url: e }
1141
+ }), Ve = (e) => ({
1142
+ type: r.Error,
1143
+ errorType: t.Forbidden,
973
1144
  ...e != null && { url: e }
974
- }), Re = (t) => ({
975
- type: i.Error,
976
- errorType: e.LoadFailed,
977
- ...t != null && { url: t }
978
- }), ze = (t) => ({
979
- type: i.Error,
980
- errorType: e.Forbidden,
981
- ...t != null && { url: t }
982
- }), $ = (e, t) => {
1145
+ }), He = (e, t) => {
983
1146
  let n = e.toLowerCase();
984
1147
  return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
985
- }, Be = (e) => {
1148
+ }, Ue = (e) => {
986
1149
  let t;
987
1150
  try {
988
1151
  t = new URL(e).pathname;
989
1152
  } catch {
990
- t = g(e);
1153
+ t = _(e);
991
1154
  }
992
1155
  let n = t.split("/").filter(Boolean).pop() ?? "";
993
1156
  try {
@@ -995,97 +1158,97 @@ var De = ({ children: e }) => {
995
1158
  } catch {
996
1159
  return n;
997
1160
  }
998
- }, Ve = (e, t) => {
999
- let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = Oe(), { customVisualizers: s, themeId: c, onBeforeOpen: d } = t, f = j(async (t, r) => {
1161
+ }, We = (e, t) => {
1162
+ let { openCanvas: n, openCanvasLoading: i, closeCanvas: a } = ke(), { customVisualizers: o, themeId: c, onBeforeOpen: l } = t, f = A(async (t, i) => {
1000
1163
  if (t.url == null && t.referenceUrl != null) {
1001
- let i = e.resolveReferencePdfContent(t);
1002
- if (i != null) return n(i, t.name, r), !0;
1164
+ let r = e.resolveReferencePdfContent(t);
1165
+ if (r != null) return n(r, t.name, i), !0;
1003
1166
  }
1004
- let a = t.contentType.toLowerCase(), o = $(a, s);
1005
- if (o != null) {
1006
- let i = await e.resolveVisualizerContent(t, o, c);
1007
- if (i != null) return n(i, t.name, r), !0;
1167
+ let a = t.contentType.toLowerCase(), s = He(a, o);
1168
+ if (s != null) {
1169
+ let r = await e.resolveVisualizerContent(t, s, c);
1170
+ if (r != null) return n(r, t.name, i), !0;
1008
1171
  }
1009
1172
  if (!a && t.data != null) {
1010
- let i = await e.resolveTextContent(t);
1011
- if (i != null) return n(i, t.name, r), !0;
1173
+ let r = await e.resolveTextContent(t);
1174
+ if (r != null) return n(r, t.name, i), !0;
1012
1175
  }
1013
- let d = J("", a);
1014
- if (d != null) return n(await e.resolveOoxmlContent(t, d) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
1176
+ let l = X("", a);
1177
+ if (l != null) return n(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1015
1178
  switch (a) {
1016
- case u.PDF: return n(await e.resolvePdfContent(t) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
1017
- case u.Markdown: return n(await e.resolveMarkdownContent(t) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
1018
- case u.JSON: return n(await e.resolveJsonContent(t) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
1179
+ case d.PDF: return n(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1180
+ case d.Markdown: return n(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1181
+ case d.JSON: return n(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1019
1182
  }
1020
- let f = t.name ?? "", p = f.lastIndexOf("."), m = p === -1 ? "" : f.slice(p + 1).toLowerCase(), h = J(f);
1021
- if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
1183
+ let f = t.name ?? "", p = f.lastIndexOf("."), m = p === -1 ? "" : f.slice(p + 1).toLowerCase(), h = X(f);
1184
+ if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1022
1185
  switch (m) {
1023
- case l.Markdown:
1024
- case l.MarkdownAlt: {
1025
- let i = await e.resolveMarkdownContent(t);
1026
- return i == null ? !1 : (n(i, t.name, r), !0);
1186
+ case u.Markdown:
1187
+ case u.MarkdownAlt: {
1188
+ let r = await e.resolveMarkdownContent(t);
1189
+ return r == null ? !1 : (n(r, t.name, i), !0);
1027
1190
  }
1028
- case l.JSON: {
1029
- let i = await e.resolveJsonContent(t);
1030
- return i == null ? !1 : (n(i, t.name, r), !0);
1191
+ case u.JSON: {
1192
+ let r = await e.resolveJsonContent(t);
1193
+ return r == null ? !1 : (n(r, t.name, i), !0);
1031
1194
  }
1032
- case l.PDF: {
1033
- let i = await e.resolvePdfContent(t);
1034
- return i == null ? !1 : (n(i, t.name, r), !0);
1195
+ case u.PDF: {
1196
+ let r = await e.resolvePdfContent(t);
1197
+ return r == null ? !1 : (n(r, t.name, i), !0);
1035
1198
  }
1036
1199
  }
1037
- let g = t.name != null && Z(t.name) || t.url != null && Z(Be(t.url));
1038
- if (t.name != null && !X(t.name) && !g) return n(Q(e.resolveContentUrl(t)), t.name, r), !0;
1200
+ let g = t.name != null && Q(t.name) || t.url != null && Q(Ue(t.url));
1201
+ if (t.name != null && !Z(t.name) && !g) return n($(e.resolveContentUrl(t)), t.name, i), !0;
1039
1202
  if (g) {
1040
1203
  let a = await e.resolveHtmlContent(t);
1041
- return a == null ? e.hasTextSource(t) ? (n(Q(e.resolveContentUrl(t)), t.name, r), !0) : t.url == null ? !1 : (n({
1042
- type: i.Html,
1204
+ return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, i), !0) : t.url == null ? !1 : (n({
1205
+ type: r.Html,
1043
1206
  url: t.url
1044
- }, t.name, r), !0) : (n(a, t.name, r), !0);
1207
+ }, t.name, i), !0) : (n(a, t.name, i), !0);
1045
1208
  }
1046
- let _ = await e.resolveCodeContent(t, Le(m));
1047
- return _ == null ? !1 : (n(_, t.name, r), !0);
1209
+ let _ = await e.resolveCodeContent(t, ze(m));
1210
+ return _ == null ? !1 : (n(_, t.name, i), !0);
1048
1211
  }, [
1049
1212
  n,
1050
- s,
1213
+ o,
1051
1214
  c,
1052
1215
  e
1053
1216
  ]);
1054
- return { openAttachmentCanvas: j(async (t, s = t.id) => {
1217
+ return { openAttachmentCanvas: A(async (t, o = t.id) => {
1055
1218
  switch (t.type) {
1056
- case o.Image: {
1219
+ case s.Image: {
1057
1220
  let r = e.resolveImageContent(t);
1058
- return r == null ? !1 : (d?.(), n(r, t.name, s), !0);
1221
+ return r == null ? !1 : (l?.(), n(r, t.name, o), !0);
1059
1222
  }
1060
- case o.Audio: {
1223
+ case s.Audio: {
1061
1224
  let e = t.playUrl ?? t.url;
1062
1225
  return e == null ? !1 : (n({
1063
- type: i.Audio,
1226
+ type: r.Audio,
1064
1227
  url: e,
1065
1228
  mimeType: t.contentType || void 0
1066
- }, t.name, s), !0);
1229
+ }, t.name, o), !0);
1067
1230
  }
1068
- case o.File: {
1069
- d?.(), r(t.name, s);
1070
- let e = await f(t, s);
1231
+ case s.File: {
1232
+ l?.(), i(t.name, o);
1233
+ let e = await f(t, o);
1071
1234
  return e || a(), e;
1072
1235
  }
1073
- case o.Pasted:
1074
- case o.Prompt: {
1075
- d?.(), r(t.name, s);
1076
- let i = await e.resolveTextContent(t);
1077
- return i == null ? (a(), !1) : (n(i, t.name, s), !0);
1236
+ case s.Pasted:
1237
+ case s.Prompt: {
1238
+ l?.(), i(t.name, o);
1239
+ let r = await e.resolveTextContent(t);
1240
+ return r == null ? (a(), !1) : (n(r, t.name, o), !0);
1078
1241
  }
1079
1242
  default: return !1;
1080
1243
  }
1081
1244
  }, [
1082
1245
  n,
1083
- r,
1246
+ i,
1084
1247
  a,
1085
- d,
1248
+ l,
1086
1249
  f,
1087
1250
  e
1088
1251
  ]) };
1089
1252
  };
1090
1253
  //#endregion
1091
- export { Ce as AttachmentCanvas, xe as AttachmentCanvasBody, ke as AttachmentCanvasContainer, De as AttachmentCanvasProvider, i as AttachmentContentType, e as AttachmentErrorType, ue as CodeContent, pe as McpAppCanvasRenderer, n as OoxmlFileType, ze as createForbiddenCanvasContent, Re as createLoadErrorCanvasContent, Q as createUnsupportedCanvasContent, t as downloadAttachmentContent, Le as extensionToLanguage, $ as findVisualizerForMime, J as getOoxmlFileType, Y as getOoxmlMimeType, r as isDownloadable, Z as isHtmlPreviewable, Fe as isOoxmlPreviewable, X as isTextPreviewable, Oe as useAttachmentCanvas, Ve as useOpenAttachmentCanvas };
1254
+ export { we as AttachmentCanvas, Se as AttachmentCanvasBody, Ae as AttachmentCanvasContainer, Oe as AttachmentCanvasProvider, r as AttachmentContentType, t as AttachmentErrorType, ue as CodeContent, pe as McpAppCanvasRenderer, n as OoxmlFileType, e as OoxmlHighlightKind, Ve as createForbiddenCanvasContent, Be as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, i as downloadAttachmentContent, ze as extensionToLanguage, He as findVisualizerForMime, X as getOoxmlFileType, Le as getOoxmlMimeType, a as isDownloadable, Q as isHtmlPreviewable, Ie as isOoxmlPreviewable, Z as isTextPreviewable, ke as useAttachmentCanvas, We as useOpenAttachmentCanvas };