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