@epam/ai-dial-attachment-canvas 1.2.0-dev.28 → 1.2.0-dev.34
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/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/index.js +361 -369
- package/models/attachment-canvas.d.ts +3 -7
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -4,39 +4,39 @@ import { AttachmentType as c, CodeBlockTheme as l, DEFAULT_MARKDOWN_CLASS_NAMES
|
|
|
4
4
|
import { SidebarOrientation as y, SidebarPanel as b } from "@epam/ai-dial-sidebar";
|
|
5
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
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
|
|
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
|
-
var
|
|
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
|
+
var pe = {
|
|
15
15
|
container: "_container_1nhig_1",
|
|
16
16
|
containerLight: "_containerLight_1nhig_5"
|
|
17
|
-
},
|
|
17
|
+
}, me = {
|
|
18
18
|
[l.Dark]: _,
|
|
19
19
|
[l.Light]: _
|
|
20
|
-
},
|
|
20
|
+
}, U = () => j(async () => {
|
|
21
21
|
let { Prism: e } = await import("react-syntax-highlighter");
|
|
22
22
|
return { default: e };
|
|
23
|
-
}),
|
|
24
|
-
let { text: r, language: i } = e, a = i == null || i === "plaintext", o =
|
|
23
|
+
}), he = M(({ content: e, codeBlockTheme: t = l.Light, labels: n }) => {
|
|
24
|
+
let { text: r, language: i } = e, a = i == null || i === "plaintext", o = me[t], c = t === l.Light, [u, d] = L(0), f = F(U, [u]), p = N(() => {
|
|
25
25
|
d((e) => e + 1);
|
|
26
|
-
}, []), m = /* @__PURE__ */
|
|
26
|
+
}, []), m = /* @__PURE__ */ z("pre", {
|
|
27
27
|
className: "whitespace-pre-wrap break-words p-4",
|
|
28
28
|
children: r
|
|
29
29
|
});
|
|
30
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ z("div", {
|
|
31
31
|
dir: "ltr",
|
|
32
|
-
className: g("h-full overflow-auto",
|
|
33
|
-
children: a ? m : /* @__PURE__ */
|
|
32
|
+
className: g("h-full overflow-auto", pe.container, c && pe.containerLight),
|
|
33
|
+
children: a ? m : /* @__PURE__ */ z(s, {
|
|
34
34
|
retryKey: u,
|
|
35
35
|
onRetry: p,
|
|
36
36
|
pendingContent: m,
|
|
37
37
|
errorContent: m,
|
|
38
38
|
labels: n,
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ z(f, {
|
|
40
40
|
language: i,
|
|
41
41
|
style: o,
|
|
42
42
|
customStyle: {
|
|
@@ -53,9 +53,9 @@ var G = {
|
|
|
53
53
|
})
|
|
54
54
|
})
|
|
55
55
|
});
|
|
56
|
-
}),
|
|
57
|
-
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] =
|
|
58
|
-
|
|
56
|
+
}), ge = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, _e = M(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
|
|
57
|
+
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = L(!0), [d, f] = L(!1), p = I(null);
|
|
58
|
+
P(() => {
|
|
59
59
|
u(!0), f(!1);
|
|
60
60
|
}, [e]);
|
|
61
61
|
let m = N((t) => {
|
|
@@ -67,7 +67,7 @@ var G = {
|
|
|
67
67
|
}, [e.srcdoc]), h = N(() => {
|
|
68
68
|
u(!1), f(!0);
|
|
69
69
|
}, []);
|
|
70
|
-
if (n && e.srcdoc != null) return /* @__PURE__ */
|
|
70
|
+
if (n && e.srcdoc != null) return /* @__PURE__ */ z(he, {
|
|
71
71
|
content: {
|
|
72
72
|
type: i.Code,
|
|
73
73
|
text: e.srcdoc,
|
|
@@ -75,26 +75,26 @@ var G = {
|
|
|
75
75
|
},
|
|
76
76
|
codeBlockTheme: a
|
|
77
77
|
});
|
|
78
|
-
if (d) return /* @__PURE__ */
|
|
78
|
+
if (d) return /* @__PURE__ */ B("div", {
|
|
79
79
|
className: "flex h-full flex-col items-center justify-center gap-3 p-4",
|
|
80
|
-
children: [/* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ z("p", {
|
|
81
81
|
className: "text-center",
|
|
82
82
|
children: s
|
|
83
|
-
}), e.url != null && /* @__PURE__ */
|
|
83
|
+
}), e.url != null && /* @__PURE__ */ z(T, {
|
|
84
84
|
href: e.url,
|
|
85
85
|
target: "_blank",
|
|
86
86
|
label: c,
|
|
87
|
-
className:
|
|
87
|
+
className: ge.openInNewTabButton,
|
|
88
88
|
textClassName: o
|
|
89
89
|
})]
|
|
90
90
|
});
|
|
91
91
|
let _ = e.srcdoc != null, v = _ ? void 0 : e.url, y = _ ? e.srcdoc : void 0;
|
|
92
|
-
return /* @__PURE__ */
|
|
92
|
+
return /* @__PURE__ */ B("div", {
|
|
93
93
|
className: "relative h-full",
|
|
94
|
-
children: [l && /* @__PURE__ */
|
|
94
|
+
children: [l && /* @__PURE__ */ z("div", {
|
|
95
95
|
className: "absolute inset-0 flex items-center justify-center",
|
|
96
|
-
children: /* @__PURE__ */
|
|
97
|
-
}), /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ z(E, {})
|
|
97
|
+
}), /* @__PURE__ */ z("iframe", {
|
|
98
98
|
ref: p,
|
|
99
99
|
title: r,
|
|
100
100
|
src: v,
|
|
@@ -105,10 +105,10 @@ var G = {
|
|
|
105
105
|
onError: h
|
|
106
106
|
})]
|
|
107
107
|
});
|
|
108
|
-
}),
|
|
108
|
+
}), ve = {
|
|
109
109
|
name: "MCP-UI Host",
|
|
110
110
|
version: "1.0.0"
|
|
111
|
-
},
|
|
111
|
+
}, ye = { openLinks: {} }, be = (e) => {
|
|
112
112
|
let t;
|
|
113
113
|
try {
|
|
114
114
|
t = new URL(e);
|
|
@@ -122,31 +122,31 @@ var G = {
|
|
|
122
122
|
return !1;
|
|
123
123
|
}
|
|
124
124
|
return !0;
|
|
125
|
-
},
|
|
125
|
+
}, xe = (e, t, n) => {
|
|
126
126
|
if (n) {
|
|
127
127
|
e.style.maxWidth = "", e.style.maxHeight = "";
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
let r = t;
|
|
131
131
|
r != null && (r.width != null && (e.style.width = `${r.width}px`), r.maxWidth != null && (e.style.maxWidth = `${r.maxWidth}px`), r.height != null && (e.style.height = `${r.height}px`), r.maxHeight != null && (e.style.maxHeight = `${r.maxHeight}px`));
|
|
132
|
-
},
|
|
133
|
-
let r =
|
|
134
|
-
|
|
132
|
+
}, Se = (e, t, n) => {
|
|
133
|
+
let r = I(e);
|
|
134
|
+
P(() => {
|
|
135
135
|
r.current = e;
|
|
136
136
|
});
|
|
137
|
-
let [i, a] =
|
|
138
|
-
return
|
|
137
|
+
let [i, a] = L(null), [o, s] = L(!1);
|
|
138
|
+
return P(() => {
|
|
139
139
|
let e = null;
|
|
140
140
|
try {
|
|
141
|
-
e = new
|
|
141
|
+
e = new V(null, ve, ye, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
|
|
142
142
|
let t = r.current.onOpenLink;
|
|
143
|
-
return (t == null ?
|
|
143
|
+
return (t == null ? be(e) : t(e)) === !1 ? { isError: !0 } : {};
|
|
144
144
|
}, e.onrequestdisplaymode = async ({ mode: e }) => {
|
|
145
145
|
let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
|
|
146
146
|
return { mode: t?.(e) ?? n };
|
|
147
|
-
}, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(
|
|
147
|
+
}, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(de, ({ params: e }) => {
|
|
148
148
|
let n = t.current?.querySelector("iframe");
|
|
149
|
-
n != null &&
|
|
149
|
+
n != null && xe(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
|
|
150
150
|
}), a(e);
|
|
151
151
|
} catch (e) {
|
|
152
152
|
console.error("[useMcpAppBridge] Error creating AppBridge:", e), s(!0);
|
|
@@ -154,20 +154,20 @@ var G = {
|
|
|
154
154
|
return () => {
|
|
155
155
|
e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
|
|
156
156
|
};
|
|
157
|
-
}, [t]),
|
|
157
|
+
}, [t]), P(() => {
|
|
158
158
|
i != null && n != null && i.setHostContext(n);
|
|
159
159
|
}, [i, n]), {
|
|
160
160
|
appBridge: i,
|
|
161
161
|
hasFailed: o
|
|
162
162
|
};
|
|
163
|
-
},
|
|
163
|
+
}, Ce = {
|
|
164
164
|
loadingOverlay: "_loadingOverlay_1aric_1",
|
|
165
165
|
fullscreenFrame: "_fullscreenFrame_1aric_20",
|
|
166
166
|
statusLabel: "_statusLabel_1aric_27",
|
|
167
167
|
errorIcon: "_errorIcon_1aric_31"
|
|
168
|
-
},
|
|
169
|
-
let [n, r] =
|
|
170
|
-
|
|
168
|
+
}, we = ({ content: e, errorLabel: t = "Failed to load app" }) => {
|
|
169
|
+
let [n, r] = L("loading"), { html: i, sandboxUrl: a, toolInput: o, toolResult: s, hostContext: c } = e, l = F(() => ({ url: new URL(a) }), [a]), u = c?.displayMode === "fullscreen", d = I(null), [f, p] = L();
|
|
170
|
+
P(() => {
|
|
171
171
|
let e = d.current;
|
|
172
172
|
if (!e) return;
|
|
173
173
|
let t = new ResizeObserver(([e]) => {
|
|
@@ -180,15 +180,15 @@ var G = {
|
|
|
180
180
|
});
|
|
181
181
|
return t.observe(e), () => t.disconnect();
|
|
182
182
|
}, []);
|
|
183
|
-
let { appBridge: m, hasFailed: h } =
|
|
183
|
+
let { appBridge: m, hasFailed: h } = Se(e, d, F(() => c == null || f == null ? c : {
|
|
184
184
|
...c,
|
|
185
185
|
containerDimensions: f
|
|
186
186
|
}, [c, f])), _ = h || n === "error";
|
|
187
|
-
return /* @__PURE__ */
|
|
187
|
+
return /* @__PURE__ */ B("div", {
|
|
188
188
|
ref: d,
|
|
189
|
-
className: g("relative h-full w-full", u &&
|
|
189
|
+
className: g("relative h-full w-full", u && Ce.fullscreenFrame),
|
|
190
190
|
children: [
|
|
191
|
-
m != null && /* @__PURE__ */
|
|
191
|
+
m != null && /* @__PURE__ */ z(ue, {
|
|
192
192
|
html: i,
|
|
193
193
|
sandbox: l,
|
|
194
194
|
appBridge: m,
|
|
@@ -198,26 +198,26 @@ var G = {
|
|
|
198
198
|
onInitialized: () => r("ready"),
|
|
199
199
|
onError: () => r("error")
|
|
200
200
|
}),
|
|
201
|
-
!_ && n === "loading" && /* @__PURE__ */
|
|
202
|
-
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
203
|
-
children: /* @__PURE__ */
|
|
201
|
+
!_ && n === "loading" && /* @__PURE__ */ z("div", {
|
|
202
|
+
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", Ce.loadingOverlay),
|
|
203
|
+
children: /* @__PURE__ */ z(E, {})
|
|
204
204
|
}),
|
|
205
|
-
_ && /* @__PURE__ */
|
|
205
|
+
_ && /* @__PURE__ */ B("div", {
|
|
206
206
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
207
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ z(D, {
|
|
208
208
|
size: 60,
|
|
209
209
|
stroke: S,
|
|
210
210
|
"aria-hidden": !0,
|
|
211
|
-
className:
|
|
212
|
-
}), /* @__PURE__ */
|
|
211
|
+
className: Ce.errorIcon
|
|
212
|
+
}), /* @__PURE__ */ z("p", {
|
|
213
213
|
role: "alert",
|
|
214
|
-
className: g("text-center",
|
|
214
|
+
className: g("text-center", Ce.statusLabel),
|
|
215
215
|
children: t
|
|
216
216
|
})]
|
|
217
217
|
})
|
|
218
218
|
]
|
|
219
219
|
});
|
|
220
|
-
},
|
|
220
|
+
}, W = {
|
|
221
221
|
viewer: "_viewer_1w97n_2",
|
|
222
222
|
spreadsheetCanvas: "_spreadsheetCanvas_1w97n_6",
|
|
223
223
|
formulaPanel: "_formulaPanel_1w97n_12",
|
|
@@ -225,13 +225,13 @@ var G = {
|
|
|
225
225
|
statusOverlay: "_statusOverlay_1w97n_24",
|
|
226
226
|
errorIcon: "_errorIcon_1w97n_29",
|
|
227
227
|
highlight: "_highlight_1w97n_37"
|
|
228
|
-
},
|
|
228
|
+
}, Te = (e) => {
|
|
229
229
|
if (e?.kind !== "range") return "";
|
|
230
230
|
let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
|
|
231
231
|
if (n == null) return "";
|
|
232
232
|
let r = n.formula;
|
|
233
233
|
return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
|
|
234
|
-
},
|
|
234
|
+
}, Ee = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
|
|
235
235
|
switch (t) {
|
|
236
236
|
case r.Docx: {
|
|
237
237
|
let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/docx"), import("@silurus/ooxml/chart-ex")]);
|
|
@@ -253,7 +253,7 @@ var G = {
|
|
|
253
253
|
}
|
|
254
254
|
case r.Csv: {
|
|
255
255
|
let { XlsxSheetViewer: t } = await import("@silurus/ooxml/xlsx"), r = document.createElement("canvas");
|
|
256
|
-
r.className =
|
|
256
|
+
r.className = W.spreadsheetCanvas, e.replaceChildren(r);
|
|
257
257
|
let i = new t(r, {
|
|
258
258
|
showScrollbars: !0,
|
|
259
259
|
onError: n
|
|
@@ -273,7 +273,7 @@ var G = {
|
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
},
|
|
276
|
+
}, De = async (e, t, n, i) => {
|
|
277
277
|
let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = n;
|
|
278
278
|
switch (t.format) {
|
|
279
279
|
case r.Docx: {
|
|
@@ -282,7 +282,7 @@ var G = {
|
|
|
282
282
|
import("@silurus/ooxml/chart-ex"),
|
|
283
283
|
import("./ooxml-highlight-surfaces-vLEREQkr.js")
|
|
284
284
|
]), l = await n.load(t.url, { chartEx: o });
|
|
285
|
-
if (i()) throw l.destroy(), new
|
|
285
|
+
if (i()) throw l.destroy(), new Oe();
|
|
286
286
|
let u = r.fromDocument(e, l, {
|
|
287
287
|
enableTextSelection: !0,
|
|
288
288
|
refitOnResize: !0,
|
|
@@ -302,7 +302,7 @@ var G = {
|
|
|
302
302
|
import("@silurus/ooxml/chart-ex"),
|
|
303
303
|
import("./ooxml-highlight-surfaces-vLEREQkr.js")
|
|
304
304
|
]), l = await n.load(t.url, { chartEx: o });
|
|
305
|
-
if (i()) throw l.destroy(), new
|
|
305
|
+
if (i()) throw l.destroy(), new Oe();
|
|
306
306
|
let u = r.fromPresentation(e, l, {
|
|
307
307
|
enableTextSelection: !0,
|
|
308
308
|
refitOnResize: !0,
|
|
@@ -336,15 +336,15 @@ var G = {
|
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
case r.Csv: {
|
|
339
|
-
let r = await
|
|
339
|
+
let r = await Ee(e, t.format, n);
|
|
340
340
|
return await r.load(t.url), { viewer: r };
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
},
|
|
344
|
-
let l =
|
|
343
|
+
}, 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" }) => {
|
|
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, T = I(void 0), O = I(x);
|
|
345
345
|
O.current = x;
|
|
346
|
-
let k =
|
|
347
|
-
return
|
|
346
|
+
let k = I(void 0);
|
|
347
|
+
return P(() => {
|
|
348
348
|
let e = l.current;
|
|
349
349
|
if (e == null) return;
|
|
350
350
|
let n, r, i = !1, a, o = () => i;
|
|
@@ -366,7 +366,7 @@ var G = {
|
|
|
366
366
|
i || (d(!1), p(!0));
|
|
367
367
|
},
|
|
368
368
|
onXlsxSelectionContextChange: (e) => {
|
|
369
|
-
i || h(
|
|
369
|
+
i || h(Te(e));
|
|
370
370
|
},
|
|
371
371
|
onGeometryInvalidated: s
|
|
372
372
|
}, f = () => {
|
|
@@ -375,14 +375,14 @@ var G = {
|
|
|
375
375
|
return e.addEventListener("scroll", s, !0), k.current = s, (async () => {
|
|
376
376
|
try {
|
|
377
377
|
if (w) {
|
|
378
|
-
let r = await
|
|
378
|
+
let r = await De(e, t, u, o);
|
|
379
379
|
if (i) {
|
|
380
380
|
r.viewer.destroy(), r.engine?.destroy();
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
383
383
|
n = r, T.current = r.highlights, f();
|
|
384
384
|
} else {
|
|
385
|
-
let r = await
|
|
385
|
+
let r = await Ee(e, t.format, u);
|
|
386
386
|
if (i) {
|
|
387
387
|
r.destroy();
|
|
388
388
|
return;
|
|
@@ -392,7 +392,7 @@ var G = {
|
|
|
392
392
|
if (i) return;
|
|
393
393
|
d(!1), await c();
|
|
394
394
|
} catch (t) {
|
|
395
|
-
if (t instanceof
|
|
395
|
+
if (t instanceof Oe || i) return;
|
|
396
396
|
n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, T.current = void 0, e.replaceChildren(), d(!1), p(!0);
|
|
397
397
|
}
|
|
398
398
|
})(), () => {
|
|
@@ -402,9 +402,9 @@ var G = {
|
|
|
402
402
|
t.format,
|
|
403
403
|
t.url,
|
|
404
404
|
w
|
|
405
|
-
]),
|
|
405
|
+
]), P(() => {
|
|
406
406
|
k.current?.();
|
|
407
|
-
}, [x]),
|
|
407
|
+
}, [x]), P(() => {
|
|
408
408
|
b(!1);
|
|
409
409
|
let t = T.current;
|
|
410
410
|
if (t == null || u) return;
|
|
@@ -422,38 +422,38 @@ var G = {
|
|
|
422
422
|
})(), () => {
|
|
423
423
|
r = !0;
|
|
424
424
|
};
|
|
425
|
-
}, [C, u]), /* @__PURE__ */
|
|
425
|
+
}, [C, u]), /* @__PURE__ */ B("div", {
|
|
426
426
|
className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
|
|
427
427
|
children: [
|
|
428
|
-
t.format === r.Xlsx && /* @__PURE__ */
|
|
428
|
+
t.format === r.Xlsx && /* @__PURE__ */ B("div", {
|
|
429
429
|
role: "region",
|
|
430
430
|
"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__ */
|
|
431
|
+
className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", W.formulaPanel),
|
|
432
|
+
children: [/* @__PURE__ */ z("span", {
|
|
433
433
|
"aria-hidden": "true",
|
|
434
434
|
className: g("shrink-0", o),
|
|
435
435
|
children: "fx"
|
|
436
|
-
}), /* @__PURE__ */
|
|
436
|
+
}), /* @__PURE__ */ z("code", {
|
|
437
437
|
dir: "ltr",
|
|
438
438
|
tabIndex: 0,
|
|
439
439
|
"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",
|
|
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", W.formulaValue),
|
|
441
441
|
children: m
|
|
442
442
|
})]
|
|
443
443
|
}),
|
|
444
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ B("div", {
|
|
445
445
|
className: "relative min-h-0 w-full flex-1",
|
|
446
|
-
children: [/* @__PURE__ */
|
|
446
|
+
children: [/* @__PURE__ */ z("div", {
|
|
447
447
|
ref: l,
|
|
448
448
|
role: "document",
|
|
449
449
|
"aria-label": n,
|
|
450
450
|
"aria-busy": u,
|
|
451
|
-
className: g("h-full w-full overflow-hidden",
|
|
452
|
-
}), _.length > 0 && /* @__PURE__ */
|
|
451
|
+
className: g("h-full w-full overflow-hidden", W.viewer)
|
|
452
|
+
}), _.length > 0 && /* @__PURE__ */ z("div", {
|
|
453
453
|
role: "region",
|
|
454
454
|
"aria-label": s,
|
|
455
455
|
className: "pointer-events-none absolute inset-0 overflow-hidden",
|
|
456
|
-
children: _.map((e, t) => /* @__PURE__ */
|
|
456
|
+
children: _.map((e, t) => /* @__PURE__ */ z("div", {
|
|
457
457
|
"aria-hidden": "true",
|
|
458
458
|
style: {
|
|
459
459
|
left: `${e.left}px`,
|
|
@@ -463,28 +463,28 @@ var G = {
|
|
|
463
463
|
},
|
|
464
464
|
"data-selected": e.highlightId === C,
|
|
465
465
|
"data-clipped": e.isClippedAtEnd === !0,
|
|
466
|
-
className: g("absolute",
|
|
466
|
+
className: g("absolute", W.highlight)
|
|
467
467
|
}, `${e.highlightId}-${t}`))
|
|
468
468
|
})]
|
|
469
469
|
}),
|
|
470
|
-
/* @__PURE__ */
|
|
470
|
+
/* @__PURE__ */ z("div", {
|
|
471
471
|
role: "status",
|
|
472
472
|
"aria-live": "polite",
|
|
473
473
|
className: "sr-only",
|
|
474
474
|
children: y ? c : ""
|
|
475
475
|
}),
|
|
476
|
-
(u || f) && /* @__PURE__ */
|
|
476
|
+
(u || f) && /* @__PURE__ */ z("div", {
|
|
477
477
|
role: f ? "alert" : void 0,
|
|
478
478
|
"aria-live": "polite",
|
|
479
|
-
className: g("absolute inset-0 flex items-center justify-center",
|
|
480
|
-
children: u ? /* @__PURE__ */
|
|
479
|
+
className: g("absolute inset-0 flex items-center justify-center", W.statusOverlay),
|
|
480
|
+
children: u ? /* @__PURE__ */ z(E, { size: 48 }) : /* @__PURE__ */ B("div", {
|
|
481
481
|
className: "flex flex-col items-center gap-2",
|
|
482
|
-
children: [/* @__PURE__ */
|
|
482
|
+
children: [/* @__PURE__ */ z(D, {
|
|
483
483
|
"aria-hidden": "true",
|
|
484
484
|
size: 60,
|
|
485
485
|
stroke: S,
|
|
486
|
-
className:
|
|
487
|
-
}), /* @__PURE__ */
|
|
486
|
+
className: W.errorIcon
|
|
487
|
+
}), /* @__PURE__ */ z("p", {
|
|
488
488
|
className: "text-center",
|
|
489
489
|
children: i
|
|
490
490
|
})]
|
|
@@ -492,17 +492,17 @@ var G = {
|
|
|
492
492
|
})
|
|
493
493
|
]
|
|
494
494
|
});
|
|
495
|
-
},
|
|
495
|
+
}, Ae = {
|
|
496
496
|
loadingOverlay: "_loadingOverlay_12637_1",
|
|
497
497
|
statusLabel: "_statusLabel_12637_5",
|
|
498
498
|
errorIcon: "_errorIcon_12637_9"
|
|
499
|
-
},
|
|
500
|
-
let o =
|
|
501
|
-
return f.current = e,
|
|
499
|
+
}, je = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: a }) => {
|
|
500
|
+
let o = I(null), [s, c] = L("loading"), { url: l, visualizerName: u, requestTimeout: d } = e, f = I(e);
|
|
501
|
+
return f.current = e, P(() => {
|
|
502
502
|
let e = o.current;
|
|
503
503
|
if (!e) return;
|
|
504
504
|
c("loading");
|
|
505
|
-
let t = new
|
|
505
|
+
let t = new fe(e, {
|
|
506
506
|
domain: l,
|
|
507
507
|
hostDomain: window.location.origin,
|
|
508
508
|
visualizerName: u,
|
|
@@ -511,7 +511,7 @@ var G = {
|
|
|
511
511
|
return (async () => {
|
|
512
512
|
if (await t.ready(), !n) return;
|
|
513
513
|
let e = f.current;
|
|
514
|
-
if (e.type === i.GroupedVisualizer) await t.send(
|
|
514
|
+
if (e.type === i.GroupedVisualizer) await t.send(H.sendGroupedVisualizeData, {
|
|
515
515
|
attachments: e.attachments,
|
|
516
516
|
layout: e.layout
|
|
517
517
|
});
|
|
@@ -520,7 +520,7 @@ var G = {
|
|
|
520
520
|
layout: r,
|
|
521
521
|
...typeof i == "object" && i ? i : {}
|
|
522
522
|
};
|
|
523
|
-
await t.send(
|
|
523
|
+
await t.send(H.sendVisualizeData, {
|
|
524
524
|
mimeType: n,
|
|
525
525
|
visualizerData: a
|
|
526
526
|
});
|
|
@@ -535,7 +535,7 @@ var G = {
|
|
|
535
535
|
l,
|
|
536
536
|
u,
|
|
537
537
|
d
|
|
538
|
-
]),
|
|
538
|
+
]), P(() => {
|
|
539
539
|
let e = r ?? u.trim();
|
|
540
540
|
e !== "" && o.current?.querySelector("iframe")?.setAttribute("title", e);
|
|
541
541
|
}, [
|
|
@@ -543,7 +543,7 @@ var G = {
|
|
|
543
543
|
u,
|
|
544
544
|
l,
|
|
545
545
|
d
|
|
546
|
-
]), /* @__PURE__ */
|
|
546
|
+
]), /* @__PURE__ */ B("div", {
|
|
547
547
|
className: "relative h-full w-full",
|
|
548
548
|
style: m({
|
|
549
549
|
"--vs-loading-bg": a?.loadingBackground,
|
|
@@ -551,33 +551,33 @@ var G = {
|
|
|
551
551
|
"--vs-error-icon": a?.errorIcon
|
|
552
552
|
}),
|
|
553
553
|
children: [
|
|
554
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ z("div", {
|
|
555
555
|
ref: o,
|
|
556
556
|
className: "h-full w-full"
|
|
557
557
|
}),
|
|
558
|
-
s === "loading" && /* @__PURE__ */
|
|
559
|
-
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
560
|
-
children: [/* @__PURE__ */
|
|
561
|
-
className: g("text-center",
|
|
558
|
+
s === "loading" && /* @__PURE__ */ B("div", {
|
|
559
|
+
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", Ae.loadingOverlay),
|
|
560
|
+
children: [/* @__PURE__ */ z(E, {}), t && /* @__PURE__ */ z("p", {
|
|
561
|
+
className: g("text-center", Ae.statusLabel),
|
|
562
562
|
children: t
|
|
563
563
|
})]
|
|
564
564
|
}),
|
|
565
|
-
s === "error" && /* @__PURE__ */
|
|
565
|
+
s === "error" && /* @__PURE__ */ B("div", {
|
|
566
566
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
567
|
-
children: [/* @__PURE__ */
|
|
567
|
+
children: [/* @__PURE__ */ z(D, {
|
|
568
568
|
size: 60,
|
|
569
569
|
stroke: S,
|
|
570
570
|
"aria-hidden": !0,
|
|
571
|
-
className:
|
|
572
|
-
}), /* @__PURE__ */
|
|
571
|
+
className: Ae.errorIcon
|
|
572
|
+
}), /* @__PURE__ */ z("p", {
|
|
573
573
|
role: "alert",
|
|
574
|
-
className: g("text-center",
|
|
574
|
+
className: g("text-center", Ae.statusLabel),
|
|
575
575
|
children: n
|
|
576
576
|
})]
|
|
577
577
|
})
|
|
578
578
|
]
|
|
579
579
|
});
|
|
580
|
-
},
|
|
580
|
+
}, G = {
|
|
581
581
|
body: "_body_13ogb_4",
|
|
582
582
|
statusLabel: "_statusLabel_13ogb_13",
|
|
583
583
|
errorIcon: "_errorIcon_13ogb_17",
|
|
@@ -592,66 +592,66 @@ var G = {
|
|
|
592
592
|
jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
|
|
593
593
|
jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
|
|
594
594
|
jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
|
|
595
|
-
},
|
|
596
|
-
let [r, i] =
|
|
597
|
-
return
|
|
595
|
+
}, Me = () => j(async () => ({ default: (await import("./PdfContent-DN_j6BCb.js")).PdfContent })), Ne = ({ url: e, fileName: t, loadErrorLabel: n }) => {
|
|
596
|
+
let [r, i] = L(!1);
|
|
597
|
+
return P(() => {
|
|
598
598
|
i(!1);
|
|
599
|
-
}, [e]), r ? /* @__PURE__ */
|
|
599
|
+
}, [e]), r ? /* @__PURE__ */ B("div", {
|
|
600
600
|
className: "flex flex-col items-center gap-2",
|
|
601
|
-
children: [/* @__PURE__ */
|
|
601
|
+
children: [/* @__PURE__ */ z(D, {
|
|
602
602
|
size: 60,
|
|
603
603
|
stroke: S,
|
|
604
|
-
className:
|
|
605
|
-
}), /* @__PURE__ */
|
|
606
|
-
className: g("text-center",
|
|
604
|
+
className: G.errorIcon
|
|
605
|
+
}), /* @__PURE__ */ z("p", {
|
|
606
|
+
className: g("text-center", G.statusLabel),
|
|
607
607
|
children: n
|
|
608
608
|
})]
|
|
609
|
-
}) : /* @__PURE__ */
|
|
609
|
+
}) : /* @__PURE__ */ z("img", {
|
|
610
610
|
src: e,
|
|
611
611
|
alt: t ?? "",
|
|
612
612
|
className: "max-h-full max-w-full object-contain",
|
|
613
613
|
onError: () => i(!0)
|
|
614
614
|
});
|
|
615
|
-
},
|
|
615
|
+
}, Pe = new Set([
|
|
616
616
|
i.PlainText,
|
|
617
617
|
i.Code,
|
|
618
618
|
i.Ooxml
|
|
619
|
-
]),
|
|
620
|
-
let { colors:
|
|
621
|
-
|
|
622
|
-
}, []),
|
|
619
|
+
]), 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: se, hidePdfToolbar: P = !1, configurePdfWorker: I }) => {
|
|
620
|
+
let { colors: R, typography: V, bodyClassName: ue, cssVars: de } = A ?? {}, [H, fe] = L(0), pe = F(Me, [H]), me = N(() => {
|
|
621
|
+
fe((e) => e + 1);
|
|
622
|
+
}, []), U = V?.fontClassName != null, ge = F(() => ({
|
|
623
623
|
...m({
|
|
624
|
-
"--ac-text":
|
|
625
|
-
"--ac-status-text":
|
|
626
|
-
"--ac-error-icon":
|
|
627
|
-
"--ac-open-in-new-tab-text":
|
|
628
|
-
"--ac-json-border":
|
|
629
|
-
"--ac-json-bg":
|
|
630
|
-
"--ac-json-label":
|
|
631
|
-
"--ac-json-clickable-label":
|
|
632
|
-
"--ac-json-punctuation":
|
|
633
|
-
"--ac-json-string":
|
|
634
|
-
"--ac-json-number":
|
|
635
|
-
"--ac-json-boolean":
|
|
636
|
-
"--ac-json-null":
|
|
637
|
-
"--ac-json-toggle-icon":
|
|
638
|
-
"--ac-json-toggle-icon-hover":
|
|
639
|
-
"--ac-ooxml-bg":
|
|
640
|
-
"--ac-ooxml-formula-border":
|
|
641
|
-
"--ac-ooxml-formula-bg":
|
|
642
|
-
"--ac-ooxml-formula-text":
|
|
643
|
-
"--ac-ooxml-highlight-border":
|
|
644
|
-
"--ac-ooxml-highlight-bg":
|
|
645
|
-
"--ac-json-collapsed-text":
|
|
646
|
-
"--ac-json-collapsed-bg":
|
|
647
|
-
"--ac-font-family":
|
|
648
|
-
"--ac-font-size":
|
|
649
|
-
"--ac-font-weight":
|
|
650
|
-
"--ac-line-height":
|
|
651
|
-
"--ac-letter-spacing":
|
|
624
|
+
"--ac-text": R?.text,
|
|
625
|
+
"--ac-status-text": R?.statusText,
|
|
626
|
+
"--ac-error-icon": R?.errorIcon,
|
|
627
|
+
"--ac-open-in-new-tab-text": R?.openInNewTabText,
|
|
628
|
+
"--ac-json-border": R?.jsonBorder,
|
|
629
|
+
"--ac-json-bg": R?.jsonBackground,
|
|
630
|
+
"--ac-json-label": R?.jsonLabel,
|
|
631
|
+
"--ac-json-clickable-label": R?.jsonClickableLabel,
|
|
632
|
+
"--ac-json-punctuation": R?.jsonPunctuation,
|
|
633
|
+
"--ac-json-string": R?.jsonString,
|
|
634
|
+
"--ac-json-number": R?.jsonNumber,
|
|
635
|
+
"--ac-json-boolean": R?.jsonBoolean,
|
|
636
|
+
"--ac-json-null": R?.jsonNull,
|
|
637
|
+
"--ac-json-toggle-icon": R?.jsonToggleIcon,
|
|
638
|
+
"--ac-json-toggle-icon-hover": R?.jsonToggleIconHover,
|
|
639
|
+
"--ac-ooxml-bg": R?.ooxmlBackground,
|
|
640
|
+
"--ac-ooxml-formula-border": R?.ooxmlFormulaBorder,
|
|
641
|
+
"--ac-ooxml-formula-bg": R?.ooxmlFormulaBackground,
|
|
642
|
+
"--ac-ooxml-formula-text": R?.ooxmlFormulaText,
|
|
643
|
+
"--ac-ooxml-highlight-border": R?.ooxmlHighlightBorder,
|
|
644
|
+
"--ac-ooxml-highlight-bg": R?.ooxmlHighlightBackground,
|
|
645
|
+
"--ac-json-collapsed-text": R?.jsonCollapsedText,
|
|
646
|
+
"--ac-json-collapsed-bg": R?.jsonCollapsedBackground,
|
|
647
|
+
"--ac-font-family": U ? void 0 : V?.fontFamily,
|
|
648
|
+
"--ac-font-size": U ? void 0 : V?.fontSize,
|
|
649
|
+
"--ac-font-weight": U ? void 0 : V?.fontWeight,
|
|
650
|
+
"--ac-line-height": U ? void 0 : V?.lineHeight,
|
|
651
|
+
"--ac-letter-spacing": U ? void 0 : V?.letterSpacing
|
|
652
652
|
}),
|
|
653
|
-
...
|
|
654
|
-
}), [
|
|
653
|
+
...de
|
|
654
|
+
}), [A]), ve = F(() => {
|
|
655
655
|
switch (e.type) {
|
|
656
656
|
case i.Image:
|
|
657
657
|
case i.Audio:
|
|
@@ -669,38 +669,38 @@ var G = {
|
|
|
669
669
|
case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
|
|
670
670
|
default: return "h-full overflow-auto p-4";
|
|
671
671
|
}
|
|
672
|
-
}, [e.type]),
|
|
672
|
+
}, [e.type]), ye = F(() => {
|
|
673
673
|
switch (e.type) {
|
|
674
|
-
case i.PlainText: return /* @__PURE__ */
|
|
675
|
-
className: g("whitespace-pre-wrap break-words",
|
|
674
|
+
case i.PlainText: return /* @__PURE__ */ z("pre", {
|
|
675
|
+
className: g("whitespace-pre-wrap break-words", G.body, V?.fontClassName),
|
|
676
676
|
children: e.text
|
|
677
677
|
});
|
|
678
|
-
case i.Image: return /* @__PURE__ */
|
|
678
|
+
case i.Image: return /* @__PURE__ */ z(Ne, {
|
|
679
679
|
url: e.url,
|
|
680
680
|
fileName: r,
|
|
681
681
|
loadErrorLabel: c
|
|
682
682
|
});
|
|
683
|
-
case i.Audio: return /* @__PURE__ */
|
|
683
|
+
case i.Audio: return /* @__PURE__ */ z("audio", {
|
|
684
684
|
controls: !0,
|
|
685
685
|
src: e.url,
|
|
686
686
|
"aria-label": r ?? "Audio attachment",
|
|
687
687
|
className: "w-full max-w-sm",
|
|
688
688
|
preload: "metadata",
|
|
689
|
-
children: e.mimeType && /* @__PURE__ */
|
|
689
|
+
children: e.mimeType && /* @__PURE__ */ z("source", {
|
|
690
690
|
src: e.url,
|
|
691
691
|
type: e.mimeType
|
|
692
692
|
})
|
|
693
693
|
});
|
|
694
|
-
case i.Markdown: return /* @__PURE__ */
|
|
694
|
+
case i.Markdown: return /* @__PURE__ */ z(p, {
|
|
695
695
|
content: e.text,
|
|
696
696
|
isStreaming: !1,
|
|
697
|
-
codeBlockTheme:
|
|
697
|
+
codeBlockTheme: j,
|
|
698
698
|
classNames: u
|
|
699
699
|
});
|
|
700
|
-
case i.MarkdownTable: return /* @__PURE__ */
|
|
700
|
+
case i.MarkdownTable: return /* @__PURE__ */ z(p, {
|
|
701
701
|
content: e.text,
|
|
702
702
|
isStreaming: !1,
|
|
703
|
-
codeBlockTheme:
|
|
703
|
+
codeBlockTheme: j,
|
|
704
704
|
containerClassName: "flex h-full min-h-0 flex-col",
|
|
705
705
|
classNames: {
|
|
706
706
|
...u,
|
|
@@ -708,51 +708,49 @@ var G = {
|
|
|
708
708
|
tableScrollContainer: "max-h-full"
|
|
709
709
|
},
|
|
710
710
|
tableActionLabels: {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
copiedLabel: ae,
|
|
715
|
-
downloadCsvLabel: oe
|
|
711
|
+
copyLabel: te,
|
|
712
|
+
copiedLabel: ne,
|
|
713
|
+
downloadCsvLabel: re
|
|
716
714
|
},
|
|
717
|
-
tableDownloadFilename:
|
|
715
|
+
tableDownloadFilename: M
|
|
718
716
|
});
|
|
719
|
-
case i.Json: return /* @__PURE__ */
|
|
717
|
+
case i.Json: return /* @__PURE__ */ z("div", {
|
|
720
718
|
dir: "ltr",
|
|
721
719
|
className: "h-full overflow-auto",
|
|
722
|
-
children: /* @__PURE__ */
|
|
723
|
-
className: g("m-3 overflow-auto rounded-md border",
|
|
724
|
-
children: /* @__PURE__ */
|
|
720
|
+
children: /* @__PURE__ */ z("div", {
|
|
721
|
+
className: g("m-3 overflow-auto rounded-md border", G.jsonWrapper),
|
|
722
|
+
children: /* @__PURE__ */ z(ce, {
|
|
725
723
|
data: e.value,
|
|
726
724
|
style: {
|
|
727
|
-
container: g("whitespace-pre-wrap break-words p-2",
|
|
728
|
-
basicChildStyle:
|
|
725
|
+
container: g("whitespace-pre-wrap break-words p-2", V?.jsonClassName ?? "dial-code-text"),
|
|
726
|
+
basicChildStyle: le.basicChildStyle,
|
|
729
727
|
childFieldsContainer: "m-0 ps-3",
|
|
730
|
-
label: g("me-1 font-semibold",
|
|
731
|
-
clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline",
|
|
732
|
-
nullValue: g("italic",
|
|
733
|
-
undefinedValue: g("italic",
|
|
734
|
-
stringValue:
|
|
735
|
-
booleanValue:
|
|
736
|
-
numberValue:
|
|
737
|
-
otherValue: g("italic",
|
|
738
|
-
punctuation: g("me-1",
|
|
739
|
-
collapseIcon: g("me-1 cursor-pointer select-none transition-colors",
|
|
740
|
-
expandIcon: g("me-1 cursor-pointer select-none transition-colors",
|
|
741
|
-
collapsedContent: g("me-1 cursor-pointer rounded px-1",
|
|
728
|
+
label: g("me-1 font-semibold", G.jsonLabel),
|
|
729
|
+
clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", G.jsonClickableLabel),
|
|
730
|
+
nullValue: g("italic", G.jsonNullValue),
|
|
731
|
+
undefinedValue: g("italic", G.jsonNullValue),
|
|
732
|
+
stringValue: G.jsonStringValue,
|
|
733
|
+
booleanValue: G.jsonBooleanValue,
|
|
734
|
+
numberValue: G.jsonNumberValue,
|
|
735
|
+
otherValue: g("italic", G.jsonNullValue),
|
|
736
|
+
punctuation: g("me-1", G.jsonPunctuation),
|
|
737
|
+
collapseIcon: g("me-1 cursor-pointer select-none transition-colors", G.jsonCollapseIcon),
|
|
738
|
+
expandIcon: g("me-1 cursor-pointer select-none transition-colors", G.jsonExpandIcon),
|
|
739
|
+
collapsedContent: g("me-1 cursor-pointer rounded px-1", G.jsonCollapsedContent)
|
|
742
740
|
}
|
|
743
741
|
})
|
|
744
742
|
})
|
|
745
743
|
});
|
|
746
|
-
case i.Code: return /* @__PURE__ */
|
|
744
|
+
case i.Code: return /* @__PURE__ */ z(he, {
|
|
747
745
|
content: e,
|
|
748
|
-
codeBlockTheme:
|
|
746
|
+
codeBlockTheme: j,
|
|
749
747
|
labels: {
|
|
750
748
|
loadingLabel: O,
|
|
751
749
|
errorLabel: k,
|
|
752
750
|
retryLabel: ee
|
|
753
751
|
}
|
|
754
752
|
});
|
|
755
|
-
case i.Html: return /* @__PURE__ */
|
|
753
|
+
case i.Html: return /* @__PURE__ */ z(_e, {
|
|
756
754
|
content: e,
|
|
757
755
|
labels: {
|
|
758
756
|
htmlFrameBlockedLabel: f,
|
|
@@ -760,25 +758,25 @@ var G = {
|
|
|
760
758
|
},
|
|
761
759
|
isSourceView: a,
|
|
762
760
|
title: r,
|
|
763
|
-
codeBlockTheme:
|
|
761
|
+
codeBlockTheme: j
|
|
764
762
|
});
|
|
765
|
-
case i.Pdf: return /* @__PURE__ */
|
|
766
|
-
retryKey:
|
|
763
|
+
case i.Pdf: return /* @__PURE__ */ z(s, {
|
|
764
|
+
retryKey: H,
|
|
767
765
|
onRetry: me,
|
|
768
766
|
labels: {
|
|
769
767
|
loadingLabel: x,
|
|
770
768
|
errorLabel: C,
|
|
771
769
|
retryLabel: w
|
|
772
770
|
},
|
|
773
|
-
children: /* @__PURE__ */
|
|
771
|
+
children: /* @__PURE__ */ z(pe, {
|
|
774
772
|
fileName: r,
|
|
775
773
|
url: e.url,
|
|
776
774
|
highlights: e.highlights ?? [],
|
|
777
775
|
selectedHighlightId: e.selectedHighlightId,
|
|
778
776
|
selectedPageNumber: e.page,
|
|
779
|
-
loadPdf:
|
|
780
|
-
hideHeader:
|
|
781
|
-
configurePdfWorker:
|
|
777
|
+
loadPdf: se,
|
|
778
|
+
hideHeader: P,
|
|
779
|
+
configurePdfWorker: I,
|
|
782
780
|
labels: {
|
|
783
781
|
thumbnailsLabel: _,
|
|
784
782
|
showThumbnailsLabel: v,
|
|
@@ -790,35 +788,35 @@ var G = {
|
|
|
790
788
|
}
|
|
791
789
|
})
|
|
792
790
|
}, e.url);
|
|
793
|
-
case i.Ooxml: return /* @__PURE__ */
|
|
791
|
+
case i.Ooxml: return /* @__PURE__ */ z(ke, {
|
|
794
792
|
content: e,
|
|
795
793
|
fileName: r,
|
|
796
794
|
loadErrorLabel: c,
|
|
797
795
|
formulaLabel: T,
|
|
798
|
-
formulaLabelClassName:
|
|
799
|
-
highlightsLabel:
|
|
800
|
-
highlightNavigatedLabel:
|
|
796
|
+
formulaLabelClassName: V?.xlsxFormulaLabelClassName ?? "dial-italic-text",
|
|
797
|
+
highlightsLabel: ae,
|
|
798
|
+
highlightNavigatedLabel: oe
|
|
801
799
|
});
|
|
802
800
|
case i.Visualizer:
|
|
803
|
-
case i.GroupedVisualizer: return /* @__PURE__ */
|
|
801
|
+
case i.GroupedVisualizer: return /* @__PURE__ */ z(je, {
|
|
804
802
|
content: e,
|
|
805
803
|
errorLabel: d
|
|
806
804
|
});
|
|
807
|
-
case i.McpApp: return /* @__PURE__ */
|
|
808
|
-
case i.Unsupported: return /* @__PURE__ */
|
|
809
|
-
className: g("text-center",
|
|
805
|
+
case i.McpApp: return /* @__PURE__ */ z(we, { content: e });
|
|
806
|
+
case i.Unsupported: return /* @__PURE__ */ z("p", {
|
|
807
|
+
className: g("text-center", G.statusLabel),
|
|
810
808
|
children: o
|
|
811
809
|
});
|
|
812
810
|
case i.Error: {
|
|
813
811
|
let t = e.errorType === n.Forbidden;
|
|
814
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ B("div", {
|
|
815
813
|
className: "flex flex-col items-center gap-2",
|
|
816
|
-
children: [
|
|
814
|
+
children: [z(t ? ie : D, {
|
|
817
815
|
size: 60,
|
|
818
816
|
stroke: S,
|
|
819
|
-
className:
|
|
820
|
-
}), /* @__PURE__ */
|
|
821
|
-
className: g("text-center",
|
|
817
|
+
className: G.errorIcon
|
|
818
|
+
}), /* @__PURE__ */ z("p", {
|
|
819
|
+
className: g("text-center", G.statusLabel),
|
|
822
820
|
children: t ? l : c
|
|
823
821
|
})]
|
|
824
822
|
});
|
|
@@ -826,11 +824,11 @@ var G = {
|
|
|
826
824
|
}
|
|
827
825
|
}, [
|
|
828
826
|
e,
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
827
|
+
V?.fontClassName,
|
|
828
|
+
V?.jsonClassName,
|
|
829
|
+
V?.xlsxFormulaLabelClassName,
|
|
832
830
|
r,
|
|
833
|
-
|
|
831
|
+
j,
|
|
834
832
|
o,
|
|
835
833
|
c,
|
|
836
834
|
l,
|
|
@@ -838,10 +836,10 @@ var G = {
|
|
|
838
836
|
f,
|
|
839
837
|
h,
|
|
840
838
|
a,
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
839
|
+
M,
|
|
840
|
+
se,
|
|
841
|
+
P,
|
|
842
|
+
I,
|
|
845
843
|
_,
|
|
846
844
|
v,
|
|
847
845
|
y,
|
|
@@ -853,41 +851,39 @@ var G = {
|
|
|
853
851
|
O,
|
|
854
852
|
k,
|
|
855
853
|
ee,
|
|
856
|
-
|
|
857
|
-
|
|
854
|
+
pe,
|
|
855
|
+
H,
|
|
858
856
|
me,
|
|
859
857
|
te,
|
|
860
858
|
ne,
|
|
861
859
|
re,
|
|
862
860
|
ae,
|
|
863
|
-
oe
|
|
864
|
-
A,
|
|
865
|
-
j
|
|
861
|
+
oe
|
|
866
862
|
]);
|
|
867
|
-
return /* @__PURE__ */
|
|
868
|
-
style: !t &&
|
|
869
|
-
className: g(t ? "flex h-full items-center justify-center" :
|
|
870
|
-
children: t ? /* @__PURE__ */
|
|
863
|
+
return /* @__PURE__ */ z("div", {
|
|
864
|
+
style: !t && Pe.has(e.type) ? ge : void 0,
|
|
865
|
+
className: g(t ? "flex h-full items-center justify-center" : ve, ue),
|
|
866
|
+
children: t ? /* @__PURE__ */ z(E, {}) : ye
|
|
871
867
|
});
|
|
872
|
-
}),
|
|
873
|
-
let [
|
|
874
|
-
|
|
875
|
-
}, [
|
|
876
|
-
|
|
877
|
-
}, [
|
|
878
|
-
|
|
879
|
-
}, [
|
|
880
|
-
|
|
881
|
-
|
|
868
|
+
}), Ie = 2e3, Le = 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: pe, tableCopyLabel: me, tableCopiedLabel: U, tableDownloadCsvLabel: he, ooxmlHighlightsLabel: ge, ooxmlHighlightNavigatedLabel: _e }, onDownload: ve, onCopyText: ye, onCopyMarkdown: be, onCopyJson: xe, tableDownloadFilename: Se, isMobile: Ce = !1, defaultWidth: we, minWidth: W = 600, maxWidth: Te = 1500, onResizeStop: Ee, styles: De, codeBlockTheme: Oe, loadPdf: ke, configurePdfWorker: Ae }) => {
|
|
869
|
+
let [je, G] = L(!1), [Me, Ne] = L(!1), [Pe, Le] = L(!1), [K, q] = L(!1), J = I(null), Y = I(null), X = I(null), Re = N(() => {
|
|
870
|
+
ye?.(), J.current != null && clearTimeout(J.current), G(!0), J.current = setTimeout(() => G(!1), Ie);
|
|
871
|
+
}, [ye]), Z = N(() => {
|
|
872
|
+
be?.(), Y.current != null && clearTimeout(Y.current), Ne(!0), Y.current = setTimeout(() => Ne(!1), Ie);
|
|
873
|
+
}, [be]), ze = N(() => {
|
|
874
|
+
xe?.(), X.current != null && clearTimeout(X.current), Le(!0), X.current = setTimeout(() => Le(!1), Ie);
|
|
875
|
+
}, [xe]);
|
|
876
|
+
P(() => () => {
|
|
877
|
+
J.current != null && clearTimeout(J.current), Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current);
|
|
882
878
|
}, []);
|
|
883
|
-
let
|
|
884
|
-
|
|
879
|
+
let Be = N(() => {
|
|
880
|
+
q((e) => !e);
|
|
885
881
|
}, []);
|
|
886
|
-
|
|
887
|
-
|
|
882
|
+
P(() => {
|
|
883
|
+
q(!1);
|
|
888
884
|
}, [r]);
|
|
889
|
-
let { className:
|
|
890
|
-
return /* @__PURE__ */
|
|
885
|
+
let { className: Ve, panelStyles: Q, ...He } = De ?? {}, Ue = !t && r.type === i.Html && r.srcdoc != null, $ = !t && ye != null && (r.type === i.PlainText || r.type === i.Code), We = !t && be != null && r.type === i.Markdown, Ge = !t && xe != null && r.type === i.Json, Ke = !t && ve != null && o(r), qe = !t && r.type === i.McpApp && r.onReload != null;
|
|
886
|
+
return /* @__PURE__ */ z(b, {
|
|
891
887
|
isOpen: e,
|
|
892
888
|
orientation: y.Right,
|
|
893
889
|
title: a,
|
|
@@ -897,20 +893,20 @@ var G = {
|
|
|
897
893
|
resizeLabel: l
|
|
898
894
|
},
|
|
899
895
|
onClose: n,
|
|
900
|
-
resizable: !
|
|
901
|
-
defaultWidth:
|
|
902
|
-
minWidth:
|
|
903
|
-
maxWidth:
|
|
904
|
-
onResizeStop:
|
|
896
|
+
resizable: !Ce,
|
|
897
|
+
defaultWidth: we,
|
|
898
|
+
minWidth: W,
|
|
899
|
+
maxWidth: Te,
|
|
900
|
+
onResizeStop: Ee,
|
|
905
901
|
styles: {
|
|
906
|
-
...
|
|
907
|
-
titleClassName:
|
|
908
|
-
headerClassName: g("border-b border-tertiary",
|
|
909
|
-
className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0",
|
|
902
|
+
...Q,
|
|
903
|
+
titleClassName: Q?.titleClassName ?? "dial-h3-text",
|
|
904
|
+
headerClassName: g("border-b border-tertiary", Q?.headerClassName),
|
|
905
|
+
className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", Ve, Q?.className)
|
|
910
906
|
},
|
|
911
|
-
rightActions:
|
|
912
|
-
|
|
913
|
-
icon: /* @__PURE__ */
|
|
907
|
+
rightActions: Ue || $ || We || Ge || Ke || qe ? /* @__PURE__ */ B(R, { children: [
|
|
908
|
+
qe && /* @__PURE__ */ z(w, {
|
|
909
|
+
icon: /* @__PURE__ */ z(oe, {
|
|
914
910
|
size: x.LG,
|
|
915
911
|
stroke: S,
|
|
916
912
|
"aria-hidden": !0
|
|
@@ -919,62 +915,62 @@ var G = {
|
|
|
919
915
|
tooltipProps: { tooltip: j },
|
|
920
916
|
onClick: r.type === i.McpApp ? r.onReload : void 0
|
|
921
917
|
}),
|
|
922
|
-
|
|
923
|
-
icon:
|
|
918
|
+
Ue && /* @__PURE__ */ z(w, {
|
|
919
|
+
icon: z(K ? re : ee, {
|
|
924
920
|
size: x.LG,
|
|
925
921
|
stroke: S,
|
|
926
922
|
"aria-hidden": !0
|
|
927
923
|
}),
|
|
928
|
-
"aria-label":
|
|
929
|
-
"aria-pressed":
|
|
930
|
-
tooltipProps: { tooltip:
|
|
931
|
-
onClick:
|
|
924
|
+
"aria-label": K ? A : ie,
|
|
925
|
+
"aria-pressed": K,
|
|
926
|
+
tooltipProps: { tooltip: K ? A : ie },
|
|
927
|
+
onClick: Be
|
|
932
928
|
}),
|
|
933
|
-
|
|
934
|
-
icon:
|
|
929
|
+
$ && /* @__PURE__ */ z(w, {
|
|
930
|
+
icon: z(je ? k : te, {
|
|
935
931
|
size: x.LG,
|
|
936
932
|
stroke: S,
|
|
937
933
|
"aria-hidden": !0
|
|
938
934
|
}),
|
|
939
|
-
"aria-label":
|
|
940
|
-
tooltipProps: { tooltip:
|
|
935
|
+
"aria-label": je ? f : d,
|
|
936
|
+
tooltipProps: { tooltip: je ? f : d },
|
|
941
937
|
onClick: Re
|
|
942
938
|
}),
|
|
943
|
-
|
|
944
|
-
icon:
|
|
939
|
+
We && /* @__PURE__ */ z(w, {
|
|
940
|
+
icon: z(Me ? k : ae, {
|
|
945
941
|
size: x.LG,
|
|
946
942
|
stroke: S,
|
|
947
943
|
"aria-hidden": !0
|
|
948
944
|
}),
|
|
949
|
-
"aria-label":
|
|
950
|
-
tooltipProps: { tooltip:
|
|
951
|
-
onClick:
|
|
945
|
+
"aria-label": Me ? m : p,
|
|
946
|
+
tooltipProps: { tooltip: Me ? m : p },
|
|
947
|
+
onClick: Z
|
|
952
948
|
}),
|
|
953
|
-
|
|
954
|
-
icon:
|
|
949
|
+
Ge && /* @__PURE__ */ z(w, {
|
|
950
|
+
icon: z(Pe ? k : te, {
|
|
955
951
|
size: x.LG,
|
|
956
952
|
stroke: S,
|
|
957
953
|
"aria-hidden": !0
|
|
958
954
|
}),
|
|
959
955
|
"aria-label": Pe ? _ : h,
|
|
960
956
|
tooltipProps: { tooltip: Pe ? _ : h },
|
|
961
|
-
onClick:
|
|
957
|
+
onClick: ze
|
|
962
958
|
}),
|
|
963
|
-
|
|
964
|
-
icon: /* @__PURE__ */
|
|
959
|
+
Ke && /* @__PURE__ */ z(w, {
|
|
960
|
+
icon: /* @__PURE__ */ z(ne, {
|
|
965
961
|
size: x.LG,
|
|
966
962
|
stroke: S
|
|
967
963
|
}),
|
|
968
964
|
"aria-label": u,
|
|
969
965
|
tooltipProps: { tooltip: u },
|
|
970
|
-
onClick:
|
|
966
|
+
onClick: ve
|
|
971
967
|
})
|
|
972
968
|
] }) : null,
|
|
973
|
-
children: /* @__PURE__ */
|
|
969
|
+
children: /* @__PURE__ */ z(Fe, {
|
|
974
970
|
content: r,
|
|
975
971
|
isLoading: t,
|
|
976
972
|
fileName: a,
|
|
977
|
-
isHtmlSourceView:
|
|
973
|
+
isHtmlSourceView: K,
|
|
978
974
|
labels: {
|
|
979
975
|
unsupportedLabel: C,
|
|
980
976
|
loadErrorLabel: T,
|
|
@@ -983,67 +979,65 @@ var G = {
|
|
|
983
979
|
htmlFrameBlockedLabel: D,
|
|
984
980
|
htmlOpenInNewTabLabel: O,
|
|
985
981
|
pdfThumbnailsLabel: M,
|
|
986
|
-
pdfShowThumbnailsLabel:
|
|
987
|
-
pdfHideThumbnailsLabel:
|
|
988
|
-
pdfPageNumberLabel:
|
|
989
|
-
pdfContentLoadingLabel:
|
|
990
|
-
pdfContentErrorLabel:
|
|
991
|
-
pdfContentRetryLabel:
|
|
992
|
-
xlsxFormulaLabel:
|
|
993
|
-
codeContentLoadingLabel:
|
|
994
|
-
codeContentErrorLabel:
|
|
995
|
-
codeContentRetryLabel:
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
tableCopyMarkdownLabel: pe,
|
|
999
|
-
tableCopiedLabel: me,
|
|
982
|
+
pdfShowThumbnailsLabel: se,
|
|
983
|
+
pdfHideThumbnailsLabel: F,
|
|
984
|
+
pdfPageNumberLabel: ce,
|
|
985
|
+
pdfContentLoadingLabel: le,
|
|
986
|
+
pdfContentErrorLabel: V,
|
|
987
|
+
pdfContentRetryLabel: ue,
|
|
988
|
+
xlsxFormulaLabel: de,
|
|
989
|
+
codeContentLoadingLabel: H,
|
|
990
|
+
codeContentErrorLabel: fe,
|
|
991
|
+
codeContentRetryLabel: pe,
|
|
992
|
+
tableCopyLabel: me,
|
|
993
|
+
tableCopiedLabel: U,
|
|
1000
994
|
tableDownloadCsvLabel: he,
|
|
1001
|
-
ooxmlHighlightsLabel:
|
|
1002
|
-
ooxmlHighlightNavigatedLabel:
|
|
995
|
+
ooxmlHighlightsLabel: ge,
|
|
996
|
+
ooxmlHighlightNavigatedLabel: _e
|
|
1003
997
|
},
|
|
1004
|
-
styles:
|
|
1005
|
-
codeBlockTheme:
|
|
1006
|
-
tableDownloadFilename:
|
|
1007
|
-
loadPdf:
|
|
1008
|
-
configurePdfWorker:
|
|
998
|
+
styles: He,
|
|
999
|
+
codeBlockTheme: Oe,
|
|
1000
|
+
tableDownloadFilename: Se,
|
|
1001
|
+
loadPdf: ke,
|
|
1002
|
+
configurePdfWorker: Ae
|
|
1009
1003
|
})
|
|
1010
1004
|
});
|
|
1011
|
-
}),
|
|
1005
|
+
}), K = new Set(["html", "htm"]), q = {
|
|
1012
1006
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1013
1007
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1014
1008
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
1015
|
-
},
|
|
1009
|
+
}, 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 = {
|
|
1016
1010
|
docx: r.Docx,
|
|
1017
1011
|
xlsx: r.Xlsx,
|
|
1018
1012
|
pptx: r.Pptx,
|
|
1019
1013
|
csv: r.Csv
|
|
1020
|
-
},
|
|
1021
|
-
[
|
|
1022
|
-
[
|
|
1023
|
-
[
|
|
1014
|
+
}, X = {
|
|
1015
|
+
[q.docx]: r.Docx,
|
|
1016
|
+
[q.xlsx]: r.Xlsx,
|
|
1017
|
+
[q.pptx]: r.Pptx,
|
|
1024
1018
|
[f.CSV]: r.Csv
|
|
1025
|
-
},
|
|
1026
|
-
[r.Docx]:
|
|
1027
|
-
[r.Xlsx]:
|
|
1028
|
-
[r.Pptx]:
|
|
1019
|
+
}, Re = {
|
|
1020
|
+
[r.Docx]: q.docx,
|
|
1021
|
+
[r.Xlsx]: q.xlsx,
|
|
1022
|
+
[r.Pptx]: q.pptx,
|
|
1029
1023
|
[r.Csv]: f.CSV
|
|
1030
|
-
},
|
|
1024
|
+
}, Z = (e, t) => {
|
|
1031
1025
|
let n = t?.split(";", 1)[0].trim().toLowerCase();
|
|
1032
1026
|
if (n != null) {
|
|
1033
|
-
let e =
|
|
1027
|
+
let e = X[n];
|
|
1034
1028
|
if (e != null) return e;
|
|
1035
1029
|
}
|
|
1036
1030
|
let r = e.lastIndexOf(".");
|
|
1037
|
-
if (r !== -1) return
|
|
1038
|
-
},
|
|
1039
|
-
let n =
|
|
1040
|
-
return n == null ? void 0 :
|
|
1041
|
-
}, Be = (e) => {
|
|
1042
|
-
let t = e.lastIndexOf(".");
|
|
1043
|
-
return t === -1 ? !1 : Z.has(e.slice(t + 1).toLowerCase());
|
|
1031
|
+
if (r !== -1) return Y[e.slice(r + 1).toLowerCase()];
|
|
1032
|
+
}, ze = (e, t) => Z(e, t) != null, Be = (e, t) => {
|
|
1033
|
+
let n = Z(e, t);
|
|
1034
|
+
return n == null ? void 0 : Re[n];
|
|
1044
1035
|
}, Ve = (e) => {
|
|
1045
1036
|
let t = e.lastIndexOf(".");
|
|
1046
|
-
return t === -1 ? !1 :
|
|
1037
|
+
return t === -1 ? !1 : J.has(e.slice(t + 1).toLowerCase());
|
|
1038
|
+
}, Q = (e) => {
|
|
1039
|
+
let t = e.lastIndexOf(".");
|
|
1040
|
+
return t === -1 ? !1 : K.has(e.slice(t + 1).toLowerCase());
|
|
1047
1041
|
}, He = {
|
|
1048
1042
|
xml: "xml",
|
|
1049
1043
|
csv: "plaintext",
|
|
@@ -1114,18 +1108,18 @@ var G = {
|
|
|
1114
1108
|
}, Ye = A(void 0);
|
|
1115
1109
|
Ye.displayName = "AttachmentCanvasContext";
|
|
1116
1110
|
var Xe = ({ children: e }) => {
|
|
1117
|
-
let [t, n] =
|
|
1111
|
+
let [t, n] = L(!1), [r, i] = L(!1), [a, o] = L(Je), [s, c] = L(void 0), [l, u] = L(void 0), d = N((e, t) => {
|
|
1118
1112
|
c(e), u(t), i(!0), n(!0);
|
|
1119
1113
|
}, []), f = N((e, t, r) => {
|
|
1120
1114
|
o(e), c(t), u(r), i(!1), n(!0);
|
|
1121
1115
|
}, []), p = N(() => {
|
|
1122
1116
|
o(Je), n(!1), i(!1), u(void 0);
|
|
1123
1117
|
}, []);
|
|
1124
|
-
return
|
|
1118
|
+
return P(() => () => {
|
|
1125
1119
|
let e = Ke(a);
|
|
1126
1120
|
e != null && URL.revokeObjectURL(e);
|
|
1127
|
-
}, [a]), /* @__PURE__ */
|
|
1128
|
-
value:
|
|
1121
|
+
}, [a]), /* @__PURE__ */ z(Ye.Provider, {
|
|
1122
|
+
value: F(() => ({
|
|
1129
1123
|
isOpen: t,
|
|
1130
1124
|
isLoading: r,
|
|
1131
1125
|
content: a,
|
|
@@ -1147,25 +1141,25 @@ var Xe = ({ children: e }) => {
|
|
|
1147
1141
|
children: e
|
|
1148
1142
|
});
|
|
1149
1143
|
}, Ze = () => {
|
|
1150
|
-
let e =
|
|
1144
|
+
let e = se(Ye);
|
|
1151
1145
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
1152
1146
|
return e;
|
|
1153
1147
|
}, Qe = M(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
|
|
1154
|
-
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,
|
|
1155
|
-
a(
|
|
1156
|
-
}, [
|
|
1157
|
-
(
|
|
1158
|
-
}, [
|
|
1159
|
-
|
|
1160
|
-
}, [
|
|
1161
|
-
|
|
1162
|
-
}, [
|
|
1163
|
-
return /* @__PURE__ */
|
|
1164
|
-
isOpen:
|
|
1165
|
-
isLoading:
|
|
1166
|
-
onClose:
|
|
1167
|
-
content:
|
|
1168
|
-
fileName:
|
|
1148
|
+
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 } = Ze(), R = N(() => {
|
|
1149
|
+
a(L, ce);
|
|
1150
|
+
}, [L, ce]), B = N(() => {
|
|
1151
|
+
(L.type === i.PlainText || L.type === i.Code) && h(L.text);
|
|
1152
|
+
}, [L]), V = N(() => {
|
|
1153
|
+
L.type === i.Markdown && h(L.text);
|
|
1154
|
+
}, [L]), ue = N(() => {
|
|
1155
|
+
L.type === i.Json && h(JSON.stringify(L.value, null, 2));
|
|
1156
|
+
}, [L]);
|
|
1157
|
+
return /* @__PURE__ */ z(Le, {
|
|
1158
|
+
isOpen: F,
|
|
1159
|
+
isLoading: I,
|
|
1160
|
+
onClose: le,
|
|
1161
|
+
content: L,
|
|
1162
|
+
fileName: ce,
|
|
1169
1163
|
labels: {
|
|
1170
1164
|
ariaLabel: l,
|
|
1171
1165
|
closeLabel: u,
|
|
@@ -1194,18 +1188,16 @@ var Xe = ({ children: e }) => {
|
|
|
1194
1188
|
codeContentLoadingLabel: ie,
|
|
1195
1189
|
codeContentErrorLabel: ae,
|
|
1196
1190
|
codeContentRetryLabel: oe,
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
ooxmlHighlightsLabel: I,
|
|
1203
|
-
ooxmlHighlightNavigatedLabel: L
|
|
1191
|
+
tableCopyLabel: A,
|
|
1192
|
+
tableCopiedLabel: j,
|
|
1193
|
+
tableDownloadCsvLabel: M,
|
|
1194
|
+
ooxmlHighlightsLabel: se,
|
|
1195
|
+
ooxmlHighlightNavigatedLabel: P
|
|
1204
1196
|
},
|
|
1205
|
-
onDownload:
|
|
1206
|
-
onCopyText:
|
|
1207
|
-
onCopyMarkdown:
|
|
1208
|
-
onCopyJson:
|
|
1197
|
+
onDownload: R,
|
|
1198
|
+
onCopyText: L.type === i.PlainText || L.type === i.Code ? B : void 0,
|
|
1199
|
+
onCopyMarkdown: L.type === i.Markdown ? V : void 0,
|
|
1200
|
+
onCopyJson: L.type === i.Json ? ue : void 0,
|
|
1209
1201
|
tableDownloadFilename: s,
|
|
1210
1202
|
isMobile: t,
|
|
1211
1203
|
defaultWidth: n,
|
|
@@ -1219,24 +1211,24 @@ var Xe = ({ children: e }) => {
|
|
|
1219
1211
|
title: "_title_g47g7_10"
|
|
1220
1212
|
}, et = 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 }) => {
|
|
1221
1213
|
let u = e.visualizerName.trim();
|
|
1222
|
-
return /* @__PURE__ */
|
|
1214
|
+
return /* @__PURE__ */ B("div", {
|
|
1223
1215
|
className: g("flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", $e.frame),
|
|
1224
1216
|
style: m({
|
|
1225
1217
|
"--igv-bg": l?.background,
|
|
1226
1218
|
"--igv-border": l?.border,
|
|
1227
1219
|
"--igv-title-text": l?.titleText
|
|
1228
1220
|
}),
|
|
1229
|
-
children: [/* @__PURE__ */
|
|
1221
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1230
1222
|
className: g("flex min-h-10 items-center justify-between gap-2 border-b px-4 py-2", $e.header),
|
|
1231
|
-
children: [/* @__PURE__ */
|
|
1223
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1232
1224
|
className: g("min-w-0 truncate", c, $e.title),
|
|
1233
1225
|
children: u
|
|
1234
|
-
}), /* @__PURE__ */
|
|
1226
|
+
}), /* @__PURE__ */ z("div", {
|
|
1235
1227
|
role: "toolbar",
|
|
1236
1228
|
"aria-label": i,
|
|
1237
1229
|
className: "flex items-center gap-1",
|
|
1238
|
-
children: /* @__PURE__ */
|
|
1239
|
-
icon: /* @__PURE__ */
|
|
1230
|
+
children: /* @__PURE__ */ z(w, {
|
|
1231
|
+
icon: /* @__PURE__ */ z(O, {
|
|
1240
1232
|
size: x.SM,
|
|
1241
1233
|
stroke: S,
|
|
1242
1234
|
"aria-hidden": !0
|
|
@@ -1246,10 +1238,10 @@ var Xe = ({ children: e }) => {
|
|
|
1246
1238
|
onClick: n
|
|
1247
1239
|
})
|
|
1248
1240
|
})]
|
|
1249
|
-
}), /* @__PURE__ */
|
|
1241
|
+
}), /* @__PURE__ */ z("div", {
|
|
1250
1242
|
className: "w-full",
|
|
1251
1243
|
style: { height: `${t}px` },
|
|
1252
|
-
children: /* @__PURE__ */
|
|
1244
|
+
children: /* @__PURE__ */ z(je, {
|
|
1253
1245
|
content: e,
|
|
1254
1246
|
loadingLabel: o,
|
|
1255
1247
|
errorLabel: s,
|
|
@@ -1302,14 +1294,14 @@ var Xe = ({ children: e }) => {
|
|
|
1302
1294
|
let i = await e.resolveTextContent(t);
|
|
1303
1295
|
if (i != null) return r(i, t.name, n);
|
|
1304
1296
|
}
|
|
1305
|
-
let l =
|
|
1297
|
+
let l = Z("", a);
|
|
1306
1298
|
if (l != null) return r(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1307
1299
|
switch (a) {
|
|
1308
1300
|
case f.PDF: return r(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1309
1301
|
case f.Markdown: return r(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1310
1302
|
case f.JSON: return r(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1311
1303
|
}
|
|
1312
|
-
let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h =
|
|
1304
|
+
let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h = Z(u);
|
|
1313
1305
|
if (h != null) return r(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1314
1306
|
switch (m) {
|
|
1315
1307
|
case d.Markdown:
|
|
@@ -1326,8 +1318,8 @@ var Xe = ({ children: e }) => {
|
|
|
1326
1318
|
return i == null ? !1 : r(i, t.name, n);
|
|
1327
1319
|
}
|
|
1328
1320
|
}
|
|
1329
|
-
let g = t.name != null &&
|
|
1330
|
-
if (t.name != null && !
|
|
1321
|
+
let g = t.name != null && Q(t.name) || t.url != null && Q(at(t.url));
|
|
1322
|
+
if (t.name != null && !Ve(t.name) && !g) return r($(e.resolveContentUrl(t)), t.name, n);
|
|
1331
1323
|
if (g) {
|
|
1332
1324
|
let a = await e.resolveHtmlContent(t);
|
|
1333
1325
|
return a == null ? e.hasTextSource(t) ? r($(e.resolveContentUrl(t)), t.name, n) : t.url == null ? !1 : r({
|
|
@@ -1380,4 +1372,4 @@ var Xe = ({ children: e }) => {
|
|
|
1380
1372
|
]) };
|
|
1381
1373
|
};
|
|
1382
1374
|
//#endregion
|
|
1383
|
-
export {
|
|
1375
|
+
export { Le as AttachmentCanvas, Fe as AttachmentCanvasBody, Qe as AttachmentCanvasContainer, Xe as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, he as CodeContent, et as InlineGroupedVisualizer, we as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, Ge as createForbiddenCanvasContent, We as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, a as downloadAttachmentContent, Ue as extensionToLanguage, nt as findVisualizerForApplication, tt as findVisualizerForMime, Z as getOoxmlFileType, Be as getOoxmlMimeType, rt as groupedVisualizerCanvasKey, o as isDownloadable, Q as isHtmlPreviewable, ze as isOoxmlPreviewable, Ve as isTextPreviewable, it as partitionAttachmentsForApplicationVisualizer, Ze as useAttachmentCanvas, ot as useOpenAttachmentCanvas };
|