@epam/ai-dial-attachment-canvas 1.3.0-dev.14 → 1.3.0-dev.141

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/index.js CHANGED
@@ -8,9 +8,8 @@ import { createContext as M, lazy as N, memo as P, useCallback as F, useContext
8
8
  import { JsonView as se, defaultStyles as ce } from "react-json-view-lite";
9
9
  import { Fragment as le, jsx as B, jsxs as V } from "react/jsx-runtime";
10
10
  import { AppBridge as H, AppFrame as ue } from "@mcp-ui/client";
11
- import { McpUiHostContextChangedNotificationSchema as U } from "@modelcontextprotocol/ext-apps/app-bridge";
12
- import { VisualizerConnectorEvents as W, VisualizerConnectorRequests as de } from "@epam/ai-dial-shared";
13
- import { VisualizerConnector as fe } from "@epam/ai-dial-visualizer-connector";
11
+ import { McpUiHostContextChangedNotificationSchema as de } from "@modelcontextprotocol/ext-apps/app-bridge";
12
+ import { VisualizerConnector as U, VisualizerConnectorEvents as W, VisualizerConnectorRequests as fe } from "@epam/ai-dial-visualizer-connector";
14
13
  //#region src/constants/public-class-names.ts
15
14
  var pe = { panel: "dial-attachment-canvas-panel" }, G = {
16
15
  container: "_container_1nhig_1",
@@ -25,7 +24,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
25
24
  let { text: r, language: i } = e, a = L(() => g(r), [r]), o = i == null || i === "plaintext" || !a, c = K[t], u = t === l.Light, [d, f] = z(0), p = L(me, [d]), m = F(() => {
26
25
  f((e) => e + 1);
27
26
  }, []), h = /* @__PURE__ */ B("pre", {
28
- className: "whitespace-pre-wrap break-words p-4",
27
+ className: "p-4 wrap-break-word whitespace-pre-wrap",
29
28
  children: r
30
29
  });
31
30
  return /* @__PURE__ */ B("div", {
@@ -96,9 +95,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
96
95
  type: ge,
97
96
  html: ee
98
97
  }, "*"));
99
- return;
100
- }
101
- if (!(k || O)) try {
98
+ } else if (!(k || O)) try {
102
99
  b.current?.contentDocument ?? f(!0);
103
100
  } catch {
104
101
  f(!0);
@@ -198,7 +195,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
198
195
  }, e.onrequestdisplaymode = async ({ mode: e }) => {
199
196
  let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
200
197
  return { mode: t?.(e) ?? n };
201
- }, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(U, ({ params: e }) => {
198
+ }, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(de, ({ params: e }) => {
202
199
  let n = t.current?.querySelector("iframe");
203
200
  n != null && Se(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
204
201
  }), a(e);
@@ -242,7 +239,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
242
239
  }, [d, h])), b = y || r === "error";
243
240
  return /* @__PURE__ */ V("div", {
244
241
  ref: m,
245
- className: _("relative h-full min-h-[200px] w-full", p && q.fullscreenFrame, !p && r === "loading" && q.loadingFrame),
242
+ className: _("relative h-full w-full", b ? "min-h-[160px]" : "min-h-[100px]", p && q.fullscreenFrame, !p && r === "loading" && q.loadingFrame),
246
243
  children: [
247
244
  v != null && !b && /* @__PURE__ */ B(ue, {
248
245
  html: s,
@@ -347,7 +344,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
347
344
  let [{ DocxDocument: n, DocxScrollViewer: r }, { chartEx: o }, { createDocxHighlightSurface: c }] = await Promise.all([
348
345
  import("@silurus/ooxml/docx"),
349
346
  import("@silurus/ooxml/chart-ex"),
350
- import("./ooxml-highlight-surfaces-BzgOKpBV.js")
347
+ import("./ooxml-highlight-surfaces-C18JJb0P.js")
351
348
  ]), l = await n.load(t.url, { chartEx: o });
352
349
  if (i()) throw l.destroy(), new De();
353
350
  let u = r.fromDocument(e, l, {
@@ -367,7 +364,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
367
364
  let [{ PptxPresentation: n, PptxScrollViewer: r }, { chartEx: o }, { createPptxHighlightSurface: c }] = await Promise.all([
368
365
  import("@silurus/ooxml/pptx"),
369
366
  import("@silurus/ooxml/chart-ex"),
370
- import("./ooxml-highlight-surfaces-BzgOKpBV.js")
367
+ import("./ooxml-highlight-surfaces-C18JJb0P.js")
371
368
  ]), l = await n.load(t.url, { chartEx: o });
372
369
  if (i()) throw l.destroy(), new De();
373
370
  let u = r.fromPresentation(e, l, {
@@ -387,7 +384,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
387
384
  let [{ XlsxViewer: n }, { chartEx: r }, { createXlsxHighlightSurface: c }] = await Promise.all([
388
385
  import("@silurus/ooxml/xlsx"),
389
386
  import("@silurus/ooxml/chart-ex"),
390
- import("./ooxml-highlight-surfaces-BzgOKpBV.js")
387
+ import("./ooxml-highlight-surfaces-C18JJb0P.js")
391
388
  ]), l = new n(e, {
392
389
  showZoomSlider: !0,
393
390
  chartEx: r,
@@ -507,7 +504,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
507
504
  dir: "ltr",
508
505
  tabIndex: 0,
509
506
  "aria-live": "polite",
510
- className: _("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", J.formulaValue),
507
+ className: _("h-8 min-w-0 flex-1 overflow-x-auto rounded border px-2 py-1 text-sm whitespace-nowrap focus-visible:outline focus-visible:outline-focus", J.formulaValue),
511
508
  children: m
512
509
  })]
513
510
  }),
@@ -566,15 +563,11 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
566
563
  let n = e.toLowerCase();
567
564
  return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
568
565
  }, Ae = (e, t) => {
569
- if (!(e == null || e === "")) return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
566
+ if (e != null && e !== "") return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
570
567
  }, je = (e) => `${e}:grouped-visualizer`, Me = (e, t) => {
571
568
  let n = (t.contentType ?? "").split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""), r = [], i = [];
572
569
  return e.forEach((e) => {
573
- if (e.url != null && e.url !== "" && (n.length === 0 || n.includes(e.contentType.toLowerCase()))) {
574
- r.push(e);
575
- return;
576
- }
577
- i.push(e);
570
+ e.url != null && e.url !== "" && (n.length === 0 || n.includes(e.contentType.toLowerCase())) ? r.push(e) : i.push(e);
578
571
  }), {
579
572
  claimed: r,
580
573
  unclaimed: i
@@ -595,19 +588,18 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
595
588
  let e = s.current;
596
589
  if (!e) return;
597
590
  l("loading");
598
- let t = new fe(e, {
591
+ let t = new U(e, {
599
592
  domain: u,
600
- hostDomain: window.location.origin,
601
593
  visualizerName: d,
602
594
  requestTimeout: f
603
- }), n = !0, r = t.subscribe(`${d}/${W.sendMessage}`, (e) => {
595
+ }), n = !0, r = t.subscribe(`${d}/${W.SendMessage}`, (e) => {
604
596
  let t = Ne(e);
605
597
  t != null && h.current?.(t);
606
598
  });
607
599
  return (async () => {
608
600
  if (await t.ready(), !n) return;
609
601
  let e = p.current;
610
- if (e.type === i.GroupedVisualizer) await t.send(de.sendGroupedVisualizeData, {
602
+ if (e.type === i.GroupedVisualizer) await t.send(fe.SendGroupedVisualizeData, {
611
603
  attachments: e.attachments,
612
604
  layout: e.layout
613
605
  });
@@ -616,7 +608,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
616
608
  layout: r,
617
609
  ...typeof i == "object" && i ? i : {}
618
610
  };
619
- await t.send(de.sendVisualizeData, {
611
+ await t.send(fe.SendVisualizeData, {
620
612
  mimeType: n,
621
613
  visualizerData: a
622
614
  });
@@ -688,7 +680,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
688
680
  jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
689
681
  jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
690
682
  jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
691
- }, Ie = () => N(async () => ({ default: (await import("./PdfContent-ELaDSyFF.js")).PdfContent })), Le = ({ url: e, fileName: t, loadErrorLabel: n }) => {
683
+ }, Ie = () => N(async () => ({ default: (await import("./PdfContent-Dp13pnPj.js")).PdfContent })), Le = ({ url: e, fileName: t, loadErrorLabel: n }) => {
692
684
  let [r, i] = z(!1);
693
685
  return I(() => {
694
686
  i(!1);
@@ -708,11 +700,11 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
708
700
  className: "max-h-full max-w-full object-contain",
709
701
  onError: () => i(!0)
710
702
  });
711
- }, Re = new Set([
703
+ }, Re = /* @__PURE__ */ new Set([
712
704
  i.PlainText,
713
705
  i.Code,
714
706
  i.Ooxml
715
- ]), ze = P(({ 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: g, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: S, pdfContentRetryLabel: w, xlsxFormulaLabel: T = "Formula", codeContentLoadingLabel: E, codeContentErrorLabel: k, codeContentRetryLabel: A, tableCopyLabel: ee, tableCopiedLabel: te, tableDownloadCsvLabel: ne, codeBlockCopyLabel: j, codeBlockCopiedLabel: ie, codeBlockDownloadLabel: ae, tableScrollRegionAriaLabel: M, mathScrollRegionAriaLabel: N, ooxmlHighlightsLabel: P, ooxmlHighlightNavigatedLabel: oe } = {}, styles: le, codeBlockTheme: H, tableDownloadFilename: ue, loadPdf: U, hidePdfToolbar: W = !1, configurePdfWorker: de, onAppInfo: fe, onVisualizerSendMessage: pe }) => {
707
+ ]), ze = P(({ 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: g, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: S, pdfContentRetryLabel: w, xlsxFormulaLabel: T = "Formula", codeContentLoadingLabel: E, codeContentErrorLabel: k, codeContentRetryLabel: A, tableCopyLabel: ee, tableCopiedLabel: te, tableDownloadCsvLabel: ne, codeBlockCopyLabel: j, codeBlockCopiedLabel: ie, codeBlockDownloadLabel: ae, tableScrollRegionAriaLabel: M, mathScrollRegionAriaLabel: N, ooxmlHighlightsLabel: P, ooxmlHighlightNavigatedLabel: oe } = {}, styles: le, codeBlockTheme: H, tableDownloadFilename: ue, loadPdf: de, hidePdfToolbar: U = !1, configurePdfWorker: W, onAppInfo: fe, onVisualizerSendMessage: pe }) => {
716
708
  let { colors: G, typography: K, bodyClassName: me, cssVars: ge } = le ?? {}, [_e, ye] = z(0), be = L(Ie, [_e]), xe = F(() => {
717
709
  ye((e) => e + 1);
718
710
  }, []), Se = R(void 0), [Ce, q] = z(0), J = F((e) => {
@@ -768,14 +760,14 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
768
760
  case i.McpApp:
769
761
  case i.Code:
770
762
  case i.Html: return "h-full overflow-hidden";
771
- case i.Markdown: return "h-full overflow-auto p-4";
763
+ case i.Markdown: return "h-full overflow-auto";
772
764
  case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
773
765
  default: return "h-full overflow-auto p-4";
774
766
  }
775
767
  }, [e.type]), De = L(() => {
776
768
  switch (e.type) {
777
769
  case i.PlainText: return /* @__PURE__ */ B("pre", {
778
- className: _("whitespace-pre-wrap break-words", X.body, K?.fontClassName),
770
+ className: _("break-words whitespace-pre-wrap", X.body, K?.fontClassName),
779
771
  children: e.text
780
772
  });
781
773
  case i.Image: return /* @__PURE__ */ B(Le, {
@@ -795,16 +787,19 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
795
787
  type: e.mimeType
796
788
  })
797
789
  });
798
- case i.Markdown: return /* @__PURE__ */ B(p, {
799
- content: e.text,
800
- isStreaming: !1,
801
- codeBlockTheme: H,
802
- codeBlockCopyLabel: j,
803
- codeBlockCopiedLabel: ie,
804
- codeBlockDownloadLabel: ae,
805
- tableScrollRegionAriaLabel: M,
806
- mathScrollRegionAriaLabel: N,
807
- classNames: u
790
+ case i.Markdown: return /* @__PURE__ */ B("div", {
791
+ className: "p-4",
792
+ children: /* @__PURE__ */ B(p, {
793
+ content: e.text,
794
+ isStreaming: !1,
795
+ codeBlockTheme: H,
796
+ codeBlockCopyLabel: j,
797
+ codeBlockCopiedLabel: ie,
798
+ codeBlockDownloadLabel: ae,
799
+ tableScrollRegionAriaLabel: M,
800
+ mathScrollRegionAriaLabel: N,
801
+ classNames: u
802
+ })
808
803
  });
809
804
  case i.MarkdownTable: return /* @__PURE__ */ B(p, {
810
805
  content: e.text,
@@ -888,10 +883,10 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
888
883
  highlights: e.highlights ?? [],
889
884
  selectedHighlightId: e.selectedHighlightId,
890
885
  selectedPageNumber: e.page,
891
- loadPdf: U,
886
+ loadPdf: de,
892
887
  onLoadError: J,
893
- hideHeader: W,
894
- configurePdfWorker: de,
888
+ hideHeader: U,
889
+ configurePdfWorker: W,
895
890
  labels: {
896
891
  thumbnailsLabel: g,
897
892
  showThumbnailsLabel: v,
@@ -957,9 +952,9 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
957
952
  h,
958
953
  a,
959
954
  ue,
955
+ de,
960
956
  U,
961
957
  W,
962
- de,
963
958
  fe,
964
959
  g,
965
960
  v,
@@ -996,7 +991,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
996
991
  }), Be = {
997
992
  mcpAppDivider: "_mcpAppDivider_1jh5p_1",
998
993
  mcpAppVersion: "_mcpAppVersion_1jh5p_5"
999
- }, Ve = 2e3, He = P(({ isOpen: e, isLoading: t = !1, onClose: n, content: r, fileName: a, leftActions: s, labels: { ariaLabel: c, closeLabel: l = "Close", resizeLabel: u = "Resize panel", downloadLabel: d = "Download", copyTextLabel: f = "Copy text", copiedTextLabel: p = "Copied!", copyMarkdownLabel: h = "Copy as Markdown", copiedMarkdownLabel: g = "Copied!", copyJsonLabel: v = "Copy as JSON", copiedJsonLabel: y = "Copied!", visualizerErrorLabel: w, unsupportedLabel: E = "Preview is not supported for this file", loadErrorLabel: D = "Failed to load file", forbiddenErrorLabel: O = "You don't have permission to access this file", htmlFrameBlockedLabel: k = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: re = "Open in new tab", htmlViewSourceLabel: M = "View source", htmlViewRenderedLabel: N = "View rendered", mcpAppReloadLabel: P = "Reload", pdfThumbnailsLabel: oe, pdfShowThumbnailsLabel: se, pdfHideThumbnailsLabel: ce, pdfPageNumberLabel: H, pdfContentLoadingLabel: ue, pdfContentErrorLabel: U, pdfContentRetryLabel: W, xlsxFormulaLabel: de, codeContentLoadingLabel: fe, codeContentErrorLabel: G, codeContentRetryLabel: K, tableCopyLabel: me, tableCopiedLabel: he, tableDownloadCsvLabel: ge, codeBlockCopyLabel: _e, codeBlockCopiedLabel: ve, codeBlockDownloadLabel: ye, tableScrollRegionAriaLabel: be, mathScrollRegionAriaLabel: xe, ooxmlHighlightsLabel: Se, ooxmlHighlightNavigatedLabel: Ce }, onDownload: q, onCopyText: we, onCopyMarkdown: J, onCopyJson: Y, tableDownloadFilename: Te, isMobile: Ee = !1, defaultWidth: De, minWidth: Oe = 600, maxWidth: ke = 1500, onResizeStop: Ae, styles: je, codeBlockTheme: Me, loadPdf: Ne, configurePdfWorker: Pe, onVisualizerSendMessage: Fe }) => {
994
+ }, Ve = 2e3, He = P(({ isOpen: e, isLoading: t = !1, onClose: n, content: r, fileName: a, leftActions: s, labels: { ariaLabel: c, closeLabel: l = "Close", resizeLabel: u = "Resize panel", downloadLabel: d = "Download", copyTextLabel: f = "Copy text", copiedTextLabel: p = "Copied!", copyMarkdownLabel: h = "Copy as Markdown", copiedMarkdownLabel: g = "Copied!", copyJsonLabel: v = "Copy as JSON", copiedJsonLabel: y = "Copied!", visualizerErrorLabel: w, unsupportedLabel: E = "Preview is not supported for this file", loadErrorLabel: D = "Failed to load file", forbiddenErrorLabel: O = "You don't have permission to access this file", htmlFrameBlockedLabel: k = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: re = "Open in new tab", htmlViewSourceLabel: M = "View source", htmlViewRenderedLabel: N = "View rendered", mcpAppReloadLabel: P = "Reload", pdfThumbnailsLabel: oe, pdfShowThumbnailsLabel: se, pdfHideThumbnailsLabel: ce, pdfPageNumberLabel: H, pdfContentLoadingLabel: ue, pdfContentErrorLabel: de, pdfContentRetryLabel: U, xlsxFormulaLabel: W, codeContentLoadingLabel: fe, codeContentErrorLabel: G, codeContentRetryLabel: K, tableCopyLabel: me, tableCopiedLabel: he, tableDownloadCsvLabel: ge, codeBlockCopyLabel: _e, codeBlockCopiedLabel: ve, codeBlockDownloadLabel: ye, tableScrollRegionAriaLabel: be, mathScrollRegionAriaLabel: xe, ooxmlHighlightsLabel: Se, ooxmlHighlightNavigatedLabel: Ce }, onDownload: q, onCopyText: we, onCopyMarkdown: J, onCopyJson: Y, tableDownloadFilename: Te, isMobile: Ee = !1, defaultWidth: De, minWidth: Oe = 600, maxWidth: ke = 1500, onResizeStop: Ae, styles: je, codeBlockTheme: Me, loadPdf: Ne, configurePdfWorker: Pe, onVisualizerSendMessage: Fe }) => {
1000
995
  let [X, Ie] = z(!1), [Le, Re] = z(!1), [He, Ue] = z(!1), [Z, We] = z(!1), [Ge, Ke] = z(void 0), qe = R(null), Q = R(null), Je = R(null), Ye = F(() => {
1001
996
  we?.(), qe.current != null && clearTimeout(qe.current), Ie(!0), qe.current = setTimeout(() => Ie(!1), Ve);
1002
997
  }, [we]), Xe = F(() => {
@@ -1133,9 +1128,9 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
1133
1128
  pdfHideThumbnailsLabel: ce,
1134
1129
  pdfPageNumberLabel: H,
1135
1130
  pdfContentLoadingLabel: ue,
1136
- pdfContentErrorLabel: U,
1137
- pdfContentRetryLabel: W,
1138
- xlsxFormulaLabel: de,
1131
+ pdfContentErrorLabel: de,
1132
+ pdfContentRetryLabel: U,
1133
+ xlsxFormulaLabel: W,
1139
1134
  codeContentLoadingLabel: fe,
1140
1135
  codeContentErrorLabel: G,
1141
1136
  codeContentRetryLabel: K,
@@ -1158,11 +1153,11 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
1158
1153
  onVisualizerSendMessage: Fe
1159
1154
  })
1160
1155
  });
1161
- }), Ue = new Set(["html", "htm"]), Z = {
1156
+ }), Ue = /* @__PURE__ */ new Set(["html", "htm"]), Z = {
1162
1157
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1163
1158
  xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1164
1159
  pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
1165
- }, We = 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(".")), Ge = {
1160
+ }, We = /* @__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(".")), Ge = {
1166
1161
  docx: r.Docx,
1167
1162
  xlsx: r.Xlsx,
1168
1163
  pptx: r.Pptx,
@@ -1190,10 +1185,10 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
1190
1185
  return n == null ? void 0 : qe[n];
1191
1186
  }, Xe = (e) => {
1192
1187
  let t = e.lastIndexOf(".");
1193
- return t === -1 ? !1 : We.has(e.slice(t + 1).toLowerCase());
1188
+ return t !== -1 && We.has(e.slice(t + 1).toLowerCase());
1194
1189
  }, Ze = (e) => {
1195
1190
  let t = e.lastIndexOf(".");
1196
- return t === -1 ? !1 : Ue.has(e.slice(t + 1).toLowerCase());
1191
+ return t !== -1 && Ue.has(e.slice(t + 1).toLowerCase());
1197
1192
  }, Qe = {
1198
1193
  xml: "xml",
1199
1194
  csv: "plaintext",
@@ -1254,7 +1249,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
1254
1249
  errorType: n.Forbidden,
1255
1250
  ...e != null && { url: e }
1256
1251
  }), nt = (e) => {
1257
- 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;
1252
+ 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;
1258
1253
  }, rt = (e) => {
1259
1254
  let t = nt(e);
1260
1255
  t != null && URL.revokeObjectURL(t);
@@ -1300,74 +1295,75 @@ var ot = ({ children: e }) => {
1300
1295
  let e = oe(at);
1301
1296
  if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
1302
1297
  return e;
1303
- }, ct = P(({ labels: e, leftActions: t, isMobile: n = !1, defaultWidth: r, maxWidth: o, codeBlockTheme: s, tableDownloadFilename: c, loadPdf: l, configurePdfWorker: u, onVisualizerSendMessage: d }) => {
1304
- let { ariaLabel: f = "Attachment preview", closeLabel: p = "Close", downloadLabel: m = "Download", unsupportedLabel: g = "Preview is not supported for this file", loadErrorLabel: _ = "Failed to load file", forbiddenErrorLabel: v = "You don't have permission to access this file", copyTextLabel: y, copiedTextLabel: b, copyMarkdownLabel: x, copiedMarkdownLabel: S, copyJsonLabel: C, copiedJsonLabel: w, htmlFrameBlockedLabel: T, htmlOpenInNewTabLabel: E, htmlViewSourceLabel: D, htmlViewRenderedLabel: O, pdfThumbnailsLabel: k, pdfShowThumbnailsLabel: A, pdfHideThumbnailsLabel: ee, pdfPageNumberLabel: te, pdfContentLoadingLabel: ne, pdfContentErrorLabel: j, pdfContentRetryLabel: re, xlsxFormulaLabel: ie, codeContentLoadingLabel: ae, codeContentErrorLabel: M, codeContentRetryLabel: N, tableCopyLabel: P, tableCopiedLabel: oe, tableDownloadCsvLabel: I, codeBlockCopyLabel: L, codeBlockCopiedLabel: R, codeBlockDownloadLabel: z, tableScrollRegionAriaLabel: se, mathScrollRegionAriaLabel: ce, ooxmlHighlightsLabel: le, ooxmlHighlightNavigatedLabel: V } = e ?? {}, { isOpen: H, isLoading: ue, content: U, fileName: W, closeCanvas: de } = st(), fe = F(() => {
1298
+ }, ct = P(({ labels: e, leftActions: t, isMobile: n = !1, defaultWidth: r, minWidth: o, maxWidth: s, codeBlockTheme: c, tableDownloadFilename: l, loadPdf: u, configurePdfWorker: d, onVisualizerSendMessage: f }) => {
1299
+ let { ariaLabel: p = "Attachment preview", closeLabel: m = "Close", downloadLabel: g = "Download", unsupportedLabel: _ = "Preview is not supported for this file", loadErrorLabel: v = "Failed to load file", forbiddenErrorLabel: y = "You don't have permission to access this file", copyTextLabel: b, copiedTextLabel: x, copyMarkdownLabel: S, copiedMarkdownLabel: C, copyJsonLabel: w, copiedJsonLabel: T, htmlFrameBlockedLabel: E, htmlOpenInNewTabLabel: D, htmlViewSourceLabel: O, htmlViewRenderedLabel: k, pdfThumbnailsLabel: A, pdfShowThumbnailsLabel: ee, pdfHideThumbnailsLabel: te, pdfPageNumberLabel: ne, pdfContentLoadingLabel: j, pdfContentErrorLabel: re, pdfContentRetryLabel: ie, xlsxFormulaLabel: ae, codeContentLoadingLabel: M, codeContentErrorLabel: N, codeContentRetryLabel: P, tableCopyLabel: oe, tableCopiedLabel: I, tableDownloadCsvLabel: L, codeBlockCopyLabel: R, codeBlockCopiedLabel: z, codeBlockDownloadLabel: se, tableScrollRegionAriaLabel: ce, mathScrollRegionAriaLabel: le, ooxmlHighlightsLabel: V, ooxmlHighlightNavigatedLabel: H } = e ?? {}, { isOpen: ue, isLoading: de, content: U, fileName: W, closeCanvas: fe } = st(), pe = F(() => {
1305
1300
  a(U, W);
1306
- }, [U, W]), pe = F(() => {
1301
+ }, [U, W]), G = F(() => {
1307
1302
  (U.type === i.PlainText || U.type === i.Code) && h(U.text);
1308
- }, [U]), G = F(() => {
1309
- U.type === i.Markdown && h(U.text);
1310
1303
  }, [U]), K = F(() => {
1304
+ U.type === i.Markdown && h(U.text);
1305
+ }, [U]), me = F(() => {
1311
1306
  U.type === i.Json && h(JSON.stringify(U.value, null, 2));
1312
1307
  }, [U]);
1313
1308
  return /* @__PURE__ */ B(He, {
1314
- isOpen: H,
1315
- isLoading: ue,
1316
- onClose: de,
1309
+ isOpen: ue,
1310
+ isLoading: de,
1311
+ onClose: fe,
1317
1312
  content: U,
1318
1313
  fileName: W,
1319
1314
  leftActions: t,
1320
1315
  labels: {
1321
- ariaLabel: f,
1322
- closeLabel: p,
1323
- downloadLabel: m,
1324
- copyTextLabel: y,
1325
- copiedTextLabel: b,
1326
- copyMarkdownLabel: x,
1327
- copiedMarkdownLabel: S,
1328
- copyJsonLabel: C,
1329
- copiedJsonLabel: w,
1330
- unsupportedLabel: g,
1331
- loadErrorLabel: _,
1332
- forbiddenErrorLabel: v,
1333
- htmlFrameBlockedLabel: T,
1334
- htmlOpenInNewTabLabel: E,
1335
- htmlViewSourceLabel: D,
1336
- htmlViewRenderedLabel: O,
1337
- pdfThumbnailsLabel: k,
1338
- pdfShowThumbnailsLabel: A,
1339
- pdfHideThumbnailsLabel: ee,
1340
- pdfPageNumberLabel: te,
1341
- pdfContentLoadingLabel: ne,
1342
- pdfContentErrorLabel: j,
1343
- pdfContentRetryLabel: re,
1344
- xlsxFormulaLabel: ie,
1345
- codeContentLoadingLabel: ae,
1346
- codeContentErrorLabel: M,
1347
- codeContentRetryLabel: N,
1348
- tableCopyLabel: P,
1349
- tableCopiedLabel: oe,
1350
- tableDownloadCsvLabel: I,
1351
- codeBlockCopyLabel: L,
1352
- codeBlockCopiedLabel: R,
1353
- codeBlockDownloadLabel: z,
1354
- tableScrollRegionAriaLabel: se,
1355
- mathScrollRegionAriaLabel: ce,
1356
- ooxmlHighlightsLabel: le,
1357
- ooxmlHighlightNavigatedLabel: V
1316
+ ariaLabel: p,
1317
+ closeLabel: m,
1318
+ downloadLabel: g,
1319
+ copyTextLabel: b,
1320
+ copiedTextLabel: x,
1321
+ copyMarkdownLabel: S,
1322
+ copiedMarkdownLabel: C,
1323
+ copyJsonLabel: w,
1324
+ copiedJsonLabel: T,
1325
+ unsupportedLabel: _,
1326
+ loadErrorLabel: v,
1327
+ forbiddenErrorLabel: y,
1328
+ htmlFrameBlockedLabel: E,
1329
+ htmlOpenInNewTabLabel: D,
1330
+ htmlViewSourceLabel: O,
1331
+ htmlViewRenderedLabel: k,
1332
+ pdfThumbnailsLabel: A,
1333
+ pdfShowThumbnailsLabel: ee,
1334
+ pdfHideThumbnailsLabel: te,
1335
+ pdfPageNumberLabel: ne,
1336
+ pdfContentLoadingLabel: j,
1337
+ pdfContentErrorLabel: re,
1338
+ pdfContentRetryLabel: ie,
1339
+ xlsxFormulaLabel: ae,
1340
+ codeContentLoadingLabel: M,
1341
+ codeContentErrorLabel: N,
1342
+ codeContentRetryLabel: P,
1343
+ tableCopyLabel: oe,
1344
+ tableCopiedLabel: I,
1345
+ tableDownloadCsvLabel: L,
1346
+ codeBlockCopyLabel: R,
1347
+ codeBlockCopiedLabel: z,
1348
+ codeBlockDownloadLabel: se,
1349
+ tableScrollRegionAriaLabel: ce,
1350
+ mathScrollRegionAriaLabel: le,
1351
+ ooxmlHighlightsLabel: V,
1352
+ ooxmlHighlightNavigatedLabel: H
1358
1353
  },
1359
- onDownload: fe,
1360
- onCopyText: U.type === i.PlainText || U.type === i.Code ? pe : void 0,
1361
- onCopyMarkdown: U.type === i.Markdown ? G : void 0,
1362
- onCopyJson: U.type === i.Json ? K : void 0,
1363
- tableDownloadFilename: c,
1354
+ onDownload: pe,
1355
+ onCopyText: U.type === i.PlainText || U.type === i.Code ? G : void 0,
1356
+ onCopyMarkdown: U.type === i.Markdown ? K : void 0,
1357
+ onCopyJson: U.type === i.Json ? me : void 0,
1358
+ tableDownloadFilename: l,
1364
1359
  isMobile: n,
1365
1360
  defaultWidth: r,
1366
- maxWidth: o,
1367
- codeBlockTheme: s,
1368
- configurePdfWorker: u,
1369
- loadPdf: l,
1370
- onVisualizerSendMessage: d
1361
+ minWidth: o,
1362
+ maxWidth: s,
1363
+ codeBlockTheme: c,
1364
+ configurePdfWorker: d,
1365
+ loadPdf: u,
1366
+ onVisualizerSendMessage: f
1371
1367
  });
1372
1368
  }), lt = {
1373
1369
  frame: "_frame_1ys0b_1",
@@ -1455,28 +1451,28 @@ var ot = ({ children: e }) => {
1455
1451
  case d.Markdown:
1456
1452
  case d.MarkdownAlt: {
1457
1453
  let i = await e.resolveMarkdownContent(t);
1458
- return i == null ? !1 : r(i, t.name, n);
1454
+ return i != null && r(i, t.name, n);
1459
1455
  }
1460
1456
  case d.JSON: {
1461
1457
  let i = await e.resolveJsonContent(t);
1462
- return i == null ? !1 : r(i, t.name, n);
1458
+ return i != null && r(i, t.name, n);
1463
1459
  }
1464
1460
  case d.PDF: {
1465
1461
  let i = await e.resolvePdfContent(t);
1466
- return i == null ? !1 : r(i, t.name, n);
1462
+ return i != null && r(i, t.name, n);
1467
1463
  }
1468
1464
  }
1469
1465
  let g = t.name != null && Ze(t.name) || t.url != null && Ze(dt(t.url));
1470
1466
  if (t.name != null && !Xe(t.name) && !g) return r($(e.resolveContentUrl(t)), t.name, n);
1471
1467
  if (g) {
1472
1468
  let a = await e.resolveHtmlContent(t);
1473
- return a == null ? e.hasTextSource(t) ? r($(e.resolveContentUrl(t)), t.name, n) : t.url == null ? !1 : r({
1469
+ return a == null ? e.hasTextSource(t) ? r($(e.resolveContentUrl(t)), t.name, n) : t.url != null && r({
1474
1470
  type: i.Html,
1475
1471
  url: t.url
1476
1472
  }, t.name, n) : r(a, t.name, n);
1477
1473
  }
1478
1474
  let _ = await e.resolveCodeContent(t, $e(m));
1479
- return _ == null ? !1 : r(_, t.name, n);
1475
+ return _ != null && r(_, t.name, n);
1480
1476
  }, [
1481
1477
  o,
1482
1478
  s,
@@ -1487,11 +1483,11 @@ var ot = ({ children: e }) => {
1487
1483
  switch (t.type) {
1488
1484
  case c.Image: {
1489
1485
  let r = e.resolveImageContent(t);
1490
- return r == null ? !1 : (l?.(), n(r, t.name, o), !0);
1486
+ return r != null && (l?.(), n(r, t.name, o), !0);
1491
1487
  }
1492
1488
  case c.Audio: {
1493
1489
  let e = t.playUrl ?? t.url;
1494
- return e == null ? !1 : (n({
1490
+ return e != null && (n({
1495
1491
  type: i.Audio,
1496
1492
  url: e,
1497
1493
  mimeType: t.contentType || void 0
@@ -466,7 +466,7 @@ export interface AttachmentCanvasProps {
466
466
  isMobile?: boolean;
467
467
  /** Initial panel width in pixels (when resizable). Defaults to `min(maxWidth, 2/3 of viewport width)`. */
468
468
  defaultWidth?: number;
469
- /** Minimum panel width in pixels (when resizable). Defaults to `320`. */
469
+ /** Minimum panel width in pixels (when resizable). Defaults to `600`. */
470
470
  minWidth?: number;
471
471
  /** Maximum panel width in pixels (when resizable). Defaults to `1500`. */
472
472
  maxWidth?: number;
@@ -32,11 +32,7 @@ var n = 4 / 3, r = 9525, i = 2, a = 1, o = 0, s = 16, c = .25, l = () => {
32
32
  let t = [...e].sort((e, t) => e.top - t.top || e.left - t.left), n = [];
33
33
  for (let e of t) {
34
34
  let t = n.at(-1), r = t != null && Math.abs(t.top - e.top) <= i && Math.abs(t.height - e.height) <= i, o = t != null && e.left <= t.left + t.width + a;
35
- if (r && o) {
36
- t.width = Math.max(t.left + t.width, e.left + e.width) - t.left, t.height = Math.max(t.height, e.height);
37
- continue;
38
- }
39
- n.push({ ...e });
35
+ r && o ? (t.width = Math.max(t.left + t.width, e.left + e.width) - t.left, t.height = Math.max(t.height, e.height)) : n.push({ ...e });
40
36
  }
41
37
  return n;
42
38
  }, h = (e, t, n) => Math.min(Math.max(e, t), n), g = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), _ = (e, t, n) => {
@@ -67,11 +63,7 @@ var n = 4 / 3, r = 9525, i = 2, a = 1, o = 0, s = 16, c = .25, l = () => {
67
63
  let e = h(n - t.start, 0, t.end - t.start), i = o(t, e, h(r - t.start, e, t.end - t.start));
68
64
  if (i == null) continue;
69
65
  let c = s.get(t.surfaceIndex);
70
- if (c == null) {
71
- s.set(t.surfaceIndex, [i]);
72
- continue;
73
- }
74
- c.push(i);
66
+ c == null ? s.set(t.surfaceIndex, [i]) : c.push(i);
75
67
  }
76
68
  for (let [e, t] of s) s.set(e, m(t));
77
69
  return s;
@@ -118,7 +110,7 @@ var n = 4 / 3, r = 9525, i = 2, a = 1, o = 0, s = 16, c = .25, l = () => {
118
110
  });
119
111
  }, x = (e) => e.rotation !== 0 || (e.textBodyRotation ?? 0) !== 0 || e.shapeFlipH === !0 || e.shapeFlipV === !0, S = ({ location: e, runs: t, measure: n }) => {
120
112
  let r = [], i = "";
121
- for (let n of t) n.shapeId != null && String(n.shapeId) === e.shapeId && (n.origin === "master" || n.origin === "layout" || (r.push({
113
+ for (let n of t) n.shapeId != null && String(n.shapeId) === e.shapeId && n.origin !== "master" && n.origin !== "layout" && (r.push({
122
114
  run: n,
123
115
  box: {
124
116
  x: n.shapeX + n.inShapeX,
@@ -129,7 +121,7 @@ var n = 4 / 3, r = 9525, i = 2, a = 1, o = 0, s = 16, c = .25, l = () => {
129
121
  start: i.length,
130
122
  end: i.length + n.text.length,
131
123
  surfaceIndex: o
132
- }), i += n.text));
124
+ }), i += n.text);
133
125
  return y(r, i, e.start, e.endExclusive, e.text, x, ({ run: e, box: t }, r, i) => v(e.text, t, e.font, 0, !1, r, i, n)).get(o) ?? [];
134
126
  }, C = (e, t) => {
135
127
  let n = t.indexOf(e);
@@ -223,7 +215,7 @@ var n = 4 / 3, r = 9525, i = 2, a = 1, o = 0, s = 16, c = .25, l = () => {
223
215
  }, M = (e, n) => {
224
216
  if (!Number.isSafeInteger(e.occurrence) || e.occurrence < 1) return [];
225
217
  let r = /* @__PURE__ */ new Map();
226
- for (let e of n) e.tableCell == null || e.shapeId == null || e.origin === "master" || e.origin === "layout" || O(r, JSON.stringify([
218
+ for (let e of n) e.tableCell != null && e.shapeId != null && e.origin !== "master" && e.origin !== "layout" && O(r, JSON.stringify([
227
219
  e.elementIndex,
228
220
  e.shapeId,
229
221
  e.tableCell.row
@@ -428,7 +420,7 @@ var n = 4 / 3, r = 9525, i = 2, a = 1, o = 0, s = 16, c = .25, l = () => {
428
420
  for (let n of e) for (let e of n.locations) {
429
421
  if (e.kind !== t.XlsxCellRange) continue;
430
422
  let s = C(e.sheet, r.sheetNames);
431
- if (!(s == null || s !== r.sheetIndex)) for (let t of T({
423
+ if (s != null && s === r.sheetIndex) for (let t of T({
432
424
  location: e,
433
425
  getCellViewportRect: (e) => {
434
426
  let t = r.getCellViewportRect(e);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-attachment-canvas",
3
3
  "description": "Canvas viewer for rendering attachment content — images, PDFs, Office documents, CSV, JSON, markdown, and plain text",
4
- "version": "1.3.0-dev.14",
4
+ "version": "1.3.0-dev.141",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -21,19 +21,18 @@
21
21
  "@tabler/icons-react": "^3.44.0",
22
22
  "react-json-view-lite": "^2.5.0",
23
23
  "react-syntax-highlighter": "^16.1.1",
24
- "@epam/ai-dial-react-pdf-highlighter": "0.2.0",
25
- "@epam/ai-dial-shared": "0.48.0",
26
- "@epam/ai-dial-visualizer-connector": "0.48.0",
24
+ "@epam/ai-dial-react-pdf-highlighter": "0.3.0-dev.6",
25
+ "@epam/ai-dial-visualizer-connector": "1.3.0-dev.141",
27
26
  "@epam/pdf-highlighter-kit": "^0.0.19",
28
27
  "@mcp-ui/client": "^7.1.1",
29
28
  "@modelcontextprotocol/sdk": "^1.32.1",
30
29
  "@modelcontextprotocol/ext-apps": "1.7.5",
31
30
  "pdfjs-dist": "^5.4.149",
32
- "@epam/ai-dial-sidebar": "1.3.0-dev.14"
31
+ "@epam/ai-dial-sidebar": "1.3.0-dev.141"
33
32
  },
34
33
  "peerDependencies": {
35
- "@epam/ai-dial-chat-shared": "1.3.0-dev.14",
36
- "@epam/ai-dial-ui-kit": "^0.15.1",
34
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.141",
35
+ "@epam/ai-dial-ui-kit": "^0.16.0-dev.22",
37
36
  "react": "^19.2.8"
38
37
  },
39
38
  "repository": {
@@ -5,7 +5,7 @@
5
5
  * package), and either way the import stays external so consumers get one
6
6
  * shared copy rather than a second one inlined here.
7
7
  */
8
- export declare const EXTERNAL_PACKAGE_NAMES: readonly ["react", "@silurus/ooxml", "@epam/ai-dial-chat-shared", "@epam/ai-dial-shared", "@epam/ai-dial-sidebar", "@epam/ai-dial-ui-kit", "@epam/ai-dial-visualizer-connector", "@tabler/icons-react", "react-json-view-lite", "@epam/ai-dial-react-pdf-highlighter", "@epam/pdf-highlighter-kit", "react-syntax-highlighter", "@mcp-ui/client", "@modelcontextprotocol/sdk", "@modelcontextprotocol/ext-apps", "pdfjs-dist"];
8
+ export declare const EXTERNAL_PACKAGE_NAMES: readonly ["react", "@silurus/ooxml", "@epam/ai-dial-chat-shared", "@epam/ai-dial-sidebar", "@epam/ai-dial-ui-kit", "@epam/ai-dial-visualizer-connector", "@tabler/icons-react", "react-json-view-lite", "@epam/ai-dial-react-pdf-highlighter", "@epam/pdf-highlighter-kit", "react-syntax-highlighter", "@mcp-ui/client", "@modelcontextprotocol/sdk", "@modelcontextprotocol/ext-apps", "pdfjs-dist"];
9
9
  /**
10
10
  * Returns true when `id` is a bare runtime package name, or is prefixed by
11
11
  * `<packageName>/` (a deep subpath of that package), for any name in
@@ -1 +1 @@
1
- {"version":3,"file":"vite-external-matcher.d.ts","sourceRoot":"","sources":["../../src/utils/vite-external-matcher.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,gaAiBzB,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAAI,IAAI,MAAM,KAAG,OAKpD,CAAC"}
1
+ {"version":3,"file":"vite-external-matcher.d.ts","sourceRoot":"","sources":["../../src/utils/vite-external-matcher.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,wYAgBzB,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAAI,IAAI,MAAM,KAAG,OAKpD,CAAC"}