@epam/ai-dial-attachment-canvas 1.1.0-dev.411 → 1.1.0-dev.418
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-DkAcpR4S.js → LazyContentBoundary-9fvYBGuL.js} +5 -2
- package/PdfContent-BexpRNO0.js +239 -0
- package/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
- package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -1
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts +2 -0
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
- package/components/PdfContent/PdfContent.d.ts +7 -0
- package/components/PdfContent/PdfContent.d.ts.map +1 -1
- package/context/AttachmentCanvasContext.d.ts +1 -1
- package/context/AttachmentCanvasContext.d.ts.map +1 -1
- package/index.js +451 -406
- package/models/attachment-canvas.d.ts +25 -2
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +3 -3
- package/types/attachment-canvas.d.ts +1 -0
- package/types/attachment-canvas.d.ts.map +1 -1
- package/utils/download.d.ts.map +1 -1
- package/PdfContent-BBUc0_SC.js +0 -226
package/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { c as e, i as t, l as n, o as r, s as i, t as a } from "./LazyContentBoundary-
|
|
1
|
+
import { c as e, i as t, l as n, o as r, s as i, t as a } from "./LazyContentBoundary-9fvYBGuL.js";
|
|
2
2
|
import { AttachmentType as o, CodeBlockTheme as s, DEFAULT_MARKDOWN_CLASS_NAMES as c, FileExtension as l, MIMEType as u, MarkdownRenderer as d, buildCssVars as f, copyToClipboard as p, mergeClasses as m, restrainedSyntaxTheme as h, stripUrlQueryAndFragment as g } from "@epam/ai-dial-chat-shared";
|
|
3
|
-
import { SidebarOrientation as _, SidebarPanel as
|
|
4
|
-
import { DIAL_ICON_SIZE as
|
|
5
|
-
import { IconAlertTriangle as
|
|
6
|
-
import { createContext as
|
|
7
|
-
import { JsonView as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { AppRenderer as
|
|
10
|
-
import { VisualizerConnectorRequests as
|
|
11
|
-
import { VisualizerConnector as
|
|
12
|
-
var
|
|
3
|
+
import { SidebarOrientation as _, SidebarPanel as v } from "@epam/ai-dial-sidebar";
|
|
4
|
+
import { DIAL_ICON_SIZE as y, DIAL_KIT_ICON_STROKE as b, GhostIconButton as x, LinkButton as S, Spinner as C } from "@epam/ai-dial-ui-kit";
|
|
5
|
+
import { IconAlertTriangle as w, IconCheck as T, IconCode as E, IconCopy as D, IconDownload as ee, IconEye as te, IconLock as ne, IconMarkdown as re, IconRefresh as ie } from "@tabler/icons-react";
|
|
6
|
+
import { createContext as O, lazy as k, memo as A, useCallback as j, useContext as M, useEffect as N, useMemo as P, useRef as F, useState as I } from "react";
|
|
7
|
+
import { JsonView as ae, defaultStyles as oe } from "react-json-view-lite";
|
|
8
|
+
import { Fragment as se, jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
9
|
+
import { AppRenderer as z } from "@mcp-ui/client";
|
|
10
|
+
import { VisualizerConnectorRequests as B } from "@epam/ai-dial-shared";
|
|
11
|
+
import { VisualizerConnector as ce } from "@epam/ai-dial-visualizer-connector";
|
|
12
|
+
var V = {
|
|
13
13
|
container: "_container_1nhig_1",
|
|
14
14
|
containerLight: "_containerLight_1nhig_5"
|
|
15
|
-
},
|
|
15
|
+
}, H = {
|
|
16
16
|
[s.Dark]: h,
|
|
17
17
|
[s.Light]: h
|
|
18
|
-
},
|
|
18
|
+
}, le = () => k(async () => {
|
|
19
19
|
let { Prism: e } = await import("react-syntax-highlighter");
|
|
20
20
|
return { default: e };
|
|
21
|
-
}),
|
|
22
|
-
let { text: r, language: i } = e, o = i == null || i === "plaintext", c =
|
|
21
|
+
}), ue = A(({ content: e, codeBlockTheme: t = s.Light, labels: n }) => {
|
|
22
|
+
let { text: r, language: i } = e, o = i == null || i === "plaintext", c = H[t], l = t === s.Light, [u, d] = I(0), f = P(le, [u]), p = j(() => {
|
|
23
23
|
d((e) => e + 1);
|
|
24
|
-
}, []), h = /* @__PURE__ */
|
|
24
|
+
}, []), h = /* @__PURE__ */ L("pre", {
|
|
25
25
|
className: "whitespace-pre-wrap break-words p-4",
|
|
26
26
|
children: r
|
|
27
27
|
});
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ L("div", {
|
|
29
29
|
dir: "ltr",
|
|
30
|
-
className: m("h-full overflow-auto",
|
|
31
|
-
children: o ? h : /* @__PURE__ */
|
|
30
|
+
className: m("h-full overflow-auto", V.container, l && V.containerLight),
|
|
31
|
+
children: o ? h : /* @__PURE__ */ L(a, {
|
|
32
32
|
retryKey: u,
|
|
33
33
|
onRetry: p,
|
|
34
34
|
pendingContent: h,
|
|
35
35
|
errorContent: h,
|
|
36
36
|
labels: n,
|
|
37
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ L(f, {
|
|
38
38
|
language: i,
|
|
39
39
|
style: c,
|
|
40
40
|
customStyle: {
|
|
@@ -51,21 +51,21 @@ var L = {
|
|
|
51
51
|
})
|
|
52
52
|
})
|
|
53
53
|
});
|
|
54
|
-
}),
|
|
55
|
-
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] =
|
|
56
|
-
|
|
54
|
+
}), de = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, fe = A(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
|
|
55
|
+
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = I(!0), [d, f] = I(!1), p = F(null);
|
|
56
|
+
N(() => {
|
|
57
57
|
u(!0), f(!1);
|
|
58
58
|
}, [e]);
|
|
59
|
-
let h =
|
|
59
|
+
let h = j((t) => {
|
|
60
60
|
if (u(!1), e.srcdoc == null) try {
|
|
61
61
|
p.current?.contentDocument ?? f(!0);
|
|
62
62
|
} catch {
|
|
63
63
|
f(!0);
|
|
64
64
|
}
|
|
65
|
-
}, [e.srcdoc]), g =
|
|
65
|
+
}, [e.srcdoc]), g = j(() => {
|
|
66
66
|
u(!1), f(!0);
|
|
67
67
|
}, []);
|
|
68
|
-
if (n && e.srcdoc != null) return /* @__PURE__ */
|
|
68
|
+
if (n && e.srcdoc != null) return /* @__PURE__ */ L(ue, {
|
|
69
69
|
content: {
|
|
70
70
|
type: i.Code,
|
|
71
71
|
text: e.srcdoc,
|
|
@@ -73,44 +73,44 @@ var L = {
|
|
|
73
73
|
},
|
|
74
74
|
codeBlockTheme: a
|
|
75
75
|
});
|
|
76
|
-
if (d) return /* @__PURE__ */
|
|
76
|
+
if (d) return /* @__PURE__ */ R("div", {
|
|
77
77
|
className: "flex h-full flex-col items-center justify-center gap-3 p-4",
|
|
78
|
-
children: [/* @__PURE__ */
|
|
78
|
+
children: [/* @__PURE__ */ L("p", {
|
|
79
79
|
className: "text-center",
|
|
80
80
|
children: s
|
|
81
|
-
}), e.url != null && /* @__PURE__ */
|
|
81
|
+
}), e.url != null && /* @__PURE__ */ L(S, {
|
|
82
82
|
href: e.url,
|
|
83
83
|
target: "_blank",
|
|
84
84
|
label: c,
|
|
85
|
-
className:
|
|
85
|
+
className: de.openInNewTabButton,
|
|
86
86
|
textClassName: o
|
|
87
87
|
})]
|
|
88
88
|
});
|
|
89
|
-
let _ = e.srcdoc != null,
|
|
90
|
-
return /* @__PURE__ */
|
|
89
|
+
let _ = e.srcdoc != null, v = _ ? void 0 : e.url, y = _ ? e.srcdoc : void 0;
|
|
90
|
+
return /* @__PURE__ */ R("div", {
|
|
91
91
|
className: "relative h-full",
|
|
92
|
-
children: [l && /* @__PURE__ */
|
|
92
|
+
children: [l && /* @__PURE__ */ L("div", {
|
|
93
93
|
className: "absolute inset-0 flex items-center justify-center",
|
|
94
|
-
children: /* @__PURE__ */
|
|
95
|
-
}), /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ L(C, {})
|
|
95
|
+
}), /* @__PURE__ */ L("iframe", {
|
|
96
96
|
ref: p,
|
|
97
97
|
title: r,
|
|
98
|
-
src:
|
|
99
|
-
srcDoc:
|
|
98
|
+
src: v,
|
|
99
|
+
srcDoc: y,
|
|
100
100
|
sandbox: _ ? "allow-scripts" : "allow-scripts allow-same-origin",
|
|
101
101
|
className: m("h-full w-full border-none", l ? "invisible" : ""),
|
|
102
102
|
onLoad: h,
|
|
103
103
|
onError: g
|
|
104
104
|
})]
|
|
105
105
|
});
|
|
106
|
-
}),
|
|
106
|
+
}), U = {
|
|
107
107
|
loadingOverlay: "_loadingOverlay_72o98_1",
|
|
108
108
|
fullscreenFrame: "_fullscreenFrame_72o98_14",
|
|
109
109
|
statusLabel: "_statusLabel_72o98_19",
|
|
110
110
|
errorIcon: "_errorIcon_72o98_23"
|
|
111
|
-
},
|
|
112
|
-
let [n, r] =
|
|
113
|
-
|
|
111
|
+
}, pe = ({ content: e, errorLabel: t = "Failed to load app" }) => {
|
|
112
|
+
let [n, r] = I("loading"), { html: i, sandboxUrl: a, toolName: o, toolInput: s, toolResult: c, hostContext: l, onToolCall: u } = e, d = P(() => ({ url: new URL(a) }), [a]), f = l?.displayMode === "fullscreen", p = F(null), [h, g] = I();
|
|
113
|
+
N(() => {
|
|
114
114
|
let e = p.current;
|
|
115
115
|
if (!e) return;
|
|
116
116
|
let t = new ResizeObserver(([e]) => {
|
|
@@ -123,15 +123,15 @@ var L = {
|
|
|
123
123
|
});
|
|
124
124
|
return t.observe(e), () => t.disconnect();
|
|
125
125
|
}, []);
|
|
126
|
-
let _ =
|
|
126
|
+
let _ = P(() => l == null || h == null ? l : {
|
|
127
127
|
...l,
|
|
128
128
|
containerDimensions: h
|
|
129
129
|
}, [l, h]);
|
|
130
|
-
return /* @__PURE__ */
|
|
130
|
+
return /* @__PURE__ */ R("div", {
|
|
131
131
|
ref: p,
|
|
132
|
-
className: m("relative h-full w-full", f &&
|
|
132
|
+
className: m("relative h-full w-full", f && U.fullscreenFrame),
|
|
133
133
|
children: [
|
|
134
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ L(z, {
|
|
135
135
|
html: i,
|
|
136
136
|
toolName: o,
|
|
137
137
|
toolInput: s,
|
|
@@ -142,39 +142,39 @@ var L = {
|
|
|
142
142
|
onSizeChanged: () => r("ready"),
|
|
143
143
|
onError: () => r("error")
|
|
144
144
|
}),
|
|
145
|
-
n === "loading" && /* @__PURE__ */
|
|
146
|
-
className: m("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
147
|
-
children: /* @__PURE__ */
|
|
145
|
+
n === "loading" && /* @__PURE__ */ L("div", {
|
|
146
|
+
className: m("absolute inset-0 flex flex-col items-center justify-center gap-2", U.loadingOverlay),
|
|
147
|
+
children: /* @__PURE__ */ L(C, {})
|
|
148
148
|
}),
|
|
149
|
-
n === "error" && /* @__PURE__ */
|
|
149
|
+
n === "error" && /* @__PURE__ */ R("div", {
|
|
150
150
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
151
|
-
children: [/* @__PURE__ */
|
|
151
|
+
children: [/* @__PURE__ */ L(w, {
|
|
152
152
|
size: 60,
|
|
153
|
-
stroke:
|
|
153
|
+
stroke: b,
|
|
154
154
|
"aria-hidden": !0,
|
|
155
|
-
className:
|
|
156
|
-
}), /* @__PURE__ */
|
|
155
|
+
className: U.errorIcon
|
|
156
|
+
}), /* @__PURE__ */ L("p", {
|
|
157
157
|
role: "alert",
|
|
158
|
-
className: m("text-center",
|
|
158
|
+
className: m("text-center", U.statusLabel),
|
|
159
159
|
children: t
|
|
160
160
|
})]
|
|
161
161
|
})
|
|
162
162
|
]
|
|
163
163
|
});
|
|
164
|
-
},
|
|
164
|
+
}, W = {
|
|
165
165
|
viewer: "_viewer_1npwu_1",
|
|
166
166
|
spreadsheetCanvas: "_spreadsheetCanvas_1npwu_5",
|
|
167
167
|
formulaPanel: "_formulaPanel_1npwu_11",
|
|
168
168
|
formulaValue: "_formulaValue_1npwu_17",
|
|
169
169
|
statusOverlay: "_statusOverlay_1npwu_23",
|
|
170
170
|
errorIcon: "_errorIcon_1npwu_28"
|
|
171
|
-
},
|
|
171
|
+
}, me = (e) => {
|
|
172
172
|
if (e?.kind !== "range") return "";
|
|
173
173
|
let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
|
|
174
174
|
if (n == null) return "";
|
|
175
175
|
let r = n.formula;
|
|
176
176
|
return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
|
|
177
|
-
},
|
|
177
|
+
}, he = async (e, t, r, i) => {
|
|
178
178
|
switch (t) {
|
|
179
179
|
case n.Docx: {
|
|
180
180
|
let [{ DocxScrollViewer: t }, { chartEx: n }] = await Promise.all([import("./docx-B9qBTEkj.js"), import("./chart-ex-B0DgG3Dt.js")]);
|
|
@@ -196,7 +196,7 @@ var L = {
|
|
|
196
196
|
}
|
|
197
197
|
case n.Csv: {
|
|
198
198
|
let { XlsxSheetViewer: t } = await import("./xlsx-BAXMTJTG.js"), n = document.createElement("canvas");
|
|
199
|
-
n.className =
|
|
199
|
+
n.className = W.spreadsheetCanvas, e.replaceChildren(n);
|
|
200
200
|
let i = new t(n, {
|
|
201
201
|
showScrollbars: !0,
|
|
202
202
|
onError: r
|
|
@@ -216,18 +216,18 @@ var L = {
|
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
},
|
|
220
|
-
let o =
|
|
221
|
-
return
|
|
219
|
+
}, ge = ({ content: e, fileName: t, loadErrorLabel: r, formulaLabel: i, formulaLabelClassName: a }) => {
|
|
220
|
+
let o = F(null), [s, c] = I(!0), [l, u] = I(!1), [d, f] = I("");
|
|
221
|
+
return N(() => {
|
|
222
222
|
let t = o.current;
|
|
223
223
|
if (t == null) return;
|
|
224
224
|
let n, r = !1;
|
|
225
225
|
return c(!0), u(!1), f(""), (async () => {
|
|
226
226
|
try {
|
|
227
|
-
let i = await
|
|
227
|
+
let i = await he(t, e.format, () => {
|
|
228
228
|
r || (c(!1), u(!0));
|
|
229
229
|
}, (e) => {
|
|
230
|
-
r || f(
|
|
230
|
+
r || f(me(e));
|
|
231
231
|
});
|
|
232
232
|
if (r) {
|
|
233
233
|
i.destroy();
|
|
@@ -240,44 +240,44 @@ var L = {
|
|
|
240
240
|
})(), () => {
|
|
241
241
|
r = !0, n?.destroy(), t.replaceChildren();
|
|
242
242
|
};
|
|
243
|
-
}, [e.format, e.url]), /* @__PURE__ */
|
|
243
|
+
}, [e.format, e.url]), /* @__PURE__ */ R("div", {
|
|
244
244
|
className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
|
|
245
245
|
children: [
|
|
246
|
-
e.format === n.Xlsx && /* @__PURE__ */
|
|
246
|
+
e.format === n.Xlsx && /* @__PURE__ */ R("div", {
|
|
247
247
|
role: "region",
|
|
248
248
|
"aria-label": i,
|
|
249
|
-
className: m("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2",
|
|
250
|
-
children: [/* @__PURE__ */
|
|
249
|
+
className: m("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", W.formulaPanel),
|
|
250
|
+
children: [/* @__PURE__ */ L("span", {
|
|
251
251
|
"aria-hidden": "true",
|
|
252
252
|
className: m("shrink-0", a),
|
|
253
253
|
children: "fx"
|
|
254
|
-
}), /* @__PURE__ */
|
|
254
|
+
}), /* @__PURE__ */ L("code", {
|
|
255
255
|
dir: "ltr",
|
|
256
256
|
tabIndex: 0,
|
|
257
257
|
"aria-live": "polite",
|
|
258
|
-
className: m("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",
|
|
258
|
+
className: m("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),
|
|
259
259
|
children: d
|
|
260
260
|
})]
|
|
261
261
|
}),
|
|
262
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ L("div", {
|
|
263
263
|
ref: o,
|
|
264
264
|
role: "document",
|
|
265
265
|
"aria-label": t,
|
|
266
266
|
"aria-busy": s,
|
|
267
|
-
className: m("min-h-0 w-full flex-1 overflow-hidden",
|
|
267
|
+
className: m("min-h-0 w-full flex-1 overflow-hidden", W.viewer)
|
|
268
268
|
}),
|
|
269
|
-
(s || l) && /* @__PURE__ */
|
|
269
|
+
(s || l) && /* @__PURE__ */ L("div", {
|
|
270
270
|
role: l ? "alert" : void 0,
|
|
271
271
|
"aria-live": "polite",
|
|
272
|
-
className: m("absolute inset-0 flex items-center justify-center",
|
|
273
|
-
children: s ? /* @__PURE__ */
|
|
272
|
+
className: m("absolute inset-0 flex items-center justify-center", W.statusOverlay),
|
|
273
|
+
children: s ? /* @__PURE__ */ L(C, { size: 48 }) : /* @__PURE__ */ R("div", {
|
|
274
274
|
className: "flex flex-col items-center gap-2",
|
|
275
|
-
children: [/* @__PURE__ */
|
|
275
|
+
children: [/* @__PURE__ */ L(w, {
|
|
276
276
|
"aria-hidden": "true",
|
|
277
277
|
size: 60,
|
|
278
|
-
stroke:
|
|
279
|
-
className:
|
|
280
|
-
}), /* @__PURE__ */
|
|
278
|
+
stroke: b,
|
|
279
|
+
className: W.errorIcon
|
|
280
|
+
}), /* @__PURE__ */ L("p", {
|
|
281
281
|
className: "text-center",
|
|
282
282
|
children: r
|
|
283
283
|
})]
|
|
@@ -285,17 +285,17 @@ var L = {
|
|
|
285
285
|
})
|
|
286
286
|
]
|
|
287
287
|
});
|
|
288
|
-
},
|
|
288
|
+
}, G = {
|
|
289
289
|
loadingOverlay: "_loadingOverlay_12637_1",
|
|
290
290
|
statusLabel: "_statusLabel_12637_5",
|
|
291
291
|
errorIcon: "_errorIcon_12637_9"
|
|
292
|
-
},
|
|
293
|
-
let i =
|
|
294
|
-
return u.current = e,
|
|
292
|
+
}, _e = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
|
|
293
|
+
let i = F(null), [a, o] = I("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = F(e);
|
|
294
|
+
return u.current = e, N(() => {
|
|
295
295
|
let e = i.current;
|
|
296
296
|
if (!e) return;
|
|
297
297
|
o("loading");
|
|
298
|
-
let t = new
|
|
298
|
+
let t = new ce(e, {
|
|
299
299
|
domain: s,
|
|
300
300
|
hostDomain: window.location.origin,
|
|
301
301
|
visualizerName: c,
|
|
@@ -307,7 +307,7 @@ var L = {
|
|
|
307
307
|
layout: r,
|
|
308
308
|
...typeof i == "object" && i ? i : {}
|
|
309
309
|
};
|
|
310
|
-
await t.send(
|
|
310
|
+
await t.send(B.sendVisualizeData, {
|
|
311
311
|
mimeType: e,
|
|
312
312
|
visualizerData: a
|
|
313
313
|
}), n && o("ready");
|
|
@@ -320,7 +320,7 @@ var L = {
|
|
|
320
320
|
s,
|
|
321
321
|
c,
|
|
322
322
|
l
|
|
323
|
-
]), /* @__PURE__ */
|
|
323
|
+
]), /* @__PURE__ */ R("div", {
|
|
324
324
|
className: "relative h-full w-full",
|
|
325
325
|
style: f({
|
|
326
326
|
"--vs-loading-bg": r?.loadingBackground,
|
|
@@ -328,33 +328,33 @@ var L = {
|
|
|
328
328
|
"--vs-error-icon": r?.errorIcon
|
|
329
329
|
}),
|
|
330
330
|
children: [
|
|
331
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ L("div", {
|
|
332
332
|
ref: i,
|
|
333
333
|
className: "h-full w-full"
|
|
334
334
|
}),
|
|
335
|
-
a === "loading" && /* @__PURE__ */
|
|
336
|
-
className: m("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
337
|
-
children: [/* @__PURE__ */
|
|
338
|
-
className: m("text-center",
|
|
335
|
+
a === "loading" && /* @__PURE__ */ R("div", {
|
|
336
|
+
className: m("absolute inset-0 flex flex-col items-center justify-center gap-2", G.loadingOverlay),
|
|
337
|
+
children: [/* @__PURE__ */ L(C, {}), t && /* @__PURE__ */ L("p", {
|
|
338
|
+
className: m("text-center", G.statusLabel),
|
|
339
339
|
children: t
|
|
340
340
|
})]
|
|
341
341
|
}),
|
|
342
|
-
a === "error" && /* @__PURE__ */
|
|
342
|
+
a === "error" && /* @__PURE__ */ R("div", {
|
|
343
343
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
344
|
-
children: [/* @__PURE__ */
|
|
344
|
+
children: [/* @__PURE__ */ L(w, {
|
|
345
345
|
size: 60,
|
|
346
|
-
stroke:
|
|
346
|
+
stroke: b,
|
|
347
347
|
"aria-hidden": !0,
|
|
348
|
-
className:
|
|
349
|
-
}), /* @__PURE__ */
|
|
348
|
+
className: G.errorIcon
|
|
349
|
+
}), /* @__PURE__ */ L("p", {
|
|
350
350
|
role: "alert",
|
|
351
|
-
className: m("text-center",
|
|
351
|
+
className: m("text-center", G.statusLabel),
|
|
352
352
|
children: n
|
|
353
353
|
})]
|
|
354
354
|
})
|
|
355
355
|
]
|
|
356
356
|
});
|
|
357
|
-
},
|
|
357
|
+
}, K = {
|
|
358
358
|
body: "_body_13ogb_4",
|
|
359
359
|
statusLabel: "_statusLabel_13ogb_13",
|
|
360
360
|
errorIcon: "_errorIcon_13ogb_17",
|
|
@@ -369,64 +369,64 @@ var L = {
|
|
|
369
369
|
jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
|
|
370
370
|
jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
|
|
371
371
|
jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
|
|
372
|
-
},
|
|
373
|
-
let [r, i] =
|
|
374
|
-
return
|
|
372
|
+
}, ve = () => k(async () => ({ default: (await import("./PdfContent-BexpRNO0.js")).PdfContent })), ye = ({ url: e, fileName: t, loadErrorLabel: n }) => {
|
|
373
|
+
let [r, i] = I(!1);
|
|
374
|
+
return N(() => {
|
|
375
375
|
i(!1);
|
|
376
|
-
}, [e]), r ? /* @__PURE__ */
|
|
376
|
+
}, [e]), r ? /* @__PURE__ */ R("div", {
|
|
377
377
|
className: "flex flex-col items-center gap-2",
|
|
378
|
-
children: [/* @__PURE__ */
|
|
378
|
+
children: [/* @__PURE__ */ L(w, {
|
|
379
379
|
size: 60,
|
|
380
|
-
stroke:
|
|
381
|
-
className:
|
|
382
|
-
}), /* @__PURE__ */
|
|
383
|
-
className: m("text-center",
|
|
380
|
+
stroke: b,
|
|
381
|
+
className: K.errorIcon
|
|
382
|
+
}), /* @__PURE__ */ L("p", {
|
|
383
|
+
className: m("text-center", K.statusLabel),
|
|
384
384
|
children: n
|
|
385
385
|
})]
|
|
386
|
-
}) : /* @__PURE__ */
|
|
386
|
+
}) : /* @__PURE__ */ L("img", {
|
|
387
387
|
src: e,
|
|
388
388
|
alt: t ?? "",
|
|
389
389
|
className: "max-h-full max-w-full object-contain",
|
|
390
390
|
onError: () => i(!0)
|
|
391
391
|
});
|
|
392
|
-
},
|
|
392
|
+
}, be = new Set([
|
|
393
393
|
i.PlainText,
|
|
394
394
|
i.Code,
|
|
395
395
|
i.Ooxml
|
|
396
|
-
]),
|
|
397
|
-
let { colors:
|
|
398
|
-
|
|
399
|
-
}, []),
|
|
396
|
+
]), xe = A(({ content: t, isLoading: n = !1, fileName: r, isHtmlSourceView: o = !1, labels: { unsupportedLabel: s = "Preview is not supported for this file", loadErrorLabel: l = "Failed to load file", forbiddenErrorLabel: u = "You don't have permission to access this file", visualizerErrorLabel: p, htmlFrameBlockedLabel: h = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: g = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: x, pdfContentLoadingLabel: S, pdfContentErrorLabel: T, pdfContentRetryLabel: E, xlsxFormulaLabel: D = "Formula", codeContentLoadingLabel: ee, codeContentErrorLabel: te, codeContentRetryLabel: re, tableCopyCsvLabel: ie, tableCopyTxtLabel: O, tableCopyMarkdownLabel: k, tableCopiedLabel: A, tableDownloadCsvLabel: M } = {}, styles: N, codeBlockTheme: F, tableDownloadFilename: se, loadPdf: z, hidePdfToolbar: B = !1, configurePdfWorker: ce }) => {
|
|
397
|
+
let { colors: V, typography: H, bodyClassName: le, cssVars: de } = N ?? {}, [U, W] = I(0), me = P(ve, [U]), he = j(() => {
|
|
398
|
+
W((e) => e + 1);
|
|
399
|
+
}, []), G = H?.fontClassName != null, xe = P(() => ({
|
|
400
400
|
...f({
|
|
401
|
-
"--ac-text":
|
|
402
|
-
"--ac-status-text":
|
|
403
|
-
"--ac-error-icon":
|
|
404
|
-
"--ac-open-in-new-tab-text":
|
|
405
|
-
"--ac-json-border":
|
|
406
|
-
"--ac-json-bg":
|
|
407
|
-
"--ac-json-label":
|
|
408
|
-
"--ac-json-clickable-label":
|
|
409
|
-
"--ac-json-punctuation":
|
|
410
|
-
"--ac-json-string":
|
|
411
|
-
"--ac-json-number":
|
|
412
|
-
"--ac-json-boolean":
|
|
413
|
-
"--ac-json-null":
|
|
414
|
-
"--ac-json-toggle-icon":
|
|
415
|
-
"--ac-json-toggle-icon-hover":
|
|
416
|
-
"--ac-ooxml-bg":
|
|
417
|
-
"--ac-ooxml-formula-border":
|
|
418
|
-
"--ac-ooxml-formula-bg":
|
|
419
|
-
"--ac-ooxml-formula-text":
|
|
420
|
-
"--ac-json-collapsed-text":
|
|
421
|
-
"--ac-json-collapsed-bg":
|
|
422
|
-
"--ac-font-family":
|
|
423
|
-
"--ac-font-size":
|
|
424
|
-
"--ac-font-weight":
|
|
425
|
-
"--ac-line-height":
|
|
426
|
-
"--ac-letter-spacing":
|
|
401
|
+
"--ac-text": V?.text,
|
|
402
|
+
"--ac-status-text": V?.statusText,
|
|
403
|
+
"--ac-error-icon": V?.errorIcon,
|
|
404
|
+
"--ac-open-in-new-tab-text": V?.openInNewTabText,
|
|
405
|
+
"--ac-json-border": V?.jsonBorder,
|
|
406
|
+
"--ac-json-bg": V?.jsonBackground,
|
|
407
|
+
"--ac-json-label": V?.jsonLabel,
|
|
408
|
+
"--ac-json-clickable-label": V?.jsonClickableLabel,
|
|
409
|
+
"--ac-json-punctuation": V?.jsonPunctuation,
|
|
410
|
+
"--ac-json-string": V?.jsonString,
|
|
411
|
+
"--ac-json-number": V?.jsonNumber,
|
|
412
|
+
"--ac-json-boolean": V?.jsonBoolean,
|
|
413
|
+
"--ac-json-null": V?.jsonNull,
|
|
414
|
+
"--ac-json-toggle-icon": V?.jsonToggleIcon,
|
|
415
|
+
"--ac-json-toggle-icon-hover": V?.jsonToggleIconHover,
|
|
416
|
+
"--ac-ooxml-bg": V?.ooxmlBackground,
|
|
417
|
+
"--ac-ooxml-formula-border": V?.ooxmlFormulaBorder,
|
|
418
|
+
"--ac-ooxml-formula-bg": V?.ooxmlFormulaBackground,
|
|
419
|
+
"--ac-ooxml-formula-text": V?.ooxmlFormulaText,
|
|
420
|
+
"--ac-json-collapsed-text": V?.jsonCollapsedText,
|
|
421
|
+
"--ac-json-collapsed-bg": V?.jsonCollapsedBackground,
|
|
422
|
+
"--ac-font-family": G ? void 0 : H?.fontFamily,
|
|
423
|
+
"--ac-font-size": G ? void 0 : H?.fontSize,
|
|
424
|
+
"--ac-font-weight": G ? void 0 : H?.fontWeight,
|
|
425
|
+
"--ac-line-height": G ? void 0 : H?.lineHeight,
|
|
426
|
+
"--ac-letter-spacing": G ? void 0 : H?.letterSpacing
|
|
427
427
|
}),
|
|
428
428
|
...de
|
|
429
|
-
}), [
|
|
429
|
+
}), [N]), Se = P(() => {
|
|
430
430
|
switch (t.type) {
|
|
431
431
|
case i.Image:
|
|
432
432
|
case i.Audio:
|
|
@@ -439,73 +439,99 @@ var L = {
|
|
|
439
439
|
case i.McpApp:
|
|
440
440
|
case i.Code:
|
|
441
441
|
case i.Html: return "h-full overflow-hidden";
|
|
442
|
+
case i.Markdown:
|
|
443
|
+
case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
|
|
442
444
|
default: return "h-full overflow-auto p-4";
|
|
443
445
|
}
|
|
444
|
-
}, [t.type]),
|
|
446
|
+
}, [t.type]), Ce = P(() => {
|
|
445
447
|
switch (t.type) {
|
|
446
|
-
case i.PlainText: return /* @__PURE__ */
|
|
447
|
-
className: m("whitespace-pre-wrap break-words",
|
|
448
|
+
case i.PlainText: return /* @__PURE__ */ L("pre", {
|
|
449
|
+
className: m("whitespace-pre-wrap break-words", K.body, H?.fontClassName),
|
|
448
450
|
children: t.text
|
|
449
451
|
});
|
|
450
|
-
case i.Image: return /* @__PURE__ */
|
|
452
|
+
case i.Image: return /* @__PURE__ */ L(ye, {
|
|
451
453
|
url: t.url,
|
|
452
454
|
fileName: r,
|
|
453
455
|
loadErrorLabel: l
|
|
454
456
|
});
|
|
455
|
-
case i.Audio: return /* @__PURE__ */
|
|
457
|
+
case i.Audio: return /* @__PURE__ */ L("audio", {
|
|
456
458
|
controls: !0,
|
|
457
459
|
src: t.url,
|
|
458
460
|
"aria-label": r ?? "Audio attachment",
|
|
459
461
|
className: "w-full max-w-sm",
|
|
460
462
|
preload: "metadata",
|
|
461
|
-
children: t.mimeType && /* @__PURE__ */
|
|
463
|
+
children: t.mimeType && /* @__PURE__ */ L("source", {
|
|
462
464
|
src: t.url,
|
|
463
465
|
type: t.mimeType
|
|
464
466
|
})
|
|
465
467
|
});
|
|
466
|
-
case i.Markdown: return /* @__PURE__ */
|
|
468
|
+
case i.Markdown: return /* @__PURE__ */ L(d, {
|
|
469
|
+
content: t.text,
|
|
470
|
+
isStreaming: !1,
|
|
471
|
+
codeBlockTheme: F,
|
|
472
|
+
containerClassName: "flex h-full min-h-0 flex-col",
|
|
473
|
+
classNames: {
|
|
474
|
+
...c,
|
|
475
|
+
tableWrapper: "my-0 max-h-full",
|
|
476
|
+
tableScrollContainer: "max-h-full"
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
case i.MarkdownTable: return /* @__PURE__ */ L(d, {
|
|
467
480
|
content: t.text,
|
|
468
481
|
isStreaming: !1,
|
|
469
|
-
codeBlockTheme:
|
|
470
|
-
|
|
482
|
+
codeBlockTheme: F,
|
|
483
|
+
containerClassName: "flex h-full min-h-0 flex-col",
|
|
484
|
+
classNames: {
|
|
485
|
+
...c,
|
|
486
|
+
tableWrapper: "my-0 max-h-full",
|
|
487
|
+
tableScrollContainer: "max-h-full"
|
|
488
|
+
},
|
|
489
|
+
tableActionLabels: {
|
|
490
|
+
copyCsvLabel: ie,
|
|
491
|
+
copyTxtLabel: O,
|
|
492
|
+
copyMarkdownLabel: k,
|
|
493
|
+
copiedLabel: A,
|
|
494
|
+
downloadCsvLabel: M
|
|
495
|
+
},
|
|
496
|
+
tableDownloadFilename: se
|
|
471
497
|
});
|
|
472
|
-
case i.Json: return /* @__PURE__ */
|
|
498
|
+
case i.Json: return /* @__PURE__ */ L("div", {
|
|
473
499
|
dir: "ltr",
|
|
474
500
|
className: "h-full overflow-auto",
|
|
475
|
-
children: /* @__PURE__ */
|
|
476
|
-
className: m("m-3 overflow-auto rounded-md border",
|
|
477
|
-
children: /* @__PURE__ */
|
|
501
|
+
children: /* @__PURE__ */ L("div", {
|
|
502
|
+
className: m("m-3 overflow-auto rounded-md border", K.jsonWrapper),
|
|
503
|
+
children: /* @__PURE__ */ L(ae, {
|
|
478
504
|
data: t.value,
|
|
479
505
|
style: {
|
|
480
|
-
container: m("whitespace-pre-wrap break-words p-2",
|
|
481
|
-
basicChildStyle:
|
|
506
|
+
container: m("whitespace-pre-wrap break-words p-2", H?.jsonClassName ?? "dial-code-text"),
|
|
507
|
+
basicChildStyle: oe.basicChildStyle,
|
|
482
508
|
childFieldsContainer: "m-0 ps-3",
|
|
483
|
-
label: m("me-1 font-semibold",
|
|
484
|
-
clickableLabel: m("me-1 cursor-pointer font-semibold hover:underline",
|
|
485
|
-
nullValue: m("italic",
|
|
486
|
-
undefinedValue: m("italic",
|
|
487
|
-
stringValue:
|
|
488
|
-
booleanValue:
|
|
489
|
-
numberValue:
|
|
490
|
-
otherValue: m("italic",
|
|
491
|
-
punctuation: m("me-1",
|
|
492
|
-
collapseIcon: m("me-1 cursor-pointer select-none transition-colors",
|
|
493
|
-
expandIcon: m("me-1 cursor-pointer select-none transition-colors",
|
|
494
|
-
collapsedContent: m("me-1 cursor-pointer rounded px-1",
|
|
509
|
+
label: m("me-1 font-semibold", K.jsonLabel),
|
|
510
|
+
clickableLabel: m("me-1 cursor-pointer font-semibold hover:underline", K.jsonClickableLabel),
|
|
511
|
+
nullValue: m("italic", K.jsonNullValue),
|
|
512
|
+
undefinedValue: m("italic", K.jsonNullValue),
|
|
513
|
+
stringValue: K.jsonStringValue,
|
|
514
|
+
booleanValue: K.jsonBooleanValue,
|
|
515
|
+
numberValue: K.jsonNumberValue,
|
|
516
|
+
otherValue: m("italic", K.jsonNullValue),
|
|
517
|
+
punctuation: m("me-1", K.jsonPunctuation),
|
|
518
|
+
collapseIcon: m("me-1 cursor-pointer select-none transition-colors", K.jsonCollapseIcon),
|
|
519
|
+
expandIcon: m("me-1 cursor-pointer select-none transition-colors", K.jsonExpandIcon),
|
|
520
|
+
collapsedContent: m("me-1 cursor-pointer rounded px-1", K.jsonCollapsedContent)
|
|
495
521
|
}
|
|
496
522
|
})
|
|
497
523
|
})
|
|
498
524
|
});
|
|
499
|
-
case i.Code: return /* @__PURE__ */
|
|
525
|
+
case i.Code: return /* @__PURE__ */ L(ue, {
|
|
500
526
|
content: t,
|
|
501
|
-
codeBlockTheme:
|
|
527
|
+
codeBlockTheme: F,
|
|
502
528
|
labels: {
|
|
503
|
-
loadingLabel:
|
|
504
|
-
errorLabel:
|
|
505
|
-
retryLabel:
|
|
529
|
+
loadingLabel: ee,
|
|
530
|
+
errorLabel: te,
|
|
531
|
+
retryLabel: re
|
|
506
532
|
}
|
|
507
533
|
});
|
|
508
|
-
case i.Html: return /* @__PURE__ */
|
|
534
|
+
case i.Html: return /* @__PURE__ */ L(fe, {
|
|
509
535
|
content: t,
|
|
510
536
|
labels: {
|
|
511
537
|
htmlFrameBlockedLabel: h,
|
|
@@ -513,61 +539,62 @@ var L = {
|
|
|
513
539
|
},
|
|
514
540
|
isSourceView: o,
|
|
515
541
|
title: r,
|
|
516
|
-
codeBlockTheme:
|
|
542
|
+
codeBlockTheme: F
|
|
517
543
|
});
|
|
518
|
-
case i.Pdf: return /* @__PURE__ */
|
|
519
|
-
retryKey:
|
|
520
|
-
onRetry:
|
|
544
|
+
case i.Pdf: return /* @__PURE__ */ L(a, {
|
|
545
|
+
retryKey: U,
|
|
546
|
+
onRetry: he,
|
|
521
547
|
labels: {
|
|
522
|
-
loadingLabel:
|
|
523
|
-
errorLabel:
|
|
524
|
-
retryLabel:
|
|
548
|
+
loadingLabel: S,
|
|
549
|
+
errorLabel: T,
|
|
550
|
+
retryLabel: E
|
|
525
551
|
},
|
|
526
|
-
children: /* @__PURE__ */
|
|
552
|
+
children: /* @__PURE__ */ L(me, {
|
|
527
553
|
fileName: r,
|
|
528
554
|
url: t.url,
|
|
529
555
|
highlights: t.highlights ?? [],
|
|
530
556
|
selectedHighlightId: t.selectedHighlightId,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
557
|
+
selectedPageNumber: t.page,
|
|
558
|
+
loadPdf: z,
|
|
559
|
+
hideHeader: B,
|
|
560
|
+
configurePdfWorker: ce,
|
|
534
561
|
labels: {
|
|
535
562
|
thumbnailsLabel: _,
|
|
536
|
-
showThumbnailsLabel:
|
|
537
|
-
hideThumbnailsLabel:
|
|
538
|
-
pageNumberLabel:
|
|
539
|
-
loadingLabel:
|
|
540
|
-
errorLabel:
|
|
541
|
-
retryLabel:
|
|
563
|
+
showThumbnailsLabel: v,
|
|
564
|
+
hideThumbnailsLabel: y,
|
|
565
|
+
pageNumberLabel: x,
|
|
566
|
+
loadingLabel: S,
|
|
567
|
+
errorLabel: T,
|
|
568
|
+
retryLabel: E
|
|
542
569
|
}
|
|
543
570
|
})
|
|
544
571
|
}, t.url);
|
|
545
|
-
case i.Ooxml: return /* @__PURE__ */
|
|
572
|
+
case i.Ooxml: return /* @__PURE__ */ L(ge, {
|
|
546
573
|
content: t,
|
|
547
574
|
fileName: r,
|
|
548
575
|
loadErrorLabel: l,
|
|
549
|
-
formulaLabel:
|
|
550
|
-
formulaLabelClassName:
|
|
576
|
+
formulaLabel: D,
|
|
577
|
+
formulaLabelClassName: H?.xlsxFormulaLabelClassName ?? "dial-italic-text"
|
|
551
578
|
});
|
|
552
|
-
case i.Visualizer: return /* @__PURE__ */
|
|
579
|
+
case i.Visualizer: return /* @__PURE__ */ L(_e, {
|
|
553
580
|
content: t,
|
|
554
581
|
errorLabel: p
|
|
555
582
|
});
|
|
556
|
-
case i.McpApp: return /* @__PURE__ */
|
|
557
|
-
case i.Unsupported: return /* @__PURE__ */
|
|
558
|
-
className: m("text-center",
|
|
583
|
+
case i.McpApp: return /* @__PURE__ */ L(pe, { content: t });
|
|
584
|
+
case i.Unsupported: return /* @__PURE__ */ L("p", {
|
|
585
|
+
className: m("text-center", K.statusLabel),
|
|
559
586
|
children: s
|
|
560
587
|
});
|
|
561
588
|
case i.Error: {
|
|
562
589
|
let n = t.errorType === e.Forbidden;
|
|
563
|
-
return /* @__PURE__ */
|
|
590
|
+
return /* @__PURE__ */ R("div", {
|
|
564
591
|
className: "flex flex-col items-center gap-2",
|
|
565
|
-
children: [
|
|
592
|
+
children: [L(n ? ne : w, {
|
|
566
593
|
size: 60,
|
|
567
|
-
stroke:
|
|
568
|
-
className:
|
|
569
|
-
}), /* @__PURE__ */
|
|
570
|
-
className: m("text-center",
|
|
594
|
+
stroke: b,
|
|
595
|
+
className: K.errorIcon
|
|
596
|
+
}), /* @__PURE__ */ L("p", {
|
|
597
|
+
className: m("text-center", K.statusLabel),
|
|
571
598
|
children: n ? u : l
|
|
572
599
|
})]
|
|
573
600
|
});
|
|
@@ -575,11 +602,11 @@ var L = {
|
|
|
575
602
|
}
|
|
576
603
|
}, [
|
|
577
604
|
t,
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
605
|
+
H?.fontClassName,
|
|
606
|
+
H?.jsonClassName,
|
|
607
|
+
H?.xlsxFormulaLabelClassName,
|
|
581
608
|
r,
|
|
582
|
-
|
|
609
|
+
F,
|
|
583
610
|
s,
|
|
584
611
|
l,
|
|
585
612
|
u,
|
|
@@ -587,48 +614,54 @@ var L = {
|
|
|
587
614
|
h,
|
|
588
615
|
g,
|
|
589
616
|
o,
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
617
|
+
se,
|
|
618
|
+
z,
|
|
619
|
+
B,
|
|
620
|
+
ce,
|
|
593
621
|
_,
|
|
594
|
-
ee,
|
|
595
622
|
v,
|
|
596
|
-
|
|
623
|
+
y,
|
|
597
624
|
x,
|
|
598
|
-
|
|
625
|
+
S,
|
|
626
|
+
T,
|
|
627
|
+
E,
|
|
628
|
+
D,
|
|
629
|
+
ee,
|
|
599
630
|
te,
|
|
600
|
-
ne,
|
|
601
631
|
re,
|
|
632
|
+
me,
|
|
633
|
+
U,
|
|
634
|
+
he,
|
|
602
635
|
ie,
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
636
|
+
O,
|
|
637
|
+
k,
|
|
638
|
+
A,
|
|
639
|
+
M
|
|
607
640
|
]);
|
|
608
|
-
return /* @__PURE__ */
|
|
609
|
-
style: !n &&
|
|
610
|
-
className: m(n ? "flex h-full items-center justify-center" :
|
|
611
|
-
children: n ? /* @__PURE__ */
|
|
641
|
+
return /* @__PURE__ */ L("div", {
|
|
642
|
+
style: !n && be.has(t.type) ? xe : void 0,
|
|
643
|
+
className: m(n ? "flex h-full items-center justify-center" : Se, le),
|
|
644
|
+
children: n ? /* @__PURE__ */ L(C, {}) : Ce
|
|
612
645
|
});
|
|
613
|
-
}),
|
|
614
|
-
let [
|
|
615
|
-
|
|
616
|
-
}, [
|
|
617
|
-
|
|
618
|
-
}, [
|
|
619
|
-
|
|
620
|
-
}, [
|
|
621
|
-
|
|
622
|
-
|
|
646
|
+
}), Se = 2e3, Ce = A(({ isOpen: e, isLoading: t = !1, onClose: n, content: a, fileName: o, labels: { ariaLabel: s, closeLabel: c = "Close", downloadLabel: l = "Download", copyTextLabel: u = "Copy text", copiedTextLabel: d = "Copied!", copyMarkdownLabel: f = "Copy as Markdown", copiedMarkdownLabel: p = "Copied!", copyJsonLabel: h = "Copy as JSON", copiedJsonLabel: g = "Copied!", visualizerErrorLabel: S, unsupportedLabel: C = "Preview is not supported for this file", loadErrorLabel: w = "Failed to load file", forbiddenErrorLabel: ne = "You don't have permission to access this file", htmlFrameBlockedLabel: O = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: k = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: M = "View rendered", mcpAppReloadLabel: P = "Reload", pdfThumbnailsLabel: ae, pdfShowThumbnailsLabel: oe, pdfHideThumbnailsLabel: z, pdfPageNumberLabel: B, pdfContentLoadingLabel: ce, pdfContentErrorLabel: V, pdfContentRetryLabel: H, xlsxFormulaLabel: le, codeContentLoadingLabel: ue, codeContentErrorLabel: de, codeContentRetryLabel: fe, tableCopyCsvLabel: U, tableCopyTxtLabel: pe, tableCopyMarkdownLabel: W, tableCopiedLabel: me, tableDownloadCsvLabel: he }, onDownload: ge, onCopyText: G, onCopyMarkdown: _e, onCopyJson: K, tableDownloadFilename: ve, isMobile: ye = !1, defaultWidth: be, minWidth: Ce = 600, maxWidth: we = 1500, onResizeStop: Te, styles: Ee, codeBlockTheme: De, loadPdf: Oe, configurePdfWorker: ke }) => {
|
|
647
|
+
let [Ae, q] = I(!1), [je, Me] = I(!1), [Ne, Pe] = I(!1), [J, Fe] = I(!1), Y = F(null), X = F(null), Z = F(null), Ie = j(() => {
|
|
648
|
+
G?.(), Y.current != null && clearTimeout(Y.current), q(!0), Y.current = setTimeout(() => q(!1), Se);
|
|
649
|
+
}, [G]), Le = j(() => {
|
|
650
|
+
_e?.(), X.current != null && clearTimeout(X.current), Me(!0), X.current = setTimeout(() => Me(!1), Se);
|
|
651
|
+
}, [_e]), Q = j(() => {
|
|
652
|
+
K?.(), Z.current != null && clearTimeout(Z.current), Pe(!0), Z.current = setTimeout(() => Pe(!1), Se);
|
|
653
|
+
}, [K]);
|
|
654
|
+
N(() => () => {
|
|
655
|
+
Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
|
|
623
656
|
}, []);
|
|
624
|
-
let
|
|
625
|
-
|
|
657
|
+
let Re = j(() => {
|
|
658
|
+
Fe((e) => !e);
|
|
626
659
|
}, []);
|
|
627
|
-
|
|
628
|
-
|
|
660
|
+
N(() => {
|
|
661
|
+
Fe(!1);
|
|
629
662
|
}, [a]);
|
|
630
|
-
let { className:
|
|
631
|
-
return /* @__PURE__ */
|
|
663
|
+
let { className: ze, panelStyles: $, ...Be } = Ee ?? {}, Ve = !t && a.type === i.Html && a.srcdoc != null, He = !t && G != null && (a.type === i.PlainText || a.type === i.Code), Ue = !t && _e != null && a.type === i.Markdown, We = !t && K != null && a.type === i.Json, Ge = !t && ge != null && r(a), Ke = !t && a.type === i.McpApp && a.onReload != null;
|
|
664
|
+
return /* @__PURE__ */ L(v, {
|
|
632
665
|
isOpen: e,
|
|
633
666
|
orientation: _.Right,
|
|
634
667
|
title: o,
|
|
@@ -637,129 +670,135 @@ var L = {
|
|
|
637
670
|
closeLabel: c
|
|
638
671
|
},
|
|
639
672
|
onClose: n,
|
|
640
|
-
resizable: !
|
|
641
|
-
defaultWidth:
|
|
642
|
-
minWidth:
|
|
643
|
-
maxWidth:
|
|
644
|
-
onResizeStop:
|
|
673
|
+
resizable: !ye,
|
|
674
|
+
defaultWidth: be,
|
|
675
|
+
minWidth: Ce,
|
|
676
|
+
maxWidth: we,
|
|
677
|
+
onResizeStop: Te,
|
|
645
678
|
styles: {
|
|
646
|
-
|
|
647
|
-
titleClassName:
|
|
648
|
-
headerClassName: m("border-b border-tertiary",
|
|
649
|
-
className: m(e ? "mobile:w-full mobile:max-w-full" : "w-0",
|
|
679
|
+
...$,
|
|
680
|
+
titleClassName: $?.titleClassName ?? "dial-h3-text",
|
|
681
|
+
headerClassName: m("border-b border-tertiary", $?.headerClassName),
|
|
682
|
+
className: m(e ? "mobile:w-full mobile:max-w-full" : "w-0", ze, $?.className)
|
|
650
683
|
},
|
|
651
|
-
rightActions:
|
|
652
|
-
|
|
653
|
-
icon: /* @__PURE__ */
|
|
654
|
-
size:
|
|
655
|
-
stroke:
|
|
684
|
+
rightActions: Ve || He || Ue || We || Ge || Ke ? /* @__PURE__ */ R(se, { children: [
|
|
685
|
+
Ke && /* @__PURE__ */ L(x, {
|
|
686
|
+
icon: /* @__PURE__ */ L(ie, {
|
|
687
|
+
size: y.LG,
|
|
688
|
+
stroke: b,
|
|
656
689
|
"aria-hidden": !0
|
|
657
690
|
}),
|
|
658
|
-
"aria-label":
|
|
659
|
-
tooltipProps: { tooltip:
|
|
691
|
+
"aria-label": P,
|
|
692
|
+
tooltipProps: { tooltip: P },
|
|
660
693
|
onClick: a.type === i.McpApp ? a.onReload : void 0
|
|
661
694
|
}),
|
|
662
|
-
|
|
663
|
-
icon:
|
|
664
|
-
size:
|
|
665
|
-
stroke:
|
|
695
|
+
Ve && /* @__PURE__ */ L(x, {
|
|
696
|
+
icon: L(J ? te : E, {
|
|
697
|
+
size: y.LG,
|
|
698
|
+
stroke: b,
|
|
666
699
|
"aria-hidden": !0
|
|
667
700
|
}),
|
|
668
|
-
"aria-label":
|
|
669
|
-
"aria-pressed":
|
|
670
|
-
tooltipProps: { tooltip:
|
|
671
|
-
onClick:
|
|
701
|
+
"aria-label": J ? M : A,
|
|
702
|
+
"aria-pressed": J,
|
|
703
|
+
tooltipProps: { tooltip: J ? M : A },
|
|
704
|
+
onClick: Re
|
|
672
705
|
}),
|
|
673
|
-
|
|
674
|
-
icon:
|
|
675
|
-
size:
|
|
676
|
-
stroke:
|
|
706
|
+
He && /* @__PURE__ */ L(x, {
|
|
707
|
+
icon: L(Ae ? T : D, {
|
|
708
|
+
size: y.LG,
|
|
709
|
+
stroke: b,
|
|
677
710
|
"aria-hidden": !0
|
|
678
711
|
}),
|
|
679
|
-
"aria-label":
|
|
680
|
-
tooltipProps: { tooltip:
|
|
681
|
-
onClick:
|
|
712
|
+
"aria-label": Ae ? d : u,
|
|
713
|
+
tooltipProps: { tooltip: Ae ? d : u },
|
|
714
|
+
onClick: Ie
|
|
682
715
|
}),
|
|
683
|
-
|
|
684
|
-
icon:
|
|
685
|
-
size:
|
|
686
|
-
stroke:
|
|
716
|
+
Ue && /* @__PURE__ */ L(x, {
|
|
717
|
+
icon: L(je ? T : re, {
|
|
718
|
+
size: y.LG,
|
|
719
|
+
stroke: b,
|
|
687
720
|
"aria-hidden": !0
|
|
688
721
|
}),
|
|
689
|
-
"aria-label":
|
|
690
|
-
tooltipProps: { tooltip:
|
|
691
|
-
onClick:
|
|
722
|
+
"aria-label": je ? p : f,
|
|
723
|
+
tooltipProps: { tooltip: je ? p : f },
|
|
724
|
+
onClick: Le
|
|
692
725
|
}),
|
|
693
|
-
|
|
694
|
-
icon:
|
|
695
|
-
size:
|
|
696
|
-
stroke:
|
|
726
|
+
We && /* @__PURE__ */ L(x, {
|
|
727
|
+
icon: L(Ne ? T : D, {
|
|
728
|
+
size: y.LG,
|
|
729
|
+
stroke: b,
|
|
697
730
|
"aria-hidden": !0
|
|
698
731
|
}),
|
|
699
|
-
"aria-label":
|
|
700
|
-
tooltipProps: { tooltip:
|
|
701
|
-
onClick:
|
|
732
|
+
"aria-label": Ne ? g : h,
|
|
733
|
+
tooltipProps: { tooltip: Ne ? g : h },
|
|
734
|
+
onClick: Q
|
|
702
735
|
}),
|
|
703
|
-
|
|
704
|
-
icon: /* @__PURE__ */
|
|
705
|
-
size:
|
|
706
|
-
stroke:
|
|
736
|
+
Ge && /* @__PURE__ */ L(x, {
|
|
737
|
+
icon: /* @__PURE__ */ L(ee, {
|
|
738
|
+
size: y.LG,
|
|
739
|
+
stroke: b
|
|
707
740
|
}),
|
|
708
741
|
"aria-label": l,
|
|
709
742
|
tooltipProps: { tooltip: l },
|
|
710
|
-
onClick:
|
|
743
|
+
onClick: ge
|
|
711
744
|
})
|
|
712
745
|
] }) : null,
|
|
713
|
-
children: /* @__PURE__ */
|
|
746
|
+
children: /* @__PURE__ */ L(xe, {
|
|
714
747
|
content: a,
|
|
715
748
|
isLoading: t,
|
|
716
749
|
fileName: o,
|
|
717
|
-
isHtmlSourceView:
|
|
750
|
+
isHtmlSourceView: J,
|
|
718
751
|
labels: {
|
|
719
|
-
unsupportedLabel:
|
|
720
|
-
loadErrorLabel:
|
|
721
|
-
forbiddenErrorLabel:
|
|
722
|
-
visualizerErrorLabel:
|
|
723
|
-
htmlFrameBlockedLabel:
|
|
724
|
-
htmlOpenInNewTabLabel:
|
|
725
|
-
pdfThumbnailsLabel:
|
|
726
|
-
pdfShowThumbnailsLabel:
|
|
727
|
-
pdfHideThumbnailsLabel:
|
|
728
|
-
pdfPageNumberLabel:
|
|
729
|
-
pdfContentLoadingLabel:
|
|
730
|
-
pdfContentErrorLabel:
|
|
731
|
-
pdfContentRetryLabel:
|
|
732
|
-
xlsxFormulaLabel:
|
|
733
|
-
codeContentLoadingLabel:
|
|
734
|
-
codeContentErrorLabel:
|
|
735
|
-
codeContentRetryLabel:
|
|
752
|
+
unsupportedLabel: C,
|
|
753
|
+
loadErrorLabel: w,
|
|
754
|
+
forbiddenErrorLabel: ne,
|
|
755
|
+
visualizerErrorLabel: S,
|
|
756
|
+
htmlFrameBlockedLabel: O,
|
|
757
|
+
htmlOpenInNewTabLabel: k,
|
|
758
|
+
pdfThumbnailsLabel: ae,
|
|
759
|
+
pdfShowThumbnailsLabel: oe,
|
|
760
|
+
pdfHideThumbnailsLabel: z,
|
|
761
|
+
pdfPageNumberLabel: B,
|
|
762
|
+
pdfContentLoadingLabel: ce,
|
|
763
|
+
pdfContentErrorLabel: V,
|
|
764
|
+
pdfContentRetryLabel: H,
|
|
765
|
+
xlsxFormulaLabel: le,
|
|
766
|
+
codeContentLoadingLabel: ue,
|
|
767
|
+
codeContentErrorLabel: de,
|
|
768
|
+
codeContentRetryLabel: fe,
|
|
769
|
+
tableCopyCsvLabel: U,
|
|
770
|
+
tableCopyTxtLabel: pe,
|
|
771
|
+
tableCopyMarkdownLabel: W,
|
|
772
|
+
tableCopiedLabel: me,
|
|
773
|
+
tableDownloadCsvLabel: he
|
|
736
774
|
},
|
|
737
|
-
styles:
|
|
738
|
-
codeBlockTheme:
|
|
739
|
-
|
|
740
|
-
|
|
775
|
+
styles: Be,
|
|
776
|
+
codeBlockTheme: De,
|
|
777
|
+
tableDownloadFilename: ve,
|
|
778
|
+
loadPdf: Oe,
|
|
779
|
+
configurePdfWorker: ke
|
|
741
780
|
})
|
|
742
781
|
});
|
|
743
|
-
}),
|
|
782
|
+
}), we = {
|
|
744
783
|
type: i.PlainText,
|
|
745
784
|
text: ""
|
|
746
|
-
},
|
|
785
|
+
}, Te = (e) => {
|
|
747
786
|
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;
|
|
748
|
-
},
|
|
749
|
-
|
|
750
|
-
var
|
|
751
|
-
let [t, n] =
|
|
787
|
+
}, Ee = O(void 0);
|
|
788
|
+
Ee.displayName = "AttachmentCanvasContext";
|
|
789
|
+
var De = ({ children: e }) => {
|
|
790
|
+
let [t, n] = I(!1), [r, i] = I(!1), [a, o] = I(we), [s, c] = I(void 0), [l, u] = I(void 0), d = j((e, t) => {
|
|
752
791
|
c(e), u(t), i(!0), n(!0);
|
|
753
|
-
}, []), f =
|
|
792
|
+
}, []), f = j((e, t, r) => {
|
|
754
793
|
o(e), c(t), u(r), i(!1), n(!0);
|
|
755
|
-
}, []), p =
|
|
756
|
-
o(
|
|
794
|
+
}, []), p = j(() => {
|
|
795
|
+
o(we), n(!1), i(!1), u(void 0);
|
|
757
796
|
}, []);
|
|
758
|
-
return
|
|
759
|
-
let e =
|
|
797
|
+
return N(() => () => {
|
|
798
|
+
let e = Te(a);
|
|
760
799
|
e != null && URL.revokeObjectURL(e);
|
|
761
|
-
}, [a]), /* @__PURE__ */
|
|
762
|
-
value:
|
|
800
|
+
}, [a]), /* @__PURE__ */ L(Ee.Provider, {
|
|
801
|
+
value: P(() => ({
|
|
763
802
|
isOpen: t,
|
|
764
803
|
isLoading: r,
|
|
765
804
|
content: a,
|
|
@@ -780,102 +819,108 @@ var ke = ({ children: e }) => {
|
|
|
780
819
|
]),
|
|
781
820
|
children: e
|
|
782
821
|
});
|
|
783
|
-
},
|
|
784
|
-
let e =
|
|
822
|
+
}, Oe = () => {
|
|
823
|
+
let e = M(Ee);
|
|
785
824
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
786
825
|
return e;
|
|
787
|
-
},
|
|
788
|
-
let { ariaLabel:
|
|
789
|
-
t(
|
|
790
|
-
}, [
|
|
791
|
-
(
|
|
792
|
-
}, [
|
|
793
|
-
|
|
794
|
-
}, [
|
|
795
|
-
|
|
796
|
-
}, [
|
|
797
|
-
return /* @__PURE__ */
|
|
798
|
-
isOpen:
|
|
799
|
-
isLoading:
|
|
800
|
-
onClose:
|
|
801
|
-
content:
|
|
802
|
-
fileName:
|
|
826
|
+
}, ke = A(({ labels: e, isMobile: n = !1, defaultWidth: r, maxWidth: a, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
|
|
827
|
+
let { ariaLabel: l = "Attachment preview", closeLabel: u = "Close", downloadLabel: d = "Download", unsupportedLabel: f = "Preview is not supported for this file", loadErrorLabel: m = "Failed to load file", forbiddenErrorLabel: h = "You don't have permission to access this file", copyTextLabel: g, copiedTextLabel: _, copyMarkdownLabel: v, copiedMarkdownLabel: y, copyJsonLabel: b, copiedJsonLabel: x, htmlFrameBlockedLabel: S, htmlOpenInNewTabLabel: C, htmlViewSourceLabel: w, htmlViewRenderedLabel: T, pdfThumbnailsLabel: E, pdfShowThumbnailsLabel: D, pdfHideThumbnailsLabel: ee, pdfPageNumberLabel: te, pdfContentLoadingLabel: ne, pdfContentErrorLabel: re, pdfContentRetryLabel: ie, xlsxFormulaLabel: O, codeContentLoadingLabel: k, codeContentErrorLabel: A, codeContentRetryLabel: M, tableCopyCsvLabel: N, tableCopyTxtLabel: P, tableCopyMarkdownLabel: F, tableCopiedLabel: I, tableDownloadCsvLabel: ae } = e ?? {}, { isOpen: oe, isLoading: se, content: R, fileName: z, closeCanvas: B } = Oe(), ce = j(() => {
|
|
828
|
+
t(R, z);
|
|
829
|
+
}, [R, z]), V = j(() => {
|
|
830
|
+
(R.type === i.PlainText || R.type === i.Code) && p(R.text);
|
|
831
|
+
}, [R]), H = j(() => {
|
|
832
|
+
R.type === i.Markdown && p(R.text);
|
|
833
|
+
}, [R]), le = j(() => {
|
|
834
|
+
R.type === i.Json && p(JSON.stringify(R.value, null, 2));
|
|
835
|
+
}, [R]);
|
|
836
|
+
return /* @__PURE__ */ L(Ce, {
|
|
837
|
+
isOpen: oe,
|
|
838
|
+
isLoading: se,
|
|
839
|
+
onClose: B,
|
|
840
|
+
content: R,
|
|
841
|
+
fileName: z,
|
|
803
842
|
labels: {
|
|
804
|
-
ariaLabel:
|
|
805
|
-
closeLabel:
|
|
806
|
-
downloadLabel:
|
|
807
|
-
copyTextLabel:
|
|
808
|
-
copiedTextLabel:
|
|
809
|
-
copyMarkdownLabel:
|
|
810
|
-
copiedMarkdownLabel:
|
|
811
|
-
copyJsonLabel:
|
|
812
|
-
copiedJsonLabel:
|
|
813
|
-
unsupportedLabel:
|
|
814
|
-
loadErrorLabel:
|
|
815
|
-
forbiddenErrorLabel:
|
|
816
|
-
htmlFrameBlockedLabel:
|
|
817
|
-
htmlOpenInNewTabLabel:
|
|
818
|
-
htmlViewSourceLabel:
|
|
819
|
-
htmlViewRenderedLabel:
|
|
820
|
-
pdfThumbnailsLabel:
|
|
821
|
-
pdfShowThumbnailsLabel:
|
|
822
|
-
pdfHideThumbnailsLabel:
|
|
823
|
-
pdfPageNumberLabel:
|
|
824
|
-
pdfContentLoadingLabel:
|
|
825
|
-
pdfContentErrorLabel:
|
|
826
|
-
pdfContentRetryLabel:
|
|
827
|
-
xlsxFormulaLabel:
|
|
828
|
-
codeContentLoadingLabel:
|
|
829
|
-
codeContentErrorLabel:
|
|
830
|
-
codeContentRetryLabel:
|
|
843
|
+
ariaLabel: l,
|
|
844
|
+
closeLabel: u,
|
|
845
|
+
downloadLabel: d,
|
|
846
|
+
copyTextLabel: g,
|
|
847
|
+
copiedTextLabel: _,
|
|
848
|
+
copyMarkdownLabel: v,
|
|
849
|
+
copiedMarkdownLabel: y,
|
|
850
|
+
copyJsonLabel: b,
|
|
851
|
+
copiedJsonLabel: x,
|
|
852
|
+
unsupportedLabel: f,
|
|
853
|
+
loadErrorLabel: m,
|
|
854
|
+
forbiddenErrorLabel: h,
|
|
855
|
+
htmlFrameBlockedLabel: S,
|
|
856
|
+
htmlOpenInNewTabLabel: C,
|
|
857
|
+
htmlViewSourceLabel: w,
|
|
858
|
+
htmlViewRenderedLabel: T,
|
|
859
|
+
pdfThumbnailsLabel: E,
|
|
860
|
+
pdfShowThumbnailsLabel: D,
|
|
861
|
+
pdfHideThumbnailsLabel: ee,
|
|
862
|
+
pdfPageNumberLabel: te,
|
|
863
|
+
pdfContentLoadingLabel: ne,
|
|
864
|
+
pdfContentErrorLabel: re,
|
|
865
|
+
pdfContentRetryLabel: ie,
|
|
866
|
+
xlsxFormulaLabel: O,
|
|
867
|
+
codeContentLoadingLabel: k,
|
|
868
|
+
codeContentErrorLabel: A,
|
|
869
|
+
codeContentRetryLabel: M,
|
|
870
|
+
tableCopyCsvLabel: N,
|
|
871
|
+
tableCopyTxtLabel: P,
|
|
872
|
+
tableCopyMarkdownLabel: F,
|
|
873
|
+
tableCopiedLabel: I,
|
|
874
|
+
tableDownloadCsvLabel: ae
|
|
831
875
|
},
|
|
832
876
|
onDownload: ce,
|
|
833
|
-
onCopyText:
|
|
834
|
-
onCopyMarkdown:
|
|
835
|
-
onCopyJson:
|
|
877
|
+
onCopyText: R.type === i.PlainText || R.type === i.Code ? V : void 0,
|
|
878
|
+
onCopyMarkdown: R.type === i.Markdown ? H : void 0,
|
|
879
|
+
onCopyJson: R.type === i.Json ? le : void 0,
|
|
880
|
+
tableDownloadFilename: s,
|
|
836
881
|
isMobile: n,
|
|
837
882
|
defaultWidth: r,
|
|
838
883
|
maxWidth: a,
|
|
839
884
|
codeBlockTheme: o,
|
|
840
|
-
configurePdfWorker:
|
|
885
|
+
configurePdfWorker: c
|
|
841
886
|
});
|
|
842
|
-
}),
|
|
887
|
+
}), Ae = new Set(["html", "htm"]), q = {
|
|
843
888
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
844
889
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
845
890
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
846
|
-
},
|
|
891
|
+
}, je = 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(".")), Me = {
|
|
847
892
|
docx: n.Docx,
|
|
848
893
|
xlsx: n.Xlsx,
|
|
849
894
|
pptx: n.Pptx,
|
|
850
895
|
csv: n.Csv
|
|
851
|
-
},
|
|
896
|
+
}, Ne = {
|
|
852
897
|
[q.docx]: n.Docx,
|
|
853
898
|
[q.xlsx]: n.Xlsx,
|
|
854
899
|
[q.pptx]: n.Pptx,
|
|
855
900
|
[u.CSV]: n.Csv
|
|
856
|
-
},
|
|
901
|
+
}, Pe = {
|
|
857
902
|
[n.Docx]: q.docx,
|
|
858
903
|
[n.Xlsx]: q.xlsx,
|
|
859
904
|
[n.Pptx]: q.pptx,
|
|
860
905
|
[n.Csv]: u.CSV
|
|
861
|
-
},
|
|
906
|
+
}, J = (e, t) => {
|
|
862
907
|
let n = t?.split(";", 1)[0].trim().toLowerCase();
|
|
863
908
|
if (n != null) {
|
|
864
|
-
let e =
|
|
909
|
+
let e = Ne[n];
|
|
865
910
|
if (e != null) return e;
|
|
866
911
|
}
|
|
867
912
|
let r = e.lastIndexOf(".");
|
|
868
|
-
if (r !== -1) return
|
|
869
|
-
},
|
|
870
|
-
let n =
|
|
871
|
-
return n == null ? void 0 :
|
|
872
|
-
},
|
|
913
|
+
if (r !== -1) return Me[e.slice(r + 1).toLowerCase()];
|
|
914
|
+
}, Fe = (e, t) => J(e, t) != null, Y = (e, t) => {
|
|
915
|
+
let n = J(e, t);
|
|
916
|
+
return n == null ? void 0 : Pe[n];
|
|
917
|
+
}, X = (e) => {
|
|
873
918
|
let t = e.lastIndexOf(".");
|
|
874
|
-
return t === -1 ? !1 :
|
|
875
|
-
},
|
|
919
|
+
return t === -1 ? !1 : je.has(e.slice(t + 1).toLowerCase());
|
|
920
|
+
}, Z = (e) => {
|
|
876
921
|
let t = e.lastIndexOf(".");
|
|
877
|
-
return t === -1 ? !1 :
|
|
878
|
-
},
|
|
922
|
+
return t === -1 ? !1 : Ae.has(e.slice(t + 1).toLowerCase());
|
|
923
|
+
}, Ie = {
|
|
879
924
|
xml: "xml",
|
|
880
925
|
csv: "plaintext",
|
|
881
926
|
tsv: "plaintext",
|
|
@@ -923,18 +968,18 @@ var ke = ({ children: e }) => {
|
|
|
923
968
|
gitignore: "plaintext",
|
|
924
969
|
dockerfile: "plaintext",
|
|
925
970
|
makefile: "plaintext"
|
|
926
|
-
},
|
|
971
|
+
}, Le = (e) => Ie[e], Q = (e) => ({
|
|
927
972
|
type: i.Unsupported,
|
|
928
973
|
...e != null && { url: e }
|
|
929
|
-
}),
|
|
974
|
+
}), Re = (t) => ({
|
|
930
975
|
type: i.Error,
|
|
931
976
|
errorType: e.LoadFailed,
|
|
932
977
|
...t != null && { url: t }
|
|
933
|
-
}),
|
|
978
|
+
}), ze = (t) => ({
|
|
934
979
|
type: i.Error,
|
|
935
980
|
errorType: e.Forbidden,
|
|
936
981
|
...t != null && { url: t }
|
|
937
|
-
}),
|
|
982
|
+
}), $ = (e, t) => {
|
|
938
983
|
let n = e.toLowerCase();
|
|
939
984
|
return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
|
|
940
985
|
}, Be = (e) => {
|
|
@@ -951,12 +996,12 @@ var ke = ({ children: e }) => {
|
|
|
951
996
|
return n;
|
|
952
997
|
}
|
|
953
998
|
}, Ve = (e, t) => {
|
|
954
|
-
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } =
|
|
999
|
+
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = Oe(), { customVisualizers: s, themeId: c, onBeforeOpen: d } = t, f = j(async (t, r) => {
|
|
955
1000
|
if (t.url == null && t.referenceUrl != null) {
|
|
956
1001
|
let i = e.resolveReferencePdfContent(t);
|
|
957
1002
|
if (i != null) return n(i, t.name, r), !0;
|
|
958
1003
|
}
|
|
959
|
-
let a = t.contentType.toLowerCase(), o =
|
|
1004
|
+
let a = t.contentType.toLowerCase(), o = $(a, s);
|
|
960
1005
|
if (o != null) {
|
|
961
1006
|
let i = await e.resolveVisualizerContent(t, o, c);
|
|
962
1007
|
if (i != null) return n(i, t.name, r), !0;
|
|
@@ -965,15 +1010,15 @@ var ke = ({ children: e }) => {
|
|
|
965
1010
|
let i = await e.resolveTextContent(t);
|
|
966
1011
|
if (i != null) return n(i, t.name, r), !0;
|
|
967
1012
|
}
|
|
968
|
-
let d =
|
|
969
|
-
if (d != null) return n(await e.resolveOoxmlContent(t, d) ??
|
|
1013
|
+
let d = J("", a);
|
|
1014
|
+
if (d != null) return n(await e.resolveOoxmlContent(t, d) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
|
|
970
1015
|
switch (a) {
|
|
971
|
-
case u.PDF: return n(await e.resolvePdfContent(t) ??
|
|
972
|
-
case u.Markdown: return n(await e.resolveMarkdownContent(t) ??
|
|
973
|
-
case u.JSON: return n(await e.resolveJsonContent(t) ??
|
|
1016
|
+
case u.PDF: return n(await e.resolvePdfContent(t) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
|
|
1017
|
+
case u.Markdown: return n(await e.resolveMarkdownContent(t) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
|
|
1018
|
+
case u.JSON: return n(await e.resolveJsonContent(t) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
|
|
974
1019
|
}
|
|
975
|
-
let f = t.name ?? "", p = f.lastIndexOf("."), m = p === -1 ? "" : f.slice(p + 1).toLowerCase(), h =
|
|
976
|
-
if (h != null) return n(await e.resolveOoxmlContent(t, h) ??
|
|
1020
|
+
let f = t.name ?? "", p = f.lastIndexOf("."), m = p === -1 ? "" : f.slice(p + 1).toLowerCase(), h = J(f);
|
|
1021
|
+
if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? Q(e.resolveContentUrl(t)), t.name, r), !0;
|
|
977
1022
|
switch (m) {
|
|
978
1023
|
case l.Markdown:
|
|
979
1024
|
case l.MarkdownAlt: {
|
|
@@ -989,16 +1034,16 @@ var ke = ({ children: e }) => {
|
|
|
989
1034
|
return i == null ? !1 : (n(i, t.name, r), !0);
|
|
990
1035
|
}
|
|
991
1036
|
}
|
|
992
|
-
let g = t.name != null &&
|
|
993
|
-
if (t.name != null && !
|
|
1037
|
+
let g = t.name != null && Z(t.name) || t.url != null && Z(Be(t.url));
|
|
1038
|
+
if (t.name != null && !X(t.name) && !g) return n(Q(e.resolveContentUrl(t)), t.name, r), !0;
|
|
994
1039
|
if (g) {
|
|
995
1040
|
let a = await e.resolveHtmlContent(t);
|
|
996
|
-
return a == null ? e.hasTextSource(t) ? (n(
|
|
1041
|
+
return a == null ? e.hasTextSource(t) ? (n(Q(e.resolveContentUrl(t)), t.name, r), !0) : t.url == null ? !1 : (n({
|
|
997
1042
|
type: i.Html,
|
|
998
1043
|
url: t.url
|
|
999
1044
|
}, t.name, r), !0) : (n(a, t.name, r), !0);
|
|
1000
1045
|
}
|
|
1001
|
-
let _ = await e.resolveCodeContent(t,
|
|
1046
|
+
let _ = await e.resolveCodeContent(t, Le(m));
|
|
1002
1047
|
return _ == null ? !1 : (n(_, t.name, r), !0);
|
|
1003
1048
|
}, [
|
|
1004
1049
|
n,
|
|
@@ -1006,7 +1051,7 @@ var ke = ({ children: e }) => {
|
|
|
1006
1051
|
c,
|
|
1007
1052
|
e
|
|
1008
1053
|
]);
|
|
1009
|
-
return { openAttachmentCanvas:
|
|
1054
|
+
return { openAttachmentCanvas: j(async (t, s = t.id) => {
|
|
1010
1055
|
switch (t.type) {
|
|
1011
1056
|
case o.Image: {
|
|
1012
1057
|
let r = e.resolveImageContent(t);
|
|
@@ -1043,4 +1088,4 @@ var ke = ({ children: e }) => {
|
|
|
1043
1088
|
]) };
|
|
1044
1089
|
};
|
|
1045
1090
|
//#endregion
|
|
1046
|
-
export {
|
|
1091
|
+
export { Ce as AttachmentCanvas, xe as AttachmentCanvasBody, ke as AttachmentCanvasContainer, De as AttachmentCanvasProvider, i as AttachmentContentType, e as AttachmentErrorType, ue as CodeContent, pe as McpAppCanvasRenderer, n as OoxmlFileType, ze as createForbiddenCanvasContent, Re as createLoadErrorCanvasContent, Q as createUnsupportedCanvasContent, t as downloadAttachmentContent, Le as extensionToLanguage, $ as findVisualizerForMime, J as getOoxmlFileType, Y as getOoxmlMimeType, r as isDownloadable, Z as isHtmlPreviewable, Fe as isOoxmlPreviewable, X as isTextPreviewable, Oe as useAttachmentCanvas, Ve as useOpenAttachmentCanvas };
|