@epam/ai-dial-attachment-canvas 1.2.0-dev.111 → 1.2.0-dev.115

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.
@@ -15,6 +15,8 @@ export interface AttachmentCanvasContainerProps {
15
15
  codeBlockTheme?: CodeBlockTheme;
16
16
  /** Filename used when downloading a `MarkdownTable`'s content as CSV. Defaults to `'table.csv'`. */
17
17
  tableDownloadFilename?: string;
18
+ /** Host-owned PDF loader. When omitted, the viewer fetches the URL with browser defaults. */
19
+ loadPdf?: (url: string) => Promise<Blob>;
18
20
  /**
19
21
  * Configures `pdfjs-dist`'s worker (`GlobalWorkerOptions.workerSrc`) for the
20
22
  * host app. Called once, the first time a PDF attachment is opened, and
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentCanvasContainer.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasContainer/AttachmentCanvasContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AAKxC,yDAAyD;AACzD,MAAM,WAAW,8BAA8B;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,oGAAoG;IACpG,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CA8ItE,CAAC"}
1
+ {"version":3,"file":"AttachmentCanvasContainer.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasContainer/AttachmentCanvasContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AAKxC,yDAAyD;AACzD,MAAM,WAAW,8BAA8B;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,oGAAoG;IACpG,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6FAA6F;IAC7F,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CAgJtE,CAAC"}
package/index.js CHANGED
@@ -4,8 +4,8 @@ import { AttachmentType as c, CodeBlockTheme as l, DEFAULT_MARKDOWN_CLASS_NAMES
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
6
  import { IconAlertTriangle as D, IconArrowsMaximize as O, IconCheck as k, IconCode as ee, IconCopy as te, IconDownload as ne, IconEye as re, IconLock as ie, IconMarkdown as ae, IconRefresh as oe } from "@tabler/icons-react";
7
- import { createContext as A, lazy as j, memo as M, useCallback as N, useContext as P, 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";
7
+ import { createContext as A, lazy as j, memo as M, useCallback as N, useContext as se, useEffect as P, useMemo as F, useRef as I, useState as L } from "react";
8
+ import { JsonView as R, defaultStyles as ce } from "react-json-view-lite";
9
9
  import { Fragment as le, jsx as z, jsxs as B } from "react/jsx-runtime";
10
10
  import { AppBridge as V, AppFrame as H } from "@mcp-ui/client";
11
11
  import { McpUiHostContextChangedNotificationSchema as ue } from "@modelcontextprotocol/ext-apps/app-bridge";
@@ -22,7 +22,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
22
22
  let { Prism: e } = await import("react-syntax-highlighter");
23
23
  return { default: e };
24
24
  }), ge = M(({ 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 = N(() => {
25
+ let { text: r, language: i } = e, a = i == null || i === "plaintext", o = he[t], c = t === l.Light, [u, d] = L(0), f = F(U, [u]), p = N(() => {
26
26
  d((e) => e + 1);
27
27
  }, []), m = /* @__PURE__ */ z("pre", {
28
28
  className: "whitespace-pre-wrap break-words p-4",
@@ -55,8 +55,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
55
55
  })
56
56
  });
57
57
  }), _e = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ve = M(({ 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(() => {
58
+ let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = L(!0), [d, f] = L(!1), p = I(null);
59
+ P(() => {
60
60
  u(!0), f(!1);
61
61
  }, [e]);
62
62
  let m = N((t) => {
@@ -131,12 +131,12 @@ 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 = L(e);
135
- F(() => {
134
+ let r = I(e);
135
+ P(() => {
136
136
  r.current = e;
137
137
  });
138
- let [i, a] = R(null), [o, s] = R(!1);
139
- return F(() => {
138
+ let [i, a] = L(null), [o, s] = L(!1);
139
+ return P(() => {
140
140
  let e = null;
141
141
  try {
142
142
  let n = t.current?.getBoundingClientRect(), i = n != null && n.width > 0 && n.height > 0 ? {
@@ -162,7 +162,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
162
162
  return () => {
163
163
  e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
164
164
  };
165
- }, [t]), F(() => {
165
+ }, [t]), P(() => {
166
166
  i != null && i.transport != null && n != null && i.setHostContext(n);
167
167
  }, [i, n]), {
168
168
  appBridge: i,
@@ -176,8 +176,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
176
176
  statusDetail: "_statusDetail_iea4a_38",
177
177
  errorIcon: "_errorIcon_iea4a_42"
178
178
  }, we = ({ content: e, errorLabel: t = "Failed to load app", onAppInfo: n }) => {
179
- let [r, i] = R("loading"), [a, o] = R(), { html: s, sandboxUrl: c, toolInput: l, toolResult: u, hostContext: d } = e, f = I(() => ({ url: new URL(c) }), [c]), p = d?.displayMode === "fullscreen", m = L(null), [h, _] = R();
180
- F(() => {
179
+ let [r, i] = L("loading"), [a, o] = L(), { html: s, sandboxUrl: c, toolInput: l, toolResult: u, hostContext: d } = e, f = F(() => ({ url: new URL(c) }), [c]), p = d?.displayMode === "fullscreen", m = I(null), [h, _] = L();
180
+ P(() => {
181
181
  let e = m.current;
182
182
  if (!e) return;
183
183
  let t = new ResizeObserver(([e]) => {
@@ -190,7 +190,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
190
190
  });
191
191
  return t.observe(e), () => t.disconnect();
192
192
  }, []);
193
- let { appBridge: v, hasFailed: y } = Ce(e, m, I(() => d == null || h == null ? d : {
193
+ let { appBridge: v, hasFailed: y } = Ce(e, m, F(() => d == null || h == null ? d : {
194
194
  ...d,
195
195
  containerDimensions: h
196
196
  }, [d, h])), b = y || r === "error";
@@ -362,10 +362,10 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
362
362
  }
363
363
  }
364
364
  }, 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" }) => {
365
- 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);
365
+ let l = I(null), [u, d] = L(!0), [f, p] = L(!1), [m, h] = L(""), [_, v] = L([]), [y, b] = L(!1), { highlights: x, selectedHighlightId: C } = t, w = x != null && x.length > 0, T = I(void 0), O = I(x);
366
366
  O.current = x;
367
- let k = L(void 0);
368
- return F(() => {
367
+ let k = I(void 0);
368
+ return P(() => {
369
369
  let e = l.current;
370
370
  if (e == null) return;
371
371
  let n, r, i = !1, a, o = () => i;
@@ -426,9 +426,9 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
426
426
  t.format,
427
427
  t.url,
428
428
  w
429
- ]), F(() => {
429
+ ]), P(() => {
430
430
  k.current?.();
431
- }, [x]), F(() => {
431
+ }, [x]), P(() => {
432
432
  b(!1);
433
433
  let t = T.current;
434
434
  if (t == null || u) return;
@@ -521,8 +521,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
521
521
  statusLabel: "_statusLabel_12637_5",
522
522
  errorIcon: "_errorIcon_12637_9"
523
523
  }, je = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: a }) => {
524
- let o = L(null), [s, c] = R("loading"), { url: l, visualizerName: u, requestTimeout: d } = e, f = L(e);
525
- return f.current = e, F(() => {
524
+ let o = I(null), [s, c] = L("loading"), { url: l, visualizerName: u, requestTimeout: d } = e, f = I(e);
525
+ return f.current = e, P(() => {
526
526
  let e = o.current;
527
527
  if (!e) return;
528
528
  c("loading");
@@ -559,7 +559,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
559
559
  l,
560
560
  u,
561
561
  d
562
- ]), F(() => {
562
+ ]), P(() => {
563
563
  let e = r ?? u.trim();
564
564
  e !== "" && o.current?.querySelector("iframe")?.setAttribute("title", e);
565
565
  }, [
@@ -617,8 +617,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
617
617
  jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
618
618
  jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
619
619
  }, Me = () => j(async () => ({ default: (await import("./PdfContent-BoAtghsO.js")).PdfContent })), Ne = ({ url: e, fileName: t, loadErrorLabel: n }) => {
620
- let [r, i] = R(!1);
621
- return F(() => {
620
+ let [r, i] = L(!1);
621
+ return P(() => {
622
622
  i(!1);
623
623
  }, [e]), r ? /* @__PURE__ */ B("div", {
624
624
  className: "flex flex-col items-center gap-2",
@@ -640,10 +640,10 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
640
640
  i.PlainText,
641
641
  i.Code,
642
642
  i.Ooxml
643
- ]), Fe = M(({ 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: te, tableCopiedLabel: ne, tableDownloadCsvLabel: re, ooxmlHighlightsLabel: ae, ooxmlHighlightNavigatedLabel: oe } = {}, styles: A, codeBlockTheme: j, tableDownloadFilename: M, loadPdf: P, hidePdfToolbar: F = !1, configurePdfWorker: L, onAppInfo: le }) => {
644
- let { colors: V, typography: H, bodyClassName: ue, cssVars: de } = A ?? {}, [fe, pe] = R(0), me = I(Me, [fe]), he = N(() => {
643
+ ]), Fe = M(({ 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: te, tableCopiedLabel: ne, tableDownloadCsvLabel: re, ooxmlHighlightsLabel: ae, ooxmlHighlightNavigatedLabel: oe } = {}, styles: A, codeBlockTheme: j, tableDownloadFilename: M, loadPdf: se, hidePdfToolbar: P = !1, configurePdfWorker: I, onAppInfo: le }) => {
644
+ let { colors: V, typography: H, bodyClassName: ue, cssVars: de } = A ?? {}, [fe, pe] = L(0), me = F(Me, [fe]), he = N(() => {
645
645
  pe((e) => e + 1);
646
- }, []), U = H?.fontClassName != null, _e = I(() => ({
646
+ }, []), U = H?.fontClassName != null, _e = F(() => ({
647
647
  ...m({
648
648
  "--ac-text": V?.text,
649
649
  "--ac-status-text": V?.statusText,
@@ -675,7 +675,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
675
675
  "--ac-letter-spacing": U ? void 0 : H?.letterSpacing
676
676
  }),
677
677
  ...de
678
- }), [A]), ye = I(() => {
678
+ }), [A]), ye = F(() => {
679
679
  switch (e.type) {
680
680
  case i.Image:
681
681
  case i.Audio:
@@ -693,7 +693,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
693
693
  case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
694
694
  default: return "h-full overflow-auto p-4";
695
695
  }
696
- }, [e.type]), be = I(() => {
696
+ }, [e.type]), be = F(() => {
697
697
  switch (e.type) {
698
698
  case i.PlainText: return /* @__PURE__ */ z("pre", {
699
699
  className: g("whitespace-pre-wrap break-words", K.body, H?.fontClassName),
@@ -743,7 +743,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
743
743
  className: "h-full overflow-auto",
744
744
  children: /* @__PURE__ */ z("div", {
745
745
  className: g("m-3 overflow-auto rounded-md border", K.jsonWrapper),
746
- children: /* @__PURE__ */ z(se, {
746
+ children: /* @__PURE__ */ z(R, {
747
747
  data: e.value,
748
748
  style: {
749
749
  container: g("whitespace-pre-wrap break-words p-2", H?.jsonClassName ?? "dial-code-text"),
@@ -798,9 +798,9 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
798
798
  highlights: e.highlights ?? [],
799
799
  selectedHighlightId: e.selectedHighlightId,
800
800
  selectedPageNumber: e.page,
801
- loadPdf: P,
802
- hideHeader: F,
803
- configurePdfWorker: L,
801
+ loadPdf: se,
802
+ hideHeader: P,
803
+ configurePdfWorker: I,
804
804
  labels: {
805
805
  thumbnailsLabel: _,
806
806
  showThumbnailsLabel: v,
@@ -864,9 +864,9 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
864
864
  h,
865
865
  a,
866
866
  M,
867
+ se,
867
868
  P,
868
- F,
869
- L,
869
+ I,
870
870
  le,
871
871
  _,
872
872
  v,
@@ -896,24 +896,24 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
896
896
  }), Ie = {
897
897
  mcpAppDivider: "_mcpAppDivider_1jh5p_1",
898
898
  mcpAppVersion: "_mcpAppVersion_1jh5p_5"
899
- }, Le = 2e3, Re = M(({ 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: ie = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: M = "Reload", pdfThumbnailsLabel: P, 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 }) => {
900
- 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 = N(() => {
899
+ }, Le = 2e3, Re = M(({ 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: ie = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: M = "Reload", pdfThumbnailsLabel: se, pdfShowThumbnailsLabel: R, 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 }) => {
900
+ let [Me, Ne] = L(!1), [Pe, Re] = L(!1), [ze, q] = L(!1), [J, Be] = L(!1), [Ve, He] = L(void 0), Y = I(null), X = I(null), Z = I(null), Ue = N(() => {
901
901
  Se?.(), Y.current != null && clearTimeout(Y.current), Ne(!0), Y.current = setTimeout(() => Ne(!1), Le);
902
902
  }, [Se]), We = N(() => {
903
903
  Ce?.(), X.current != null && clearTimeout(X.current), Re(!0), X.current = setTimeout(() => Re(!1), Le);
904
904
  }, [Ce]), Ge = N(() => {
905
905
  W?.(), Z.current != null && clearTimeout(Z.current), q(!0), Z.current = setTimeout(() => q(!1), Le);
906
906
  }, [W]);
907
- F(() => () => {
907
+ P(() => () => {
908
908
  Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
909
909
  }, []);
910
910
  let Ke = N(() => {
911
911
  Be((e) => !e);
912
912
  }, []);
913
- F(() => {
913
+ P(() => {
914
914
  Be(!1), He(void 0);
915
915
  }, [r]);
916
- let { className: Q, panelStyles: qe, ...Je } = ke ?? {}, { colors: $, typography: Ye } = Je, Xe = I(() => m({
916
+ let { className: Q, panelStyles: qe, ...Je } = ke ?? {}, { colors: $, typography: Ye } = Je, Xe = F(() => m({
917
917
  "--ac-mcp-app-divider": $?.mcpAppDividerColor,
918
918
  "--ac-mcp-app-version": $?.mcpAppVersionColor
919
919
  }), [$?.mcpAppDividerColor, $?.mcpAppVersionColor]), Ze = r.type === i.McpApp && Ve != null ? /* @__PURE__ */ B("span", {
@@ -1027,8 +1027,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
1027
1027
  visualizerErrorLabel: C,
1028
1028
  htmlFrameBlockedLabel: O,
1029
1029
  htmlOpenInNewTabLabel: ie,
1030
- pdfThumbnailsLabel: P,
1031
- pdfShowThumbnailsLabel: se,
1030
+ pdfThumbnailsLabel: se,
1031
+ pdfShowThumbnailsLabel: R,
1032
1032
  pdfHideThumbnailsLabel: ce,
1033
1033
  pdfPageNumberLabel: V,
1034
1034
  pdfContentLoadingLabel: H,
@@ -1157,18 +1157,18 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
1157
1157
  }, Ze = A(void 0);
1158
1158
  Ze.displayName = "AttachmentCanvasContext";
1159
1159
  var Qe = ({ children: e }) => {
1160
- let [t, n] = R(!1), [r, i] = R(!1), [a, o] = R(Xe), [s, c] = R(void 0), [l, u] = R(void 0), d = N((e, t) => {
1160
+ let [t, n] = L(!1), [r, i] = L(!1), [a, o] = L(Xe), [s, c] = L(void 0), [l, u] = L(void 0), d = N((e, t) => {
1161
1161
  c(e), u(t), i(!0), n(!0);
1162
1162
  }, []), f = N((e, t, r) => {
1163
1163
  o(e), c(t), u(r), i(!1), n(!0);
1164
1164
  }, []), p = N(() => {
1165
1165
  o(Xe), n(!1), i(!1), u(void 0);
1166
1166
  }, []);
1167
- return F(() => () => {
1167
+ return P(() => () => {
1168
1168
  let e = $(a);
1169
1169
  e != null && URL.revokeObjectURL(e);
1170
1170
  }, [a]), /* @__PURE__ */ z(Ze.Provider, {
1171
- value: I(() => ({
1171
+ value: F(() => ({
1172
1172
  isOpen: t,
1173
1173
  isLoading: r,
1174
1174
  content: a,
@@ -1190,69 +1190,70 @@ var Qe = ({ children: e }) => {
1190
1190
  children: e
1191
1191
  });
1192
1192
  }, $e = () => {
1193
- let e = P(Ze);
1193
+ let e = se(Ze);
1194
1194
  if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
1195
1195
  return e;
1196
- }, et = M(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
1197
- 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: te, pdfContentRetryLabel: ne, xlsxFormulaLabel: re, codeContentLoadingLabel: ie, codeContentErrorLabel: ae, codeContentRetryLabel: oe, tableCopyLabel: A, tableCopiedLabel: j, tableDownloadCsvLabel: M, ooxmlHighlightsLabel: P, ooxmlHighlightNavigatedLabel: F } = e ?? {}, { isOpen: I, isLoading: L, content: R, fileName: se, closeCanvas: ce } = $e(), le = N(() => {
1198
- a(R, se);
1199
- }, [R, se]), B = N(() => {
1196
+ }, et = M(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, loadPdf: c, configurePdfWorker: l }) => {
1197
+ let { ariaLabel: u = "Attachment preview", closeLabel: d = "Close", downloadLabel: f = "Download", unsupportedLabel: p = "Preview is not supported for this file", loadErrorLabel: m = "Failed to load file", forbiddenErrorLabel: g = "You don't have permission to access this file", copyTextLabel: _, copiedTextLabel: v, copyMarkdownLabel: y, copiedMarkdownLabel: b, copyJsonLabel: x, copiedJsonLabel: S, htmlFrameBlockedLabel: C, htmlOpenInNewTabLabel: w, htmlViewSourceLabel: T, htmlViewRenderedLabel: E, pdfThumbnailsLabel: D, pdfShowThumbnailsLabel: O, pdfHideThumbnailsLabel: k, pdfPageNumberLabel: ee, pdfContentLoadingLabel: te, pdfContentErrorLabel: ne, pdfContentRetryLabel: re, xlsxFormulaLabel: ie, codeContentLoadingLabel: ae, codeContentErrorLabel: oe, codeContentRetryLabel: A, tableCopyLabel: j, tableCopiedLabel: M, tableDownloadCsvLabel: se, ooxmlHighlightsLabel: P, ooxmlHighlightNavigatedLabel: F } = e ?? {}, { isOpen: I, isLoading: L, content: R, fileName: ce, closeCanvas: le } = $e(), B = N(() => {
1198
+ a(R, ce);
1199
+ }, [R, ce]), V = N(() => {
1200
1200
  (R.type === i.PlainText || R.type === i.Code) && h(R.text);
1201
- }, [R]), V = N(() => {
1202
- R.type === i.Markdown && h(R.text);
1203
1201
  }, [R]), H = N(() => {
1202
+ R.type === i.Markdown && h(R.text);
1203
+ }, [R]), ue = N(() => {
1204
1204
  R.type === i.Json && h(JSON.stringify(R.value, null, 2));
1205
1205
  }, [R]);
1206
1206
  return /* @__PURE__ */ z(Re, {
1207
1207
  isOpen: I,
1208
1208
  isLoading: L,
1209
- onClose: ce,
1209
+ onClose: le,
1210
1210
  content: R,
1211
- fileName: se,
1211
+ fileName: ce,
1212
1212
  labels: {
1213
- ariaLabel: l,
1214
- closeLabel: u,
1215
- downloadLabel: d,
1216
- copyTextLabel: g,
1217
- copiedTextLabel: _,
1218
- copyMarkdownLabel: v,
1219
- copiedMarkdownLabel: y,
1220
- copyJsonLabel: b,
1221
- copiedJsonLabel: x,
1222
- unsupportedLabel: f,
1223
- loadErrorLabel: p,
1224
- forbiddenErrorLabel: m,
1225
- htmlFrameBlockedLabel: S,
1226
- htmlOpenInNewTabLabel: C,
1227
- htmlViewSourceLabel: w,
1228
- htmlViewRenderedLabel: T,
1229
- pdfThumbnailsLabel: E,
1230
- pdfShowThumbnailsLabel: D,
1231
- pdfHideThumbnailsLabel: O,
1232
- pdfPageNumberLabel: k,
1233
- pdfContentLoadingLabel: ee,
1234
- pdfContentErrorLabel: te,
1235
- pdfContentRetryLabel: ne,
1236
- xlsxFormulaLabel: re,
1237
- codeContentLoadingLabel: ie,
1238
- codeContentErrorLabel: ae,
1239
- codeContentRetryLabel: oe,
1240
- tableCopyLabel: A,
1241
- tableCopiedLabel: j,
1242
- tableDownloadCsvLabel: M,
1213
+ ariaLabel: u,
1214
+ closeLabel: d,
1215
+ downloadLabel: f,
1216
+ copyTextLabel: _,
1217
+ copiedTextLabel: v,
1218
+ copyMarkdownLabel: y,
1219
+ copiedMarkdownLabel: b,
1220
+ copyJsonLabel: x,
1221
+ copiedJsonLabel: S,
1222
+ unsupportedLabel: p,
1223
+ loadErrorLabel: m,
1224
+ forbiddenErrorLabel: g,
1225
+ htmlFrameBlockedLabel: C,
1226
+ htmlOpenInNewTabLabel: w,
1227
+ htmlViewSourceLabel: T,
1228
+ htmlViewRenderedLabel: E,
1229
+ pdfThumbnailsLabel: D,
1230
+ pdfShowThumbnailsLabel: O,
1231
+ pdfHideThumbnailsLabel: k,
1232
+ pdfPageNumberLabel: ee,
1233
+ pdfContentLoadingLabel: te,
1234
+ pdfContentErrorLabel: ne,
1235
+ pdfContentRetryLabel: re,
1236
+ xlsxFormulaLabel: ie,
1237
+ codeContentLoadingLabel: ae,
1238
+ codeContentErrorLabel: oe,
1239
+ codeContentRetryLabel: A,
1240
+ tableCopyLabel: j,
1241
+ tableCopiedLabel: M,
1242
+ tableDownloadCsvLabel: se,
1243
1243
  ooxmlHighlightsLabel: P,
1244
1244
  ooxmlHighlightNavigatedLabel: F
1245
1245
  },
1246
- onDownload: le,
1247
- onCopyText: R.type === i.PlainText || R.type === i.Code ? B : void 0,
1248
- onCopyMarkdown: R.type === i.Markdown ? V : void 0,
1249
- onCopyJson: R.type === i.Json ? H : void 0,
1246
+ onDownload: B,
1247
+ onCopyText: R.type === i.PlainText || R.type === i.Code ? V : void 0,
1248
+ onCopyMarkdown: R.type === i.Markdown ? H : void 0,
1249
+ onCopyJson: R.type === i.Json ? ue : void 0,
1250
1250
  tableDownloadFilename: s,
1251
1251
  isMobile: t,
1252
1252
  defaultWidth: n,
1253
1253
  maxWidth: r,
1254
1254
  codeBlockTheme: o,
1255
- configurePdfWorker: c
1255
+ configurePdfWorker: l,
1256
+ loadPdf: c
1256
1257
  });
1257
1258
  }), tt = {
1258
1259
  frame: "_frame_g47g7_1",
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.2.0-dev.111",
4
+ "version": "1.2.0-dev.115",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -29,10 +29,10 @@
29
29
  "@modelcontextprotocol/sdk": "^1.29.0",
30
30
  "@modelcontextprotocol/ext-apps": "1.7.5",
31
31
  "pdfjs-dist": "^5.4.149",
32
- "@epam/ai-dial-sidebar": "1.2.0-dev.111"
32
+ "@epam/ai-dial-sidebar": "1.2.0-dev.115"
33
33
  },
34
34
  "peerDependencies": {
35
- "@epam/ai-dial-chat-shared": "1.2.0-dev.111",
35
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.115",
36
36
  "@epam/ai-dial-ui-kit": "^0.15.0-dev.15",
37
37
  "react": "^19.2.8"
38
38
  },