@epam/ai-dial-attachment-canvas 1.1.0-dev.402 → 1.1.0-dev.411

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,40 +1,40 @@
1
1
  import { c as e, i as t, l as n, o as r, s as i, t as a } from "./LazyContentBoundary-DkAcpR4S.js";
2
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 ee, IconCopy as te, IconDownload as ne, IconEye as re, IconLock as ie, IconMarkdown as ae } from "@tabler/icons-react";
6
- import { createContext as E, lazy as D, memo as O, useCallback as k, useContext as A, useEffect as j, useMemo as M, useRef as N, useState as P } from "react";
7
- import { JsonView as oe, defaultStyles as se } from "react-json-view-lite";
8
- import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
9
- import { AppRenderer as ce } from "@mcp-ui/client";
10
- import { VisualizerConnectorRequests as le } from "@epam/ai-dial-shared";
11
- import { VisualizerConnector as R } from "@epam/ai-dial-visualizer-connector";
12
- var ue = {
3
+ import { SidebarOrientation as _, SidebarPanel as ee } from "@epam/ai-dial-sidebar";
4
+ import { DIAL_ICON_SIZE as v, DIAL_KIT_ICON_STROKE as y, GhostIconButton as b, LinkButton as x, Spinner as S } from "@epam/ai-dial-ui-kit";
5
+ import { IconAlertTriangle as C, IconCheck as w, IconCode as te, IconCopy as ne, IconDownload as re, IconEye as ie, IconLock as ae, IconMarkdown as oe, IconRefresh as se } from "@tabler/icons-react";
6
+ import { createContext as T, lazy as E, memo as D, useCallback as O, useContext as k, useEffect as A, useMemo as j, useRef as M, useState as N } from "react";
7
+ import { JsonView as ce, defaultStyles as le } from "react-json-view-lite";
8
+ import { Fragment as ue, jsx as P, jsxs as F } from "react/jsx-runtime";
9
+ import { AppRenderer as de } from "@mcp-ui/client";
10
+ import { VisualizerConnectorRequests as I } from "@epam/ai-dial-shared";
11
+ import { VisualizerConnector as fe } from "@epam/ai-dial-visualizer-connector";
12
+ var L = {
13
13
  container: "_container_1nhig_1",
14
14
  containerLight: "_containerLight_1nhig_5"
15
- }, de = {
15
+ }, pe = {
16
16
  [s.Dark]: h,
17
17
  [s.Light]: h
18
- }, fe = () => D(async () => {
18
+ }, R = () => E(async () => {
19
19
  let { Prism: e } = await import("react-syntax-highlighter");
20
20
  return { default: e };
21
- }), pe = O(({ content: e, codeBlockTheme: t = s.Light, labels: n }) => {
22
- let { text: r, language: i } = e, o = i == null || i === "plaintext", c = de[t], l = t === s.Light, [u, d] = P(0), f = M(fe, [u]), p = k(() => {
21
+ }), me = D(({ content: e, codeBlockTheme: t = s.Light, labels: n }) => {
22
+ let { text: r, language: i } = e, o = i == null || i === "plaintext", c = pe[t], l = t === s.Light, [u, d] = N(0), f = j(R, [u]), p = O(() => {
23
23
  d((e) => e + 1);
24
- }, []), h = /* @__PURE__ */ I("pre", {
24
+ }, []), h = /* @__PURE__ */ P("pre", {
25
25
  className: "whitespace-pre-wrap break-words p-4",
26
26
  children: r
27
27
  });
28
- return /* @__PURE__ */ I("div", {
28
+ return /* @__PURE__ */ P("div", {
29
29
  dir: "ltr",
30
- className: m("h-full overflow-auto", ue.container, l && ue.containerLight),
31
- children: o ? h : /* @__PURE__ */ I(a, {
30
+ className: m("h-full overflow-auto", L.container, l && L.containerLight),
31
+ children: o ? h : /* @__PURE__ */ P(a, {
32
32
  retryKey: u,
33
33
  onRetry: p,
34
34
  pendingContent: h,
35
35
  errorContent: h,
36
36
  labels: n,
37
- children: /* @__PURE__ */ I(f, {
37
+ children: /* @__PURE__ */ P(f, {
38
38
  language: i,
39
39
  style: c,
40
40
  customStyle: {
@@ -51,21 +51,21 @@ var ue = {
51
51
  })
52
52
  })
53
53
  });
54
- }), z = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, me = O(({ 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] = P(!0), [d, f] = P(!1), p = N(null);
56
- j(() => {
54
+ }), he = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ge = D(({ 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] = N(!0), [d, f] = N(!1), p = M(null);
56
+ A(() => {
57
57
  u(!0), f(!1);
58
58
  }, [e]);
59
- let h = k((t) => {
59
+ let h = O((t) => {
60
60
  if (u(!1), e.srcdoc == null) try {
61
61
  p.current?.contentDocument ?? f(!0);
62
62
  } catch {
63
63
  f(!0);
64
64
  }
65
- }, [e.srcdoc]), g = k(() => {
65
+ }, [e.srcdoc]), g = O(() => {
66
66
  u(!1), f(!0);
67
67
  }, []);
68
- if (n && e.srcdoc != null) return /* @__PURE__ */ I(pe, {
68
+ if (n && e.srcdoc != null) return /* @__PURE__ */ P(me, {
69
69
  content: {
70
70
  type: i.Code,
71
71
  text: e.srcdoc,
@@ -73,70 +73,89 @@ var ue = {
73
73
  },
74
74
  codeBlockTheme: a
75
75
  });
76
- if (d) return /* @__PURE__ */ L("div", {
76
+ if (d) return /* @__PURE__ */ F("div", {
77
77
  className: "flex h-full flex-col items-center justify-center gap-3 p-4",
78
- children: [/* @__PURE__ */ I("p", {
78
+ children: [/* @__PURE__ */ P("p", {
79
79
  className: "text-center",
80
80
  children: s
81
- }), e.url != null && /* @__PURE__ */ I(S, {
81
+ }), e.url != null && /* @__PURE__ */ P(x, {
82
82
  href: e.url,
83
83
  target: "_blank",
84
84
  label: c,
85
- className: z.openInNewTabButton,
85
+ className: he.openInNewTabButton,
86
86
  textClassName: o
87
87
  })]
88
88
  });
89
- let _ = e.srcdoc != null, v = _ ? void 0 : e.url, y = _ ? e.srcdoc : void 0;
90
- return /* @__PURE__ */ L("div", {
89
+ let _ = e.srcdoc != null, ee = _ ? void 0 : e.url, v = _ ? e.srcdoc : void 0;
90
+ return /* @__PURE__ */ F("div", {
91
91
  className: "relative h-full",
92
- children: [l && /* @__PURE__ */ I("div", {
92
+ children: [l && /* @__PURE__ */ P("div", {
93
93
  className: "absolute inset-0 flex items-center justify-center",
94
- children: /* @__PURE__ */ I(C, {})
95
- }), /* @__PURE__ */ I("iframe", {
94
+ children: /* @__PURE__ */ P(S, {})
95
+ }), /* @__PURE__ */ P("iframe", {
96
96
  ref: p,
97
97
  title: r,
98
- src: v,
99
- srcDoc: y,
98
+ src: ee,
99
+ srcDoc: v,
100
100
  sandbox: _ ? "allow-scripts" : "allow-scripts allow-same-origin",
101
101
  className: m("h-full w-full border-none", l ? "invisible" : ""),
102
102
  onLoad: h,
103
103
  onError: g
104
104
  })]
105
105
  });
106
- }), B = {
107
- loadingOverlay: "_loadingOverlay_t3d2v_1",
108
- statusLabel: "_statusLabel_t3d2v_5",
109
- errorIcon: "_errorIcon_t3d2v_9"
110
- }, he = ({ content: e, errorLabel: t = "Failed to load app" }) => {
111
- let [n, r] = P("loading"), { html: i, sandboxUrl: a, toolName: o, toolInput: s, toolResult: c, hostContext: l, onToolCall: u } = e;
112
- return /* @__PURE__ */ L("div", {
113
- className: "relative h-full w-full",
106
+ }), z = {
107
+ loadingOverlay: "_loadingOverlay_72o98_1",
108
+ fullscreenFrame: "_fullscreenFrame_72o98_14",
109
+ statusLabel: "_statusLabel_72o98_19",
110
+ errorIcon: "_errorIcon_72o98_23"
111
+ }, B = ({ content: e, errorLabel: t = "Failed to load app" }) => {
112
+ let [n, r] = N("loading"), { html: i, sandboxUrl: a, toolName: o, toolInput: s, toolResult: c, hostContext: l, onToolCall: u } = e, d = j(() => ({ url: new URL(a) }), [a]), f = l?.displayMode === "fullscreen", p = M(null), [h, g] = N();
113
+ A(() => {
114
+ let e = p.current;
115
+ if (!e) return;
116
+ let t = new ResizeObserver(([e]) => {
117
+ if (!e) return;
118
+ let { width: t, height: n } = e.contentRect;
119
+ g({
120
+ width: Math.round(t),
121
+ height: Math.round(n)
122
+ });
123
+ });
124
+ return t.observe(e), () => t.disconnect();
125
+ }, []);
126
+ let _ = j(() => l == null || h == null ? l : {
127
+ ...l,
128
+ containerDimensions: h
129
+ }, [l, h]);
130
+ return /* @__PURE__ */ F("div", {
131
+ ref: p,
132
+ className: m("relative h-full w-full", f && z.fullscreenFrame),
114
133
  children: [
115
- /* @__PURE__ */ I(ce, {
134
+ /* @__PURE__ */ P(de, {
116
135
  html: i,
117
136
  toolName: o,
118
137
  toolInput: s,
119
138
  toolResult: c,
120
- hostContext: l,
121
- sandbox: { url: new URL(a) },
139
+ hostContext: _,
140
+ sandbox: d,
122
141
  onCallTool: (e) => u(e.name, e.arguments),
123
142
  onSizeChanged: () => r("ready"),
124
143
  onError: () => r("error")
125
144
  }),
126
- n === "loading" && /* @__PURE__ */ I("div", {
127
- className: m("absolute inset-0 flex flex-col items-center justify-center gap-2", B.loadingOverlay),
128
- children: /* @__PURE__ */ I(C, {})
145
+ n === "loading" && /* @__PURE__ */ P("div", {
146
+ className: m("absolute inset-0 flex flex-col items-center justify-center gap-2", z.loadingOverlay),
147
+ children: /* @__PURE__ */ P(S, {})
129
148
  }),
130
- n === "error" && /* @__PURE__ */ L("div", {
149
+ n === "error" && /* @__PURE__ */ F("div", {
131
150
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
132
- children: [/* @__PURE__ */ I(w, {
151
+ children: [/* @__PURE__ */ P(C, {
133
152
  size: 60,
134
- stroke: b,
153
+ stroke: y,
135
154
  "aria-hidden": !0,
136
- className: B.errorIcon
137
- }), /* @__PURE__ */ I("p", {
155
+ className: z.errorIcon
156
+ }), /* @__PURE__ */ P("p", {
138
157
  role: "alert",
139
- className: m("text-center", B.statusLabel),
158
+ className: m("text-center", z.statusLabel),
140
159
  children: t
141
160
  })]
142
161
  })
@@ -149,13 +168,13 @@ var ue = {
149
168
  formulaValue: "_formulaValue_1npwu_17",
150
169
  statusOverlay: "_statusOverlay_1npwu_23",
151
170
  errorIcon: "_errorIcon_1npwu_28"
152
- }, ge = (e) => {
171
+ }, _e = (e) => {
153
172
  if (e?.kind !== "range") return "";
154
173
  let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
155
174
  if (n == null) return "";
156
175
  let r = n.formula;
157
176
  return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
158
- }, _e = async (e, t, r, i) => {
177
+ }, ve = async (e, t, r, i) => {
159
178
  switch (t) {
160
179
  case n.Docx: {
161
180
  let [{ DocxScrollViewer: t }, { chartEx: n }] = await Promise.all([import("./docx-B9qBTEkj.js"), import("./chart-ex-B0DgG3Dt.js")]);
@@ -197,18 +216,18 @@ var ue = {
197
216
  });
198
217
  }
199
218
  }
200
- }, ve = ({ content: e, fileName: t, loadErrorLabel: r, formulaLabel: i, formulaLabelClassName: a }) => {
201
- let o = N(null), [s, c] = P(!0), [l, u] = P(!1), [d, f] = P("");
202
- return j(() => {
219
+ }, ye = ({ content: e, fileName: t, loadErrorLabel: r, formulaLabel: i, formulaLabelClassName: a }) => {
220
+ let o = M(null), [s, c] = N(!0), [l, u] = N(!1), [d, f] = N("");
221
+ return A(() => {
203
222
  let t = o.current;
204
223
  if (t == null) return;
205
224
  let n, r = !1;
206
225
  return c(!0), u(!1), f(""), (async () => {
207
226
  try {
208
- let i = await _e(t, e.format, () => {
227
+ let i = await ve(t, e.format, () => {
209
228
  r || (c(!1), u(!0));
210
229
  }, (e) => {
211
- r || f(ge(e));
230
+ r || f(_e(e));
212
231
  });
213
232
  if (r) {
214
233
  i.destroy();
@@ -221,18 +240,18 @@ var ue = {
221
240
  })(), () => {
222
241
  r = !0, n?.destroy(), t.replaceChildren();
223
242
  };
224
- }, [e.format, e.url]), /* @__PURE__ */ L("div", {
243
+ }, [e.format, e.url]), /* @__PURE__ */ F("div", {
225
244
  className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
226
245
  children: [
227
- e.format === n.Xlsx && /* @__PURE__ */ L("div", {
246
+ e.format === n.Xlsx && /* @__PURE__ */ F("div", {
228
247
  role: "region",
229
248
  "aria-label": i,
230
249
  className: m("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", V.formulaPanel),
231
- children: [/* @__PURE__ */ I("span", {
250
+ children: [/* @__PURE__ */ P("span", {
232
251
  "aria-hidden": "true",
233
252
  className: m("shrink-0", a),
234
253
  children: "fx"
235
- }), /* @__PURE__ */ I("code", {
254
+ }), /* @__PURE__ */ P("code", {
236
255
  dir: "ltr",
237
256
  tabIndex: 0,
238
257
  "aria-live": "polite",
@@ -240,25 +259,25 @@ var ue = {
240
259
  children: d
241
260
  })]
242
261
  }),
243
- /* @__PURE__ */ I("div", {
262
+ /* @__PURE__ */ P("div", {
244
263
  ref: o,
245
264
  role: "document",
246
265
  "aria-label": t,
247
266
  "aria-busy": s,
248
267
  className: m("min-h-0 w-full flex-1 overflow-hidden", V.viewer)
249
268
  }),
250
- (s || l) && /* @__PURE__ */ I("div", {
269
+ (s || l) && /* @__PURE__ */ P("div", {
251
270
  role: l ? "alert" : void 0,
252
271
  "aria-live": "polite",
253
272
  className: m("absolute inset-0 flex items-center justify-center", V.statusOverlay),
254
- children: s ? /* @__PURE__ */ I(C, { size: 48 }) : /* @__PURE__ */ L("div", {
273
+ children: s ? /* @__PURE__ */ P(S, { size: 48 }) : /* @__PURE__ */ F("div", {
255
274
  className: "flex flex-col items-center gap-2",
256
- children: [/* @__PURE__ */ I(w, {
275
+ children: [/* @__PURE__ */ P(C, {
257
276
  "aria-hidden": "true",
258
277
  size: 60,
259
- stroke: b,
278
+ stroke: y,
260
279
  className: V.errorIcon
261
- }), /* @__PURE__ */ I("p", {
280
+ }), /* @__PURE__ */ P("p", {
262
281
  className: "text-center",
263
282
  children: r
264
283
  })]
@@ -270,13 +289,13 @@ var ue = {
270
289
  loadingOverlay: "_loadingOverlay_12637_1",
271
290
  statusLabel: "_statusLabel_12637_5",
272
291
  errorIcon: "_errorIcon_12637_9"
273
- }, ye = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
274
- let i = N(null), [a, o] = P("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = N(e);
275
- return u.current = e, j(() => {
292
+ }, be = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
293
+ let i = M(null), [a, o] = N("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = M(e);
294
+ return u.current = e, A(() => {
276
295
  let e = i.current;
277
296
  if (!e) return;
278
297
  o("loading");
279
- let t = new R(e, {
298
+ let t = new fe(e, {
280
299
  domain: s,
281
300
  hostDomain: window.location.origin,
282
301
  visualizerName: c,
@@ -288,7 +307,7 @@ var ue = {
288
307
  layout: r,
289
308
  ...typeof i == "object" && i ? i : {}
290
309
  };
291
- await t.send(le.sendVisualizeData, {
310
+ await t.send(I.sendVisualizeData, {
292
311
  mimeType: e,
293
312
  visualizerData: a
294
313
  }), n && o("ready");
@@ -301,7 +320,7 @@ var ue = {
301
320
  s,
302
321
  c,
303
322
  l
304
- ]), /* @__PURE__ */ L("div", {
323
+ ]), /* @__PURE__ */ F("div", {
305
324
  className: "relative h-full w-full",
306
325
  style: f({
307
326
  "--vs-loading-bg": r?.loadingBackground,
@@ -309,25 +328,25 @@ var ue = {
309
328
  "--vs-error-icon": r?.errorIcon
310
329
  }),
311
330
  children: [
312
- /* @__PURE__ */ I("div", {
331
+ /* @__PURE__ */ P("div", {
313
332
  ref: i,
314
333
  className: "h-full w-full"
315
334
  }),
316
- a === "loading" && /* @__PURE__ */ L("div", {
335
+ a === "loading" && /* @__PURE__ */ F("div", {
317
336
  className: m("absolute inset-0 flex flex-col items-center justify-center gap-2", H.loadingOverlay),
318
- children: [/* @__PURE__ */ I(C, {}), t && /* @__PURE__ */ I("p", {
337
+ children: [/* @__PURE__ */ P(S, {}), t && /* @__PURE__ */ P("p", {
319
338
  className: m("text-center", H.statusLabel),
320
339
  children: t
321
340
  })]
322
341
  }),
323
- a === "error" && /* @__PURE__ */ L("div", {
342
+ a === "error" && /* @__PURE__ */ F("div", {
324
343
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
325
- children: [/* @__PURE__ */ I(w, {
344
+ children: [/* @__PURE__ */ P(C, {
326
345
  size: 60,
327
- stroke: b,
346
+ stroke: y,
328
347
  "aria-hidden": !0,
329
348
  className: H.errorIcon
330
- }), /* @__PURE__ */ I("p", {
349
+ }), /* @__PURE__ */ P("p", {
331
350
  role: "alert",
332
351
  className: m("text-center", H.statusLabel),
333
352
  children: n
@@ -350,64 +369,64 @@ var ue = {
350
369
  jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
351
370
  jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
352
371
  jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
353
- }, be = () => D(async () => ({ default: (await import("./PdfContent-BBUc0_SC.js")).PdfContent })), xe = ({ url: e, fileName: t, loadErrorLabel: n }) => {
354
- let [r, i] = P(!1);
355
- return j(() => {
372
+ }, xe = () => E(async () => ({ default: (await import("./PdfContent-BBUc0_SC.js")).PdfContent })), Se = ({ url: e, fileName: t, loadErrorLabel: n }) => {
373
+ let [r, i] = N(!1);
374
+ return A(() => {
356
375
  i(!1);
357
- }, [e]), r ? /* @__PURE__ */ L("div", {
376
+ }, [e]), r ? /* @__PURE__ */ F("div", {
358
377
  className: "flex flex-col items-center gap-2",
359
- children: [/* @__PURE__ */ I(w, {
378
+ children: [/* @__PURE__ */ P(C, {
360
379
  size: 60,
361
- stroke: b,
380
+ stroke: y,
362
381
  className: U.errorIcon
363
- }), /* @__PURE__ */ I("p", {
382
+ }), /* @__PURE__ */ P("p", {
364
383
  className: m("text-center", U.statusLabel),
365
384
  children: n
366
385
  })]
367
- }) : /* @__PURE__ */ I("img", {
386
+ }) : /* @__PURE__ */ P("img", {
368
387
  src: e,
369
388
  alt: t ?? "",
370
389
  className: "max-h-full max-w-full object-contain",
371
390
  onError: () => i(!0)
372
391
  });
373
- }, Se = new Set([
392
+ }, Ce = new Set([
374
393
  i.PlainText,
375
394
  i.Code,
376
395
  i.Ooxml
377
- ]), Ce = O(({ 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: ee, xlsxFormulaLabel: te = "Formula", codeContentLoadingLabel: ne, codeContentErrorLabel: re, codeContentRetryLabel: ae } = {}, styles: E, codeBlockTheme: D, loadPdf: O, hidePdfToolbar: A = !1, configurePdfWorker: j }) => {
378
- let { colors: N, typography: F, bodyClassName: ce, cssVars: le } = E ?? {}, [R, ue] = P(0), de = M(be, [R]), fe = k(() => {
379
- ue((e) => e + 1);
380
- }, []), z = F?.fontClassName != null, B = M(() => ({
396
+ ]), we = D(({ 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: ee, pdfHideThumbnailsLabel: v, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: w, pdfContentRetryLabel: te, xlsxFormulaLabel: ne = "Formula", codeContentLoadingLabel: re, codeContentErrorLabel: ie, codeContentRetryLabel: oe } = {}, styles: se, codeBlockTheme: T, loadPdf: E, hidePdfToolbar: D = !1, configurePdfWorker: k }) => {
397
+ let { colors: A, typography: M, bodyClassName: ue, cssVars: de } = se ?? {}, [I, fe] = N(0), L = j(xe, [I]), pe = O(() => {
398
+ fe((e) => e + 1);
399
+ }, []), R = M?.fontClassName != null, he = j(() => ({
381
400
  ...f({
382
- "--ac-text": N?.text,
383
- "--ac-status-text": N?.statusText,
384
- "--ac-error-icon": N?.errorIcon,
385
- "--ac-open-in-new-tab-text": N?.openInNewTabText,
386
- "--ac-json-border": N?.jsonBorder,
387
- "--ac-json-bg": N?.jsonBackground,
388
- "--ac-json-label": N?.jsonLabel,
389
- "--ac-json-clickable-label": N?.jsonClickableLabel,
390
- "--ac-json-punctuation": N?.jsonPunctuation,
391
- "--ac-json-string": N?.jsonString,
392
- "--ac-json-number": N?.jsonNumber,
393
- "--ac-json-boolean": N?.jsonBoolean,
394
- "--ac-json-null": N?.jsonNull,
395
- "--ac-json-toggle-icon": N?.jsonToggleIcon,
396
- "--ac-json-toggle-icon-hover": N?.jsonToggleIconHover,
397
- "--ac-ooxml-bg": N?.ooxmlBackground,
398
- "--ac-ooxml-formula-border": N?.ooxmlFormulaBorder,
399
- "--ac-ooxml-formula-bg": N?.ooxmlFormulaBackground,
400
- "--ac-ooxml-formula-text": N?.ooxmlFormulaText,
401
- "--ac-json-collapsed-text": N?.jsonCollapsedText,
402
- "--ac-json-collapsed-bg": N?.jsonCollapsedBackground,
403
- "--ac-font-family": z ? void 0 : F?.fontFamily,
404
- "--ac-font-size": z ? void 0 : F?.fontSize,
405
- "--ac-font-weight": z ? void 0 : F?.fontWeight,
406
- "--ac-line-height": z ? void 0 : F?.lineHeight,
407
- "--ac-letter-spacing": z ? void 0 : F?.letterSpacing
401
+ "--ac-text": A?.text,
402
+ "--ac-status-text": A?.statusText,
403
+ "--ac-error-icon": A?.errorIcon,
404
+ "--ac-open-in-new-tab-text": A?.openInNewTabText,
405
+ "--ac-json-border": A?.jsonBorder,
406
+ "--ac-json-bg": A?.jsonBackground,
407
+ "--ac-json-label": A?.jsonLabel,
408
+ "--ac-json-clickable-label": A?.jsonClickableLabel,
409
+ "--ac-json-punctuation": A?.jsonPunctuation,
410
+ "--ac-json-string": A?.jsonString,
411
+ "--ac-json-number": A?.jsonNumber,
412
+ "--ac-json-boolean": A?.jsonBoolean,
413
+ "--ac-json-null": A?.jsonNull,
414
+ "--ac-json-toggle-icon": A?.jsonToggleIcon,
415
+ "--ac-json-toggle-icon-hover": A?.jsonToggleIconHover,
416
+ "--ac-ooxml-bg": A?.ooxmlBackground,
417
+ "--ac-ooxml-formula-border": A?.ooxmlFormulaBorder,
418
+ "--ac-ooxml-formula-bg": A?.ooxmlFormulaBackground,
419
+ "--ac-ooxml-formula-text": A?.ooxmlFormulaText,
420
+ "--ac-json-collapsed-text": A?.jsonCollapsedText,
421
+ "--ac-json-collapsed-bg": A?.jsonCollapsedBackground,
422
+ "--ac-font-family": R ? void 0 : M?.fontFamily,
423
+ "--ac-font-size": R ? void 0 : M?.fontSize,
424
+ "--ac-font-weight": R ? void 0 : M?.fontWeight,
425
+ "--ac-line-height": R ? void 0 : M?.lineHeight,
426
+ "--ac-letter-spacing": R ? void 0 : M?.letterSpacing
408
427
  }),
409
- ...le
410
- }), [E]), V = M(() => {
428
+ ...de
429
+ }), [se]), z = j(() => {
411
430
  switch (t.type) {
412
431
  case i.Image:
413
432
  case i.Audio:
@@ -422,44 +441,44 @@ var ue = {
422
441
  case i.Html: return "h-full overflow-hidden";
423
442
  default: return "h-full overflow-auto p-4";
424
443
  }
425
- }, [t.type]), ge = M(() => {
444
+ }, [t.type]), V = j(() => {
426
445
  switch (t.type) {
427
- case i.PlainText: return /* @__PURE__ */ I("pre", {
428
- className: m("whitespace-pre-wrap break-words", U.body, F?.fontClassName),
446
+ case i.PlainText: return /* @__PURE__ */ P("pre", {
447
+ className: m("whitespace-pre-wrap break-words", U.body, M?.fontClassName),
429
448
  children: t.text
430
449
  });
431
- case i.Image: return /* @__PURE__ */ I(xe, {
450
+ case i.Image: return /* @__PURE__ */ P(Se, {
432
451
  url: t.url,
433
452
  fileName: r,
434
453
  loadErrorLabel: l
435
454
  });
436
- case i.Audio: return /* @__PURE__ */ I("audio", {
455
+ case i.Audio: return /* @__PURE__ */ P("audio", {
437
456
  controls: !0,
438
457
  src: t.url,
439
458
  "aria-label": r ?? "Audio attachment",
440
459
  className: "w-full max-w-sm",
441
460
  preload: "metadata",
442
- children: t.mimeType && /* @__PURE__ */ I("source", {
461
+ children: t.mimeType && /* @__PURE__ */ P("source", {
443
462
  src: t.url,
444
463
  type: t.mimeType
445
464
  })
446
465
  });
447
- case i.Markdown: return /* @__PURE__ */ I(d, {
466
+ case i.Markdown: return /* @__PURE__ */ P(d, {
448
467
  content: t.text,
449
468
  isStreaming: !1,
450
- codeBlockTheme: D,
469
+ codeBlockTheme: T,
451
470
  classNames: c
452
471
  });
453
- case i.Json: return /* @__PURE__ */ I("div", {
472
+ case i.Json: return /* @__PURE__ */ P("div", {
454
473
  dir: "ltr",
455
474
  className: "h-full overflow-auto",
456
- children: /* @__PURE__ */ I("div", {
475
+ children: /* @__PURE__ */ P("div", {
457
476
  className: m("m-3 overflow-auto rounded-md border", U.jsonWrapper),
458
- children: /* @__PURE__ */ I(oe, {
477
+ children: /* @__PURE__ */ P(ce, {
459
478
  data: t.value,
460
479
  style: {
461
- container: m("whitespace-pre-wrap break-words p-2", F?.jsonClassName ?? "dial-code-text"),
462
- basicChildStyle: se.basicChildStyle,
480
+ container: m("whitespace-pre-wrap break-words p-2", M?.jsonClassName ?? "dial-code-text"),
481
+ basicChildStyle: le.basicChildStyle,
463
482
  childFieldsContainer: "m-0 ps-3",
464
483
  label: m("me-1 font-semibold", U.jsonLabel),
465
484
  clickableLabel: m("me-1 cursor-pointer font-semibold hover:underline", U.jsonClickableLabel),
@@ -477,16 +496,16 @@ var ue = {
477
496
  })
478
497
  })
479
498
  });
480
- case i.Code: return /* @__PURE__ */ I(pe, {
499
+ case i.Code: return /* @__PURE__ */ P(me, {
481
500
  content: t,
482
- codeBlockTheme: D,
501
+ codeBlockTheme: T,
483
502
  labels: {
484
- loadingLabel: ne,
485
- errorLabel: re,
486
- retryLabel: ae
503
+ loadingLabel: re,
504
+ errorLabel: ie,
505
+ retryLabel: oe
487
506
  }
488
507
  });
489
- case i.Html: return /* @__PURE__ */ I(me, {
508
+ case i.Html: return /* @__PURE__ */ P(ge, {
490
509
  content: t,
491
510
  labels: {
492
511
  htmlFrameBlockedLabel: h,
@@ -494,60 +513,60 @@ var ue = {
494
513
  },
495
514
  isSourceView: o,
496
515
  title: r,
497
- codeBlockTheme: D
516
+ codeBlockTheme: T
498
517
  });
499
- case i.Pdf: return /* @__PURE__ */ I(a, {
500
- retryKey: R,
501
- onRetry: fe,
518
+ case i.Pdf: return /* @__PURE__ */ P(a, {
519
+ retryKey: I,
520
+ onRetry: pe,
502
521
  labels: {
503
- loadingLabel: S,
504
- errorLabel: T,
505
- retryLabel: ee
522
+ loadingLabel: x,
523
+ errorLabel: w,
524
+ retryLabel: te
506
525
  },
507
- children: /* @__PURE__ */ I(de, {
526
+ children: /* @__PURE__ */ P(L, {
508
527
  fileName: r,
509
528
  url: t.url,
510
529
  highlights: t.highlights ?? [],
511
530
  selectedHighlightId: t.selectedHighlightId,
512
- loadPdf: O,
513
- hideHeader: A,
514
- configurePdfWorker: j,
531
+ loadPdf: E,
532
+ hideHeader: D,
533
+ configurePdfWorker: k,
515
534
  labels: {
516
535
  thumbnailsLabel: _,
517
- showThumbnailsLabel: v,
518
- hideThumbnailsLabel: y,
519
- pageNumberLabel: x,
520
- loadingLabel: S,
521
- errorLabel: T,
522
- retryLabel: ee
536
+ showThumbnailsLabel: ee,
537
+ hideThumbnailsLabel: v,
538
+ pageNumberLabel: b,
539
+ loadingLabel: x,
540
+ errorLabel: w,
541
+ retryLabel: te
523
542
  }
524
543
  })
525
544
  }, t.url);
526
- case i.Ooxml: return /* @__PURE__ */ I(ve, {
545
+ case i.Ooxml: return /* @__PURE__ */ P(ye, {
527
546
  content: t,
528
547
  fileName: r,
529
548
  loadErrorLabel: l,
530
- formulaLabel: te,
531
- formulaLabelClassName: F?.xlsxFormulaLabelClassName ?? "dial-italic-text"
549
+ formulaLabel: ne,
550
+ formulaLabelClassName: M?.xlsxFormulaLabelClassName ?? "dial-italic-text"
532
551
  });
533
- case i.Visualizer: return /* @__PURE__ */ I(ye, {
552
+ case i.Visualizer: return /* @__PURE__ */ P(be, {
534
553
  content: t,
535
554
  errorLabel: p
536
555
  });
537
- case i.McpApp: return /* @__PURE__ */ I(he, { content: t });
538
- case i.Unsupported: return /* @__PURE__ */ I("p", {
556
+ case i.McpApp: return /* @__PURE__ */ P(B, { content: t });
557
+ case i.Unsupported: return /* @__PURE__ */ P("p", {
539
558
  className: m("text-center", U.statusLabel),
540
559
  children: s
541
560
  });
542
561
  case i.Error: {
543
562
  let n = t.errorType === e.Forbidden;
544
- return /* @__PURE__ */ L("div", {
563
+ return /* @__PURE__ */ F("div", {
545
564
  className: "flex flex-col items-center gap-2",
546
- children: [I(n ? ie : w, {
565
+ children: [P(n ? ae : C, {
547
566
  size: 60,
548
- stroke: b,
567
+ stroke: y,
549
568
  className: U.errorIcon
550
- }), /* @__PURE__ */ I("p", {
569
+ }), /* @__PURE__ */ P("p", {
551
570
  className: m("text-center", U.statusLabel),
552
571
  children: n ? u : l
553
572
  })]
@@ -556,11 +575,11 @@ var ue = {
556
575
  }
557
576
  }, [
558
577
  t,
559
- F?.fontClassName,
560
- F?.jsonClassName,
561
- F?.xlsxFormulaLabelClassName,
578
+ M?.fontClassName,
579
+ M?.jsonClassName,
580
+ M?.xlsxFormulaLabelClassName,
562
581
  r,
563
- D,
582
+ T,
564
583
  s,
565
584
  l,
566
585
  u,
@@ -568,48 +587,48 @@ var ue = {
568
587
  h,
569
588
  g,
570
589
  o,
571
- O,
572
- A,
573
- j,
590
+ E,
591
+ D,
592
+ k,
574
593
  _,
594
+ ee,
575
595
  v,
576
- y,
596
+ b,
577
597
  x,
578
- S,
579
- T,
580
- ee,
598
+ w,
581
599
  te,
582
600
  ne,
583
601
  re,
584
- ae,
585
- de,
586
- R,
587
- fe
602
+ ie,
603
+ oe,
604
+ L,
605
+ I,
606
+ pe
588
607
  ]);
589
- return /* @__PURE__ */ I("div", {
590
- style: !n && Se.has(t.type) ? B : void 0,
591
- className: m(n ? "flex h-full items-center justify-center" : V, ce),
592
- children: n ? /* @__PURE__ */ I(C, {}) : ge
608
+ return /* @__PURE__ */ P("div", {
609
+ style: !n && Ce.has(t.type) ? he : void 0,
610
+ className: m(n ? "flex h-full items-center justify-center" : z, ue),
611
+ children: n ? /* @__PURE__ */ P(S, {}) : V
593
612
  });
594
- }), we = 2e3, W = O(({ 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: ie = "You don't have permission to access this file", htmlFrameBlockedLabel: E = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: D = "Open in new tab", htmlViewSourceLabel: O = "View source", htmlViewRenderedLabel: A = "View rendered", pdfThumbnailsLabel: M, pdfShowThumbnailsLabel: oe, pdfHideThumbnailsLabel: se, pdfPageNumberLabel: ce, pdfContentLoadingLabel: le, pdfContentErrorLabel: R, pdfContentRetryLabel: ue, xlsxFormulaLabel: de, codeContentLoadingLabel: fe, codeContentErrorLabel: pe, codeContentRetryLabel: z }, onDownload: me, onCopyText: B, onCopyMarkdown: he, onCopyJson: V, isMobile: ge = !1, defaultWidth: _e, minWidth: ve = 600, maxWidth: H = 1500, onResizeStop: ye, styles: U, codeBlockTheme: be, loadPdf: xe, configurePdfWorker: Se }) => {
595
- let [W, Te] = P(!1), [Ee, G] = P(!1), [De, K] = P(!1), [q, Oe] = P(!1), J = N(null), Y = N(null), X = N(null), ke = k(() => {
596
- B?.(), J.current != null && clearTimeout(J.current), Te(!0), J.current = setTimeout(() => Te(!1), we);
597
- }, [B]), Ae = k(() => {
598
- he?.(), Y.current != null && clearTimeout(Y.current), G(!0), Y.current = setTimeout(() => G(!1), we);
599
- }, [he]), Z = k(() => {
600
- V?.(), X.current != null && clearTimeout(X.current), K(!0), X.current = setTimeout(() => K(!1), we);
601
- }, [V]);
602
- j(() => () => {
613
+ }), Te = 2e3, Ee = D(({ 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: x, unsupportedLabel: S = "Preview is not supported for this file", loadErrorLabel: C = "Failed to load file", forbiddenErrorLabel: ae = "You don't have permission to access this file", htmlFrameBlockedLabel: T = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: E = "Open in new tab", htmlViewSourceLabel: D = "View source", htmlViewRenderedLabel: k = "View rendered", mcpAppReloadLabel: j = "Reload", pdfThumbnailsLabel: ce, pdfShowThumbnailsLabel: le, pdfHideThumbnailsLabel: de, pdfPageNumberLabel: I, pdfContentLoadingLabel: fe, pdfContentErrorLabel: L, pdfContentRetryLabel: pe, xlsxFormulaLabel: R, codeContentLoadingLabel: me, codeContentErrorLabel: he, codeContentRetryLabel: ge }, onDownload: z, onCopyText: B, onCopyMarkdown: V, onCopyJson: _e, isMobile: ve = !1, defaultWidth: ye, minWidth: H = 600, maxWidth: be = 1500, onResizeStop: U, styles: xe, codeBlockTheme: Se, loadPdf: Ce, configurePdfWorker: Ee }) => {
614
+ let [De, Oe] = N(!1), [W, ke] = N(!1), [G, Ae] = N(!1), [K, q] = N(!1), J = M(null), Y = M(null), X = M(null), je = O(() => {
615
+ B?.(), J.current != null && clearTimeout(J.current), Oe(!0), J.current = setTimeout(() => Oe(!1), Te);
616
+ }, [B]), Z = O(() => {
617
+ V?.(), Y.current != null && clearTimeout(Y.current), ke(!0), Y.current = setTimeout(() => ke(!1), Te);
618
+ }, [V]), Me = O(() => {
619
+ _e?.(), X.current != null && clearTimeout(X.current), Ae(!0), X.current = setTimeout(() => Ae(!1), Te);
620
+ }, [_e]);
621
+ A(() => () => {
603
622
  J.current != null && clearTimeout(J.current), Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current);
604
623
  }, []);
605
- let je = k(() => {
606
- Oe((e) => !e);
624
+ let Ne = O(() => {
625
+ q((e) => !e);
607
626
  }, []);
608
- j(() => {
609
- Oe(!1);
627
+ A(() => {
628
+ q(!1);
610
629
  }, [a]);
611
- let { className: Me, panelStyles: Q, ...Ne } = U ?? {}, Pe = !t && a.type === i.Html && a.srcdoc != null, Fe = !t && B != null && (a.type === i.PlainText || a.type === i.Code), $ = !t && he != null && a.type === i.Markdown, Ie = !t && V != null && a.type === i.Json, Le = !t && me != null && r(a);
612
- return /* @__PURE__ */ I(v, {
630
+ let { className: Pe, panelStyles: Q, ...Fe } = xe ?? {}, Ie = !t && a.type === i.Html && a.srcdoc != null, $ = !t && B != null && (a.type === i.PlainText || a.type === i.Code), Le = !t && V != null && a.type === i.Markdown, Re = !t && _e != null && a.type === i.Json, ze = !t && z != null && r(a), Be = !t && a.type === i.McpApp && a.onReload != null;
631
+ return /* @__PURE__ */ P(ee, {
613
632
  isOpen: e,
614
633
  orientation: _.Right,
615
634
  title: o,
@@ -618,119 +637,129 @@ var ue = {
618
637
  closeLabel: c
619
638
  },
620
639
  onClose: n,
621
- resizable: !ge,
622
- defaultWidth: _e,
623
- minWidth: ve,
624
- maxWidth: H,
625
- onResizeStop: ye,
640
+ resizable: !ve,
641
+ defaultWidth: ye,
642
+ minWidth: H,
643
+ maxWidth: be,
644
+ onResizeStop: U,
626
645
  styles: {
627
646
  ...Q,
628
647
  titleClassName: Q?.titleClassName ?? "dial-h3-text",
629
648
  headerClassName: m("border-b border-tertiary", Q?.headerClassName),
630
- className: m(e ? "mobile:w-full mobile:max-w-full" : "w-0", Me, Q?.className)
649
+ className: m(e ? "mobile:w-full mobile:max-w-full" : "w-0", Pe, Q?.className)
631
650
  },
632
- rightActions: Pe || Fe || $ || Ie || Le ? /* @__PURE__ */ L(F, { children: [
633
- Pe && /* @__PURE__ */ I(x, {
634
- icon: I(q ? re : ee, {
635
- size: y.LG,
636
- stroke: b,
651
+ rightActions: Ie || $ || Le || Re || ze || Be ? /* @__PURE__ */ F(ue, { children: [
652
+ Be && /* @__PURE__ */ P(b, {
653
+ icon: /* @__PURE__ */ P(se, {
654
+ size: v.LG,
655
+ stroke: y,
637
656
  "aria-hidden": !0
638
657
  }),
639
- "aria-label": q ? A : O,
640
- "aria-pressed": q,
641
- tooltipProps: { tooltip: q ? A : O },
642
- onClick: je
658
+ "aria-label": j,
659
+ tooltipProps: { tooltip: j },
660
+ onClick: a.type === i.McpApp ? a.onReload : void 0
643
661
  }),
644
- Fe && /* @__PURE__ */ I(x, {
645
- icon: I(W ? T : te, {
646
- size: y.LG,
647
- stroke: b,
662
+ Ie && /* @__PURE__ */ P(b, {
663
+ icon: P(K ? ie : te, {
664
+ size: v.LG,
665
+ stroke: y,
648
666
  "aria-hidden": !0
649
667
  }),
650
- "aria-label": W ? d : u,
651
- tooltipProps: { tooltip: W ? d : u },
652
- onClick: ke
668
+ "aria-label": K ? k : D,
669
+ "aria-pressed": K,
670
+ tooltipProps: { tooltip: K ? k : D },
671
+ onClick: Ne
653
672
  }),
654
- $ && /* @__PURE__ */ I(x, {
655
- icon: I(Ee ? T : ae, {
656
- size: y.LG,
657
- stroke: b,
673
+ $ && /* @__PURE__ */ P(b, {
674
+ icon: P(De ? w : ne, {
675
+ size: v.LG,
676
+ stroke: y,
658
677
  "aria-hidden": !0
659
678
  }),
660
- "aria-label": Ee ? p : f,
661
- tooltipProps: { tooltip: Ee ? p : f },
662
- onClick: Ae
679
+ "aria-label": De ? d : u,
680
+ tooltipProps: { tooltip: De ? d : u },
681
+ onClick: je
663
682
  }),
664
- Ie && /* @__PURE__ */ I(x, {
665
- icon: I(De ? T : te, {
666
- size: y.LG,
667
- stroke: b,
683
+ Le && /* @__PURE__ */ P(b, {
684
+ icon: P(W ? w : oe, {
685
+ size: v.LG,
686
+ stroke: y,
668
687
  "aria-hidden": !0
669
688
  }),
670
- "aria-label": De ? g : h,
671
- tooltipProps: { tooltip: De ? g : h },
689
+ "aria-label": W ? p : f,
690
+ tooltipProps: { tooltip: W ? p : f },
672
691
  onClick: Z
673
692
  }),
674
- Le && /* @__PURE__ */ I(x, {
675
- icon: /* @__PURE__ */ I(ne, {
676
- size: y.LG,
677
- stroke: b
693
+ Re && /* @__PURE__ */ P(b, {
694
+ icon: P(G ? w : ne, {
695
+ size: v.LG,
696
+ stroke: y,
697
+ "aria-hidden": !0
698
+ }),
699
+ "aria-label": G ? g : h,
700
+ tooltipProps: { tooltip: G ? g : h },
701
+ onClick: Me
702
+ }),
703
+ ze && /* @__PURE__ */ P(b, {
704
+ icon: /* @__PURE__ */ P(re, {
705
+ size: v.LG,
706
+ stroke: y
678
707
  }),
679
708
  "aria-label": l,
680
709
  tooltipProps: { tooltip: l },
681
- onClick: me
710
+ onClick: z
682
711
  })
683
712
  ] }) : null,
684
- children: /* @__PURE__ */ I(Ce, {
713
+ children: /* @__PURE__ */ P(we, {
685
714
  content: a,
686
715
  isLoading: t,
687
716
  fileName: o,
688
- isHtmlSourceView: q,
717
+ isHtmlSourceView: K,
689
718
  labels: {
690
- unsupportedLabel: C,
691
- loadErrorLabel: w,
692
- forbiddenErrorLabel: ie,
693
- visualizerErrorLabel: S,
694
- htmlFrameBlockedLabel: E,
695
- htmlOpenInNewTabLabel: D,
696
- pdfThumbnailsLabel: M,
697
- pdfShowThumbnailsLabel: oe,
698
- pdfHideThumbnailsLabel: se,
699
- pdfPageNumberLabel: ce,
700
- pdfContentLoadingLabel: le,
701
- pdfContentErrorLabel: R,
702
- pdfContentRetryLabel: ue,
703
- xlsxFormulaLabel: de,
704
- codeContentLoadingLabel: fe,
705
- codeContentErrorLabel: pe,
706
- codeContentRetryLabel: z
719
+ unsupportedLabel: S,
720
+ loadErrorLabel: C,
721
+ forbiddenErrorLabel: ae,
722
+ visualizerErrorLabel: x,
723
+ htmlFrameBlockedLabel: T,
724
+ htmlOpenInNewTabLabel: E,
725
+ pdfThumbnailsLabel: ce,
726
+ pdfShowThumbnailsLabel: le,
727
+ pdfHideThumbnailsLabel: de,
728
+ pdfPageNumberLabel: I,
729
+ pdfContentLoadingLabel: fe,
730
+ pdfContentErrorLabel: L,
731
+ pdfContentRetryLabel: pe,
732
+ xlsxFormulaLabel: R,
733
+ codeContentLoadingLabel: me,
734
+ codeContentErrorLabel: he,
735
+ codeContentRetryLabel: ge
707
736
  },
708
- styles: Ne,
709
- codeBlockTheme: be,
710
- loadPdf: xe,
711
- configurePdfWorker: Se
737
+ styles: Fe,
738
+ codeBlockTheme: Se,
739
+ loadPdf: Ce,
740
+ configurePdfWorker: Ee
712
741
  })
713
742
  });
714
- }), Te = {
743
+ }), De = {
715
744
  type: i.PlainText,
716
745
  text: ""
717
- }, Ee = (e) => {
746
+ }, Oe = (e) => {
718
747
  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;
719
- }, G = E(void 0);
720
- G.displayName = "AttachmentCanvasContext";
721
- var De = ({ children: e }) => {
722
- let [t, n] = P(!1), [r, i] = P(!1), [a, o] = P(Te), [s, c] = P(void 0), [l, u] = P(void 0), d = k((e, t) => {
748
+ }, W = T(void 0);
749
+ W.displayName = "AttachmentCanvasContext";
750
+ var ke = ({ children: e }) => {
751
+ let [t, n] = N(!1), [r, i] = N(!1), [a, o] = N(De), [s, c] = N(void 0), [l, u] = N(void 0), d = O((e, t) => {
723
752
  c(e), u(t), i(!0), n(!0);
724
- }, []), f = k((e, t, r) => {
753
+ }, []), f = O((e, t, r) => {
725
754
  o(e), c(t), u(r), i(!1), n(!0);
726
- }, []), p = k(() => {
727
- o(Te), n(!1), i(!1), u(void 0);
755
+ }, []), p = O(() => {
756
+ o(De), n(!1), i(!1), u(void 0);
728
757
  }, []);
729
- return j(() => () => {
730
- let e = Ee(a);
758
+ return A(() => () => {
759
+ let e = Oe(a);
731
760
  e != null && URL.revokeObjectURL(e);
732
- }, [a]), /* @__PURE__ */ I(G.Provider, {
733
- value: M(() => ({
761
+ }, [a]), /* @__PURE__ */ P(W.Provider, {
762
+ value: j(() => ({
734
763
  isOpen: t,
735
764
  isLoading: r,
736
765
  content: a,
@@ -751,26 +780,26 @@ var De = ({ children: e }) => {
751
780
  ]),
752
781
  children: e
753
782
  });
754
- }, K = () => {
755
- let e = A(G);
783
+ }, G = () => {
784
+ let e = k(W);
756
785
  if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
757
786
  return e;
758
- }, q = O(({ labels: e, isMobile: n = !1, defaultWidth: r, maxWidth: a, codeBlockTheme: o, configurePdfWorker: s }) => {
759
- let { ariaLabel: c = "Attachment preview", closeLabel: l = "Close", downloadLabel: u = "Download", unsupportedLabel: d = "Preview is not supported for this file", loadErrorLabel: f = "Failed to load file", forbiddenErrorLabel: m = "You don't have permission to access this file", copyTextLabel: h, copiedTextLabel: g, copyMarkdownLabel: _, copiedMarkdownLabel: v, copyJsonLabel: y, copiedJsonLabel: b, htmlFrameBlockedLabel: x, htmlOpenInNewTabLabel: S, htmlViewSourceLabel: C, htmlViewRenderedLabel: w, pdfThumbnailsLabel: T, pdfShowThumbnailsLabel: ee, pdfHideThumbnailsLabel: te, pdfPageNumberLabel: ne, pdfContentLoadingLabel: re, pdfContentErrorLabel: ie, pdfContentRetryLabel: ae, xlsxFormulaLabel: E, codeContentLoadingLabel: D, codeContentErrorLabel: O, codeContentRetryLabel: A } = e ?? {}, { isOpen: j, isLoading: M, content: N, fileName: P, closeCanvas: oe } = K(), se = k(() => {
760
- t(N, P);
761
- }, [N, P]), F = k(() => {
762
- (N.type === i.PlainText || N.type === i.Code) && p(N.text);
763
- }, [N]), L = k(() => {
764
- N.type === i.Markdown && p(N.text);
765
- }, [N]), ce = k(() => {
766
- N.type === i.Json && p(JSON.stringify(N.value, null, 2));
767
- }, [N]);
768
- return /* @__PURE__ */ I(W, {
769
- isOpen: j,
770
- isLoading: M,
771
- onClose: oe,
772
- content: N,
773
- fileName: P,
787
+ }, Ae = D(({ labels: e, isMobile: n = !1, defaultWidth: r, maxWidth: a, codeBlockTheme: o, configurePdfWorker: s }) => {
788
+ let { ariaLabel: c = "Attachment preview", closeLabel: l = "Close", downloadLabel: u = "Download", unsupportedLabel: d = "Preview is not supported for this file", loadErrorLabel: f = "Failed to load file", forbiddenErrorLabel: m = "You don't have permission to access this file", copyTextLabel: h, copiedTextLabel: g, copyMarkdownLabel: _, copiedMarkdownLabel: ee, copyJsonLabel: v, copiedJsonLabel: y, htmlFrameBlockedLabel: b, htmlOpenInNewTabLabel: x, htmlViewSourceLabel: S, htmlViewRenderedLabel: C, pdfThumbnailsLabel: w, pdfShowThumbnailsLabel: te, pdfHideThumbnailsLabel: ne, pdfPageNumberLabel: re, pdfContentLoadingLabel: ie, pdfContentErrorLabel: ae, pdfContentRetryLabel: oe, xlsxFormulaLabel: se, codeContentLoadingLabel: T, codeContentErrorLabel: E, codeContentRetryLabel: D } = e ?? {}, { isOpen: k, isLoading: A, content: j, fileName: M, closeCanvas: N } = G(), ce = O(() => {
789
+ t(j, M);
790
+ }, [j, M]), le = O(() => {
791
+ (j.type === i.PlainText || j.type === i.Code) && p(j.text);
792
+ }, [j]), ue = O(() => {
793
+ j.type === i.Markdown && p(j.text);
794
+ }, [j]), F = O(() => {
795
+ j.type === i.Json && p(JSON.stringify(j.value, null, 2));
796
+ }, [j]);
797
+ return /* @__PURE__ */ P(Ee, {
798
+ isOpen: k,
799
+ isLoading: A,
800
+ onClose: N,
801
+ content: j,
802
+ fileName: M,
774
803
  labels: {
775
804
  ariaLabel: c,
776
805
  closeLabel: l,
@@ -778,75 +807,75 @@ var De = ({ children: e }) => {
778
807
  copyTextLabel: h,
779
808
  copiedTextLabel: g,
780
809
  copyMarkdownLabel: _,
781
- copiedMarkdownLabel: v,
782
- copyJsonLabel: y,
783
- copiedJsonLabel: b,
810
+ copiedMarkdownLabel: ee,
811
+ copyJsonLabel: v,
812
+ copiedJsonLabel: y,
784
813
  unsupportedLabel: d,
785
814
  loadErrorLabel: f,
786
815
  forbiddenErrorLabel: m,
787
- htmlFrameBlockedLabel: x,
788
- htmlOpenInNewTabLabel: S,
789
- htmlViewSourceLabel: C,
790
- htmlViewRenderedLabel: w,
791
- pdfThumbnailsLabel: T,
792
- pdfShowThumbnailsLabel: ee,
793
- pdfHideThumbnailsLabel: te,
794
- pdfPageNumberLabel: ne,
795
- pdfContentLoadingLabel: re,
796
- pdfContentErrorLabel: ie,
797
- pdfContentRetryLabel: ae,
798
- xlsxFormulaLabel: E,
799
- codeContentLoadingLabel: D,
800
- codeContentErrorLabel: O,
801
- codeContentRetryLabel: A
816
+ htmlFrameBlockedLabel: b,
817
+ htmlOpenInNewTabLabel: x,
818
+ htmlViewSourceLabel: S,
819
+ htmlViewRenderedLabel: C,
820
+ pdfThumbnailsLabel: w,
821
+ pdfShowThumbnailsLabel: te,
822
+ pdfHideThumbnailsLabel: ne,
823
+ pdfPageNumberLabel: re,
824
+ pdfContentLoadingLabel: ie,
825
+ pdfContentErrorLabel: ae,
826
+ pdfContentRetryLabel: oe,
827
+ xlsxFormulaLabel: se,
828
+ codeContentLoadingLabel: T,
829
+ codeContentErrorLabel: E,
830
+ codeContentRetryLabel: D
802
831
  },
803
- onDownload: se,
804
- onCopyText: N.type === i.PlainText || N.type === i.Code ? F : void 0,
805
- onCopyMarkdown: N.type === i.Markdown ? L : void 0,
806
- onCopyJson: N.type === i.Json ? ce : void 0,
832
+ onDownload: ce,
833
+ onCopyText: j.type === i.PlainText || j.type === i.Code ? le : void 0,
834
+ onCopyMarkdown: j.type === i.Markdown ? ue : void 0,
835
+ onCopyJson: j.type === i.Json ? F : void 0,
807
836
  isMobile: n,
808
837
  defaultWidth: r,
809
838
  maxWidth: a,
810
839
  codeBlockTheme: o,
811
840
  configurePdfWorker: s
812
841
  });
813
- }), Oe = new Set(["html", "htm"]), J = {
842
+ }), K = new Set(["html", "htm"]), q = {
814
843
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
815
844
  xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
816
845
  pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
817
- }, Y = 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(".")), X = {
846
+ }, J = 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(".")), Y = {
818
847
  docx: n.Docx,
819
848
  xlsx: n.Xlsx,
820
849
  pptx: n.Pptx,
821
850
  csv: n.Csv
822
- }, ke = {
823
- [J.docx]: n.Docx,
824
- [J.xlsx]: n.Xlsx,
825
- [J.pptx]: n.Pptx,
851
+ }, X = {
852
+ [q.docx]: n.Docx,
853
+ [q.xlsx]: n.Xlsx,
854
+ [q.pptx]: n.Pptx,
826
855
  [u.CSV]: n.Csv
827
- }, Ae = {
828
- [n.Docx]: J.docx,
829
- [n.Xlsx]: J.xlsx,
830
- [n.Pptx]: J.pptx,
856
+ }, je = {
857
+ [n.Docx]: q.docx,
858
+ [n.Xlsx]: q.xlsx,
859
+ [n.Pptx]: q.pptx,
831
860
  [n.Csv]: u.CSV
832
861
  }, Z = (e, t) => {
833
862
  let n = t?.split(";", 1)[0].trim().toLowerCase();
834
863
  if (n != null) {
835
- let e = ke[n];
864
+ let e = X[n];
836
865
  if (e != null) return e;
837
866
  }
838
867
  let r = e.lastIndexOf(".");
839
- if (r !== -1) return X[e.slice(r + 1).toLowerCase()];
840
- }, je = (e, t) => Z(e, t) != null, Me = (e, t) => {
868
+ if (r !== -1) return Y[e.slice(r + 1).toLowerCase()];
869
+ }, Me = (e, t) => Z(e, t) != null, Ne = (e, t) => {
841
870
  let n = Z(e, t);
842
- return n == null ? void 0 : Ae[n];
843
- }, Q = (e) => {
871
+ return n == null ? void 0 : je[n];
872
+ }, Pe = (e) => {
844
873
  let t = e.lastIndexOf(".");
845
- return t === -1 ? !1 : Y.has(e.slice(t + 1).toLowerCase());
846
- }, Ne = (e) => {
874
+ return t === -1 ? !1 : J.has(e.slice(t + 1).toLowerCase());
875
+ }, Q = (e) => {
847
876
  let t = e.lastIndexOf(".");
848
- return t === -1 ? !1 : Oe.has(e.slice(t + 1).toLowerCase());
849
- }, Pe = {
877
+ return t === -1 ? !1 : K.has(e.slice(t + 1).toLowerCase());
878
+ }, Fe = {
850
879
  xml: "xml",
851
880
  csv: "plaintext",
852
881
  tsv: "plaintext",
@@ -894,21 +923,21 @@ var De = ({ children: e }) => {
894
923
  gitignore: "plaintext",
895
924
  dockerfile: "plaintext",
896
925
  makefile: "plaintext"
897
- }, Fe = (e) => Pe[e], $ = (e) => ({
926
+ }, Ie = (e) => Fe[e], $ = (e) => ({
898
927
  type: i.Unsupported,
899
928
  ...e != null && { url: e }
900
- }), Ie = (t) => ({
929
+ }), Le = (t) => ({
901
930
  type: i.Error,
902
931
  errorType: e.LoadFailed,
903
932
  ...t != null && { url: t }
904
- }), Le = (t) => ({
933
+ }), Re = (t) => ({
905
934
  type: i.Error,
906
935
  errorType: e.Forbidden,
907
936
  ...t != null && { url: t }
908
- }), Re = (e, t) => {
937
+ }), ze = (e, t) => {
909
938
  let n = e.toLowerCase();
910
939
  return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
911
- }, ze = (e) => {
940
+ }, Be = (e) => {
912
941
  let t;
913
942
  try {
914
943
  t = new URL(e).pathname;
@@ -921,13 +950,13 @@ var De = ({ children: e }) => {
921
950
  } catch {
922
951
  return n;
923
952
  }
924
- }, Be = (e, t) => {
925
- let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = K(), { customVisualizers: s, themeId: c, onBeforeOpen: d } = t, f = k(async (t, r) => {
953
+ }, Ve = (e, t) => {
954
+ let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = G(), { customVisualizers: s, themeId: c, onBeforeOpen: d } = t, f = O(async (t, r) => {
926
955
  if (t.url == null && t.referenceUrl != null) {
927
956
  let i = e.resolveReferencePdfContent(t);
928
957
  if (i != null) return n(i, t.name, r), !0;
929
958
  }
930
- let a = t.contentType.toLowerCase(), o = Re(a, s);
959
+ let a = t.contentType.toLowerCase(), o = ze(a, s);
931
960
  if (o != null) {
932
961
  let i = await e.resolveVisualizerContent(t, o, c);
933
962
  if (i != null) return n(i, t.name, r), !0;
@@ -960,8 +989,8 @@ var De = ({ children: e }) => {
960
989
  return i == null ? !1 : (n(i, t.name, r), !0);
961
990
  }
962
991
  }
963
- let g = t.name != null && Ne(t.name) || t.url != null && Ne(ze(t.url));
964
- if (t.name != null && !Q(t.name) && !g) return n($(e.resolveContentUrl(t)), t.name, r), !0;
992
+ let g = t.name != null && Q(t.name) || t.url != null && Q(Be(t.url));
993
+ if (t.name != null && !Pe(t.name) && !g) return n($(e.resolveContentUrl(t)), t.name, r), !0;
965
994
  if (g) {
966
995
  let a = await e.resolveHtmlContent(t);
967
996
  return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, r), !0) : t.url == null ? !1 : (n({
@@ -969,7 +998,7 @@ var De = ({ children: e }) => {
969
998
  url: t.url
970
999
  }, t.name, r), !0) : (n(a, t.name, r), !0);
971
1000
  }
972
- let _ = await e.resolveCodeContent(t, Fe(m));
1001
+ let _ = await e.resolveCodeContent(t, Ie(m));
973
1002
  return _ == null ? !1 : (n(_, t.name, r), !0);
974
1003
  }, [
975
1004
  n,
@@ -977,7 +1006,7 @@ var De = ({ children: e }) => {
977
1006
  c,
978
1007
  e
979
1008
  ]);
980
- return { openAttachmentCanvas: k(async (t, s = t.id) => {
1009
+ return { openAttachmentCanvas: O(async (t, s = t.id) => {
981
1010
  switch (t.type) {
982
1011
  case o.Image: {
983
1012
  let r = e.resolveImageContent(t);
@@ -1014,4 +1043,4 @@ var De = ({ children: e }) => {
1014
1043
  ]) };
1015
1044
  };
1016
1045
  //#endregion
1017
- export { W as AttachmentCanvas, Ce as AttachmentCanvasBody, q as AttachmentCanvasContainer, De as AttachmentCanvasProvider, i as AttachmentContentType, e as AttachmentErrorType, pe as CodeContent, n as OoxmlFileType, Le as createForbiddenCanvasContent, Ie as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, t as downloadAttachmentContent, Fe as extensionToLanguage, Re as findVisualizerForMime, Z as getOoxmlFileType, Me as getOoxmlMimeType, r as isDownloadable, Ne as isHtmlPreviewable, je as isOoxmlPreviewable, Q as isTextPreviewable, K as useAttachmentCanvas, Be as useOpenAttachmentCanvas };
1046
+ export { Ee as AttachmentCanvas, we as AttachmentCanvasBody, Ae as AttachmentCanvasContainer, ke as AttachmentCanvasProvider, i as AttachmentContentType, e as AttachmentErrorType, me as CodeContent, B as McpAppCanvasRenderer, n as OoxmlFileType, Re as createForbiddenCanvasContent, Le as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, t as downloadAttachmentContent, Ie as extensionToLanguage, ze as findVisualizerForMime, Z as getOoxmlFileType, Ne as getOoxmlMimeType, r as isDownloadable, Q as isHtmlPreviewable, Me as isOoxmlPreviewable, Pe as isTextPreviewable, G as useAttachmentCanvas, Ve as useOpenAttachmentCanvas };