@epam/ai-dial-attachment-canvas 1.2.0-dev.11 → 1.2.0-dev.111
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/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts +3 -0
- package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts.map +1 -1
- package/components/OoxmlContent/OoxmlContent.d.ts.map +1 -1
- 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/useMcpAppBridge/useMcpAppBridge.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 +595 -475
- package/models/attachment-canvas.d.ts +52 -11
- 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
|
|
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 P, useEffect as F, useMemo as I, useRef as L, useState as R } from "react";
|
|
8
|
+
import { JsonView as se, defaultStyles as ce } from "react-json-view-lite";
|
|
9
|
+
import { Fragment as le, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
10
|
+
import { AppBridge as V, AppFrame as H } from "@mcp-ui/client";
|
|
11
11
|
import { McpUiHostContextChangedNotificationSchema as ue } from "@modelcontextprotocol/ext-apps/app-bridge";
|
|
12
|
-
import { VisualizerConnectorRequests as
|
|
13
|
-
import { VisualizerConnector as
|
|
14
|
-
|
|
12
|
+
import { VisualizerConnectorRequests as de } 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
|
+
}, he = {
|
|
18
19
|
[l.Dark]: _,
|
|
19
20
|
[l.Light]: _
|
|
20
|
-
},
|
|
21
|
+
}, U = () => 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 = he[t], c = t === l.Light, [u, d] = R(0), f = I(U, [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
|
-
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] =
|
|
58
|
-
|
|
57
|
+
}), _e = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ve = M(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
|
|
58
|
+
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = R(!0), [d, f] = R(!1), p = L(null);
|
|
59
|
+
F(() => {
|
|
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,31 +123,38 @@ 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
|
-
let r =
|
|
134
|
-
|
|
133
|
+
}, Ce = (e, t, n) => {
|
|
134
|
+
let r = L(e);
|
|
135
|
+
F(() => {
|
|
135
136
|
r.current = e;
|
|
136
137
|
});
|
|
137
|
-
let [i, a] =
|
|
138
|
-
return
|
|
138
|
+
let [i, a] = R(null), [o, s] = R(!1);
|
|
139
|
+
return F(() => {
|
|
139
140
|
let e = null;
|
|
140
141
|
try {
|
|
141
|
-
|
|
142
|
+
let n = t.current?.getBoundingClientRect(), i = n != null && n.width > 0 && n.height > 0 ? {
|
|
143
|
+
...r.current.hostContext,
|
|
144
|
+
containerDimensions: {
|
|
145
|
+
width: Math.round(n.width),
|
|
146
|
+
height: Math.round(n.height)
|
|
147
|
+
}
|
|
148
|
+
} : r.current.hostContext;
|
|
149
|
+
e = new V(null, r.current.hostInfo ?? ye, be, { hostContext: i }), e.onopenlink = async ({ url: e }) => {
|
|
142
150
|
let t = r.current.onOpenLink;
|
|
143
|
-
return (t == null ?
|
|
151
|
+
return (t == null ? xe(e) : t(e)) === !1 ? { isError: !0 } : {};
|
|
144
152
|
}, e.onrequestdisplaymode = async ({ mode: e }) => {
|
|
145
153
|
let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
|
|
146
154
|
return { mode: t?.(e) ?? n };
|
|
147
155
|
}, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(ue, ({ params: e }) => {
|
|
148
156
|
let n = t.current?.querySelector("iframe");
|
|
149
|
-
n != null &&
|
|
157
|
+
n != null && Se(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
|
|
150
158
|
}), a(e);
|
|
151
159
|
} catch (e) {
|
|
152
160
|
console.error("[useMcpAppBridge] Error creating AppBridge:", e), s(!0);
|
|
@@ -154,65 +162,74 @@ var de = {
|
|
|
154
162
|
return () => {
|
|
155
163
|
e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
|
|
156
164
|
};
|
|
157
|
-
}, [t]),
|
|
158
|
-
i != null && n != null && i.setHostContext(n);
|
|
165
|
+
}, [t]), F(() => {
|
|
166
|
+
i != null && i.transport != null && n != null && i.setHostContext(n);
|
|
159
167
|
}, [i, n]), {
|
|
160
168
|
appBridge: i,
|
|
161
169
|
hasFailed: o
|
|
162
170
|
};
|
|
163
171
|
}, W = {
|
|
164
|
-
loadingOverlay: "
|
|
165
|
-
fullscreenFrame: "
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
loadingOverlay: "_loadingOverlay_iea4a_2",
|
|
173
|
+
fullscreenFrame: "_fullscreenFrame_iea4a_21",
|
|
174
|
+
loadingFrame: "_loadingFrame_iea4a_29",
|
|
175
|
+
statusLabel: "_statusLabel_iea4a_33",
|
|
176
|
+
statusDetail: "_statusDetail_iea4a_38",
|
|
177
|
+
errorIcon: "_errorIcon_iea4a_42"
|
|
178
|
+
}, we = ({ content: e, errorLabel: t = "Failed to load app", onAppInfo: n }) => {
|
|
179
|
+
let [r, i] = R("loading"), [a, o] = R(), { html: s, sandboxUrl: c, toolInput: l, toolResult: u, hostContext: d } = e, f = I(() => ({ url: new URL(c) }), [c]), p = d?.displayMode === "fullscreen", m = L(null), [h, _] = R();
|
|
180
|
+
F(() => {
|
|
181
|
+
let e = m.current;
|
|
172
182
|
if (!e) return;
|
|
173
183
|
let t = new ResizeObserver(([e]) => {
|
|
174
184
|
if (!e) return;
|
|
175
185
|
let { width: t, height: n } = e.contentRect;
|
|
176
|
-
|
|
186
|
+
_({
|
|
177
187
|
width: Math.round(t),
|
|
178
188
|
height: Math.round(n)
|
|
179
189
|
});
|
|
180
190
|
});
|
|
181
191
|
return t.observe(e), () => t.disconnect();
|
|
182
192
|
}, []);
|
|
183
|
-
let { appBridge:
|
|
184
|
-
...
|
|
185
|
-
containerDimensions:
|
|
186
|
-
}, [
|
|
187
|
-
return /* @__PURE__ */
|
|
188
|
-
ref:
|
|
189
|
-
className: g("relative h-full w-full",
|
|
193
|
+
let { appBridge: v, hasFailed: y } = Ce(e, m, I(() => d == null || h == null ? d : {
|
|
194
|
+
...d,
|
|
195
|
+
containerDimensions: h
|
|
196
|
+
}, [d, h])), b = y || r === "error";
|
|
197
|
+
return /* @__PURE__ */ B("div", {
|
|
198
|
+
ref: m,
|
|
199
|
+
className: g("relative h-full min-h-[200px] w-full", p && W.fullscreenFrame, !p && r === "loading" && W.loadingFrame),
|
|
190
200
|
children: [
|
|
191
|
-
|
|
192
|
-
html:
|
|
193
|
-
sandbox:
|
|
194
|
-
appBridge:
|
|
195
|
-
toolInput:
|
|
196
|
-
toolResult:
|
|
197
|
-
onSizeChanged: () =>
|
|
198
|
-
onInitialized: () =>
|
|
199
|
-
|
|
201
|
+
v != null && !b && /* @__PURE__ */ z(H, {
|
|
202
|
+
html: s,
|
|
203
|
+
sandbox: f,
|
|
204
|
+
appBridge: v,
|
|
205
|
+
toolInput: l,
|
|
206
|
+
toolResult: u,
|
|
207
|
+
onSizeChanged: () => i("ready"),
|
|
208
|
+
onInitialized: (e) => {
|
|
209
|
+
i("ready"), e.appVersion != null && n?.(e.appVersion);
|
|
210
|
+
},
|
|
211
|
+
onError: (e) => {
|
|
212
|
+
o(e.message), i("error");
|
|
213
|
+
}
|
|
200
214
|
}),
|
|
201
|
-
!
|
|
215
|
+
!b && r === "loading" && /* @__PURE__ */ z("div", {
|
|
202
216
|
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", W.loadingOverlay),
|
|
203
|
-
children: /* @__PURE__ */
|
|
217
|
+
children: /* @__PURE__ */ z(E, {})
|
|
204
218
|
}),
|
|
205
|
-
|
|
206
|
-
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
207
|
-
children: [/* @__PURE__ */
|
|
219
|
+
b && /* @__PURE__ */ B("div", {
|
|
220
|
+
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
|
|
221
|
+
children: [/* @__PURE__ */ z(D, {
|
|
208
222
|
size: 60,
|
|
209
223
|
stroke: S,
|
|
210
224
|
"aria-hidden": !0,
|
|
211
225
|
className: W.errorIcon
|
|
212
|
-
}), /* @__PURE__ */
|
|
226
|
+
}), /* @__PURE__ */ B("p", {
|
|
213
227
|
role: "alert",
|
|
214
228
|
className: g("text-center", W.statusLabel),
|
|
215
|
-
children: t
|
|
229
|
+
children: [t, a && /* @__PURE__ */ B(le, { children: [/* @__PURE__ */ z("br", {}), /* @__PURE__ */ z("span", {
|
|
230
|
+
className: W.statusDetail,
|
|
231
|
+
children: a
|
|
232
|
+
})] })]
|
|
216
233
|
})]
|
|
217
234
|
})
|
|
218
235
|
]
|
|
@@ -225,16 +242,16 @@ var de = {
|
|
|
225
242
|
statusOverlay: "_statusOverlay_1w97n_24",
|
|
226
243
|
errorIcon: "_errorIcon_1w97n_29",
|
|
227
244
|
highlight: "_highlight_1w97n_37"
|
|
228
|
-
},
|
|
245
|
+
}, Te = (e) => {
|
|
229
246
|
if (e?.kind !== "range") return "";
|
|
230
247
|
let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
|
|
231
248
|
if (n == null) return "";
|
|
232
249
|
let r = n.formula;
|
|
233
250
|
return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
|
|
234
|
-
},
|
|
251
|
+
}, Ee = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
|
|
235
252
|
switch (t) {
|
|
236
253
|
case r.Docx: {
|
|
237
|
-
let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("
|
|
254
|
+
let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/docx"), import("@silurus/ooxml/chart-ex")]);
|
|
238
255
|
return new t(e, {
|
|
239
256
|
enableTextSelection: !0,
|
|
240
257
|
refitOnResize: !0,
|
|
@@ -243,7 +260,7 @@ var de = {
|
|
|
243
260
|
});
|
|
244
261
|
}
|
|
245
262
|
case r.Xlsx: {
|
|
246
|
-
let [{ XlsxViewer: t }, { chartEx: r }] = await Promise.all([import("
|
|
263
|
+
let [{ XlsxViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/xlsx"), import("@silurus/ooxml/chart-ex")]);
|
|
247
264
|
return new t(e, {
|
|
248
265
|
showZoomSlider: !0,
|
|
249
266
|
chartEx: r,
|
|
@@ -252,7 +269,7 @@ var de = {
|
|
|
252
269
|
});
|
|
253
270
|
}
|
|
254
271
|
case r.Csv: {
|
|
255
|
-
let { XlsxSheetViewer: t } = await import("
|
|
272
|
+
let { XlsxSheetViewer: t } = await import("@silurus/ooxml/xlsx"), r = document.createElement("canvas");
|
|
256
273
|
r.className = G.spreadsheetCanvas, e.replaceChildren(r);
|
|
257
274
|
let i = new t(r, {
|
|
258
275
|
showScrollbars: !0,
|
|
@@ -260,11 +277,15 @@ var de = {
|
|
|
260
277
|
});
|
|
261
278
|
return {
|
|
262
279
|
load: (e) => i.load(e, { format: "csv" }),
|
|
263
|
-
destroy: () => i.destroy()
|
|
280
|
+
destroy: () => i.destroy(),
|
|
281
|
+
resize: () => {
|
|
282
|
+
let { width: t, height: n } = e.getBoundingClientRect();
|
|
283
|
+
return t > 0 && (r.style.width = `${t}px`), n > 0 && (r.style.height = `${n}px`), i.relayout();
|
|
284
|
+
}
|
|
264
285
|
};
|
|
265
286
|
}
|
|
266
287
|
case r.Pptx: {
|
|
267
|
-
let [{ PptxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("
|
|
288
|
+
let [{ PptxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/pptx"), import("@silurus/ooxml/chart-ex")]);
|
|
268
289
|
return new t(e, {
|
|
269
290
|
enableTextSelection: !0,
|
|
270
291
|
refitOnResize: !0,
|
|
@@ -273,16 +294,16 @@ var de = {
|
|
|
273
294
|
});
|
|
274
295
|
}
|
|
275
296
|
}
|
|
276
|
-
},
|
|
297
|
+
}, De = async (e, t, n, i) => {
|
|
277
298
|
let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = n;
|
|
278
299
|
switch (t.format) {
|
|
279
300
|
case r.Docx: {
|
|
280
301
|
let [{ DocxDocument: n, DocxScrollViewer: r }, { chartEx: o }, { createDocxHighlightSurface: c }] = await Promise.all([
|
|
281
|
-
import("
|
|
282
|
-
import("
|
|
283
|
-
import("./ooxml-highlight-surfaces-
|
|
302
|
+
import("@silurus/ooxml/docx"),
|
|
303
|
+
import("@silurus/ooxml/chart-ex"),
|
|
304
|
+
import("./ooxml-highlight-surfaces-BzgOKpBV.js")
|
|
284
305
|
]), l = await n.load(t.url, { chartEx: o });
|
|
285
|
-
if (i()) throw l.destroy(), new
|
|
306
|
+
if (i()) throw l.destroy(), new Oe();
|
|
286
307
|
let u = r.fromDocument(e, l, {
|
|
287
308
|
enableTextSelection: !0,
|
|
288
309
|
refitOnResize: !0,
|
|
@@ -298,11 +319,11 @@ var de = {
|
|
|
298
319
|
}
|
|
299
320
|
case r.Pptx: {
|
|
300
321
|
let [{ PptxPresentation: n, PptxScrollViewer: r }, { chartEx: o }, { createPptxHighlightSurface: c }] = await Promise.all([
|
|
301
|
-
import("
|
|
302
|
-
import("
|
|
303
|
-
import("./ooxml-highlight-surfaces-
|
|
322
|
+
import("@silurus/ooxml/pptx"),
|
|
323
|
+
import("@silurus/ooxml/chart-ex"),
|
|
324
|
+
import("./ooxml-highlight-surfaces-BzgOKpBV.js")
|
|
304
325
|
]), l = await n.load(t.url, { chartEx: o });
|
|
305
|
-
if (i()) throw l.destroy(), new
|
|
326
|
+
if (i()) throw l.destroy(), new Oe();
|
|
306
327
|
let u = r.fromPresentation(e, l, {
|
|
307
328
|
enableTextSelection: !0,
|
|
308
329
|
refitOnResize: !0,
|
|
@@ -318,9 +339,9 @@ var de = {
|
|
|
318
339
|
}
|
|
319
340
|
case r.Xlsx: {
|
|
320
341
|
let [{ XlsxViewer: n }, { chartEx: r }, { createXlsxHighlightSurface: c }] = await Promise.all([
|
|
321
|
-
import("
|
|
322
|
-
import("
|
|
323
|
-
import("./ooxml-highlight-surfaces-
|
|
342
|
+
import("@silurus/ooxml/xlsx"),
|
|
343
|
+
import("@silurus/ooxml/chart-ex"),
|
|
344
|
+
import("./ooxml-highlight-surfaces-BzgOKpBV.js")
|
|
324
345
|
]), l = new n(e, {
|
|
325
346
|
showZoomSlider: !0,
|
|
326
347
|
chartEx: r,
|
|
@@ -336,15 +357,15 @@ var de = {
|
|
|
336
357
|
};
|
|
337
358
|
}
|
|
338
359
|
case r.Csv: {
|
|
339
|
-
let r = await
|
|
360
|
+
let r = await Ee(e, t.format, n);
|
|
340
361
|
return await r.load(t.url), { viewer: r };
|
|
341
362
|
}
|
|
342
363
|
}
|
|
343
|
-
},
|
|
344
|
-
let l =
|
|
364
|
+
}, Oe = class extends Error {}, ke = ({ content: t, fileName: n, loadErrorLabel: i, formulaLabel: a, formulaLabelClassName: o, highlightsLabel: s = "Cited locations", highlightNavigatedLabel: c = "Scrolled to the cited location" }) => {
|
|
365
|
+
let l = L(null), [u, d] = R(!0), [f, p] = R(!1), [m, h] = R(""), [_, v] = R([]), [y, b] = R(!1), { highlights: x, selectedHighlightId: C } = t, w = x != null && x.length > 0, T = L(void 0), O = L(x);
|
|
345
366
|
O.current = x;
|
|
346
|
-
let k =
|
|
347
|
-
return
|
|
367
|
+
let k = L(void 0);
|
|
368
|
+
return F(() => {
|
|
348
369
|
let e = l.current;
|
|
349
370
|
if (e == null) return;
|
|
350
371
|
let n, r, i = !1, a, o = () => i;
|
|
@@ -366,47 +387,50 @@ var de = {
|
|
|
366
387
|
i || (d(!1), p(!0));
|
|
367
388
|
},
|
|
368
389
|
onXlsxSelectionContextChange: (e) => {
|
|
369
|
-
i || h(
|
|
390
|
+
i || h(Te(e));
|
|
370
391
|
},
|
|
371
392
|
onGeometryInvalidated: s
|
|
372
393
|
}, f = () => {
|
|
373
|
-
i || (r = new ResizeObserver(
|
|
394
|
+
i || (r = new ResizeObserver(() => {
|
|
395
|
+
n?.viewer.resize?.(), s();
|
|
396
|
+
}), r.observe(e));
|
|
374
397
|
};
|
|
375
398
|
return e.addEventListener("scroll", s, !0), k.current = s, (async () => {
|
|
376
399
|
try {
|
|
377
400
|
if (w) {
|
|
378
|
-
let r = await
|
|
401
|
+
let r = await De(e, t, u, o);
|
|
379
402
|
if (i) {
|
|
380
403
|
r.viewer.destroy(), r.engine?.destroy();
|
|
381
404
|
return;
|
|
382
405
|
}
|
|
383
|
-
n = r,
|
|
406
|
+
n = r, T.current = r.highlights, f();
|
|
384
407
|
} else {
|
|
385
|
-
let r = await
|
|
408
|
+
let r = await Ee(e, t.format, u);
|
|
386
409
|
if (i) {
|
|
387
410
|
r.destroy();
|
|
388
411
|
return;
|
|
389
412
|
}
|
|
390
|
-
n = { viewer: r },
|
|
413
|
+
if (n = { viewer: r }, T.current = void 0, await r.load(t.url), i) return;
|
|
414
|
+
f();
|
|
391
415
|
}
|
|
392
416
|
if (i) return;
|
|
393
417
|
d(!1), await c();
|
|
394
418
|
} catch (t) {
|
|
395
|
-
if (t instanceof
|
|
396
|
-
n?.viewer.destroy(), n?.engine?.destroy(), n = void 0,
|
|
419
|
+
if (t instanceof Oe || i) return;
|
|
420
|
+
n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, T.current = void 0, e.replaceChildren(), d(!1), p(!0);
|
|
397
421
|
}
|
|
398
422
|
})(), () => {
|
|
399
|
-
i = !0, e.removeEventListener("scroll", s, !0), a != null && cancelAnimationFrame(a), k.current = void 0, r?.disconnect(), n?.viewer.destroy(), n?.engine?.destroy(),
|
|
423
|
+
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
424
|
};
|
|
401
425
|
}, [
|
|
402
426
|
t.format,
|
|
403
427
|
t.url,
|
|
404
428
|
w
|
|
405
|
-
]),
|
|
429
|
+
]), F(() => {
|
|
406
430
|
k.current?.();
|
|
407
|
-
}, [x]),
|
|
431
|
+
}, [x]), F(() => {
|
|
408
432
|
b(!1);
|
|
409
|
-
let t =
|
|
433
|
+
let t = T.current;
|
|
410
434
|
if (t == null || u) return;
|
|
411
435
|
let n = (O.current?.find(({ id: e }) => e === C))?.locations.at(0);
|
|
412
436
|
if (n == null) return;
|
|
@@ -422,18 +446,18 @@ var de = {
|
|
|
422
446
|
})(), () => {
|
|
423
447
|
r = !0;
|
|
424
448
|
};
|
|
425
|
-
}, [C, u]), /* @__PURE__ */
|
|
449
|
+
}, [C, u]), /* @__PURE__ */ B("div", {
|
|
426
450
|
className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
|
|
427
451
|
children: [
|
|
428
|
-
t.format === r.Xlsx && /* @__PURE__ */
|
|
452
|
+
t.format === r.Xlsx && /* @__PURE__ */ B("div", {
|
|
429
453
|
role: "region",
|
|
430
454
|
"aria-label": a,
|
|
431
455
|
className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", G.formulaPanel),
|
|
432
|
-
children: [/* @__PURE__ */
|
|
456
|
+
children: [/* @__PURE__ */ z("span", {
|
|
433
457
|
"aria-hidden": "true",
|
|
434
458
|
className: g("shrink-0", o),
|
|
435
459
|
children: "fx"
|
|
436
|
-
}), /* @__PURE__ */
|
|
460
|
+
}), /* @__PURE__ */ z("code", {
|
|
437
461
|
dir: "ltr",
|
|
438
462
|
tabIndex: 0,
|
|
439
463
|
"aria-live": "polite",
|
|
@@ -441,19 +465,19 @@ var de = {
|
|
|
441
465
|
children: m
|
|
442
466
|
})]
|
|
443
467
|
}),
|
|
444
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ B("div", {
|
|
445
469
|
className: "relative min-h-0 w-full flex-1",
|
|
446
|
-
children: [/* @__PURE__ */
|
|
470
|
+
children: [/* @__PURE__ */ z("div", {
|
|
447
471
|
ref: l,
|
|
448
472
|
role: "document",
|
|
449
473
|
"aria-label": n,
|
|
450
474
|
"aria-busy": u,
|
|
451
475
|
className: g("h-full w-full overflow-hidden", G.viewer)
|
|
452
|
-
}), _.length > 0 && /* @__PURE__ */
|
|
476
|
+
}), _.length > 0 && /* @__PURE__ */ z("div", {
|
|
453
477
|
role: "region",
|
|
454
478
|
"aria-label": s,
|
|
455
479
|
className: "pointer-events-none absolute inset-0 overflow-hidden",
|
|
456
|
-
children: _.map((e, t) => /* @__PURE__ */
|
|
480
|
+
children: _.map((e, t) => /* @__PURE__ */ z("div", {
|
|
457
481
|
"aria-hidden": "true",
|
|
458
482
|
style: {
|
|
459
483
|
left: `${e.left}px`,
|
|
@@ -467,24 +491,24 @@ var de = {
|
|
|
467
491
|
}, `${e.highlightId}-${t}`))
|
|
468
492
|
})]
|
|
469
493
|
}),
|
|
470
|
-
/* @__PURE__ */
|
|
494
|
+
/* @__PURE__ */ z("div", {
|
|
471
495
|
role: "status",
|
|
472
496
|
"aria-live": "polite",
|
|
473
497
|
className: "sr-only",
|
|
474
498
|
children: y ? c : ""
|
|
475
499
|
}),
|
|
476
|
-
(u || f) && /* @__PURE__ */
|
|
500
|
+
(u || f) && /* @__PURE__ */ z("div", {
|
|
477
501
|
role: f ? "alert" : void 0,
|
|
478
502
|
"aria-live": "polite",
|
|
479
503
|
className: g("absolute inset-0 flex items-center justify-center", G.statusOverlay),
|
|
480
|
-
children: u ? /* @__PURE__ */
|
|
504
|
+
children: u ? /* @__PURE__ */ z(E, { size: 48 }) : /* @__PURE__ */ B("div", {
|
|
481
505
|
className: "flex flex-col items-center gap-2",
|
|
482
|
-
children: [/* @__PURE__ */
|
|
506
|
+
children: [/* @__PURE__ */ z(D, {
|
|
483
507
|
"aria-hidden": "true",
|
|
484
508
|
size: 60,
|
|
485
509
|
stroke: S,
|
|
486
510
|
className: G.errorIcon
|
|
487
|
-
}), /* @__PURE__ */
|
|
511
|
+
}), /* @__PURE__ */ z("p", {
|
|
488
512
|
className: "text-center",
|
|
489
513
|
children: i
|
|
490
514
|
})]
|
|
@@ -492,70 +516,86 @@ var de = {
|
|
|
492
516
|
})
|
|
493
517
|
]
|
|
494
518
|
});
|
|
495
|
-
},
|
|
519
|
+
}, Ae = {
|
|
496
520
|
loadingOverlay: "_loadingOverlay_12637_1",
|
|
497
521
|
statusLabel: "_statusLabel_12637_5",
|
|
498
522
|
errorIcon: "_errorIcon_12637_9"
|
|
499
|
-
},
|
|
500
|
-
let
|
|
501
|
-
return
|
|
502
|
-
let e =
|
|
523
|
+
}, je = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: a }) => {
|
|
524
|
+
let o = L(null), [s, c] = R("loading"), { url: l, visualizerName: u, requestTimeout: d } = e, f = L(e);
|
|
525
|
+
return f.current = e, F(() => {
|
|
526
|
+
let e = o.current;
|
|
503
527
|
if (!e) return;
|
|
504
|
-
|
|
505
|
-
let t = new
|
|
506
|
-
domain:
|
|
528
|
+
c("loading");
|
|
529
|
+
let t = new fe(e, {
|
|
530
|
+
domain: l,
|
|
507
531
|
hostDomain: window.location.origin,
|
|
508
|
-
visualizerName:
|
|
509
|
-
requestTimeout:
|
|
532
|
+
visualizerName: u,
|
|
533
|
+
requestTimeout: d
|
|
510
534
|
}), n = !0;
|
|
511
535
|
return (async () => {
|
|
512
536
|
if (await t.ready(), !n) return;
|
|
513
|
-
let
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
537
|
+
let e = f.current;
|
|
538
|
+
if (e.type === i.GroupedVisualizer) await t.send(de.sendGroupedVisualizeData, {
|
|
539
|
+
attachments: e.attachments,
|
|
540
|
+
layout: e.layout
|
|
541
|
+
});
|
|
542
|
+
else {
|
|
543
|
+
let { mimeType: n, layout: r, data: i } = e, a = {
|
|
544
|
+
layout: r,
|
|
545
|
+
...typeof i == "object" && i ? i : {}
|
|
546
|
+
};
|
|
547
|
+
await t.send(de.sendVisualizeData, {
|
|
548
|
+
mimeType: n,
|
|
549
|
+
visualizerData: a
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
n && c("ready");
|
|
521
553
|
})().catch(() => {
|
|
522
|
-
n &&
|
|
554
|
+
n && c("error");
|
|
523
555
|
}), () => {
|
|
524
556
|
n = !1, t.destroy();
|
|
525
557
|
};
|
|
526
558
|
}, [
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
]),
|
|
559
|
+
l,
|
|
560
|
+
u,
|
|
561
|
+
d
|
|
562
|
+
]), F(() => {
|
|
563
|
+
let e = r ?? u.trim();
|
|
564
|
+
e !== "" && o.current?.querySelector("iframe")?.setAttribute("title", e);
|
|
565
|
+
}, [
|
|
566
|
+
r,
|
|
567
|
+
u,
|
|
568
|
+
l,
|
|
569
|
+
d
|
|
570
|
+
]), /* @__PURE__ */ B("div", {
|
|
531
571
|
className: "relative h-full w-full",
|
|
532
572
|
style: m({
|
|
533
|
-
"--vs-loading-bg":
|
|
534
|
-
"--vs-status-text":
|
|
535
|
-
"--vs-error-icon":
|
|
573
|
+
"--vs-loading-bg": a?.loadingBackground,
|
|
574
|
+
"--vs-status-text": a?.statusText,
|
|
575
|
+
"--vs-error-icon": a?.errorIcon
|
|
536
576
|
}),
|
|
537
577
|
children: [
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
ref:
|
|
578
|
+
/* @__PURE__ */ z("div", {
|
|
579
|
+
ref: o,
|
|
540
580
|
className: "h-full w-full"
|
|
541
581
|
}),
|
|
542
|
-
|
|
543
|
-
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
544
|
-
children: [/* @__PURE__ */
|
|
545
|
-
className: g("text-center",
|
|
582
|
+
s === "loading" && /* @__PURE__ */ B("div", {
|
|
583
|
+
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", Ae.loadingOverlay),
|
|
584
|
+
children: [/* @__PURE__ */ z(E, {}), t && /* @__PURE__ */ z("p", {
|
|
585
|
+
className: g("text-center", Ae.statusLabel),
|
|
546
586
|
children: t
|
|
547
587
|
})]
|
|
548
588
|
}),
|
|
549
|
-
|
|
589
|
+
s === "error" && /* @__PURE__ */ B("div", {
|
|
550
590
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
551
|
-
children: [/* @__PURE__ */
|
|
591
|
+
children: [/* @__PURE__ */ z(D, {
|
|
552
592
|
size: 60,
|
|
553
593
|
stroke: S,
|
|
554
594
|
"aria-hidden": !0,
|
|
555
|
-
className:
|
|
556
|
-
}), /* @__PURE__ */
|
|
595
|
+
className: Ae.errorIcon
|
|
596
|
+
}), /* @__PURE__ */ z("p", {
|
|
557
597
|
role: "alert",
|
|
558
|
-
className: g("text-center",
|
|
598
|
+
className: g("text-center", Ae.statusLabel),
|
|
559
599
|
children: n
|
|
560
600
|
})]
|
|
561
601
|
})
|
|
@@ -576,34 +616,34 @@ var de = {
|
|
|
576
616
|
jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
|
|
577
617
|
jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
|
|
578
618
|
jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
|
|
579
|
-
},
|
|
580
|
-
let [r, i] =
|
|
581
|
-
return
|
|
619
|
+
}, Me = () => j(async () => ({ default: (await import("./PdfContent-BoAtghsO.js")).PdfContent })), Ne = ({ url: e, fileName: t, loadErrorLabel: n }) => {
|
|
620
|
+
let [r, i] = R(!1);
|
|
621
|
+
return F(() => {
|
|
582
622
|
i(!1);
|
|
583
|
-
}, [e]), r ? /* @__PURE__ */
|
|
623
|
+
}, [e]), r ? /* @__PURE__ */ B("div", {
|
|
584
624
|
className: "flex flex-col items-center gap-2",
|
|
585
|
-
children: [/* @__PURE__ */
|
|
625
|
+
children: [/* @__PURE__ */ z(D, {
|
|
586
626
|
size: 60,
|
|
587
627
|
stroke: S,
|
|
588
628
|
className: K.errorIcon
|
|
589
|
-
}), /* @__PURE__ */
|
|
629
|
+
}), /* @__PURE__ */ z("p", {
|
|
590
630
|
className: g("text-center", K.statusLabel),
|
|
591
631
|
children: n
|
|
592
632
|
})]
|
|
593
|
-
}) : /* @__PURE__ */
|
|
633
|
+
}) : /* @__PURE__ */ z("img", {
|
|
594
634
|
src: e,
|
|
595
635
|
alt: t ?? "",
|
|
596
636
|
className: "max-h-full max-w-full object-contain",
|
|
597
637
|
onError: () => i(!0)
|
|
598
638
|
});
|
|
599
|
-
},
|
|
639
|
+
}, Pe = new Set([
|
|
600
640
|
i.PlainText,
|
|
601
641
|
i.Code,
|
|
602
642
|
i.Ooxml
|
|
603
|
-
]),
|
|
604
|
-
let { colors: V, typography: H, bodyClassName:
|
|
605
|
-
|
|
606
|
-
}, []), U = H?.fontClassName != null,
|
|
643
|
+
]), Fe = 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: P, hidePdfToolbar: F = !1, configurePdfWorker: L, onAppInfo: le }) => {
|
|
644
|
+
let { colors: V, typography: H, bodyClassName: ue, cssVars: de } = A ?? {}, [fe, pe] = R(0), me = I(Me, [fe]), he = N(() => {
|
|
645
|
+
pe((e) => e + 1);
|
|
646
|
+
}, []), U = H?.fontClassName != null, _e = I(() => ({
|
|
607
647
|
...m({
|
|
608
648
|
"--ac-text": V?.text,
|
|
609
649
|
"--ac-status-text": V?.statusText,
|
|
@@ -634,8 +674,8 @@ var de = {
|
|
|
634
674
|
"--ac-line-height": U ? void 0 : H?.lineHeight,
|
|
635
675
|
"--ac-letter-spacing": U ? void 0 : H?.letterSpacing
|
|
636
676
|
}),
|
|
637
|
-
...
|
|
638
|
-
}), [
|
|
677
|
+
...de
|
|
678
|
+
}), [A]), ye = I(() => {
|
|
639
679
|
switch (e.type) {
|
|
640
680
|
case i.Image:
|
|
641
681
|
case i.Audio:
|
|
@@ -645,6 +685,7 @@ var de = {
|
|
|
645
685
|
case i.Pdf:
|
|
646
686
|
case i.Ooxml:
|
|
647
687
|
case i.Visualizer:
|
|
688
|
+
case i.GroupedVisualizer:
|
|
648
689
|
case i.McpApp:
|
|
649
690
|
case i.Code:
|
|
650
691
|
case i.Html: return "h-full overflow-hidden";
|
|
@@ -652,38 +693,38 @@ var de = {
|
|
|
652
693
|
case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
|
|
653
694
|
default: return "h-full overflow-auto p-4";
|
|
654
695
|
}
|
|
655
|
-
}, [e.type]),
|
|
696
|
+
}, [e.type]), be = I(() => {
|
|
656
697
|
switch (e.type) {
|
|
657
|
-
case i.PlainText: return /* @__PURE__ */
|
|
698
|
+
case i.PlainText: return /* @__PURE__ */ z("pre", {
|
|
658
699
|
className: g("whitespace-pre-wrap break-words", K.body, H?.fontClassName),
|
|
659
700
|
children: e.text
|
|
660
701
|
});
|
|
661
|
-
case i.Image: return /* @__PURE__ */
|
|
702
|
+
case i.Image: return /* @__PURE__ */ z(Ne, {
|
|
662
703
|
url: e.url,
|
|
663
704
|
fileName: r,
|
|
664
705
|
loadErrorLabel: c
|
|
665
706
|
});
|
|
666
|
-
case i.Audio: return /* @__PURE__ */
|
|
707
|
+
case i.Audio: return /* @__PURE__ */ z("audio", {
|
|
667
708
|
controls: !0,
|
|
668
709
|
src: e.url,
|
|
669
710
|
"aria-label": r ?? "Audio attachment",
|
|
670
711
|
className: "w-full max-w-sm",
|
|
671
712
|
preload: "metadata",
|
|
672
|
-
children: e.mimeType && /* @__PURE__ */
|
|
713
|
+
children: e.mimeType && /* @__PURE__ */ z("source", {
|
|
673
714
|
src: e.url,
|
|
674
715
|
type: e.mimeType
|
|
675
716
|
})
|
|
676
717
|
});
|
|
677
|
-
case i.Markdown: return /* @__PURE__ */
|
|
718
|
+
case i.Markdown: return /* @__PURE__ */ z(p, {
|
|
678
719
|
content: e.text,
|
|
679
720
|
isStreaming: !1,
|
|
680
|
-
codeBlockTheme:
|
|
721
|
+
codeBlockTheme: j,
|
|
681
722
|
classNames: u
|
|
682
723
|
});
|
|
683
|
-
case i.MarkdownTable: return /* @__PURE__ */
|
|
724
|
+
case i.MarkdownTable: return /* @__PURE__ */ z(p, {
|
|
684
725
|
content: e.text,
|
|
685
726
|
isStreaming: !1,
|
|
686
|
-
codeBlockTheme:
|
|
727
|
+
codeBlockTheme: j,
|
|
687
728
|
containerClassName: "flex h-full min-h-0 flex-col",
|
|
688
729
|
classNames: {
|
|
689
730
|
...u,
|
|
@@ -691,24 +732,22 @@ var de = {
|
|
|
691
732
|
tableScrollContainer: "max-h-full"
|
|
692
733
|
},
|
|
693
734
|
tableActionLabels: {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
copiedLabel: ae,
|
|
698
|
-
downloadCsvLabel: A
|
|
735
|
+
copyLabel: te,
|
|
736
|
+
copiedLabel: ne,
|
|
737
|
+
downloadCsvLabel: re
|
|
699
738
|
},
|
|
700
|
-
tableDownloadFilename:
|
|
739
|
+
tableDownloadFilename: M
|
|
701
740
|
});
|
|
702
|
-
case i.Json: return /* @__PURE__ */
|
|
741
|
+
case i.Json: return /* @__PURE__ */ z("div", {
|
|
703
742
|
dir: "ltr",
|
|
704
743
|
className: "h-full overflow-auto",
|
|
705
|
-
children: /* @__PURE__ */
|
|
744
|
+
children: /* @__PURE__ */ z("div", {
|
|
706
745
|
className: g("m-3 overflow-auto rounded-md border", K.jsonWrapper),
|
|
707
|
-
children: /* @__PURE__ */
|
|
746
|
+
children: /* @__PURE__ */ z(se, {
|
|
708
747
|
data: e.value,
|
|
709
748
|
style: {
|
|
710
749
|
container: g("whitespace-pre-wrap break-words p-2", H?.jsonClassName ?? "dial-code-text"),
|
|
711
|
-
basicChildStyle:
|
|
750
|
+
basicChildStyle: ce.basicChildStyle,
|
|
712
751
|
childFieldsContainer: "m-0 ps-3",
|
|
713
752
|
label: g("me-1 font-semibold", K.jsonLabel),
|
|
714
753
|
clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", K.jsonClickableLabel),
|
|
@@ -726,16 +765,16 @@ var de = {
|
|
|
726
765
|
})
|
|
727
766
|
})
|
|
728
767
|
});
|
|
729
|
-
case i.Code: return /* @__PURE__ */
|
|
768
|
+
case i.Code: return /* @__PURE__ */ z(ge, {
|
|
730
769
|
content: e,
|
|
731
|
-
codeBlockTheme:
|
|
770
|
+
codeBlockTheme: j,
|
|
732
771
|
labels: {
|
|
733
772
|
loadingLabel: O,
|
|
734
773
|
errorLabel: k,
|
|
735
774
|
retryLabel: ee
|
|
736
775
|
}
|
|
737
776
|
});
|
|
738
|
-
case i.Html: return /* @__PURE__ */
|
|
777
|
+
case i.Html: return /* @__PURE__ */ z(ve, {
|
|
739
778
|
content: e,
|
|
740
779
|
labels: {
|
|
741
780
|
htmlFrameBlockedLabel: f,
|
|
@@ -743,25 +782,25 @@ var de = {
|
|
|
743
782
|
},
|
|
744
783
|
isSourceView: a,
|
|
745
784
|
title: r,
|
|
746
|
-
codeBlockTheme:
|
|
785
|
+
codeBlockTheme: j
|
|
747
786
|
});
|
|
748
|
-
case i.Pdf: return /* @__PURE__ */
|
|
749
|
-
retryKey:
|
|
750
|
-
onRetry:
|
|
787
|
+
case i.Pdf: return /* @__PURE__ */ z(s, {
|
|
788
|
+
retryKey: fe,
|
|
789
|
+
onRetry: he,
|
|
751
790
|
labels: {
|
|
752
791
|
loadingLabel: x,
|
|
753
792
|
errorLabel: C,
|
|
754
793
|
retryLabel: w
|
|
755
794
|
},
|
|
756
|
-
children: /* @__PURE__ */
|
|
795
|
+
children: /* @__PURE__ */ z(me, {
|
|
757
796
|
fileName: r,
|
|
758
797
|
url: e.url,
|
|
759
798
|
highlights: e.highlights ?? [],
|
|
760
799
|
selectedHighlightId: e.selectedHighlightId,
|
|
761
800
|
selectedPageNumber: e.page,
|
|
762
|
-
loadPdf:
|
|
763
|
-
hideHeader:
|
|
764
|
-
configurePdfWorker:
|
|
801
|
+
loadPdf: P,
|
|
802
|
+
hideHeader: F,
|
|
803
|
+
configurePdfWorker: L,
|
|
765
804
|
labels: {
|
|
766
805
|
thumbnailsLabel: _,
|
|
767
806
|
showThumbnailsLabel: v,
|
|
@@ -773,33 +812,37 @@ var de = {
|
|
|
773
812
|
}
|
|
774
813
|
})
|
|
775
814
|
}, e.url);
|
|
776
|
-
case i.Ooxml: return /* @__PURE__ */
|
|
815
|
+
case i.Ooxml: return /* @__PURE__ */ z(ke, {
|
|
777
816
|
content: e,
|
|
778
817
|
fileName: r,
|
|
779
818
|
loadErrorLabel: c,
|
|
780
|
-
formulaLabel:
|
|
819
|
+
formulaLabel: T,
|
|
781
820
|
formulaLabelClassName: H?.xlsxFormulaLabelClassName ?? "dial-italic-text",
|
|
782
|
-
highlightsLabel:
|
|
783
|
-
highlightNavigatedLabel:
|
|
821
|
+
highlightsLabel: ae,
|
|
822
|
+
highlightNavigatedLabel: oe
|
|
784
823
|
});
|
|
785
|
-
case i.Visualizer:
|
|
824
|
+
case i.Visualizer:
|
|
825
|
+
case i.GroupedVisualizer: return /* @__PURE__ */ z(je, {
|
|
786
826
|
content: e,
|
|
787
827
|
errorLabel: d
|
|
788
828
|
});
|
|
789
|
-
case i.McpApp: return /* @__PURE__ */
|
|
790
|
-
|
|
829
|
+
case i.McpApp: return /* @__PURE__ */ z(we, {
|
|
830
|
+
content: e,
|
|
831
|
+
onAppInfo: le
|
|
832
|
+
});
|
|
833
|
+
case i.Unsupported: return /* @__PURE__ */ z("p", {
|
|
791
834
|
className: g("text-center", K.statusLabel),
|
|
792
835
|
children: o
|
|
793
836
|
});
|
|
794
837
|
case i.Error: {
|
|
795
838
|
let t = e.errorType === n.Forbidden;
|
|
796
|
-
return /* @__PURE__ */
|
|
839
|
+
return /* @__PURE__ */ B("div", {
|
|
797
840
|
className: "flex flex-col items-center gap-2",
|
|
798
|
-
children: [
|
|
841
|
+
children: [z(t ? ie : D, {
|
|
799
842
|
size: 60,
|
|
800
843
|
stroke: S,
|
|
801
844
|
className: K.errorIcon
|
|
802
|
-
}), /* @__PURE__ */
|
|
845
|
+
}), /* @__PURE__ */ z("p", {
|
|
803
846
|
className: g("text-center", K.statusLabel),
|
|
804
847
|
children: t ? l : c
|
|
805
848
|
})]
|
|
@@ -812,7 +855,7 @@ var de = {
|
|
|
812
855
|
H?.jsonClassName,
|
|
813
856
|
H?.xlsxFormulaLabelClassName,
|
|
814
857
|
r,
|
|
815
|
-
|
|
858
|
+
j,
|
|
816
859
|
o,
|
|
817
860
|
c,
|
|
818
861
|
l,
|
|
@@ -820,10 +863,11 @@ var de = {
|
|
|
820
863
|
f,
|
|
821
864
|
h,
|
|
822
865
|
a,
|
|
823
|
-
|
|
824
|
-
|
|
866
|
+
M,
|
|
867
|
+
P,
|
|
868
|
+
F,
|
|
869
|
+
L,
|
|
825
870
|
le,
|
|
826
|
-
ue,
|
|
827
871
|
_,
|
|
828
872
|
v,
|
|
829
873
|
y,
|
|
@@ -831,78 +875,96 @@ var de = {
|
|
|
831
875
|
x,
|
|
832
876
|
C,
|
|
833
877
|
w,
|
|
834
|
-
|
|
878
|
+
T,
|
|
835
879
|
O,
|
|
836
880
|
k,
|
|
837
881
|
ee,
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
882
|
+
me,
|
|
883
|
+
fe,
|
|
884
|
+
he,
|
|
841
885
|
te,
|
|
886
|
+
ne,
|
|
842
887
|
re,
|
|
843
|
-
ie,
|
|
844
888
|
ae,
|
|
845
|
-
|
|
846
|
-
j,
|
|
847
|
-
N
|
|
889
|
+
oe
|
|
848
890
|
]);
|
|
849
|
-
return /* @__PURE__ */
|
|
850
|
-
style: !t &&
|
|
851
|
-
className: g(t ? "flex h-full items-center justify-center" :
|
|
852
|
-
children: t ? /* @__PURE__ */
|
|
891
|
+
return /* @__PURE__ */ z("div", {
|
|
892
|
+
style: !t && Pe.has(e.type) ? _e : void 0,
|
|
893
|
+
className: g(t ? "flex h-full items-center justify-center" : ye, ue),
|
|
894
|
+
children: t ? /* @__PURE__ */ z(E, {}) : be
|
|
853
895
|
});
|
|
854
|
-
}),
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
896
|
+
}), Ie = {
|
|
897
|
+
mcpAppDivider: "_mcpAppDivider_1jh5p_1",
|
|
898
|
+
mcpAppVersion: "_mcpAppVersion_1jh5p_5"
|
|
899
|
+
}, 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: h = "Copied!", copyJsonLabel: _ = "Copy as JSON", copiedJsonLabel: v = "Copied!", visualizerErrorLabel: C, unsupportedLabel: T = "Preview is not supported for this file", loadErrorLabel: E = "Failed to load file", forbiddenErrorLabel: D = "You don't have permission to access this file", htmlFrameBlockedLabel: O = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: ie = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: M = "Reload", pdfThumbnailsLabel: P, pdfShowThumbnailsLabel: se, pdfHideThumbnailsLabel: ce, pdfPageNumberLabel: V, pdfContentLoadingLabel: H, pdfContentErrorLabel: ue, pdfContentRetryLabel: de, xlsxFormulaLabel: fe, codeContentLoadingLabel: me, codeContentErrorLabel: he, codeContentRetryLabel: U, tableCopyLabel: ge, tableCopiedLabel: _e, tableDownloadCsvLabel: ve, ooxmlHighlightsLabel: ye, ooxmlHighlightNavigatedLabel: be }, onDownload: xe, onCopyText: Se, onCopyMarkdown: Ce, onCopyJson: W, tableDownloadFilename: we, isMobile: G = !1, defaultWidth: Te, minWidth: Ee = 600, maxWidth: De = 1500, onResizeStop: Oe, styles: ke, codeBlockTheme: Ae, loadPdf: je, configurePdfWorker: K }) => {
|
|
900
|
+
let [Me, Ne] = R(!1), [Pe, Re] = R(!1), [ze, q] = R(!1), [J, Be] = R(!1), [Ve, He] = R(void 0), Y = L(null), X = L(null), Z = L(null), Ue = N(() => {
|
|
901
|
+
Se?.(), Y.current != null && clearTimeout(Y.current), Ne(!0), Y.current = setTimeout(() => Ne(!1), Le);
|
|
902
|
+
}, [Se]), We = N(() => {
|
|
903
|
+
Ce?.(), X.current != null && clearTimeout(X.current), Re(!0), X.current = setTimeout(() => Re(!1), Le);
|
|
904
|
+
}, [Ce]), Ge = N(() => {
|
|
905
|
+
W?.(), Z.current != null && clearTimeout(Z.current), q(!0), Z.current = setTimeout(() => q(!1), Le);
|
|
906
|
+
}, [W]);
|
|
907
|
+
F(() => () => {
|
|
863
908
|
Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
|
|
864
909
|
}, []);
|
|
865
|
-
let
|
|
866
|
-
|
|
910
|
+
let Ke = N(() => {
|
|
911
|
+
Be((e) => !e);
|
|
867
912
|
}, []);
|
|
868
|
-
|
|
869
|
-
|
|
913
|
+
F(() => {
|
|
914
|
+
Be(!1), He(void 0);
|
|
870
915
|
}, [r]);
|
|
871
|
-
let { className:
|
|
872
|
-
|
|
916
|
+
let { className: Q, panelStyles: qe, ...Je } = ke ?? {}, { colors: $, typography: Ye } = Je, Xe = I(() => m({
|
|
917
|
+
"--ac-mcp-app-divider": $?.mcpAppDividerColor,
|
|
918
|
+
"--ac-mcp-app-version": $?.mcpAppVersionColor
|
|
919
|
+
}), [$?.mcpAppDividerColor, $?.mcpAppVersionColor]), Ze = r.type === i.McpApp && Ve != null ? /* @__PURE__ */ B("span", {
|
|
920
|
+
style: Xe,
|
|
921
|
+
children: [
|
|
922
|
+
/* @__PURE__ */ z("span", { children: a }),
|
|
923
|
+
/* @__PURE__ */ z("span", {
|
|
924
|
+
"aria-hidden": !0,
|
|
925
|
+
className: g("mx-1.5 inline-block h-3 w-0 border-s align-middle", Ie.mcpAppDivider)
|
|
926
|
+
}),
|
|
927
|
+
/* @__PURE__ */ z("span", { children: Ve.name }),
|
|
928
|
+
Ve.version && /* @__PURE__ */ z("span", {
|
|
929
|
+
className: g("ms-2", Ye?.mcpAppVersionClassName ?? "dial-caption-text", Ie.mcpAppVersion),
|
|
930
|
+
children: Ve.version
|
|
931
|
+
})
|
|
932
|
+
]
|
|
933
|
+
}) : a, Qe = !t && r.type === i.Html && r.srcdoc != null, $e = !t && Se != null && (r.type === i.PlainText || r.type === i.Code), et = !t && Ce != null && r.type === i.Markdown, tt = !t && W != null && r.type === i.Json, nt = !t && xe != null && o(r), rt = !t && r.type === i.McpApp && r.onReload != null;
|
|
934
|
+
return /* @__PURE__ */ z(b, {
|
|
873
935
|
isOpen: e,
|
|
874
936
|
orientation: y.Right,
|
|
875
|
-
title:
|
|
937
|
+
title: Ze,
|
|
876
938
|
labels: {
|
|
877
939
|
ariaLabel: s,
|
|
878
940
|
closeLabel: c,
|
|
879
941
|
resizeLabel: l
|
|
880
942
|
},
|
|
881
943
|
onClose: n,
|
|
882
|
-
resizable: !
|
|
883
|
-
defaultWidth:
|
|
884
|
-
minWidth:
|
|
885
|
-
maxWidth:
|
|
886
|
-
onResizeStop:
|
|
944
|
+
resizable: !G,
|
|
945
|
+
defaultWidth: Te,
|
|
946
|
+
minWidth: Ee,
|
|
947
|
+
maxWidth: De,
|
|
948
|
+
onResizeStop: Oe,
|
|
887
949
|
styles: {
|
|
888
|
-
...
|
|
889
|
-
titleClassName:
|
|
890
|
-
headerClassName: g("border-b border-tertiary",
|
|
891
|
-
className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0",
|
|
950
|
+
...qe,
|
|
951
|
+
titleClassName: qe?.titleClassName ?? "dial-h3-text",
|
|
952
|
+
headerClassName: g("border-b border-tertiary", qe?.headerClassName),
|
|
953
|
+
className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", Q, qe?.className, pe.panel)
|
|
892
954
|
},
|
|
893
|
-
rightActions:
|
|
894
|
-
|
|
895
|
-
icon: /* @__PURE__ */
|
|
955
|
+
rightActions: Qe || $e || et || tt || nt || rt ? /* @__PURE__ */ B(le, { children: [
|
|
956
|
+
rt && /* @__PURE__ */ z(w, {
|
|
957
|
+
icon: /* @__PURE__ */ z(oe, {
|
|
896
958
|
size: x.LG,
|
|
897
959
|
stroke: S,
|
|
898
960
|
"aria-hidden": !0
|
|
899
961
|
}),
|
|
900
|
-
"aria-label":
|
|
901
|
-
tooltipProps: { tooltip:
|
|
962
|
+
"aria-label": M,
|
|
963
|
+
tooltipProps: { tooltip: M },
|
|
902
964
|
onClick: r.type === i.McpApp ? r.onReload : void 0
|
|
903
965
|
}),
|
|
904
|
-
|
|
905
|
-
icon:
|
|
966
|
+
Qe && /* @__PURE__ */ z(w, {
|
|
967
|
+
icon: z(J ? re : ee, {
|
|
906
968
|
size: x.LG,
|
|
907
969
|
stroke: S,
|
|
908
970
|
"aria-hidden": !0
|
|
@@ -910,230 +972,122 @@ var de = {
|
|
|
910
972
|
"aria-label": J ? j : A,
|
|
911
973
|
"aria-pressed": J,
|
|
912
974
|
tooltipProps: { tooltip: J ? j : A },
|
|
913
|
-
onClick:
|
|
975
|
+
onClick: Ke
|
|
914
976
|
}),
|
|
915
|
-
|
|
916
|
-
icon:
|
|
977
|
+
$e && /* @__PURE__ */ z(w, {
|
|
978
|
+
icon: z(Me ? k : te, {
|
|
917
979
|
size: x.LG,
|
|
918
980
|
stroke: S,
|
|
919
981
|
"aria-hidden": !0
|
|
920
982
|
}),
|
|
921
|
-
"aria-label":
|
|
922
|
-
tooltipProps: { tooltip:
|
|
923
|
-
onClick:
|
|
983
|
+
"aria-label": Me ? f : d,
|
|
984
|
+
tooltipProps: { tooltip: Me ? f : d },
|
|
985
|
+
onClick: Ue
|
|
924
986
|
}),
|
|
925
|
-
|
|
926
|
-
icon:
|
|
987
|
+
et && /* @__PURE__ */ z(w, {
|
|
988
|
+
icon: z(Pe ? k : ae, {
|
|
927
989
|
size: x.LG,
|
|
928
990
|
stroke: S,
|
|
929
991
|
"aria-hidden": !0
|
|
930
992
|
}),
|
|
931
|
-
"aria-label":
|
|
932
|
-
tooltipProps: { tooltip:
|
|
933
|
-
onClick:
|
|
993
|
+
"aria-label": Pe ? h : p,
|
|
994
|
+
tooltipProps: { tooltip: Pe ? h : p },
|
|
995
|
+
onClick: We
|
|
934
996
|
}),
|
|
935
|
-
|
|
936
|
-
icon:
|
|
997
|
+
tt && /* @__PURE__ */ z(w, {
|
|
998
|
+
icon: z(ze ? k : te, {
|
|
937
999
|
size: x.LG,
|
|
938
1000
|
stroke: S,
|
|
939
1001
|
"aria-hidden": !0
|
|
940
1002
|
}),
|
|
941
|
-
"aria-label":
|
|
942
|
-
tooltipProps: { tooltip:
|
|
943
|
-
onClick:
|
|
1003
|
+
"aria-label": ze ? v : _,
|
|
1004
|
+
tooltipProps: { tooltip: ze ? v : _ },
|
|
1005
|
+
onClick: Ge
|
|
944
1006
|
}),
|
|
945
|
-
|
|
946
|
-
icon: /* @__PURE__ */
|
|
1007
|
+
nt && /* @__PURE__ */ z(w, {
|
|
1008
|
+
icon: /* @__PURE__ */ z(ne, {
|
|
947
1009
|
size: x.LG,
|
|
948
1010
|
stroke: S
|
|
949
1011
|
}),
|
|
950
1012
|
"aria-label": u,
|
|
951
1013
|
tooltipProps: { tooltip: u },
|
|
952
|
-
onClick:
|
|
1014
|
+
onClick: xe
|
|
953
1015
|
})
|
|
954
1016
|
] }) : null,
|
|
955
|
-
children: /* @__PURE__ */
|
|
1017
|
+
children: /* @__PURE__ */ z(Fe, {
|
|
956
1018
|
content: r,
|
|
957
1019
|
isLoading: t,
|
|
958
1020
|
fileName: a,
|
|
959
1021
|
isHtmlSourceView: J,
|
|
1022
|
+
onAppInfo: r.type === i.McpApp ? He : void 0,
|
|
960
1023
|
labels: {
|
|
961
|
-
unsupportedLabel:
|
|
962
|
-
loadErrorLabel:
|
|
963
|
-
forbiddenErrorLabel:
|
|
964
|
-
visualizerErrorLabel:
|
|
965
|
-
htmlFrameBlockedLabel:
|
|
966
|
-
htmlOpenInNewTabLabel:
|
|
967
|
-
pdfThumbnailsLabel:
|
|
968
|
-
pdfShowThumbnailsLabel:
|
|
969
|
-
pdfHideThumbnailsLabel:
|
|
970
|
-
pdfPageNumberLabel:
|
|
971
|
-
pdfContentLoadingLabel:
|
|
1024
|
+
unsupportedLabel: T,
|
|
1025
|
+
loadErrorLabel: E,
|
|
1026
|
+
forbiddenErrorLabel: D,
|
|
1027
|
+
visualizerErrorLabel: C,
|
|
1028
|
+
htmlFrameBlockedLabel: O,
|
|
1029
|
+
htmlOpenInNewTabLabel: ie,
|
|
1030
|
+
pdfThumbnailsLabel: P,
|
|
1031
|
+
pdfShowThumbnailsLabel: se,
|
|
1032
|
+
pdfHideThumbnailsLabel: ce,
|
|
1033
|
+
pdfPageNumberLabel: V,
|
|
1034
|
+
pdfContentLoadingLabel: H,
|
|
972
1035
|
pdfContentErrorLabel: ue,
|
|
973
|
-
pdfContentRetryLabel:
|
|
974
|
-
xlsxFormulaLabel:
|
|
975
|
-
codeContentLoadingLabel:
|
|
976
|
-
codeContentErrorLabel:
|
|
977
|
-
codeContentRetryLabel:
|
|
978
|
-
|
|
979
|
-
tableCopyTxtLabel: he,
|
|
980
|
-
tableCopyMarkdownLabel: ge,
|
|
1036
|
+
pdfContentRetryLabel: de,
|
|
1037
|
+
xlsxFormulaLabel: fe,
|
|
1038
|
+
codeContentLoadingLabel: me,
|
|
1039
|
+
codeContentErrorLabel: he,
|
|
1040
|
+
codeContentRetryLabel: U,
|
|
1041
|
+
tableCopyLabel: ge,
|
|
981
1042
|
tableCopiedLabel: _e,
|
|
982
1043
|
tableDownloadCsvLabel: ve,
|
|
983
|
-
ooxmlHighlightsLabel:
|
|
984
|
-
ooxmlHighlightNavigatedLabel:
|
|
1044
|
+
ooxmlHighlightsLabel: ye,
|
|
1045
|
+
ooxmlHighlightNavigatedLabel: be
|
|
985
1046
|
},
|
|
986
|
-
styles:
|
|
987
|
-
codeBlockTheme:
|
|
988
|
-
tableDownloadFilename:
|
|
989
|
-
loadPdf:
|
|
990
|
-
configurePdfWorker:
|
|
1047
|
+
styles: Je,
|
|
1048
|
+
codeBlockTheme: Ae,
|
|
1049
|
+
tableDownloadFilename: we,
|
|
1050
|
+
loadPdf: je,
|
|
1051
|
+
configurePdfWorker: K
|
|
991
1052
|
})
|
|
992
1053
|
});
|
|
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 = {
|
|
1054
|
+
}), ze = new Set(["html", "htm"]), q = {
|
|
1101
1055
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1102
1056
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1103
1057
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
1104
|
-
},
|
|
1058
|
+
}, 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(".")), Be = {
|
|
1105
1059
|
docx: r.Docx,
|
|
1106
1060
|
xlsx: r.Xlsx,
|
|
1107
1061
|
pptx: r.Pptx,
|
|
1108
1062
|
csv: r.Csv
|
|
1109
|
-
}, Be = {
|
|
1110
|
-
[X.docx]: r.Docx,
|
|
1111
|
-
[X.xlsx]: r.Xlsx,
|
|
1112
|
-
[X.pptx]: r.Pptx,
|
|
1113
|
-
[f.CSV]: r.Csv
|
|
1114
1063
|
}, Ve = {
|
|
1115
|
-
[
|
|
1116
|
-
[
|
|
1117
|
-
[
|
|
1064
|
+
[q.docx]: r.Docx,
|
|
1065
|
+
[q.xlsx]: r.Xlsx,
|
|
1066
|
+
[q.pptx]: r.Pptx,
|
|
1067
|
+
[f.CSV]: r.Csv
|
|
1068
|
+
}, He = {
|
|
1069
|
+
[r.Docx]: q.docx,
|
|
1070
|
+
[r.Xlsx]: q.xlsx,
|
|
1071
|
+
[r.Pptx]: q.pptx,
|
|
1118
1072
|
[r.Csv]: f.CSV
|
|
1119
|
-
},
|
|
1073
|
+
}, Y = (e, t) => {
|
|
1120
1074
|
let n = t?.split(";", 1)[0].trim().toLowerCase();
|
|
1121
1075
|
if (n != null) {
|
|
1122
|
-
let e =
|
|
1076
|
+
let e = Ve[n];
|
|
1123
1077
|
if (e != null) return e;
|
|
1124
1078
|
}
|
|
1125
1079
|
let r = e.lastIndexOf(".");
|
|
1126
|
-
if (r !== -1) return
|
|
1127
|
-
},
|
|
1128
|
-
let n =
|
|
1129
|
-
return n == null ? void 0 :
|
|
1130
|
-
},
|
|
1080
|
+
if (r !== -1) return Be[e.slice(r + 1).toLowerCase()];
|
|
1081
|
+
}, X = (e, t) => Y(e, t) != null, Z = (e, t) => {
|
|
1082
|
+
let n = Y(e, t);
|
|
1083
|
+
return n == null ? void 0 : He[n];
|
|
1084
|
+
}, Ue = (e) => {
|
|
1131
1085
|
let t = e.lastIndexOf(".");
|
|
1132
|
-
return t === -1 ? !1 :
|
|
1133
|
-
},
|
|
1086
|
+
return t === -1 ? !1 : J.has(e.slice(t + 1).toLowerCase());
|
|
1087
|
+
}, We = (e) => {
|
|
1134
1088
|
let t = e.lastIndexOf(".");
|
|
1135
|
-
return t === -1 ? !1 :
|
|
1136
|
-
},
|
|
1089
|
+
return t === -1 ? !1 : ze.has(e.slice(t + 1).toLowerCase());
|
|
1090
|
+
}, Ge = {
|
|
1137
1091
|
xml: "xml",
|
|
1138
1092
|
csv: "plaintext",
|
|
1139
1093
|
tsv: "plaintext",
|
|
@@ -1181,21 +1135,187 @@ var Le = ({ children: e }) => {
|
|
|
1181
1135
|
gitignore: "plaintext",
|
|
1182
1136
|
dockerfile: "plaintext",
|
|
1183
1137
|
makefile: "plaintext"
|
|
1184
|
-
},
|
|
1138
|
+
}, Ke = (e) => Ge[e], Q = (e) => ({
|
|
1185
1139
|
type: i.Unsupported,
|
|
1186
1140
|
...e != null && { url: e }
|
|
1187
|
-
}),
|
|
1141
|
+
}), qe = (e) => ({
|
|
1188
1142
|
type: i.Error,
|
|
1189
1143
|
errorType: n.LoadFailed,
|
|
1190
1144
|
...e != null && { url: e }
|
|
1191
|
-
}),
|
|
1145
|
+
}), Je = (e) => ({
|
|
1192
1146
|
type: i.Error,
|
|
1193
1147
|
errorType: n.Forbidden,
|
|
1194
1148
|
...e != null && { url: e }
|
|
1195
|
-
}),
|
|
1149
|
+
}), $ = (e) => {
|
|
1150
|
+
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;
|
|
1151
|
+
}, Ye = (e) => {
|
|
1152
|
+
let t = $(e);
|
|
1153
|
+
t != null && URL.revokeObjectURL(t);
|
|
1154
|
+
}, Xe = {
|
|
1155
|
+
type: i.PlainText,
|
|
1156
|
+
text: ""
|
|
1157
|
+
}, Ze = A(void 0);
|
|
1158
|
+
Ze.displayName = "AttachmentCanvasContext";
|
|
1159
|
+
var Qe = ({ children: e }) => {
|
|
1160
|
+
let [t, n] = R(!1), [r, i] = R(!1), [a, o] = R(Xe), [s, c] = R(void 0), [l, u] = R(void 0), d = N((e, t) => {
|
|
1161
|
+
c(e), u(t), i(!0), n(!0);
|
|
1162
|
+
}, []), f = N((e, t, r) => {
|
|
1163
|
+
o(e), c(t), u(r), i(!1), n(!0);
|
|
1164
|
+
}, []), p = N(() => {
|
|
1165
|
+
o(Xe), n(!1), i(!1), u(void 0);
|
|
1166
|
+
}, []);
|
|
1167
|
+
return F(() => () => {
|
|
1168
|
+
let e = $(a);
|
|
1169
|
+
e != null && URL.revokeObjectURL(e);
|
|
1170
|
+
}, [a]), /* @__PURE__ */ z(Ze.Provider, {
|
|
1171
|
+
value: I(() => ({
|
|
1172
|
+
isOpen: t,
|
|
1173
|
+
isLoading: r,
|
|
1174
|
+
content: a,
|
|
1175
|
+
fileName: s,
|
|
1176
|
+
attachmentId: l,
|
|
1177
|
+
openCanvasLoading: d,
|
|
1178
|
+
openCanvas: f,
|
|
1179
|
+
closeCanvas: p
|
|
1180
|
+
}), [
|
|
1181
|
+
t,
|
|
1182
|
+
r,
|
|
1183
|
+
a,
|
|
1184
|
+
s,
|
|
1185
|
+
l,
|
|
1186
|
+
d,
|
|
1187
|
+
f,
|
|
1188
|
+
p
|
|
1189
|
+
]),
|
|
1190
|
+
children: e
|
|
1191
|
+
});
|
|
1192
|
+
}, $e = () => {
|
|
1193
|
+
let e = P(Ze);
|
|
1194
|
+
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
1195
|
+
return e;
|
|
1196
|
+
}, et = M(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
|
|
1197
|
+
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: P, ooxmlHighlightNavigatedLabel: F } = e ?? {}, { isOpen: I, isLoading: L, content: R, fileName: se, closeCanvas: ce } = $e(), le = N(() => {
|
|
1198
|
+
a(R, se);
|
|
1199
|
+
}, [R, se]), B = N(() => {
|
|
1200
|
+
(R.type === i.PlainText || R.type === i.Code) && h(R.text);
|
|
1201
|
+
}, [R]), V = N(() => {
|
|
1202
|
+
R.type === i.Markdown && h(R.text);
|
|
1203
|
+
}, [R]), H = N(() => {
|
|
1204
|
+
R.type === i.Json && h(JSON.stringify(R.value, null, 2));
|
|
1205
|
+
}, [R]);
|
|
1206
|
+
return /* @__PURE__ */ z(Re, {
|
|
1207
|
+
isOpen: I,
|
|
1208
|
+
isLoading: L,
|
|
1209
|
+
onClose: ce,
|
|
1210
|
+
content: R,
|
|
1211
|
+
fileName: se,
|
|
1212
|
+
labels: {
|
|
1213
|
+
ariaLabel: l,
|
|
1214
|
+
closeLabel: u,
|
|
1215
|
+
downloadLabel: d,
|
|
1216
|
+
copyTextLabel: g,
|
|
1217
|
+
copiedTextLabel: _,
|
|
1218
|
+
copyMarkdownLabel: v,
|
|
1219
|
+
copiedMarkdownLabel: y,
|
|
1220
|
+
copyJsonLabel: b,
|
|
1221
|
+
copiedJsonLabel: x,
|
|
1222
|
+
unsupportedLabel: f,
|
|
1223
|
+
loadErrorLabel: p,
|
|
1224
|
+
forbiddenErrorLabel: m,
|
|
1225
|
+
htmlFrameBlockedLabel: S,
|
|
1226
|
+
htmlOpenInNewTabLabel: C,
|
|
1227
|
+
htmlViewSourceLabel: w,
|
|
1228
|
+
htmlViewRenderedLabel: T,
|
|
1229
|
+
pdfThumbnailsLabel: E,
|
|
1230
|
+
pdfShowThumbnailsLabel: D,
|
|
1231
|
+
pdfHideThumbnailsLabel: O,
|
|
1232
|
+
pdfPageNumberLabel: k,
|
|
1233
|
+
pdfContentLoadingLabel: ee,
|
|
1234
|
+
pdfContentErrorLabel: te,
|
|
1235
|
+
pdfContentRetryLabel: ne,
|
|
1236
|
+
xlsxFormulaLabel: re,
|
|
1237
|
+
codeContentLoadingLabel: ie,
|
|
1238
|
+
codeContentErrorLabel: ae,
|
|
1239
|
+
codeContentRetryLabel: oe,
|
|
1240
|
+
tableCopyLabel: A,
|
|
1241
|
+
tableCopiedLabel: j,
|
|
1242
|
+
tableDownloadCsvLabel: M,
|
|
1243
|
+
ooxmlHighlightsLabel: P,
|
|
1244
|
+
ooxmlHighlightNavigatedLabel: F
|
|
1245
|
+
},
|
|
1246
|
+
onDownload: le,
|
|
1247
|
+
onCopyText: R.type === i.PlainText || R.type === i.Code ? B : void 0,
|
|
1248
|
+
onCopyMarkdown: R.type === i.Markdown ? V : void 0,
|
|
1249
|
+
onCopyJson: R.type === i.Json ? H : void 0,
|
|
1250
|
+
tableDownloadFilename: s,
|
|
1251
|
+
isMobile: t,
|
|
1252
|
+
defaultWidth: n,
|
|
1253
|
+
maxWidth: r,
|
|
1254
|
+
codeBlockTheme: o,
|
|
1255
|
+
configurePdfWorker: c
|
|
1256
|
+
});
|
|
1257
|
+
}), tt = {
|
|
1258
|
+
frame: "_frame_g47g7_1",
|
|
1259
|
+
header: "_header_g47g7_6",
|
|
1260
|
+
title: "_title_g47g7_10"
|
|
1261
|
+
}, nt = 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 }) => {
|
|
1262
|
+
let u = e.visualizerName.trim();
|
|
1263
|
+
return /* @__PURE__ */ B("div", {
|
|
1264
|
+
className: g("flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", tt.frame),
|
|
1265
|
+
style: m({
|
|
1266
|
+
"--igv-bg": l?.background,
|
|
1267
|
+
"--igv-border": l?.border,
|
|
1268
|
+
"--igv-title-text": l?.titleText
|
|
1269
|
+
}),
|
|
1270
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1271
|
+
className: g("flex min-h-10 items-center justify-between gap-2 border-b px-4 py-2", tt.header),
|
|
1272
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1273
|
+
className: g("min-w-0 truncate", c, tt.title),
|
|
1274
|
+
children: u
|
|
1275
|
+
}), /* @__PURE__ */ z("div", {
|
|
1276
|
+
role: "toolbar",
|
|
1277
|
+
"aria-label": i,
|
|
1278
|
+
className: "flex items-center gap-1",
|
|
1279
|
+
children: /* @__PURE__ */ z(w, {
|
|
1280
|
+
icon: /* @__PURE__ */ z(O, {
|
|
1281
|
+
size: x.SM,
|
|
1282
|
+
stroke: S,
|
|
1283
|
+
"aria-hidden": !0
|
|
1284
|
+
}),
|
|
1285
|
+
"aria-label": r,
|
|
1286
|
+
size: C.Small,
|
|
1287
|
+
onClick: n
|
|
1288
|
+
})
|
|
1289
|
+
})]
|
|
1290
|
+
}), /* @__PURE__ */ z("div", {
|
|
1291
|
+
className: "w-full",
|
|
1292
|
+
style: { height: `${t}px` },
|
|
1293
|
+
children: /* @__PURE__ */ z(je, {
|
|
1294
|
+
content: e,
|
|
1295
|
+
loadingLabel: o,
|
|
1296
|
+
errorLabel: s,
|
|
1297
|
+
frameTitle: a
|
|
1298
|
+
})
|
|
1299
|
+
})]
|
|
1300
|
+
});
|
|
1301
|
+
}), rt = (e, t) => {
|
|
1196
1302
|
let n = e.toLowerCase();
|
|
1197
1303
|
return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
|
|
1198
|
-
},
|
|
1304
|
+
}, it = (e, t) => {
|
|
1305
|
+
if (!(e == null || e === "")) return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
|
|
1306
|
+
}, at = (e) => `${e}:grouped-visualizer`, ot = (e, t) => {
|
|
1307
|
+
let n = (t.contentType ?? "").split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""), r = [], i = [];
|
|
1308
|
+
return e.forEach((e) => {
|
|
1309
|
+
if (e.url != null && e.url !== "" && (n.length === 0 || n.includes(e.contentType.toLowerCase()))) {
|
|
1310
|
+
r.push(e);
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
i.push(e);
|
|
1314
|
+
}), {
|
|
1315
|
+
claimed: r,
|
|
1316
|
+
unclaimed: i
|
|
1317
|
+
};
|
|
1318
|
+
}, st = (e) => {
|
|
1199
1319
|
let t;
|
|
1200
1320
|
try {
|
|
1201
1321
|
t = new URL(e).pathname;
|
|
@@ -1208,63 +1328,63 @@ var Le = ({ children: e }) => {
|
|
|
1208
1328
|
} catch {
|
|
1209
1329
|
return n;
|
|
1210
1330
|
}
|
|
1211
|
-
},
|
|
1212
|
-
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } =
|
|
1331
|
+
}, ct = (e, t) => {
|
|
1332
|
+
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = $e(), { customVisualizers: o, themeId: s, onBeforeOpen: l } = t, u = N(async (t, n, r) => {
|
|
1213
1333
|
if (t.url == null && t.referenceUrl != null) {
|
|
1214
1334
|
let i = e.resolveReferencePdfContent(t);
|
|
1215
|
-
if (i != null) return
|
|
1335
|
+
if (i != null) return r(i, t.name, n);
|
|
1216
1336
|
}
|
|
1217
|
-
let a = t.contentType.toLowerCase(), c =
|
|
1337
|
+
let a = t.contentType.toLowerCase(), c = rt(a, o);
|
|
1218
1338
|
if (c != null) {
|
|
1219
1339
|
let i = await e.resolveVisualizerContent(t, c, s);
|
|
1220
|
-
if (i != null) return
|
|
1340
|
+
if (i != null) return r(i, t.name, n);
|
|
1221
1341
|
}
|
|
1222
1342
|
if (!a && t.data != null) {
|
|
1223
1343
|
let i = await e.resolveTextContent(t);
|
|
1224
|
-
if (i != null) return
|
|
1344
|
+
if (i != null) return r(i, t.name, n);
|
|
1225
1345
|
}
|
|
1226
|
-
let l =
|
|
1227
|
-
if (l != null) return
|
|
1346
|
+
let l = Y("", a);
|
|
1347
|
+
if (l != null) return r(await e.resolveOoxmlContent(t, l) ?? Q(e.resolveContentUrl(t)), t.name, n);
|
|
1228
1348
|
switch (a) {
|
|
1229
|
-
case f.PDF: return
|
|
1230
|
-
case f.Markdown: return
|
|
1231
|
-
case f.JSON: return
|
|
1349
|
+
case f.PDF: return r(await e.resolvePdfContent(t) ?? Q(e.resolveContentUrl(t)), t.name, n);
|
|
1350
|
+
case f.Markdown: return r(await e.resolveMarkdownContent(t) ?? Q(e.resolveContentUrl(t)), t.name, n);
|
|
1351
|
+
case f.JSON: return r(await e.resolveJsonContent(t) ?? Q(e.resolveContentUrl(t)), t.name, n);
|
|
1232
1352
|
}
|
|
1233
|
-
let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h =
|
|
1234
|
-
if (h != null) return
|
|
1353
|
+
let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h = Y(u);
|
|
1354
|
+
if (h != null) return r(await e.resolveOoxmlContent(t, h) ?? Q(e.resolveContentUrl(t)), t.name, n);
|
|
1235
1355
|
switch (m) {
|
|
1236
1356
|
case d.Markdown:
|
|
1237
1357
|
case d.MarkdownAlt: {
|
|
1238
1358
|
let i = await e.resolveMarkdownContent(t);
|
|
1239
|
-
return i == null ? !1 : (
|
|
1359
|
+
return i == null ? !1 : r(i, t.name, n);
|
|
1240
1360
|
}
|
|
1241
1361
|
case d.JSON: {
|
|
1242
1362
|
let i = await e.resolveJsonContent(t);
|
|
1243
|
-
return i == null ? !1 : (
|
|
1363
|
+
return i == null ? !1 : r(i, t.name, n);
|
|
1244
1364
|
}
|
|
1245
1365
|
case d.PDF: {
|
|
1246
1366
|
let i = await e.resolvePdfContent(t);
|
|
1247
|
-
return i == null ? !1 : (
|
|
1367
|
+
return i == null ? !1 : r(i, t.name, n);
|
|
1248
1368
|
}
|
|
1249
1369
|
}
|
|
1250
|
-
let g = t.name != null &&
|
|
1251
|
-
if (t.name != null && !
|
|
1370
|
+
let g = t.name != null && We(t.name) || t.url != null && We(st(t.url));
|
|
1371
|
+
if (t.name != null && !Ue(t.name) && !g) return r(Q(e.resolveContentUrl(t)), t.name, n);
|
|
1252
1372
|
if (g) {
|
|
1253
1373
|
let a = await e.resolveHtmlContent(t);
|
|
1254
|
-
return a == null ? e.hasTextSource(t) ? (
|
|
1374
|
+
return a == null ? e.hasTextSource(t) ? r(Q(e.resolveContentUrl(t)), t.name, n) : t.url == null ? !1 : r({
|
|
1255
1375
|
type: i.Html,
|
|
1256
1376
|
url: t.url
|
|
1257
|
-
}, t.name,
|
|
1377
|
+
}, t.name, n) : r(a, t.name, n);
|
|
1258
1378
|
}
|
|
1259
|
-
let _ = await e.resolveCodeContent(t,
|
|
1260
|
-
return _ == null ? !1 : (
|
|
1379
|
+
let _ = await e.resolveCodeContent(t, Ke(m));
|
|
1380
|
+
return _ == null ? !1 : r(_, t.name, n);
|
|
1261
1381
|
}, [
|
|
1262
|
-
n,
|
|
1263
1382
|
o,
|
|
1264
1383
|
s,
|
|
1265
1384
|
e
|
|
1266
1385
|
]);
|
|
1267
|
-
return { openAttachmentCanvas:
|
|
1386
|
+
return { openAttachmentCanvas: N(async (t, o = t.id, s) => {
|
|
1387
|
+
let d = () => s == null || s(), f = (e, t, r) => d() ? (n(e, t, r), !0) : (Ye(e), !1);
|
|
1268
1388
|
switch (t.type) {
|
|
1269
1389
|
case c.Image: {
|
|
1270
1390
|
let r = e.resolveImageContent(t);
|
|
@@ -1280,14 +1400,14 @@ var Le = ({ children: e }) => {
|
|
|
1280
1400
|
}
|
|
1281
1401
|
case c.File: {
|
|
1282
1402
|
l?.(), r(t.name, o);
|
|
1283
|
-
let e = await u(t, o);
|
|
1284
|
-
return e
|
|
1403
|
+
let e = await u(t, o, f);
|
|
1404
|
+
return !e && d() && a(), e;
|
|
1285
1405
|
}
|
|
1286
1406
|
case c.Pasted:
|
|
1287
1407
|
case c.Prompt: {
|
|
1288
1408
|
l?.(), r(t.name, o);
|
|
1289
|
-
let
|
|
1290
|
-
return
|
|
1409
|
+
let n = await e.resolveTextContent(t);
|
|
1410
|
+
return n == null ? (d() && a(), !1) : f(n, t.name, o);
|
|
1291
1411
|
}
|
|
1292
1412
|
default: return !1;
|
|
1293
1413
|
}
|
|
@@ -1301,4 +1421,4 @@ var Le = ({ children: e }) => {
|
|
|
1301
1421
|
]) };
|
|
1302
1422
|
};
|
|
1303
1423
|
//#endregion
|
|
1304
|
-
export {
|
|
1424
|
+
export { pe as ATTACHMENT_CANVAS_CLASS, Re as AttachmentCanvas, Fe as AttachmentCanvasBody, et as AttachmentCanvasContainer, Qe as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, ge as CodeContent, nt as InlineGroupedVisualizer, we as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, Je as createForbiddenCanvasContent, qe as createLoadErrorCanvasContent, Q as createUnsupportedCanvasContent, a as downloadAttachmentContent, Ke as extensionToLanguage, it as findVisualizerForApplication, rt as findVisualizerForMime, Y as getOoxmlFileType, Z as getOoxmlMimeType, at as groupedVisualizerCanvasKey, o as isDownloadable, We as isHtmlPreviewable, X as isOoxmlPreviewable, Ue as isTextPreviewable, ot as partitionAttachmentsForApplicationVisualizer, $e as useAttachmentCanvas, ct as useOpenAttachmentCanvas };
|