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