@epam/ai-dial-attachment-canvas 1.2.0-dev.2 → 1.2.0-dev.201

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.
Files changed (68) hide show
  1. package/{LazyContentBoundary-CL7J_W9c.js → LazyContentBoundary-tNE1ExbI.js} +2 -1
  2. package/{PdfContent-DhfjgYL-.js → PdfContent-BoAtghsO.js} +1 -1
  3. package/PdfContent.css +1 -1
  4. package/{attachment-canvas-Bp6WeQws.js → attachment-canvas-BgwyzrRC.js} +5 -3
  5. package/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
  6. package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -1
  7. package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts +5 -1
  8. package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
  9. package/components/InlineGroupedVisualizer/InlineGroupedVisualizer.d.ts +40 -0
  10. package/components/InlineGroupedVisualizer/InlineGroupedVisualizer.d.ts.map +1 -0
  11. package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts +3 -0
  12. package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts.map +1 -1
  13. package/components/OoxmlContent/OoxmlContent.d.ts.map +1 -1
  14. package/components/PdfContent/PdfContent.d.ts.map +1 -1
  15. package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts +5 -3
  16. package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts.map +1 -1
  17. package/constants/public-class-names.d.ts +11 -0
  18. package/constants/public-class-names.d.ts.map +1 -0
  19. package/context/AttachmentCanvasContext.d.ts.map +1 -1
  20. package/hooks/useMcpAppBridge/useMcpAppBridge.d.ts.map +1 -1
  21. package/hooks/useOpenAttachmentCanvas/useOpenAttachmentCanvas.d.ts +14 -1
  22. package/hooks/useOpenAttachmentCanvas/useOpenAttachmentCanvas.d.ts.map +1 -1
  23. package/index.css +2 -1
  24. package/index.d.ts +7 -3
  25. package/index.d.ts.map +1 -1
  26. package/index.js +814 -691
  27. package/models/attachment-canvas.d.ts +55 -12
  28. package/models/attachment-canvas.d.ts.map +1 -1
  29. package/ooxml-highlight-surfaces-BzgOKpBV.js +459 -0
  30. package/package.json +6 -6
  31. package/test-setup.d.ts +10 -1
  32. package/test-setup.d.ts.map +1 -1
  33. package/types/attachment-canvas.d.ts +23 -1
  34. package/types/attachment-canvas.d.ts.map +1 -1
  35. package/utils/content.d.ts +16 -2
  36. package/utils/content.d.ts.map +1 -1
  37. package/utils/download.d.ts.map +1 -1
  38. package/utils/ooxml-highlight-geometry.d.ts +87 -3
  39. package/utils/ooxml-highlight-geometry.d.ts.map +1 -1
  40. package/utils/ooxml-highlight-surfaces.d.ts +33 -6
  41. package/utils/ooxml-highlight-surfaces.d.ts.map +1 -1
  42. package/utils/ooxml-table-row-highlight.d.ts +8 -0
  43. package/utils/ooxml-table-row-highlight.d.ts.map +1 -0
  44. package/utils/visualizer.d.ts +29 -1
  45. package/utils/visualizer.d.ts.map +1 -1
  46. package/utils/vite-external-matcher.d.ts +5 -5
  47. package/utils/vite-external-matcher.d.ts.map +1 -1
  48. package/bounded-raw-part-cache-BfbSxRIL-DD07NKh9.js +0 -37832
  49. package/chart-ex-B0DgG3Dt.js +0 -1009
  50. package/comment-occurrence-CqejEuts-7SeKCBXk.js +0 -6
  51. package/comment-ui-runtime-DEtgcmj7-B1G7PH4z.js +0 -170
  52. package/comment-ui-runtime-TLHustXJ-DWCXG2mL.js +0 -2
  53. package/comment-ui-runtime-lXwVOgjW-Be4RALsI.js +0 -112
  54. package/comments-CAn2A_Xh-CdgNAj0h.js +0 -282
  55. package/delimited-text-worker-host-DcHj_JZt-DWJmaPag.js +0 -25
  56. package/docx-B9qBTEkj.js +0 -29822
  57. package/line-distribute-IsUGfHXm-DeITjLzJ.js +0 -1234
  58. package/line-metrics-CBbw80Ko-DoOuwYxZ.js +0 -60
  59. package/ooxml-highlight-surfaces-DhK1KJcR.js +0 -294
  60. package/pptx-dkJw0-Vx.js +0 -9179
  61. package/read-only-comment-decoration-BTnWEeo5-BNhbteYc.js +0 -94
  62. package/read-only-comment-margin-plStyGfE-mggNAMB_.js +0 -189
  63. package/render-worker-host-BEfLZvSL-COy91Rd8.js +0 -7
  64. package/render-worker-host-Ba6Fchqr-DZeKpMWD.js +0 -7
  65. package/render-worker-host-C3xwtHnv-BBGHFdo9.js +0 -7
  66. package/renderer-module-contract-Cu-GKuPd-Bt0YZuzB.js +0 -10063
  67. package/visible-index-DPoQYSDt-9lRc-2Ik.js +0 -162
  68. package/xlsx-BAXMTJTG.js +0 -8585
package/index.js CHANGED
@@ -1,44 +1,45 @@
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 k, memo as A, useCallback as j, useContext as M, useEffect as N, useMemo as P, useRef as F, useState as I } from "react";
8
- import { JsonView as oe, defaultStyles as se } from "react-json-view-lite";
9
- import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
10
- import { AppBridge as B, AppFrame as V } from "@mcp-ui/client";
11
- import { McpUiHostContextChangedNotificationSchema as ce } from "@modelcontextprotocol/ext-apps/app-bridge";
12
- import { VisualizerConnectorRequests as le } from "@epam/ai-dial-shared";
13
- import { VisualizerConnector as H } from "@epam/ai-dial-visualizer-connector";
14
- var U = {
1
+ import { a as e, i as t, n, r, t as i } from "./attachment-canvas-BgwyzrRC.js";
2
+ import { i as a, o, t as s } from "./LazyContentBoundary-tNE1ExbI.js";
3
+ import { AttachmentType as c, CodeBlockTheme as l, DEFAULT_MARKDOWN_CLASS_NAMES as u, FileExtension as d, MIMEType as f, MarkdownRenderer as p, buildCssVars as m, copyToClipboard as h, mergeClasses as g, restrainedSyntaxTheme as _, stripUrlQueryAndFragment as v } from "@epam/ai-dial-chat-shared";
4
+ import { SidebarOrientation as y, SidebarPanel as b } from "@epam/ai-dial-sidebar";
5
+ import { DIAL_ICON_SIZE as x, DIAL_KIT_ICON_STROKE as S, ElementSize as C, GhostIconButton as w, LinkButton as T, Spinner as E } from "@epam/ai-dial-ui-kit";
6
+ import { IconAlertTriangle as D, IconArrowsMaximize as O, IconCheck as k, IconCode as ee, IconCopy as te, IconDownload as ne, IconEye as re, IconLock as ie, IconMarkdown as ae, IconRefresh as oe } from "@tabler/icons-react";
7
+ import { createContext as se, lazy as A, memo as j, useCallback as M, useContext as N, useEffect as P, useMemo as F, useRef as I, useState as L } from "react";
8
+ import { JsonView as ce, defaultStyles as R } from "react-json-view-lite";
9
+ import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
10
+ import { AppBridge as H, AppFrame as U } from "@mcp-ui/client";
11
+ import { McpUiHostContextChangedNotificationSchema as le } from "@modelcontextprotocol/ext-apps/app-bridge";
12
+ import { VisualizerConnectorRequests as ue } from "@epam/ai-dial-shared";
13
+ import { VisualizerConnector as de } from "@epam/ai-dial-visualizer-connector";
14
+ //#region src/constants/public-class-names.ts
15
+ var fe = { panel: "dial-attachment-canvas-panel" }, pe = {
15
16
  container: "_container_1nhig_1",
16
17
  containerLight: "_containerLight_1nhig_5"
17
- }, ue = {
18
- [c.Dark]: g,
19
- [c.Light]: g
20
- }, de = () => k(async () => {
18
+ }, me = {
19
+ [l.Dark]: _,
20
+ [l.Light]: _
21
+ }, W = () => A(async () => {
21
22
  let { Prism: e } = await import("react-syntax-highlighter");
22
23
  return { default: e };
23
- }), fe = A(({ content: e, codeBlockTheme: t = c.Light, labels: n }) => {
24
- let { text: r, language: i } = e, a = i == null || i === "plaintext", s = ue[t], l = t === c.Light, [u, d] = I(0), f = P(de, [u]), p = j(() => {
24
+ }), he = j(({ content: e, codeBlockTheme: t = l.Light, labels: n }) => {
25
+ let { text: r, language: i } = e, a = i == null || i === "plaintext", o = me[t], c = t === l.Light, [u, d] = L(0), f = F(W, [u]), p = M(() => {
25
26
  d((e) => e + 1);
26
- }, []), m = /* @__PURE__ */ R("pre", {
27
+ }, []), m = /* @__PURE__ */ B("pre", {
27
28
  className: "whitespace-pre-wrap break-words p-4",
28
29
  children: r
29
30
  });
30
- return /* @__PURE__ */ R("div", {
31
+ return /* @__PURE__ */ B("div", {
31
32
  dir: "ltr",
32
- className: h("h-full overflow-auto", U.container, l && U.containerLight),
33
- children: a ? m : /* @__PURE__ */ R(o, {
33
+ className: g("h-full overflow-auto", pe.container, c && pe.containerLight),
34
+ children: a ? m : /* @__PURE__ */ B(s, {
34
35
  retryKey: u,
35
36
  onRetry: p,
36
37
  pendingContent: m,
37
38
  errorContent: m,
38
39
  labels: n,
39
- children: /* @__PURE__ */ R(f, {
40
+ children: /* @__PURE__ */ B(f, {
40
41
  language: i,
41
- style: s,
42
+ style: o,
42
43
  customStyle: {
43
44
  margin: 0,
44
45
  borderRadius: 0,
@@ -53,62 +54,62 @@ var U = {
53
54
  })
54
55
  })
55
56
  });
56
- }), pe = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, me = A(({ content: e, labels: t, isSourceView: n, title: i, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
57
- 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);
58
- N(() => {
57
+ }), ge = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, _e = j(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
58
+ let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = L(!0), [d, f] = L(!1), p = I(null);
59
+ P(() => {
59
60
  u(!0), f(!1);
60
61
  }, [e]);
61
- let m = j((t) => {
62
+ let m = M((t) => {
62
63
  if (u(!1), e.srcdoc == null) try {
63
64
  p.current?.contentDocument ?? f(!0);
64
65
  } catch {
65
66
  f(!0);
66
67
  }
67
- }, [e.srcdoc]), g = j(() => {
68
+ }, [e.srcdoc]), h = M(() => {
68
69
  u(!1), f(!0);
69
70
  }, []);
70
- if (n && e.srcdoc != null) return /* @__PURE__ */ R(fe, {
71
+ if (n && e.srcdoc != null) return /* @__PURE__ */ B(he, {
71
72
  content: {
72
- type: r.Code,
73
+ type: i.Code,
73
74
  text: e.srcdoc,
74
75
  language: "html"
75
76
  },
76
77
  codeBlockTheme: a
77
78
  });
78
- if (d) return /* @__PURE__ */ z("div", {
79
+ if (d) return /* @__PURE__ */ V("div", {
79
80
  className: "flex h-full flex-col items-center justify-center gap-3 p-4",
80
- children: [/* @__PURE__ */ R("p", {
81
+ children: [/* @__PURE__ */ B("p", {
81
82
  className: "text-center",
82
83
  children: s
83
- }), e.url != null && /* @__PURE__ */ R(C, {
84
+ }), e.url != null && /* @__PURE__ */ B(T, {
84
85
  href: e.url,
85
86
  target: "_blank",
86
87
  label: c,
87
- className: pe.openInNewTabButton,
88
+ className: ge.openInNewTabButton,
88
89
  textClassName: o
89
90
  })]
90
91
  });
91
92
  let _ = e.srcdoc != null, v = _ ? void 0 : e.url, y = _ ? e.srcdoc : void 0;
92
- return /* @__PURE__ */ z("div", {
93
+ return /* @__PURE__ */ V("div", {
93
94
  className: "relative h-full",
94
- children: [l && /* @__PURE__ */ R("div", {
95
+ children: [l && /* @__PURE__ */ B("div", {
95
96
  className: "absolute inset-0 flex items-center justify-center",
96
- children: /* @__PURE__ */ R(w, {})
97
- }), /* @__PURE__ */ R("iframe", {
97
+ children: /* @__PURE__ */ B(E, {})
98
+ }), /* @__PURE__ */ B("iframe", {
98
99
  ref: p,
99
- title: i,
100
+ title: r,
100
101
  src: v,
101
102
  srcDoc: y,
102
103
  sandbox: _ ? "allow-scripts" : "allow-scripts allow-same-origin",
103
- className: h("h-full w-full border-none", l ? "invisible" : ""),
104
+ className: g("h-full w-full border-none", l ? "invisible" : ""),
104
105
  onLoad: m,
105
- onError: g
106
+ onError: h
106
107
  })]
107
108
  });
108
- }), he = {
109
+ }), ve = {
109
110
  name: "MCP-UI Host",
110
111
  version: "1.0.0"
111
- }, ge = { openLinks: {} }, _e = (e) => {
112
+ }, ye = { openLinks: {} }, be = (e) => {
112
113
  let t;
113
114
  try {
114
115
  t = new URL(e);
@@ -122,31 +123,38 @@ var U = {
122
123
  return !1;
123
124
  }
124
125
  return !0;
125
- }, W = (e, t, n) => {
126
+ }, xe = (e, t, n) => {
126
127
  if (n) {
127
128
  e.style.maxWidth = "", e.style.maxHeight = "";
128
129
  return;
129
130
  }
130
131
  let r = t;
131
132
  r != null && (r.width != null && (e.style.width = `${r.width}px`), r.maxWidth != null && (e.style.maxWidth = `${r.maxWidth}px`), r.height != null && (e.style.height = `${r.height}px`), r.maxHeight != null && (e.style.maxHeight = `${r.maxHeight}px`));
132
- }, ve = (e, t, n) => {
133
- let r = F(e);
134
- N(() => {
133
+ }, Se = (e, t, n) => {
134
+ let r = I(e);
135
+ P(() => {
135
136
  r.current = e;
136
137
  });
137
- let [i, a] = I(null), [o, s] = I(!1);
138
- return N(() => {
138
+ let [i, a] = L(null), [o, s] = L(!1);
139
+ return P(() => {
139
140
  let e = null;
140
141
  try {
141
- e = new B(null, he, ge, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
142
+ let n = t.current?.getBoundingClientRect(), i = n != null && n.width > 0 && n.height > 0 ? {
143
+ ...r.current.hostContext,
144
+ containerDimensions: {
145
+ width: Math.round(n.width),
146
+ height: Math.round(n.height)
147
+ }
148
+ } : r.current.hostContext;
149
+ e = new H(null, r.current.hostInfo ?? ve, ye, { hostContext: i }), e.onopenlink = async ({ url: e }) => {
142
150
  let t = r.current.onOpenLink;
143
- return (t == null ? _e(e) : t(e)) === !1 ? { isError: !0 } : {};
151
+ return (t == null ? be(e) : t(e)) === !1 ? { isError: !0 } : {};
144
152
  }, e.onrequestdisplaymode = async ({ mode: e }) => {
145
153
  let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
146
154
  return { mode: t?.(e) ?? n };
147
- }, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(ce, ({ params: e }) => {
155
+ }, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(le, ({ params: e }) => {
148
156
  let n = t.current?.querySelector("iframe");
149
- n != null && W(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
157
+ n != null && xe(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
150
158
  }), a(e);
151
159
  } catch (e) {
152
160
  console.error("[useMcpAppBridge] Error creating AppBridge:", e), s(!0);
@@ -154,65 +162,74 @@ var U = {
154
162
  return () => {
155
163
  e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
156
164
  };
157
- }, [t]), N(() => {
158
- i != null && n != null && i.setHostContext(n);
165
+ }, [t]), P(() => {
166
+ i != null && i.transport != null && n != null && i.setHostContext(n);
159
167
  }, [i, n]), {
160
168
  appBridge: i,
161
169
  hasFailed: o
162
170
  };
163
171
  }, G = {
164
- loadingOverlay: "_loadingOverlay_1aric_1",
165
- fullscreenFrame: "_fullscreenFrame_1aric_20",
166
- statusLabel: "_statusLabel_1aric_27",
167
- errorIcon: "_errorIcon_1aric_31"
168
- }, ye = ({ content: e, errorLabel: t = "Failed to load app" }) => {
169
- let [n, r] = I("loading"), { html: i, sandboxUrl: a, toolInput: o, toolResult: s, hostContext: c } = e, l = P(() => ({ url: new URL(a) }), [a]), u = c?.displayMode === "fullscreen", d = F(null), [f, p] = I();
170
- N(() => {
171
- let e = d.current;
172
+ loadingOverlay: "_loadingOverlay_iea4a_2",
173
+ fullscreenFrame: "_fullscreenFrame_iea4a_21",
174
+ loadingFrame: "_loadingFrame_iea4a_29",
175
+ statusLabel: "_statusLabel_iea4a_33",
176
+ statusDetail: "_statusDetail_iea4a_38",
177
+ errorIcon: "_errorIcon_iea4a_42"
178
+ }, Ce = ({ content: e, errorLabel: t = "Failed to load app", onAppInfo: n }) => {
179
+ let [r, i] = L("loading"), [a, o] = L(), { html: s, sandboxUrl: c, toolInput: l, toolResult: u, hostContext: d } = e, f = F(() => ({ url: new URL(c) }), [c]), p = d?.displayMode === "fullscreen", m = I(null), [h, _] = L();
180
+ P(() => {
181
+ let e = m.current;
172
182
  if (!e) return;
173
183
  let t = new ResizeObserver(([e]) => {
174
184
  if (!e) return;
175
185
  let { width: t, height: n } = e.contentRect;
176
- p({
186
+ _({
177
187
  width: Math.round(t),
178
188
  height: Math.round(n)
179
189
  });
180
190
  });
181
191
  return t.observe(e), () => t.disconnect();
182
192
  }, []);
183
- let { appBridge: m, hasFailed: g } = ve(e, d, P(() => c == null || f == null ? c : {
184
- ...c,
185
- containerDimensions: f
186
- }, [c, f])), _ = g || n === "error";
187
- return /* @__PURE__ */ z("div", {
188
- ref: d,
189
- className: h("relative h-full w-full", u && G.fullscreenFrame),
193
+ let { appBridge: v, hasFailed: y } = Se(e, m, F(() => d == null || h == null ? d : {
194
+ ...d,
195
+ containerDimensions: h
196
+ }, [d, h])), b = y || r === "error";
197
+ return /* @__PURE__ */ V("div", {
198
+ ref: m,
199
+ className: g("relative h-full min-h-[200px] w-full", p && G.fullscreenFrame, !p && r === "loading" && G.loadingFrame),
190
200
  children: [
191
- m != null && /* @__PURE__ */ R(V, {
192
- html: i,
193
- sandbox: l,
194
- appBridge: m,
195
- toolInput: o,
196
- toolResult: s,
197
- onSizeChanged: () => r("ready"),
198
- onInitialized: () => r("ready"),
199
- onError: () => r("error")
201
+ v != null && !b && /* @__PURE__ */ B(U, {
202
+ html: s,
203
+ sandbox: f,
204
+ appBridge: v,
205
+ toolInput: l,
206
+ toolResult: u,
207
+ onSizeChanged: () => i("ready"),
208
+ onInitialized: (e) => {
209
+ i("ready"), e.appVersion != null && n?.(e.appVersion);
210
+ },
211
+ onError: (e) => {
212
+ o(e.message), i("error");
213
+ }
200
214
  }),
201
- !_ && n === "loading" && /* @__PURE__ */ R("div", {
202
- className: h("absolute inset-0 flex flex-col items-center justify-center gap-2", G.loadingOverlay),
203
- children: /* @__PURE__ */ R(w, {})
215
+ !b && r === "loading" && /* @__PURE__ */ B("div", {
216
+ className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", G.loadingOverlay),
217
+ children: /* @__PURE__ */ B(E, {})
204
218
  }),
205
- _ && /* @__PURE__ */ z("div", {
206
- className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
207
- children: [/* @__PURE__ */ R(T, {
219
+ b && /* @__PURE__ */ V("div", {
220
+ className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
221
+ children: [/* @__PURE__ */ B(D, {
208
222
  size: 60,
209
- stroke: x,
223
+ stroke: S,
210
224
  "aria-hidden": !0,
211
225
  className: G.errorIcon
212
- }), /* @__PURE__ */ R("p", {
226
+ }), /* @__PURE__ */ V("p", {
213
227
  role: "alert",
214
- className: h("text-center", G.statusLabel),
215
- children: t
228
+ className: g("text-center", G.statusLabel),
229
+ children: [t, a && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("br", {}), /* @__PURE__ */ B("span", {
230
+ className: G.statusDetail,
231
+ children: a
232
+ })] })]
216
233
  })]
217
234
  })
218
235
  ]
@@ -225,64 +242,68 @@ var U = {
225
242
  statusOverlay: "_statusOverlay_1w97n_24",
226
243
  errorIcon: "_errorIcon_1w97n_29",
227
244
  highlight: "_highlight_1w97n_37"
228
- }, be = (e) => {
245
+ }, we = (e) => {
229
246
  if (e?.kind !== "range") return "";
230
247
  let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
231
248
  if (n == null) return "";
232
249
  let r = n.formula;
233
250
  return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
234
- }, xe = async (e, t, { onError: r, onXlsxSelectionContextChange: i }) => {
251
+ }, Te = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
235
252
  switch (t) {
236
- case n.Docx: {
237
- let [{ DocxScrollViewer: t }, { chartEx: n }] = await Promise.all([import("./docx-B9qBTEkj.js"), import("./chart-ex-B0DgG3Dt.js")]);
253
+ case r.Docx: {
254
+ let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/docx"), import("@silurus/ooxml/chart-ex")]);
238
255
  return new t(e, {
239
256
  enableTextSelection: !0,
240
257
  refitOnResize: !0,
241
- chartEx: n,
242
- onError: r
258
+ chartEx: r,
259
+ onError: n
243
260
  });
244
261
  }
245
- case n.Xlsx: {
246
- let [{ XlsxViewer: t }, { chartEx: n }] = await Promise.all([import("./xlsx-BAXMTJTG.js"), import("./chart-ex-B0DgG3Dt.js")]);
262
+ case r.Xlsx: {
263
+ let [{ XlsxViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/xlsx"), import("@silurus/ooxml/chart-ex")]);
247
264
  return new t(e, {
248
265
  showZoomSlider: !0,
249
- chartEx: n,
250
- onError: r,
266
+ chartEx: r,
267
+ onError: n,
251
268
  onSelectionContextChange: i
252
269
  });
253
270
  }
254
- case n.Csv: {
255
- let { XlsxSheetViewer: t } = await import("./xlsx-BAXMTJTG.js"), n = document.createElement("canvas");
256
- n.className = K.spreadsheetCanvas, e.replaceChildren(n);
257
- let i = new t(n, {
271
+ case r.Csv: {
272
+ let { XlsxSheetViewer: t } = await import("@silurus/ooxml/xlsx"), r = document.createElement("canvas");
273
+ r.className = K.spreadsheetCanvas, e.replaceChildren(r);
274
+ let i = new t(r, {
258
275
  showScrollbars: !0,
259
- onError: r
276
+ onError: n
260
277
  });
261
278
  return {
262
279
  load: (e) => i.load(e, { format: "csv" }),
263
- destroy: () => i.destroy()
280
+ destroy: () => i.destroy(),
281
+ resize: () => {
282
+ let { width: t, height: n } = e.getBoundingClientRect();
283
+ return t > 0 && (r.style.width = `${t}px`), n > 0 && (r.style.height = `${n}px`), i.relayout();
284
+ }
264
285
  };
265
286
  }
266
- case n.Pptx: {
267
- let [{ PptxScrollViewer: t }, { chartEx: n }] = await Promise.all([import("./pptx-dkJw0-Vx.js"), import("./chart-ex-B0DgG3Dt.js")]);
287
+ case r.Pptx: {
288
+ let [{ PptxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/pptx"), import("@silurus/ooxml/chart-ex")]);
268
289
  return new t(e, {
269
290
  enableTextSelection: !0,
270
291
  refitOnResize: !0,
271
- chartEx: n,
272
- onError: r
292
+ chartEx: r,
293
+ onError: n
273
294
  });
274
295
  }
275
296
  }
276
- }, Se = async (e, t, r, i) => {
277
- let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = r;
297
+ }, Ee = async (e, t, n, i) => {
298
+ let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = n;
278
299
  switch (t.format) {
279
- case n.Docx: {
300
+ case r.Docx: {
280
301
  let [{ DocxDocument: n, DocxScrollViewer: r }, { chartEx: o }, { createDocxHighlightSurface: c }] = await Promise.all([
281
- import("./docx-B9qBTEkj.js"),
282
- import("./chart-ex-B0DgG3Dt.js"),
283
- import("./ooxml-highlight-surfaces-DhK1KJcR.js")
302
+ import("@silurus/ooxml/docx"),
303
+ import("@silurus/ooxml/chart-ex"),
304
+ import("./ooxml-highlight-surfaces-BzgOKpBV.js")
284
305
  ]), l = await n.load(t.url, { chartEx: o });
285
- if (i()) throw l.destroy(), new Ce();
306
+ if (i()) throw l.destroy(), new De();
286
307
  let u = r.fromDocument(e, l, {
287
308
  enableTextSelection: !0,
288
309
  refitOnResize: !0,
@@ -296,13 +317,13 @@ var U = {
296
317
  highlights: c(e, l, u, i)
297
318
  };
298
319
  }
299
- case n.Pptx: {
320
+ case r.Pptx: {
300
321
  let [{ PptxPresentation: n, PptxScrollViewer: r }, { chartEx: o }, { createPptxHighlightSurface: c }] = await Promise.all([
301
- import("./pptx-dkJw0-Vx.js"),
302
- import("./chart-ex-B0DgG3Dt.js"),
303
- import("./ooxml-highlight-surfaces-DhK1KJcR.js")
322
+ import("@silurus/ooxml/pptx"),
323
+ import("@silurus/ooxml/chart-ex"),
324
+ import("./ooxml-highlight-surfaces-BzgOKpBV.js")
304
325
  ]), l = await n.load(t.url, { chartEx: o });
305
- if (i()) throw l.destroy(), new Ce();
326
+ if (i()) throw l.destroy(), new De();
306
327
  let u = r.fromPresentation(e, l, {
307
328
  enableTextSelection: !0,
308
329
  refitOnResize: !0,
@@ -316,11 +337,11 @@ var U = {
316
337
  highlights: c(e, l, u, i)
317
338
  };
318
339
  }
319
- case n.Xlsx: {
340
+ case r.Xlsx: {
320
341
  let [{ XlsxViewer: n }, { chartEx: r }, { createXlsxHighlightSurface: c }] = await Promise.all([
321
- import("./xlsx-BAXMTJTG.js"),
322
- import("./chart-ex-B0DgG3Dt.js"),
323
- import("./ooxml-highlight-surfaces-DhK1KJcR.js")
342
+ import("@silurus/ooxml/xlsx"),
343
+ import("@silurus/ooxml/chart-ex"),
344
+ import("./ooxml-highlight-surfaces-BzgOKpBV.js")
324
345
  ]), l = new n(e, {
325
346
  showZoomSlider: !0,
326
347
  chartEx: r,
@@ -335,125 +356,128 @@ var U = {
335
356
  highlights: c(e, l, i)
336
357
  };
337
358
  }
338
- case n.Csv: {
339
- let n = await xe(e, t.format, r);
340
- return await n.load(t.url), { viewer: n };
359
+ case r.Csv: {
360
+ let r = await Te(e, t.format, n);
361
+ return await r.load(t.url), { viewer: r };
341
362
  }
342
363
  }
343
- }, Ce = class extends Error {}, we = ({ content: e, fileName: t, loadErrorLabel: r, formulaLabel: i, formulaLabelClassName: a, highlightsLabel: o = "Cited locations", highlightNavigatedLabel: s = "Scrolled to the cited location" }) => {
344
- let c = F(null), [l, u] = I(!0), [d, f] = I(!1), [p, m] = I(""), [g, _] = I([]), [v, y] = I(!1), { highlights: b, selectedHighlightId: S } = e, C = b != null && b.length > 0, E = F(void 0), D = F(b);
345
- D.current = b;
346
- let O = F(void 0);
347
- return N(() => {
348
- let t = c.current;
349
- if (t == null) return;
350
- let n, r = !1, i, a = () => r;
351
- u(!0), f(!1), m(""), _([]), y(!1);
352
- let o = () => {
353
- r || i != null || (i = requestAnimationFrame(() => {
354
- i = void 0, s();
364
+ }, De = class extends Error {}, Oe = ({ content: t, fileName: n, loadErrorLabel: i, formulaLabel: a, formulaLabelClassName: o, highlightsLabel: s = "Cited locations", highlightNavigatedLabel: c = "Scrolled to the cited location" }) => {
365
+ let l = I(null), [u, d] = L(!0), [f, p] = L(!1), [m, h] = L(""), [_, v] = L([]), [y, b] = L(!1), { highlights: x, selectedHighlightId: C } = t, w = x != null && x.length > 0, T = I(void 0), O = I(x);
366
+ O.current = x;
367
+ let k = I(void 0);
368
+ return P(() => {
369
+ let e = l.current;
370
+ if (e == null) return;
371
+ let n, r, i = !1, a, o = () => i;
372
+ d(!0), p(!1), h(""), v([]), b(!1);
373
+ let s = () => {
374
+ i || a != null || (a = requestAnimationFrame(() => {
375
+ a = void 0, c();
355
376
  }));
356
- }, s = async () => {
357
- let e = n?.highlights, t = D.current;
358
- if (!(r || e == null || t == null)) try {
377
+ }, c = async () => {
378
+ let e = n?.highlights, t = O.current;
379
+ if (!(i || e == null || t == null)) try {
359
380
  let n = await e.measure(t);
360
- r || _(n);
381
+ i || v(n);
361
382
  } catch {
362
- r || _([]);
383
+ i || v([]);
363
384
  }
364
- }, l = {
385
+ }, u = {
365
386
  onError: () => {
366
- r || (u(!1), f(!0));
387
+ i || (d(!1), p(!0));
367
388
  },
368
389
  onXlsxSelectionContextChange: (e) => {
369
- r || m(be(e));
390
+ i || h(we(e));
370
391
  },
371
- onGeometryInvalidated: o
392
+ onGeometryInvalidated: s
393
+ }, f = () => {
394
+ i || (r = new ResizeObserver(() => {
395
+ n?.viewer.resize?.(), s();
396
+ }), r.observe(e));
372
397
  };
373
- return t.addEventListener("scroll", o, !0), O.current = o, (async () => {
398
+ return e.addEventListener("scroll", s, !0), k.current = s, (async () => {
374
399
  try {
375
- if (C) {
376
- let i = await Se(t, e, l, a);
377
- if (r) {
378
- i.viewer.destroy(), i.engine?.destroy();
400
+ if (w) {
401
+ let r = await Ee(e, t, u, o);
402
+ if (i) {
403
+ r.viewer.destroy(), r.engine?.destroy();
379
404
  return;
380
405
  }
381
- n = i, E.current = i.highlights;
406
+ n = r, T.current = r.highlights, f();
382
407
  } else {
383
- let i = await xe(t, e.format, l);
384
- if (r) {
385
- i.destroy();
408
+ let r = await Te(e, t.format, u);
409
+ if (i) {
410
+ r.destroy();
386
411
  return;
387
412
  }
388
- n = { viewer: i }, E.current = void 0, await i.load(e.url);
413
+ if (n = { viewer: r }, T.current = void 0, await r.load(t.url), i) return;
414
+ f();
389
415
  }
390
- if (r) return;
391
- u(!1), await s();
392
- } catch (e) {
393
- if (e instanceof Ce || r) return;
394
- n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, E.current = void 0, t.replaceChildren(), u(!1), f(!0);
416
+ if (i) return;
417
+ d(!1), await c();
418
+ } catch (t) {
419
+ if (t instanceof De || i) return;
420
+ n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, T.current = void 0, e.replaceChildren(), d(!1), p(!0);
395
421
  }
396
422
  })(), () => {
397
- 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();
423
+ i = !0, e.removeEventListener("scroll", s, !0), a != null && cancelAnimationFrame(a), k.current = void 0, r?.disconnect(), n?.viewer.destroy(), n?.engine?.destroy(), T.current = void 0, e.replaceChildren();
398
424
  };
399
425
  }, [
400
- e.format,
401
- e.url,
402
- C
403
- ]), N(() => {
404
- O.current?.();
405
- }, [b]), N(() => {
406
- let e = E.current;
407
- if (e == null || l) return;
408
- let t = (b?.find(({ id: e }) => e === S))?.locations.at(0);
409
- if (t == null) return;
410
- let n = !1;
426
+ t.format,
427
+ t.url,
428
+ w
429
+ ]), P(() => {
430
+ k.current?.();
431
+ }, [x]), P(() => {
432
+ b(!1);
433
+ let t = T.current;
434
+ if (t == null || u) return;
435
+ let n = (O.current?.find(({ id: e }) => e === C))?.locations.at(0);
436
+ if (n == null) return;
437
+ let r = !1;
411
438
  return (async () => {
439
+ let i;
412
440
  try {
413
- await e.navigate(t);
441
+ i = await t.navigate(n);
414
442
  } catch {
415
443
  return;
416
444
  }
417
- n || y(!0);
445
+ r || i !== e.Navigated || b(!0);
418
446
  })(), () => {
419
- n = !0;
447
+ r = !0;
420
448
  };
421
- }, [
422
- b,
423
- S,
424
- l
425
- ]), /* @__PURE__ */ z("div", {
449
+ }, [C, u]), /* @__PURE__ */ V("div", {
426
450
  className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
427
451
  children: [
428
- e.format === n.Xlsx && /* @__PURE__ */ z("div", {
452
+ t.format === r.Xlsx && /* @__PURE__ */ V("div", {
429
453
  role: "region",
430
- "aria-label": i,
431
- className: h("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", K.formulaPanel),
432
- children: [/* @__PURE__ */ R("span", {
454
+ "aria-label": a,
455
+ className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", K.formulaPanel),
456
+ children: [/* @__PURE__ */ B("span", {
433
457
  "aria-hidden": "true",
434
- className: h("shrink-0", a),
458
+ className: g("shrink-0", o),
435
459
  children: "fx"
436
- }), /* @__PURE__ */ R("code", {
460
+ }), /* @__PURE__ */ B("code", {
437
461
  dir: "ltr",
438
462
  tabIndex: 0,
439
463
  "aria-live": "polite",
440
- 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", K.formulaValue),
441
- children: p
464
+ className: g("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", K.formulaValue),
465
+ children: m
442
466
  })]
443
467
  }),
444
- /* @__PURE__ */ z("div", {
468
+ /* @__PURE__ */ V("div", {
445
469
  className: "relative min-h-0 w-full flex-1",
446
- children: [/* @__PURE__ */ R("div", {
447
- ref: c,
470
+ children: [/* @__PURE__ */ B("div", {
471
+ ref: l,
448
472
  role: "document",
449
- "aria-label": t,
450
- "aria-busy": l,
451
- className: h("h-full w-full overflow-hidden", K.viewer)
452
- }), g.length > 0 && /* @__PURE__ */ R("div", {
473
+ "aria-label": n,
474
+ "aria-busy": u,
475
+ className: g("h-full w-full overflow-hidden", K.viewer)
476
+ }), _.length > 0 && /* @__PURE__ */ B("div", {
453
477
  role: "region",
454
- "aria-label": o,
478
+ "aria-label": s,
455
479
  className: "pointer-events-none absolute inset-0 overflow-hidden",
456
- children: g.map((e, t) => /* @__PURE__ */ R("div", {
480
+ children: _.map((e, t) => /* @__PURE__ */ B("div", {
457
481
  "aria-hidden": "true",
458
482
  style: {
459
483
  left: `${e.left}px`,
@@ -461,101 +485,117 @@ var U = {
461
485
  width: `${e.width}px`,
462
486
  height: `${e.height}px`
463
487
  },
464
- "data-selected": e.highlightId === S,
488
+ "data-selected": e.highlightId === C,
465
489
  "data-clipped": e.isClippedAtEnd === !0,
466
- className: h("absolute", K.highlight)
490
+ className: g("absolute", K.highlight)
467
491
  }, `${e.highlightId}-${t}`))
468
492
  })]
469
493
  }),
470
- /* @__PURE__ */ R("div", {
494
+ /* @__PURE__ */ B("div", {
471
495
  role: "status",
472
496
  "aria-live": "polite",
473
497
  className: "sr-only",
474
- children: v ? s : ""
498
+ children: y ? c : ""
475
499
  }),
476
- (l || d) && /* @__PURE__ */ R("div", {
477
- role: d ? "alert" : void 0,
500
+ (u || f) && /* @__PURE__ */ B("div", {
501
+ role: f ? "alert" : void 0,
478
502
  "aria-live": "polite",
479
- className: h("absolute inset-0 flex items-center justify-center", K.statusOverlay),
480
- children: l ? /* @__PURE__ */ R(w, { size: 48 }) : /* @__PURE__ */ z("div", {
503
+ className: g("absolute inset-0 flex items-center justify-center", K.statusOverlay),
504
+ children: u ? /* @__PURE__ */ B(E, { size: 48 }) : /* @__PURE__ */ V("div", {
481
505
  className: "flex flex-col items-center gap-2",
482
- children: [/* @__PURE__ */ R(T, {
506
+ children: [/* @__PURE__ */ B(D, {
483
507
  "aria-hidden": "true",
484
508
  size: 60,
485
- stroke: x,
509
+ stroke: S,
486
510
  className: K.errorIcon
487
- }), /* @__PURE__ */ R("p", {
511
+ }), /* @__PURE__ */ B("p", {
488
512
  className: "text-center",
489
- children: r
513
+ children: i
490
514
  })]
491
515
  })
492
516
  })
493
517
  ]
494
518
  });
495
- }, Te = {
519
+ }, ke = {
496
520
  loadingOverlay: "_loadingOverlay_12637_1",
497
521
  statusLabel: "_statusLabel_12637_5",
498
522
  errorIcon: "_errorIcon_12637_9"
499
- }, Ee = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
500
- let i = F(null), [a, o] = I("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = F(e);
501
- return u.current = e, N(() => {
502
- let e = i.current;
523
+ }, Ae = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: a }) => {
524
+ let o = I(null), [s, c] = L("loading"), { url: l, visualizerName: u, requestTimeout: d } = e, f = I(e);
525
+ return f.current = e, P(() => {
526
+ let e = o.current;
503
527
  if (!e) return;
504
- o("loading");
505
- let t = new H(e, {
506
- domain: s,
528
+ c("loading");
529
+ let t = new de(e, {
530
+ domain: l,
507
531
  hostDomain: window.location.origin,
508
- visualizerName: c,
509
- requestTimeout: l
532
+ visualizerName: u,
533
+ requestTimeout: d
510
534
  }), n = !0;
511
535
  return (async () => {
512
536
  if (await t.ready(), !n) return;
513
- let { mimeType: e, layout: r, data: i } = u.current, a = {
514
- layout: r,
515
- ...typeof i == "object" && i ? i : {}
516
- };
517
- await t.send(le.sendVisualizeData, {
518
- mimeType: e,
519
- visualizerData: a
520
- }), n && o("ready");
537
+ let e = f.current;
538
+ if (e.type === i.GroupedVisualizer) await t.send(ue.sendGroupedVisualizeData, {
539
+ attachments: e.attachments,
540
+ layout: e.layout
541
+ });
542
+ else {
543
+ let { mimeType: n, layout: r, data: i } = e, a = {
544
+ layout: r,
545
+ ...typeof i == "object" && i ? i : {}
546
+ };
547
+ await t.send(ue.sendVisualizeData, {
548
+ mimeType: n,
549
+ visualizerData: a
550
+ });
551
+ }
552
+ n && c("ready");
521
553
  })().catch(() => {
522
- n && o("error");
554
+ n && c("error");
523
555
  }), () => {
524
556
  n = !1, t.destroy();
525
557
  };
526
558
  }, [
527
- s,
528
- c,
529
- l
530
- ]), /* @__PURE__ */ z("div", {
559
+ l,
560
+ u,
561
+ d
562
+ ]), P(() => {
563
+ let e = r ?? u.trim();
564
+ e !== "" && o.current?.querySelector("iframe")?.setAttribute("title", e);
565
+ }, [
566
+ r,
567
+ u,
568
+ l,
569
+ d
570
+ ]), /* @__PURE__ */ V("div", {
531
571
  className: "relative h-full w-full",
532
- style: p({
533
- "--vs-loading-bg": r?.loadingBackground,
534
- "--vs-status-text": r?.statusText,
535
- "--vs-error-icon": r?.errorIcon
572
+ style: m({
573
+ "--vs-loading-bg": a?.loadingBackground,
574
+ "--vs-status-text": a?.statusText,
575
+ "--vs-error-icon": a?.errorIcon
536
576
  }),
537
577
  children: [
538
- /* @__PURE__ */ R("div", {
539
- ref: i,
578
+ /* @__PURE__ */ B("div", {
579
+ ref: o,
540
580
  className: "h-full w-full"
541
581
  }),
542
- a === "loading" && /* @__PURE__ */ z("div", {
543
- className: h("absolute inset-0 flex flex-col items-center justify-center gap-2", Te.loadingOverlay),
544
- children: [/* @__PURE__ */ R(w, {}), t && /* @__PURE__ */ R("p", {
545
- className: h("text-center", Te.statusLabel),
582
+ s === "loading" && /* @__PURE__ */ V("div", {
583
+ className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", ke.loadingOverlay),
584
+ children: [/* @__PURE__ */ B(E, {}), t && /* @__PURE__ */ B("p", {
585
+ className: g("text-center", ke.statusLabel),
546
586
  children: t
547
587
  })]
548
588
  }),
549
- a === "error" && /* @__PURE__ */ z("div", {
589
+ s === "error" && /* @__PURE__ */ V("div", {
550
590
  className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
551
- children: [/* @__PURE__ */ R(T, {
591
+ children: [/* @__PURE__ */ B(D, {
552
592
  size: 60,
553
- stroke: x,
593
+ stroke: S,
554
594
  "aria-hidden": !0,
555
- className: Te.errorIcon
556
- }), /* @__PURE__ */ R("p", {
595
+ className: ke.errorIcon
596
+ }), /* @__PURE__ */ B("p", {
557
597
  role: "alert",
558
- className: h("text-center", Te.statusLabel),
598
+ className: g("text-center", ke.statusLabel),
559
599
  children: n
560
600
  })]
561
601
  })
@@ -576,35 +616,35 @@ var U = {
576
616
  jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
577
617
  jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
578
618
  jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
579
- }, De = () => k(async () => ({ default: (await import("./PdfContent-DhfjgYL-.js")).PdfContent })), Oe = ({ url: e, fileName: t, loadErrorLabel: n }) => {
580
- let [r, i] = I(!1);
581
- return N(() => {
619
+ }, je = () => A(async () => ({ default: (await import("./PdfContent-BoAtghsO.js")).PdfContent })), Me = ({ url: e, fileName: t, loadErrorLabel: n }) => {
620
+ let [r, i] = L(!1);
621
+ return P(() => {
582
622
  i(!1);
583
- }, [e]), r ? /* @__PURE__ */ z("div", {
623
+ }, [e]), r ? /* @__PURE__ */ V("div", {
584
624
  className: "flex flex-col items-center gap-2",
585
- children: [/* @__PURE__ */ R(T, {
625
+ children: [/* @__PURE__ */ B(D, {
586
626
  size: 60,
587
- stroke: x,
627
+ stroke: S,
588
628
  className: q.errorIcon
589
- }), /* @__PURE__ */ R("p", {
590
- className: h("text-center", q.statusLabel),
629
+ }), /* @__PURE__ */ B("p", {
630
+ className: g("text-center", q.statusLabel),
591
631
  children: n
592
632
  })]
593
- }) : /* @__PURE__ */ R("img", {
633
+ }) : /* @__PURE__ */ B("img", {
594
634
  src: e,
595
635
  alt: t ?? "",
596
636
  className: "max-h-full max-w-full object-contain",
597
637
  onError: () => i(!0)
598
638
  });
599
- }, ke = new Set([
600
- r.PlainText,
601
- r.Code,
602
- r.Ooxml
603
- ]), Ae = A(({ 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: k, tableDownloadCsvLabel: A, ooxmlHighlightsLabel: M, ooxmlHighlightNavigatedLabel: N } = {}, styles: F, codeBlockTheme: L, tableDownloadFilename: B, loadPdf: V, hidePdfToolbar: ce = !1, configurePdfWorker: le }) => {
604
- let { colors: H, typography: U, bodyClassName: ue, cssVars: de } = F ?? {}, [pe, he] = I(0), ge = P(De, [pe]), _e = j(() => {
605
- he((e) => e + 1);
606
- }, []), W = U?.fontClassName != null, ve = P(() => ({
607
- ...p({
639
+ }, Ne = new Set([
640
+ i.PlainText,
641
+ i.Code,
642
+ i.Ooxml
643
+ ]), Pe = j(({ content: e, isLoading: t = !1, fileName: r, isHtmlSourceView: a = !1, labels: { unsupportedLabel: o = "Preview is not supported for this file", loadErrorLabel: c = "Failed to load file", forbiddenErrorLabel: l = "You don't have permission to access this file", visualizerErrorLabel: d, htmlFrameBlockedLabel: f = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: h = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: C, pdfContentRetryLabel: w, xlsxFormulaLabel: T = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: k, codeContentRetryLabel: ee, tableCopyLabel: te, tableCopiedLabel: ne, tableDownloadCsvLabel: re, ooxmlHighlightsLabel: ae, ooxmlHighlightNavigatedLabel: oe } = {}, styles: se, codeBlockTheme: A, tableDownloadFilename: j, loadPdf: N, hidePdfToolbar: P = !1, configurePdfWorker: I, onAppInfo: z }) => {
644
+ let { colors: H, typography: U, bodyClassName: le, cssVars: ue } = se ?? {}, [de, fe] = L(0), pe = F(je, [de]), me = M(() => {
645
+ fe((e) => e + 1);
646
+ }, []), W = U?.fontClassName != null, ge = F(() => ({
647
+ ...m({
608
648
  "--ac-text": H?.text,
609
649
  "--ac-status-text": H?.statusText,
610
650
  "--ac-error-icon": H?.errorIcon,
@@ -634,174 +674,177 @@ var U = {
634
674
  "--ac-line-height": W ? void 0 : U?.lineHeight,
635
675
  "--ac-letter-spacing": W ? void 0 : U?.letterSpacing
636
676
  }),
637
- ...de
638
- }), [F]), G = P(() => {
677
+ ...ue
678
+ }), [se]), ve = F(() => {
639
679
  switch (e.type) {
640
- case r.Image:
641
- case r.Audio:
642
- case r.Unsupported:
643
- case r.Error: return "h-full overflow-auto p-4 flex items-center justify-center";
644
- case r.Json: return "h-full overflow-auto";
645
- case r.Pdf:
646
- case r.Ooxml:
647
- case r.Visualizer:
648
- case r.McpApp:
649
- case r.Code:
650
- case r.Html: return "h-full overflow-hidden";
651
- case r.Markdown: return "h-full overflow-auto p-4";
652
- case r.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
680
+ case i.Image:
681
+ case i.Audio:
682
+ case i.Unsupported:
683
+ case i.Error: return "h-full overflow-auto p-4 flex items-center justify-center";
684
+ case i.Json: return "h-full overflow-auto";
685
+ case i.Pdf:
686
+ case i.Ooxml:
687
+ case i.Visualizer:
688
+ case i.GroupedVisualizer:
689
+ case i.McpApp:
690
+ case i.Code:
691
+ case i.Html: return "h-full overflow-hidden";
692
+ case i.Markdown: return "h-full overflow-auto p-4";
693
+ case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
653
694
  default: return "h-full overflow-auto p-4";
654
695
  }
655
- }, [e.type]), K = P(() => {
696
+ }, [e.type]), ye = F(() => {
656
697
  switch (e.type) {
657
- case r.PlainText: return /* @__PURE__ */ R("pre", {
658
- className: h("whitespace-pre-wrap break-words", q.body, U?.fontClassName),
698
+ case i.PlainText: return /* @__PURE__ */ B("pre", {
699
+ className: g("whitespace-pre-wrap break-words", q.body, U?.fontClassName),
659
700
  children: e.text
660
701
  });
661
- case r.Image: return /* @__PURE__ */ R(Oe, {
702
+ case i.Image: return /* @__PURE__ */ B(Me, {
662
703
  url: e.url,
663
- fileName: i,
704
+ fileName: r,
664
705
  loadErrorLabel: c
665
706
  });
666
- case r.Audio: return /* @__PURE__ */ R("audio", {
707
+ case i.Audio: return /* @__PURE__ */ B("audio", {
667
708
  controls: !0,
668
709
  src: e.url,
669
- "aria-label": i ?? "Audio attachment",
710
+ "aria-label": r ?? "Audio attachment",
670
711
  className: "w-full max-w-sm",
671
712
  preload: "metadata",
672
- children: e.mimeType && /* @__PURE__ */ R("source", {
713
+ children: e.mimeType && /* @__PURE__ */ B("source", {
673
714
  src: e.url,
674
715
  type: e.mimeType
675
716
  })
676
717
  });
677
- case r.Markdown: return /* @__PURE__ */ R(f, {
718
+ case i.Markdown: return /* @__PURE__ */ B(p, {
678
719
  content: e.text,
679
720
  isStreaming: !1,
680
- codeBlockTheme: L,
681
- classNames: l
721
+ codeBlockTheme: A,
722
+ classNames: u
682
723
  });
683
- case r.MarkdownTable: return /* @__PURE__ */ R(f, {
724
+ case i.MarkdownTable: return /* @__PURE__ */ B(p, {
684
725
  content: e.text,
685
726
  isStreaming: !1,
686
- codeBlockTheme: L,
727
+ codeBlockTheme: A,
687
728
  containerClassName: "flex h-full min-h-0 flex-col",
688
729
  classNames: {
689
- ...l,
730
+ ...u,
690
731
  tableWrapper: "my-0 max-h-full",
691
732
  tableScrollContainer: "max-h-full"
692
733
  },
693
734
  tableActionLabels: {
694
- copyCsvLabel: re,
695
- copyTxtLabel: ie,
696
- copyMarkdownLabel: ae,
697
- copiedLabel: k,
698
- downloadCsvLabel: A
735
+ copyLabel: te,
736
+ copiedLabel: ne,
737
+ downloadCsvLabel: re
699
738
  },
700
- tableDownloadFilename: B
739
+ tableDownloadFilename: j
701
740
  });
702
- case r.Json: return /* @__PURE__ */ R("div", {
741
+ case i.Json: return /* @__PURE__ */ B("div", {
703
742
  dir: "ltr",
704
743
  className: "h-full overflow-auto",
705
- children: /* @__PURE__ */ R("div", {
706
- className: h("m-3 overflow-auto rounded-md border", q.jsonWrapper),
707
- children: /* @__PURE__ */ R(oe, {
744
+ children: /* @__PURE__ */ B("div", {
745
+ className: g("m-3 overflow-auto rounded-md border", q.jsonWrapper),
746
+ children: /* @__PURE__ */ B(ce, {
708
747
  data: e.value,
709
748
  style: {
710
- container: h("whitespace-pre-wrap break-words p-2", U?.jsonClassName ?? "dial-code-text"),
711
- basicChildStyle: se.basicChildStyle,
749
+ container: g("whitespace-pre-wrap break-words p-2", U?.jsonClassName ?? "dial-code-text"),
750
+ basicChildStyle: R.basicChildStyle,
712
751
  childFieldsContainer: "m-0 ps-3",
713
- label: h("me-1 font-semibold", q.jsonLabel),
714
- clickableLabel: h("me-1 cursor-pointer font-semibold hover:underline", q.jsonClickableLabel),
715
- nullValue: h("italic", q.jsonNullValue),
716
- undefinedValue: h("italic", q.jsonNullValue),
752
+ label: g("me-1 font-semibold", q.jsonLabel),
753
+ clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", q.jsonClickableLabel),
754
+ nullValue: g("italic", q.jsonNullValue),
755
+ undefinedValue: g("italic", q.jsonNullValue),
717
756
  stringValue: q.jsonStringValue,
718
757
  booleanValue: q.jsonBooleanValue,
719
758
  numberValue: q.jsonNumberValue,
720
- otherValue: h("italic", q.jsonNullValue),
721
- punctuation: h("me-1", q.jsonPunctuation),
722
- collapseIcon: h("me-1 cursor-pointer select-none transition-colors", q.jsonCollapseIcon),
723
- expandIcon: h("me-1 cursor-pointer select-none transition-colors", q.jsonExpandIcon),
724
- collapsedContent: h("me-1 cursor-pointer rounded px-1", q.jsonCollapsedContent)
759
+ otherValue: g("italic", q.jsonNullValue),
760
+ punctuation: g("me-1", q.jsonPunctuation),
761
+ collapseIcon: g("me-1 cursor-pointer select-none transition-colors", q.jsonCollapseIcon),
762
+ expandIcon: g("me-1 cursor-pointer select-none transition-colors", q.jsonExpandIcon),
763
+ collapsedContent: g("me-1 cursor-pointer rounded px-1", q.jsonCollapsedContent)
725
764
  }
726
765
  })
727
766
  })
728
767
  });
729
- case r.Code: return /* @__PURE__ */ R(fe, {
768
+ case i.Code: return /* @__PURE__ */ B(he, {
730
769
  content: e,
731
- codeBlockTheme: L,
770
+ codeBlockTheme: A,
732
771
  labels: {
733
772
  loadingLabel: O,
734
- errorLabel: ee,
735
- retryLabel: te
773
+ errorLabel: k,
774
+ retryLabel: ee
736
775
  }
737
776
  });
738
- case r.Html: return /* @__PURE__ */ R(me, {
777
+ case i.Html: return /* @__PURE__ */ B(_e, {
739
778
  content: e,
740
779
  labels: {
741
- htmlFrameBlockedLabel: m,
742
- htmlOpenInNewTabLabel: g
780
+ htmlFrameBlockedLabel: f,
781
+ htmlOpenInNewTabLabel: h
743
782
  },
744
783
  isSourceView: a,
745
- title: i,
746
- codeBlockTheme: L
784
+ title: r,
785
+ codeBlockTheme: A
747
786
  });
748
- case r.Pdf: return /* @__PURE__ */ R(o, {
749
- retryKey: pe,
750
- onRetry: _e,
787
+ case i.Pdf: return /* @__PURE__ */ B(s, {
788
+ retryKey: de,
789
+ onRetry: me,
751
790
  labels: {
752
- loadingLabel: S,
791
+ loadingLabel: x,
753
792
  errorLabel: C,
754
- retryLabel: E
793
+ retryLabel: w
755
794
  },
756
- children: /* @__PURE__ */ R(ge, {
757
- fileName: i,
795
+ children: /* @__PURE__ */ B(pe, {
796
+ fileName: r,
758
797
  url: e.url,
759
798
  highlights: e.highlights ?? [],
760
799
  selectedHighlightId: e.selectedHighlightId,
761
800
  selectedPageNumber: e.page,
762
- loadPdf: V,
763
- hideHeader: ce,
764
- configurePdfWorker: le,
801
+ loadPdf: N,
802
+ hideHeader: P,
803
+ configurePdfWorker: I,
765
804
  labels: {
766
805
  thumbnailsLabel: _,
767
806
  showThumbnailsLabel: v,
768
807
  hideThumbnailsLabel: y,
769
808
  pageNumberLabel: b,
770
- loadingLabel: S,
809
+ loadingLabel: x,
771
810
  errorLabel: C,
772
- retryLabel: E
811
+ retryLabel: w
773
812
  }
774
813
  })
775
814
  }, e.url);
776
- case r.Ooxml: return /* @__PURE__ */ R(we, {
815
+ case i.Ooxml: return /* @__PURE__ */ B(Oe, {
777
816
  content: e,
778
- fileName: i,
817
+ fileName: r,
779
818
  loadErrorLabel: c,
780
- formulaLabel: D,
819
+ formulaLabel: T,
781
820
  formulaLabelClassName: U?.xlsxFormulaLabelClassName ?? "dial-italic-text",
782
- highlightsLabel: M,
783
- highlightNavigatedLabel: N
821
+ highlightsLabel: ae,
822
+ highlightNavigatedLabel: oe
784
823
  });
785
- case r.Visualizer: return /* @__PURE__ */ R(Ee, {
824
+ case i.Visualizer:
825
+ case i.GroupedVisualizer: return /* @__PURE__ */ B(Ae, {
786
826
  content: e,
787
827
  errorLabel: d
788
828
  });
789
- case r.McpApp: return /* @__PURE__ */ R(ye, { content: e });
790
- case r.Unsupported: return /* @__PURE__ */ R("p", {
791
- className: h("text-center", q.statusLabel),
792
- children: s
829
+ case i.McpApp: return /* @__PURE__ */ B(Ce, {
830
+ content: e,
831
+ onAppInfo: z
793
832
  });
794
- case r.Error: {
795
- let n = e.errorType === t.Forbidden;
796
- return /* @__PURE__ */ z("div", {
833
+ case i.Unsupported: return /* @__PURE__ */ B("p", {
834
+ className: g("text-center", q.statusLabel),
835
+ children: o
836
+ });
837
+ case i.Error: {
838
+ let t = e.errorType === n.Forbidden;
839
+ return /* @__PURE__ */ V("div", {
797
840
  className: "flex flex-col items-center gap-2",
798
- children: [R(n ? ne : T, {
841
+ children: [B(t ? ie : D, {
799
842
  size: 60,
800
- stroke: x,
843
+ stroke: S,
801
844
  className: q.errorIcon
802
- }), /* @__PURE__ */ R("p", {
803
- className: h("text-center", q.statusLabel),
804
- children: n ? u : c
845
+ }), /* @__PURE__ */ B("p", {
846
+ className: g("text-center", q.statusLabel),
847
+ children: t ? l : c
805
848
  })]
806
849
  });
807
850
  }
@@ -811,329 +854,241 @@ var U = {
811
854
  U?.fontClassName,
812
855
  U?.jsonClassName,
813
856
  U?.xlsxFormulaLabelClassName,
814
- i,
815
- L,
816
- s,
857
+ r,
858
+ A,
859
+ o,
817
860
  c,
818
- u,
861
+ l,
819
862
  d,
820
- m,
821
- g,
863
+ f,
864
+ h,
822
865
  a,
823
- B,
824
- V,
825
- ce,
826
- le,
866
+ j,
867
+ N,
868
+ P,
869
+ I,
870
+ z,
827
871
  _,
828
872
  v,
829
873
  y,
830
874
  b,
831
- S,
875
+ x,
832
876
  C,
833
- E,
834
- D,
877
+ w,
878
+ T,
835
879
  O,
880
+ k,
836
881
  ee,
837
- te,
838
- ge,
839
882
  pe,
840
- _e,
883
+ de,
884
+ me,
885
+ te,
886
+ ne,
841
887
  re,
842
- ie,
843
888
  ae,
844
- k,
845
- A,
846
- M,
847
- N
889
+ oe
848
890
  ]);
849
- return /* @__PURE__ */ R("div", {
850
- style: !n && ke.has(e.type) ? ve : void 0,
851
- className: h(n ? "flex h-full items-center justify-center" : G, ue),
852
- children: n ? /* @__PURE__ */ R(w, {}) : K
891
+ return /* @__PURE__ */ B("div", {
892
+ style: !t && Ne.has(e.type) ? ge : void 0,
893
+ className: g(t ? "flex h-full items-center justify-center" : ve, le),
894
+ children: t ? /* @__PURE__ */ B(E, {}) : ye
853
895
  });
854
- }), je = 2e3, Me = A(({ 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: k = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: M = "View rendered", mcpAppReloadLabel: P = "Reload", pdfThumbnailsLabel: oe, pdfShowThumbnailsLabel: se, pdfHideThumbnailsLabel: B, pdfPageNumberLabel: V, pdfContentLoadingLabel: ce, pdfContentErrorLabel: le, pdfContentRetryLabel: H, xlsxFormulaLabel: U, codeContentLoadingLabel: ue, codeContentErrorLabel: de, codeContentRetryLabel: fe, tableCopyCsvLabel: pe, tableCopyTxtLabel: me, tableCopyMarkdownLabel: he, tableCopiedLabel: ge, tableDownloadCsvLabel: _e, ooxmlHighlightsLabel: W, ooxmlHighlightNavigatedLabel: ve }, onDownload: G, onCopyText: ye, onCopyMarkdown: K, onCopyJson: be, tableDownloadFilename: xe, isMobile: Se = !1, defaultWidth: Ce, minWidth: we = 600, maxWidth: Te = 1500, onResizeStop: Ee, styles: q, codeBlockTheme: De, loadPdf: Oe, configurePdfWorker: ke }) => {
855
- let [Me, Ne] = I(!1), [Pe, Fe] = I(!1), [Ie, Le] = I(!1), [J, Re] = I(!1), Y = F(null), X = F(null), Z = F(null), ze = j(() => {
856
- ye?.(), Y.current != null && clearTimeout(Y.current), Ne(!0), Y.current = setTimeout(() => Ne(!1), je);
857
- }, [ye]), Be = j(() => {
858
- K?.(), X.current != null && clearTimeout(X.current), Fe(!0), X.current = setTimeout(() => Fe(!1), je);
859
- }, [K]), Q = j(() => {
860
- be?.(), Z.current != null && clearTimeout(Z.current), Le(!0), Z.current = setTimeout(() => Le(!1), je);
861
- }, [be]);
862
- N(() => () => {
863
- Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
896
+ }), Fe = {
897
+ mcpAppDivider: "_mcpAppDivider_1jh5p_1",
898
+ mcpAppVersion: "_mcpAppVersion_1jh5p_5"
899
+ }, Ie = 2e3, Le = j(({ isOpen: e, isLoading: t = !1, onClose: n, content: r, fileName: a, leftActions: s, labels: { ariaLabel: c, closeLabel: l = "Close", resizeLabel: u = "Resize panel", downloadLabel: d = "Download", copyTextLabel: f = "Copy text", copiedTextLabel: p = "Copied!", copyMarkdownLabel: h = "Copy as Markdown", copiedMarkdownLabel: _ = "Copied!", copyJsonLabel: v = "Copy as JSON", copiedJsonLabel: C = "Copied!", visualizerErrorLabel: T, unsupportedLabel: E = "Preview is not supported for this file", loadErrorLabel: D = "Failed to load file", forbiddenErrorLabel: O = "You don't have permission to access this file", htmlFrameBlockedLabel: ie = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: se = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: N = "Reload", pdfThumbnailsLabel: ce, pdfShowThumbnailsLabel: R, pdfHideThumbnailsLabel: H, pdfPageNumberLabel: U, pdfContentLoadingLabel: le, pdfContentErrorLabel: ue, pdfContentRetryLabel: de, xlsxFormulaLabel: pe, codeContentLoadingLabel: me, codeContentErrorLabel: W, codeContentRetryLabel: he, tableCopyLabel: ge, tableCopiedLabel: _e, tableDownloadCsvLabel: ve, ooxmlHighlightsLabel: ye, ooxmlHighlightNavigatedLabel: be }, onDownload: xe, onCopyText: Se, onCopyMarkdown: G, onCopyJson: Ce, tableDownloadFilename: K, isMobile: we = !1, defaultWidth: Te, minWidth: Ee = 600, maxWidth: De = 1500, onResizeStop: Oe, styles: ke, codeBlockTheme: Ae, loadPdf: q, configurePdfWorker: je }) => {
900
+ let [Me, Ne] = L(!1), [Le, Re] = L(!1), [J, ze] = L(!1), [Y, Be] = L(!1), [Ve, X] = L(void 0), Z = I(null), He = I(null), Q = I(null), Ue = M(() => {
901
+ Se?.(), Z.current != null && clearTimeout(Z.current), Ne(!0), Z.current = setTimeout(() => Ne(!1), Ie);
902
+ }, [Se]), We = M(() => {
903
+ G?.(), He.current != null && clearTimeout(He.current), Re(!0), He.current = setTimeout(() => Re(!1), Ie);
904
+ }, [G]), Ge = M(() => {
905
+ Ce?.(), Q.current != null && clearTimeout(Q.current), ze(!0), Q.current = setTimeout(() => ze(!1), Ie);
906
+ }, [Ce]);
907
+ P(() => () => {
908
+ Z.current != null && clearTimeout(Z.current), He.current != null && clearTimeout(He.current), Q.current != null && clearTimeout(Q.current);
864
909
  }, []);
865
- let Ve = j(() => {
866
- Re((e) => !e);
910
+ let $ = M(() => {
911
+ Be((e) => !e);
867
912
  }, []);
868
- N(() => {
869
- Re(!1);
870
- }, [i]);
871
- let { className: He, panelStyles: Ue, ...We } = q ?? {}, Ge = !t && i.type === r.Html && i.srcdoc != null, Ke = !t && ye != null && (i.type === r.PlainText || i.type === r.Code), $ = !t && K != null && i.type === r.Markdown, qe = !t && be != null && i.type === r.Json, Je = !t && G != null && a(i), Ye = !t && i.type === r.McpApp && i.onReload != null;
872
- return /* @__PURE__ */ R(y, {
913
+ P(() => {
914
+ Be(!1), X(void 0);
915
+ }, [r]);
916
+ let { className: Ke, panelStyles: qe, ...Je } = ke ?? {}, { colors: Ye, typography: Xe } = Je, Ze = F(() => m({
917
+ "--ac-mcp-app-divider": Ye?.mcpAppDividerColor,
918
+ "--ac-mcp-app-version": Ye?.mcpAppVersionColor
919
+ }), [Ye?.mcpAppDividerColor, Ye?.mcpAppVersionColor]), Qe = r.type === i.McpApp && Ve != null ? /* @__PURE__ */ V("span", {
920
+ style: Ze,
921
+ children: [
922
+ /* @__PURE__ */ B("span", { children: a }),
923
+ /* @__PURE__ */ B("span", {
924
+ "aria-hidden": !0,
925
+ className: g("mx-1.5 inline-block h-3 w-0 border-s align-middle", Fe.mcpAppDivider)
926
+ }),
927
+ /* @__PURE__ */ B("span", { children: Ve.name }),
928
+ Ve.version && /* @__PURE__ */ B("span", {
929
+ className: g("ms-2", Xe?.mcpAppVersionClassName ?? "dial-caption-text", Fe.mcpAppVersion),
930
+ children: Ve.version
931
+ })
932
+ ]
933
+ }) : a, $e = !t && r.type === i.Html && r.srcdoc != null, et = !t && Se != null && (r.type === i.PlainText || r.type === i.Code), tt = !t && G != null && r.type === i.Markdown, nt = !t && Ce != null && r.type === i.Json, rt = !t && xe != null && o(r), it = !t && r.type === i.McpApp && r.onReload != null;
934
+ return /* @__PURE__ */ B(b, {
873
935
  isOpen: e,
874
- orientation: v.Right,
875
- title: o,
936
+ orientation: y.Right,
937
+ title: Qe,
876
938
  labels: {
877
- ariaLabel: s,
878
- closeLabel: c,
879
- resizeLabel: l
939
+ ariaLabel: c,
940
+ closeLabel: l,
941
+ resizeLabel: u
880
942
  },
881
943
  onClose: n,
882
- resizable: !Se,
883
- defaultWidth: Ce,
884
- minWidth: we,
885
- maxWidth: Te,
886
- onResizeStop: Ee,
944
+ resizable: !we,
945
+ defaultWidth: Te,
946
+ minWidth: Ee,
947
+ maxWidth: De,
948
+ onResizeStop: Oe,
887
949
  styles: {
888
- ...Ue,
889
- titleClassName: Ue?.titleClassName ?? "dial-h3-text",
890
- headerClassName: h("border-b border-tertiary", Ue?.headerClassName),
891
- className: h(e ? "mobile:w-full mobile:max-w-full" : "w-0", He, Ue?.className)
950
+ ...qe,
951
+ titleClassName: qe?.titleClassName ?? "dial-h3-text",
952
+ headerClassName: g("border-b border-tertiary", qe?.headerClassName),
953
+ className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", Ke, qe?.className, fe.panel)
892
954
  },
893
- rightActions: Ge || Ke || $ || qe || Je || Ye ? /* @__PURE__ */ z(L, { children: [
894
- Ye && /* @__PURE__ */ R(S, {
895
- icon: /* @__PURE__ */ R(ie, {
896
- size: b.LG,
897
- stroke: x,
955
+ leftActions: s,
956
+ rightActions: $e || et || tt || nt || rt || it ? /* @__PURE__ */ V(z, { children: [
957
+ it && /* @__PURE__ */ B(w, {
958
+ icon: /* @__PURE__ */ B(oe, {
959
+ size: x.LG,
960
+ stroke: S,
898
961
  "aria-hidden": !0
899
962
  }),
900
- "aria-label": P,
901
- tooltipProps: { tooltip: P },
902
- onClick: i.type === r.McpApp ? i.onReload : void 0
963
+ "aria-label": N,
964
+ tooltipProps: { tooltip: N },
965
+ onClick: r.type === i.McpApp ? r.onReload : void 0
903
966
  }),
904
- Ge && /* @__PURE__ */ R(S, {
905
- icon: R(J ? te : D, {
906
- size: b.LG,
907
- stroke: x,
967
+ $e && /* @__PURE__ */ B(w, {
968
+ icon: B(Y ? re : ee, {
969
+ size: x.LG,
970
+ stroke: S,
908
971
  "aria-hidden": !0
909
972
  }),
910
- "aria-label": J ? M : A,
911
- "aria-pressed": J,
912
- tooltipProps: { tooltip: J ? M : A },
913
- onClick: Ve
973
+ "aria-label": Y ? j : A,
974
+ "aria-pressed": Y,
975
+ tooltipProps: { tooltip: Y ? j : A },
976
+ onClick: $
914
977
  }),
915
- Ke && /* @__PURE__ */ R(S, {
916
- icon: R(Me ? E : O, {
917
- size: b.LG,
918
- stroke: x,
978
+ et && /* @__PURE__ */ B(w, {
979
+ icon: B(Me ? k : te, {
980
+ size: x.LG,
981
+ stroke: S,
919
982
  "aria-hidden": !0
920
983
  }),
921
- "aria-label": Me ? f : d,
922
- tooltipProps: { tooltip: Me ? f : d },
923
- onClick: ze
984
+ "aria-label": Me ? p : f,
985
+ tooltipProps: { tooltip: Me ? p : f },
986
+ onClick: Ue
924
987
  }),
925
- $ && /* @__PURE__ */ R(S, {
926
- icon: R(Pe ? E : re, {
927
- size: b.LG,
928
- stroke: x,
988
+ tt && /* @__PURE__ */ B(w, {
989
+ icon: B(Le ? k : ae, {
990
+ size: x.LG,
991
+ stroke: S,
929
992
  "aria-hidden": !0
930
993
  }),
931
- "aria-label": Pe ? m : p,
932
- tooltipProps: { tooltip: Pe ? m : p },
933
- onClick: Be
994
+ "aria-label": Le ? _ : h,
995
+ tooltipProps: { tooltip: Le ? _ : h },
996
+ onClick: We
934
997
  }),
935
- qe && /* @__PURE__ */ R(S, {
936
- icon: R(Ie ? E : O, {
937
- size: b.LG,
938
- stroke: x,
998
+ nt && /* @__PURE__ */ B(w, {
999
+ icon: B(J ? k : te, {
1000
+ size: x.LG,
1001
+ stroke: S,
939
1002
  "aria-hidden": !0
940
1003
  }),
941
- "aria-label": Ie ? _ : g,
942
- tooltipProps: { tooltip: Ie ? _ : g },
943
- onClick: Q
1004
+ "aria-label": J ? C : v,
1005
+ tooltipProps: { tooltip: J ? C : v },
1006
+ onClick: Ge
944
1007
  }),
945
- Je && /* @__PURE__ */ R(S, {
946
- icon: /* @__PURE__ */ R(ee, {
947
- size: b.LG,
948
- stroke: x
1008
+ rt && /* @__PURE__ */ B(w, {
1009
+ icon: /* @__PURE__ */ B(ne, {
1010
+ size: x.LG,
1011
+ stroke: S
949
1012
  }),
950
- "aria-label": u,
951
- tooltipProps: { tooltip: u },
952
- onClick: G
1013
+ "aria-label": d,
1014
+ tooltipProps: { tooltip: d },
1015
+ onClick: xe
953
1016
  })
954
1017
  ] }) : null,
955
- children: /* @__PURE__ */ R(Ae, {
956
- content: i,
1018
+ children: /* @__PURE__ */ B(Pe, {
1019
+ content: r,
957
1020
  isLoading: t,
958
- fileName: o,
959
- isHtmlSourceView: J,
1021
+ fileName: a,
1022
+ isHtmlSourceView: Y,
1023
+ onAppInfo: r.type === i.McpApp ? X : void 0,
960
1024
  labels: {
961
- unsupportedLabel: w,
962
- loadErrorLabel: T,
963
- forbiddenErrorLabel: ne,
964
- visualizerErrorLabel: C,
965
- htmlFrameBlockedLabel: ae,
966
- htmlOpenInNewTabLabel: k,
967
- pdfThumbnailsLabel: oe,
968
- pdfShowThumbnailsLabel: se,
969
- pdfHideThumbnailsLabel: B,
970
- pdfPageNumberLabel: V,
971
- pdfContentLoadingLabel: ce,
972
- pdfContentErrorLabel: le,
973
- pdfContentRetryLabel: H,
974
- xlsxFormulaLabel: U,
975
- codeContentLoadingLabel: ue,
976
- codeContentErrorLabel: de,
977
- codeContentRetryLabel: fe,
978
- tableCopyCsvLabel: pe,
979
- tableCopyTxtLabel: me,
980
- tableCopyMarkdownLabel: he,
981
- tableCopiedLabel: ge,
982
- tableDownloadCsvLabel: _e,
983
- ooxmlHighlightsLabel: W,
984
- ooxmlHighlightNavigatedLabel: ve
1025
+ unsupportedLabel: E,
1026
+ loadErrorLabel: D,
1027
+ forbiddenErrorLabel: O,
1028
+ visualizerErrorLabel: T,
1029
+ htmlFrameBlockedLabel: ie,
1030
+ htmlOpenInNewTabLabel: se,
1031
+ pdfThumbnailsLabel: ce,
1032
+ pdfShowThumbnailsLabel: R,
1033
+ pdfHideThumbnailsLabel: H,
1034
+ pdfPageNumberLabel: U,
1035
+ pdfContentLoadingLabel: le,
1036
+ pdfContentErrorLabel: ue,
1037
+ pdfContentRetryLabel: de,
1038
+ xlsxFormulaLabel: pe,
1039
+ codeContentLoadingLabel: me,
1040
+ codeContentErrorLabel: W,
1041
+ codeContentRetryLabel: he,
1042
+ tableCopyLabel: ge,
1043
+ tableCopiedLabel: _e,
1044
+ tableDownloadCsvLabel: ve,
1045
+ ooxmlHighlightsLabel: ye,
1046
+ ooxmlHighlightNavigatedLabel: be
985
1047
  },
986
- styles: We,
987
- codeBlockTheme: De,
988
- tableDownloadFilename: xe,
989
- loadPdf: Oe,
990
- configurePdfWorker: ke
1048
+ styles: Je,
1049
+ codeBlockTheme: Ae,
1050
+ tableDownloadFilename: K,
1051
+ loadPdf: q,
1052
+ configurePdfWorker: je
991
1053
  })
992
1054
  });
993
- }), Ne = {
994
- type: r.PlainText,
995
- text: ""
996
- }, Pe = (e) => {
997
- 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;
998
- }, Fe = ae(void 0);
999
- Fe.displayName = "AttachmentCanvasContext";
1000
- var Ie = ({ children: e }) => {
1001
- let [t, n] = I(!1), [r, i] = I(!1), [a, o] = I(Ne), [s, c] = I(void 0), [l, u] = I(void 0), d = j((e, t) => {
1002
- c(e), u(t), i(!0), n(!0);
1003
- }, []), f = j((e, t, r) => {
1004
- o(e), c(t), u(r), i(!1), n(!0);
1005
- }, []), p = j(() => {
1006
- o(Ne), n(!1), i(!1), u(void 0);
1007
- }, []);
1008
- return N(() => () => {
1009
- let e = Pe(a);
1010
- e != null && URL.revokeObjectURL(e);
1011
- }, [a]), /* @__PURE__ */ R(Fe.Provider, {
1012
- value: P(() => ({
1013
- isOpen: t,
1014
- isLoading: r,
1015
- content: a,
1016
- fileName: s,
1017
- attachmentId: l,
1018
- openCanvasLoading: d,
1019
- openCanvas: f,
1020
- closeCanvas: p
1021
- }), [
1022
- t,
1023
- r,
1024
- a,
1025
- s,
1026
- l,
1027
- d,
1028
- f,
1029
- p
1030
- ]),
1031
- children: e
1032
- });
1033
- }, Le = () => {
1034
- let e = M(Fe);
1035
- if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
1036
- return e;
1037
- }, J = A(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: a, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
1038
- 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: k, codeContentRetryLabel: A, tableCopyCsvLabel: M, tableCopyTxtLabel: N, tableCopyMarkdownLabel: P, tableCopiedLabel: F, tableDownloadCsvLabel: I, ooxmlHighlightsLabel: oe, ooxmlHighlightNavigatedLabel: se } = e ?? {}, { isOpen: L, isLoading: z, content: B, fileName: V, closeCanvas: ce } = Le(), le = j(() => {
1039
- i(B, V);
1040
- }, [B, V]), H = j(() => {
1041
- (B.type === r.PlainText || B.type === r.Code) && m(B.text);
1042
- }, [B]), U = j(() => {
1043
- B.type === r.Markdown && m(B.text);
1044
- }, [B]), ue = j(() => {
1045
- B.type === r.Json && m(JSON.stringify(B.value, null, 2));
1046
- }, [B]);
1047
- return /* @__PURE__ */ R(Me, {
1048
- isOpen: L,
1049
- isLoading: z,
1050
- onClose: ce,
1051
- content: B,
1052
- fileName: V,
1053
- labels: {
1054
- ariaLabel: l,
1055
- closeLabel: u,
1056
- downloadLabel: d,
1057
- copyTextLabel: g,
1058
- copiedTextLabel: _,
1059
- copyMarkdownLabel: v,
1060
- copiedMarkdownLabel: y,
1061
- copyJsonLabel: b,
1062
- copiedJsonLabel: x,
1063
- unsupportedLabel: f,
1064
- loadErrorLabel: p,
1065
- forbiddenErrorLabel: h,
1066
- htmlFrameBlockedLabel: S,
1067
- htmlOpenInNewTabLabel: C,
1068
- htmlViewSourceLabel: w,
1069
- htmlViewRenderedLabel: T,
1070
- pdfThumbnailsLabel: E,
1071
- pdfShowThumbnailsLabel: D,
1072
- pdfHideThumbnailsLabel: O,
1073
- pdfPageNumberLabel: ee,
1074
- pdfContentLoadingLabel: te,
1075
- pdfContentErrorLabel: ne,
1076
- pdfContentRetryLabel: re,
1077
- xlsxFormulaLabel: ie,
1078
- codeContentLoadingLabel: ae,
1079
- codeContentErrorLabel: k,
1080
- codeContentRetryLabel: A,
1081
- tableCopyCsvLabel: M,
1082
- tableCopyTxtLabel: N,
1083
- tableCopyMarkdownLabel: P,
1084
- tableCopiedLabel: F,
1085
- tableDownloadCsvLabel: I,
1086
- ooxmlHighlightsLabel: oe,
1087
- ooxmlHighlightNavigatedLabel: se
1088
- },
1089
- onDownload: le,
1090
- onCopyText: B.type === r.PlainText || B.type === r.Code ? H : void 0,
1091
- onCopyMarkdown: B.type === r.Markdown ? U : void 0,
1092
- onCopyJson: B.type === r.Json ? ue : void 0,
1093
- tableDownloadFilename: s,
1094
- isMobile: t,
1095
- defaultWidth: n,
1096
- maxWidth: a,
1097
- codeBlockTheme: o,
1098
- configurePdfWorker: c
1099
- });
1100
- }), Re = new Set(["html", "htm"]), Y = {
1055
+ }), Re = new Set(["html", "htm"]), J = {
1101
1056
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1102
1057
  xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1103
1058
  pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
1104
- }, X = 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(".")), Z = {
1105
- docx: n.Docx,
1106
- xlsx: n.Xlsx,
1107
- pptx: n.Pptx,
1108
- csv: n.Csv
1109
- }, ze = {
1110
- [Y.docx]: n.Docx,
1111
- [Y.xlsx]: n.Xlsx,
1112
- [Y.pptx]: n.Pptx,
1113
- [d.CSV]: n.Csv
1059
+ }, ze = 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 = {
1060
+ docx: r.Docx,
1061
+ xlsx: r.Xlsx,
1062
+ pptx: r.Pptx,
1063
+ csv: r.Csv
1114
1064
  }, Be = {
1115
- [n.Docx]: Y.docx,
1116
- [n.Xlsx]: Y.xlsx,
1117
- [n.Pptx]: Y.pptx,
1118
- [n.Csv]: d.CSV
1119
- }, Q = (e, t) => {
1065
+ [J.docx]: r.Docx,
1066
+ [J.xlsx]: r.Xlsx,
1067
+ [J.pptx]: r.Pptx,
1068
+ [f.CSV]: r.Csv
1069
+ }, Ve = {
1070
+ [r.Docx]: J.docx,
1071
+ [r.Xlsx]: J.xlsx,
1072
+ [r.Pptx]: J.pptx,
1073
+ [r.Csv]: f.CSV
1074
+ }, X = (e, t) => {
1120
1075
  let n = t?.split(";", 1)[0].trim().toLowerCase();
1121
1076
  if (n != null) {
1122
- let e = ze[n];
1077
+ let e = Be[n];
1123
1078
  if (e != null) return e;
1124
1079
  }
1125
1080
  let r = e.lastIndexOf(".");
1126
- if (r !== -1) return Z[e.slice(r + 1).toLowerCase()];
1127
- }, Ve = (e, t) => Q(e, t) != null, He = (e, t) => {
1128
- let n = Q(e, t);
1129
- return n == null ? void 0 : Be[n];
1130
- }, Ue = (e) => {
1081
+ if (r !== -1) return Y[e.slice(r + 1).toLowerCase()];
1082
+ }, Z = (e, t) => X(e, t) != null, He = (e, t) => {
1083
+ let n = X(e, t);
1084
+ return n == null ? void 0 : Ve[n];
1085
+ }, Q = (e) => {
1131
1086
  let t = e.lastIndexOf(".");
1132
- return t === -1 ? !1 : X.has(e.slice(t + 1).toLowerCase());
1133
- }, We = (e) => {
1087
+ return t === -1 ? !1 : ze.has(e.slice(t + 1).toLowerCase());
1088
+ }, Ue = (e) => {
1134
1089
  let t = e.lastIndexOf(".");
1135
1090
  return t === -1 ? !1 : Re.has(e.slice(t + 1).toLowerCase());
1136
- }, Ge = {
1091
+ }, We = {
1137
1092
  xml: "xml",
1138
1093
  csv: "plaintext",
1139
1094
  tsv: "plaintext",
@@ -1181,26 +1136,194 @@ var Ie = ({ children: e }) => {
1181
1136
  gitignore: "plaintext",
1182
1137
  dockerfile: "plaintext",
1183
1138
  makefile: "plaintext"
1184
- }, Ke = (e) => Ge[e], $ = (e) => ({
1185
- type: r.Unsupported,
1139
+ }, Ge = (e) => We[e], $ = (e) => ({
1140
+ type: i.Unsupported,
1186
1141
  ...e != null && { url: e }
1187
- }), qe = (e) => ({
1188
- type: r.Error,
1189
- errorType: t.LoadFailed,
1142
+ }), Ke = (e) => ({
1143
+ type: i.Error,
1144
+ errorType: n.LoadFailed,
1190
1145
  ...e != null && { url: e }
1191
- }), Je = (e) => ({
1192
- type: r.Error,
1193
- errorType: t.Forbidden,
1146
+ }), qe = (e) => ({
1147
+ type: i.Error,
1148
+ errorType: n.Forbidden,
1194
1149
  ...e != null && { url: e }
1195
- }), Ye = (e, t) => {
1150
+ }), Je = (e) => {
1151
+ 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;
1152
+ }, Ye = (e) => {
1153
+ let t = Je(e);
1154
+ t != null && URL.revokeObjectURL(t);
1155
+ }, Xe = {
1156
+ type: i.PlainText,
1157
+ text: ""
1158
+ }, Ze = se(void 0);
1159
+ Ze.displayName = "AttachmentCanvasContext";
1160
+ var Qe = ({ children: e }) => {
1161
+ let [t, n] = L(!1), [r, i] = L(!1), [a, o] = L(Xe), [s, c] = L(void 0), [l, u] = L(void 0), d = M((e, t) => {
1162
+ c(e), u(t), i(!0), n(!0);
1163
+ }, []), f = M((e, t, r) => {
1164
+ o(e), c(t), u(r), i(!1), n(!0);
1165
+ }, []), p = M(() => {
1166
+ o(Xe), n(!1), i(!1), u(void 0);
1167
+ }, []);
1168
+ return P(() => () => {
1169
+ let e = Je(a);
1170
+ e != null && URL.revokeObjectURL(e);
1171
+ }, [a]), /* @__PURE__ */ B(Ze.Provider, {
1172
+ value: F(() => ({
1173
+ isOpen: t,
1174
+ isLoading: r,
1175
+ content: a,
1176
+ fileName: s,
1177
+ attachmentId: l,
1178
+ openCanvasLoading: d,
1179
+ openCanvas: f,
1180
+ closeCanvas: p
1181
+ }), [
1182
+ t,
1183
+ r,
1184
+ a,
1185
+ s,
1186
+ l,
1187
+ d,
1188
+ f,
1189
+ p
1190
+ ]),
1191
+ children: e
1192
+ });
1193
+ }, $e = () => {
1194
+ let e = N(Ze);
1195
+ if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
1196
+ return e;
1197
+ }, et = j(({ labels: e, leftActions: t, isMobile: n = !1, defaultWidth: r, maxWidth: o, codeBlockTheme: s, tableDownloadFilename: c, loadPdf: l, configurePdfWorker: u }) => {
1198
+ let { ariaLabel: d = "Attachment preview", closeLabel: f = "Close", downloadLabel: p = "Download", unsupportedLabel: m = "Preview is not supported for this file", loadErrorLabel: g = "Failed to load file", forbiddenErrorLabel: _ = "You don't have permission to access this file", copyTextLabel: v, copiedTextLabel: y, copyMarkdownLabel: b, copiedMarkdownLabel: x, copyJsonLabel: S, copiedJsonLabel: C, htmlFrameBlockedLabel: w, htmlOpenInNewTabLabel: T, htmlViewSourceLabel: E, htmlViewRenderedLabel: D, pdfThumbnailsLabel: O, pdfShowThumbnailsLabel: k, pdfHideThumbnailsLabel: ee, pdfPageNumberLabel: te, pdfContentLoadingLabel: ne, pdfContentErrorLabel: re, pdfContentRetryLabel: ie, xlsxFormulaLabel: ae, codeContentLoadingLabel: oe, codeContentErrorLabel: se, codeContentRetryLabel: A, tableCopyLabel: j, tableCopiedLabel: N, tableDownloadCsvLabel: P, ooxmlHighlightsLabel: F, ooxmlHighlightNavigatedLabel: I } = e ?? {}, { isOpen: L, isLoading: ce, content: R, fileName: z, closeCanvas: V } = $e(), H = M(() => {
1199
+ a(R, z);
1200
+ }, [R, z]), U = M(() => {
1201
+ (R.type === i.PlainText || R.type === i.Code) && h(R.text);
1202
+ }, [R]), le = M(() => {
1203
+ R.type === i.Markdown && h(R.text);
1204
+ }, [R]), ue = M(() => {
1205
+ R.type === i.Json && h(JSON.stringify(R.value, null, 2));
1206
+ }, [R]);
1207
+ return /* @__PURE__ */ B(Le, {
1208
+ isOpen: L,
1209
+ isLoading: ce,
1210
+ onClose: V,
1211
+ content: R,
1212
+ fileName: z,
1213
+ leftActions: t,
1214
+ labels: {
1215
+ ariaLabel: d,
1216
+ closeLabel: f,
1217
+ downloadLabel: p,
1218
+ copyTextLabel: v,
1219
+ copiedTextLabel: y,
1220
+ copyMarkdownLabel: b,
1221
+ copiedMarkdownLabel: x,
1222
+ copyJsonLabel: S,
1223
+ copiedJsonLabel: C,
1224
+ unsupportedLabel: m,
1225
+ loadErrorLabel: g,
1226
+ forbiddenErrorLabel: _,
1227
+ htmlFrameBlockedLabel: w,
1228
+ htmlOpenInNewTabLabel: T,
1229
+ htmlViewSourceLabel: E,
1230
+ htmlViewRenderedLabel: D,
1231
+ pdfThumbnailsLabel: O,
1232
+ pdfShowThumbnailsLabel: k,
1233
+ pdfHideThumbnailsLabel: ee,
1234
+ pdfPageNumberLabel: te,
1235
+ pdfContentLoadingLabel: ne,
1236
+ pdfContentErrorLabel: re,
1237
+ pdfContentRetryLabel: ie,
1238
+ xlsxFormulaLabel: ae,
1239
+ codeContentLoadingLabel: oe,
1240
+ codeContentErrorLabel: se,
1241
+ codeContentRetryLabel: A,
1242
+ tableCopyLabel: j,
1243
+ tableCopiedLabel: N,
1244
+ tableDownloadCsvLabel: P,
1245
+ ooxmlHighlightsLabel: F,
1246
+ ooxmlHighlightNavigatedLabel: I
1247
+ },
1248
+ onDownload: H,
1249
+ onCopyText: R.type === i.PlainText || R.type === i.Code ? U : void 0,
1250
+ onCopyMarkdown: R.type === i.Markdown ? le : void 0,
1251
+ onCopyJson: R.type === i.Json ? ue : void 0,
1252
+ tableDownloadFilename: c,
1253
+ isMobile: n,
1254
+ defaultWidth: r,
1255
+ maxWidth: o,
1256
+ codeBlockTheme: s,
1257
+ configurePdfWorker: u,
1258
+ loadPdf: l
1259
+ });
1260
+ }), tt = {
1261
+ frame: "_frame_g47g7_1",
1262
+ header: "_header_g47g7_6",
1263
+ title: "_title_g47g7_10"
1264
+ }, nt = j(({ content: e, height: t, onExpand: n, expandAriaLabel: r, actionsGroupAriaLabel: i = "Visualizer actions", frameTitle: a, loadingLabel: o, errorLabel: s, titleClassName: c = "dial-small-semi-text", isBorderless: l = !1, isTitleHidden: u = !1, colors: d }) => {
1265
+ let f = e.visualizerName.trim(), p = !u && f !== "";
1266
+ return /* @__PURE__ */ V("div", {
1267
+ className: g("flex w-full min-w-0 flex-col overflow-hidden", !l && ["rounded-xl border", tt.frame]),
1268
+ style: m({
1269
+ "--igv-bg": d?.background,
1270
+ "--igv-border": d?.border,
1271
+ "--igv-title-text": d?.titleText
1272
+ }),
1273
+ children: [/* @__PURE__ */ V("div", {
1274
+ className: g("flex min-h-10 items-center gap-2 py-2", p ? "justify-between" : "justify-end", !l && ["border-b px-4", tt.header]),
1275
+ children: [p && /* @__PURE__ */ B("span", {
1276
+ className: g("min-w-0 truncate", c, tt.title),
1277
+ children: f
1278
+ }), /* @__PURE__ */ B("div", {
1279
+ role: "toolbar",
1280
+ "aria-label": i,
1281
+ className: "flex items-center gap-1",
1282
+ children: /* @__PURE__ */ B(w, {
1283
+ icon: /* @__PURE__ */ B(O, {
1284
+ size: x.SM,
1285
+ stroke: S,
1286
+ "aria-hidden": !0
1287
+ }),
1288
+ "aria-label": r,
1289
+ size: C.Small,
1290
+ onClick: n
1291
+ })
1292
+ })]
1293
+ }), /* @__PURE__ */ B("div", {
1294
+ className: "w-full",
1295
+ style: { height: `${t}px` },
1296
+ children: /* @__PURE__ */ B(Ae, {
1297
+ content: e,
1298
+ loadingLabel: o,
1299
+ errorLabel: s,
1300
+ frameTitle: a
1301
+ })
1302
+ })]
1303
+ });
1304
+ }), rt = (e, t) => {
1196
1305
  let n = e.toLowerCase();
1197
1306
  return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
1198
- }, Xe = (e) => {
1307
+ }, it = (e, t) => {
1308
+ if (!(e == null || e === "")) return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
1309
+ }, at = (e) => `${e}:grouped-visualizer`, ot = (e, t) => {
1310
+ let n = (t.contentType ?? "").split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""), r = [], i = [];
1311
+ return e.forEach((e) => {
1312
+ if (e.url != null && e.url !== "" && (n.length === 0 || n.includes(e.contentType.toLowerCase()))) {
1313
+ r.push(e);
1314
+ return;
1315
+ }
1316
+ i.push(e);
1317
+ }), {
1318
+ claimed: r,
1319
+ unclaimed: i
1320
+ };
1321
+ }, st = (e) => {
1199
1322
  let t;
1200
1323
  try {
1201
1324
  t = new URL(e).pathname;
1202
1325
  } catch {
1203
- t = _(e);
1326
+ t = v(e);
1204
1327
  }
1205
1328
  let n = t.split("/").filter(Boolean).pop() ?? "";
1206
1329
  try {
@@ -1208,97 +1331,97 @@ var Ie = ({ children: e }) => {
1208
1331
  } catch {
1209
1332
  return n;
1210
1333
  }
1211
- }, Ze = (e, t) => {
1212
- let { openCanvas: n, openCanvasLoading: i, closeCanvas: a } = Le(), { customVisualizers: o, themeId: c, onBeforeOpen: l } = t, f = j(async (t, i) => {
1334
+ }, ct = (e, t) => {
1335
+ let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = $e(), { customVisualizers: o, themeId: s, onBeforeOpen: l } = t, u = M(async (t, n, r) => {
1213
1336
  if (t.url == null && t.referenceUrl != null) {
1214
- let r = e.resolveReferencePdfContent(t);
1215
- if (r != null) return n(r, t.name, i), !0;
1337
+ let i = e.resolveReferencePdfContent(t);
1338
+ if (i != null) return r(i, t.name, n);
1216
1339
  }
1217
- let a = t.contentType.toLowerCase(), s = Ye(a, o);
1218
- if (s != null) {
1219
- let r = await e.resolveVisualizerContent(t, s, c);
1220
- if (r != null) return n(r, t.name, i), !0;
1340
+ let a = t.contentType.toLowerCase(), c = rt(a, o);
1341
+ if (c != null) {
1342
+ let i = await e.resolveVisualizerContent(t, c, s);
1343
+ if (i != null) return r(i, t.name, n);
1221
1344
  }
1222
1345
  if (!a && t.data != null) {
1223
- let r = await e.resolveTextContent(t);
1224
- if (r != null) return n(r, t.name, i), !0;
1346
+ let i = await e.resolveTextContent(t);
1347
+ if (i != null) return r(i, t.name, n);
1225
1348
  }
1226
- let l = Q("", a);
1227
- if (l != null) return n(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1349
+ let l = X("", a);
1350
+ if (l != null) return r(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, n);
1228
1351
  switch (a) {
1229
- case d.PDF: return n(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1230
- case d.Markdown: return n(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1231
- case d.JSON: return n(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1352
+ case f.PDF: return r(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
1353
+ case f.Markdown: return r(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
1354
+ case f.JSON: return r(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
1232
1355
  }
1233
- let f = t.name ?? "", p = f.lastIndexOf("."), m = p === -1 ? "" : f.slice(p + 1).toLowerCase(), h = Q(f);
1234
- if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
1356
+ let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h = X(u);
1357
+ if (h != null) return r(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, n);
1235
1358
  switch (m) {
1236
- case u.Markdown:
1237
- case u.MarkdownAlt: {
1238
- let r = await e.resolveMarkdownContent(t);
1239
- return r == null ? !1 : (n(r, t.name, i), !0);
1359
+ case d.Markdown:
1360
+ case d.MarkdownAlt: {
1361
+ let i = await e.resolveMarkdownContent(t);
1362
+ return i == null ? !1 : r(i, t.name, n);
1240
1363
  }
1241
- case u.JSON: {
1242
- let r = await e.resolveJsonContent(t);
1243
- return r == null ? !1 : (n(r, t.name, i), !0);
1364
+ case d.JSON: {
1365
+ let i = await e.resolveJsonContent(t);
1366
+ return i == null ? !1 : r(i, t.name, n);
1244
1367
  }
1245
- case u.PDF: {
1246
- let r = await e.resolvePdfContent(t);
1247
- return r == null ? !1 : (n(r, t.name, i), !0);
1368
+ case d.PDF: {
1369
+ let i = await e.resolvePdfContent(t);
1370
+ return i == null ? !1 : r(i, t.name, n);
1248
1371
  }
1249
1372
  }
1250
- let g = t.name != null && We(t.name) || t.url != null && We(Xe(t.url));
1251
- if (t.name != null && !Ue(t.name) && !g) return n($(e.resolveContentUrl(t)), t.name, i), !0;
1373
+ let g = t.name != null && Ue(t.name) || t.url != null && Ue(st(t.url));
1374
+ if (t.name != null && !Q(t.name) && !g) return r($(e.resolveContentUrl(t)), t.name, n);
1252
1375
  if (g) {
1253
1376
  let a = await e.resolveHtmlContent(t);
1254
- return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, i), !0) : t.url == null ? !1 : (n({
1255
- type: r.Html,
1377
+ return a == null ? e.hasTextSource(t) ? r($(e.resolveContentUrl(t)), t.name, n) : t.url == null ? !1 : r({
1378
+ type: i.Html,
1256
1379
  url: t.url
1257
- }, t.name, i), !0) : (n(a, t.name, i), !0);
1380
+ }, t.name, n) : r(a, t.name, n);
1258
1381
  }
1259
- let _ = await e.resolveCodeContent(t, Ke(m));
1260
- return _ == null ? !1 : (n(_, t.name, i), !0);
1382
+ let _ = await e.resolveCodeContent(t, Ge(m));
1383
+ return _ == null ? !1 : r(_, t.name, n);
1261
1384
  }, [
1262
- n,
1263
1385
  o,
1264
- c,
1386
+ s,
1265
1387
  e
1266
1388
  ]);
1267
- return { openAttachmentCanvas: j(async (t, o = t.id) => {
1389
+ return { openAttachmentCanvas: M(async (t, o = t.id, s) => {
1390
+ let d = () => s == null || s(), f = (e, t, r) => d() ? (n(e, t, r), !0) : (Ye(e), !1);
1268
1391
  switch (t.type) {
1269
- case s.Image: {
1392
+ case c.Image: {
1270
1393
  let r = e.resolveImageContent(t);
1271
1394
  return r == null ? !1 : (l?.(), n(r, t.name, o), !0);
1272
1395
  }
1273
- case s.Audio: {
1396
+ case c.Audio: {
1274
1397
  let e = t.playUrl ?? t.url;
1275
1398
  return e == null ? !1 : (n({
1276
- type: r.Audio,
1399
+ type: i.Audio,
1277
1400
  url: e,
1278
1401
  mimeType: t.contentType || void 0
1279
1402
  }, t.name, o), !0);
1280
1403
  }
1281
- case s.File: {
1282
- l?.(), i(t.name, o);
1283
- let e = await f(t, o);
1284
- return e || a(), e;
1404
+ case c.File: {
1405
+ l?.(), r(t.name, o);
1406
+ let e = await u(t, o, f);
1407
+ return !e && d() && a(), e;
1285
1408
  }
1286
- case s.Pasted:
1287
- case s.Prompt: {
1288
- l?.(), i(t.name, o);
1289
- let r = await e.resolveTextContent(t);
1290
- return r == null ? (a(), !1) : (n(r, t.name, o), !0);
1409
+ case c.Pasted:
1410
+ case c.Prompt: {
1411
+ l?.(), r(t.name, o);
1412
+ let n = await e.resolveTextContent(t);
1413
+ return n == null ? (d() && a(), !1) : f(n, t.name, o);
1291
1414
  }
1292
1415
  default: return !1;
1293
1416
  }
1294
1417
  }, [
1295
1418
  n,
1296
- i,
1419
+ r,
1297
1420
  a,
1298
1421
  l,
1299
- f,
1422
+ u,
1300
1423
  e
1301
1424
  ]) };
1302
1425
  };
1303
1426
  //#endregion
1304
- export { Me as AttachmentCanvas, Ae as AttachmentCanvasBody, J as AttachmentCanvasContainer, Ie as AttachmentCanvasProvider, r as AttachmentContentType, t as AttachmentErrorType, fe as CodeContent, ye as McpAppCanvasRenderer, n as OoxmlFileType, e as OoxmlHighlightKind, Je as createForbiddenCanvasContent, qe as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, i as downloadAttachmentContent, Ke as extensionToLanguage, Ye as findVisualizerForMime, Q as getOoxmlFileType, He as getOoxmlMimeType, a as isDownloadable, We as isHtmlPreviewable, Ve as isOoxmlPreviewable, Ue as isTextPreviewable, Le as useAttachmentCanvas, Ze as useOpenAttachmentCanvas };
1427
+ export { fe as ATTACHMENT_CANVAS_CLASS, Le as AttachmentCanvas, Pe as AttachmentCanvasBody, et as AttachmentCanvasContainer, Qe as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, he as CodeContent, nt as InlineGroupedVisualizer, Ce as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, qe as createForbiddenCanvasContent, Ke as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, a as downloadAttachmentContent, Ge as extensionToLanguage, it as findVisualizerForApplication, rt as findVisualizerForMime, X as getOoxmlFileType, He as getOoxmlMimeType, at as groupedVisualizerCanvasKey, o as isDownloadable, Ue as isHtmlPreviewable, Z as isOoxmlPreviewable, Q as isTextPreviewable, ot as partitionAttachmentsForApplicationVisualizer, $e as useAttachmentCanvas, ct as useOpenAttachmentCanvas };