@epam/ai-dial-attachment-canvas 1.2.0-dev.2 → 1.2.0-dev.6
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/{attachment-canvas-Bp6WeQws.js → attachment-canvas-nvhW3tKV.js} +3 -1
- package/{bounded-raw-part-cache-BfbSxRIL-DD07NKh9.js → bounded-raw-part-cache-Cg1BsSZQ-DN8p45IK.js} +1111 -1043
- package/{chart-ex-B0DgG3Dt.js → chart-ex-DsESBs97.js} +1 -1
- package/{comment-occurrence-CqejEuts-7SeKCBXk.js → comment-occurrence-C8Y2uoVr-C1cxz2TU.js} +1 -1
- package/{comment-ui-runtime-lXwVOgjW-Be4RALsI.js → comment-ui-runtime-BfE7MJZn-DhQ_eg15.js} +29 -29
- package/comment-ui-runtime-BsK8pmUT-EgWiymew.js +2 -0
- package/{comment-ui-runtime-DEtgcmj7-B1G7PH4z.js → comment-ui-runtime-DcJOYlw--B15auUq-.js} +52 -52
- package/{comments-CAn2A_Xh-CdgNAj0h.js → comments-Diid5ujN-BdQhRNjI.js} +2 -2
- package/components/OoxmlContent/OoxmlContent.d.ts.map +1 -1
- package/{delimited-text-worker-host-DcHj_JZt-DWJmaPag.js → delimited-text-worker-host-BVY-Ecni-AimUmSn0.js} +1 -1
- package/{docx-B9qBTEkj.js → docx-B-VcIRoc.js} +4628 -4580
- package/index.js +564 -564
- package/line-distribute-Dtudnqhs--BYZNgzX.js +1237 -0
- package/{line-metrics-CBbw80Ko-DoOuwYxZ.js → line-metrics-B60C86uh-DfQUk7X1.js} +1 -1
- package/ooxml-highlight-surfaces-CaMjx8u-.js +351 -0
- package/package.json +4 -4
- package/{pptx-dkJw0-Vx.js → pptx-CnoDB8Fv.js} +955 -923
- package/{read-only-comment-decoration-BTnWEeo5-BNhbteYc.js → read-only-comment-decoration-Dz7eTQ4d-Cl3RKKH6.js} +1 -1
- package/{read-only-comment-margin-plStyGfE-mggNAMB_.js → read-only-comment-margin-DkgzASAl-BbDxMI5E.js} +1 -1
- package/render-worker-host-BfbnEChF-D2thMRGX.js +7 -0
- package/render-worker-host-DNL9dWRh-Bky38ZHE.js +7 -0
- package/render-worker-host-IkHrYOci-DbjyHK7U.js +7 -0
- package/{renderer-module-contract-Cu-GKuPd-Bt0YZuzB.js → renderer-module-contract-D91rkYHH-BtfSKxb4.js} +1 -1
- package/test-setup.d.ts +10 -1
- package/test-setup.d.ts.map +1 -1
- package/types/attachment-canvas.d.ts +17 -0
- package/types/attachment-canvas.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/{visible-index-DPoQYSDt-9lRc-2Ik.js → visible-index-BgiHEc1z-BOzE9X5U.js} +7 -7
- package/{xlsx-BAXMTJTG.js → xlsx-Dn0XSlTO.js} +1581 -1556
- package/comment-ui-runtime-TLHustXJ-DWCXG2mL.js +0 -2
- package/line-distribute-IsUGfHXm-DeITjLzJ.js +0 -1234
- package/ooxml-highlight-surfaces-DhK1KJcR.js +0 -294
- 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/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
|
+
}, pe = () => 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
|
+
}), me = 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(pe, [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
|
+
}), he = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ge = 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(me, {
|
|
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: he.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
|
+
}), _e = {
|
|
109
109
|
name: "MCP-UI Host",
|
|
110
110
|
version: "1.0.0"
|
|
111
|
-
},
|
|
111
|
+
}, ve = { openLinks: {} }, U = (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
|
+
}, ye = (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
|
+
}, be = (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, _e, ve, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
|
|
142
142
|
let t = r.current.onOpenLink;
|
|
143
|
-
return (t == null ?
|
|
143
|
+
return (t == null ? U(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 && ye(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,20 +154,20 @@ 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,
|
|
161
161
|
hasFailed: o
|
|
162
162
|
};
|
|
163
|
-
},
|
|
163
|
+
}, W = {
|
|
164
164
|
loadingOverlay: "_loadingOverlay_1aric_1",
|
|
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
|
+
}, xe = ({ 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 } = be(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 && W.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,25 +199,25 @@ 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", W.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
|
-
className:
|
|
211
|
+
className: W.errorIcon
|
|
212
212
|
}), /* @__PURE__ */ R("p", {
|
|
213
213
|
role: "alert",
|
|
214
|
-
className:
|
|
214
|
+
className: g("text-center", W.statusLabel),
|
|
215
215
|
children: t
|
|
216
216
|
})]
|
|
217
217
|
})
|
|
218
218
|
]
|
|
219
219
|
});
|
|
220
|
-
},
|
|
220
|
+
}, G = {
|
|
221
221
|
viewer: "_viewer_1w97n_2",
|
|
222
222
|
spreadsheetCanvas: "_spreadsheetCanvas_1w97n_6",
|
|
223
223
|
formulaPanel: "_formulaPanel_1w97n_12",
|
|
@@ -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
|
+
}, Se = (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
|
+
}, Ce = 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("./docx-B-VcIRoc.js"), import("./chart-ex-DsESBs97.js")]);
|
|
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("./xlsx-Dn0XSlTO.js"), import("./chart-ex-DsESBs97.js")]);
|
|
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("./xlsx-
|
|
256
|
-
|
|
257
|
-
let i = new t(
|
|
254
|
+
case r.Csv: {
|
|
255
|
+
let { XlsxSheetViewer: t } = await import("./xlsx-Dn0XSlTO.js"), r = document.createElement("canvas");
|
|
256
|
+
r.className = G.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("./pptx-CnoDB8Fv.js"), import("./chart-ex-DsESBs97.js")]);
|
|
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
|
+
}, we = 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("./docx-
|
|
282
|
-
import("./chart-ex-
|
|
283
|
-
import("./ooxml-highlight-surfaces-
|
|
281
|
+
import("./docx-B-VcIRoc.js"),
|
|
282
|
+
import("./chart-ex-DsESBs97.js"),
|
|
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 Te();
|
|
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("./pptx-
|
|
302
|
-
import("./chart-ex-
|
|
303
|
-
import("./ooxml-highlight-surfaces-
|
|
301
|
+
import("./pptx-CnoDB8Fv.js"),
|
|
302
|
+
import("./chart-ex-DsESBs97.js"),
|
|
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 Te();
|
|
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("./xlsx-
|
|
322
|
-
import("./chart-ex-
|
|
323
|
-
import("./ooxml-highlight-surfaces-
|
|
321
|
+
import("./xlsx-Dn0XSlTO.js"),
|
|
322
|
+
import("./chart-ex-DsESBs97.js"),
|
|
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 Ce(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
|
+
}, Te = class extends Error {}, Ee = ({ 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(Se(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 we(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 Ce(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 Te || 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", G.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", G.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", G.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", G.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", G.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:
|
|
486
|
-
className:
|
|
485
|
+
stroke: S,
|
|
486
|
+
className: G.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
|
+
}, De = {
|
|
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
|
+
}, Oe = ({ 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,28 +540,28 @@ 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", De.loadingOverlay),
|
|
544
|
+
children: [/* @__PURE__ */ R(T, {}), t && /* @__PURE__ */ R("p", {
|
|
545
|
+
className: g("text-center", De.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: De.errorIcon
|
|
556
556
|
}), /* @__PURE__ */ R("p", {
|
|
557
557
|
role: "alert",
|
|
558
|
-
className:
|
|
558
|
+
className: g("text-center", De.statusLabel),
|
|
559
559
|
children: n
|
|
560
560
|
})]
|
|
561
561
|
})
|
|
562
562
|
]
|
|
563
563
|
});
|
|
564
|
-
},
|
|
564
|
+
}, K = {
|
|
565
565
|
body: "_body_13ogb_4",
|
|
566
566
|
statusLabel: "_statusLabel_13ogb_13",
|
|
567
567
|
errorIcon: "_errorIcon_13ogb_17",
|
|
@@ -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
|
+
}, ke = () => A(async () => ({ default: (await import("./PdfContent-D71LPAe3.js")).PdfContent })), Ae = ({ 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:
|
|
588
|
-
className:
|
|
587
|
+
stroke: S,
|
|
588
|
+
className: K.errorIcon
|
|
589
589
|
}), /* @__PURE__ */ R("p", {
|
|
590
|
-
className:
|
|
590
|
+
className: g("text-center", K.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:
|
|
599
|
+
}, je = new Set([
|
|
600
|
+
i.PlainText,
|
|
601
|
+
i.Code,
|
|
602
|
+
i.Ooxml
|
|
603
|
+
]), Me = 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 ?? {}, [pe, he] = L(0), _e = F(ke, [pe]), ve = M(() => {
|
|
605
605
|
he((e) => e + 1);
|
|
606
|
-
}, []),
|
|
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":
|
|
632
|
-
"--ac-font-size":
|
|
633
|
-
"--ac-font-weight":
|
|
634
|
-
"--ac-line-height":
|
|
635
|
-
"--ac-letter-spacing":
|
|
606
|
+
}, []), U = H?.fontClassName != null, ye = 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": U ? void 0 : H?.fontFamily,
|
|
632
|
+
"--ac-font-size": U ? void 0 : H?.fontSize,
|
|
633
|
+
"--ac-font-weight": U ? void 0 : H?.fontWeight,
|
|
634
|
+
"--ac-line-height": U ? void 0 : H?.lineHeight,
|
|
635
|
+
"--ac-letter-spacing": U ? void 0 : H?.letterSpacing
|
|
636
636
|
}),
|
|
637
|
-
...
|
|
638
|
-
}), [
|
|
637
|
+
...fe
|
|
638
|
+
}), [P]), be = 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]), W = 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", K.body, H?.fontClassName),
|
|
659
659
|
children: e.text
|
|
660
660
|
});
|
|
661
|
-
case
|
|
661
|
+
case i.Image: return /* @__PURE__ */ R(Ae, {
|
|
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,342 +674,342 @@ 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", K.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:
|
|
717
|
-
stringValue:
|
|
718
|
-
booleanValue:
|
|
719
|
-
numberValue:
|
|
720
|
-
otherValue:
|
|
721
|
-
punctuation:
|
|
722
|
-
collapseIcon:
|
|
723
|
-
expandIcon:
|
|
724
|
-
collapsedContent:
|
|
713
|
+
label: g("me-1 font-semibold", K.jsonLabel),
|
|
714
|
+
clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", K.jsonClickableLabel),
|
|
715
|
+
nullValue: g("italic", K.jsonNullValue),
|
|
716
|
+
undefinedValue: g("italic", K.jsonNullValue),
|
|
717
|
+
stringValue: K.jsonStringValue,
|
|
718
|
+
booleanValue: K.jsonBooleanValue,
|
|
719
|
+
numberValue: K.jsonNumberValue,
|
|
720
|
+
otherValue: g("italic", K.jsonNullValue),
|
|
721
|
+
punctuation: g("me-1", K.jsonPunctuation),
|
|
722
|
+
collapseIcon: g("me-1 cursor-pointer select-none transition-colors", K.jsonCollapseIcon),
|
|
723
|
+
expandIcon: g("me-1 cursor-pointer select-none transition-colors", K.jsonExpandIcon),
|
|
724
|
+
collapsedContent: g("me-1 cursor-pointer rounded px-1", K.jsonCollapsedContent)
|
|
725
725
|
}
|
|
726
726
|
})
|
|
727
727
|
})
|
|
728
728
|
});
|
|
729
|
-
case
|
|
729
|
+
case i.Code: return /* @__PURE__ */ R(me, {
|
|
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(ge, {
|
|
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
|
|
748
|
+
case i.Pdf: return /* @__PURE__ */ R(s, {
|
|
749
749
|
retryKey: pe,
|
|
750
|
-
onRetry:
|
|
750
|
+
onRetry: ve,
|
|
751
751
|
labels: {
|
|
752
|
-
loadingLabel:
|
|
752
|
+
loadingLabel: x,
|
|
753
753
|
errorLabel: C,
|
|
754
|
-
retryLabel:
|
|
754
|
+
retryLabel: w
|
|
755
755
|
},
|
|
756
|
-
children: /* @__PURE__ */ R(
|
|
757
|
-
fileName:
|
|
756
|
+
children: /* @__PURE__ */ R(_e, {
|
|
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(Ee, {
|
|
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(Oe, {
|
|
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(xe, { content: e });
|
|
790
|
+
case i.Unsupported: return /* @__PURE__ */ R("p", {
|
|
791
|
+
className: g("text-center", K.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:
|
|
801
|
-
className:
|
|
800
|
+
stroke: S,
|
|
801
|
+
className: K.errorIcon
|
|
802
802
|
}), /* @__PURE__ */ R("p", {
|
|
803
|
-
className:
|
|
804
|
-
children:
|
|
803
|
+
className: g("text-center", K.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
|
-
ge,
|
|
839
|
-
pe,
|
|
840
838
|
_e,
|
|
839
|
+
pe,
|
|
840
|
+
ve,
|
|
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 && je.has(e.type) ? ye : void 0,
|
|
851
|
+
className: g(t ? "flex h-full items-center justify-center" : be, de),
|
|
852
|
+
children: t ? /* @__PURE__ */ R(T, {}) : W
|
|
853
853
|
});
|
|
854
|
-
}),
|
|
855
|
-
let [
|
|
856
|
-
|
|
857
|
-
}, [
|
|
858
|
-
|
|
859
|
-
}, [
|
|
860
|
-
|
|
861
|
-
}, [
|
|
862
|
-
|
|
854
|
+
}), Ne = 2e3, Pe = 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: pe, tableCopyCsvLabel: me, tableCopyTxtLabel: he, tableCopyMarkdownLabel: ge, tableCopiedLabel: _e, tableDownloadCsvLabel: ve, ooxmlHighlightsLabel: U, ooxmlHighlightNavigatedLabel: ye }, onDownload: be, onCopyText: W, onCopyMarkdown: xe, onCopyJson: G, tableDownloadFilename: Se, isMobile: Ce = !1, defaultWidth: we, minWidth: Te = 600, maxWidth: Ee = 1500, onResizeStop: De, styles: Oe, codeBlockTheme: K, loadPdf: ke, configurePdfWorker: Ae }) => {
|
|
855
|
+
let [je, Pe] = L(!1), [Fe, Ie] = L(!1), [q, Le] = L(!1), [J, Re] = L(!1), Y = I(null), X = I(null), Z = I(null), ze = M(() => {
|
|
856
|
+
W?.(), Y.current != null && clearTimeout(Y.current), Pe(!0), Y.current = setTimeout(() => Pe(!1), Ne);
|
|
857
|
+
}, [W]), Be = M(() => {
|
|
858
|
+
xe?.(), X.current != null && clearTimeout(X.current), Ie(!0), X.current = setTimeout(() => Ie(!1), Ne);
|
|
859
|
+
}, [xe]), Ve = M(() => {
|
|
860
|
+
G?.(), Z.current != null && clearTimeout(Z.current), Le(!0), Z.current = setTimeout(() => Le(!1), Ne);
|
|
861
|
+
}, [G]);
|
|
862
|
+
P(() => () => {
|
|
863
863
|
Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
|
|
864
864
|
}, []);
|
|
865
|
-
let
|
|
865
|
+
let Q = M(() => {
|
|
866
866
|
Re((e) => !e);
|
|
867
867
|
}, []);
|
|
868
|
-
|
|
868
|
+
P(() => {
|
|
869
869
|
Re(!1);
|
|
870
|
-
}, [
|
|
871
|
-
let { className: He, panelStyles: Ue, ...We } =
|
|
872
|
-
return /* @__PURE__ */ R(
|
|
870
|
+
}, [r]);
|
|
871
|
+
let { className: He, panelStyles: Ue, ...We } = Oe ?? {}, Ge = !t && r.type === i.Html && r.srcdoc != null, Ke = !t && W != null && (r.type === i.PlainText || r.type === i.Code), qe = !t && xe != null && r.type === i.Markdown, $ = !t && G != null && r.type === i.Json, Je = !t && be != 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,
|
|
879
879
|
resizeLabel: l
|
|
880
880
|
},
|
|
881
881
|
onClose: n,
|
|
882
|
-
resizable: !
|
|
883
|
-
defaultWidth:
|
|
884
|
-
minWidth:
|
|
885
|
-
maxWidth:
|
|
886
|
-
onResizeStop:
|
|
882
|
+
resizable: !Ce,
|
|
883
|
+
defaultWidth: we,
|
|
884
|
+
minWidth: Te,
|
|
885
|
+
maxWidth: Ee,
|
|
886
|
+
onResizeStop: De,
|
|
887
887
|
styles: {
|
|
888
888
|
...Ue,
|
|
889
889
|
titleClassName: Ue?.titleClassName ?? "dial-h3-text",
|
|
890
|
-
headerClassName:
|
|
891
|
-
className:
|
|
890
|
+
headerClassName: g("border-b border-tertiary", Ue?.headerClassName),
|
|
891
|
+
className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", He, Ue?.className)
|
|
892
892
|
},
|
|
893
|
-
rightActions: Ge || Ke ||
|
|
894
|
-
Ye && /* @__PURE__ */ R(
|
|
893
|
+
rightActions: 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
|
-
Ge && /* @__PURE__ */ R(
|
|
905
|
-
icon: R(J ? te :
|
|
906
|
-
size:
|
|
907
|
-
stroke:
|
|
904
|
+
Ge && /* @__PURE__ */ R(C, {
|
|
905
|
+
icon: R(J ? te : O, {
|
|
906
|
+
size: x.LG,
|
|
907
|
+
stroke: S,
|
|
908
908
|
"aria-hidden": !0
|
|
909
909
|
}),
|
|
910
|
-
"aria-label": J ?
|
|
910
|
+
"aria-label": J ? j : A,
|
|
911
911
|
"aria-pressed": J,
|
|
912
|
-
tooltipProps: { tooltip: J ?
|
|
913
|
-
onClick:
|
|
912
|
+
tooltipProps: { tooltip: J ? j : A },
|
|
913
|
+
onClick: Q
|
|
914
914
|
}),
|
|
915
|
-
Ke && /* @__PURE__ */ R(
|
|
916
|
-
icon: R(
|
|
917
|
-
size:
|
|
918
|
-
stroke:
|
|
915
|
+
Ke && /* @__PURE__ */ R(C, {
|
|
916
|
+
icon: R(je ? D : k, {
|
|
917
|
+
size: x.LG,
|
|
918
|
+
stroke: S,
|
|
919
919
|
"aria-hidden": !0
|
|
920
920
|
}),
|
|
921
|
-
"aria-label":
|
|
922
|
-
tooltipProps: { tooltip:
|
|
921
|
+
"aria-label": je ? f : d,
|
|
922
|
+
tooltipProps: { tooltip: je ? f : d },
|
|
923
923
|
onClick: ze
|
|
924
924
|
}),
|
|
925
|
-
|
|
926
|
-
icon: R(
|
|
927
|
-
size:
|
|
928
|
-
stroke:
|
|
925
|
+
qe && /* @__PURE__ */ R(C, {
|
|
926
|
+
icon: R(Fe ? D : re, {
|
|
927
|
+
size: x.LG,
|
|
928
|
+
stroke: S,
|
|
929
929
|
"aria-hidden": !0
|
|
930
930
|
}),
|
|
931
|
-
"aria-label":
|
|
932
|
-
tooltipProps: { tooltip:
|
|
931
|
+
"aria-label": Fe ? m : p,
|
|
932
|
+
tooltipProps: { tooltip: Fe ? m : p },
|
|
933
933
|
onClick: Be
|
|
934
934
|
}),
|
|
935
|
-
|
|
936
|
-
icon: R(
|
|
937
|
-
size:
|
|
938
|
-
stroke:
|
|
935
|
+
$ && /* @__PURE__ */ R(C, {
|
|
936
|
+
icon: R(q ? 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": q ? _ : h,
|
|
942
|
+
tooltipProps: { tooltip: q ? _ : h },
|
|
943
|
+
onClick: Ve
|
|
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: be
|
|
953
953
|
})
|
|
954
954
|
] }) : null,
|
|
955
|
-
children: /* @__PURE__ */ R(
|
|
956
|
-
content:
|
|
955
|
+
children: /* @__PURE__ */ R(Me, {
|
|
956
|
+
content: r,
|
|
957
957
|
isLoading: t,
|
|
958
|
-
fileName:
|
|
958
|
+
fileName: a,
|
|
959
959
|
isHtmlSourceView: J,
|
|
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:
|
|
978
|
-
tableCopyCsvLabel:
|
|
979
|
-
tableCopyTxtLabel:
|
|
980
|
-
tableCopyMarkdownLabel:
|
|
981
|
-
tableCopiedLabel:
|
|
982
|
-
tableDownloadCsvLabel:
|
|
983
|
-
ooxmlHighlightsLabel:
|
|
984
|
-
ooxmlHighlightNavigatedLabel:
|
|
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: pe,
|
|
978
|
+
tableCopyCsvLabel: me,
|
|
979
|
+
tableCopyTxtLabel: he,
|
|
980
|
+
tableCopyMarkdownLabel: ge,
|
|
981
|
+
tableCopiedLabel: _e,
|
|
982
|
+
tableDownloadCsvLabel: ve,
|
|
983
|
+
ooxmlHighlightsLabel: U,
|
|
984
|
+
ooxmlHighlightNavigatedLabel: ye
|
|
985
985
|
},
|
|
986
986
|
styles: We,
|
|
987
|
-
codeBlockTheme:
|
|
988
|
-
tableDownloadFilename:
|
|
989
|
-
loadPdf:
|
|
990
|
-
configurePdfWorker:
|
|
987
|
+
codeBlockTheme: K,
|
|
988
|
+
tableDownloadFilename: Se,
|
|
989
|
+
loadPdf: ke,
|
|
990
|
+
configurePdfWorker: Ae
|
|
991
991
|
})
|
|
992
992
|
});
|
|
993
|
-
}),
|
|
994
|
-
type:
|
|
993
|
+
}), Fe = {
|
|
994
|
+
type: i.PlainText,
|
|
995
995
|
text: ""
|
|
996
|
-
},
|
|
997
|
-
if (!(e.type !==
|
|
998
|
-
},
|
|
999
|
-
|
|
1000
|
-
var
|
|
1001
|
-
let [t, n] =
|
|
996
|
+
}, Ie = (e) => {
|
|
997
|
+
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;
|
|
998
|
+
}, q = ae(void 0);
|
|
999
|
+
q.displayName = "AttachmentCanvasContext";
|
|
1000
|
+
var Le = ({ children: e }) => {
|
|
1001
|
+
let [t, n] = L(!1), [r, i] = L(!1), [a, o] = L(Fe), [s, c] = L(void 0), [l, u] = L(void 0), d = M((e, t) => {
|
|
1002
1002
|
c(e), u(t), i(!0), n(!0);
|
|
1003
|
-
}, []), f =
|
|
1003
|
+
}, []), f = M((e, t, r) => {
|
|
1004
1004
|
o(e), c(t), u(r), i(!1), n(!0);
|
|
1005
|
-
}, []), p =
|
|
1006
|
-
o(
|
|
1005
|
+
}, []), p = M(() => {
|
|
1006
|
+
o(Fe), n(!1), i(!1), u(void 0);
|
|
1007
1007
|
}, []);
|
|
1008
|
-
return
|
|
1009
|
-
let e =
|
|
1008
|
+
return P(() => () => {
|
|
1009
|
+
let e = Ie(a);
|
|
1010
1010
|
e != null && URL.revokeObjectURL(e);
|
|
1011
|
-
}, [a]), /* @__PURE__ */ R(
|
|
1012
|
-
value:
|
|
1011
|
+
}, [a]), /* @__PURE__ */ R(q.Provider, {
|
|
1012
|
+
value: F(() => ({
|
|
1013
1013
|
isOpen: t,
|
|
1014
1014
|
isLoading: r,
|
|
1015
1015
|
content: a,
|
|
@@ -1030,26 +1030,26 @@ var Ie = ({ children: e }) => {
|
|
|
1030
1030
|
]),
|
|
1031
1031
|
children: e
|
|
1032
1032
|
});
|
|
1033
|
-
},
|
|
1034
|
-
let e =
|
|
1033
|
+
}, J = () => {
|
|
1034
|
+
let e = N(q);
|
|
1035
1035
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
1036
1036
|
return e;
|
|
1037
|
-
},
|
|
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:
|
|
1039
|
-
|
|
1040
|
-
}, [
|
|
1041
|
-
(
|
|
1042
|
-
}, [
|
|
1043
|
-
|
|
1044
|
-
}, [
|
|
1045
|
-
|
|
1046
|
-
}, [
|
|
1047
|
-
return /* @__PURE__ */ R(
|
|
1048
|
-
isOpen:
|
|
1049
|
-
isLoading:
|
|
1050
|
-
onClose:
|
|
1051
|
-
content:
|
|
1052
|
-
fileName:
|
|
1037
|
+
}, Re = j(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, 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: 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 } = J(), ue = M(() => {
|
|
1039
|
+
a(z, B);
|
|
1040
|
+
}, [z, B]), V = M(() => {
|
|
1041
|
+
(z.type === i.PlainText || z.type === i.Code) && h(z.text);
|
|
1042
|
+
}, [z]), H = M(() => {
|
|
1043
|
+
z.type === i.Markdown && h(z.text);
|
|
1044
|
+
}, [z]), de = M(() => {
|
|
1045
|
+
z.type === i.Json && h(JSON.stringify(z.value, null, 2));
|
|
1046
|
+
}, [z]);
|
|
1047
|
+
return /* @__PURE__ */ R(Pe, {
|
|
1048
|
+
isOpen: se,
|
|
1049
|
+
isLoading: ce,
|
|
1050
|
+
onClose: le,
|
|
1051
|
+
content: z,
|
|
1052
|
+
fileName: B,
|
|
1053
1053
|
labels: {
|
|
1054
1054
|
ariaLabel: l,
|
|
1055
1055
|
closeLabel: u,
|
|
@@ -1062,7 +1062,7 @@ var Ie = ({ children: e }) => {
|
|
|
1062
1062
|
copiedJsonLabel: x,
|
|
1063
1063
|
unsupportedLabel: f,
|
|
1064
1064
|
loadErrorLabel: p,
|
|
1065
|
-
forbiddenErrorLabel:
|
|
1065
|
+
forbiddenErrorLabel: m,
|
|
1066
1066
|
htmlFrameBlockedLabel: S,
|
|
1067
1067
|
htmlOpenInNewTabLabel: C,
|
|
1068
1068
|
htmlViewSourceLabel: w,
|
|
@@ -1070,70 +1070,70 @@ var Ie = ({ children: e }) => {
|
|
|
1070
1070
|
pdfThumbnailsLabel: E,
|
|
1071
1071
|
pdfShowThumbnailsLabel: D,
|
|
1072
1072
|
pdfHideThumbnailsLabel: O,
|
|
1073
|
-
pdfPageNumberLabel:
|
|
1074
|
-
pdfContentLoadingLabel:
|
|
1075
|
-
pdfContentErrorLabel:
|
|
1076
|
-
pdfContentRetryLabel:
|
|
1077
|
-
xlsxFormulaLabel:
|
|
1078
|
-
codeContentLoadingLabel:
|
|
1079
|
-
codeContentErrorLabel:
|
|
1073
|
+
pdfPageNumberLabel: k,
|
|
1074
|
+
pdfContentLoadingLabel: ee,
|
|
1075
|
+
pdfContentErrorLabel: te,
|
|
1076
|
+
pdfContentRetryLabel: ne,
|
|
1077
|
+
xlsxFormulaLabel: re,
|
|
1078
|
+
codeContentLoadingLabel: ie,
|
|
1079
|
+
codeContentErrorLabel: ae,
|
|
1080
1080
|
codeContentRetryLabel: A,
|
|
1081
|
-
tableCopyCsvLabel:
|
|
1081
|
+
tableCopyCsvLabel: j,
|
|
1082
1082
|
tableCopyTxtLabel: N,
|
|
1083
1083
|
tableCopyMarkdownLabel: P,
|
|
1084
1084
|
tableCopiedLabel: F,
|
|
1085
1085
|
tableDownloadCsvLabel: I,
|
|
1086
|
-
ooxmlHighlightsLabel:
|
|
1087
|
-
ooxmlHighlightNavigatedLabel:
|
|
1086
|
+
ooxmlHighlightsLabel: L,
|
|
1087
|
+
ooxmlHighlightNavigatedLabel: oe
|
|
1088
1088
|
},
|
|
1089
|
-
onDownload:
|
|
1090
|
-
onCopyText:
|
|
1091
|
-
onCopyMarkdown:
|
|
1092
|
-
onCopyJson:
|
|
1089
|
+
onDownload: ue,
|
|
1090
|
+
onCopyText: z.type === i.PlainText || z.type === i.Code ? V : void 0,
|
|
1091
|
+
onCopyMarkdown: z.type === i.Markdown ? H : void 0,
|
|
1092
|
+
onCopyJson: z.type === i.Json ? de : void 0,
|
|
1093
1093
|
tableDownloadFilename: s,
|
|
1094
1094
|
isMobile: t,
|
|
1095
1095
|
defaultWidth: n,
|
|
1096
|
-
maxWidth:
|
|
1096
|
+
maxWidth: r,
|
|
1097
1097
|
codeBlockTheme: o,
|
|
1098
1098
|
configurePdfWorker: c
|
|
1099
1099
|
});
|
|
1100
|
-
}),
|
|
1100
|
+
}), Y = new Set(["html", "htm"]), X = {
|
|
1101
1101
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1102
1102
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1103
1103
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
1104
|
-
},
|
|
1105
|
-
docx:
|
|
1106
|
-
xlsx:
|
|
1107
|
-
pptx:
|
|
1108
|
-
csv:
|
|
1109
|
-
}, ze = {
|
|
1110
|
-
[Y.docx]: n.Docx,
|
|
1111
|
-
[Y.xlsx]: n.Xlsx,
|
|
1112
|
-
[Y.pptx]: n.Pptx,
|
|
1113
|
-
[d.CSV]: n.Csv
|
|
1104
|
+
}, Z = 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(".")), ze = {
|
|
1105
|
+
docx: r.Docx,
|
|
1106
|
+
xlsx: r.Xlsx,
|
|
1107
|
+
pptx: r.Pptx,
|
|
1108
|
+
csv: r.Csv
|
|
1114
1109
|
}, Be = {
|
|
1115
|
-
[
|
|
1116
|
-
[
|
|
1117
|
-
[
|
|
1118
|
-
[
|
|
1110
|
+
[X.docx]: r.Docx,
|
|
1111
|
+
[X.xlsx]: r.Xlsx,
|
|
1112
|
+
[X.pptx]: r.Pptx,
|
|
1113
|
+
[f.CSV]: r.Csv
|
|
1114
|
+
}, Ve = {
|
|
1115
|
+
[r.Docx]: X.docx,
|
|
1116
|
+
[r.Xlsx]: X.xlsx,
|
|
1117
|
+
[r.Pptx]: X.pptx,
|
|
1118
|
+
[r.Csv]: f.CSV
|
|
1119
1119
|
}, Q = (e, t) => {
|
|
1120
1120
|
let n = t?.split(";", 1)[0].trim().toLowerCase();
|
|
1121
1121
|
if (n != null) {
|
|
1122
|
-
let e =
|
|
1122
|
+
let e = Be[n];
|
|
1123
1123
|
if (e != null) return e;
|
|
1124
1124
|
}
|
|
1125
1125
|
let r = e.lastIndexOf(".");
|
|
1126
|
-
if (r !== -1) return
|
|
1127
|
-
},
|
|
1126
|
+
if (r !== -1) return ze[e.slice(r + 1).toLowerCase()];
|
|
1127
|
+
}, He = (e, t) => Q(e, t) != null, Ue = (e, t) => {
|
|
1128
1128
|
let n = Q(e, t);
|
|
1129
|
-
return n == null ? void 0 :
|
|
1130
|
-
}, Ue = (e) => {
|
|
1131
|
-
let t = e.lastIndexOf(".");
|
|
1132
|
-
return t === -1 ? !1 : X.has(e.slice(t + 1).toLowerCase());
|
|
1129
|
+
return n == null ? void 0 : Ve[n];
|
|
1133
1130
|
}, We = (e) => {
|
|
1134
1131
|
let t = e.lastIndexOf(".");
|
|
1135
|
-
return t === -1 ? !1 :
|
|
1136
|
-
}, Ge = {
|
|
1132
|
+
return t === -1 ? !1 : Z.has(e.slice(t + 1).toLowerCase());
|
|
1133
|
+
}, Ge = (e) => {
|
|
1134
|
+
let t = e.lastIndexOf(".");
|
|
1135
|
+
return t === -1 ? !1 : Y.has(e.slice(t + 1).toLowerCase());
|
|
1136
|
+
}, Ke = {
|
|
1137
1137
|
xml: "xml",
|
|
1138
1138
|
csv: "plaintext",
|
|
1139
1139
|
tsv: "plaintext",
|
|
@@ -1181,26 +1181,26 @@ var Ie = ({ children: e }) => {
|
|
|
1181
1181
|
gitignore: "plaintext",
|
|
1182
1182
|
dockerfile: "plaintext",
|
|
1183
1183
|
makefile: "plaintext"
|
|
1184
|
-
},
|
|
1185
|
-
type:
|
|
1186
|
-
...e != null && { url: e }
|
|
1187
|
-
}), qe = (e) => ({
|
|
1188
|
-
type: r.Error,
|
|
1189
|
-
errorType: t.LoadFailed,
|
|
1184
|
+
}, qe = (e) => Ke[e], $ = (e) => ({
|
|
1185
|
+
type: i.Unsupported,
|
|
1190
1186
|
...e != null && { url: e }
|
|
1191
1187
|
}), Je = (e) => ({
|
|
1192
|
-
type:
|
|
1193
|
-
errorType:
|
|
1188
|
+
type: i.Error,
|
|
1189
|
+
errorType: n.LoadFailed,
|
|
1190
|
+
...e != null && { url: e }
|
|
1191
|
+
}), Ye = (e) => ({
|
|
1192
|
+
type: i.Error,
|
|
1193
|
+
errorType: n.Forbidden,
|
|
1194
1194
|
...e != null && { url: e }
|
|
1195
|
-
}),
|
|
1195
|
+
}), Xe = (e, t) => {
|
|
1196
1196
|
let n = e.toLowerCase();
|
|
1197
1197
|
return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
|
|
1198
|
-
},
|
|
1198
|
+
}, Ze = (e) => {
|
|
1199
1199
|
let t;
|
|
1200
1200
|
try {
|
|
1201
1201
|
t = new URL(e).pathname;
|
|
1202
1202
|
} catch {
|
|
1203
|
-
t =
|
|
1203
|
+
t = v(e);
|
|
1204
1204
|
}
|
|
1205
1205
|
let n = t.split("/").filter(Boolean).pop() ?? "";
|
|
1206
1206
|
try {
|
|
@@ -1208,97 +1208,97 @@ var Ie = ({ children: e }) => {
|
|
|
1208
1208
|
} catch {
|
|
1209
1209
|
return n;
|
|
1210
1210
|
}
|
|
1211
|
-
},
|
|
1212
|
-
let { openCanvas: n, openCanvasLoading:
|
|
1211
|
+
}, Qe = (e, t) => {
|
|
1212
|
+
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = J(), { customVisualizers: o, themeId: s, onBeforeOpen: l } = t, u = M(async (t, r) => {
|
|
1213
1213
|
if (t.url == null && t.referenceUrl != null) {
|
|
1214
|
-
let
|
|
1215
|
-
if (
|
|
1214
|
+
let i = e.resolveReferencePdfContent(t);
|
|
1215
|
+
if (i != null) return n(i, t.name, r), !0;
|
|
1216
1216
|
}
|
|
1217
|
-
let a = t.contentType.toLowerCase(),
|
|
1218
|
-
if (
|
|
1219
|
-
let
|
|
1220
|
-
if (
|
|
1217
|
+
let a = t.contentType.toLowerCase(), c = Xe(a, o);
|
|
1218
|
+
if (c != null) {
|
|
1219
|
+
let i = await e.resolveVisualizerContent(t, c, s);
|
|
1220
|
+
if (i != null) return n(i, t.name, r), !0;
|
|
1221
1221
|
}
|
|
1222
1222
|
if (!a && t.data != null) {
|
|
1223
|
-
let
|
|
1224
|
-
if (
|
|
1223
|
+
let i = await e.resolveTextContent(t);
|
|
1224
|
+
if (i != null) return n(i, t.name, r), !0;
|
|
1225
1225
|
}
|
|
1226
1226
|
let l = Q("", a);
|
|
1227
|
-
if (l != null) return n(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name,
|
|
1227
|
+
if (l != null) return n(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
|
|
1228
1228
|
switch (a) {
|
|
1229
|
-
case
|
|
1230
|
-
case
|
|
1231
|
-
case
|
|
1229
|
+
case f.PDF: return n(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
|
|
1230
|
+
case f.Markdown: return n(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
|
|
1231
|
+
case f.JSON: return n(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
|
|
1232
1232
|
}
|
|
1233
|
-
let
|
|
1234
|
-
if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name,
|
|
1233
|
+
let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h = Q(u);
|
|
1234
|
+
if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
|
|
1235
1235
|
switch (m) {
|
|
1236
|
-
case
|
|
1237
|
-
case
|
|
1238
|
-
let
|
|
1239
|
-
return
|
|
1236
|
+
case d.Markdown:
|
|
1237
|
+
case d.MarkdownAlt: {
|
|
1238
|
+
let i = await e.resolveMarkdownContent(t);
|
|
1239
|
+
return i == null ? !1 : (n(i, t.name, r), !0);
|
|
1240
1240
|
}
|
|
1241
|
-
case
|
|
1242
|
-
let
|
|
1243
|
-
return
|
|
1241
|
+
case d.JSON: {
|
|
1242
|
+
let i = await e.resolveJsonContent(t);
|
|
1243
|
+
return i == null ? !1 : (n(i, t.name, r), !0);
|
|
1244
1244
|
}
|
|
1245
|
-
case
|
|
1246
|
-
let
|
|
1247
|
-
return
|
|
1245
|
+
case d.PDF: {
|
|
1246
|
+
let i = await e.resolvePdfContent(t);
|
|
1247
|
+
return i == null ? !1 : (n(i, t.name, r), !0);
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
|
-
let g = t.name != null &&
|
|
1251
|
-
if (t.name != null && !
|
|
1250
|
+
let g = t.name != null && Ge(t.name) || t.url != null && Ge(Ze(t.url));
|
|
1251
|
+
if (t.name != null && !We(t.name) && !g) return n($(e.resolveContentUrl(t)), t.name, r), !0;
|
|
1252
1252
|
if (g) {
|
|
1253
1253
|
let a = await e.resolveHtmlContent(t);
|
|
1254
|
-
return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name,
|
|
1255
|
-
type:
|
|
1254
|
+
return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, r), !0) : t.url == null ? !1 : (n({
|
|
1255
|
+
type: i.Html,
|
|
1256
1256
|
url: t.url
|
|
1257
|
-
}, t.name,
|
|
1257
|
+
}, t.name, r), !0) : (n(a, t.name, r), !0);
|
|
1258
1258
|
}
|
|
1259
|
-
let _ = await e.resolveCodeContent(t,
|
|
1260
|
-
return _ == null ? !1 : (n(_, t.name,
|
|
1259
|
+
let _ = await e.resolveCodeContent(t, qe(m));
|
|
1260
|
+
return _ == null ? !1 : (n(_, t.name, r), !0);
|
|
1261
1261
|
}, [
|
|
1262
1262
|
n,
|
|
1263
1263
|
o,
|
|
1264
|
-
|
|
1264
|
+
s,
|
|
1265
1265
|
e
|
|
1266
1266
|
]);
|
|
1267
|
-
return { openAttachmentCanvas:
|
|
1267
|
+
return { openAttachmentCanvas: M(async (t, o = t.id) => {
|
|
1268
1268
|
switch (t.type) {
|
|
1269
|
-
case
|
|
1269
|
+
case c.Image: {
|
|
1270
1270
|
let r = e.resolveImageContent(t);
|
|
1271
1271
|
return r == null ? !1 : (l?.(), n(r, t.name, o), !0);
|
|
1272
1272
|
}
|
|
1273
|
-
case
|
|
1273
|
+
case c.Audio: {
|
|
1274
1274
|
let e = t.playUrl ?? t.url;
|
|
1275
1275
|
return e == null ? !1 : (n({
|
|
1276
|
-
type:
|
|
1276
|
+
type: i.Audio,
|
|
1277
1277
|
url: e,
|
|
1278
1278
|
mimeType: t.contentType || void 0
|
|
1279
1279
|
}, t.name, o), !0);
|
|
1280
1280
|
}
|
|
1281
|
-
case
|
|
1282
|
-
l?.(),
|
|
1283
|
-
let e = await
|
|
1281
|
+
case c.File: {
|
|
1282
|
+
l?.(), r(t.name, o);
|
|
1283
|
+
let e = await u(t, o);
|
|
1284
1284
|
return e || a(), e;
|
|
1285
1285
|
}
|
|
1286
|
-
case
|
|
1287
|
-
case
|
|
1288
|
-
l?.(),
|
|
1289
|
-
let
|
|
1290
|
-
return
|
|
1286
|
+
case c.Pasted:
|
|
1287
|
+
case c.Prompt: {
|
|
1288
|
+
l?.(), r(t.name, o);
|
|
1289
|
+
let i = await e.resolveTextContent(t);
|
|
1290
|
+
return i == null ? (a(), !1) : (n(i, t.name, o), !0);
|
|
1291
1291
|
}
|
|
1292
1292
|
default: return !1;
|
|
1293
1293
|
}
|
|
1294
1294
|
}, [
|
|
1295
1295
|
n,
|
|
1296
|
-
|
|
1296
|
+
r,
|
|
1297
1297
|
a,
|
|
1298
1298
|
l,
|
|
1299
|
-
|
|
1299
|
+
u,
|
|
1300
1300
|
e
|
|
1301
1301
|
]) };
|
|
1302
1302
|
};
|
|
1303
1303
|
//#endregion
|
|
1304
|
-
export {
|
|
1304
|
+
export { Pe as AttachmentCanvas, Me as AttachmentCanvasBody, Re as AttachmentCanvasContainer, Le as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, me as CodeContent, xe as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, Ye as createForbiddenCanvasContent, Je as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, a as downloadAttachmentContent, qe as extensionToLanguage, Xe as findVisualizerForMime, Q as getOoxmlFileType, Ue as getOoxmlMimeType, o as isDownloadable, Ge as isHtmlPreviewable, He as isOoxmlPreviewable, We as isTextPreviewable, J as useAttachmentCanvas, Qe as useOpenAttachmentCanvas };
|