@epam/ai-dial-attachment-canvas 1.1.0-dev.459 → 1.1.0-dev.467
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/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -1
- package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts.map +1 -1
- package/hooks/useMcpAppBridge/useMcpAppBridge.d.ts +23 -0
- package/hooks/useMcpAppBridge/useMcpAppBridge.d.ts.map +1 -0
- package/index.css +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +406 -356
- package/models/attachment-canvas.d.ts +6 -2
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +5 -4
- package/utils/vite-external-matcher.d.ts +1 -1
- package/utils/vite-external-matcher.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -4,38 +4,39 @@ import { AttachmentType as s, CodeBlockTheme as c, DEFAULT_MARKDOWN_CLASS_NAMES
|
|
|
4
4
|
import { SidebarOrientation as v, SidebarPanel as y } from "@epam/ai-dial-sidebar";
|
|
5
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
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
|
|
8
|
-
import { JsonView as
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
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 = {
|
|
14
15
|
container: "_container_1nhig_1",
|
|
15
16
|
containerLight: "_containerLight_1nhig_5"
|
|
16
|
-
},
|
|
17
|
+
}, ue = {
|
|
17
18
|
[c.Dark]: g,
|
|
18
19
|
[c.Light]: g
|
|
19
|
-
},
|
|
20
|
+
}, de = () => k(async () => {
|
|
20
21
|
let { Prism: e } = await import("react-syntax-highlighter");
|
|
21
22
|
return { default: e };
|
|
22
|
-
}),
|
|
23
|
-
let { text: r, language: i } = e, a = i == null || i === "plaintext", s =
|
|
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
25
|
d((e) => e + 1);
|
|
25
|
-
}, []), m = /* @__PURE__ */
|
|
26
|
+
}, []), m = /* @__PURE__ */ R("pre", {
|
|
26
27
|
className: "whitespace-pre-wrap break-words p-4",
|
|
27
28
|
children: r
|
|
28
29
|
});
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ R("div", {
|
|
30
31
|
dir: "ltr",
|
|
31
|
-
className: h("h-full overflow-auto",
|
|
32
|
-
children: a ? m : /* @__PURE__ */
|
|
32
|
+
className: h("h-full overflow-auto", U.container, l && U.containerLight),
|
|
33
|
+
children: a ? m : /* @__PURE__ */ R(o, {
|
|
33
34
|
retryKey: u,
|
|
34
35
|
onRetry: p,
|
|
35
36
|
pendingContent: m,
|
|
36
37
|
errorContent: m,
|
|
37
38
|
labels: n,
|
|
38
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ R(f, {
|
|
39
40
|
language: i,
|
|
40
41
|
style: s,
|
|
41
42
|
customStyle: {
|
|
@@ -52,21 +53,21 @@ var V = {
|
|
|
52
53
|
})
|
|
53
54
|
})
|
|
54
55
|
});
|
|
55
|
-
}),
|
|
56
|
-
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] =
|
|
57
|
-
|
|
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(() => {
|
|
58
59
|
u(!0), f(!1);
|
|
59
60
|
}, [e]);
|
|
60
|
-
let m =
|
|
61
|
+
let m = j((t) => {
|
|
61
62
|
if (u(!1), e.srcdoc == null) try {
|
|
62
63
|
p.current?.contentDocument ?? f(!0);
|
|
63
64
|
} catch {
|
|
64
65
|
f(!0);
|
|
65
66
|
}
|
|
66
|
-
}, [e.srcdoc]), g =
|
|
67
|
+
}, [e.srcdoc]), g = j(() => {
|
|
67
68
|
u(!1), f(!0);
|
|
68
69
|
}, []);
|
|
69
|
-
if (n && e.srcdoc != null) return /* @__PURE__ */
|
|
70
|
+
if (n && e.srcdoc != null) return /* @__PURE__ */ R(fe, {
|
|
70
71
|
content: {
|
|
71
72
|
type: r.Code,
|
|
72
73
|
text: e.srcdoc,
|
|
@@ -74,26 +75,26 @@ var V = {
|
|
|
74
75
|
},
|
|
75
76
|
codeBlockTheme: a
|
|
76
77
|
});
|
|
77
|
-
if (d) return /* @__PURE__ */
|
|
78
|
+
if (d) return /* @__PURE__ */ z("div", {
|
|
78
79
|
className: "flex h-full flex-col items-center justify-center gap-3 p-4",
|
|
79
|
-
children: [/* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ R("p", {
|
|
80
81
|
className: "text-center",
|
|
81
82
|
children: s
|
|
82
|
-
}), e.url != null && /* @__PURE__ */
|
|
83
|
+
}), e.url != null && /* @__PURE__ */ R(C, {
|
|
83
84
|
href: e.url,
|
|
84
85
|
target: "_blank",
|
|
85
86
|
label: c,
|
|
86
|
-
className:
|
|
87
|
+
className: pe.openInNewTabButton,
|
|
87
88
|
textClassName: o
|
|
88
89
|
})]
|
|
89
90
|
});
|
|
90
91
|
let _ = e.srcdoc != null, v = _ ? void 0 : e.url, y = _ ? e.srcdoc : void 0;
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
+
return /* @__PURE__ */ z("div", {
|
|
92
93
|
className: "relative h-full",
|
|
93
|
-
children: [l && /* @__PURE__ */
|
|
94
|
+
children: [l && /* @__PURE__ */ R("div", {
|
|
94
95
|
className: "absolute inset-0 flex items-center justify-center",
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
-
}), /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ R(w, {})
|
|
97
|
+
}), /* @__PURE__ */ R("iframe", {
|
|
97
98
|
ref: p,
|
|
98
99
|
title: i,
|
|
99
100
|
src: v,
|
|
@@ -104,65 +105,119 @@ var V = {
|
|
|
104
105
|
onError: g
|
|
105
106
|
})]
|
|
106
107
|
});
|
|
107
|
-
}),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
}), he = {
|
|
109
|
+
name: "MCP-UI Host",
|
|
110
|
+
version: "1.0.0"
|
|
111
|
+
}, ge = { openLinks: {} }, _e = (e) => {
|
|
112
|
+
let t;
|
|
113
|
+
try {
|
|
114
|
+
t = new URL(e);
|
|
115
|
+
} catch {
|
|
116
|
+
return !1;
|
|
117
|
+
}
|
|
118
|
+
if (t.protocol !== "http:" && t.protocol !== "https:") return !1;
|
|
119
|
+
try {
|
|
120
|
+
window.open(e, "_blank", "noopener,noreferrer");
|
|
121
|
+
} catch {
|
|
122
|
+
return !1;
|
|
123
|
+
}
|
|
124
|
+
return !0;
|
|
125
|
+
}, W = (e, t, n) => {
|
|
126
|
+
if (n) {
|
|
127
|
+
e.style.maxWidth = "", e.style.maxHeight = "";
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
let r = t;
|
|
131
|
+
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(() => {
|
|
135
|
+
r.current = e;
|
|
136
|
+
});
|
|
137
|
+
let [i, a] = I(null), [o, s] = I(!1);
|
|
138
|
+
return N(() => {
|
|
139
|
+
let e = null;
|
|
140
|
+
try {
|
|
141
|
+
e = new B(null, he, ge, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
|
|
142
|
+
let t = r.current.onOpenLink;
|
|
143
|
+
return (t == null ? _e(e) : t(e)) === !1 ? { isError: !0 } : {};
|
|
144
|
+
}, e.onrequestdisplaymode = async ({ mode: e }) => {
|
|
145
|
+
let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
|
|
146
|
+
return { mode: t?.(e) ?? n };
|
|
147
|
+
}, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(ce, ({ params: e }) => {
|
|
148
|
+
let n = t.current?.querySelector("iframe");
|
|
149
|
+
n != null && W(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
|
|
150
|
+
}), a(e);
|
|
151
|
+
} catch (e) {
|
|
152
|
+
console.error("[useMcpAppBridge] Error creating AppBridge:", e), s(!0);
|
|
153
|
+
}
|
|
154
|
+
return () => {
|
|
155
|
+
e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
|
|
156
|
+
};
|
|
157
|
+
}, [t]), N(() => {
|
|
158
|
+
i != null && n != null && i.setHostContext(n);
|
|
159
|
+
}, [i, n]), {
|
|
160
|
+
appBridge: i,
|
|
161
|
+
hasFailed: o
|
|
162
|
+
};
|
|
163
|
+
}, 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;
|
|
116
172
|
if (!e) return;
|
|
117
173
|
let t = new ResizeObserver(([e]) => {
|
|
118
174
|
if (!e) return;
|
|
119
175
|
let { width: t, height: n } = e.contentRect;
|
|
120
|
-
|
|
176
|
+
p({
|
|
121
177
|
width: Math.round(t),
|
|
122
178
|
height: Math.round(n)
|
|
123
179
|
});
|
|
124
180
|
});
|
|
125
181
|
return t.observe(e), () => t.disconnect();
|
|
126
182
|
}, []);
|
|
127
|
-
let
|
|
128
|
-
...
|
|
129
|
-
containerDimensions:
|
|
130
|
-
}, [
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
ref:
|
|
133
|
-
className: h("relative h-full w-full",
|
|
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),
|
|
134
190
|
children: [
|
|
135
|
-
/* @__PURE__ */
|
|
191
|
+
m != null && /* @__PURE__ */ R(V, {
|
|
136
192
|
html: i,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
sandbox: d,
|
|
142
|
-
onCallTool: (e) => u(e.name, e.arguments),
|
|
193
|
+
sandbox: l,
|
|
194
|
+
appBridge: m,
|
|
195
|
+
toolInput: o,
|
|
196
|
+
toolResult: s,
|
|
143
197
|
onSizeChanged: () => r("ready"),
|
|
198
|
+
onInitialized: () => r("ready"),
|
|
144
199
|
onError: () => r("error")
|
|
145
200
|
}),
|
|
146
|
-
n === "loading" && /* @__PURE__ */
|
|
147
|
-
className: h("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
148
|
-
children: /* @__PURE__ */
|
|
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, {})
|
|
149
204
|
}),
|
|
150
|
-
|
|
205
|
+
_ && /* @__PURE__ */ z("div", {
|
|
151
206
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
152
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ R(T, {
|
|
153
208
|
size: 60,
|
|
154
209
|
stroke: x,
|
|
155
210
|
"aria-hidden": !0,
|
|
156
|
-
className:
|
|
157
|
-
}), /* @__PURE__ */
|
|
211
|
+
className: G.errorIcon
|
|
212
|
+
}), /* @__PURE__ */ R("p", {
|
|
158
213
|
role: "alert",
|
|
159
|
-
className: h("text-center",
|
|
214
|
+
className: h("text-center", G.statusLabel),
|
|
160
215
|
children: t
|
|
161
216
|
})]
|
|
162
217
|
})
|
|
163
218
|
]
|
|
164
219
|
});
|
|
165
|
-
},
|
|
220
|
+
}, K = {
|
|
166
221
|
viewer: "_viewer_1w97n_2",
|
|
167
222
|
spreadsheetCanvas: "_spreadsheetCanvas_1w97n_6",
|
|
168
223
|
formulaPanel: "_formulaPanel_1w97n_12",
|
|
@@ -170,13 +225,13 @@ var V = {
|
|
|
170
225
|
statusOverlay: "_statusOverlay_1w97n_24",
|
|
171
226
|
errorIcon: "_errorIcon_1w97n_29",
|
|
172
227
|
highlight: "_highlight_1w97n_37"
|
|
173
|
-
},
|
|
228
|
+
}, be = (e) => {
|
|
174
229
|
if (e?.kind !== "range") return "";
|
|
175
230
|
let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
|
|
176
231
|
if (n == null) return "";
|
|
177
232
|
let r = n.formula;
|
|
178
233
|
return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
|
|
179
|
-
},
|
|
234
|
+
}, xe = async (e, t, { onError: r, onXlsxSelectionContextChange: i }) => {
|
|
180
235
|
switch (t) {
|
|
181
236
|
case n.Docx: {
|
|
182
237
|
let [{ DocxScrollViewer: t }, { chartEx: n }] = await Promise.all([import("./docx-B9qBTEkj.js"), import("./chart-ex-B0DgG3Dt.js")]);
|
|
@@ -198,7 +253,7 @@ var V = {
|
|
|
198
253
|
}
|
|
199
254
|
case n.Csv: {
|
|
200
255
|
let { XlsxSheetViewer: t } = await import("./xlsx-BAXMTJTG.js"), n = document.createElement("canvas");
|
|
201
|
-
n.className =
|
|
256
|
+
n.className = K.spreadsheetCanvas, e.replaceChildren(n);
|
|
202
257
|
let i = new t(n, {
|
|
203
258
|
showScrollbars: !0,
|
|
204
259
|
onError: r
|
|
@@ -218,7 +273,7 @@ var V = {
|
|
|
218
273
|
});
|
|
219
274
|
}
|
|
220
275
|
}
|
|
221
|
-
},
|
|
276
|
+
}, Se = async (e, t, r, i) => {
|
|
222
277
|
let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = r;
|
|
223
278
|
switch (t.format) {
|
|
224
279
|
case n.Docx: {
|
|
@@ -227,7 +282,7 @@ var V = {
|
|
|
227
282
|
import("./chart-ex-B0DgG3Dt.js"),
|
|
228
283
|
import("./ooxml-highlight-surfaces-BhfVZvru.js")
|
|
229
284
|
]), l = await n.load(t.url, { chartEx: o });
|
|
230
|
-
if (i()) throw l.destroy(), new
|
|
285
|
+
if (i()) throw l.destroy(), new Ce();
|
|
231
286
|
let u = r.fromDocument(e, l, {
|
|
232
287
|
enableTextSelection: !0,
|
|
233
288
|
refitOnResize: !0,
|
|
@@ -247,7 +302,7 @@ var V = {
|
|
|
247
302
|
import("./chart-ex-B0DgG3Dt.js"),
|
|
248
303
|
import("./ooxml-highlight-surfaces-BhfVZvru.js")
|
|
249
304
|
]), l = await n.load(t.url, { chartEx: o });
|
|
250
|
-
if (i()) throw l.destroy(), new
|
|
305
|
+
if (i()) throw l.destroy(), new Ce();
|
|
251
306
|
let u = r.fromPresentation(e, l, {
|
|
252
307
|
enableTextSelection: !0,
|
|
253
308
|
refitOnResize: !0,
|
|
@@ -281,15 +336,15 @@ var V = {
|
|
|
281
336
|
};
|
|
282
337
|
}
|
|
283
338
|
case n.Csv: {
|
|
284
|
-
let n = await
|
|
339
|
+
let n = await xe(e, t.format, r);
|
|
285
340
|
return await n.load(t.url), { viewer: n };
|
|
286
341
|
}
|
|
287
342
|
}
|
|
288
|
-
},
|
|
289
|
-
let c =
|
|
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);
|
|
290
345
|
D.current = b;
|
|
291
|
-
let O =
|
|
292
|
-
return
|
|
346
|
+
let O = F(void 0);
|
|
347
|
+
return N(() => {
|
|
293
348
|
let t = c.current;
|
|
294
349
|
if (t == null) return;
|
|
295
350
|
let n, r = !1, i, a = () => r;
|
|
@@ -311,21 +366,21 @@ var V = {
|
|
|
311
366
|
r || (u(!1), f(!0));
|
|
312
367
|
},
|
|
313
368
|
onXlsxSelectionContextChange: (e) => {
|
|
314
|
-
r || m(
|
|
369
|
+
r || m(be(e));
|
|
315
370
|
},
|
|
316
371
|
onGeometryInvalidated: o
|
|
317
372
|
};
|
|
318
373
|
return t.addEventListener("scroll", o, !0), O.current = o, (async () => {
|
|
319
374
|
try {
|
|
320
375
|
if (C) {
|
|
321
|
-
let i = await
|
|
376
|
+
let i = await Se(t, e, l, a);
|
|
322
377
|
if (r) {
|
|
323
378
|
i.viewer.destroy(), i.engine?.destroy();
|
|
324
379
|
return;
|
|
325
380
|
}
|
|
326
381
|
n = i, E.current = i.highlights;
|
|
327
382
|
} else {
|
|
328
|
-
let i = await
|
|
383
|
+
let i = await xe(t, e.format, l);
|
|
329
384
|
if (r) {
|
|
330
385
|
i.destroy();
|
|
331
386
|
return;
|
|
@@ -335,7 +390,7 @@ var V = {
|
|
|
335
390
|
if (r) return;
|
|
336
391
|
u(!1), await s();
|
|
337
392
|
} catch (e) {
|
|
338
|
-
if (e instanceof
|
|
393
|
+
if (e instanceof Ce || r) return;
|
|
339
394
|
n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, E.current = void 0, t.replaceChildren(), u(!1), f(!0);
|
|
340
395
|
}
|
|
341
396
|
})(), () => {
|
|
@@ -345,9 +400,9 @@ var V = {
|
|
|
345
400
|
e.format,
|
|
346
401
|
e.url,
|
|
347
402
|
C
|
|
348
|
-
]),
|
|
403
|
+
]), N(() => {
|
|
349
404
|
O.current?.();
|
|
350
|
-
}, [b]),
|
|
405
|
+
}, [b]), N(() => {
|
|
351
406
|
let e = E.current;
|
|
352
407
|
if (e == null || l) return;
|
|
353
408
|
let t = (b?.find(({ id: e }) => e === S))?.locations.at(0);
|
|
@@ -367,38 +422,38 @@ var V = {
|
|
|
367
422
|
b,
|
|
368
423
|
S,
|
|
369
424
|
l
|
|
370
|
-
]), /* @__PURE__ */
|
|
425
|
+
]), /* @__PURE__ */ z("div", {
|
|
371
426
|
className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
|
|
372
427
|
children: [
|
|
373
|
-
e.format === n.Xlsx && /* @__PURE__ */
|
|
428
|
+
e.format === n.Xlsx && /* @__PURE__ */ z("div", {
|
|
374
429
|
role: "region",
|
|
375
430
|
"aria-label": i,
|
|
376
|
-
className: h("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2",
|
|
377
|
-
children: [/* @__PURE__ */
|
|
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", {
|
|
378
433
|
"aria-hidden": "true",
|
|
379
434
|
className: h("shrink-0", a),
|
|
380
435
|
children: "fx"
|
|
381
|
-
}), /* @__PURE__ */
|
|
436
|
+
}), /* @__PURE__ */ R("code", {
|
|
382
437
|
dir: "ltr",
|
|
383
438
|
tabIndex: 0,
|
|
384
439
|
"aria-live": "polite",
|
|
385
|
-
className: h("h-8 min-w-0 flex-1 overflow-x-auto whitespace-nowrap rounded border px-2 py-1 text-sm focus-visible:outline focus-visible:outline-focus",
|
|
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),
|
|
386
441
|
children: p
|
|
387
442
|
})]
|
|
388
443
|
}),
|
|
389
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ z("div", {
|
|
390
445
|
className: "relative min-h-0 w-full flex-1",
|
|
391
|
-
children: [/* @__PURE__ */
|
|
446
|
+
children: [/* @__PURE__ */ R("div", {
|
|
392
447
|
ref: c,
|
|
393
448
|
role: "document",
|
|
394
449
|
"aria-label": t,
|
|
395
450
|
"aria-busy": l,
|
|
396
|
-
className: h("h-full w-full overflow-hidden",
|
|
397
|
-
}), g.length > 0 && /* @__PURE__ */
|
|
451
|
+
className: h("h-full w-full overflow-hidden", K.viewer)
|
|
452
|
+
}), g.length > 0 && /* @__PURE__ */ R("div", {
|
|
398
453
|
role: "region",
|
|
399
454
|
"aria-label": o,
|
|
400
455
|
className: "pointer-events-none absolute inset-0 overflow-hidden",
|
|
401
|
-
children: g.map((e, t) => /* @__PURE__ */
|
|
456
|
+
children: g.map((e, t) => /* @__PURE__ */ R("div", {
|
|
402
457
|
"aria-hidden": "true",
|
|
403
458
|
style: {
|
|
404
459
|
left: `${e.left}px`,
|
|
@@ -408,28 +463,28 @@ var V = {
|
|
|
408
463
|
},
|
|
409
464
|
"data-selected": e.highlightId === S,
|
|
410
465
|
"data-clipped": e.isClippedAtEnd === !0,
|
|
411
|
-
className: h("absolute",
|
|
466
|
+
className: h("absolute", K.highlight)
|
|
412
467
|
}, `${e.highlightId}-${t}`))
|
|
413
468
|
})]
|
|
414
469
|
}),
|
|
415
|
-
/* @__PURE__ */
|
|
470
|
+
/* @__PURE__ */ R("div", {
|
|
416
471
|
role: "status",
|
|
417
472
|
"aria-live": "polite",
|
|
418
473
|
className: "sr-only",
|
|
419
474
|
children: v ? s : ""
|
|
420
475
|
}),
|
|
421
|
-
(l || d) && /* @__PURE__ */
|
|
476
|
+
(l || d) && /* @__PURE__ */ R("div", {
|
|
422
477
|
role: d ? "alert" : void 0,
|
|
423
478
|
"aria-live": "polite",
|
|
424
|
-
className: h("absolute inset-0 flex items-center justify-center",
|
|
425
|
-
children: l ? /* @__PURE__ */
|
|
479
|
+
className: h("absolute inset-0 flex items-center justify-center", K.statusOverlay),
|
|
480
|
+
children: l ? /* @__PURE__ */ R(w, { size: 48 }) : /* @__PURE__ */ z("div", {
|
|
426
481
|
className: "flex flex-col items-center gap-2",
|
|
427
|
-
children: [/* @__PURE__ */
|
|
482
|
+
children: [/* @__PURE__ */ R(T, {
|
|
428
483
|
"aria-hidden": "true",
|
|
429
484
|
size: 60,
|
|
430
485
|
stroke: x,
|
|
431
|
-
className:
|
|
432
|
-
}), /* @__PURE__ */
|
|
486
|
+
className: K.errorIcon
|
|
487
|
+
}), /* @__PURE__ */ R("p", {
|
|
433
488
|
className: "text-center",
|
|
434
489
|
children: r
|
|
435
490
|
})]
|
|
@@ -437,17 +492,17 @@ var V = {
|
|
|
437
492
|
})
|
|
438
493
|
]
|
|
439
494
|
});
|
|
440
|
-
},
|
|
495
|
+
}, Te = {
|
|
441
496
|
loadingOverlay: "_loadingOverlay_12637_1",
|
|
442
497
|
statusLabel: "_statusLabel_12637_5",
|
|
443
498
|
errorIcon: "_errorIcon_12637_9"
|
|
444
|
-
},
|
|
445
|
-
let i =
|
|
446
|
-
return u.current = e,
|
|
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(() => {
|
|
447
502
|
let e = i.current;
|
|
448
503
|
if (!e) return;
|
|
449
504
|
o("loading");
|
|
450
|
-
let t = new
|
|
505
|
+
let t = new H(e, {
|
|
451
506
|
domain: s,
|
|
452
507
|
hostDomain: window.location.origin,
|
|
453
508
|
visualizerName: c,
|
|
@@ -459,7 +514,7 @@ var V = {
|
|
|
459
514
|
layout: r,
|
|
460
515
|
...typeof i == "object" && i ? i : {}
|
|
461
516
|
};
|
|
462
|
-
await t.send(
|
|
517
|
+
await t.send(le.sendVisualizeData, {
|
|
463
518
|
mimeType: e,
|
|
464
519
|
visualizerData: a
|
|
465
520
|
}), n && o("ready");
|
|
@@ -472,7 +527,7 @@ var V = {
|
|
|
472
527
|
s,
|
|
473
528
|
c,
|
|
474
529
|
l
|
|
475
|
-
]), /* @__PURE__ */
|
|
530
|
+
]), /* @__PURE__ */ z("div", {
|
|
476
531
|
className: "relative h-full w-full",
|
|
477
532
|
style: p({
|
|
478
533
|
"--vs-loading-bg": r?.loadingBackground,
|
|
@@ -480,33 +535,33 @@ var V = {
|
|
|
480
535
|
"--vs-error-icon": r?.errorIcon
|
|
481
536
|
}),
|
|
482
537
|
children: [
|
|
483
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ R("div", {
|
|
484
539
|
ref: i,
|
|
485
540
|
className: "h-full w-full"
|
|
486
541
|
}),
|
|
487
|
-
a === "loading" && /* @__PURE__ */
|
|
488
|
-
className: h("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
489
|
-
children: [/* @__PURE__ */
|
|
490
|
-
className: h("text-center",
|
|
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),
|
|
491
546
|
children: t
|
|
492
547
|
})]
|
|
493
548
|
}),
|
|
494
|
-
a === "error" && /* @__PURE__ */
|
|
549
|
+
a === "error" && /* @__PURE__ */ z("div", {
|
|
495
550
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
496
|
-
children: [/* @__PURE__ */
|
|
551
|
+
children: [/* @__PURE__ */ R(T, {
|
|
497
552
|
size: 60,
|
|
498
553
|
stroke: x,
|
|
499
554
|
"aria-hidden": !0,
|
|
500
|
-
className:
|
|
501
|
-
}), /* @__PURE__ */
|
|
555
|
+
className: Te.errorIcon
|
|
556
|
+
}), /* @__PURE__ */ R("p", {
|
|
502
557
|
role: "alert",
|
|
503
|
-
className: h("text-center",
|
|
558
|
+
className: h("text-center", Te.statusLabel),
|
|
504
559
|
children: n
|
|
505
560
|
})]
|
|
506
561
|
})
|
|
507
562
|
]
|
|
508
563
|
});
|
|
509
|
-
},
|
|
564
|
+
}, q = {
|
|
510
565
|
body: "_body_13ogb_4",
|
|
511
566
|
statusLabel: "_statusLabel_13ogb_13",
|
|
512
567
|
errorIcon: "_errorIcon_13ogb_17",
|
|
@@ -521,34 +576,34 @@ var V = {
|
|
|
521
576
|
jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
|
|
522
577
|
jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
|
|
523
578
|
jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
|
|
524
|
-
},
|
|
525
|
-
let [r, i] =
|
|
526
|
-
return
|
|
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(() => {
|
|
527
582
|
i(!1);
|
|
528
|
-
}, [e]), r ? /* @__PURE__ */
|
|
583
|
+
}, [e]), r ? /* @__PURE__ */ z("div", {
|
|
529
584
|
className: "flex flex-col items-center gap-2",
|
|
530
|
-
children: [/* @__PURE__ */
|
|
585
|
+
children: [/* @__PURE__ */ R(T, {
|
|
531
586
|
size: 60,
|
|
532
587
|
stroke: x,
|
|
533
|
-
className:
|
|
534
|
-
}), /* @__PURE__ */
|
|
535
|
-
className: h("text-center",
|
|
588
|
+
className: q.errorIcon
|
|
589
|
+
}), /* @__PURE__ */ R("p", {
|
|
590
|
+
className: h("text-center", q.statusLabel),
|
|
536
591
|
children: n
|
|
537
592
|
})]
|
|
538
|
-
}) : /* @__PURE__ */
|
|
593
|
+
}) : /* @__PURE__ */ R("img", {
|
|
539
594
|
src: e,
|
|
540
595
|
alt: t ?? "",
|
|
541
596
|
className: "max-h-full max-w-full object-contain",
|
|
542
597
|
onError: () => i(!0)
|
|
543
598
|
});
|
|
544
|
-
},
|
|
599
|
+
}, ke = new Set([
|
|
545
600
|
r.PlainText,
|
|
546
601
|
r.Code,
|
|
547
602
|
r.Ooxml
|
|
548
|
-
]),
|
|
549
|
-
let { colors: H, typography: U, bodyClassName:
|
|
550
|
-
|
|
551
|
-
}, []),
|
|
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(() => ({
|
|
552
607
|
...p({
|
|
553
608
|
"--ac-text": H?.text,
|
|
554
609
|
"--ac-status-text": H?.statusText,
|
|
@@ -573,14 +628,14 @@ var V = {
|
|
|
573
628
|
"--ac-ooxml-highlight-bg": H?.ooxmlHighlightBackground,
|
|
574
629
|
"--ac-json-collapsed-text": H?.jsonCollapsedText,
|
|
575
630
|
"--ac-json-collapsed-bg": H?.jsonCollapsedBackground,
|
|
576
|
-
"--ac-font-family":
|
|
577
|
-
"--ac-font-size":
|
|
578
|
-
"--ac-font-weight":
|
|
579
|
-
"--ac-line-height":
|
|
580
|
-
"--ac-letter-spacing":
|
|
631
|
+
"--ac-font-family": W ? void 0 : U?.fontFamily,
|
|
632
|
+
"--ac-font-size": W ? void 0 : U?.fontSize,
|
|
633
|
+
"--ac-font-weight": W ? void 0 : U?.fontWeight,
|
|
634
|
+
"--ac-line-height": W ? void 0 : U?.lineHeight,
|
|
635
|
+
"--ac-letter-spacing": W ? void 0 : U?.letterSpacing
|
|
581
636
|
}),
|
|
582
|
-
...
|
|
583
|
-
}), [
|
|
637
|
+
...de
|
|
638
|
+
}), [F]), G = P(() => {
|
|
584
639
|
switch (e.type) {
|
|
585
640
|
case r.Image:
|
|
586
641
|
case r.Audio:
|
|
@@ -593,47 +648,42 @@ var V = {
|
|
|
593
648
|
case r.McpApp:
|
|
594
649
|
case r.Code:
|
|
595
650
|
case r.Html: return "h-full overflow-hidden";
|
|
596
|
-
case r.Markdown:
|
|
651
|
+
case r.Markdown: return "h-full overflow-auto p-4";
|
|
597
652
|
case r.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
|
|
598
653
|
default: return "h-full overflow-auto p-4";
|
|
599
654
|
}
|
|
600
|
-
}, [e.type]),
|
|
655
|
+
}, [e.type]), K = P(() => {
|
|
601
656
|
switch (e.type) {
|
|
602
|
-
case r.PlainText: return /* @__PURE__ */
|
|
603
|
-
className: h("whitespace-pre-wrap break-words",
|
|
657
|
+
case r.PlainText: return /* @__PURE__ */ R("pre", {
|
|
658
|
+
className: h("whitespace-pre-wrap break-words", q.body, U?.fontClassName),
|
|
604
659
|
children: e.text
|
|
605
660
|
});
|
|
606
|
-
case r.Image: return /* @__PURE__ */
|
|
661
|
+
case r.Image: return /* @__PURE__ */ R(Oe, {
|
|
607
662
|
url: e.url,
|
|
608
663
|
fileName: i,
|
|
609
664
|
loadErrorLabel: c
|
|
610
665
|
});
|
|
611
|
-
case r.Audio: return /* @__PURE__ */
|
|
666
|
+
case r.Audio: return /* @__PURE__ */ R("audio", {
|
|
612
667
|
controls: !0,
|
|
613
668
|
src: e.url,
|
|
614
669
|
"aria-label": i ?? "Audio attachment",
|
|
615
670
|
className: "w-full max-w-sm",
|
|
616
671
|
preload: "metadata",
|
|
617
|
-
children: e.mimeType && /* @__PURE__ */
|
|
672
|
+
children: e.mimeType && /* @__PURE__ */ R("source", {
|
|
618
673
|
src: e.url,
|
|
619
674
|
type: e.mimeType
|
|
620
675
|
})
|
|
621
676
|
});
|
|
622
|
-
case r.Markdown: return /* @__PURE__ */
|
|
677
|
+
case r.Markdown: return /* @__PURE__ */ R(f, {
|
|
623
678
|
content: e.text,
|
|
624
679
|
isStreaming: !1,
|
|
625
|
-
codeBlockTheme:
|
|
626
|
-
|
|
627
|
-
classNames: {
|
|
628
|
-
...l,
|
|
629
|
-
tableWrapper: "my-0 max-h-full",
|
|
630
|
-
tableScrollContainer: "max-h-full"
|
|
631
|
-
}
|
|
680
|
+
codeBlockTheme: L,
|
|
681
|
+
classNames: l
|
|
632
682
|
});
|
|
633
|
-
case r.MarkdownTable: return /* @__PURE__ */
|
|
683
|
+
case r.MarkdownTable: return /* @__PURE__ */ R(f, {
|
|
634
684
|
content: e.text,
|
|
635
685
|
isStreaming: !1,
|
|
636
|
-
codeBlockTheme:
|
|
686
|
+
codeBlockTheme: L,
|
|
637
687
|
containerClassName: "flex h-full min-h-0 flex-col",
|
|
638
688
|
classNames: {
|
|
639
689
|
...l,
|
|
@@ -644,48 +694,48 @@ var V = {
|
|
|
644
694
|
copyCsvLabel: re,
|
|
645
695
|
copyTxtLabel: ie,
|
|
646
696
|
copyMarkdownLabel: ae,
|
|
647
|
-
copiedLabel:
|
|
648
|
-
downloadCsvLabel:
|
|
697
|
+
copiedLabel: k,
|
|
698
|
+
downloadCsvLabel: A
|
|
649
699
|
},
|
|
650
|
-
tableDownloadFilename:
|
|
700
|
+
tableDownloadFilename: B
|
|
651
701
|
});
|
|
652
|
-
case r.Json: return /* @__PURE__ */
|
|
702
|
+
case r.Json: return /* @__PURE__ */ R("div", {
|
|
653
703
|
dir: "ltr",
|
|
654
704
|
className: "h-full overflow-auto",
|
|
655
|
-
children: /* @__PURE__ */
|
|
656
|
-
className: h("m-3 overflow-auto rounded-md border",
|
|
657
|
-
children: /* @__PURE__ */
|
|
705
|
+
children: /* @__PURE__ */ R("div", {
|
|
706
|
+
className: h("m-3 overflow-auto rounded-md border", q.jsonWrapper),
|
|
707
|
+
children: /* @__PURE__ */ R(oe, {
|
|
658
708
|
data: e.value,
|
|
659
709
|
style: {
|
|
660
710
|
container: h("whitespace-pre-wrap break-words p-2", U?.jsonClassName ?? "dial-code-text"),
|
|
661
|
-
basicChildStyle:
|
|
711
|
+
basicChildStyle: se.basicChildStyle,
|
|
662
712
|
childFieldsContainer: "m-0 ps-3",
|
|
663
|
-
label: h("me-1 font-semibold",
|
|
664
|
-
clickableLabel: h("me-1 cursor-pointer font-semibold hover:underline",
|
|
665
|
-
nullValue: h("italic",
|
|
666
|
-
undefinedValue: h("italic",
|
|
667
|
-
stringValue:
|
|
668
|
-
booleanValue:
|
|
669
|
-
numberValue:
|
|
670
|
-
otherValue: h("italic",
|
|
671
|
-
punctuation: h("me-1",
|
|
672
|
-
collapseIcon: h("me-1 cursor-pointer select-none transition-colors",
|
|
673
|
-
expandIcon: h("me-1 cursor-pointer select-none transition-colors",
|
|
674
|
-
collapsedContent: h("me-1 cursor-pointer rounded px-1",
|
|
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),
|
|
717
|
+
stringValue: q.jsonStringValue,
|
|
718
|
+
booleanValue: q.jsonBooleanValue,
|
|
719
|
+
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)
|
|
675
725
|
}
|
|
676
726
|
})
|
|
677
727
|
})
|
|
678
728
|
});
|
|
679
|
-
case r.Code: return /* @__PURE__ */
|
|
729
|
+
case r.Code: return /* @__PURE__ */ R(fe, {
|
|
680
730
|
content: e,
|
|
681
|
-
codeBlockTheme:
|
|
731
|
+
codeBlockTheme: L,
|
|
682
732
|
labels: {
|
|
683
733
|
loadingLabel: O,
|
|
684
734
|
errorLabel: ee,
|
|
685
735
|
retryLabel: te
|
|
686
736
|
}
|
|
687
737
|
});
|
|
688
|
-
case r.Html: return /* @__PURE__ */
|
|
738
|
+
case r.Html: return /* @__PURE__ */ R(me, {
|
|
689
739
|
content: e,
|
|
690
740
|
labels: {
|
|
691
741
|
htmlFrameBlockedLabel: m,
|
|
@@ -693,25 +743,25 @@ var V = {
|
|
|
693
743
|
},
|
|
694
744
|
isSourceView: a,
|
|
695
745
|
title: i,
|
|
696
|
-
codeBlockTheme:
|
|
746
|
+
codeBlockTheme: L
|
|
697
747
|
});
|
|
698
|
-
case r.Pdf: return /* @__PURE__ */
|
|
699
|
-
retryKey:
|
|
700
|
-
onRetry:
|
|
748
|
+
case r.Pdf: return /* @__PURE__ */ R(o, {
|
|
749
|
+
retryKey: pe,
|
|
750
|
+
onRetry: _e,
|
|
701
751
|
labels: {
|
|
702
752
|
loadingLabel: S,
|
|
703
753
|
errorLabel: C,
|
|
704
754
|
retryLabel: E
|
|
705
755
|
},
|
|
706
|
-
children: /* @__PURE__ */
|
|
756
|
+
children: /* @__PURE__ */ R(ge, {
|
|
707
757
|
fileName: i,
|
|
708
758
|
url: e.url,
|
|
709
759
|
highlights: e.highlights ?? [],
|
|
710
760
|
selectedHighlightId: e.selectedHighlightId,
|
|
711
761
|
selectedPageNumber: e.page,
|
|
712
|
-
loadPdf:
|
|
713
|
-
hideHeader:
|
|
714
|
-
configurePdfWorker:
|
|
762
|
+
loadPdf: V,
|
|
763
|
+
hideHeader: ce,
|
|
764
|
+
configurePdfWorker: le,
|
|
715
765
|
labels: {
|
|
716
766
|
thumbnailsLabel: _,
|
|
717
767
|
showThumbnailsLabel: v,
|
|
@@ -723,34 +773,34 @@ var V = {
|
|
|
723
773
|
}
|
|
724
774
|
})
|
|
725
775
|
}, e.url);
|
|
726
|
-
case r.Ooxml: return /* @__PURE__ */
|
|
776
|
+
case r.Ooxml: return /* @__PURE__ */ R(we, {
|
|
727
777
|
content: e,
|
|
728
778
|
fileName: i,
|
|
729
779
|
loadErrorLabel: c,
|
|
730
780
|
formulaLabel: D,
|
|
731
781
|
formulaLabelClassName: U?.xlsxFormulaLabelClassName ?? "dial-italic-text",
|
|
732
|
-
highlightsLabel:
|
|
733
|
-
highlightNavigatedLabel:
|
|
782
|
+
highlightsLabel: M,
|
|
783
|
+
highlightNavigatedLabel: N
|
|
734
784
|
});
|
|
735
|
-
case r.Visualizer: return /* @__PURE__ */
|
|
785
|
+
case r.Visualizer: return /* @__PURE__ */ R(Ee, {
|
|
736
786
|
content: e,
|
|
737
787
|
errorLabel: d
|
|
738
788
|
});
|
|
739
|
-
case r.McpApp: return /* @__PURE__ */
|
|
740
|
-
case r.Unsupported: return /* @__PURE__ */
|
|
741
|
-
className: h("text-center",
|
|
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),
|
|
742
792
|
children: s
|
|
743
793
|
});
|
|
744
794
|
case r.Error: {
|
|
745
795
|
let n = e.errorType === t.Forbidden;
|
|
746
|
-
return /* @__PURE__ */
|
|
796
|
+
return /* @__PURE__ */ z("div", {
|
|
747
797
|
className: "flex flex-col items-center gap-2",
|
|
748
|
-
children: [
|
|
798
|
+
children: [R(n ? ne : T, {
|
|
749
799
|
size: 60,
|
|
750
800
|
stroke: x,
|
|
751
|
-
className:
|
|
752
|
-
}), /* @__PURE__ */
|
|
753
|
-
className: h("text-center",
|
|
801
|
+
className: q.errorIcon
|
|
802
|
+
}), /* @__PURE__ */ R("p", {
|
|
803
|
+
className: h("text-center", q.statusLabel),
|
|
754
804
|
children: n ? u : c
|
|
755
805
|
})]
|
|
756
806
|
});
|
|
@@ -762,7 +812,7 @@ var V = {
|
|
|
762
812
|
U?.jsonClassName,
|
|
763
813
|
U?.xlsxFormulaLabelClassName,
|
|
764
814
|
i,
|
|
765
|
-
|
|
815
|
+
L,
|
|
766
816
|
s,
|
|
767
817
|
c,
|
|
768
818
|
u,
|
|
@@ -770,10 +820,10 @@ var V = {
|
|
|
770
820
|
m,
|
|
771
821
|
g,
|
|
772
822
|
a,
|
|
773
|
-
z,
|
|
774
823
|
B,
|
|
775
|
-
le,
|
|
776
824
|
V,
|
|
825
|
+
ce,
|
|
826
|
+
le,
|
|
777
827
|
_,
|
|
778
828
|
v,
|
|
779
829
|
y,
|
|
@@ -785,41 +835,41 @@ var V = {
|
|
|
785
835
|
O,
|
|
786
836
|
ee,
|
|
787
837
|
te,
|
|
788
|
-
he,
|
|
789
|
-
G,
|
|
790
838
|
ge,
|
|
839
|
+
pe,
|
|
840
|
+
_e,
|
|
791
841
|
re,
|
|
792
842
|
ie,
|
|
793
843
|
ae,
|
|
794
|
-
oe,
|
|
795
844
|
k,
|
|
796
|
-
|
|
797
|
-
M
|
|
845
|
+
A,
|
|
846
|
+
M,
|
|
847
|
+
N
|
|
798
848
|
]);
|
|
799
|
-
return /* @__PURE__ */
|
|
800
|
-
style: !n &&
|
|
801
|
-
className: h(n ? "flex h-full items-center justify-center" :
|
|
802
|
-
children: n ? /* @__PURE__ */
|
|
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
|
|
803
853
|
});
|
|
804
|
-
}),
|
|
805
|
-
let [
|
|
806
|
-
|
|
807
|
-
}, [
|
|
808
|
-
|
|
809
|
-
}, [
|
|
810
|
-
|
|
811
|
-
}, [
|
|
812
|
-
|
|
813
|
-
|
|
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);
|
|
814
864
|
}, []);
|
|
815
|
-
let
|
|
816
|
-
|
|
865
|
+
let Ve = j(() => {
|
|
866
|
+
Re((e) => !e);
|
|
817
867
|
}, []);
|
|
818
|
-
|
|
819
|
-
|
|
868
|
+
N(() => {
|
|
869
|
+
Re(!1);
|
|
820
870
|
}, [i]);
|
|
821
|
-
let { className:
|
|
822
|
-
return /* @__PURE__ */
|
|
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, {
|
|
823
873
|
isOpen: e,
|
|
824
874
|
orientation: v.Right,
|
|
825
875
|
title: o,
|
|
@@ -829,137 +879,137 @@ var V = {
|
|
|
829
879
|
resizeLabel: l
|
|
830
880
|
},
|
|
831
881
|
onClose: n,
|
|
832
|
-
resizable: !
|
|
833
|
-
defaultWidth:
|
|
882
|
+
resizable: !Se,
|
|
883
|
+
defaultWidth: Ce,
|
|
834
884
|
minWidth: we,
|
|
835
885
|
maxWidth: Te,
|
|
836
886
|
onResizeStop: Ee,
|
|
837
887
|
styles: {
|
|
838
|
-
...
|
|
839
|
-
titleClassName:
|
|
840
|
-
headerClassName: h("border-b border-tertiary",
|
|
841
|
-
className: h(e ? "mobile:w-full mobile:max-w-full" : "w-0",
|
|
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)
|
|
842
892
|
},
|
|
843
|
-
rightActions:
|
|
844
|
-
Ye && /* @__PURE__ */
|
|
845
|
-
icon: /* @__PURE__ */
|
|
893
|
+
rightActions: Ge || Ke || $ || qe || Je || Ye ? /* @__PURE__ */ z(L, { children: [
|
|
894
|
+
Ye && /* @__PURE__ */ R(S, {
|
|
895
|
+
icon: /* @__PURE__ */ R(ie, {
|
|
846
896
|
size: b.LG,
|
|
847
897
|
stroke: x,
|
|
848
898
|
"aria-hidden": !0
|
|
849
899
|
}),
|
|
850
|
-
"aria-label":
|
|
851
|
-
tooltipProps: { tooltip:
|
|
900
|
+
"aria-label": P,
|
|
901
|
+
tooltipProps: { tooltip: P },
|
|
852
902
|
onClick: i.type === r.McpApp ? i.onReload : void 0
|
|
853
903
|
}),
|
|
854
|
-
|
|
855
|
-
icon:
|
|
904
|
+
Ge && /* @__PURE__ */ R(S, {
|
|
905
|
+
icon: R(J ? te : D, {
|
|
856
906
|
size: b.LG,
|
|
857
907
|
stroke: x,
|
|
858
908
|
"aria-hidden": !0
|
|
859
909
|
}),
|
|
860
|
-
"aria-label":
|
|
861
|
-
"aria-pressed":
|
|
862
|
-
tooltipProps: { tooltip:
|
|
863
|
-
onClick:
|
|
910
|
+
"aria-label": J ? M : A,
|
|
911
|
+
"aria-pressed": J,
|
|
912
|
+
tooltipProps: { tooltip: J ? M : A },
|
|
913
|
+
onClick: Ve
|
|
864
914
|
}),
|
|
865
|
-
|
|
866
|
-
icon:
|
|
915
|
+
Ke && /* @__PURE__ */ R(S, {
|
|
916
|
+
icon: R(Me ? E : O, {
|
|
867
917
|
size: b.LG,
|
|
868
918
|
stroke: x,
|
|
869
919
|
"aria-hidden": !0
|
|
870
920
|
}),
|
|
871
|
-
"aria-label":
|
|
872
|
-
tooltipProps: { tooltip:
|
|
873
|
-
onClick:
|
|
921
|
+
"aria-label": Me ? f : d,
|
|
922
|
+
tooltipProps: { tooltip: Me ? f : d },
|
|
923
|
+
onClick: ze
|
|
874
924
|
}),
|
|
875
|
-
|
|
876
|
-
icon:
|
|
925
|
+
$ && /* @__PURE__ */ R(S, {
|
|
926
|
+
icon: R(Pe ? E : re, {
|
|
877
927
|
size: b.LG,
|
|
878
928
|
stroke: x,
|
|
879
929
|
"aria-hidden": !0
|
|
880
930
|
}),
|
|
881
|
-
"aria-label":
|
|
882
|
-
tooltipProps: { tooltip:
|
|
883
|
-
onClick:
|
|
931
|
+
"aria-label": Pe ? m : p,
|
|
932
|
+
tooltipProps: { tooltip: Pe ? m : p },
|
|
933
|
+
onClick: Be
|
|
884
934
|
}),
|
|
885
|
-
qe && /* @__PURE__ */
|
|
886
|
-
icon:
|
|
935
|
+
qe && /* @__PURE__ */ R(S, {
|
|
936
|
+
icon: R(Ie ? E : O, {
|
|
887
937
|
size: b.LG,
|
|
888
938
|
stroke: x,
|
|
889
939
|
"aria-hidden": !0
|
|
890
940
|
}),
|
|
891
|
-
"aria-label":
|
|
892
|
-
tooltipProps: { tooltip:
|
|
893
|
-
onClick:
|
|
941
|
+
"aria-label": Ie ? _ : g,
|
|
942
|
+
tooltipProps: { tooltip: Ie ? _ : g },
|
|
943
|
+
onClick: Q
|
|
894
944
|
}),
|
|
895
|
-
Je && /* @__PURE__ */
|
|
896
|
-
icon: /* @__PURE__ */
|
|
945
|
+
Je && /* @__PURE__ */ R(S, {
|
|
946
|
+
icon: /* @__PURE__ */ R(ee, {
|
|
897
947
|
size: b.LG,
|
|
898
948
|
stroke: x
|
|
899
949
|
}),
|
|
900
950
|
"aria-label": u,
|
|
901
951
|
tooltipProps: { tooltip: u },
|
|
902
|
-
onClick:
|
|
952
|
+
onClick: G
|
|
903
953
|
})
|
|
904
954
|
] }) : null,
|
|
905
|
-
children: /* @__PURE__ */
|
|
955
|
+
children: /* @__PURE__ */ R(Ae, {
|
|
906
956
|
content: i,
|
|
907
957
|
isLoading: t,
|
|
908
958
|
fileName: o,
|
|
909
|
-
isHtmlSourceView:
|
|
959
|
+
isHtmlSourceView: J,
|
|
910
960
|
labels: {
|
|
911
961
|
unsupportedLabel: w,
|
|
912
962
|
loadErrorLabel: T,
|
|
913
963
|
forbiddenErrorLabel: ne,
|
|
914
964
|
visualizerErrorLabel: C,
|
|
915
965
|
htmlFrameBlockedLabel: ae,
|
|
916
|
-
htmlOpenInNewTabLabel:
|
|
917
|
-
pdfThumbnailsLabel:
|
|
918
|
-
pdfShowThumbnailsLabel:
|
|
919
|
-
pdfHideThumbnailsLabel:
|
|
920
|
-
pdfPageNumberLabel:
|
|
921
|
-
pdfContentLoadingLabel:
|
|
922
|
-
pdfContentErrorLabel:
|
|
966
|
+
htmlOpenInNewTabLabel: k,
|
|
967
|
+
pdfThumbnailsLabel: oe,
|
|
968
|
+
pdfShowThumbnailsLabel: se,
|
|
969
|
+
pdfHideThumbnailsLabel: B,
|
|
970
|
+
pdfPageNumberLabel: V,
|
|
971
|
+
pdfContentLoadingLabel: ce,
|
|
972
|
+
pdfContentErrorLabel: le,
|
|
923
973
|
pdfContentRetryLabel: H,
|
|
924
974
|
xlsxFormulaLabel: U,
|
|
925
975
|
codeContentLoadingLabel: ue,
|
|
926
976
|
codeContentErrorLabel: de,
|
|
927
977
|
codeContentRetryLabel: fe,
|
|
928
|
-
tableCopyCsvLabel:
|
|
929
|
-
tableCopyTxtLabel:
|
|
930
|
-
tableCopyMarkdownLabel:
|
|
931
|
-
tableCopiedLabel:
|
|
932
|
-
tableDownloadCsvLabel:
|
|
933
|
-
ooxmlHighlightsLabel:
|
|
934
|
-
ooxmlHighlightNavigatedLabel:
|
|
978
|
+
tableCopyCsvLabel: pe,
|
|
979
|
+
tableCopyTxtLabel: me,
|
|
980
|
+
tableCopyMarkdownLabel: he,
|
|
981
|
+
tableCopiedLabel: ge,
|
|
982
|
+
tableDownloadCsvLabel: _e,
|
|
983
|
+
ooxmlHighlightsLabel: W,
|
|
984
|
+
ooxmlHighlightNavigatedLabel: ve
|
|
935
985
|
},
|
|
936
|
-
styles:
|
|
937
|
-
codeBlockTheme:
|
|
938
|
-
tableDownloadFilename:
|
|
939
|
-
loadPdf:
|
|
940
|
-
configurePdfWorker:
|
|
986
|
+
styles: We,
|
|
987
|
+
codeBlockTheme: De,
|
|
988
|
+
tableDownloadFilename: xe,
|
|
989
|
+
loadPdf: Oe,
|
|
990
|
+
configurePdfWorker: ke
|
|
941
991
|
})
|
|
942
992
|
});
|
|
943
|
-
}),
|
|
993
|
+
}), Ne = {
|
|
944
994
|
type: r.PlainText,
|
|
945
995
|
text: ""
|
|
946
|
-
},
|
|
996
|
+
}, Pe = (e) => {
|
|
947
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;
|
|
948
|
-
},
|
|
949
|
-
|
|
950
|
-
var
|
|
951
|
-
let [t, n] =
|
|
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) => {
|
|
952
1002
|
c(e), u(t), i(!0), n(!0);
|
|
953
|
-
}, []), f =
|
|
1003
|
+
}, []), f = j((e, t, r) => {
|
|
954
1004
|
o(e), c(t), u(r), i(!1), n(!0);
|
|
955
|
-
}, []), p =
|
|
956
|
-
o(
|
|
1005
|
+
}, []), p = j(() => {
|
|
1006
|
+
o(Ne), n(!1), i(!1), u(void 0);
|
|
957
1007
|
}, []);
|
|
958
|
-
return
|
|
959
|
-
let e =
|
|
1008
|
+
return N(() => () => {
|
|
1009
|
+
let e = Pe(a);
|
|
960
1010
|
e != null && URL.revokeObjectURL(e);
|
|
961
|
-
}, [a]), /* @__PURE__ */
|
|
962
|
-
value:
|
|
1011
|
+
}, [a]), /* @__PURE__ */ R(Fe.Provider, {
|
|
1012
|
+
value: P(() => ({
|
|
963
1013
|
isOpen: t,
|
|
964
1014
|
isLoading: r,
|
|
965
1015
|
content: a,
|
|
@@ -980,26 +1030,26 @@ var Oe = ({ children: e }) => {
|
|
|
980
1030
|
]),
|
|
981
1031
|
children: e
|
|
982
1032
|
});
|
|
983
|
-
},
|
|
984
|
-
let e =
|
|
1033
|
+
}, Le = () => {
|
|
1034
|
+
let e = M(Fe);
|
|
985
1035
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
986
1036
|
return e;
|
|
987
|
-
},
|
|
988
|
-
let { ariaLabel: l = "Attachment preview", closeLabel: u = "Close", downloadLabel: d = "Download", unsupportedLabel: f = "Preview is not supported for this file", loadErrorLabel: p = "Failed to load file", forbiddenErrorLabel: h = "You don't have permission to access this file", copyTextLabel: g, copiedTextLabel: _, copyMarkdownLabel: v, copiedMarkdownLabel: y, copyJsonLabel: b, copiedJsonLabel: x, htmlFrameBlockedLabel: S, htmlOpenInNewTabLabel: C, htmlViewSourceLabel: w, htmlViewRenderedLabel: T, pdfThumbnailsLabel: E, pdfShowThumbnailsLabel: D, pdfHideThumbnailsLabel: O, pdfPageNumberLabel: ee, pdfContentLoadingLabel: te, pdfContentErrorLabel: ne, pdfContentRetryLabel: re, xlsxFormulaLabel: ie, codeContentLoadingLabel: ae, codeContentErrorLabel:
|
|
989
|
-
i(
|
|
990
|
-
}, [
|
|
991
|
-
(
|
|
992
|
-
}, [
|
|
993
|
-
|
|
994
|
-
}, [
|
|
995
|
-
|
|
996
|
-
}, [
|
|
997
|
-
return /* @__PURE__ */
|
|
998
|
-
isOpen:
|
|
999
|
-
isLoading:
|
|
1000
|
-
onClose:
|
|
1001
|
-
content:
|
|
1002
|
-
fileName:
|
|
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,
|
|
1003
1053
|
labels: {
|
|
1004
1054
|
ariaLabel: l,
|
|
1005
1055
|
closeLabel: u,
|
|
@@ -1026,20 +1076,20 @@ var Oe = ({ children: e }) => {
|
|
|
1026
1076
|
pdfContentRetryLabel: re,
|
|
1027
1077
|
xlsxFormulaLabel: ie,
|
|
1028
1078
|
codeContentLoadingLabel: ae,
|
|
1029
|
-
codeContentErrorLabel:
|
|
1030
|
-
codeContentRetryLabel:
|
|
1031
|
-
tableCopyCsvLabel:
|
|
1032
|
-
tableCopyTxtLabel:
|
|
1033
|
-
tableCopyMarkdownLabel:
|
|
1034
|
-
tableCopiedLabel:
|
|
1035
|
-
tableDownloadCsvLabel:
|
|
1036
|
-
ooxmlHighlightsLabel:
|
|
1037
|
-
ooxmlHighlightNavigatedLabel:
|
|
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
|
|
1038
1088
|
},
|
|
1039
|
-
onDownload:
|
|
1040
|
-
onCopyText:
|
|
1041
|
-
onCopyMarkdown:
|
|
1042
|
-
onCopyJson:
|
|
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,
|
|
1043
1093
|
tableDownloadFilename: s,
|
|
1044
1094
|
isMobile: t,
|
|
1045
1095
|
defaultWidth: n,
|
|
@@ -1047,43 +1097,43 @@ var Oe = ({ children: e }) => {
|
|
|
1047
1097
|
codeBlockTheme: o,
|
|
1048
1098
|
configurePdfWorker: c
|
|
1049
1099
|
});
|
|
1050
|
-
}),
|
|
1100
|
+
}), Re = new Set(["html", "htm"]), Y = {
|
|
1051
1101
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1052
1102
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1053
1103
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
1054
|
-
},
|
|
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 = {
|
|
1055
1105
|
docx: n.Docx,
|
|
1056
1106
|
xlsx: n.Xlsx,
|
|
1057
1107
|
pptx: n.Pptx,
|
|
1058
1108
|
csv: n.Csv
|
|
1059
|
-
},
|
|
1109
|
+
}, ze = {
|
|
1060
1110
|
[Y.docx]: n.Docx,
|
|
1061
1111
|
[Y.xlsx]: n.Xlsx,
|
|
1062
1112
|
[Y.pptx]: n.Pptx,
|
|
1063
1113
|
[d.CSV]: n.Csv
|
|
1064
|
-
},
|
|
1114
|
+
}, Be = {
|
|
1065
1115
|
[n.Docx]: Y.docx,
|
|
1066
1116
|
[n.Xlsx]: Y.xlsx,
|
|
1067
1117
|
[n.Pptx]: Y.pptx,
|
|
1068
1118
|
[n.Csv]: d.CSV
|
|
1069
|
-
},
|
|
1119
|
+
}, Q = (e, t) => {
|
|
1070
1120
|
let n = t?.split(";", 1)[0].trim().toLowerCase();
|
|
1071
1121
|
if (n != null) {
|
|
1072
|
-
let e =
|
|
1122
|
+
let e = ze[n];
|
|
1073
1123
|
if (e != null) return e;
|
|
1074
1124
|
}
|
|
1075
1125
|
let r = e.lastIndexOf(".");
|
|
1076
|
-
if (r !== -1) return
|
|
1077
|
-
},
|
|
1078
|
-
let n =
|
|
1079
|
-
return n == null ? void 0 :
|
|
1080
|
-
},
|
|
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
1131
|
let t = e.lastIndexOf(".");
|
|
1082
|
-
return t === -1 ? !1 :
|
|
1083
|
-
},
|
|
1132
|
+
return t === -1 ? !1 : X.has(e.slice(t + 1).toLowerCase());
|
|
1133
|
+
}, We = (e) => {
|
|
1084
1134
|
let t = e.lastIndexOf(".");
|
|
1085
|
-
return t === -1 ? !1 :
|
|
1086
|
-
},
|
|
1135
|
+
return t === -1 ? !1 : Re.has(e.slice(t + 1).toLowerCase());
|
|
1136
|
+
}, Ge = {
|
|
1087
1137
|
xml: "xml",
|
|
1088
1138
|
csv: "plaintext",
|
|
1089
1139
|
tsv: "plaintext",
|
|
@@ -1131,21 +1181,21 @@ var Oe = ({ children: e }) => {
|
|
|
1131
1181
|
gitignore: "plaintext",
|
|
1132
1182
|
dockerfile: "plaintext",
|
|
1133
1183
|
makefile: "plaintext"
|
|
1134
|
-
},
|
|
1184
|
+
}, Ke = (e) => Ge[e], $ = (e) => ({
|
|
1135
1185
|
type: r.Unsupported,
|
|
1136
1186
|
...e != null && { url: e }
|
|
1137
|
-
}),
|
|
1187
|
+
}), qe = (e) => ({
|
|
1138
1188
|
type: r.Error,
|
|
1139
1189
|
errorType: t.LoadFailed,
|
|
1140
1190
|
...e != null && { url: e }
|
|
1141
|
-
}),
|
|
1191
|
+
}), Je = (e) => ({
|
|
1142
1192
|
type: r.Error,
|
|
1143
1193
|
errorType: t.Forbidden,
|
|
1144
1194
|
...e != null && { url: e }
|
|
1145
|
-
}),
|
|
1195
|
+
}), Ye = (e, t) => {
|
|
1146
1196
|
let n = e.toLowerCase();
|
|
1147
1197
|
return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
|
|
1148
|
-
},
|
|
1198
|
+
}, Xe = (e) => {
|
|
1149
1199
|
let t;
|
|
1150
1200
|
try {
|
|
1151
1201
|
t = new URL(e).pathname;
|
|
@@ -1158,13 +1208,13 @@ var Oe = ({ children: e }) => {
|
|
|
1158
1208
|
} catch {
|
|
1159
1209
|
return n;
|
|
1160
1210
|
}
|
|
1161
|
-
},
|
|
1162
|
-
let { openCanvas: n, openCanvasLoading: i, closeCanvas: a } =
|
|
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) => {
|
|
1163
1213
|
if (t.url == null && t.referenceUrl != null) {
|
|
1164
1214
|
let r = e.resolveReferencePdfContent(t);
|
|
1165
1215
|
if (r != null) return n(r, t.name, i), !0;
|
|
1166
1216
|
}
|
|
1167
|
-
let a = t.contentType.toLowerCase(), s =
|
|
1217
|
+
let a = t.contentType.toLowerCase(), s = Ye(a, o);
|
|
1168
1218
|
if (s != null) {
|
|
1169
1219
|
let r = await e.resolveVisualizerContent(t, s, c);
|
|
1170
1220
|
if (r != null) return n(r, t.name, i), !0;
|
|
@@ -1173,14 +1223,14 @@ var Oe = ({ children: e }) => {
|
|
|
1173
1223
|
let r = await e.resolveTextContent(t);
|
|
1174
1224
|
if (r != null) return n(r, t.name, i), !0;
|
|
1175
1225
|
}
|
|
1176
|
-
let l =
|
|
1226
|
+
let l = Q("", a);
|
|
1177
1227
|
if (l != null) return n(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
|
|
1178
1228
|
switch (a) {
|
|
1179
1229
|
case d.PDF: return n(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
|
|
1180
1230
|
case d.Markdown: return n(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
|
|
1181
1231
|
case d.JSON: return n(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
|
|
1182
1232
|
}
|
|
1183
|
-
let f = t.name ?? "", p = f.lastIndexOf("."), m = p === -1 ? "" : f.slice(p + 1).toLowerCase(), h =
|
|
1233
|
+
let f = t.name ?? "", p = f.lastIndexOf("."), m = p === -1 ? "" : f.slice(p + 1).toLowerCase(), h = Q(f);
|
|
1184
1234
|
if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, i), !0;
|
|
1185
1235
|
switch (m) {
|
|
1186
1236
|
case u.Markdown:
|
|
@@ -1197,8 +1247,8 @@ var Oe = ({ children: e }) => {
|
|
|
1197
1247
|
return r == null ? !1 : (n(r, t.name, i), !0);
|
|
1198
1248
|
}
|
|
1199
1249
|
}
|
|
1200
|
-
let g = t.name != null &&
|
|
1201
|
-
if (t.name != null && !
|
|
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;
|
|
1202
1252
|
if (g) {
|
|
1203
1253
|
let a = await e.resolveHtmlContent(t);
|
|
1204
1254
|
return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, i), !0) : t.url == null ? !1 : (n({
|
|
@@ -1206,7 +1256,7 @@ var Oe = ({ children: e }) => {
|
|
|
1206
1256
|
url: t.url
|
|
1207
1257
|
}, t.name, i), !0) : (n(a, t.name, i), !0);
|
|
1208
1258
|
}
|
|
1209
|
-
let _ = await e.resolveCodeContent(t,
|
|
1259
|
+
let _ = await e.resolveCodeContent(t, Ke(m));
|
|
1210
1260
|
return _ == null ? !1 : (n(_, t.name, i), !0);
|
|
1211
1261
|
}, [
|
|
1212
1262
|
n,
|
|
@@ -1214,7 +1264,7 @@ var Oe = ({ children: e }) => {
|
|
|
1214
1264
|
c,
|
|
1215
1265
|
e
|
|
1216
1266
|
]);
|
|
1217
|
-
return { openAttachmentCanvas:
|
|
1267
|
+
return { openAttachmentCanvas: j(async (t, o = t.id) => {
|
|
1218
1268
|
switch (t.type) {
|
|
1219
1269
|
case s.Image: {
|
|
1220
1270
|
let r = e.resolveImageContent(t);
|
|
@@ -1251,4 +1301,4 @@ var Oe = ({ children: e }) => {
|
|
|
1251
1301
|
]) };
|
|
1252
1302
|
};
|
|
1253
1303
|
//#endregion
|
|
1254
|
-
export {
|
|
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 };
|