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