@epam/ai-dial-attachment-canvas 1.1.0-dev.39 → 1.1.0-dev.391
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/PdfContent-CES32aGU.js +17154 -0
- package/components/AttachmentCanvas/AttachmentCanvas.d.ts +1 -0
- package/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
- package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts +4 -0
- package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -0
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts +8 -0
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
- package/components/CodeContent/CodeContent.d.ts +13 -0
- package/components/CodeContent/CodeContent.d.ts.map +1 -0
- package/components/HtmlContent/HtmlContent.d.ts +21 -0
- package/components/HtmlContent/HtmlContent.d.ts.map +1 -0
- package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts +12 -0
- package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts.map +1 -0
- package/components/OoxmlContent/OoxmlContent.d.ts +14 -0
- package/components/OoxmlContent/OoxmlContent.d.ts.map +1 -0
- package/components/PdfContent/PdfContent.d.ts +39 -0
- package/components/PdfContent/PdfContent.d.ts.map +1 -1
- package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts +25 -0
- package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts.map +1 -0
- package/constants/file.d.ts +8 -0
- package/constants/file.d.ts.map +1 -1
- package/context/AttachmentCanvasContext.d.ts +4 -2
- package/context/AttachmentCanvasContext.d.ts.map +1 -1
- package/docx-TK1kGI6t.js +27179 -0
- package/download-BBbVchnm.js +119 -0
- package/esm-bFpgu8Tl.js +17407 -0
- package/highlight-rect-BuX5rWP4-BMOCuZYw.js +1037 -0
- package/hooks/useOpenAttachmentCanvas/useOpenAttachmentCanvas.d.ts +64 -0
- package/hooks/useOpenAttachmentCanvas/useOpenAttachmentCanvas.d.ts.map +1 -0
- package/index.css +1 -1
- package/index.d.ts +9 -3
- package/index.d.ts.map +1 -1
- package/index.js +15383 -16835
- package/models/attachment-canvas.d.ts +186 -11
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +14 -7
- package/pptx-DfVqSUxc.js +7410 -0
- package/render-worker-host-Br7ZDyGE-ByESfBjH.js +7 -0
- package/render-worker-host-CM1JXVqg-DGwZpsUd.js +7 -0
- package/render-worker-host-DFtd9Z-J-DU7fugLI.js +7 -0
- package/renderer-module-contract-BNGz8HvO-BmSLiM0k.js +44363 -0
- package/types/attachment-canvas.d.ts +11 -0
- package/types/attachment-canvas.d.ts.map +1 -1
- package/utils/content.d.ts +11 -0
- package/utils/content.d.ts.map +1 -1
- package/utils/download.d.ts.map +1 -1
- package/utils/visualizer.d.ts +8 -0
- package/utils/visualizer.d.ts.map +1 -0
- package/visible-index-BjesVGhg-DvGeguMs.js +133 -0
- package/xlsx-44AZTEry.js +7800 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { MIMEType as e, ensureDownloadFilename as t, triggerAnchorDownload as n, triggerBlobDownload as r } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
//#region src/types/attachment-canvas.ts
|
|
3
|
+
var i = /* @__PURE__ */ function(e) {
|
|
4
|
+
return e.PlainText = "plain_text", e.Image = "image", e.Audio = "audio", e.Markdown = "markdown", e.Json = "json", e.Pdf = "pdf", e.Ooxml = "ooxml", e.Code = "code", e.Html = "html", e.Visualizer = "visualizer", e.McpApp = "mcp_app", e.Unsupported = "unsupported", e.Error = "error", e;
|
|
5
|
+
}({}), a = /* @__PURE__ */ function(e) {
|
|
6
|
+
return e.Docx = "docx", e.Xlsx = "xlsx", e.Pptx = "pptx", e;
|
|
7
|
+
}({}), o = /* @__PURE__ */ function(e) {
|
|
8
|
+
return e.LoadFailed = "load_failed", e.Forbidden = "forbidden", e;
|
|
9
|
+
}({}), s = {
|
|
10
|
+
[a.Docx]: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
11
|
+
[a.Xlsx]: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
12
|
+
[a.Pptx]: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
13
|
+
}, c = (e) => {
|
|
14
|
+
switch (e.type) {
|
|
15
|
+
case i.PlainText:
|
|
16
|
+
case i.Markdown:
|
|
17
|
+
case i.Json:
|
|
18
|
+
case i.Image:
|
|
19
|
+
case i.Audio:
|
|
20
|
+
case i.Pdf:
|
|
21
|
+
case i.Ooxml:
|
|
22
|
+
case i.Code: return !0;
|
|
23
|
+
case i.Html: return e.url != null;
|
|
24
|
+
case i.Visualizer:
|
|
25
|
+
case i.McpApp: return !1;
|
|
26
|
+
case i.Unsupported: return e.url != null;
|
|
27
|
+
case i.Error: return e.errorType !== o.Forbidden && e.url != null;
|
|
28
|
+
}
|
|
29
|
+
}, l = async (e) => {
|
|
30
|
+
let t = await fetch(e);
|
|
31
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
32
|
+
return t.blob();
|
|
33
|
+
}, u = (t) => {
|
|
34
|
+
switch (t.type) {
|
|
35
|
+
case i.Image: return {
|
|
36
|
+
url: t.url,
|
|
37
|
+
mimeType: void 0
|
|
38
|
+
};
|
|
39
|
+
case i.Audio: return {
|
|
40
|
+
url: t.url,
|
|
41
|
+
mimeType: t.mimeType
|
|
42
|
+
};
|
|
43
|
+
case i.Pdf: return {
|
|
44
|
+
url: t.url,
|
|
45
|
+
mimeType: e.PDF
|
|
46
|
+
};
|
|
47
|
+
case i.Ooxml: return {
|
|
48
|
+
url: t.url,
|
|
49
|
+
mimeType: s[t.format]
|
|
50
|
+
};
|
|
51
|
+
case i.Html: return {
|
|
52
|
+
url: t.url,
|
|
53
|
+
mimeType: e.HTML
|
|
54
|
+
};
|
|
55
|
+
case i.Unsupported:
|
|
56
|
+
case i.Error: return {
|
|
57
|
+
url: t.url,
|
|
58
|
+
mimeType: void 0
|
|
59
|
+
};
|
|
60
|
+
case i.PlainText:
|
|
61
|
+
case i.Code: return {
|
|
62
|
+
url: void 0,
|
|
63
|
+
mimeType: e.Plain
|
|
64
|
+
};
|
|
65
|
+
case i.Markdown: return {
|
|
66
|
+
url: void 0,
|
|
67
|
+
mimeType: e.Markdown
|
|
68
|
+
};
|
|
69
|
+
case i.Json: return {
|
|
70
|
+
url: void 0,
|
|
71
|
+
mimeType: e.JSON
|
|
72
|
+
};
|
|
73
|
+
default: return {
|
|
74
|
+
url: void 0,
|
|
75
|
+
mimeType: void 0
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}, d = (a, o) => {
|
|
79
|
+
let { url: s, mimeType: l } = u(a), d = t(o ?? "attachment", s, l);
|
|
80
|
+
switch (a.type) {
|
|
81
|
+
case i.PlainText:
|
|
82
|
+
if (a.text === "") return;
|
|
83
|
+
r(new Blob([a.text], { type: e.Plain }), d);
|
|
84
|
+
return;
|
|
85
|
+
case i.Markdown:
|
|
86
|
+
if (a.text === "") return;
|
|
87
|
+
r(new Blob([a.text], { type: e.Markdown }), d);
|
|
88
|
+
return;
|
|
89
|
+
case i.Json:
|
|
90
|
+
r(new Blob([JSON.stringify(a.value, null, 2)], { type: e.JSON }), d);
|
|
91
|
+
return;
|
|
92
|
+
case i.Image:
|
|
93
|
+
case i.Audio:
|
|
94
|
+
case i.Pdf:
|
|
95
|
+
case i.Ooxml:
|
|
96
|
+
n(a.url, d);
|
|
97
|
+
return;
|
|
98
|
+
case i.Code:
|
|
99
|
+
if (a.text === "") return;
|
|
100
|
+
r(new Blob([a.text], { type: e.Plain }), d);
|
|
101
|
+
return;
|
|
102
|
+
case i.Html:
|
|
103
|
+
if (a.url == null) return;
|
|
104
|
+
n(a.url, d);
|
|
105
|
+
return;
|
|
106
|
+
case i.Visualizer:
|
|
107
|
+
case i.McpApp: return;
|
|
108
|
+
case i.Unsupported:
|
|
109
|
+
if (a.url == null) return;
|
|
110
|
+
n(a.url, d);
|
|
111
|
+
return;
|
|
112
|
+
case i.Error:
|
|
113
|
+
if (!c(a) || a.url == null) return;
|
|
114
|
+
n(a.url, d);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
//#endregion
|
|
119
|
+
export { o as a, i, l as n, a as o, c as r, d as t };
|