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