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