@epam/ai-dial-attachment-canvas 1.4.0-dev.95 → 1.4.0-rc.0
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/McpAppCanvasRenderer-DXUdyMtZ.js +159 -0
- package/McpAppCanvasRenderer.css +1 -0
- package/PdfContent-DX6q6wTq.js +277 -0
- package/PdfContent.css +1 -1
- package/PdfLoadingSkeleton-tRSHLlMc.js +166 -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/PdfContent/PdfContent.d.ts.map +1 -1
- package/components/PdfLoadingSkeleton/PdfLoadingSkeleton.d.ts +3 -0
- package/components/PdfLoadingSkeleton/PdfLoadingSkeleton.d.ts.map +1 -0
- package/constants/pdf-loading-skeleton.d.ts +7 -0
- package/constants/pdf-loading-skeleton.d.ts.map +1 -0
- package/context/AttachmentCanvasContext.d.ts +5 -2
- package/context/AttachmentCanvasContext.d.ts.map +1 -1
- package/hooks/useOpenAttachmentCanvas/useOpenAttachmentCanvas.d.ts.map +1 -1
- package/index.css +2 -2
- package/index.js +776 -906
- package/mcp-app-renderer.d.ts +3 -0
- package/mcp-app-renderer.d.ts.map +1 -0
- package/mcp-app-renderer.js +1 -0
- package/models/attachment-canvas.d.ts +6 -2
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +12 -7
- package/utils/open-routing.d.ts +5 -0
- package/utils/open-routing.d.ts.map +1 -0
- package/LazyContentBoundary-ES0u-Jn7.js +0 -137
- package/PdfContent-BEWJ_9tn.js +0 -274
- /package/{LazyContentBoundary.css → PdfLoadingSkeleton.css} +0 -0
package/index.js
CHANGED
|
@@ -1,68 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[i.Ooxml]: Y,
|
|
30
|
-
[i.Visualizer]: Y,
|
|
31
|
-
[i.GroupedVisualizer]: Y,
|
|
32
|
-
[i.McpApp]: Y,
|
|
33
|
-
[i.Code]: Y,
|
|
34
|
-
[i.Html]: Y,
|
|
35
|
-
[i.Markdown]: "h-full overflow-auto",
|
|
36
|
-
[i.MarkdownTable]: "flex h-full min-h-0 flex-col overflow-hidden p-4"
|
|
1
|
+
import { t as e } from "./McpAppCanvasRenderer-DXUdyMtZ.js";
|
|
2
|
+
import { a as t, i as n, n as r, r as i, t as a } from "./attachment-canvas-BgwyzrRC.js";
|
|
3
|
+
import { a as o, n as s, s as c, t as l } from "./PdfLoadingSkeleton-tRSHLlMc.js";
|
|
4
|
+
import { AttachmentType as u, CodeBlockTheme as d, DEFAULT_MARKDOWN_CLASS_NAMES as f, FileExtension as p, MIMEType as m, MarkdownRenderer as h, buildCssVars as g, copyToClipboard as _, isSyntaxHighlightingAllowed as v, mergeClasses as y, restrainedSyntaxTheme as b, stripUrlQueryAndFragment as x } from "@epam/ai-dial-chat-shared";
|
|
5
|
+
import { SidebarOrientation as S, SidebarPanel as C } from "@epam/ai-dial-sidebar";
|
|
6
|
+
import { DIAL_ICON_SIZE as w, DIAL_KIT_ICON_STROKE as T, ElementSize as E, GhostButton as D, GhostIconButton as O, LinkButton as ee, LiveRegion as k, LiveRegionPoliteness as A, Spinner as te } from "@epam/ai-dial-ui-kit";
|
|
7
|
+
import { IconAlertTriangle as j, IconArrowsMaximize as ne, IconCheck as re, IconCode as ie, IconCopy as ae, IconDownload as oe, IconEye as se, IconLock as ce, IconMarkdown as le, IconRefresh as ue } from "@tabler/icons-react";
|
|
8
|
+
import { createContext as M, lazy as N, memo as P, useCallback as F, useContext as de, useEffect as I, useMemo as L, useRef as R, useState as z } from "react";
|
|
9
|
+
import { JsonView as fe, defaultStyles as pe } from "react-json-view-lite";
|
|
10
|
+
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
11
|
+
import { VisualizerConnector as me, VisualizerConnectorEvents as U, VisualizerConnectorRequests as he } from "@epam/ai-dial-visualizer-connector";
|
|
12
|
+
//#region src/constants/public-class-names.ts
|
|
13
|
+
var W = { panel: "dial-attachment-canvas-panel" }, G = "h-full overflow-auto p-4 flex items-center justify-center", K = "h-full overflow-hidden", ge = {
|
|
14
|
+
[a.PlainText]: "h-full overflow-auto p-4",
|
|
15
|
+
[a.Image]: G,
|
|
16
|
+
[a.Audio]: G,
|
|
17
|
+
[a.Unsupported]: G,
|
|
18
|
+
[a.Error]: G,
|
|
19
|
+
[a.Json]: "h-full overflow-auto",
|
|
20
|
+
[a.Pdf]: K,
|
|
21
|
+
[a.Ooxml]: K,
|
|
22
|
+
[a.Visualizer]: K,
|
|
23
|
+
[a.GroupedVisualizer]: K,
|
|
24
|
+
[a.McpApp]: K,
|
|
25
|
+
[a.Code]: K,
|
|
26
|
+
[a.Html]: K,
|
|
27
|
+
[a.Markdown]: "h-full overflow-auto",
|
|
28
|
+
[a.MarkdownTable]: "flex h-full min-h-0 flex-col overflow-hidden p-4"
|
|
37
29
|
}, _e = {
|
|
38
30
|
container: "_container_k7ib4_1",
|
|
39
31
|
containerLight: "_containerLight_k7ib4_5"
|
|
40
32
|
}, ve = {
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
}, ye = () =>
|
|
33
|
+
[d.Dark]: b,
|
|
34
|
+
[d.Light]: b
|
|
35
|
+
}, ye = () => N(async () => {
|
|
44
36
|
let { Prism: e } = await import("react-syntax-highlighter");
|
|
45
37
|
return { default: e };
|
|
46
|
-
}), be =
|
|
47
|
-
let { text: a, language: o } = e, c =
|
|
38
|
+
}), be = P(({ content: e, codeBlockTheme: t = d.Light, labels: n, codeClassName: r = "dial-code-text", errorLabelClassName: i }) => {
|
|
39
|
+
let { text: a, language: o } = e, c = L(() => v(a), [a]), l = o == null || o === "plaintext" || !c, u = ve[t], f = t === d.Light, [p, m] = z(0), h = L(ye, [p]), g = F(() => {
|
|
48
40
|
m((e) => e + 1);
|
|
49
|
-
}, []),
|
|
50
|
-
className:
|
|
41
|
+
}, []), _ = /* @__PURE__ */ V("pre", {
|
|
42
|
+
className: y(r, "p-4 wrap-break-word whitespace-pre-wrap"),
|
|
51
43
|
children: a
|
|
52
44
|
});
|
|
53
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ V("div", {
|
|
54
46
|
dir: "ltr",
|
|
55
|
-
className:
|
|
56
|
-
children:
|
|
47
|
+
className: y("h-full overflow-auto", _e.container, f && _e.containerLight),
|
|
48
|
+
children: l ? _ : /* @__PURE__ */ V(s, {
|
|
57
49
|
retryKey: p,
|
|
58
|
-
onRetry:
|
|
59
|
-
pendingContent:
|
|
60
|
-
errorContent:
|
|
50
|
+
onRetry: g,
|
|
51
|
+
pendingContent: _,
|
|
52
|
+
errorContent: _,
|
|
61
53
|
labels: n,
|
|
62
54
|
errorLabelClassName: i,
|
|
63
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ V(h, {
|
|
64
56
|
language: o,
|
|
65
|
-
style:
|
|
57
|
+
style: u,
|
|
66
58
|
customStyle: {
|
|
67
59
|
margin: 0,
|
|
68
60
|
borderRadius: 0,
|
|
@@ -76,8 +68,8 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
76
68
|
})
|
|
77
69
|
})
|
|
78
70
|
});
|
|
79
|
-
}), xe = "dial-html-preview:render",
|
|
80
|
-
let { htmlFrameBlockedLabel: c = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: l = "Open in new tab", loadingLabel: u = "Loading…" } = t, [d, f] =
|
|
71
|
+
}), xe = "dial-html-preview:render", q = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, Se = P(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: i, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text", codeClassName: s }) => {
|
|
72
|
+
let { htmlFrameBlockedLabel: c = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: l = "Open in new tab", loadingLabel: u = "Loading…" } = t, [d, f] = z(!0), [p, m] = z(!1), [h, g] = z(void 0), [_, v] = z(!1), [b, x] = z(!1), S = R(null), C = R(null), w = R(!1), T = R({
|
|
81
73
|
content: e,
|
|
82
74
|
generation: 0
|
|
83
75
|
});
|
|
@@ -86,22 +78,22 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
86
78
|
generation: T.current.generation + 1
|
|
87
79
|
});
|
|
88
80
|
let E = T.current.generation;
|
|
89
|
-
|
|
90
|
-
f(!0), m(!1), g(void 0),
|
|
81
|
+
I(() => {
|
|
82
|
+
f(!0), m(!1), g(void 0), v(!1), x(!1);
|
|
91
83
|
}, [e]);
|
|
92
|
-
let
|
|
93
|
-
|
|
84
|
+
let D = R(n);
|
|
85
|
+
D.current !== n && (D.current = n, n && b && x(!1), !n && w.current && (w.current = !1, f(!0))), I(() => {
|
|
94
86
|
if (!n || e.srcdoc != null || e.resolveSourceText == null || h != null) return;
|
|
95
87
|
let t = !1, r = e.resolveSourceText;
|
|
96
88
|
return (async () => {
|
|
97
|
-
|
|
89
|
+
v(!0);
|
|
98
90
|
try {
|
|
99
91
|
let e = await r();
|
|
100
92
|
t || g(e);
|
|
101
93
|
} catch {
|
|
102
94
|
t || x(!0);
|
|
103
95
|
} finally {
|
|
104
|
-
t ||
|
|
96
|
+
t || v(!1);
|
|
105
97
|
}
|
|
106
98
|
})(), () => {
|
|
107
99
|
t = !0;
|
|
@@ -111,69 +103,69 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
111
103
|
e,
|
|
112
104
|
h
|
|
113
105
|
]);
|
|
114
|
-
let
|
|
115
|
-
if (f(!1),
|
|
106
|
+
let O = e.isSameOriginUrl === !0 && e.url != null, k = !O && e.srcdoc != null, A = k ? e.srcdocHostUrl : void 0, j = e.srcdoc, ne = F((e) => {
|
|
107
|
+
if (f(!1), A != null) {
|
|
116
108
|
let e = S.current?.contentWindow;
|
|
117
|
-
e != null && e !== C.current &&
|
|
109
|
+
e != null && e !== C.current && j != null && (C.current = e, e.postMessage({
|
|
118
110
|
type: xe,
|
|
119
|
-
html:
|
|
111
|
+
html: j
|
|
120
112
|
}, "*"));
|
|
121
|
-
} else if (!(
|
|
113
|
+
} else if (!(k || O)) try {
|
|
122
114
|
S.current?.contentDocument ?? m(!0);
|
|
123
115
|
} catch {
|
|
124
116
|
m(!0);
|
|
125
117
|
}
|
|
126
118
|
}, [
|
|
127
|
-
j,
|
|
128
119
|
k,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
120
|
+
O,
|
|
121
|
+
A,
|
|
122
|
+
j
|
|
123
|
+
]), re = F(() => {
|
|
132
124
|
f(!1), m(!0);
|
|
133
|
-
}, []),
|
|
134
|
-
if (n &&
|
|
125
|
+
}, []), ie = e.srcdoc ?? h, ae = e.srcdoc != null || e.resolveSourceText != null, oe = e.srcdoc == null && e.resolveSourceText != null && h == null && !b;
|
|
126
|
+
if (n && ae && (ie != null || _ || oe)) return w.current = !0, ie == null ? /* @__PURE__ */ V("div", {
|
|
135
127
|
className: "flex h-full items-center justify-center",
|
|
136
|
-
children: /* @__PURE__ */
|
|
137
|
-
}) : /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ V(te, { ariaLabel: u })
|
|
129
|
+
}) : /* @__PURE__ */ V(be, {
|
|
138
130
|
content: {
|
|
139
|
-
type:
|
|
140
|
-
text:
|
|
131
|
+
type: a.Code,
|
|
132
|
+
text: ie,
|
|
141
133
|
language: "html"
|
|
142
134
|
},
|
|
143
|
-
codeBlockTheme:
|
|
135
|
+
codeBlockTheme: i,
|
|
144
136
|
codeClassName: s
|
|
145
137
|
});
|
|
146
|
-
if (p) return /* @__PURE__ */
|
|
138
|
+
if (p) return /* @__PURE__ */ H("div", {
|
|
147
139
|
className: "flex h-full flex-col items-center justify-center gap-3 p-4",
|
|
148
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ V("p", {
|
|
149
141
|
className: "text-center",
|
|
150
142
|
children: c
|
|
151
|
-
}), e.url != null && /* @__PURE__ */
|
|
143
|
+
}), e.url != null && /* @__PURE__ */ V(ee, {
|
|
152
144
|
href: e.url,
|
|
153
145
|
target: "_blank",
|
|
154
146
|
label: l,
|
|
155
|
-
className:
|
|
147
|
+
className: q.openInNewTabButton,
|
|
156
148
|
textClassName: o
|
|
157
149
|
})]
|
|
158
150
|
});
|
|
159
|
-
let
|
|
160
|
-
return /* @__PURE__ */
|
|
151
|
+
let se = k ? A : e.url, ce = k && A == null ? e.srcdoc : void 0;
|
|
152
|
+
return /* @__PURE__ */ H("div", {
|
|
161
153
|
className: "relative h-full",
|
|
162
|
-
children: [d && /* @__PURE__ */
|
|
154
|
+
children: [d && /* @__PURE__ */ V("div", {
|
|
163
155
|
className: "absolute inset-0 flex items-center justify-center",
|
|
164
|
-
children: /* @__PURE__ */
|
|
165
|
-
}), /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ V(te, { ariaLabel: u })
|
|
157
|
+
}), /* @__PURE__ */ V("iframe", {
|
|
166
158
|
ref: S,
|
|
167
159
|
title: r,
|
|
168
|
-
src:
|
|
169
|
-
srcDoc:
|
|
170
|
-
sandbox:
|
|
171
|
-
className:
|
|
172
|
-
onLoad:
|
|
173
|
-
onError:
|
|
160
|
+
src: se,
|
|
161
|
+
srcDoc: ce,
|
|
162
|
+
sandbox: k || O ? "allow-scripts" : "allow-scripts allow-same-origin",
|
|
163
|
+
className: y("h-full w-full border-none", d ? "invisible" : ""),
|
|
164
|
+
onLoad: ne,
|
|
165
|
+
onError: re
|
|
174
166
|
}, E)]
|
|
175
167
|
});
|
|
176
|
-
}),
|
|
168
|
+
}), J = {
|
|
177
169
|
viewer: "_viewer_gdafg_2",
|
|
178
170
|
spreadsheetCanvas: "_spreadsheetCanvas_gdafg_6",
|
|
179
171
|
formulaPanel: "_formulaPanel_gdafg_12",
|
|
@@ -181,15 +173,15 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
181
173
|
statusOverlay: "_statusOverlay_gdafg_27",
|
|
182
174
|
errorIcon: "_errorIcon_gdafg_32",
|
|
183
175
|
highlight: "_highlight_gdafg_40"
|
|
184
|
-
},
|
|
176
|
+
}, Ce = (e) => {
|
|
185
177
|
if (e?.kind !== "range") return "";
|
|
186
178
|
let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
|
|
187
179
|
if (n == null) return "";
|
|
188
180
|
let r = n.formula;
|
|
189
181
|
return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
|
|
190
|
-
},
|
|
182
|
+
}, we = async (e, t, { onError: n, onXlsxSelectionContextChange: r }) => {
|
|
191
183
|
switch (t) {
|
|
192
|
-
case
|
|
184
|
+
case i.Docx: {
|
|
193
185
|
let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/docx"), import("@silurus/ooxml/chart-ex")]);
|
|
194
186
|
return new t(e, {
|
|
195
187
|
enableTextSelection: !0,
|
|
@@ -198,18 +190,18 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
198
190
|
onError: n
|
|
199
191
|
});
|
|
200
192
|
}
|
|
201
|
-
case
|
|
202
|
-
let [{ XlsxViewer: t }, { chartEx:
|
|
193
|
+
case i.Xlsx: {
|
|
194
|
+
let [{ XlsxViewer: t }, { chartEx: i }] = await Promise.all([import("@silurus/ooxml/xlsx"), import("@silurus/ooxml/chart-ex")]);
|
|
203
195
|
return new t(e, {
|
|
204
196
|
showZoomSlider: !0,
|
|
205
|
-
chartEx:
|
|
197
|
+
chartEx: i,
|
|
206
198
|
onError: n,
|
|
207
|
-
onSelectionContextChange:
|
|
199
|
+
onSelectionContextChange: r
|
|
208
200
|
});
|
|
209
201
|
}
|
|
210
|
-
case
|
|
202
|
+
case i.Csv: {
|
|
211
203
|
let { XlsxSheetViewer: t } = await import("@silurus/ooxml/xlsx"), r = document.createElement("canvas");
|
|
212
|
-
r.className =
|
|
204
|
+
r.className = J.spreadsheetCanvas, e.replaceChildren(r);
|
|
213
205
|
let i = new t(r, {
|
|
214
206
|
showScrollbars: !0,
|
|
215
207
|
onError: n
|
|
@@ -223,7 +215,7 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
223
215
|
}
|
|
224
216
|
};
|
|
225
217
|
}
|
|
226
|
-
case
|
|
218
|
+
case i.Pptx: {
|
|
227
219
|
let [{ PptxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/pptx"), import("@silurus/ooxml/chart-ex")]);
|
|
228
220
|
return new t(e, {
|
|
229
221
|
enableTextSelection: !0,
|
|
@@ -233,17 +225,17 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
233
225
|
});
|
|
234
226
|
}
|
|
235
227
|
}
|
|
236
|
-
},
|
|
228
|
+
}, Te = async (e, t, n, r) => {
|
|
237
229
|
let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = n;
|
|
238
230
|
switch (t.format) {
|
|
239
|
-
case
|
|
240
|
-
let [{ DocxDocument: n, DocxScrollViewer:
|
|
231
|
+
case i.Docx: {
|
|
232
|
+
let [{ DocxDocument: n, DocxScrollViewer: i }, { chartEx: o }, { createDocxHighlightSurface: c }] = await Promise.all([
|
|
241
233
|
import("@silurus/ooxml/docx"),
|
|
242
234
|
import("@silurus/ooxml/chart-ex"),
|
|
243
235
|
import("./ooxml-highlight-surfaces-C18JJb0P.js")
|
|
244
236
|
]), l = await n.load(t.url, { chartEx: o });
|
|
245
|
-
if (
|
|
246
|
-
let u =
|
|
237
|
+
if (r()) throw l.destroy(), new Ee();
|
|
238
|
+
let u = i.fromDocument(e, l, {
|
|
247
239
|
enableTextSelection: !0,
|
|
248
240
|
refitOnResize: !0,
|
|
249
241
|
onError: a,
|
|
@@ -253,17 +245,17 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
253
245
|
return {
|
|
254
246
|
viewer: u,
|
|
255
247
|
engine: l,
|
|
256
|
-
highlights: c(e, l, u,
|
|
248
|
+
highlights: c(e, l, u, r)
|
|
257
249
|
};
|
|
258
250
|
}
|
|
259
|
-
case
|
|
260
|
-
let [{ PptxPresentation: n, PptxScrollViewer:
|
|
251
|
+
case i.Pptx: {
|
|
252
|
+
let [{ PptxPresentation: n, PptxScrollViewer: i }, { chartEx: o }, { createPptxHighlightSurface: c }] = await Promise.all([
|
|
261
253
|
import("@silurus/ooxml/pptx"),
|
|
262
254
|
import("@silurus/ooxml/chart-ex"),
|
|
263
255
|
import("./ooxml-highlight-surfaces-C18JJb0P.js")
|
|
264
256
|
]), l = await n.load(t.url, { chartEx: o });
|
|
265
|
-
if (
|
|
266
|
-
let u =
|
|
257
|
+
if (r()) throw l.destroy(), new Ee();
|
|
258
|
+
let u = i.fromPresentation(e, l, {
|
|
267
259
|
enableTextSelection: !0,
|
|
268
260
|
refitOnResize: !0,
|
|
269
261
|
onError: a,
|
|
@@ -273,17 +265,17 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
273
265
|
return {
|
|
274
266
|
viewer: u,
|
|
275
267
|
engine: l,
|
|
276
|
-
highlights: c(e, l, u,
|
|
268
|
+
highlights: c(e, l, u, r)
|
|
277
269
|
};
|
|
278
270
|
}
|
|
279
|
-
case
|
|
280
|
-
let [{ XlsxViewer: n }, { chartEx:
|
|
271
|
+
case i.Xlsx: {
|
|
272
|
+
let [{ XlsxViewer: n }, { chartEx: i }, { createXlsxHighlightSurface: c }] = await Promise.all([
|
|
281
273
|
import("@silurus/ooxml/xlsx"),
|
|
282
274
|
import("@silurus/ooxml/chart-ex"),
|
|
283
275
|
import("./ooxml-highlight-surfaces-C18JJb0P.js")
|
|
284
276
|
]), l = new n(e, {
|
|
285
277
|
showZoomSlider: !0,
|
|
286
|
-
chartEx:
|
|
278
|
+
chartEx: i,
|
|
287
279
|
onError: a,
|
|
288
280
|
onSelectionContextChange: o,
|
|
289
281
|
onViewportChange: s,
|
|
@@ -292,29 +284,29 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
292
284
|
});
|
|
293
285
|
return await l.load(t.url), {
|
|
294
286
|
viewer: l,
|
|
295
|
-
highlights: c(e, l,
|
|
287
|
+
highlights: c(e, l, r)
|
|
296
288
|
};
|
|
297
289
|
}
|
|
298
|
-
case
|
|
299
|
-
let r = await
|
|
290
|
+
case i.Csv: {
|
|
291
|
+
let r = await we(e, t.format, n);
|
|
300
292
|
return await r.load(t.url), { viewer: r };
|
|
301
293
|
}
|
|
302
294
|
}
|
|
303
|
-
},
|
|
304
|
-
let d =
|
|
305
|
-
|
|
306
|
-
let
|
|
307
|
-
return
|
|
308
|
-
let
|
|
309
|
-
if (
|
|
295
|
+
}, Ee = class extends Error {}, De = ({ content: e, fileName: n, loadErrorLabel: r, formulaLabel: a, formulaLabelClassName: o, formulaValueClassName: s, highlightsLabel: c = "Cited locations", highlightNavigatedLabel: l = "Scrolled to the cited location", loadingLabel: u = "Loading…" }) => {
|
|
296
|
+
let d = R(null), [f, p] = z(!0), [m, h] = z(!1), [g, _] = z(""), [v, b] = z([]), [x, S] = z(!1), { highlights: C, selectedHighlightId: w } = e, E = C != null && C.length > 0, D = R(void 0), O = R(C);
|
|
297
|
+
O.current = C;
|
|
298
|
+
let ee = R(void 0);
|
|
299
|
+
return I(() => {
|
|
300
|
+
let t = d.current;
|
|
301
|
+
if (t == null) return;
|
|
310
302
|
let n, r, i = !1, a, o = () => i;
|
|
311
|
-
p(!0), h(!1),
|
|
303
|
+
p(!0), h(!1), _(""), b([]), S(!1);
|
|
312
304
|
let s = () => {
|
|
313
305
|
i || a != null || (a = requestAnimationFrame(() => {
|
|
314
306
|
a = void 0, c();
|
|
315
307
|
}));
|
|
316
308
|
}, c = async () => {
|
|
317
|
-
let e = n?.highlights, t =
|
|
309
|
+
let e = n?.highlights, t = O.current;
|
|
318
310
|
if (!(i || e == null || t == null)) try {
|
|
319
311
|
let n = await e.measure(t);
|
|
320
312
|
i || b(n);
|
|
@@ -326,97 +318,97 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
326
318
|
i || (p(!1), h(!0));
|
|
327
319
|
},
|
|
328
320
|
onXlsxSelectionContextChange: (e) => {
|
|
329
|
-
i ||
|
|
321
|
+
i || _(Ce(e));
|
|
330
322
|
},
|
|
331
323
|
onGeometryInvalidated: s
|
|
332
324
|
}, u = () => {
|
|
333
325
|
i || (r = new ResizeObserver(() => {
|
|
334
326
|
n?.viewer.resize?.(), s();
|
|
335
|
-
}), r.observe(
|
|
327
|
+
}), r.observe(t));
|
|
336
328
|
};
|
|
337
|
-
return
|
|
329
|
+
return t.addEventListener("scroll", s, !0), ee.current = s, (async () => {
|
|
338
330
|
try {
|
|
339
331
|
if (E) {
|
|
340
|
-
let r = await
|
|
332
|
+
let r = await Te(t, e, l, o);
|
|
341
333
|
if (i) {
|
|
342
334
|
r.viewer.destroy(), r.engine?.destroy();
|
|
343
335
|
return;
|
|
344
336
|
}
|
|
345
337
|
n = r, D.current = r.highlights, u();
|
|
346
338
|
} else {
|
|
347
|
-
let r = await
|
|
339
|
+
let r = await we(t, e.format, l);
|
|
348
340
|
if (i) {
|
|
349
341
|
r.destroy();
|
|
350
342
|
return;
|
|
351
343
|
}
|
|
352
|
-
if (n = { viewer: r }, D.current = void 0, await r.load(
|
|
344
|
+
if (n = { viewer: r }, D.current = void 0, await r.load(e.url), i) return;
|
|
353
345
|
u();
|
|
354
346
|
}
|
|
355
347
|
if (i) return;
|
|
356
348
|
p(!1), await c();
|
|
357
|
-
} catch (
|
|
358
|
-
if (
|
|
359
|
-
n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, D.current = void 0,
|
|
349
|
+
} catch (e) {
|
|
350
|
+
if (e instanceof Ee || i) return;
|
|
351
|
+
n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, D.current = void 0, t.replaceChildren(), p(!1), h(!0);
|
|
360
352
|
}
|
|
361
353
|
})(), () => {
|
|
362
|
-
i = !0,
|
|
354
|
+
i = !0, t.removeEventListener("scroll", s, !0), a != null && cancelAnimationFrame(a), ee.current = void 0, r?.disconnect(), n?.viewer.destroy(), n?.engine?.destroy(), D.current = void 0, t.replaceChildren();
|
|
363
355
|
};
|
|
364
356
|
}, [
|
|
365
|
-
|
|
366
|
-
|
|
357
|
+
e.format,
|
|
358
|
+
e.url,
|
|
367
359
|
E
|
|
368
|
-
]),
|
|
369
|
-
|
|
370
|
-
}, [
|
|
360
|
+
]), I(() => {
|
|
361
|
+
ee.current?.();
|
|
362
|
+
}, [C]), I(() => {
|
|
371
363
|
S(!1);
|
|
372
|
-
let
|
|
373
|
-
if (
|
|
374
|
-
let n = (
|
|
364
|
+
let e = D.current;
|
|
365
|
+
if (e == null || f) return;
|
|
366
|
+
let n = (O.current?.find(({ id: e }) => e === w))?.locations.at(0);
|
|
375
367
|
if (n == null) return;
|
|
376
368
|
let r = !1;
|
|
377
369
|
return (async () => {
|
|
378
370
|
let i;
|
|
379
371
|
try {
|
|
380
|
-
i = await
|
|
372
|
+
i = await e.navigate(n);
|
|
381
373
|
} catch {
|
|
382
374
|
return;
|
|
383
375
|
}
|
|
384
|
-
r || i !==
|
|
376
|
+
r || i !== t.Navigated || S(!0);
|
|
385
377
|
})(), () => {
|
|
386
378
|
r = !0;
|
|
387
379
|
};
|
|
388
|
-
}, [
|
|
380
|
+
}, [w, f]), /* @__PURE__ */ H("div", {
|
|
389
381
|
className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
|
|
390
382
|
children: [
|
|
391
|
-
|
|
383
|
+
e.format === i.Xlsx && /* @__PURE__ */ H("div", {
|
|
392
384
|
role: "region",
|
|
393
385
|
"aria-label": a,
|
|
394
|
-
className:
|
|
395
|
-
children: [/* @__PURE__ */
|
|
386
|
+
className: y("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", J.formulaPanel),
|
|
387
|
+
children: [/* @__PURE__ */ V("span", {
|
|
396
388
|
"aria-hidden": "true",
|
|
397
|
-
className:
|
|
389
|
+
className: y("shrink-0", o),
|
|
398
390
|
children: "fx"
|
|
399
|
-
}), /* @__PURE__ */
|
|
391
|
+
}), /* @__PURE__ */ V("code", {
|
|
400
392
|
dir: "ltr",
|
|
401
393
|
tabIndex: 0,
|
|
402
394
|
"aria-live": "polite",
|
|
403
|
-
className:
|
|
395
|
+
className: y("h-8 min-w-0 flex-1 overflow-x-auto rounded border px-2 py-1 whitespace-nowrap focus-visible:outline", J.formulaValue, s),
|
|
404
396
|
children: g
|
|
405
397
|
})]
|
|
406
398
|
}),
|
|
407
|
-
/* @__PURE__ */
|
|
399
|
+
/* @__PURE__ */ H("div", {
|
|
408
400
|
className: "relative min-h-0 w-full flex-1",
|
|
409
|
-
children: [/* @__PURE__ */
|
|
401
|
+
children: [/* @__PURE__ */ V("div", {
|
|
410
402
|
ref: d,
|
|
411
403
|
role: "document",
|
|
412
404
|
"aria-label": n,
|
|
413
405
|
"aria-busy": f,
|
|
414
|
-
className:
|
|
415
|
-
}),
|
|
406
|
+
className: y("h-full w-full overflow-hidden", J.viewer)
|
|
407
|
+
}), v.length > 0 && /* @__PURE__ */ V("div", {
|
|
416
408
|
role: "region",
|
|
417
409
|
"aria-label": c,
|
|
418
410
|
className: "pointer-events-none absolute inset-0 overflow-hidden",
|
|
419
|
-
children:
|
|
411
|
+
children: v.map((e, t) => /* @__PURE__ */ V("div", {
|
|
420
412
|
"aria-hidden": "true",
|
|
421
413
|
style: {
|
|
422
414
|
left: `${e.left}px`,
|
|
@@ -424,48 +416,48 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
424
416
|
width: `${e.width}px`,
|
|
425
417
|
height: `${e.height}px`
|
|
426
418
|
},
|
|
427
|
-
"data-selected": e.highlightId ===
|
|
419
|
+
"data-selected": e.highlightId === w,
|
|
428
420
|
"data-clipped": e.isClippedAtEnd === !0,
|
|
429
|
-
className:
|
|
421
|
+
className: y("absolute", J.highlight)
|
|
430
422
|
}, `${e.highlightId}-${t}`))
|
|
431
423
|
})]
|
|
432
424
|
}),
|
|
433
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ V(k, {
|
|
434
426
|
visuallyHidden: !0,
|
|
435
427
|
children: x ? l : ""
|
|
436
428
|
}),
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
politeness:
|
|
429
|
+
/* @__PURE__ */ V(k, {
|
|
430
|
+
politeness: A.Assertive,
|
|
439
431
|
visuallyHidden: !0,
|
|
440
|
-
children: !f && m ?
|
|
432
|
+
children: !f && m ? r : ""
|
|
441
433
|
}),
|
|
442
|
-
(f || m) && /* @__PURE__ */
|
|
443
|
-
className:
|
|
444
|
-
children: f ? /* @__PURE__ */
|
|
434
|
+
(f || m) && /* @__PURE__ */ V("div", {
|
|
435
|
+
className: y("absolute inset-0 flex items-center justify-center", J.statusOverlay),
|
|
436
|
+
children: f ? /* @__PURE__ */ V(te, {
|
|
445
437
|
size: 48,
|
|
446
438
|
ariaLabel: u
|
|
447
|
-
}) : /* @__PURE__ */
|
|
439
|
+
}) : /* @__PURE__ */ H("div", {
|
|
448
440
|
className: "flex flex-col items-center gap-2",
|
|
449
|
-
children: [/* @__PURE__ */
|
|
441
|
+
children: [/* @__PURE__ */ V(j, {
|
|
450
442
|
"aria-hidden": "true",
|
|
451
443
|
size: 60,
|
|
452
|
-
stroke:
|
|
453
|
-
className:
|
|
454
|
-
}), /* @__PURE__ */
|
|
444
|
+
stroke: T,
|
|
445
|
+
className: J.errorIcon
|
|
446
|
+
}), /* @__PURE__ */ V("p", {
|
|
455
447
|
"aria-hidden": !0,
|
|
456
448
|
className: "text-center",
|
|
457
|
-
children:
|
|
449
|
+
children: r
|
|
458
450
|
})]
|
|
459
451
|
})
|
|
460
452
|
})
|
|
461
453
|
]
|
|
462
454
|
});
|
|
463
|
-
},
|
|
455
|
+
}, Y = (e, t) => {
|
|
464
456
|
let n = e.toLowerCase();
|
|
465
457
|
return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
|
|
466
|
-
},
|
|
458
|
+
}, Oe = (e, t) => {
|
|
467
459
|
if (e != null && e !== "") return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
|
|
468
|
-
},
|
|
460
|
+
}, ke = (e) => `${e}:grouped-visualizer`, Ae = (e, t) => {
|
|
469
461
|
let n = (t.contentType ?? "").split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""), r = [], i = [];
|
|
470
462
|
return e.forEach((e) => {
|
|
471
463
|
e.url != null && e.url !== "" && (n.length === 0 || n.includes(e.contentType.toLowerCase())) ? r.push(e) : i.push(e);
|
|
@@ -473,34 +465,34 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
473
465
|
claimed: r,
|
|
474
466
|
unclaimed: i
|
|
475
467
|
};
|
|
476
|
-
},
|
|
468
|
+
}, je = (e) => {
|
|
477
469
|
if (typeof e != "object" || !e || !Object.prototype.hasOwnProperty.call(e, "message")) return;
|
|
478
470
|
let { message: t } = e;
|
|
479
471
|
return typeof t == "string" && t.trim() !== "" ? t : void 0;
|
|
480
|
-
},
|
|
472
|
+
}, Me = {
|
|
481
473
|
loadingOverlay: "_loadingOverlay_12637_1",
|
|
482
474
|
statusLabel: "_statusLabel_12637_5",
|
|
483
475
|
errorIcon: "_errorIcon_12637_9"
|
|
484
|
-
},
|
|
485
|
-
let s =
|
|
476
|
+
}, Ne = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: i, onSendMessage: o }) => {
|
|
477
|
+
let s = R(null), [c, l] = z("loading"), { url: u, visualizerName: d, requestTimeout: f } = e, p = R(e);
|
|
486
478
|
p.current = e;
|
|
487
|
-
let
|
|
488
|
-
return
|
|
479
|
+
let m = R(o);
|
|
480
|
+
return m.current = o, I(() => {
|
|
489
481
|
let e = s.current;
|
|
490
482
|
if (!e) return;
|
|
491
483
|
l("loading");
|
|
492
|
-
let t = new
|
|
484
|
+
let t = new me(e, {
|
|
493
485
|
domain: u,
|
|
494
486
|
visualizerName: d,
|
|
495
487
|
requestTimeout: f
|
|
496
|
-
}), n = !0, r = t.subscribe(`${d}/${
|
|
497
|
-
let t =
|
|
498
|
-
t != null &&
|
|
488
|
+
}), n = !0, r = t.subscribe(`${d}/${U.SendMessage}`, (e) => {
|
|
489
|
+
let t = je(e);
|
|
490
|
+
t != null && m.current?.(t);
|
|
499
491
|
});
|
|
500
492
|
return (async () => {
|
|
501
493
|
if (await t.ready(), !n) return;
|
|
502
494
|
let e = p.current;
|
|
503
|
-
if (e.type ===
|
|
495
|
+
if (e.type === a.GroupedVisualizer) await t.send(he.SendGroupedVisualizeData, {
|
|
504
496
|
attachments: e.attachments,
|
|
505
497
|
layout: e.layout
|
|
506
498
|
});
|
|
@@ -509,7 +501,7 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
509
501
|
layout: r,
|
|
510
502
|
...typeof i == "object" && i ? i : {}
|
|
511
503
|
};
|
|
512
|
-
await t.send(
|
|
504
|
+
await t.send(he.SendVisualizeData, {
|
|
513
505
|
mimeType: n,
|
|
514
506
|
visualizerData: a
|
|
515
507
|
});
|
|
@@ -524,7 +516,7 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
524
516
|
u,
|
|
525
517
|
d,
|
|
526
518
|
f
|
|
527
|
-
]),
|
|
519
|
+
]), I(() => {
|
|
528
520
|
let e = r ?? d.trim();
|
|
529
521
|
e !== "" && s.current?.querySelector("iframe")?.setAttribute("title", e);
|
|
530
522
|
}, [
|
|
@@ -532,46 +524,46 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
532
524
|
d,
|
|
533
525
|
u,
|
|
534
526
|
f
|
|
535
|
-
]), /* @__PURE__ */
|
|
527
|
+
]), /* @__PURE__ */ H("div", {
|
|
536
528
|
className: "relative h-full w-full",
|
|
537
|
-
style:
|
|
538
|
-
"--vs-loading-bg":
|
|
539
|
-
"--vs-status-text":
|
|
540
|
-
"--vs-error-icon":
|
|
529
|
+
style: g({
|
|
530
|
+
"--vs-loading-bg": i?.loadingBackground,
|
|
531
|
+
"--vs-status-text": i?.statusText,
|
|
532
|
+
"--vs-error-icon": i?.errorIcon
|
|
541
533
|
}),
|
|
542
534
|
children: [
|
|
543
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ V("div", {
|
|
544
536
|
ref: s,
|
|
545
537
|
className: "h-full w-full"
|
|
546
538
|
}),
|
|
547
|
-
c === "loading" && /* @__PURE__ */
|
|
548
|
-
className:
|
|
549
|
-
children: [/* @__PURE__ */
|
|
539
|
+
c === "loading" && /* @__PURE__ */ H("div", {
|
|
540
|
+
className: y("absolute inset-0 flex flex-col items-center justify-center gap-2", Me.loadingOverlay),
|
|
541
|
+
children: [/* @__PURE__ */ V(te, { ariaLabel: t }), t && /* @__PURE__ */ V("p", {
|
|
550
542
|
"aria-hidden": !0,
|
|
551
|
-
className:
|
|
543
|
+
className: y("text-center", Me.statusLabel),
|
|
552
544
|
children: t
|
|
553
545
|
})]
|
|
554
546
|
}),
|
|
555
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ V(k, {
|
|
556
548
|
visuallyHidden: !0,
|
|
557
549
|
children: c === "error" && n
|
|
558
550
|
}),
|
|
559
|
-
c === "error" && /* @__PURE__ */
|
|
551
|
+
c === "error" && /* @__PURE__ */ H("div", {
|
|
560
552
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
561
|
-
children: [/* @__PURE__ */
|
|
553
|
+
children: [/* @__PURE__ */ V(j, {
|
|
562
554
|
size: 60,
|
|
563
|
-
stroke:
|
|
555
|
+
stroke: T,
|
|
564
556
|
"aria-hidden": !0,
|
|
565
|
-
className:
|
|
566
|
-
}), /* @__PURE__ */
|
|
557
|
+
className: Me.errorIcon
|
|
558
|
+
}), /* @__PURE__ */ V("p", {
|
|
567
559
|
"aria-hidden": !0,
|
|
568
|
-
className:
|
|
560
|
+
className: y("text-center", Me.statusLabel),
|
|
569
561
|
children: n
|
|
570
562
|
})]
|
|
571
563
|
})
|
|
572
564
|
]
|
|
573
565
|
});
|
|
574
|
-
},
|
|
566
|
+
}, X = {
|
|
575
567
|
body: "_body_fvnln_4",
|
|
576
568
|
statusLabel: "_statusLabel_fvnln_13",
|
|
577
569
|
errorIcon: "_errorIcon_fvnln_17",
|
|
@@ -586,271 +578,272 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
586
578
|
jsonExpandIcon: "_jsonExpandIcon_fvnln_54",
|
|
587
579
|
jsonCollapseIcon: "_jsonCollapseIcon_fvnln_67",
|
|
588
580
|
jsonCollapsedContent: "_jsonCollapsedContent_fvnln_84"
|
|
589
|
-
},
|
|
590
|
-
let [r, i] =
|
|
591
|
-
return
|
|
581
|
+
}, Pe = () => N(async () => ({ default: (await import("./PdfContent-DX6q6wTq.js")).PdfContent })), Fe = () => N(async () => ({ default: (await import("./McpAppCanvasRenderer-DXUdyMtZ.js").then((e) => e.n)).McpAppCanvasRenderer })), Ie = ({ url: e, fileName: t, loadErrorLabel: n }) => {
|
|
582
|
+
let [r, i] = z(!1);
|
|
583
|
+
return I(() => {
|
|
592
584
|
i(!1);
|
|
593
|
-
}, [e]), r ? /* @__PURE__ */
|
|
585
|
+
}, [e]), r ? /* @__PURE__ */ H("div", {
|
|
594
586
|
className: "flex flex-col items-center gap-2",
|
|
595
|
-
children: [/* @__PURE__ */
|
|
587
|
+
children: [/* @__PURE__ */ V(j, {
|
|
596
588
|
size: 60,
|
|
597
|
-
stroke:
|
|
598
|
-
className:
|
|
599
|
-
}), /* @__PURE__ */
|
|
600
|
-
className:
|
|
589
|
+
stroke: T,
|
|
590
|
+
className: X.errorIcon
|
|
591
|
+
}), /* @__PURE__ */ V("p", {
|
|
592
|
+
className: y("text-center", X.statusLabel),
|
|
601
593
|
children: n
|
|
602
594
|
})]
|
|
603
|
-
}) : /* @__PURE__ */
|
|
595
|
+
}) : /* @__PURE__ */ V("img", {
|
|
604
596
|
src: e,
|
|
605
597
|
alt: t ?? "",
|
|
606
598
|
className: "max-h-full max-w-full object-contain",
|
|
607
599
|
onError: () => i(!0)
|
|
608
600
|
});
|
|
609
|
-
},
|
|
610
|
-
let { colors:
|
|
611
|
-
|
|
612
|
-
}, []), [
|
|
613
|
-
|
|
614
|
-
}, []),
|
|
615
|
-
|
|
601
|
+
}, Le = P(({ content: e, isLoading: t = !1, loadingContentType: n, fileName: i, isHtmlSourceView: o = !1, labels: { unsupportedLabel: c = "Preview is not supported for this file", loadErrorLabel: u = "Failed to load file", loadErrorRetryLabel: d = "Retry", forbiddenErrorLabel: p = "You don't have permission to access this file", visualizerErrorLabel: m, htmlFrameBlockedLabel: _ = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: v = "Open in new tab", pdfThumbnailsLabel: b, pdfShowThumbnailsLabel: x, pdfHideThumbnailsLabel: S, pdfPageNumberLabel: C, pdfContentLoadingLabel: w, pdfContentErrorLabel: E, pdfContentRetryLabel: O, xlsxFormulaLabel: ee = "Formula", codeContentLoadingLabel: A, codeContentErrorLabel: ne, codeContentRetryLabel: re, tableCopyLabel: ie, tableCopiedLabel: ae, tableDownloadCsvLabel: oe, codeBlockCopyLabel: se, codeBlockCopiedLabel: le, codeBlockDownloadLabel: ue, tableScrollRegionAriaLabel: M, mathScrollRegionAriaLabel: N, ooxmlHighlightsLabel: P, ooxmlHighlightNavigatedLabel: de, loadingLabel: B = "Loading…" } = {}, styles: me, codeBlockTheme: U, tableDownloadFilename: he, loadPdf: W, hidePdfToolbar: G = !1, configurePdfWorker: K, onAppInfo: _e, onRetry: ve, onVisualizerSendMessage: ye, mcpAppHostContext: xe }) => {
|
|
602
|
+
let { colors: q, typography: J, bodyClassName: Ce, cssVars: we } = me ?? {}, [Te, Ee] = z(0), Y = L(Pe, [Te]), Oe = F(() => {
|
|
603
|
+
Ee((e) => e + 1);
|
|
604
|
+
}, []), [ke, Ae] = z(0), je = L(Fe, [ke]), Me = F(() => {
|
|
605
|
+
Ae((e) => e + 1);
|
|
606
|
+
}, []), Le = R(void 0), [Re, ze] = z(0), Be = F((e) => {
|
|
607
|
+
Le.current = e;
|
|
616
608
|
}, []);
|
|
617
|
-
|
|
618
|
-
let t =
|
|
619
|
-
t != null && (
|
|
609
|
+
I(() => {
|
|
610
|
+
let t = Le.current;
|
|
611
|
+
t != null && (Le.current = void 0, e.type === a.Pdf && e.url === t && ze((e) => e + 1));
|
|
620
612
|
}, [e]);
|
|
621
|
-
let
|
|
622
|
-
...
|
|
623
|
-
"--ac-text":
|
|
624
|
-
"--ac-status-text":
|
|
625
|
-
"--ac-error-icon":
|
|
626
|
-
"--ac-open-in-new-tab-text":
|
|
627
|
-
"--ac-json-border":
|
|
628
|
-
"--ac-json-bg":
|
|
629
|
-
"--ac-json-label":
|
|
630
|
-
"--ac-json-clickable-label":
|
|
631
|
-
"--ac-json-punctuation":
|
|
632
|
-
"--ac-json-string":
|
|
633
|
-
"--ac-json-number":
|
|
634
|
-
"--ac-json-boolean":
|
|
635
|
-
"--ac-json-null":
|
|
636
|
-
"--ac-json-toggle-icon":
|
|
637
|
-
"--ac-json-toggle-icon-hover":
|
|
638
|
-
"--ac-ooxml-bg":
|
|
639
|
-
"--ac-ooxml-formula-border":
|
|
640
|
-
"--ac-ooxml-formula-bg":
|
|
641
|
-
"--ac-ooxml-formula-text":
|
|
642
|
-
"--ac-ooxml-highlight-border":
|
|
643
|
-
"--ac-ooxml-highlight-bg":
|
|
644
|
-
"--ac-json-collapsed-text":
|
|
645
|
-
"--ac-json-collapsed-bg":
|
|
646
|
-
"--ac-focus-outline":
|
|
647
|
-
"--ac-code-bg":
|
|
648
|
-
"--ac-mcp-app-loading-bg":
|
|
649
|
-
"--ac-mcp-app-status-text":
|
|
650
|
-
"--ac-font-family":
|
|
651
|
-
"--ac-font-size":
|
|
652
|
-
"--ac-font-weight":
|
|
653
|
-
"--ac-line-height":
|
|
654
|
-
"--ac-letter-spacing":
|
|
613
|
+
let Ve = J?.fontClassName != null, He = L(() => ({
|
|
614
|
+
...g({
|
|
615
|
+
"--ac-text": q?.text,
|
|
616
|
+
"--ac-status-text": q?.statusText,
|
|
617
|
+
"--ac-error-icon": q?.errorIcon,
|
|
618
|
+
"--ac-open-in-new-tab-text": q?.openInNewTabText,
|
|
619
|
+
"--ac-json-border": q?.jsonBorder,
|
|
620
|
+
"--ac-json-bg": q?.jsonBackground,
|
|
621
|
+
"--ac-json-label": q?.jsonLabel,
|
|
622
|
+
"--ac-json-clickable-label": q?.jsonClickableLabel,
|
|
623
|
+
"--ac-json-punctuation": q?.jsonPunctuation,
|
|
624
|
+
"--ac-json-string": q?.jsonString,
|
|
625
|
+
"--ac-json-number": q?.jsonNumber,
|
|
626
|
+
"--ac-json-boolean": q?.jsonBoolean,
|
|
627
|
+
"--ac-json-null": q?.jsonNull,
|
|
628
|
+
"--ac-json-toggle-icon": q?.jsonToggleIcon,
|
|
629
|
+
"--ac-json-toggle-icon-hover": q?.jsonToggleIconHover,
|
|
630
|
+
"--ac-ooxml-bg": q?.ooxmlBackground,
|
|
631
|
+
"--ac-ooxml-formula-border": q?.ooxmlFormulaBorder,
|
|
632
|
+
"--ac-ooxml-formula-bg": q?.ooxmlFormulaBackground,
|
|
633
|
+
"--ac-ooxml-formula-text": q?.ooxmlFormulaText,
|
|
634
|
+
"--ac-ooxml-highlight-border": q?.ooxmlHighlightBorder,
|
|
635
|
+
"--ac-ooxml-highlight-bg": q?.ooxmlHighlightBackground,
|
|
636
|
+
"--ac-json-collapsed-text": q?.jsonCollapsedText,
|
|
637
|
+
"--ac-json-collapsed-bg": q?.jsonCollapsedBackground,
|
|
638
|
+
"--ac-focus-outline": q?.focusOutline,
|
|
639
|
+
"--ac-code-bg": q?.codeBackground,
|
|
640
|
+
"--ac-mcp-app-loading-bg": q?.mcpAppLoadingBackground,
|
|
641
|
+
"--ac-mcp-app-status-text": q?.mcpAppStatusText,
|
|
642
|
+
"--ac-font-family": Ve ? void 0 : J?.fontFamily,
|
|
643
|
+
"--ac-font-size": Ve ? void 0 : J?.fontSize,
|
|
644
|
+
"--ac-font-weight": Ve ? void 0 : J?.fontWeight,
|
|
645
|
+
"--ac-line-height": Ve ? void 0 : J?.lineHeight,
|
|
646
|
+
"--ac-letter-spacing": Ve ? void 0 : J?.letterSpacing
|
|
655
647
|
}),
|
|
656
|
-
...
|
|
657
|
-
}), [
|
|
648
|
+
...we
|
|
649
|
+
}), [me]), Ue = ge[e.type], We = e.type === a.McpApp ? xe : void 0, Ge = L(() => {
|
|
658
650
|
switch (e.type) {
|
|
659
|
-
case
|
|
660
|
-
className:
|
|
651
|
+
case a.PlainText: return /* @__PURE__ */ V("pre", {
|
|
652
|
+
className: y("wrap-break-word whitespace-pre-wrap", X.body, J?.fontClassName),
|
|
661
653
|
children: e.text
|
|
662
654
|
});
|
|
663
|
-
case
|
|
655
|
+
case a.Image: return /* @__PURE__ */ V(Ie, {
|
|
664
656
|
url: e.url,
|
|
665
|
-
fileName:
|
|
666
|
-
loadErrorLabel:
|
|
657
|
+
fileName: i,
|
|
658
|
+
loadErrorLabel: u
|
|
667
659
|
});
|
|
668
|
-
case
|
|
660
|
+
case a.Audio: return /* @__PURE__ */ V("audio", {
|
|
669
661
|
controls: !0,
|
|
670
662
|
controlsList: "nodownload",
|
|
671
663
|
src: e.url,
|
|
672
|
-
"aria-label":
|
|
664
|
+
"aria-label": i ?? "Audio attachment",
|
|
673
665
|
className: "w-full max-w-sm",
|
|
674
666
|
preload: "metadata",
|
|
675
|
-
children: e.mimeType && /* @__PURE__ */
|
|
667
|
+
children: e.mimeType && /* @__PURE__ */ V("source", {
|
|
676
668
|
src: e.url,
|
|
677
669
|
type: e.mimeType
|
|
678
670
|
})
|
|
679
671
|
});
|
|
680
|
-
case
|
|
672
|
+
case a.Markdown: return /* @__PURE__ */ V("div", {
|
|
681
673
|
className: "p-4",
|
|
682
|
-
children: /* @__PURE__ */
|
|
674
|
+
children: /* @__PURE__ */ V(h, {
|
|
683
675
|
content: e.text,
|
|
684
676
|
isStreaming: !1,
|
|
685
|
-
codeBlockTheme:
|
|
686
|
-
codeBlockCopyLabel:
|
|
687
|
-
codeBlockCopiedLabel:
|
|
688
|
-
codeBlockDownloadLabel:
|
|
689
|
-
tableScrollRegionAriaLabel:
|
|
690
|
-
mathScrollRegionAriaLabel:
|
|
691
|
-
classNames:
|
|
677
|
+
codeBlockTheme: U,
|
|
678
|
+
codeBlockCopyLabel: se,
|
|
679
|
+
codeBlockCopiedLabel: le,
|
|
680
|
+
codeBlockDownloadLabel: ue,
|
|
681
|
+
tableScrollRegionAriaLabel: M,
|
|
682
|
+
mathScrollRegionAriaLabel: N,
|
|
683
|
+
classNames: f
|
|
692
684
|
})
|
|
693
685
|
});
|
|
694
|
-
case
|
|
686
|
+
case a.MarkdownTable: return /* @__PURE__ */ V(h, {
|
|
695
687
|
content: e.text,
|
|
696
688
|
isStreaming: !1,
|
|
697
|
-
codeBlockTheme:
|
|
698
|
-
codeBlockCopyLabel:
|
|
699
|
-
codeBlockCopiedLabel:
|
|
700
|
-
codeBlockDownloadLabel:
|
|
701
|
-
tableScrollRegionAriaLabel:
|
|
702
|
-
mathScrollRegionAriaLabel:
|
|
689
|
+
codeBlockTheme: U,
|
|
690
|
+
codeBlockCopyLabel: se,
|
|
691
|
+
codeBlockCopiedLabel: le,
|
|
692
|
+
codeBlockDownloadLabel: ue,
|
|
693
|
+
tableScrollRegionAriaLabel: M,
|
|
694
|
+
mathScrollRegionAriaLabel: N,
|
|
703
695
|
containerClassName: "flex h-full min-h-0 flex-col",
|
|
704
696
|
classNames: {
|
|
705
|
-
...
|
|
697
|
+
...f,
|
|
706
698
|
tableWrapper: "my-0 max-h-full",
|
|
707
699
|
tableScrollContainer: "max-h-full"
|
|
708
700
|
},
|
|
709
701
|
tableActionLabels: {
|
|
710
|
-
copyLabel:
|
|
711
|
-
copiedLabel:
|
|
712
|
-
downloadCsvLabel:
|
|
702
|
+
copyLabel: ie,
|
|
703
|
+
copiedLabel: ae,
|
|
704
|
+
downloadCsvLabel: oe
|
|
713
705
|
},
|
|
714
|
-
tableDownloadFilename:
|
|
706
|
+
tableDownloadFilename: he
|
|
715
707
|
});
|
|
716
|
-
case
|
|
717
|
-
let t =
|
|
718
|
-
return /* @__PURE__ */
|
|
708
|
+
case a.Json: {
|
|
709
|
+
let t = J?.jsonLabelClassName ?? (J?.jsonClassName ? void 0 : "dial-code-semi-text");
|
|
710
|
+
return /* @__PURE__ */ V("div", {
|
|
719
711
|
dir: "ltr",
|
|
720
712
|
className: "h-full overflow-auto",
|
|
721
|
-
children: /* @__PURE__ */
|
|
722
|
-
className:
|
|
723
|
-
children: /* @__PURE__ */
|
|
713
|
+
children: /* @__PURE__ */ V("div", {
|
|
714
|
+
className: y("m-3 overflow-auto rounded-md border", X.jsonWrapper),
|
|
715
|
+
children: /* @__PURE__ */ V(fe, {
|
|
724
716
|
data: e.value,
|
|
725
717
|
style: {
|
|
726
|
-
container:
|
|
727
|
-
basicChildStyle:
|
|
718
|
+
container: y("whitespace-pre-wrap wrap-break-word p-2", J?.jsonClassName ?? "dial-code-text"),
|
|
719
|
+
basicChildStyle: pe.basicChildStyle,
|
|
728
720
|
childFieldsContainer: "m-0 ps-3",
|
|
729
|
-
label:
|
|
730
|
-
clickableLabel:
|
|
731
|
-
nullValue:
|
|
732
|
-
undefinedValue:
|
|
733
|
-
stringValue:
|
|
734
|
-
booleanValue:
|
|
735
|
-
numberValue:
|
|
736
|
-
otherValue:
|
|
737
|
-
punctuation:
|
|
738
|
-
collapseIcon:
|
|
739
|
-
expandIcon:
|
|
740
|
-
collapsedContent:
|
|
721
|
+
label: y("me-1", t, X.jsonLabel),
|
|
722
|
+
clickableLabel: y("me-1 cursor-pointer hover:underline", t, X.jsonClickableLabel),
|
|
723
|
+
nullValue: y("italic", X.jsonNullValue),
|
|
724
|
+
undefinedValue: y("italic", X.jsonNullValue),
|
|
725
|
+
stringValue: X.jsonStringValue,
|
|
726
|
+
booleanValue: X.jsonBooleanValue,
|
|
727
|
+
numberValue: X.jsonNumberValue,
|
|
728
|
+
otherValue: y("italic", X.jsonNullValue),
|
|
729
|
+
punctuation: y("me-1", X.jsonPunctuation),
|
|
730
|
+
collapseIcon: y("me-1 cursor-pointer select-none transition-colors", X.jsonCollapseIcon),
|
|
731
|
+
expandIcon: y("me-1 cursor-pointer select-none transition-colors", X.jsonExpandIcon),
|
|
732
|
+
collapsedContent: y(J?.jsonCollapsedClassName ?? "dial-caption-text", "me-1 cursor-pointer rounded px-1", X.jsonCollapsedContent)
|
|
741
733
|
}
|
|
742
734
|
})
|
|
743
735
|
})
|
|
744
736
|
});
|
|
745
737
|
}
|
|
746
|
-
case
|
|
738
|
+
case a.Code: return /* @__PURE__ */ V(be, {
|
|
747
739
|
content: e,
|
|
748
|
-
codeBlockTheme:
|
|
749
|
-
codeClassName:
|
|
750
|
-
errorLabelClassName:
|
|
740
|
+
codeBlockTheme: U,
|
|
741
|
+
codeClassName: J?.codeClassName,
|
|
742
|
+
errorLabelClassName: J?.errorMessageClassName,
|
|
751
743
|
labels: {
|
|
752
|
-
loadingLabel:
|
|
753
|
-
errorLabel:
|
|
754
|
-
retryLabel:
|
|
744
|
+
loadingLabel: A,
|
|
745
|
+
errorLabel: ne,
|
|
746
|
+
retryLabel: re
|
|
755
747
|
}
|
|
756
748
|
});
|
|
757
|
-
case
|
|
749
|
+
case a.Html: return /* @__PURE__ */ V(Se, {
|
|
758
750
|
content: e,
|
|
759
751
|
labels: {
|
|
760
|
-
htmlFrameBlockedLabel:
|
|
761
|
-
htmlOpenInNewTabLabel:
|
|
762
|
-
loadingLabel:
|
|
752
|
+
htmlFrameBlockedLabel: _,
|
|
753
|
+
htmlOpenInNewTabLabel: v,
|
|
754
|
+
loadingLabel: B
|
|
763
755
|
},
|
|
764
|
-
isSourceView:
|
|
765
|
-
title:
|
|
766
|
-
codeBlockTheme:
|
|
767
|
-
codeClassName:
|
|
756
|
+
isSourceView: o,
|
|
757
|
+
title: i,
|
|
758
|
+
codeBlockTheme: U,
|
|
759
|
+
codeClassName: J?.codeClassName
|
|
768
760
|
});
|
|
769
|
-
case
|
|
770
|
-
retryKey:
|
|
771
|
-
onRetry:
|
|
772
|
-
|
|
761
|
+
case a.Pdf: return /* @__PURE__ */ V(s, {
|
|
762
|
+
retryKey: Te,
|
|
763
|
+
onRetry: Oe,
|
|
764
|
+
pendingContent: /* @__PURE__ */ V(l, {}),
|
|
765
|
+
errorLabelClassName: J?.errorMessageClassName,
|
|
773
766
|
labels: {
|
|
774
|
-
loadingLabel:
|
|
775
|
-
errorLabel:
|
|
776
|
-
retryLabel:
|
|
767
|
+
loadingLabel: w,
|
|
768
|
+
errorLabel: E,
|
|
769
|
+
retryLabel: O
|
|
777
770
|
},
|
|
778
|
-
children: /* @__PURE__ */
|
|
779
|
-
fileName:
|
|
771
|
+
children: /* @__PURE__ */ V(Y, {
|
|
772
|
+
fileName: i,
|
|
780
773
|
url: e.url,
|
|
781
774
|
highlights: e.highlights ?? [],
|
|
782
775
|
selectedHighlightId: e.selectedHighlightId,
|
|
783
776
|
selectedPageNumber: e.page,
|
|
784
|
-
loadPdf:
|
|
785
|
-
onLoadError:
|
|
786
|
-
hideHeader:
|
|
787
|
-
configurePdfWorker:
|
|
788
|
-
errorLabelClassName:
|
|
777
|
+
loadPdf: W,
|
|
778
|
+
onLoadError: Be,
|
|
779
|
+
hideHeader: G,
|
|
780
|
+
configurePdfWorker: K,
|
|
781
|
+
errorLabelClassName: J?.errorMessageClassName,
|
|
789
782
|
labels: {
|
|
790
|
-
thumbnailsLabel:
|
|
791
|
-
showThumbnailsLabel:
|
|
792
|
-
hideThumbnailsLabel:
|
|
793
|
-
pageNumberLabel:
|
|
794
|
-
loadingLabel:
|
|
795
|
-
errorLabel:
|
|
796
|
-
retryLabel:
|
|
783
|
+
thumbnailsLabel: b,
|
|
784
|
+
showThumbnailsLabel: x,
|
|
785
|
+
hideThumbnailsLabel: S,
|
|
786
|
+
pageNumberLabel: C,
|
|
787
|
+
loadingLabel: w,
|
|
788
|
+
errorLabel: E,
|
|
789
|
+
retryLabel: O
|
|
797
790
|
}
|
|
798
791
|
})
|
|
799
|
-
}, `${e.url}#${
|
|
800
|
-
case
|
|
792
|
+
}, `${e.url}#${Re}`);
|
|
793
|
+
case a.Ooxml: return /* @__PURE__ */ V(De, {
|
|
801
794
|
content: e,
|
|
802
|
-
fileName:
|
|
803
|
-
loadErrorLabel:
|
|
804
|
-
formulaLabel:
|
|
805
|
-
formulaLabelClassName:
|
|
806
|
-
formulaValueClassName:
|
|
807
|
-
highlightsLabel:
|
|
808
|
-
highlightNavigatedLabel:
|
|
809
|
-
loadingLabel:
|
|
795
|
+
fileName: i,
|
|
796
|
+
loadErrorLabel: u,
|
|
797
|
+
formulaLabel: ee,
|
|
798
|
+
formulaLabelClassName: J?.xlsxFormulaLabelClassName ?? "dial-italic-text",
|
|
799
|
+
formulaValueClassName: J?.xlsxFormulaValueClassName ?? "dial-code-text",
|
|
800
|
+
highlightsLabel: P,
|
|
801
|
+
highlightNavigatedLabel: de,
|
|
802
|
+
loadingLabel: B
|
|
810
803
|
});
|
|
811
|
-
case
|
|
812
|
-
case
|
|
804
|
+
case a.Visualizer:
|
|
805
|
+
case a.GroupedVisualizer: return /* @__PURE__ */ V(Ne, {
|
|
813
806
|
content: e,
|
|
814
|
-
errorLabel:
|
|
815
|
-
onSendMessage:
|
|
807
|
+
errorLabel: m,
|
|
808
|
+
onSendMessage: ye
|
|
816
809
|
});
|
|
817
|
-
case
|
|
818
|
-
retryKey:
|
|
819
|
-
onRetry:
|
|
820
|
-
errorLabelClassName:
|
|
810
|
+
case a.McpApp: return /* @__PURE__ */ V(s, {
|
|
811
|
+
retryKey: ke,
|
|
812
|
+
onRetry: Me,
|
|
813
|
+
errorLabelClassName: J?.errorMessageClassName,
|
|
821
814
|
labels: {
|
|
822
|
-
loadingLabel:
|
|
823
|
-
errorLabel:
|
|
824
|
-
retryLabel:
|
|
815
|
+
loadingLabel: B,
|
|
816
|
+
errorLabel: u,
|
|
817
|
+
retryLabel: d
|
|
825
818
|
},
|
|
826
|
-
children: /* @__PURE__ */
|
|
819
|
+
children: /* @__PURE__ */ V(je, {
|
|
827
820
|
content: e,
|
|
828
|
-
loadingLabel:
|
|
829
|
-
onAppInfo:
|
|
830
|
-
hostContext:
|
|
821
|
+
loadingLabel: B,
|
|
822
|
+
onAppInfo: _e,
|
|
823
|
+
hostContext: We
|
|
831
824
|
})
|
|
832
825
|
});
|
|
833
|
-
case
|
|
834
|
-
className:
|
|
835
|
-
children:
|
|
826
|
+
case a.Unsupported: return /* @__PURE__ */ V("p", {
|
|
827
|
+
className: y("text-center", X.statusLabel),
|
|
828
|
+
children: c
|
|
836
829
|
});
|
|
837
|
-
case
|
|
838
|
-
let t = e.errorType ===
|
|
839
|
-
return /* @__PURE__ */
|
|
830
|
+
case a.Error: {
|
|
831
|
+
let t = e.errorType === r.Forbidden;
|
|
832
|
+
return /* @__PURE__ */ H("div", {
|
|
840
833
|
className: "flex flex-col items-center gap-2",
|
|
841
834
|
children: [
|
|
842
|
-
|
|
835
|
+
V(t ? ce : j, {
|
|
843
836
|
size: 60,
|
|
844
|
-
stroke:
|
|
845
|
-
className:
|
|
837
|
+
stroke: T,
|
|
838
|
+
className: X.errorIcon
|
|
846
839
|
}),
|
|
847
|
-
/* @__PURE__ */
|
|
848
|
-
className:
|
|
849
|
-
children: t ?
|
|
840
|
+
/* @__PURE__ */ V("p", {
|
|
841
|
+
className: y("text-center", X.statusLabel),
|
|
842
|
+
children: t ? p : u
|
|
850
843
|
}),
|
|
851
|
-
!t &&
|
|
852
|
-
label:
|
|
853
|
-
onClick:
|
|
844
|
+
!t && ve != null && /* @__PURE__ */ V(D, {
|
|
845
|
+
label: d,
|
|
846
|
+
onClick: ve
|
|
854
847
|
})
|
|
855
848
|
]
|
|
856
849
|
});
|
|
@@ -858,280 +851,284 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
858
851
|
}
|
|
859
852
|
}, [
|
|
860
853
|
e,
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
o,
|
|
854
|
+
J?.fontClassName,
|
|
855
|
+
J?.jsonClassName,
|
|
856
|
+
J?.jsonLabelClassName,
|
|
857
|
+
J?.xlsxFormulaLabelClassName,
|
|
858
|
+
J?.xlsxFormulaValueClassName,
|
|
859
|
+
J?.codeClassName,
|
|
860
|
+
J?.jsonCollapsedClassName,
|
|
861
|
+
J?.errorMessageClassName,
|
|
862
|
+
i,
|
|
863
|
+
U,
|
|
872
864
|
c,
|
|
873
|
-
|
|
865
|
+
u,
|
|
874
866
|
d,
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
a,
|
|
880
|
-
le,
|
|
881
|
-
ue,
|
|
882
|
-
de,
|
|
883
|
-
q,
|
|
884
|
-
fe,
|
|
885
|
-
Be,
|
|
886
|
-
pe,
|
|
867
|
+
p,
|
|
868
|
+
m,
|
|
869
|
+
ye,
|
|
870
|
+
_,
|
|
887
871
|
v,
|
|
888
|
-
|
|
872
|
+
o,
|
|
873
|
+
he,
|
|
874
|
+
W,
|
|
875
|
+
G,
|
|
876
|
+
K,
|
|
877
|
+
_e,
|
|
878
|
+
We,
|
|
879
|
+
ve,
|
|
889
880
|
b,
|
|
890
881
|
x,
|
|
891
882
|
S,
|
|
883
|
+
C,
|
|
892
884
|
w,
|
|
893
885
|
E,
|
|
894
|
-
D,
|
|
895
886
|
O,
|
|
896
|
-
k,
|
|
897
|
-
M,
|
|
898
|
-
Se,
|
|
899
|
-
Ee,
|
|
900
|
-
we,
|
|
901
|
-
De,
|
|
902
|
-
ye,
|
|
903
|
-
X,
|
|
904
|
-
Ae,
|
|
905
|
-
Me,
|
|
906
|
-
N,
|
|
907
887
|
ee,
|
|
908
|
-
|
|
909
|
-
P,
|
|
888
|
+
A,
|
|
910
889
|
ne,
|
|
890
|
+
re,
|
|
891
|
+
Y,
|
|
892
|
+
je,
|
|
893
|
+
ke,
|
|
894
|
+
Me,
|
|
895
|
+
Te,
|
|
896
|
+
Oe,
|
|
897
|
+
Re,
|
|
898
|
+
Be,
|
|
911
899
|
ie,
|
|
912
900
|
ae,
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
901
|
+
oe,
|
|
902
|
+
se,
|
|
903
|
+
le,
|
|
904
|
+
ue,
|
|
905
|
+
M,
|
|
906
|
+
N,
|
|
907
|
+
P,
|
|
908
|
+
de,
|
|
909
|
+
B
|
|
910
|
+
]), Ke = t && n === a.Pdf, Z = t ? Ke ? "h-full" : "flex h-full items-center justify-center" : Ue, qe = t ? Ke ? /* @__PURE__ */ V(l, {}) : /* @__PURE__ */ V(te, { ariaLabel: B }) : Ge;
|
|
911
|
+
return /* @__PURE__ */ H("div", {
|
|
912
|
+
style: t ? void 0 : He,
|
|
913
|
+
className: y(Z, Ce),
|
|
914
|
+
children: [qe, /* @__PURE__ */ V(k, {
|
|
915
|
+
visuallyHidden: !0,
|
|
916
|
+
children: Ke ? B : ""
|
|
917
|
+
})]
|
|
922
918
|
});
|
|
923
|
-
}),
|
|
919
|
+
}), Re = {
|
|
924
920
|
mcpAppDivider: "_mcpAppDivider_1gxed_1",
|
|
925
921
|
mcpAppVersion: "_mcpAppVersion_1gxed_5",
|
|
926
922
|
panelHeader: "_panelHeader_1gxed_9"
|
|
927
|
-
},
|
|
928
|
-
let [
|
|
929
|
-
|
|
930
|
-
}, [
|
|
931
|
-
|
|
932
|
-
}, [
|
|
933
|
-
|
|
934
|
-
}, [
|
|
935
|
-
|
|
936
|
-
|
|
923
|
+
}, ze = 2e3, Be = P(({ isOpen: e, isLoading: t = !1, loadingContentType: n, onClose: r, onRetry: i, content: o, fileName: s, leftActions: l, labels: { ariaLabel: u, closeLabel: d = "Close", resizeLabel: f = "Resize panel", downloadLabel: p = "Download", copyTextLabel: m = "Copy text", copiedTextLabel: h = "Copied!", copyMarkdownLabel: _ = "Copy as Markdown", copiedMarkdownLabel: v = "Copied!", copyJsonLabel: b = "Copy as JSON", copiedJsonLabel: x = "Copied!", visualizerErrorLabel: E, unsupportedLabel: D = "Preview is not supported for this file", loadErrorLabel: ee = "Failed to load file", loadErrorRetryLabel: k = "Retry", forbiddenErrorLabel: A = "You don't have permission to access this file", htmlFrameBlockedLabel: te = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: j = "Open in new tab", htmlViewSourceLabel: ne = "View source", htmlViewRenderedLabel: ce = "View rendered", mcpAppReloadLabel: M = "Reload", pdfThumbnailsLabel: N, pdfShowThumbnailsLabel: P, pdfHideThumbnailsLabel: de, pdfPageNumberLabel: fe, pdfContentLoadingLabel: pe, pdfContentErrorLabel: me, pdfContentRetryLabel: U, xlsxFormulaLabel: he, codeContentLoadingLabel: G, codeContentErrorLabel: K, codeContentRetryLabel: ge, tableCopyLabel: _e, tableCopiedLabel: ve, tableDownloadCsvLabel: ye, codeBlockCopyLabel: be, codeBlockCopiedLabel: xe, codeBlockDownloadLabel: q, tableScrollRegionAriaLabel: Se, mathScrollRegionAriaLabel: J, ooxmlHighlightsLabel: Ce, ooxmlHighlightNavigatedLabel: we, loadingLabel: Te }, onDownload: Ee, onCopyText: De, onCopyMarkdown: Y, onCopyJson: Oe, tableDownloadFilename: ke, isMobile: Ae = !1, isBoundedOverlay: je = !1, defaultWidth: Me, minWidth: Ne = 600, maxWidth: X = 1500, onResizeStop: Pe, styles: Fe, codeBlockTheme: Ie, loadPdf: Be, configurePdfWorker: Ve, onVisualizerSendMessage: He, mcpAppHostContext: Ue }) => {
|
|
924
|
+
let [We, Ge] = z(!1), [Ke, Z] = z(!1), [qe, Je] = z(!1), [Ye, Xe] = z(!1), [Ze, Qe] = z(void 0), Q = R(null), $e = R(null), et = R(null), tt = F(() => {
|
|
925
|
+
De?.(), Q.current != null && clearTimeout(Q.current), Ge(!0), Q.current = setTimeout(() => Ge(!1), ze);
|
|
926
|
+
}, [De]), nt = F(() => {
|
|
927
|
+
Y?.(), $e.current != null && clearTimeout($e.current), Z(!0), $e.current = setTimeout(() => Z(!1), ze);
|
|
928
|
+
}, [Y]), rt = F(() => {
|
|
929
|
+
Oe?.(), et.current != null && clearTimeout(et.current), Je(!0), et.current = setTimeout(() => Je(!1), ze);
|
|
930
|
+
}, [Oe]);
|
|
931
|
+
I(() => () => {
|
|
932
|
+
Q.current != null && clearTimeout(Q.current), $e.current != null && clearTimeout($e.current), et.current != null && clearTimeout(et.current);
|
|
937
933
|
}, []);
|
|
938
|
-
let
|
|
939
|
-
|
|
934
|
+
let it = F(() => {
|
|
935
|
+
Xe((e) => !e);
|
|
940
936
|
}, []);
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
}, [
|
|
944
|
-
let { className:
|
|
945
|
-
"--ac-mcp-app-divider":
|
|
946
|
-
"--ac-mcp-app-version":
|
|
947
|
-
}), [
|
|
948
|
-
style:
|
|
937
|
+
I(() => {
|
|
938
|
+
Xe(!1), Qe(void 0);
|
|
939
|
+
}, [o]);
|
|
940
|
+
let { className: at, panelStyles: ot, ...st } = Fe ?? {}, { colors: ct, typography: lt } = st, ut = L(() => g({
|
|
941
|
+
"--ac-mcp-app-divider": ct?.mcpAppDividerColor,
|
|
942
|
+
"--ac-mcp-app-version": ct?.mcpAppVersionColor
|
|
943
|
+
}), [ct?.mcpAppDividerColor, ct?.mcpAppVersionColor]), dt = o.type === a.McpApp && Ze != null ? /* @__PURE__ */ H("span", {
|
|
944
|
+
style: ut,
|
|
949
945
|
children: [
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ V("span", { children: s }),
|
|
947
|
+
/* @__PURE__ */ V("span", {
|
|
952
948
|
"aria-hidden": !0,
|
|
953
|
-
className:
|
|
949
|
+
className: y("mx-1.5 inline-block h-3 w-0 border-s align-middle", Re.mcpAppDivider)
|
|
954
950
|
}),
|
|
955
|
-
/* @__PURE__ */
|
|
956
|
-
|
|
957
|
-
className:
|
|
958
|
-
children:
|
|
951
|
+
/* @__PURE__ */ V("span", { children: Ze.name }),
|
|
952
|
+
Ze.version && /* @__PURE__ */ V("span", {
|
|
953
|
+
className: y("ms-2", lt?.mcpAppVersionClassName ?? "dial-caption-text", Re.mcpAppVersion),
|
|
954
|
+
children: Ze.version
|
|
959
955
|
})
|
|
960
956
|
]
|
|
961
|
-
}) : s,
|
|
962
|
-
return /* @__PURE__ */
|
|
957
|
+
}) : s, ft = !t && o.type === a.Html && (o.srcdoc != null || o.resolveSourceText != null), $ = !t && De != null && (o.type === a.PlainText || o.type === a.Code), pt = !t && Y != null && o.type === a.Markdown, mt = !t && Oe != null && o.type === a.Json, ht = !t && Ee != null && c(o), gt = !t && o.type === a.McpApp && o.onReload != null;
|
|
958
|
+
return /* @__PURE__ */ V(C, {
|
|
963
959
|
isOpen: e,
|
|
964
|
-
isBoundedOverlay:
|
|
965
|
-
orientation:
|
|
966
|
-
title:
|
|
960
|
+
isBoundedOverlay: je,
|
|
961
|
+
orientation: S.Right,
|
|
962
|
+
title: dt,
|
|
967
963
|
labels: {
|
|
968
|
-
ariaLabel:
|
|
969
|
-
closeLabel:
|
|
970
|
-
resizeLabel:
|
|
964
|
+
ariaLabel: u,
|
|
965
|
+
closeLabel: d,
|
|
966
|
+
resizeLabel: f
|
|
971
967
|
},
|
|
972
|
-
onClose:
|
|
973
|
-
resizable: !
|
|
974
|
-
defaultWidth:
|
|
975
|
-
minWidth:
|
|
976
|
-
maxWidth:
|
|
977
|
-
onResizeStop:
|
|
968
|
+
onClose: r,
|
|
969
|
+
resizable: !Ae || je,
|
|
970
|
+
defaultWidth: Me,
|
|
971
|
+
minWidth: Ne,
|
|
972
|
+
maxWidth: X,
|
|
973
|
+
onResizeStop: Pe,
|
|
978
974
|
styles: {
|
|
979
|
-
...
|
|
975
|
+
...ot,
|
|
980
976
|
cssVars: {
|
|
981
|
-
...
|
|
982
|
-
...
|
|
977
|
+
...g({ "--ac-header-border": ct?.headerBorder }),
|
|
978
|
+
...ot?.cssVars
|
|
983
979
|
},
|
|
984
|
-
titleClassName:
|
|
985
|
-
headerClassName:
|
|
986
|
-
className:
|
|
980
|
+
titleClassName: ot?.titleClassName ?? "dial-h3-text",
|
|
981
|
+
headerClassName: y("border-b", Re.panelHeader, ot?.headerClassName),
|
|
982
|
+
className: y(!je && (e ? "mobile:w-full mobile:max-w-full" : "w-0"), at, ot?.className, W.panel)
|
|
987
983
|
},
|
|
988
|
-
leftActions:
|
|
989
|
-
rightActions:
|
|
990
|
-
|
|
991
|
-
icon: /* @__PURE__ */
|
|
992
|
-
size:
|
|
993
|
-
stroke:
|
|
984
|
+
leftActions: l,
|
|
985
|
+
rightActions: ft || $ || pt || mt || ht || gt ? /* @__PURE__ */ H(B, { children: [
|
|
986
|
+
gt && /* @__PURE__ */ V(O, {
|
|
987
|
+
icon: /* @__PURE__ */ V(ue, {
|
|
988
|
+
size: w.LG,
|
|
989
|
+
stroke: T,
|
|
994
990
|
"aria-hidden": !0
|
|
995
991
|
}),
|
|
996
|
-
"aria-label":
|
|
997
|
-
tooltipProps: { tooltip:
|
|
998
|
-
onClick:
|
|
992
|
+
"aria-label": M,
|
|
993
|
+
tooltipProps: { tooltip: M },
|
|
994
|
+
onClick: o.type === a.McpApp ? o.onReload : void 0
|
|
999
995
|
}),
|
|
1000
|
-
|
|
1001
|
-
icon:
|
|
1002
|
-
size:
|
|
1003
|
-
stroke:
|
|
996
|
+
ft && /* @__PURE__ */ V(O, {
|
|
997
|
+
icon: V(Ye ? se : ie, {
|
|
998
|
+
size: w.LG,
|
|
999
|
+
stroke: T,
|
|
1004
1000
|
"aria-hidden": !0
|
|
1005
1001
|
}),
|
|
1006
|
-
"aria-label":
|
|
1007
|
-
"aria-pressed":
|
|
1008
|
-
tooltipProps: { tooltip:
|
|
1009
|
-
onClick:
|
|
1002
|
+
"aria-label": Ye ? ce : ne,
|
|
1003
|
+
"aria-pressed": Ye,
|
|
1004
|
+
tooltipProps: { tooltip: Ye ? ce : ne },
|
|
1005
|
+
onClick: it
|
|
1010
1006
|
}),
|
|
1011
|
-
|
|
1012
|
-
icon:
|
|
1013
|
-
size:
|
|
1014
|
-
stroke:
|
|
1007
|
+
$ && /* @__PURE__ */ V(O, {
|
|
1008
|
+
icon: V(We ? re : ae, {
|
|
1009
|
+
size: w.LG,
|
|
1010
|
+
stroke: T,
|
|
1015
1011
|
"aria-hidden": !0
|
|
1016
1012
|
}),
|
|
1017
|
-
"aria-label":
|
|
1018
|
-
tooltipProps: { tooltip:
|
|
1019
|
-
onClick:
|
|
1013
|
+
"aria-label": We ? h : m,
|
|
1014
|
+
tooltipProps: { tooltip: We ? h : m },
|
|
1015
|
+
onClick: tt
|
|
1020
1016
|
}),
|
|
1021
|
-
|
|
1022
|
-
icon:
|
|
1023
|
-
size:
|
|
1024
|
-
stroke:
|
|
1017
|
+
pt && /* @__PURE__ */ V(O, {
|
|
1018
|
+
icon: V(Ke ? re : le, {
|
|
1019
|
+
size: w.LG,
|
|
1020
|
+
stroke: T,
|
|
1025
1021
|
"aria-hidden": !0
|
|
1026
1022
|
}),
|
|
1027
|
-
"aria-label":
|
|
1028
|
-
tooltipProps: { tooltip:
|
|
1029
|
-
onClick:
|
|
1023
|
+
"aria-label": Ke ? v : _,
|
|
1024
|
+
tooltipProps: { tooltip: Ke ? v : _ },
|
|
1025
|
+
onClick: nt
|
|
1030
1026
|
}),
|
|
1031
|
-
|
|
1032
|
-
icon:
|
|
1033
|
-
size:
|
|
1034
|
-
stroke:
|
|
1027
|
+
mt && /* @__PURE__ */ V(O, {
|
|
1028
|
+
icon: V(qe ? re : ae, {
|
|
1029
|
+
size: w.LG,
|
|
1030
|
+
stroke: T,
|
|
1035
1031
|
"aria-hidden": !0
|
|
1036
1032
|
}),
|
|
1037
|
-
"aria-label":
|
|
1038
|
-
tooltipProps: { tooltip:
|
|
1039
|
-
onClick:
|
|
1033
|
+
"aria-label": qe ? x : b,
|
|
1034
|
+
tooltipProps: { tooltip: qe ? x : b },
|
|
1035
|
+
onClick: rt
|
|
1040
1036
|
}),
|
|
1041
|
-
|
|
1042
|
-
icon: /* @__PURE__ */
|
|
1043
|
-
size:
|
|
1044
|
-
stroke:
|
|
1037
|
+
ht && /* @__PURE__ */ V(O, {
|
|
1038
|
+
icon: /* @__PURE__ */ V(oe, {
|
|
1039
|
+
size: w.LG,
|
|
1040
|
+
stroke: T
|
|
1045
1041
|
}),
|
|
1046
|
-
"aria-label":
|
|
1047
|
-
tooltipProps: { tooltip:
|
|
1048
|
-
onClick:
|
|
1042
|
+
"aria-label": p,
|
|
1043
|
+
tooltipProps: { tooltip: p },
|
|
1044
|
+
onClick: Ee
|
|
1049
1045
|
})
|
|
1050
1046
|
] }) : null,
|
|
1051
|
-
children: /* @__PURE__ */
|
|
1052
|
-
content:
|
|
1047
|
+
children: /* @__PURE__ */ V(Le, {
|
|
1048
|
+
content: o,
|
|
1053
1049
|
isLoading: t,
|
|
1050
|
+
loadingContentType: n,
|
|
1054
1051
|
fileName: s,
|
|
1055
|
-
isHtmlSourceView:
|
|
1056
|
-
onAppInfo:
|
|
1057
|
-
onRetry:
|
|
1052
|
+
isHtmlSourceView: Ye,
|
|
1053
|
+
onAppInfo: o.type === a.McpApp ? Qe : void 0,
|
|
1054
|
+
onRetry: i,
|
|
1058
1055
|
labels: {
|
|
1059
1056
|
unsupportedLabel: D,
|
|
1060
|
-
loadErrorLabel:
|
|
1057
|
+
loadErrorLabel: ee,
|
|
1061
1058
|
loadErrorRetryLabel: k,
|
|
1062
1059
|
forbiddenErrorLabel: A,
|
|
1063
|
-
visualizerErrorLabel:
|
|
1064
|
-
htmlFrameBlockedLabel:
|
|
1065
|
-
htmlOpenInNewTabLabel:
|
|
1066
|
-
pdfThumbnailsLabel:
|
|
1067
|
-
pdfShowThumbnailsLabel:
|
|
1068
|
-
pdfHideThumbnailsLabel:
|
|
1069
|
-
pdfPageNumberLabel:
|
|
1070
|
-
pdfContentLoadingLabel:
|
|
1071
|
-
pdfContentErrorLabel:
|
|
1072
|
-
pdfContentRetryLabel:
|
|
1073
|
-
xlsxFormulaLabel:
|
|
1074
|
-
codeContentLoadingLabel:
|
|
1075
|
-
codeContentErrorLabel:
|
|
1076
|
-
codeContentRetryLabel:
|
|
1077
|
-
tableCopyLabel:
|
|
1078
|
-
tableCopiedLabel:
|
|
1079
|
-
tableDownloadCsvLabel:
|
|
1080
|
-
codeBlockCopyLabel:
|
|
1081
|
-
codeBlockCopiedLabel:
|
|
1082
|
-
codeBlockDownloadLabel:
|
|
1083
|
-
tableScrollRegionAriaLabel:
|
|
1084
|
-
mathScrollRegionAriaLabel:
|
|
1085
|
-
ooxmlHighlightsLabel:
|
|
1086
|
-
ooxmlHighlightNavigatedLabel:
|
|
1087
|
-
loadingLabel:
|
|
1060
|
+
visualizerErrorLabel: E,
|
|
1061
|
+
htmlFrameBlockedLabel: te,
|
|
1062
|
+
htmlOpenInNewTabLabel: j,
|
|
1063
|
+
pdfThumbnailsLabel: N,
|
|
1064
|
+
pdfShowThumbnailsLabel: P,
|
|
1065
|
+
pdfHideThumbnailsLabel: de,
|
|
1066
|
+
pdfPageNumberLabel: fe,
|
|
1067
|
+
pdfContentLoadingLabel: pe,
|
|
1068
|
+
pdfContentErrorLabel: me,
|
|
1069
|
+
pdfContentRetryLabel: U,
|
|
1070
|
+
xlsxFormulaLabel: he,
|
|
1071
|
+
codeContentLoadingLabel: G,
|
|
1072
|
+
codeContentErrorLabel: K,
|
|
1073
|
+
codeContentRetryLabel: ge,
|
|
1074
|
+
tableCopyLabel: _e,
|
|
1075
|
+
tableCopiedLabel: ve,
|
|
1076
|
+
tableDownloadCsvLabel: ye,
|
|
1077
|
+
codeBlockCopyLabel: be,
|
|
1078
|
+
codeBlockCopiedLabel: xe,
|
|
1079
|
+
codeBlockDownloadLabel: q,
|
|
1080
|
+
tableScrollRegionAriaLabel: Se,
|
|
1081
|
+
mathScrollRegionAriaLabel: J,
|
|
1082
|
+
ooxmlHighlightsLabel: Ce,
|
|
1083
|
+
ooxmlHighlightNavigatedLabel: we,
|
|
1084
|
+
loadingLabel: Te
|
|
1088
1085
|
},
|
|
1089
|
-
styles:
|
|
1090
|
-
codeBlockTheme:
|
|
1091
|
-
tableDownloadFilename:
|
|
1092
|
-
loadPdf:
|
|
1093
|
-
configurePdfWorker:
|
|
1094
|
-
onVisualizerSendMessage:
|
|
1095
|
-
mcpAppHostContext:
|
|
1086
|
+
styles: st,
|
|
1087
|
+
codeBlockTheme: Ie,
|
|
1088
|
+
tableDownloadFilename: ke,
|
|
1089
|
+
loadPdf: Be,
|
|
1090
|
+
configurePdfWorker: Ve,
|
|
1091
|
+
onVisualizerSendMessage: He,
|
|
1092
|
+
mcpAppHostContext: Ue
|
|
1096
1093
|
})
|
|
1097
1094
|
});
|
|
1098
|
-
}),
|
|
1099
|
-
docx:
|
|
1100
|
-
xlsx:
|
|
1101
|
-
pptx:
|
|
1102
|
-
},
|
|
1103
|
-
docx:
|
|
1104
|
-
xlsx:
|
|
1105
|
-
pptx:
|
|
1106
|
-
csv:
|
|
1095
|
+
}), Ve = /* @__PURE__ */ new Set(["html", "htm"]), He = {
|
|
1096
|
+
docx: m.DOCX,
|
|
1097
|
+
xlsx: m.XLSX,
|
|
1098
|
+
pptx: m.PPTX
|
|
1099
|
+
}, Ue = /* @__PURE__ */ 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(".")), We = {
|
|
1100
|
+
docx: i.Docx,
|
|
1101
|
+
xlsx: i.Xlsx,
|
|
1102
|
+
pptx: i.Pptx,
|
|
1103
|
+
csv: i.Csv
|
|
1104
|
+
}, Ge = {
|
|
1105
|
+
[He.docx]: i.Docx,
|
|
1106
|
+
[He.xlsx]: i.Xlsx,
|
|
1107
|
+
[He.pptx]: i.Pptx,
|
|
1108
|
+
[m.CSV]: i.Csv
|
|
1107
1109
|
}, Ke = {
|
|
1108
|
-
[
|
|
1109
|
-
[
|
|
1110
|
-
[
|
|
1111
|
-
[
|
|
1112
|
-
},
|
|
1113
|
-
[r.Docx]: Q.docx,
|
|
1114
|
-
[r.Xlsx]: Q.xlsx,
|
|
1115
|
-
[r.Pptx]: Q.pptx,
|
|
1116
|
-
[r.Csv]: f.CSV
|
|
1117
|
-
}, Je = (e, t) => {
|
|
1110
|
+
[i.Docx]: He.docx,
|
|
1111
|
+
[i.Xlsx]: He.xlsx,
|
|
1112
|
+
[i.Pptx]: He.pptx,
|
|
1113
|
+
[i.Csv]: m.CSV
|
|
1114
|
+
}, Z = (e, t) => {
|
|
1118
1115
|
let n = t?.split(";", 1)[0].trim().toLowerCase();
|
|
1119
1116
|
if (n != null) {
|
|
1120
|
-
let e =
|
|
1117
|
+
let e = Ge[n];
|
|
1121
1118
|
if (e != null) return e;
|
|
1122
1119
|
}
|
|
1123
1120
|
let r = e.lastIndexOf(".");
|
|
1124
|
-
if (r !== -1) return
|
|
1125
|
-
},
|
|
1126
|
-
let n =
|
|
1127
|
-
return n == null ? void 0 :
|
|
1128
|
-
},
|
|
1129
|
-
let t = e.lastIndexOf(".");
|
|
1130
|
-
return t !== -1 && We.has(e.slice(t + 1).toLowerCase());
|
|
1131
|
-
}, Qe = (e) => {
|
|
1121
|
+
if (r !== -1) return We[e.slice(r + 1).toLowerCase()];
|
|
1122
|
+
}, qe = (e, t) => Z(e, t) != null, Je = (e, t) => {
|
|
1123
|
+
let n = Z(e, t);
|
|
1124
|
+
return n == null ? void 0 : Ke[n];
|
|
1125
|
+
}, Ye = (e) => {
|
|
1132
1126
|
let t = e.lastIndexOf(".");
|
|
1133
1127
|
return t !== -1 && Ue.has(e.slice(t + 1).toLowerCase());
|
|
1134
|
-
},
|
|
1128
|
+
}, Xe = (e) => {
|
|
1129
|
+
let t = e.lastIndexOf(".");
|
|
1130
|
+
return t !== -1 && Ve.has(e.slice(t + 1).toLowerCase());
|
|
1131
|
+
}, Ze = {
|
|
1135
1132
|
xml: "xml",
|
|
1136
1133
|
csv: "plaintext",
|
|
1137
1134
|
tsv: "plaintext",
|
|
@@ -1179,107 +1176,110 @@ var pe = Object.defineProperty, me = (e, t) => {
|
|
|
1179
1176
|
gitignore: "plaintext",
|
|
1180
1177
|
dockerfile: "plaintext",
|
|
1181
1178
|
makefile: "plaintext"
|
|
1182
|
-
},
|
|
1183
|
-
type:
|
|
1179
|
+
}, Qe = (e) => Ze[e], Q = (e) => ({
|
|
1180
|
+
type: a.Unsupported,
|
|
1184
1181
|
...e != null && { url: e }
|
|
1185
|
-
}),
|
|
1186
|
-
type:
|
|
1187
|
-
errorType:
|
|
1182
|
+
}), $e = (e) => ({
|
|
1183
|
+
type: a.Error,
|
|
1184
|
+
errorType: r.LoadFailed,
|
|
1188
1185
|
...e != null && { url: e }
|
|
1189
|
-
}),
|
|
1190
|
-
type:
|
|
1191
|
-
errorType:
|
|
1186
|
+
}), et = (e) => ({
|
|
1187
|
+
type: a.Error,
|
|
1188
|
+
errorType: r.Forbidden,
|
|
1192
1189
|
...e != null && { url: e }
|
|
1193
|
-
}),
|
|
1194
|
-
if (e.type ===
|
|
1195
|
-
},
|
|
1196
|
-
let t =
|
|
1190
|
+
}), tt = (e) => {
|
|
1191
|
+
if (e.type === a.Image || e.type === a.Audio || e.type === a.Pdf || e.type === a.Ooxml) return e.url.startsWith("blob:") ? e.url : void 0;
|
|
1192
|
+
}, nt = (e) => {
|
|
1193
|
+
let t = tt(e);
|
|
1197
1194
|
t != null && URL.revokeObjectURL(t);
|
|
1198
|
-
},
|
|
1199
|
-
type:
|
|
1195
|
+
}, rt = {
|
|
1196
|
+
type: a.PlainText,
|
|
1200
1197
|
text: ""
|
|
1201
|
-
},
|
|
1202
|
-
|
|
1203
|
-
var
|
|
1204
|
-
let t =
|
|
1198
|
+
}, it = M(void 0);
|
|
1199
|
+
it.displayName = "AttachmentCanvasContext";
|
|
1200
|
+
var at = M(void 0), ot = ({ children: e }) => {
|
|
1201
|
+
let t = R(0), n = F(() => {
|
|
1205
1202
|
let e = ++t.current;
|
|
1206
1203
|
return () => e === t.current;
|
|
1207
1204
|
}, []);
|
|
1208
|
-
|
|
1205
|
+
I(() => () => {
|
|
1209
1206
|
t.current += 1;
|
|
1210
1207
|
}, []);
|
|
1211
|
-
let [r, i] =
|
|
1212
|
-
|
|
1213
|
-
}, []),
|
|
1214
|
-
|
|
1215
|
-
}, []),
|
|
1216
|
-
|
|
1208
|
+
let [r, i] = z(!1), [a, o] = z(!1), [s, c] = z(void 0), [l, u] = z(rt), [d, f] = z(void 0), [p, m] = z(void 0), [h, g] = z(void 0), _ = F((e, t, n) => {
|
|
1209
|
+
f(e), m(t), c(n), g(void 0), o(!0), i(!0);
|
|
1210
|
+
}, []), v = F((e, t, n, r) => {
|
|
1211
|
+
u(e), f(t), m(n), g(r == null ? void 0 : () => r), o(!1), c(void 0), i(!0);
|
|
1212
|
+
}, []), y = F(() => {
|
|
1213
|
+
u(rt), i(!1), o(!1), c(void 0), m(void 0), g(void 0);
|
|
1217
1214
|
}, []);
|
|
1218
|
-
return
|
|
1219
|
-
let e =
|
|
1215
|
+
return I(() => () => {
|
|
1216
|
+
let e = tt(l);
|
|
1220
1217
|
e != null && URL.revokeObjectURL(e);
|
|
1221
|
-
}, [
|
|
1222
|
-
value:
|
|
1218
|
+
}, [l]), /* @__PURE__ */ V(it.Provider, {
|
|
1219
|
+
value: L(() => ({
|
|
1223
1220
|
isOpen: r,
|
|
1224
1221
|
isLoading: a,
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1222
|
+
loadingContentType: s,
|
|
1223
|
+
content: l,
|
|
1224
|
+
fileName: d,
|
|
1225
|
+
attachmentId: p,
|
|
1226
|
+
openCanvasLoading: _,
|
|
1227
|
+
openCanvas: v,
|
|
1228
|
+
closeCanvas: y,
|
|
1229
|
+
retryCanvas: h
|
|
1232
1230
|
}), [
|
|
1233
1231
|
r,
|
|
1234
1232
|
a,
|
|
1235
1233
|
s,
|
|
1236
1234
|
l,
|
|
1237
1235
|
d,
|
|
1238
|
-
|
|
1239
|
-
g,
|
|
1236
|
+
p,
|
|
1240
1237
|
_,
|
|
1241
|
-
|
|
1238
|
+
v,
|
|
1239
|
+
y,
|
|
1240
|
+
h
|
|
1242
1241
|
]),
|
|
1243
|
-
children: /* @__PURE__ */
|
|
1242
|
+
children: /* @__PURE__ */ V(at.Provider, {
|
|
1244
1243
|
value: n,
|
|
1245
1244
|
children: e
|
|
1246
1245
|
})
|
|
1247
1246
|
});
|
|
1248
|
-
},
|
|
1249
|
-
let e =
|
|
1247
|
+
}, st = () => {
|
|
1248
|
+
let e = de(it);
|
|
1250
1249
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
1251
1250
|
return e;
|
|
1252
|
-
},
|
|
1253
|
-
let e =
|
|
1251
|
+
}, ct = () => de(at), lt = () => {
|
|
1252
|
+
let e = de(at);
|
|
1254
1253
|
if (!e) throw Error("useLatestCanvasRequest must be used within an AttachmentCanvasProvider");
|
|
1255
|
-
let t =
|
|
1256
|
-
return
|
|
1254
|
+
let t = R(void 0);
|
|
1255
|
+
return I(() => (t.current = {}, () => {
|
|
1257
1256
|
t.current = void 0;
|
|
1258
|
-
}), []),
|
|
1257
|
+
}), []), F(() => {
|
|
1259
1258
|
let n = t.current, r = e();
|
|
1260
1259
|
return () => n !== void 0 && t.current === n && r();
|
|
1261
1260
|
}, [e]);
|
|
1262
|
-
},
|
|
1263
|
-
let { ariaLabel:
|
|
1264
|
-
|
|
1265
|
-
}, [
|
|
1266
|
-
(
|
|
1267
|
-
}, [
|
|
1268
|
-
|
|
1269
|
-
}, [
|
|
1270
|
-
|
|
1271
|
-
}, [
|
|
1272
|
-
return /* @__PURE__ */
|
|
1273
|
-
isOpen:
|
|
1274
|
-
isLoading:
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1261
|
+
}, ut = P(({ labels: e, leftActions: t, isMobile: n = !1, isBoundedOverlay: r = !1, defaultWidth: i, minWidth: s, maxWidth: c, codeBlockTheme: l, tableDownloadFilename: u, loadPdf: d, configurePdfWorker: f, onVisualizerSendMessage: p, mcpAppHostContext: m }) => {
|
|
1262
|
+
let { ariaLabel: h = "Attachment preview", closeLabel: g = "Close", downloadLabel: v = "Download", unsupportedLabel: y = "Preview is not supported for this file", loadErrorLabel: b = "Failed to load file", loadErrorRetryLabel: x, forbiddenErrorLabel: S = "You don't have permission to access this file", copyTextLabel: C, copiedTextLabel: w, copyMarkdownLabel: T, copiedMarkdownLabel: E, copyJsonLabel: D, copiedJsonLabel: O, htmlFrameBlockedLabel: ee, htmlOpenInNewTabLabel: k, htmlViewSourceLabel: A, htmlViewRenderedLabel: te, pdfThumbnailsLabel: j, pdfShowThumbnailsLabel: ne, pdfHideThumbnailsLabel: re, pdfPageNumberLabel: ie, pdfContentLoadingLabel: ae, pdfContentErrorLabel: oe, pdfContentRetryLabel: se, xlsxFormulaLabel: ce, codeContentLoadingLabel: le, codeContentErrorLabel: ue, codeContentRetryLabel: M, tableCopyLabel: N, tableCopiedLabel: P, tableDownloadCsvLabel: de, codeBlockCopyLabel: I, codeBlockCopiedLabel: L, codeBlockDownloadLabel: R, tableScrollRegionAriaLabel: z, mathScrollRegionAriaLabel: fe, ooxmlHighlightsLabel: pe, ooxmlHighlightNavigatedLabel: B, loadingLabel: H } = e ?? {}, { isOpen: me, isLoading: U, loadingContentType: he, content: W, fileName: G, closeCanvas: K, retryCanvas: ge } = st(), _e = F(() => {
|
|
1263
|
+
o(W, G);
|
|
1264
|
+
}, [W, G]), ve = F(() => {
|
|
1265
|
+
(W.type === a.PlainText || W.type === a.Code) && _(W.text);
|
|
1266
|
+
}, [W]), ye = F(() => {
|
|
1267
|
+
W.type === a.Markdown && _(W.text);
|
|
1268
|
+
}, [W]), be = F(() => {
|
|
1269
|
+
W.type === a.Json && _(JSON.stringify(W.value, null, 2));
|
|
1270
|
+
}, [W]);
|
|
1271
|
+
return /* @__PURE__ */ V(Be, {
|
|
1272
|
+
isOpen: me,
|
|
1273
|
+
isLoading: U,
|
|
1274
|
+
loadingContentType: he,
|
|
1275
|
+
onClose: K,
|
|
1276
|
+
onRetry: ge,
|
|
1277
|
+
content: W,
|
|
1278
|
+
fileName: G,
|
|
1279
1279
|
leftActions: t,
|
|
1280
1280
|
labels: {
|
|
1281
|
-
ariaLabel:
|
|
1282
|
-
closeLabel:
|
|
1281
|
+
ariaLabel: h,
|
|
1282
|
+
closeLabel: g,
|
|
1283
1283
|
downloadLabel: v,
|
|
1284
1284
|
copyTextLabel: C,
|
|
1285
1285
|
copiedTextLabel: w,
|
|
@@ -1291,41 +1291,41 @@ var st = F(void 0), ct = ({ children: e }) => {
|
|
|
1291
1291
|
loadErrorLabel: b,
|
|
1292
1292
|
loadErrorRetryLabel: x,
|
|
1293
1293
|
forbiddenErrorLabel: S,
|
|
1294
|
-
htmlFrameBlockedLabel:
|
|
1295
|
-
htmlOpenInNewTabLabel:
|
|
1296
|
-
htmlViewSourceLabel:
|
|
1297
|
-
htmlViewRenderedLabel:
|
|
1298
|
-
pdfThumbnailsLabel:
|
|
1299
|
-
pdfShowThumbnailsLabel:
|
|
1300
|
-
pdfHideThumbnailsLabel:
|
|
1301
|
-
pdfPageNumberLabel:
|
|
1302
|
-
pdfContentLoadingLabel:
|
|
1303
|
-
pdfContentErrorLabel:
|
|
1304
|
-
pdfContentRetryLabel:
|
|
1305
|
-
xlsxFormulaLabel:
|
|
1306
|
-
codeContentLoadingLabel:
|
|
1307
|
-
codeContentErrorLabel:
|
|
1308
|
-
codeContentRetryLabel:
|
|
1309
|
-
tableCopyLabel:
|
|
1310
|
-
tableCopiedLabel:
|
|
1311
|
-
tableDownloadCsvLabel:
|
|
1312
|
-
codeBlockCopyLabel:
|
|
1313
|
-
codeBlockCopiedLabel:
|
|
1314
|
-
codeBlockDownloadLabel:
|
|
1315
|
-
tableScrollRegionAriaLabel:
|
|
1316
|
-
mathScrollRegionAriaLabel:
|
|
1317
|
-
ooxmlHighlightsLabel:
|
|
1318
|
-
ooxmlHighlightNavigatedLabel:
|
|
1319
|
-
loadingLabel:
|
|
1294
|
+
htmlFrameBlockedLabel: ee,
|
|
1295
|
+
htmlOpenInNewTabLabel: k,
|
|
1296
|
+
htmlViewSourceLabel: A,
|
|
1297
|
+
htmlViewRenderedLabel: te,
|
|
1298
|
+
pdfThumbnailsLabel: j,
|
|
1299
|
+
pdfShowThumbnailsLabel: ne,
|
|
1300
|
+
pdfHideThumbnailsLabel: re,
|
|
1301
|
+
pdfPageNumberLabel: ie,
|
|
1302
|
+
pdfContentLoadingLabel: ae,
|
|
1303
|
+
pdfContentErrorLabel: oe,
|
|
1304
|
+
pdfContentRetryLabel: se,
|
|
1305
|
+
xlsxFormulaLabel: ce,
|
|
1306
|
+
codeContentLoadingLabel: le,
|
|
1307
|
+
codeContentErrorLabel: ue,
|
|
1308
|
+
codeContentRetryLabel: M,
|
|
1309
|
+
tableCopyLabel: N,
|
|
1310
|
+
tableCopiedLabel: P,
|
|
1311
|
+
tableDownloadCsvLabel: de,
|
|
1312
|
+
codeBlockCopyLabel: I,
|
|
1313
|
+
codeBlockCopiedLabel: L,
|
|
1314
|
+
codeBlockDownloadLabel: R,
|
|
1315
|
+
tableScrollRegionAriaLabel: z,
|
|
1316
|
+
mathScrollRegionAriaLabel: fe,
|
|
1317
|
+
ooxmlHighlightsLabel: pe,
|
|
1318
|
+
ooxmlHighlightNavigatedLabel: B,
|
|
1319
|
+
loadingLabel: H
|
|
1320
1320
|
},
|
|
1321
|
-
onDownload:
|
|
1322
|
-
onCopyText:
|
|
1323
|
-
onCopyMarkdown:
|
|
1324
|
-
onCopyJson:
|
|
1321
|
+
onDownload: _e,
|
|
1322
|
+
onCopyText: W.type === a.PlainText || W.type === a.Code ? ve : void 0,
|
|
1323
|
+
onCopyMarkdown: W.type === a.Markdown ? ye : void 0,
|
|
1324
|
+
onCopyJson: W.type === a.Json ? be : void 0,
|
|
1325
1325
|
tableDownloadFilename: u,
|
|
1326
1326
|
isMobile: n,
|
|
1327
1327
|
isBoundedOverlay: r,
|
|
1328
|
-
defaultWidth:
|
|
1328
|
+
defaultWidth: i,
|
|
1329
1329
|
minWidth: s,
|
|
1330
1330
|
maxWidth: c,
|
|
1331
1331
|
codeBlockTheme: l,
|
|
@@ -1334,43 +1334,43 @@ var st = F(void 0), ct = ({ children: e }) => {
|
|
|
1334
1334
|
onVisualizerSendMessage: p,
|
|
1335
1335
|
mcpAppHostContext: m
|
|
1336
1336
|
});
|
|
1337
|
-
}),
|
|
1337
|
+
}), dt = {
|
|
1338
1338
|
frame: "_frame_1ys0b_1",
|
|
1339
1339
|
header: "_header_1ys0b_6",
|
|
1340
1340
|
title: "_title_1ys0b_10"
|
|
1341
|
-
},
|
|
1342
|
-
let p = e.visualizerName.trim(),
|
|
1343
|
-
return /* @__PURE__ */
|
|
1344
|
-
className:
|
|
1345
|
-
style:
|
|
1341
|
+
}, ft = P(({ content: e, height: t, onExpand: n, expandAriaLabel: r, actionsGroupAriaLabel: i = "Visualizer actions", frameTitle: a, loadingLabel: o, errorLabel: s, titleClassName: c = "dial-small-semi-text", isBorderless: l = !1, isTitleHidden: u = !1, colors: d, onVisualizerSendMessage: f }) => {
|
|
1342
|
+
let p = e.visualizerName.trim(), m = !u && p !== "";
|
|
1343
|
+
return /* @__PURE__ */ H("div", {
|
|
1344
|
+
className: y("flex w-full min-w-0 flex-col overflow-hidden", !l && ["rounded-xl border", dt.frame]),
|
|
1345
|
+
style: g({
|
|
1346
1346
|
"--igv-bg": d?.background,
|
|
1347
1347
|
"--igv-border": d?.border,
|
|
1348
1348
|
"--igv-title-text": d?.titleText
|
|
1349
1349
|
}),
|
|
1350
|
-
children: [/* @__PURE__ */
|
|
1351
|
-
className:
|
|
1352
|
-
children: [
|
|
1353
|
-
className:
|
|
1350
|
+
children: [/* @__PURE__ */ H("div", {
|
|
1351
|
+
className: y("flex min-h-10 items-center gap-2 py-2", m ? "justify-between" : "justify-end", !l && ["border-b px-4", dt.header]),
|
|
1352
|
+
children: [m && /* @__PURE__ */ V("span", {
|
|
1353
|
+
className: y("min-w-0 truncate", c, dt.title),
|
|
1354
1354
|
children: p
|
|
1355
|
-
}), /* @__PURE__ */
|
|
1355
|
+
}), /* @__PURE__ */ V("div", {
|
|
1356
1356
|
role: "toolbar",
|
|
1357
1357
|
"aria-label": i,
|
|
1358
1358
|
className: "flex items-center gap-1",
|
|
1359
|
-
children: /* @__PURE__ */
|
|
1360
|
-
icon: /* @__PURE__ */
|
|
1361
|
-
size:
|
|
1362
|
-
stroke:
|
|
1359
|
+
children: /* @__PURE__ */ V(O, {
|
|
1360
|
+
icon: /* @__PURE__ */ V(ne, {
|
|
1361
|
+
size: w.SM,
|
|
1362
|
+
stroke: T,
|
|
1363
1363
|
"aria-hidden": !0
|
|
1364
1364
|
}),
|
|
1365
1365
|
"aria-label": r,
|
|
1366
|
-
size:
|
|
1366
|
+
size: E.Small,
|
|
1367
1367
|
onClick: n
|
|
1368
1368
|
})
|
|
1369
1369
|
})]
|
|
1370
|
-
}), /* @__PURE__ */
|
|
1370
|
+
}), /* @__PURE__ */ V("div", {
|
|
1371
1371
|
className: "w-full",
|
|
1372
1372
|
style: { height: `${t}px` },
|
|
1373
|
-
children: /* @__PURE__ */
|
|
1373
|
+
children: /* @__PURE__ */ V(Ne, {
|
|
1374
1374
|
content: e,
|
|
1375
1375
|
loadingLabel: o,
|
|
1376
1376
|
errorLabel: s,
|
|
@@ -1379,163 +1379,32 @@ var st = F(void 0), ct = ({ children: e }) => {
|
|
|
1379
1379
|
})
|
|
1380
1380
|
})]
|
|
1381
1381
|
});
|
|
1382
|
-
}),
|
|
1383
|
-
name: "MCP-UI Host",
|
|
1384
|
-
version: "1.0.0"
|
|
1385
|
-
}, gt = { openLinks: {} }, _t = (e) => {
|
|
1386
|
-
let t;
|
|
1387
|
-
try {
|
|
1388
|
-
t = new URL(e);
|
|
1389
|
-
} catch {
|
|
1390
|
-
return !1;
|
|
1391
|
-
}
|
|
1392
|
-
if (t.protocol !== "http:" && t.protocol !== "https:") return !1;
|
|
1393
|
-
try {
|
|
1394
|
-
window.open(e, "_blank", "noopener,noreferrer");
|
|
1395
|
-
} catch {
|
|
1396
|
-
return !1;
|
|
1397
|
-
}
|
|
1398
|
-
return !0;
|
|
1399
|
-
}, vt = (e, t, n) => {
|
|
1400
|
-
if (n) {
|
|
1401
|
-
e.style.maxWidth = "", e.style.maxHeight = "";
|
|
1402
|
-
return;
|
|
1403
|
-
}
|
|
1404
|
-
let r = t;
|
|
1405
|
-
r != null && (r.width != null && (e.style.width = `${r.width}px`), r.maxWidth != null && (e.style.maxWidth = `${r.maxWidth}px`), r.height != null && (e.style.height = `${r.height}px`), r.maxHeight != null && (e.style.maxHeight = `${r.maxHeight}px`));
|
|
1406
|
-
}, yt = (e, t, n) => {
|
|
1407
|
-
let r = H(e);
|
|
1408
|
-
B(() => {
|
|
1409
|
-
r.current = e;
|
|
1410
|
-
});
|
|
1411
|
-
let i = H(n);
|
|
1412
|
-
B(() => {
|
|
1413
|
-
i.current = n;
|
|
1414
|
-
});
|
|
1415
|
-
let [a, o] = U(null), [s, c] = U(!1);
|
|
1416
|
-
return B(() => {
|
|
1417
|
-
let e = null;
|
|
1418
|
-
try {
|
|
1419
|
-
let n = t.current?.getBoundingClientRect(), a = i.current ?? r.current.hostContext, s = n != null && n.width > 0 && n.height > 0 ? {
|
|
1420
|
-
...a,
|
|
1421
|
-
containerDimensions: {
|
|
1422
|
-
width: Math.round(n.width),
|
|
1423
|
-
height: Math.round(n.height)
|
|
1424
|
-
}
|
|
1425
|
-
} : a;
|
|
1426
|
-
e = new de(null, r.current.hostInfo ?? ht, gt, { hostContext: s }), e.onopenlink = async ({ url: e }) => {
|
|
1427
|
-
let t = r.current.onOpenLink;
|
|
1428
|
-
return (t == null ? _t(e) : t(e)) === !1 ? { isError: !0 } : {};
|
|
1429
|
-
}, e.onrequestdisplaymode = async ({ mode: e }) => {
|
|
1430
|
-
let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
|
|
1431
|
-
return { mode: t?.(e) ?? n };
|
|
1432
|
-
}, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(fe, ({ params: e }) => {
|
|
1433
|
-
let n = t.current?.querySelector("iframe");
|
|
1434
|
-
n != null && vt(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
|
|
1435
|
-
}), o(e);
|
|
1436
|
-
} catch (e) {
|
|
1437
|
-
console.error("[useMcpAppBridge] Error creating AppBridge:", e), c(!0);
|
|
1438
|
-
}
|
|
1439
|
-
return () => {
|
|
1440
|
-
e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
|
|
1441
|
-
};
|
|
1442
|
-
}, [t]), B(() => {
|
|
1443
|
-
a != null && a.transport != null && n != null && a.setHostContext(n);
|
|
1444
|
-
}, [a, n]), {
|
|
1445
|
-
appBridge: a,
|
|
1446
|
-
hasFailed: s,
|
|
1447
|
-
replayHostContext: R(() => {
|
|
1448
|
-
let e = i.current;
|
|
1449
|
-
a != null && a.transport != null && e != null && a.setHostContext(e);
|
|
1450
|
-
}, [a])
|
|
1451
|
-
};
|
|
1452
|
-
}, bt = {
|
|
1453
|
-
loadingOverlay: "_loadingOverlay_1kink_2",
|
|
1454
|
-
fullscreenFrame: "_fullscreenFrame_1kink_21",
|
|
1455
|
-
loadingFrame: "_loadingFrame_1kink_29",
|
|
1456
|
-
statusLabel: "_statusLabel_1kink_33",
|
|
1457
|
-
statusDetail: "_statusDetail_1kink_38",
|
|
1458
|
-
errorIcon: "_errorIcon_1kink_42"
|
|
1459
|
-
}, xt = /* @__PURE__ */ me({ McpAppCanvasRenderer: () => St }), St = ({ content: e, errorLabel: t = "Failed to load app", loadingLabel: n = "Loading…", onAppInfo: r, hostContext: i }) => {
|
|
1460
|
-
let [a, o] = U("loading"), [s, c] = U(), { html: l, sandboxUrl: u, toolInput: d, toolResult: f } = e, p = i ?? e.hostContext, m = V(() => ({ url: new URL(u) }), [u]), h = p?.displayMode === "fullscreen", g = H(null), [v, y] = U();
|
|
1461
|
-
B(() => {
|
|
1462
|
-
let e = g.current;
|
|
1463
|
-
if (!e) return;
|
|
1464
|
-
let t = new ResizeObserver(([e]) => {
|
|
1465
|
-
if (!e) return;
|
|
1466
|
-
let { width: t, height: n } = e.contentRect;
|
|
1467
|
-
y({
|
|
1468
|
-
width: Math.round(t),
|
|
1469
|
-
height: Math.round(n)
|
|
1470
|
-
});
|
|
1471
|
-
});
|
|
1472
|
-
return t.observe(e), () => t.disconnect();
|
|
1473
|
-
}, []);
|
|
1474
|
-
let { appBridge: b, hasFailed: x, replayHostContext: S } = yt(e, g, V(() => p == null || v == null ? p : {
|
|
1475
|
-
...p,
|
|
1476
|
-
containerDimensions: v
|
|
1477
|
-
}, [p, v])), w = x || a === "error";
|
|
1478
|
-
return /* @__PURE__ */ G("div", {
|
|
1479
|
-
ref: g,
|
|
1480
|
-
className: _("relative h-full w-full", w ? "min-h-[160px]" : "min-h-[100px]", h && bt.fullscreenFrame, !h && a === "loading" && bt.loadingFrame),
|
|
1481
|
-
children: [
|
|
1482
|
-
b != null && !w && /* @__PURE__ */ W(q, {
|
|
1483
|
-
html: l,
|
|
1484
|
-
sandbox: m,
|
|
1485
|
-
appBridge: b,
|
|
1486
|
-
toolInput: d,
|
|
1487
|
-
toolResult: f,
|
|
1488
|
-
onSizeChanged: () => o("ready"),
|
|
1489
|
-
onInitialized: (e) => {
|
|
1490
|
-
o("ready"), S(), e.appVersion != null && r?.(e.appVersion);
|
|
1491
|
-
},
|
|
1492
|
-
onError: (e) => {
|
|
1493
|
-
c(e.message), o("error");
|
|
1494
|
-
}
|
|
1495
|
-
}),
|
|
1496
|
-
!w && a === "loading" && /* @__PURE__ */ W("div", {
|
|
1497
|
-
className: _("absolute inset-0 flex flex-col items-center justify-center gap-2", bt.loadingOverlay),
|
|
1498
|
-
children: /* @__PURE__ */ W(A, { ariaLabel: n })
|
|
1499
|
-
}),
|
|
1500
|
-
/* @__PURE__ */ W(O, {
|
|
1501
|
-
visuallyHidden: !0,
|
|
1502
|
-
children: w && [t, s].filter(Boolean).join(". ")
|
|
1503
|
-
}),
|
|
1504
|
-
w && /* @__PURE__ */ G("div", {
|
|
1505
|
-
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
|
|
1506
|
-
children: [/* @__PURE__ */ W(j, {
|
|
1507
|
-
size: 60,
|
|
1508
|
-
stroke: C,
|
|
1509
|
-
"aria-hidden": !0,
|
|
1510
|
-
className: bt.errorIcon
|
|
1511
|
-
}), /* @__PURE__ */ G("p", {
|
|
1512
|
-
"aria-hidden": !0,
|
|
1513
|
-
className: _("text-center", bt.statusLabel),
|
|
1514
|
-
children: [t, s && /* @__PURE__ */ G(ce, { children: [/* @__PURE__ */ W("br", {}), /* @__PURE__ */ W("span", {
|
|
1515
|
-
className: bt.statusDetail,
|
|
1516
|
-
children: s
|
|
1517
|
-
})] })]
|
|
1518
|
-
})]
|
|
1519
|
-
})
|
|
1520
|
-
]
|
|
1521
|
-
});
|
|
1522
|
-
}, Ct = /* @__PURE__ */ function(e) {
|
|
1382
|
+
}), $ = /* @__PURE__ */ function(e) {
|
|
1523
1383
|
return e.Pdf = "resolvePdfContent", e.Markdown = "resolveMarkdownContent", e.Json = "resolveJsonContent", e;
|
|
1524
|
-
}({}),
|
|
1525
|
-
[
|
|
1526
|
-
[
|
|
1527
|
-
[
|
|
1528
|
-
},
|
|
1529
|
-
[
|
|
1530
|
-
[
|
|
1531
|
-
[
|
|
1532
|
-
[
|
|
1533
|
-
},
|
|
1384
|
+
}({}), pt = {
|
|
1385
|
+
[m.PDF]: $.Pdf,
|
|
1386
|
+
[m.Markdown]: $.Markdown,
|
|
1387
|
+
[m.JSON]: $.Json
|
|
1388
|
+
}, mt = {
|
|
1389
|
+
[p.Markdown]: $.Markdown,
|
|
1390
|
+
[p.MarkdownAlt]: $.Markdown,
|
|
1391
|
+
[p.JSON]: $.Json,
|
|
1392
|
+
[p.PDF]: $.Pdf
|
|
1393
|
+
}, ht = (e, t) => {
|
|
1394
|
+
let n = e.contentType.toLowerCase();
|
|
1395
|
+
if (Y(n, t) != null || Z("", n) != null) return;
|
|
1396
|
+
let r = pt[n];
|
|
1397
|
+
if (r != null) return r === $.Pdf ? a.Pdf : void 0;
|
|
1398
|
+
let i = e.name ?? "";
|
|
1399
|
+
if (Z(i) != null) return;
|
|
1400
|
+
let o = i.lastIndexOf(".");
|
|
1401
|
+
return mt[o === -1 ? "" : i.slice(o + 1).toLowerCase()] === $.Pdf ? a.Pdf : void 0;
|
|
1402
|
+
}, gt = (e) => {
|
|
1534
1403
|
let t;
|
|
1535
1404
|
try {
|
|
1536
1405
|
t = new URL(e).pathname;
|
|
1537
1406
|
} catch {
|
|
1538
|
-
t =
|
|
1407
|
+
t = x(e);
|
|
1539
1408
|
}
|
|
1540
1409
|
let n = t.split("/").filter(Boolean).pop() ?? "";
|
|
1541
1410
|
try {
|
|
@@ -1543,90 +1412,91 @@ var st = F(void 0), ct = ({ children: e }) => {
|
|
|
1543
1412
|
} catch {
|
|
1544
1413
|
return n;
|
|
1545
1414
|
}
|
|
1546
|
-
},
|
|
1547
|
-
let { openCanvas: n, openCanvasLoading: r, closeCanvas:
|
|
1415
|
+
}, _t = (e, t) => {
|
|
1416
|
+
let { openCanvas: n, openCanvasLoading: r, closeCanvas: i } = st(), o = ct(), { customVisualizers: s, themeId: c, onBeforeOpen: l } = t, d = R(null), f = F(async (t, n, r) => {
|
|
1548
1417
|
if (t.url == null && t.referenceUrl != null) {
|
|
1549
1418
|
let i = e.resolveReferencePdfContent(t);
|
|
1550
1419
|
if (i != null) return r(i, t.name, n);
|
|
1551
1420
|
}
|
|
1552
|
-
let
|
|
1421
|
+
let i = t.contentType.toLowerCase(), o = Y(i, s);
|
|
1553
1422
|
if (o != null) {
|
|
1554
|
-
let i = await e.resolveVisualizerContent(t, o,
|
|
1423
|
+
let i = await e.resolveVisualizerContent(t, o, c);
|
|
1555
1424
|
if (i != null) return r(i, t.name, n);
|
|
1556
1425
|
}
|
|
1557
|
-
if (!
|
|
1426
|
+
if (!i && t.data != null) {
|
|
1558
1427
|
let i = await e.resolveTextContent(t);
|
|
1559
1428
|
if (i != null) return r(i, t.name, n);
|
|
1560
1429
|
}
|
|
1561
|
-
let
|
|
1562
|
-
if (
|
|
1563
|
-
let u =
|
|
1564
|
-
if (u != null) return r(await e[u](t) ??
|
|
1565
|
-
let d = t.name ?? "", f = d.lastIndexOf("."), p = f === -1 ? "" : d.slice(f + 1).toLowerCase(), m =
|
|
1566
|
-
if (m != null) return r(await e.resolveOoxmlContent(t, m) ??
|
|
1567
|
-
let h =
|
|
1430
|
+
let l = Z("", i);
|
|
1431
|
+
if (l != null) return r(await e.resolveOoxmlContent(t, l) ?? Q(e.resolveContentUrl(t)), t.name, n);
|
|
1432
|
+
let u = pt[i];
|
|
1433
|
+
if (u != null) return r(await e[u](t) ?? Q(e.resolveContentUrl(t)), t.name, n);
|
|
1434
|
+
let d = t.name ?? "", f = d.lastIndexOf("."), p = f === -1 ? "" : d.slice(f + 1).toLowerCase(), m = Z(d);
|
|
1435
|
+
if (m != null) return r(await e.resolveOoxmlContent(t, m) ?? Q(e.resolveContentUrl(t)), t.name, n);
|
|
1436
|
+
let h = mt[p];
|
|
1568
1437
|
if (h != null) {
|
|
1569
1438
|
let i = await e[h](t);
|
|
1570
1439
|
return i != null && r(i, t.name, n);
|
|
1571
1440
|
}
|
|
1572
|
-
let g = t.name != null &&
|
|
1573
|
-
if (t.name != null && !
|
|
1441
|
+
let g = t.name != null && Xe(t.name) || t.url != null && Xe(gt(t.url));
|
|
1442
|
+
if (t.name != null && !Ye(t.name) && !g) return r(Q(e.resolveContentUrl(t)), t.name, n);
|
|
1574
1443
|
if (g) {
|
|
1575
|
-
let
|
|
1576
|
-
return
|
|
1577
|
-
type:
|
|
1444
|
+
let i = await e.resolveHtmlContent(t);
|
|
1445
|
+
return i == null ? e.hasTextSource(t) ? r(Q(e.resolveContentUrl(t)), t.name, n) : t.url != null && r({
|
|
1446
|
+
type: a.Html,
|
|
1578
1447
|
url: t.url
|
|
1579
|
-
}, t.name, n) : r(
|
|
1448
|
+
}, t.name, n) : r(i, t.name, n);
|
|
1580
1449
|
}
|
|
1581
|
-
let _ = await e.resolveCodeContent(t,
|
|
1450
|
+
let _ = await e.resolveCodeContent(t, Qe(p));
|
|
1582
1451
|
return _ != null && r(_, t.name, n);
|
|
1583
1452
|
}, [
|
|
1584
1453
|
s,
|
|
1585
|
-
|
|
1454
|
+
c,
|
|
1586
1455
|
e
|
|
1587
|
-
]), p =
|
|
1588
|
-
let
|
|
1456
|
+
]), p = F(async (t, c = t.id, p) => {
|
|
1457
|
+
let m = () => p == null || p(), h = (e, t, r) => m() ? (n(e, t, r), !0) : (nt(e), !1);
|
|
1589
1458
|
switch (t.type) {
|
|
1590
|
-
case
|
|
1459
|
+
case u.Image: {
|
|
1591
1460
|
let r = e.resolveImageContent(t);
|
|
1592
|
-
return r != null && (
|
|
1461
|
+
return r != null && (l?.(), n(r, t.name, c), !0);
|
|
1593
1462
|
}
|
|
1594
|
-
case
|
|
1463
|
+
case u.Audio: {
|
|
1595
1464
|
let e = t.playUrl ?? t.url;
|
|
1596
1465
|
return e != null && (n({
|
|
1597
|
-
type:
|
|
1466
|
+
type: a.Audio,
|
|
1598
1467
|
url: e,
|
|
1599
1468
|
mimeType: t.contentType || void 0
|
|
1600
|
-
}, t.name,
|
|
1469
|
+
}, t.name, c), !0);
|
|
1601
1470
|
}
|
|
1602
|
-
case
|
|
1471
|
+
case u.File: {
|
|
1603
1472
|
let e = () => {
|
|
1604
|
-
d.current?.(t,
|
|
1605
|
-
},
|
|
1606
|
-
|
|
1607
|
-
let
|
|
1608
|
-
return !
|
|
1473
|
+
d.current?.(t, c, o?.());
|
|
1474
|
+
}, a = (t, r, i) => m() ? (n(t, r, i, e), !0) : (nt(t), !1);
|
|
1475
|
+
l?.(), r(t.name, c, ht(t, s));
|
|
1476
|
+
let u = await f(t, c, a);
|
|
1477
|
+
return !u && m() && i(), u;
|
|
1609
1478
|
}
|
|
1610
|
-
case
|
|
1611
|
-
case
|
|
1612
|
-
|
|
1479
|
+
case u.Pasted:
|
|
1480
|
+
case u.Prompt: {
|
|
1481
|
+
l?.(), r(t.name, c);
|
|
1613
1482
|
let n = await e.resolveTextContent(t);
|
|
1614
|
-
return n == null ? (
|
|
1483
|
+
return n == null ? (m() && i(), !1) : h(n, t.name, c);
|
|
1615
1484
|
}
|
|
1616
1485
|
default: return !1;
|
|
1617
1486
|
}
|
|
1618
1487
|
}, [
|
|
1619
1488
|
n,
|
|
1620
1489
|
r,
|
|
1621
|
-
|
|
1622
|
-
|
|
1490
|
+
i,
|
|
1491
|
+
l,
|
|
1623
1492
|
f,
|
|
1624
1493
|
e,
|
|
1625
|
-
o
|
|
1494
|
+
o,
|
|
1495
|
+
s
|
|
1626
1496
|
]);
|
|
1627
|
-
return
|
|
1497
|
+
return I(() => {
|
|
1628
1498
|
d.current = p;
|
|
1629
1499
|
}, [p]), { openAttachmentCanvas: p };
|
|
1630
1500
|
};
|
|
1631
1501
|
//#endregion
|
|
1632
|
-
export {
|
|
1502
|
+
export { W as ATTACHMENT_CANVAS_CLASS, Be as AttachmentCanvas, Le as AttachmentCanvasBody, ut as AttachmentCanvasContainer, ot as AttachmentCanvasProvider, a as AttachmentContentType, r as AttachmentErrorType, be as CodeContent, xe as HTML_PREVIEW_FRAME_RENDER_MESSAGE, ft as InlineGroupedVisualizer, e as McpAppCanvasRenderer, i as OoxmlFileType, n as OoxmlHighlightKind, et as createForbiddenCanvasContent, $e as createLoadErrorCanvasContent, Q as createUnsupportedCanvasContent, o as downloadAttachmentContent, Qe as extensionToLanguage, Oe as findVisualizerForApplication, Y as findVisualizerForMime, Z as getOoxmlFileType, Je as getOoxmlMimeType, ke as groupedVisualizerCanvasKey, c as isDownloadable, Xe as isHtmlPreviewable, qe as isOoxmlPreviewable, Ye as isTextPreviewable, Ae as partitionAttachmentsForApplicationVisualizer, st as useAttachmentCanvas, lt as useLatestCanvasRequest, _t as useOpenAttachmentCanvas };
|