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