@epam/ai-dial-attachment-canvas 1.1.0-dev.56 → 1.1.0-dev.58

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvas/AttachmentCanvas.tsx"],"names":[],"mappings":"AA8BA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AA2a5E,wGAAwG;AACxG,eAAO,MAAM,gBAAgB,6DAA6B,CAAC"}
1
+ {"version":3,"file":"AttachmentCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvas/AttachmentCanvas.tsx"],"names":[],"mappings":"AA8BA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAob5E,wGAAwG;AACxG,eAAO,MAAM,gBAAgB,6DAA6B,CAAC"}
@@ -2,10 +2,15 @@ import { InputHighlightData } from '@epam/pdf-highlighter-kit';
2
2
  import { FC } from 'react';
3
3
  /** Props for the `PdfContent` component. */
4
4
  export interface PdfContentProps {
5
+ /** URL of the PDF file to display. */
5
6
  url: string;
7
+ /** Highlight annotations to overlay on the document. */
6
8
  highlights: InputHighlightData[];
9
+ /** ID of the highlight that should be scrolled into view on mount. */
7
10
  selectedHighlightId?: string;
11
+ /** Custom fetcher for the PDF blob; falls back to a plain `fetch` wrapper. */
8
12
  loadPdf?: (url: string) => Promise<Blob>;
13
+ /** File name shown in the canvas header. */
9
14
  fileName?: string;
10
15
  }
11
16
  /** Renders a PDF with highlight annotations, a sidebar thumbnail strip, and page navigation. */
@@ -1 +1 @@
1
- {"version":3,"file":"PdfContent.d.ts","sourceRoot":"","sources":["../../../src/components/PdfContent/PdfContent.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,KAAK,EAAE,EAMR,MAAM,OAAO,CAAC;AAIf,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,gGAAgG;AAChG,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAyF1C,CAAC"}
1
+ {"version":3,"file":"PdfContent.d.ts","sourceRoot":"","sources":["../../../src/components/PdfContent/PdfContent.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,KAAK,EAAE,EAMR,MAAM,OAAO,CAAC;AASf,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,8EAA8E;IAC9E,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,gGAAgG;AAChG,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA4N1C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentCanvasContext.d.ts","sourceRoot":"","sources":["../../src/context/AttachmentCanvasContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AA2B3E,sDAAsD;AACtD,MAAM,WAAW,4BAA4B;IAC3C,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,uFAAuF;IACvF,SAAS,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,OAAO,EAAE,uBAAuB,CAAC;IACjC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,kFAAkF;IAClF,iBAAiB,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,qEAAqE;IACrE,UAAU,EAAE,CAAC,OAAO,EAAE,uBAAuB,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,wBAAwB;IACxB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAOD,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,GAAI,eAEtC;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAgEA,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB,QAAO,4BAQtC,CAAC"}
1
+ {"version":3,"file":"AttachmentCanvasContext.d.ts","sourceRoot":"","sources":["../../src/context/AttachmentCanvasContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AA2B3E,sDAAsD;AACtD,MAAM,WAAW,4BAA4B;IAC3C,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,uFAAuF;IACvF,SAAS,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,OAAO,EAAE,uBAAuB,CAAC;IACjC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,kFAAkF;IAClF,iBAAiB,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,qEAAqE;IACrE,UAAU,EAAE,CAAC,OAAO,EAAE,uBAAuB,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,wBAAwB;IACxB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAOD,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,GAAI,eAEtC;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAiEA,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB,QAAO,4BAQtC,CAAC"}
package/index.js CHANGED
@@ -1,76 +1,76 @@
1
1
  import { DEFAULT_MARKDOWN_CLASS_NAMES as e, MIMEType as t, MarkdownRenderer as n, buildCssVars as r, copyToClipboard as i, mergeClasses as a, triggerAnchorDownload as o, triggerBlobDownload as s, useIsMobile as c } from "@epam/ai-dial-chat-shared";
2
2
  import { SidebarOrientation as l, SidebarPanel as u } from "@epam/ai-dial-sidebar";
3
3
  import { DIAL_ICON_SIZE as d, DialButton as f, DialCheckbox as p, DialEllipsisTooltip as m, DialGhostIconButton as h, DialLoader as g, DialSelect as _, DialSpinner as v, ElementSize as y, SelectSize as b, mergeClasses as x } from "@epam/ai-dial-ui-kit";
4
- import { IconAlertTriangle as S, IconCheck as C, IconChevronDown as w, IconChevronUp as T, IconCopy as E, IconDownload as ee, IconLock as te, IconMarkdown as ne, IconMinus as D, IconPlus as re } from "@tabler/icons-react";
5
- import { createContext as O, memo as ie, useCallback as k, useContext as ae, useEffect as A, useMemo as oe, useRef as se, useState as j } from "react";
6
- import { JsonView as ce, defaultStyles as le } from "react-json-view-lite";
7
- import { Fragment as ue, jsx as M, jsxs as N } from "react/jsx-runtime";
4
+ import { IconAlertTriangle as S, IconCheck as C, IconChevronDown as w, IconChevronUp as T, IconCopy as E, IconDownload as ee, IconLock as te, IconMarkdown as ne, IconMinus as D, IconPlus as O } from "@tabler/icons-react";
5
+ import { createContext as k, memo as re, useCallback as A, useContext as ie, useEffect as j, useMemo as ae, useRef as oe, useState as M } from "react";
6
+ import { JsonView as se, defaultStyles as ce } from "react-json-view-lite";
7
+ import { Fragment as le, jsx as N, jsxs as P } from "react/jsx-runtime";
8
8
  //#region src/types/attachment-canvas.ts
9
- var P = /* @__PURE__ */ function(e) {
9
+ var F = /* @__PURE__ */ function(e) {
10
10
  return e.PlainText = "plain_text", e.Image = "image", e.Audio = "audio", e.Markdown = "markdown", e.Json = "json", e.Pdf = "pdf", e.Unsupported = "unsupported", e.Error = "error", e;
11
- }({}), de = /* @__PURE__ */ function(e) {
11
+ }({}), ue = /* @__PURE__ */ function(e) {
12
12
  return e.LoadFailed = "load_failed", e.Forbidden = "forbidden", e;
13
- }({}), fe = (e) => {
13
+ }({}), de = (e) => {
14
14
  switch (e.type) {
15
- case P.PlainText:
16
- case P.Markdown:
17
- case P.Json:
18
- case P.Image:
19
- case P.Audio:
20
- case P.Pdf: return !0;
21
- case P.Unsupported: return e.url != null;
22
- case P.Error: return e.errorType !== de.Forbidden && e.url != null;
23
- }
24
- }, pe = async (e) => {
15
+ case F.PlainText:
16
+ case F.Markdown:
17
+ case F.Json:
18
+ case F.Image:
19
+ case F.Audio:
20
+ case F.Pdf: return !0;
21
+ case F.Unsupported: return e.url != null;
22
+ case F.Error: return e.errorType !== ue.Forbidden && e.url != null;
23
+ }
24
+ }, fe = async (e) => {
25
25
  let t = await fetch(e);
26
26
  if (!t.ok) throw Error(`HTTP ${t.status}`);
27
27
  return t.blob();
28
- }, me = (e, n) => {
28
+ }, pe = (e, n) => {
29
29
  let r = n ?? "attachment";
30
30
  switch (e.type) {
31
- case P.PlainText:
31
+ case F.PlainText:
32
32
  if (e.text === "") return;
33
33
  s(new Blob([e.text], { type: t.Plain }), r);
34
34
  return;
35
- case P.Markdown:
35
+ case F.Markdown:
36
36
  if (e.text === "") return;
37
37
  s(new Blob([e.text], { type: t.Markdown }), r);
38
38
  return;
39
- case P.Json:
39
+ case F.Json:
40
40
  s(new Blob([JSON.stringify(e.value, null, 2)], { type: t.JSON }), r);
41
41
  return;
42
- case P.Image:
43
- case P.Audio:
44
- case P.Pdf:
42
+ case F.Image:
43
+ case F.Audio:
44
+ case F.Pdf:
45
45
  o(e.url, r);
46
46
  return;
47
- case P.Unsupported:
47
+ case F.Unsupported:
48
48
  if (e.url == null) return;
49
49
  o(e.url, r);
50
50
  return;
51
- case P.Error:
52
- if (!fe(e)) return;
51
+ case F.Error:
52
+ if (!de(e)) return;
53
53
  o(e.url, r);
54
54
  return;
55
55
  }
56
- }, he;
56
+ }, me;
57
57
  (function(e) {
58
58
  e.Clockwise = "cw", e.CounterClockwise = "ccw";
59
- })(he ||= {});
60
- var ge;
59
+ })(me ||= {});
60
+ var he;
61
61
  (function(e) {
62
62
  e.AUTO = "auto", e.PAGE_FIT = "page-fit";
63
- })(ge ||= {});
63
+ })(he ||= {});
64
64
  //#endregion
65
65
  //#region ../../node_modules/pdfjs-dist/build/pdf.mjs
66
- var _e = {};
67
- _e.d = (e, t) => {
68
- for (var n in t) _e.o(t, n) && !_e.o(e, n) && Object.defineProperty(e, n, {
66
+ var ge = {};
67
+ ge.d = (e, t) => {
68
+ for (var n in t) ge.o(t, n) && !ge.o(e, n) && Object.defineProperty(e, n, {
69
69
  enumerable: !0,
70
70
  get: t[n]
71
71
  });
72
- }, _e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
73
- var F = typeof process == "object" && process + "" == "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser"), ve = [
72
+ }, ge.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
73
+ var _e = typeof process == "object" && process + "" == "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser"), ve = [
74
74
  .001,
75
75
  0,
76
76
  0,
@@ -2985,13 +2985,13 @@ var At = class {
2985
2985
  } else v ? w = rt(Math.abs(b[0] - y[0] - E), l, 1) / s : T = rt(Math.abs(b[1] - y[1] - ee), u, 1) / c;
2986
2986
  let te = e._round(s * w), ne = e._round(c * T);
2987
2987
  x = f(...g(te, ne));
2988
- let D = S - x[0], re = C - x[1];
2988
+ let D = S - x[0], O = C - x[1];
2989
2989
  this.#m ||= [
2990
2990
  this.x,
2991
2991
  this.y,
2992
2992
  this.width,
2993
2993
  this.height
2994
- ], this.width = te, this.height = ne, this.x = D, this.y = re, this.setDims(r * te, i * ne), this.fixAndSetPosition(), this._onResizing();
2994
+ ], this.width = te, this.height = ne, this.x = D, this.y = O, this.setDims(r * te, i * ne), this.fixAndSetPosition(), this._onResizing();
2995
2995
  }
2996
2996
  _onResizing() {}
2997
2997
  altTextFinish() {
@@ -3699,7 +3699,7 @@ var At = class {
3699
3699
  return U(this, "isFontLoadingAPISupported", e);
3700
3700
  }
3701
3701
  get isSyncFontLoadingSupported() {
3702
- return U(this, "isSyncFontLoadingSupported", F || W.platform.isFirefox);
3702
+ return U(this, "isSyncFontLoadingSupported", _e || W.platform.isFirefox);
3703
3703
  }
3704
3704
  _queueLoadingCallback(e) {
3705
3705
  function t() {
@@ -3799,14 +3799,14 @@ var At = class {
3799
3799
  function Yt(e) {
3800
3800
  if (e instanceof URL) return e.href;
3801
3801
  if (typeof e == "string") {
3802
- if (F) return e;
3802
+ if (_e) return e;
3803
3803
  let t = URL.parse(e, window.location);
3804
3804
  if (t) return t.href;
3805
3805
  }
3806
3806
  throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.");
3807
3807
  }
3808
3808
  function Xt(e) {
3809
- if (F && typeof Buffer < "u" && e instanceof Buffer) throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");
3809
+ if (_e && typeof Buffer < "u" && e instanceof Buffer) throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");
3810
3810
  if (e instanceof Uint8Array && e.byteLength === e.buffer.byteLength) return e;
3811
3811
  if (typeof e == "string") return Ge(e);
3812
3812
  if (e instanceof ArrayBuffer || ArrayBuffer.isView(e) || typeof e == "object" && !isNaN(e?.length)) return new Uint8Array(e);
@@ -4411,7 +4411,7 @@ var an = class {
4411
4411
  return new Uint8Array(t);
4412
4412
  }
4413
4413
  };
4414
- F && B("Please use the `legacy` build in Node.js environments.");
4414
+ _e && B("Please use the `legacy` build in Node.js environments.");
4415
4415
  async function gn(e) {
4416
4416
  let t = await process.getBuiltinModule("fs").promises.readFile(e);
4417
4417
  return new Uint8Array(t);
@@ -4869,19 +4869,19 @@ function kn(e, t, n, r, i, a, o, s) {
4869
4869
  c[n + 1] > c[r + 1] && (f = n, n = r, r = f, f = a, a = o, o = f), c[r + 1] > c[i + 1] && (f = r, r = i, i = f, f = o, o = s, s = f), c[n + 1] > c[r + 1] && (f = n, n = r, r = f, f = a, a = o, o = f);
4870
4870
  let p = (c[n] + t.offsetX) * t.scaleX, m = (c[n + 1] + t.offsetY) * t.scaleY, h = (c[r] + t.offsetX) * t.scaleX, g = (c[r + 1] + t.offsetY) * t.scaleY, _ = (c[i] + t.offsetX) * t.scaleX, v = (c[i + 1] + t.offsetY) * t.scaleY;
4871
4871
  if (m >= v) return;
4872
- let y = l[a], b = l[a + 1], x = l[a + 2], S = l[o], C = l[o + 1], w = l[o + 2], T = l[s], E = l[s + 1], ee = l[s + 2], te = Math.round(m), ne = Math.round(v), D, re, O, ie, k, ae, A, oe;
4872
+ let y = l[a], b = l[a + 1], x = l[a + 2], S = l[o], C = l[o + 1], w = l[o + 2], T = l[s], E = l[s + 1], ee = l[s + 2], te = Math.round(m), ne = Math.round(v), D, O, k, re, A, ie, j, ae;
4873
4873
  for (let e = te; e <= ne; e++) {
4874
4874
  if (e < g) {
4875
4875
  let t = e < m ? 0 : (m - e) / (m - g);
4876
- D = p - (p - h) * t, re = y - (y - S) * t, O = b - (b - C) * t, ie = x - (x - w) * t;
4876
+ D = p - (p - h) * t, O = y - (y - S) * t, k = b - (b - C) * t, re = x - (x - w) * t;
4877
4877
  } else {
4878
4878
  let t;
4879
- t = e > v ? 1 : g === v ? 0 : (g - e) / (g - v), D = h - (h - _) * t, re = S - (S - T) * t, O = C - (C - E) * t, ie = w - (w - ee) * t;
4879
+ t = e > v ? 1 : g === v ? 0 : (g - e) / (g - v), D = h - (h - _) * t, O = S - (S - T) * t, k = C - (C - E) * t, re = w - (w - ee) * t;
4880
4880
  }
4881
4881
  let t;
4882
- t = e < m ? 0 : e > v ? 1 : (m - e) / (m - v), k = p - (p - _) * t, ae = y - (y - T) * t, A = b - (b - E) * t, oe = x - (x - ee) * t;
4883
- let n = Math.round(Math.min(D, k)), r = Math.round(Math.max(D, k)), i = d * e + n * 4;
4884
- for (let e = n; e <= r; e++) t = (D - e) / (D - k), t < 0 ? t = 0 : t > 1 && (t = 1), u[i++] = re - (re - ae) * t | 0, u[i++] = O - (O - A) * t | 0, u[i++] = ie - (ie - oe) * t | 0, u[i++] = 255;
4882
+ t = e < m ? 0 : e > v ? 1 : (m - e) / (m - v), A = p - (p - _) * t, ie = y - (y - T) * t, j = b - (b - E) * t, ae = x - (x - ee) * t;
4883
+ let n = Math.round(Math.min(D, A)), r = Math.round(Math.max(D, A)), i = d * e + n * 4;
4884
+ for (let e = n; e <= r; e++) t = (D - e) / (D - A), t < 0 ? t = 0 : t > 1 && (t = 1), u[i++] = O - (O - ie) * t | 0, u[i++] = k - (k - j) * t | 0, u[i++] = re - (re - ae) * t | 0, u[i++] = 255;
4885
4885
  }
4886
4886
  }
4887
4887
  function An(e, t, n) {
@@ -4971,8 +4971,8 @@ var Pn = {
4971
4971
  G.singularValueDecompose2dScale(this.baseTransform, h);
4972
4972
  let v = g * h[0], y = _ * h[1], b = p, x = m, S = !1, C = !1, w = Math.ceil(s * v), T = Math.ceil(c * y), E = Math.ceil(p * v), ee = Math.ceil(m * y);
4973
4973
  w >= E ? b = s : S = !0, T >= ee ? x = c : C = !0;
4974
- let te = this.getSizeAndScale(b, this.ctx.canvas.width, v), ne = this.getSizeAndScale(x, this.ctx.canvas.height, y), D = e.cachedCanvases.getCanvas("pattern", te.size, ne.size), re = D.context, O = o.createCanvasGraphics(re);
4975
- if (O.groupLevel = e.groupLevel, this.setFillAndStrokeStyleToContext(O, r, a), re.translate(-te.scale * l, -ne.scale * u), O.transform(0, te.scale, 0, 0, ne.scale, 0, 0), re.save(), O.dependencyTracker?.save(), this.clipBbox(O, l, u, d, f), O.baseTransform = q(O.ctx), O.executeOperatorList(n), O.endDrawing(), O.dependencyTracker?.restore().recordNestedDependencies?.(), re.restore(), S || C) {
4974
+ let te = this.getSizeAndScale(b, this.ctx.canvas.width, v), ne = this.getSizeAndScale(x, this.ctx.canvas.height, y), D = e.cachedCanvases.getCanvas("pattern", te.size, ne.size), O = D.context, k = o.createCanvasGraphics(O);
4975
+ if (k.groupLevel = e.groupLevel, this.setFillAndStrokeStyleToContext(k, r, a), O.translate(-te.scale * l, -ne.scale * u), k.transform(0, te.scale, 0, 0, ne.scale, 0, 0), O.save(), k.dependencyTracker?.save(), this.clipBbox(k, l, u, d, f), k.baseTransform = q(k.ctx), k.executeOperatorList(n), k.endDrawing(), k.dependencyTracker?.restore().recordNestedDependencies?.(), O.restore(), S || C) {
4976
4976
  let t = D.canvas;
4977
4977
  S && (b = s), C && (x = c);
4978
4978
  let n = this.getSizeAndScale(b, this.ctx.canvas.width, v), r = this.getSizeAndScale(x, this.ctx.canvas.height, y), i = n.size, a = r.size, o = e.cachedCanvases.getCanvas("pattern-workaround", i, a), d = o.context, f = S ? Math.floor(p / s) : 0, h = C ? Math.floor(m / c) : 0;
@@ -7317,36 +7317,36 @@ var Pr = class {
7317
7317
  }, Ur = 100;
7318
7318
  function Wr(e = {}) {
7319
7319
  typeof e == "string" || e instanceof URL ? e = { url: e } : (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) && (e = { data: e });
7320
- let t = new Gr(), { docId: n } = t, r = e.url ? Yt(e.url) : null, i = e.data ? Xt(e.data) : null, a = e.httpHeaders || null, o = e.withCredentials === !0, s = e.password ?? null, c = e.range instanceof Kr ? e.range : null, l = Number.isInteger(e.rangeChunkSize) && e.rangeChunkSize > 0 ? e.rangeChunkSize : 2 ** 16, u = e.worker instanceof Yr ? e.worker : null, d = e.verbosity, f = typeof e.docBaseUrl == "string" && !dt(e.docBaseUrl) ? e.docBaseUrl : null, p = Zt(e.cMapUrl), m = e.cMapPacked !== !1, h = e.CMapReaderFactory || (F ? yn : ln), g = Zt(e.iccUrl), _ = Zt(e.standardFontDataUrl), v = e.StandardFontDataFactory || (F ? bn : pn), y = Zt(e.wasmUrl), b = e.WasmFactory || (F ? xn : hn), x = e.stopAtErrors !== !0, S = Number.isInteger(e.maxImageSize) && e.maxImageSize > -1 ? e.maxImageSize : -1, C = e.isEvalSupported !== !1, w = typeof e.isOffscreenCanvasSupported == "boolean" ? e.isOffscreenCanvasSupported : !F, T = typeof e.isImageDecoderSupported == "boolean" ? e.isImageDecoderSupported : !F && (W.platform.isFirefox || !globalThis.chrome), E = Number.isInteger(e.canvasMaxAreaInBytes) ? e.canvasMaxAreaInBytes : -1, ee = typeof e.disableFontFace == "boolean" ? e.disableFontFace : F, te = e.fontExtraProperties === !0, ne = e.enableXfa === !0, D = e.ownerDocument || globalThis.document, re = e.disableRange === !0, O = e.disableStream === !0, ie = e.disableAutoFetch === !0, k = e.pdfBug === !0, ae = e.CanvasFactory || (F ? vn : sn), A = e.FilterFactory || (F ? _n : dn), oe = e.enableHWA === !0, se = e.useWasm !== !1, j = c ? c.length : e.length ?? NaN, ce = typeof e.useSystemFonts == "boolean" ? e.useSystemFonts : !F && !ee, le = typeof e.useWorkerFetch == "boolean" ? e.useWorkerFetch : !!(h === ln && v === pn && b === hn && p && _ && y && gt(p, document.baseURI) && gt(_, document.baseURI) && gt(y, document.baseURI));
7320
+ let t = new Gr(), { docId: n } = t, r = e.url ? Yt(e.url) : null, i = e.data ? Xt(e.data) : null, a = e.httpHeaders || null, o = e.withCredentials === !0, s = e.password ?? null, c = e.range instanceof Kr ? e.range : null, l = Number.isInteger(e.rangeChunkSize) && e.rangeChunkSize > 0 ? e.rangeChunkSize : 2 ** 16, u = e.worker instanceof Yr ? e.worker : null, d = e.verbosity, f = typeof e.docBaseUrl == "string" && !dt(e.docBaseUrl) ? e.docBaseUrl : null, p = Zt(e.cMapUrl), m = e.cMapPacked !== !1, h = e.CMapReaderFactory || (_e ? yn : ln), g = Zt(e.iccUrl), _ = Zt(e.standardFontDataUrl), v = e.StandardFontDataFactory || (_e ? bn : pn), y = Zt(e.wasmUrl), b = e.WasmFactory || (_e ? xn : hn), x = e.stopAtErrors !== !0, S = Number.isInteger(e.maxImageSize) && e.maxImageSize > -1 ? e.maxImageSize : -1, C = e.isEvalSupported !== !1, w = typeof e.isOffscreenCanvasSupported == "boolean" ? e.isOffscreenCanvasSupported : !_e, T = typeof e.isImageDecoderSupported == "boolean" ? e.isImageDecoderSupported : !_e && (W.platform.isFirefox || !globalThis.chrome), E = Number.isInteger(e.canvasMaxAreaInBytes) ? e.canvasMaxAreaInBytes : -1, ee = typeof e.disableFontFace == "boolean" ? e.disableFontFace : _e, te = e.fontExtraProperties === !0, ne = e.enableXfa === !0, D = e.ownerDocument || globalThis.document, O = e.disableRange === !0, k = e.disableStream === !0, re = e.disableAutoFetch === !0, A = e.pdfBug === !0, ie = e.CanvasFactory || (_e ? vn : sn), j = e.FilterFactory || (_e ? _n : dn), ae = e.enableHWA === !0, oe = e.useWasm !== !1, M = c ? c.length : e.length ?? NaN, se = typeof e.useSystemFonts == "boolean" ? e.useSystemFonts : !_e && !ee, ce = typeof e.useWorkerFetch == "boolean" ? e.useWorkerFetch : !!(h === ln && v === pn && b === hn && p && _ && y && gt(p, document.baseURI) && gt(_, document.baseURI) && gt(y, document.baseURI));
7321
7321
  je(d);
7322
- let ue = {
7323
- canvasFactory: new ae({
7322
+ let le = {
7323
+ canvasFactory: new ie({
7324
7324
  ownerDocument: D,
7325
- enableHWA: oe
7325
+ enableHWA: ae
7326
7326
  }),
7327
- filterFactory: new A({
7327
+ filterFactory: new j({
7328
7328
  docId: n,
7329
7329
  ownerDocument: D
7330
7330
  }),
7331
- cMapReaderFactory: le ? null : new h({
7331
+ cMapReaderFactory: ce ? null : new h({
7332
7332
  baseUrl: p,
7333
7333
  isCompressed: m
7334
7334
  }),
7335
- standardFontDataFactory: le ? null : new v({ baseUrl: _ }),
7336
- wasmFactory: le ? null : new b({ baseUrl: y })
7335
+ standardFontDataFactory: ce ? null : new v({ baseUrl: _ }),
7336
+ wasmFactory: ce ? null : new b({ baseUrl: y })
7337
7337
  };
7338
7338
  u || (u = Yr.create({
7339
7339
  verbosity: d,
7340
7340
  port: ar.workerPort
7341
7341
  }), t._worker = u);
7342
- let M = {
7342
+ let N = {
7343
7343
  docId: n,
7344
7344
  apiVersion: "5.4.149",
7345
7345
  data: i,
7346
7346
  password: s,
7347
- disableAutoFetch: ie,
7347
+ disableAutoFetch: re,
7348
7348
  rangeChunkSize: l,
7349
- length: j,
7349
+ length: M,
7350
7350
  docBaseUrl: f,
7351
7351
  enableXfa: ne,
7352
7352
  evaluatorOptions: {
@@ -7358,48 +7358,48 @@ function Wr(e = {}) {
7358
7358
  isImageDecoderSupported: T,
7359
7359
  canvasMaxAreaInBytes: E,
7360
7360
  fontExtraProperties: te,
7361
- useSystemFonts: ce,
7362
- useWasm: se,
7363
- useWorkerFetch: le,
7361
+ useSystemFonts: se,
7362
+ useWasm: oe,
7363
+ useWorkerFetch: ce,
7364
7364
  cMapUrl: p,
7365
7365
  iccUrl: g,
7366
7366
  standardFontDataUrl: _,
7367
7367
  wasmUrl: y
7368
7368
  }
7369
- }, N = {
7369
+ }, P = {
7370
7370
  ownerDocument: D,
7371
- pdfBug: k,
7371
+ pdfBug: A,
7372
7372
  styleElement: null,
7373
7373
  loadingParams: {
7374
- disableAutoFetch: ie,
7374
+ disableAutoFetch: re,
7375
7375
  enableXfa: ne
7376
7376
  }
7377
7377
  };
7378
7378
  return u.promise.then(function() {
7379
7379
  if (t.destroyed) throw Error("Loading aborted");
7380
7380
  if (u.destroyed) throw Error("Worker was destroyed");
7381
- let e = u.messageHandler.sendWithPromise("GetDocRequest", M, i ? [i.buffer] : null), s;
7381
+ let e = u.messageHandler.sendWithPromise("GetDocRequest", N, i ? [i.buffer] : null), s;
7382
7382
  if (c) s = new ur(c, {
7383
- disableRange: re,
7384
- disableStream: O
7383
+ disableRange: O,
7384
+ disableStream: k
7385
7385
  });
7386
7386
  else if (!i) {
7387
7387
  if (!r) throw Error("getDocument - no `url` parameter provided.");
7388
- s = new (gt(r) ? Sr : F ? Pr : kr)({
7388
+ s = new (gt(r) ? Sr : _e ? Pr : kr)({
7389
7389
  url: r,
7390
- length: j,
7390
+ length: M,
7391
7391
  httpHeaders: a,
7392
7392
  withCredentials: o,
7393
7393
  rangeChunkSize: l,
7394
- disableRange: re,
7395
- disableStream: O
7394
+ disableRange: O,
7395
+ disableStream: k
7396
7396
  });
7397
7397
  }
7398
7398
  return e.then((e) => {
7399
7399
  if (t.destroyed) throw Error("Loading aborted");
7400
7400
  if (u.destroyed) throw Error("Worker was destroyed");
7401
7401
  let r = new an(n, e, u.port);
7402
- t._transport = new Xr(r, t, s, N, ue, oe), r.send("Ready", null);
7402
+ t._transport = new Xr(r, t, s, P, le, ae), r.send("Ready", null);
7403
7403
  });
7404
7404
  }).catch(t._capability.reject), t;
7405
7405
  }
@@ -7837,7 +7837,7 @@ var Gr = class e {
7837
7837
  static #a = !1;
7838
7838
  static #o = /* @__PURE__ */ new WeakMap();
7839
7839
  static {
7840
- F && (this.#a = !0, ar.workerSrc ||= "./pdf.worker.mjs"), this._isSameOrigin = (e, t) => {
7840
+ _e && (this.#a = !0, ar.workerSrc ||= "./pdf.worker.mjs"), this._isSameOrigin = (e, t) => {
7841
7841
  let n = URL.parse(e);
7842
7842
  if (!n?.origin || n.origin === "null") return !1;
7843
7843
  let r = new URL(t, n);
@@ -15572,7 +15572,7 @@ function io(e) {
15572
15572
  return no(360 - e);
15573
15573
  }
15574
15574
  function ao(e, t) {
15575
- return e === 0 ? 0 : t === he.Clockwise ? e : no(360 - e);
15575
+ return e === 0 ? 0 : t === me.Clockwise ? e : no(360 - e);
15576
15576
  }
15577
15577
  function oo(e, t, n, r, i) {
15578
15578
  let a = no(i);
@@ -15940,7 +15940,7 @@ var co = 40, lo = 1.2, uo = class {
15940
15940
  return this.currentScale;
15941
15941
  }
15942
15942
  setZoom(e) {
15943
- e === ge.AUTO ? this.setAutoZoom() : e === ge.PAGE_FIT ? this.setPageFitZoom() : this.applyZoom(e);
15943
+ e === he.AUTO ? this.setAutoZoom() : e === he.PAGE_FIT ? this.setPageFitZoom() : this.applyZoom(e);
15944
15944
  }
15945
15945
  applyZoom(e) {
15946
15946
  let t = this.currentScale;
@@ -15986,7 +15986,7 @@ var co = 40, lo = 1.2, uo = class {
15986
15986
  getTotalPages() {
15987
15987
  return this.totalPages;
15988
15988
  }
15989
- setPageDisplayRotation(e, t, n = he.Clockwise) {
15989
+ setPageDisplayRotation(e, t, n = me.Clockwise) {
15990
15990
  if (t === 0) {
15991
15991
  if (this.pageDisplayRotations.delete(e), this.options.pageDisplayRotations) {
15992
15992
  let t = { ...this.options.pageDisplayRotations };
@@ -16632,16 +16632,16 @@ var co = 40, lo = 1.2, uo = class {
16632
16632
  format: "image/jpeg",
16633
16633
  quality: .85
16634
16634
  }, ho = "application/pdf", go = ".pdf", _o = ({ pdf: e, highlights: t, selectedHighlightId: n, autoFocusFirstHighlight: r = !1, selectedPageNumber: i, zoom: a, containerClassName: o, onTotalPagesChange: s, onViewerReady: c, selectedPages: l, viewerOptions: u }) => {
16635
- let d = se(null), f = se(null), [p, m] = j(!1), [h, g] = j(!1), _ = se(s), v = se(c), y = se(u);
16636
- A(() => {
16635
+ let d = oe(null), f = oe(null), [p, m] = M(!1), [h, g] = M(!1), _ = oe(s), v = oe(c), y = oe(u);
16636
+ j(() => {
16637
16637
  _.current = s;
16638
- }, [s]), A(() => {
16638
+ }, [s]), j(() => {
16639
16639
  v.current = c;
16640
- }, [c]), A(() => {
16640
+ }, [c]), j(() => {
16641
16641
  y.current = u;
16642
16642
  }, [u]);
16643
- let b = k((e) => f.current?.goToHighlight(e), []);
16644
- return A(() => {
16643
+ let b = A((e) => f.current?.goToHighlight(e), []);
16644
+ return j(() => {
16645
16645
  if (!d.current) return;
16646
16646
  m(!1), g(!1), f.current &&= (f.current.destroy(), null);
16647
16647
  let t = null, n = !0, r = () => {
@@ -16671,30 +16671,30 @@ var co = 40, lo = 1.2, uo = class {
16671
16671
  })(), () => {
16672
16672
  n = !1, t && (t.removeEventListener("zoomChanged", r), t.destroy());
16673
16673
  };
16674
- }, [e, l]), A(() => {
16674
+ }, [e, l]), j(() => {
16675
16675
  !p || !f.current || (f.current.loadHighlights(t), r && t && t[0] && b(t[0].id));
16676
16676
  }, [
16677
16677
  r,
16678
16678
  b,
16679
16679
  t,
16680
16680
  p
16681
- ]), A(() => {
16681
+ ]), j(() => {
16682
16682
  p && h && n && b(n);
16683
16683
  }, [
16684
16684
  b,
16685
16685
  p,
16686
16686
  h,
16687
16687
  n
16688
- ]), A(() => {
16689
- if (!(!p || !a)) if (a === "auto") f.current?.setZoom?.(ge.AUTO);
16690
- else if (a === "page-fit") f.current?.setZoom?.(ge.PAGE_FIT);
16688
+ ]), j(() => {
16689
+ if (!(!p || !a)) if (a === "auto") f.current?.setZoom?.(he.AUTO);
16690
+ else if (a === "page-fit") f.current?.setZoom?.(he.PAGE_FIT);
16691
16691
  else {
16692
16692
  let e = parseFloat(a);
16693
16693
  !Number.isNaN(e) && e > 0 && f.current?.setZoom?.(e);
16694
16694
  }
16695
- }, [p, a]), A(() => {
16695
+ }, [p, a]), j(() => {
16696
16696
  p && i && f.current?.setPage?.(i);
16697
- }, [p, i]), A(() => {
16697
+ }, [p, i]), j(() => {
16698
16698
  if (!p || !f.current) return;
16699
16699
  let e = f.current;
16700
16700
  v.current?.({
@@ -16706,42 +16706,42 @@ var co = 40, lo = 1.2, uo = class {
16706
16706
  setPageDisplayRotation: (t, n, r) => e.setPageDisplayRotation(t, n, r),
16707
16707
  getPageDisplayRotation: (t) => e.getPageDisplayRotation(t)
16708
16708
  });
16709
- }, [p]), /* @__PURE__ */ M("div", {
16709
+ }, [p]), /* @__PURE__ */ N("div", {
16710
16710
  ref: d,
16711
16711
  className: x("grow min-w-0 overflow-auto bg-layer-3", o)
16712
16712
  });
16713
- }, vo = "h-4 rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave", yo = ({ className: e, ariaLabel: t = "pdf preview loading" }) => /* @__PURE__ */ M("div", {
16713
+ }, vo = "h-4 rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave", yo = ({ className: e, ariaLabel: t = "pdf preview loading" }) => /* @__PURE__ */ N("div", {
16714
16714
  role: "status",
16715
16715
  "aria-label": t,
16716
16716
  "aria-live": "polite",
16717
16717
  className: x("h-full w-full bg-layer-3", e),
16718
- children: /* @__PURE__ */ N("div", {
16718
+ children: /* @__PURE__ */ P("div", {
16719
16719
  className: "flex h-full w-full flex-col gap-10 px-[60px] pt-10",
16720
16720
  children: [
16721
- /* @__PURE__ */ M("div", { className: "mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave" }),
16722
- /* @__PURE__ */ N("div", {
16721
+ /* @__PURE__ */ N("div", { className: "mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave" }),
16722
+ /* @__PURE__ */ P("div", {
16723
16723
  className: "flex flex-col gap-4",
16724
16724
  children: [
16725
- /* @__PURE__ */ M("div", { className: vo }),
16726
- /* @__PURE__ */ M("div", { className: vo }),
16727
- /* @__PURE__ */ M("div", { className: vo }),
16728
- /* @__PURE__ */ M("div", { className: vo }),
16729
- /* @__PURE__ */ M("div", { className: x(vo, "w-[28%] max-w-[320px]") })
16725
+ /* @__PURE__ */ N("div", { className: vo }),
16726
+ /* @__PURE__ */ N("div", { className: vo }),
16727
+ /* @__PURE__ */ N("div", { className: vo }),
16728
+ /* @__PURE__ */ N("div", { className: vo }),
16729
+ /* @__PURE__ */ N("div", { className: x(vo, "w-[28%] max-w-[320px]") })
16730
16730
  ]
16731
16731
  }),
16732
- /* @__PURE__ */ N("div", {
16732
+ /* @__PURE__ */ P("div", {
16733
16733
  className: "flex flex-col gap-4",
16734
16734
  children: [
16735
- /* @__PURE__ */ M("div", { className: vo }),
16736
- /* @__PURE__ */ M("div", { className: vo }),
16737
- /* @__PURE__ */ M("div", { className: vo }),
16738
- /* @__PURE__ */ M("div", { className: vo }),
16739
- /* @__PURE__ */ M("div", { className: x(vo, "w-[58%] max-w-[520px]") })
16735
+ /* @__PURE__ */ N("div", { className: vo }),
16736
+ /* @__PURE__ */ N("div", { className: vo }),
16737
+ /* @__PURE__ */ N("div", { className: vo }),
16738
+ /* @__PURE__ */ N("div", { className: vo }),
16739
+ /* @__PURE__ */ N("div", { className: x(vo, "w-[58%] max-w-[520px]") })
16740
16740
  ]
16741
16741
  })
16742
16742
  ]
16743
16743
  })
16744
- }), bo = O(null), xo = () => ae(bo), So = po.filter(({ value: e }) => {
16744
+ }), bo = k(null), xo = () => ie(bo), So = po.filter(({ value: e }) => {
16745
16745
  let t = Number.parseFloat(e);
16746
16746
  return !Number.isNaN(t) && t > 0;
16747
16747
  }), Co = [...So].reverse(), wo = (e, t, n) => {
@@ -16757,7 +16757,7 @@ var Eo = po.map((e) => ({
16757
16757
  value: e.value,
16758
16758
  label: e.label
16759
16759
  })), Do = ({ fileUrl: e, fileName: t, loadFileCb: n, highlights: r, selectedPageNumber: i, onTotalPagesChange: a, thumbnailPageNumbers: o, onThumbnailsLoaded: s, onViewerReady: c, showLoaderOverlay: l = !1, selectedPages: u }) => {
16760
- let d = xo(), f = se(null), [p, m] = j(!1), [h, g] = j(0), [_, v] = j(!1), [y, b] = j(null), [x, S] = j(null), [C, w] = j(fo), T = oe(() => {
16760
+ let d = xo(), f = oe(null), [p, m] = M(!1), [h, g] = M(0), [_, v] = M(!1), [y, b] = M(null), [x, S] = M(null), [C, w] = M(fo), T = ae(() => {
16761
16761
  if (t) return To(t.toLowerCase());
16762
16762
  let n;
16763
16763
  try {
@@ -16767,12 +16767,12 @@ var Eo = po.map((e) => ({
16767
16767
  }
16768
16768
  let r = n.split("/").pop() ?? "";
16769
16769
  return !r.includes(".") || To(r.toLowerCase());
16770
- }, [t, e]), E = k((e) => {
16770
+ }, [t, e]), E = A((e) => {
16771
16771
  g((h + e + r.length) % r.length);
16772
- }, [h, r.length]), ee = k((e) => {
16772
+ }, [h, r.length]), ee = A((e) => {
16773
16773
  let t = f.current;
16774
16774
  !t?.getZoom || !e || w(wo(C, e, t.getZoom()));
16775
- }, [C]), te = oe(() => {
16775
+ }, [C]), te = ae(() => {
16776
16776
  if (!(C === "auto" || C === "page-fit" || po.some((e) => e.value === C))) {
16777
16777
  let e = parseFloat(C);
16778
16778
  if (!Number.isNaN(e) && e > 0) return [...Eo, {
@@ -16782,7 +16782,7 @@ var Eo = po.map((e) => ({
16782
16782
  }
16783
16783
  return Eo;
16784
16784
  }, [C]);
16785
- A(() => {
16785
+ j(() => {
16786
16786
  let t = !1;
16787
16787
  if (b(!0), v(!1), S(null), m(!1), f.current = null, !T) {
16788
16788
  v(!0), b(!1);
@@ -16806,10 +16806,10 @@ var Eo = po.map((e) => ({
16806
16806
  n,
16807
16807
  T
16808
16808
  ]);
16809
- let ne = k((e) => {
16809
+ let ne = A((e) => {
16810
16810
  f.current = e, m(!0), c?.(e);
16811
16811
  }, [c]);
16812
- return A(() => {
16812
+ return j(() => {
16813
16813
  let e = o ?? [], t = f.current?.getThumbnailsDataUrl;
16814
16814
  if (!e.length || !t || !x || !s || !p) return;
16815
16815
  let n = !1;
@@ -16850,7 +16850,7 @@ var Eo = po.map((e) => ({
16850
16850
  handleViewerReady: ne
16851
16851
  };
16852
16852
  }, Oo = ({ fileUrl: e, fileName: t, errorLabel: n, occurrencesLabel: r, unsupportedLabel: i, highlights: a, loadFileCb: o, showOccurrences: s = !0, selectedPageNumber: c, containerClassName: l, pdfViewerClassName: u, onTotalPagesChange: d, title: p, thumbnailPageNumbers: h, onThumbnailsLoaded: g, onViewerReady: v, showLoaderOverlay: C = !1, selectedPages: E, selectedHighlightId: ee, viewerOptions: te }) => {
16853
- let { file: ne, isError: O, isSupportedFile: ie, activeHighlightIndex: k, zoom: ae, setZoom: A, zoomSelectOptions: oe, showLoader: se, changeIndex: j, handleZoomChange: ce, handleViewerReady: le } = Do({
16853
+ let { file: ne, isError: k, isSupportedFile: re, activeHighlightIndex: A, zoom: ie, setZoom: j, zoomSelectOptions: ae, showLoader: oe, changeIndex: M, handleZoomChange: se, handleViewerReady: ce } = Do({
16854
16854
  fileUrl: e,
16855
16855
  fileName: t,
16856
16856
  loadFileCb: o,
@@ -16863,106 +16863,106 @@ var Eo = po.map((e) => ({
16863
16863
  showLoaderOverlay: C,
16864
16864
  selectedPages: E
16865
16865
  });
16866
- return /* @__PURE__ */ N("div", {
16866
+ return /* @__PURE__ */ P("div", {
16867
16867
  className: x("flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-2", l),
16868
16868
  children: [
16869
- t && /* @__PURE__ */ M("div", {
16869
+ t && /* @__PURE__ */ N("div", {
16870
16870
  className: "shrink-0 min-h-0 w-full",
16871
- children: /* @__PURE__ */ M(m, {
16871
+ children: /* @__PURE__ */ N(m, {
16872
16872
  className: "dial-tiny-text text-secondary",
16873
16873
  text: t
16874
16874
  })
16875
16875
  }),
16876
- /* @__PURE__ */ N("div", {
16876
+ /* @__PURE__ */ P("div", {
16877
16877
  className: x("flex w-full justify-between items-center", s && p ? "gap-2" : ""),
16878
- children: [/* @__PURE__ */ M("div", { children: s ? /* @__PURE__ */ N("div", {
16878
+ children: [/* @__PURE__ */ N("div", { children: s ? /* @__PURE__ */ P("div", {
16879
16879
  className: "flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-4 rounded w-fit",
16880
- children: [/* @__PURE__ */ N("span", {
16880
+ children: [/* @__PURE__ */ P("span", {
16881
16881
  className: "dial-small-text",
16882
16882
  children: [
16883
16883
  r ?? "Occurrences",
16884
16884
  ":",
16885
- /* @__PURE__ */ M("span", {
16885
+ /* @__PURE__ */ N("span", {
16886
16886
  className: "pl-0.5 min-w-3 inline-block text-right",
16887
- children: a.length > 0 ? `${k + 1}/${a.length}` : "0"
16887
+ children: a.length > 0 ? `${A + 1}/${a.length}` : "0"
16888
16888
  })
16889
16889
  ]
16890
- }), a.length > 0 && /* @__PURE__ */ N(ue, { children: [/* @__PURE__ */ M(f, {
16890
+ }), a.length > 0 && /* @__PURE__ */ P(le, { children: [/* @__PURE__ */ N(f, {
16891
16891
  className: "p-0 text-primary !h-6.5",
16892
16892
  size: y.Small,
16893
- iconAfter: /* @__PURE__ */ M(w, { size: 16 }),
16893
+ iconAfter: /* @__PURE__ */ N(w, { size: 16 }),
16894
16894
  "aria-label": "Next occurrence",
16895
- onClick: () => j(1)
16896
- }), /* @__PURE__ */ M(f, {
16895
+ onClick: () => M(1)
16896
+ }), /* @__PURE__ */ N(f, {
16897
16897
  className: "p-0 text-primary !h-6.5",
16898
16898
  size: y.Small,
16899
- iconAfter: /* @__PURE__ */ M(T, { size: 16 }),
16899
+ iconAfter: /* @__PURE__ */ N(T, { size: 16 }),
16900
16900
  "aria-label": "Previous occurrence",
16901
- onClick: () => j(-1)
16901
+ onClick: () => M(-1)
16902
16902
  })] })]
16903
- }) : /* @__PURE__ */ M("div", {}) }), /* @__PURE__ */ N("div", {
16903
+ }) : /* @__PURE__ */ N("div", {}) }), /* @__PURE__ */ P("div", {
16904
16904
  className: x("flex flex-1 items-center gap-4 min-w-0", p != null && p !== "" ? "justify-between" : "justify-end"),
16905
- children: [p != null && p !== "" && /* @__PURE__ */ M(m, {
16905
+ children: [p != null && p !== "" && /* @__PURE__ */ N(m, {
16906
16906
  text: p,
16907
16907
  className: "dial-body-semi-text text-primary min-w-0"
16908
- }), /* @__PURE__ */ N("div", {
16908
+ }), /* @__PURE__ */ P("div", {
16909
16909
  className: "flex gap-0.5 items-center shrink-0",
16910
16910
  children: [
16911
- /* @__PURE__ */ M("div", {
16911
+ /* @__PURE__ */ N("div", {
16912
16912
  className: "h-6",
16913
- children: /* @__PURE__ */ M(_, {
16913
+ children: /* @__PURE__ */ N(_, {
16914
16914
  size: b.Sm,
16915
16915
  className: "bg-layer-4 !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-hover rounded",
16916
- options: oe,
16917
- value: ae,
16918
- onChange: (e) => A(e)
16916
+ options: ae,
16917
+ value: ie,
16918
+ onChange: (e) => j(e)
16919
16919
  })
16920
16920
  }),
16921
- /* @__PURE__ */ M(f, {
16921
+ /* @__PURE__ */ N(f, {
16922
16922
  className: "py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",
16923
- iconAfter: /* @__PURE__ */ M(D, { size: 16 }),
16923
+ iconAfter: /* @__PURE__ */ N(D, { size: 16 }),
16924
16924
  "aria-label": "Zoom out",
16925
16925
  size: y.Small,
16926
- onClick: () => ce(-1)
16926
+ onClick: () => se(-1)
16927
16927
  }),
16928
- /* @__PURE__ */ M(f, {
16928
+ /* @__PURE__ */ N(f, {
16929
16929
  className: "py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",
16930
- iconAfter: /* @__PURE__ */ M(re, { size: 16 }),
16930
+ iconAfter: /* @__PURE__ */ N(O, { size: 16 }),
16931
16931
  "aria-label": "Zoom in",
16932
16932
  size: y.Small,
16933
- onClick: () => ce(1)
16933
+ onClick: () => se(1)
16934
16934
  })
16935
16935
  ]
16936
16936
  })]
16937
16937
  })]
16938
16938
  }),
16939
- /* @__PURE__ */ N("div", {
16939
+ /* @__PURE__ */ P("div", {
16940
16940
  className: "relative flex min-h-0 flex-1",
16941
16941
  children: [
16942
- ne && /* @__PURE__ */ M(_o, {
16942
+ ne && /* @__PURE__ */ N(_o, {
16943
16943
  pdf: ne,
16944
16944
  highlights: a,
16945
- selectedHighlightId: s ? a[k]?.id : ee,
16945
+ selectedHighlightId: s ? a[A]?.id : ee,
16946
16946
  selectedPageNumber: c,
16947
- zoom: ae,
16947
+ zoom: ie,
16948
16948
  onTotalPagesChange: d,
16949
- onViewerReady: le,
16949
+ onViewerReady: ce,
16950
16950
  containerClassName: u,
16951
16951
  selectedPages: E,
16952
16952
  viewerOptions: te
16953
16953
  }),
16954
- se && /* @__PURE__ */ M(yo, { className: "absolute inset-0 z-10" }),
16955
- O && /* @__PURE__ */ M("div", {
16954
+ oe && /* @__PURE__ */ N(yo, { className: "absolute inset-0 z-10" }),
16955
+ k && /* @__PURE__ */ N("div", {
16956
16956
  className: "absolute inset-0 z-20 flex items-center justify-center bg-layer-3",
16957
- children: /* @__PURE__ */ N("div", {
16957
+ children: /* @__PURE__ */ P("div", {
16958
16958
  className: "flex flex-col items-center gap-6 p-10",
16959
- children: [/* @__PURE__ */ M(S, {
16959
+ children: [/* @__PURE__ */ N(S, {
16960
16960
  size: 60,
16961
16961
  stroke: 2,
16962
16962
  className: "text-secondary"
16963
- }), /* @__PURE__ */ M("div", {
16963
+ }), /* @__PURE__ */ N("div", {
16964
16964
  className: "text-center dial-small-text whitespace-pre-wrap",
16965
- children: !ie && i ? i : n ?? "Failed to load document."
16965
+ children: !re && i ? i : n ?? "Failed to load document."
16966
16966
  })]
16967
16967
  })
16968
16968
  })
@@ -16970,7 +16970,7 @@ var Eo = po.map((e) => ({
16970
16970
  })
16971
16971
  ]
16972
16972
  });
16973
- }, ko = ({ pageNum: e, onSelectPage: t, isSelected: n, isLoading: r, isMultiselect: i, thumbnailUrl: a, className: o }) => /* @__PURE__ */ N("button", {
16973
+ }, ko = ({ pageNum: e, onSelectPage: t, isSelected: n, isLoading: r, isMultiselect: i, thumbnailUrl: a, className: o }) => /* @__PURE__ */ P("button", {
16974
16974
  type: "button",
16975
16975
  "aria-label": `Page ${e}`,
16976
16976
  "aria-pressed": n,
@@ -16978,87 +16978,129 @@ var Eo = po.map((e) => ({
16978
16978
  i && n.target.closest("[data-checkbox-wrapper]") || t(e);
16979
16979
  },
16980
16980
  className: x("flex flex-col gap-2 p-2 h-[186px] w-[120px] items-center justify-center cursor-pointer transition-colors hover:bg-layer-4 rounded-sm", n && (i ? "border border-accent-primary bg-accent-primary-alpha" : "border border-primary"), o),
16981
- children: [/* @__PURE__ */ N("div", {
16981
+ children: [/* @__PURE__ */ P("div", {
16982
16982
  className: "relative w-[104px] h-[146px] bg-model-icon rounded-sm overflow-hidden",
16983
16983
  children: [
16984
- a ? /* @__PURE__ */ M("img", {
16984
+ a ? /* @__PURE__ */ N("img", {
16985
16985
  src: a,
16986
16986
  alt: `Page ${e} thumbnail`,
16987
16987
  className: "w-full h-full object-cover rounded-sm"
16988
16988
  }) : null,
16989
- i && /* @__PURE__ */ M("div", {
16989
+ i && /* @__PURE__ */ N("div", {
16990
16990
  className: "absolute left-1 top-1 z-10",
16991
16991
  "data-checkbox-wrapper": !0,
16992
- children: /* @__PURE__ */ M(p, {
16992
+ children: /* @__PURE__ */ N(p, {
16993
16993
  id: `page-thumbnail-${e}`,
16994
16994
  checked: n,
16995
16995
  onChange: () => t(e),
16996
16996
  className: "before:border-primary before:bg-model-icon bg-model-icon"
16997
16997
  })
16998
16998
  }),
16999
- r && /* @__PURE__ */ M("div", {
16999
+ r && /* @__PURE__ */ N("div", {
17000
17000
  className: "absolute inset-0 flex items-center justify-center bg-blackout rounded-sm",
17001
- children: /* @__PURE__ */ M(g, {
17001
+ children: /* @__PURE__ */ N(g, {
17002
17002
  size: 24,
17003
17003
  fullWidth: !1,
17004
17004
  ariaLabel: `Loading page ${e}`
17005
17005
  })
17006
17006
  })
17007
17007
  ]
17008
- }), /* @__PURE__ */ M("span", {
17008
+ }), /* @__PURE__ */ N("span", {
17009
17009
  className: "dial-tiny-text text-primary",
17010
17010
  children: e
17011
17011
  })]
17012
- }), Ao = { viewer: "_viewer_1gfxm_1" }, jo = ({ url: e, highlights: t, selectedHighlightId: n, loadPdf: r }) => {
17013
- let i = c(), [o, s] = j(0), [l, u] = j(/* @__PURE__ */ new Map()), [d, f] = j(() => n ? t.find((e) => e.id === n)?.bboxes[0]?.page ?? 1 : 1), p = se(null), m = se(/* @__PURE__ */ new Map());
17014
- A(() => {
17012
+ }), Ao = { viewer: "_viewer_1gfxm_1" }, jo = 5, Mo = 200, No = ({ url: e, highlights: t, selectedHighlightId: n, loadPdf: r }) => {
17013
+ let i = c(), [o, s] = M(0), [l, u] = M(/* @__PURE__ */ new Map()), [d, f] = M(() => n ? t.find((e) => e.id === n)?.bboxes[0]?.page ?? 1 : 1), p = oe(null), m = oe(/* @__PURE__ */ new Map()), h = oe(null), [g, _] = M([]), v = oe(null), y = oe(Mo), [b, x] = M(Mo), [S, C] = M(0), [w, T] = M(600);
17014
+ j(() => {
17015
17015
  if (!n) return;
17016
17016
  let e = t.find((e) => e.id === n)?.bboxes[0]?.page;
17017
17017
  e != null && f(e);
17018
- }, [n, t]), A(() => {
17019
- m.current.get(d)?.scrollIntoView({
17018
+ }, [n, t]), j(() => {
17019
+ let e = m.current.get(d);
17020
+ e ? e.scrollIntoView({
17020
17021
  block: "center",
17021
17022
  behavior: "smooth"
17023
+ }) : v.current && v.current.scrollTo({
17024
+ top: (d - 1) * y.current,
17025
+ behavior: "smooth"
17022
17026
  });
17023
17027
  }, [d, o]);
17024
- let h = oe(() => i ? [] : Array.from({ length: o }, (e, t) => t + 1), [i, o]), g = k((e) => {
17028
+ let E = ae(() => i ? [] : Array.from({ length: o }, (e, t) => t + 1), [i, o]);
17029
+ j(() => {
17030
+ if (_([]), E.length === 0) return;
17031
+ let e = new IntersectionObserver((e) => {
17032
+ let t = e.filter((e) => e.isIntersecting).map((e) => Number(e.target.dataset.page)).filter((e) => e > 0);
17033
+ t.length !== 0 && _((e) => {
17034
+ let n = new Set(e), r = t.filter((e) => !n.has(e));
17035
+ return r.length === 0 ? e : [...e, ...r];
17036
+ });
17037
+ }, { rootMargin: "300px 0px" });
17038
+ return h.current = e, m.current.forEach((t) => e.observe(t)), () => {
17039
+ e.disconnect(), h.current = null;
17040
+ };
17041
+ }, [E]), j(() => {
17042
+ let e = v.current;
17043
+ if (!e) return;
17044
+ T(e.clientHeight);
17045
+ let t = new ResizeObserver(() => T(e.clientHeight));
17046
+ t.observe(e);
17047
+ let n = () => C(e.scrollTop);
17048
+ return e.addEventListener("scroll", n, { passive: !0 }), () => {
17049
+ t.disconnect(), e.removeEventListener("scroll", n);
17050
+ };
17051
+ }, [o]);
17052
+ let ee = ae(() => g.filter((e) => !l.has(e)), [g, l]), te = A((e) => {
17025
17053
  u((t) => new Map([...t, ...e]));
17026
- }, []), _ = k((e) => {
17054
+ }, []), ne = A((e) => {
17027
17055
  p.current = e;
17028
- }, []), v = k((e) => {
17056
+ }, []), D = A((e) => {
17029
17057
  f(e), p.current?.navigateToPage(e);
17030
- }, []);
17031
- return /* @__PURE__ */ N("div", {
17058
+ }, []), O = Math.max(0, Math.floor(S / b) - jo), k = Math.min(E.length - 1, Math.ceil((S + w) / b) + jo - 1), re = O * b, ie = Math.max(0, (E.length - 1 - k) * b);
17059
+ return e ? /* @__PURE__ */ P("div", {
17032
17060
  className: "flex h-full overflow-hidden",
17033
- children: [o > 0 && /* @__PURE__ */ M("div", {
17061
+ children: [o > 0 && /* @__PURE__ */ N("div", {
17062
+ ref: v,
17034
17063
  className: "w-30 me-1 shrink-0 overflow-auto pe-0.5 mobile:hidden",
17035
- children: h.map((e) => /* @__PURE__ */ M("div", {
17036
- ref: (t) => {
17037
- t ? m.current.set(e, t) : m.current.delete(e);
17064
+ children: /* @__PURE__ */ N("div", {
17065
+ style: {
17066
+ paddingTop: re,
17067
+ paddingBottom: ie
17038
17068
  },
17039
- children: /* @__PURE__ */ M(ko, {
17040
- pageNum: e,
17041
- onSelectPage: v,
17042
- isSelected: d === e,
17043
- isLoading: !l.has(e),
17044
- thumbnailUrl: l.get(e) ?? null
17045
- })
17046
- }, e))
17047
- }), /* @__PURE__ */ M("div", {
17069
+ children: E.slice(O, k + 1).map((e, t) => /* @__PURE__ */ N("div", {
17070
+ "data-page": e,
17071
+ ref: (n) => {
17072
+ if (n) {
17073
+ if (t === 0 && O === 0 && y.current === Mo) {
17074
+ let e = n.getBoundingClientRect().height;
17075
+ e > 0 && (y.current = e, x(e));
17076
+ }
17077
+ m.current.set(e, n), h.current?.observe(n);
17078
+ } else m.current.delete(e);
17079
+ },
17080
+ children: /* @__PURE__ */ N(ko, {
17081
+ pageNum: e,
17082
+ onSelectPage: D,
17083
+ isSelected: d === e,
17084
+ isLoading: !l.has(e),
17085
+ thumbnailUrl: l.get(e) ?? null
17086
+ })
17087
+ }, e))
17088
+ })
17089
+ }), /* @__PURE__ */ N("div", {
17048
17090
  className: a("min-w-0 flex-1 overflow-auto", Ao.viewer),
17049
- children: /* @__PURE__ */ M(Oo, {
17091
+ children: /* @__PURE__ */ N(Oo, {
17050
17092
  fileUrl: e,
17051
- loadFileCb: r ?? pe,
17093
+ loadFileCb: r ?? fe,
17052
17094
  highlights: t,
17053
17095
  selectedHighlightId: n,
17054
17096
  showOccurrences: !1,
17055
17097
  onTotalPagesChange: s,
17056
- thumbnailPageNumbers: h,
17057
- onThumbnailsLoaded: g,
17058
- onViewerReady: _
17098
+ thumbnailPageNumbers: ee,
17099
+ onThumbnailsLoaded: te,
17100
+ onViewerReady: ne
17059
17101
  })
17060
17102
  })]
17061
- });
17103
+ }) : null;
17062
17104
  }, $ = {
17063
17105
  body: "_body_t1fhd_2",
17064
17106
  statusLabel: "_statusLabel_t1fhd_6",
@@ -17075,84 +17117,88 @@ var Eo = po.map((e) => ({
17075
17117
  jsonExpandIcon: "_jsonExpandIcon_t1fhd_53",
17076
17118
  jsonCollapseIcon: "_jsonCollapseIcon_t1fhd_65",
17077
17119
  jsonCollapsedContent: "_jsonCollapsedContent_t1fhd_81"
17078
- }, Mo = 2e3, No = ({ url: e, fileName: t, loadErrorLabel: n }) => {
17079
- let [r, i] = j(!1);
17080
- return A(() => {
17120
+ }, Po = 2e3, Fo = ({ url: e, fileName: t, loadErrorLabel: n }) => {
17121
+ let [r, i] = M(!1);
17122
+ return j(() => {
17081
17123
  i(!1);
17082
- }, [e]), r ? /* @__PURE__ */ N("div", {
17124
+ }, [e]), r ? /* @__PURE__ */ P("div", {
17083
17125
  className: "flex flex-col items-center gap-2",
17084
- children: [/* @__PURE__ */ M(S, {
17126
+ children: [/* @__PURE__ */ N(S, {
17085
17127
  size: 60,
17086
17128
  stroke: 1.5,
17087
17129
  className: $.errorIcon
17088
- }), /* @__PURE__ */ M("p", {
17130
+ }), /* @__PURE__ */ N("p", {
17089
17131
  className: a("text-center", $.statusLabel),
17090
17132
  children: n
17091
17133
  })]
17092
- }) : /* @__PURE__ */ M("img", {
17134
+ }) : /* @__PURE__ */ N("img", {
17093
17135
  src: e,
17094
17136
  alt: t ?? "",
17095
17137
  className: "max-h-full max-w-full object-contain",
17096
17138
  onError: () => i(!0)
17097
17139
  });
17098
- }, Po = ie(({ isOpen: t, isLoading: i = !1, onClose: o, content: s, fileName: c, labels: { ariaLabel: f, closeLabel: p = "Close", downloadLabel: m = "Download", copyTextLabel: g = "Copy text", copiedTextLabel: _ = "Copied!", copyMarkdownLabel: y = "Copy as Markdown", copiedMarkdownLabel: b = "Copied!", copyJsonLabel: x = "Copy as JSON", copiedJsonLabel: w = "Copied!", unsupportedLabel: T = "Preview is not supported for this file", loadErrorLabel: D = "Failed to load file", forbiddenErrorLabel: re = "You don't have permission to access this file" }, onDownload: O, onCopyText: ie, onCopyMarkdown: ae, onCopyJson: A, isMobile: pe = !1, defaultWidth: me, minWidth: he = 600, maxWidth: ge = 1500, onResizeStop: _e, styles: F, codeBlockTheme: ve, loadPdf: ye }) => {
17099
- let [be, xe] = j(!1), [Se, I] = j(!1), [L, Ce] = j(!1), R = se(null), we = se(null), z = se(null), Te = k(() => {
17100
- ie?.(), R.current != null && clearTimeout(R.current), xe(!0), R.current = setTimeout(() => xe(!1), Mo);
17101
- }, [ie]), Ee = k(() => {
17102
- ae?.(), we.current != null && clearTimeout(we.current), I(!0), we.current = setTimeout(() => I(!1), Mo);
17103
- }, [ae]), De = k(() => {
17104
- A?.(), z.current != null && clearTimeout(z.current), Ce(!0), z.current = setTimeout(() => Ce(!1), Mo);
17105
- }, [A]), { colors: Oe, typography: ke, bodyClassName: Ae, className: je, cssVars: Me, panelStyles: Ne } = F ?? {}, B = oe(() => ({
17106
- ...r({ "--ac-text": Oe?.text }),
17107
- ...Me
17108
- }), [F]), V = !i && ie != null && s.type === P.PlainText, H = !i && ae != null && s.type === P.Markdown, Pe = !i && A != null && s.type === P.Json, Fe = !i && O != null && fe(s), Ie = oe(() => {
17140
+ }, Io = re(({ isOpen: t, isLoading: i = !1, onClose: o, content: s, fileName: c, labels: { ariaLabel: f, closeLabel: p = "Close", downloadLabel: m = "Download", copyTextLabel: g = "Copy text", copiedTextLabel: _ = "Copied!", copyMarkdownLabel: y = "Copy as Markdown", copiedMarkdownLabel: b = "Copied!", copyJsonLabel: x = "Copy as JSON", copiedJsonLabel: w = "Copied!", unsupportedLabel: T = "Preview is not supported for this file", loadErrorLabel: D = "Failed to load file", forbiddenErrorLabel: O = "You don't have permission to access this file" }, onDownload: k, onCopyText: re, onCopyMarkdown: ie, onCopyJson: fe, isMobile: pe = !1, defaultWidth: me, minWidth: he = 600, maxWidth: ge = 1500, onResizeStop: _e, styles: ve, codeBlockTheme: ye, loadPdf: be }) => {
17141
+ let [xe, Se] = M(!1), [I, L] = M(!1), [Ce, R] = M(!1), we = oe(null), z = oe(null), Te = oe(null), Ee = A(() => {
17142
+ re?.(), we.current != null && clearTimeout(we.current), Se(!0), we.current = setTimeout(() => Se(!1), Po);
17143
+ }, [re]), De = A(() => {
17144
+ ie?.(), z.current != null && clearTimeout(z.current), L(!0), z.current = setTimeout(() => L(!1), Po);
17145
+ }, [ie]), Oe = A(() => {
17146
+ fe?.(), Te.current != null && clearTimeout(Te.current), R(!0), Te.current = setTimeout(() => R(!1), Po);
17147
+ }, [fe]);
17148
+ j(() => () => {
17149
+ we.current != null && clearTimeout(we.current), z.current != null && clearTimeout(z.current), Te.current != null && clearTimeout(Te.current);
17150
+ }, []);
17151
+ let { colors: ke, typography: Ae, bodyClassName: je, className: Me, cssVars: Ne, panelStyles: B } = ve ?? {}, V = ae(() => ({
17152
+ ...r({ "--ac-text": ke?.text }),
17153
+ ...Ne
17154
+ }), [ve]), H = !i && re != null && s.type === F.PlainText, Pe = !i && ie != null && s.type === F.Markdown, Fe = !i && fe != null && s.type === F.Json, Ie = !i && k != null && de(s), U = ae(() => {
17109
17155
  switch (s.type) {
17110
- case P.Image:
17111
- case P.Audio:
17112
- case P.Unsupported:
17113
- case P.Error: return "h-full overflow-auto p-4 flex items-center justify-center";
17114
- case P.Json: return "h-full overflow-auto";
17115
- case P.Pdf: return "h-full overflow-hidden";
17156
+ case F.Image:
17157
+ case F.Audio:
17158
+ case F.Unsupported:
17159
+ case F.Error: return "h-full overflow-auto p-4 flex items-center justify-center";
17160
+ case F.Json: return "h-full overflow-auto";
17161
+ case F.Pdf: return "h-full overflow-hidden";
17116
17162
  default: return "h-full overflow-auto p-4";
17117
17163
  }
17118
- }, [s.type]), U = oe(() => {
17164
+ }, [s.type]), Le = ae(() => {
17119
17165
  switch (s.type) {
17120
- case P.PlainText: return /* @__PURE__ */ M("pre", {
17121
- className: a("whitespace-pre-wrap break-words", $.body, ke?.fontClassName),
17166
+ case F.PlainText: return /* @__PURE__ */ N("pre", {
17167
+ className: a("whitespace-pre-wrap break-words", $.body, Ae?.fontClassName),
17122
17168
  children: s.text
17123
17169
  });
17124
- case P.Image: return /* @__PURE__ */ M(No, {
17170
+ case F.Image: return /* @__PURE__ */ N(Fo, {
17125
17171
  url: s.url,
17126
17172
  fileName: c,
17127
17173
  loadErrorLabel: D
17128
17174
  });
17129
- case P.Audio: return /* @__PURE__ */ M("audio", {
17175
+ case F.Audio: return /* @__PURE__ */ N("audio", {
17130
17176
  controls: !0,
17131
17177
  src: s.url,
17132
17178
  "aria-label": c ?? "Audio attachment",
17133
17179
  className: "w-full max-w-sm",
17134
17180
  preload: "metadata",
17135
- children: s.mimeType && /* @__PURE__ */ M("source", {
17181
+ children: s.mimeType && /* @__PURE__ */ N("source", {
17136
17182
  src: s.url,
17137
17183
  type: s.mimeType
17138
17184
  })
17139
17185
  });
17140
- case P.Markdown: return /* @__PURE__ */ M(n, {
17186
+ case F.Markdown: return /* @__PURE__ */ N(n, {
17141
17187
  content: s.text,
17142
17188
  isStreaming: !1,
17143
- codeBlockTheme: ve,
17189
+ codeBlockTheme: ye,
17144
17190
  classNames: e
17145
17191
  });
17146
- case P.Json: return /* @__PURE__ */ M("div", {
17192
+ case F.Json: return /* @__PURE__ */ N("div", {
17147
17193
  dir: "ltr",
17148
17194
  className: "h-full overflow-auto",
17149
- children: /* @__PURE__ */ M("div", {
17195
+ children: /* @__PURE__ */ N("div", {
17150
17196
  className: a("m-3 overflow-auto rounded-md border", $.jsonWrapper),
17151
- children: /* @__PURE__ */ M(ce, {
17197
+ children: /* @__PURE__ */ N(se, {
17152
17198
  data: s.value,
17153
17199
  style: {
17154
17200
  container: a("whitespace-pre-wrap break-words p-2", $.jsonContainer),
17155
- basicChildStyle: le.basicChildStyle,
17201
+ basicChildStyle: ce.basicChildStyle,
17156
17202
  childFieldsContainer: "m-0 ps-3",
17157
17203
  label: a("me-1 font-semibold", $.jsonLabel),
17158
17204
  clickableLabel: a("me-1 cursor-pointer font-semibold hover:underline", $.jsonClickableLabel),
@@ -17170,43 +17216,43 @@ var Eo = po.map((e) => ({
17170
17216
  })
17171
17217
  })
17172
17218
  });
17173
- case P.Pdf: return /* @__PURE__ */ M(jo, {
17219
+ case F.Pdf: return /* @__PURE__ */ N(No, {
17174
17220
  fileName: c,
17175
17221
  url: s.url,
17176
17222
  highlights: s.highlights ?? [],
17177
17223
  selectedHighlightId: s.selectedHighlightId,
17178
- loadPdf: ye
17224
+ loadPdf: be
17179
17225
  }, s.url);
17180
- case P.Unsupported: return /* @__PURE__ */ M("p", {
17226
+ case F.Unsupported: return /* @__PURE__ */ N("p", {
17181
17227
  className: a("text-center", $.statusLabel),
17182
17228
  children: T
17183
17229
  });
17184
- case P.Error: {
17185
- let e = s.errorType === de.Forbidden;
17186
- return /* @__PURE__ */ N("div", {
17230
+ case F.Error: {
17231
+ let e = s.errorType === ue.Forbidden;
17232
+ return /* @__PURE__ */ P("div", {
17187
17233
  className: "flex flex-col items-center gap-2",
17188
- children: [M(e ? te : S, {
17234
+ children: [N(e ? te : S, {
17189
17235
  size: 60,
17190
17236
  stroke: 1.5,
17191
17237
  className: $.errorIcon
17192
- }), /* @__PURE__ */ M("p", {
17238
+ }), /* @__PURE__ */ N("p", {
17193
17239
  className: a("text-center", $.statusLabel),
17194
- children: e ? re : D
17240
+ children: e ? O : D
17195
17241
  })]
17196
17242
  });
17197
17243
  }
17198
17244
  }
17199
17245
  }, [
17200
17246
  s,
17201
- ke?.fontClassName,
17247
+ Ae?.fontClassName,
17202
17248
  c,
17203
- ve,
17249
+ ye,
17204
17250
  T,
17205
17251
  D,
17206
- re,
17207
- ye
17252
+ O,
17253
+ be
17208
17254
  ]);
17209
- return /* @__PURE__ */ M(u, {
17255
+ return /* @__PURE__ */ N(u, {
17210
17256
  isOpen: t,
17211
17257
  orientation: l.Right,
17212
17258
  title: c,
@@ -17221,73 +17267,73 @@ var Eo = po.map((e) => ({
17221
17267
  maxWidth: ge,
17222
17268
  onResizeStop: _e,
17223
17269
  styles: {
17224
- ...Ne,
17225
- className: a(t ? "mobile:w-full mobile:max-w-full" : "w-0", je, Ne?.className)
17270
+ ...B,
17271
+ className: a(t ? "mobile:w-full mobile:max-w-full" : "w-0", Me, B?.className)
17226
17272
  },
17227
- rightActions: V || H || Pe || Fe ? /* @__PURE__ */ N(ue, { children: [
17228
- V && /* @__PURE__ */ M(h, {
17229
- icon: M(be ? C : E, {
17273
+ rightActions: H || Pe || Fe || Ie ? /* @__PURE__ */ P(le, { children: [
17274
+ H && /* @__PURE__ */ N(h, {
17275
+ icon: N(xe ? C : E, {
17230
17276
  size: d.LG,
17231
17277
  stroke: 1.5
17232
17278
  }),
17233
- "aria-label": be ? _ : g,
17234
- tooltipProps: { tooltip: be ? _ : g },
17235
- onClick: Te
17279
+ "aria-label": xe ? _ : g,
17280
+ tooltipProps: { tooltip: xe ? _ : g },
17281
+ onClick: Ee
17236
17282
  }),
17237
- H && /* @__PURE__ */ M(h, {
17238
- icon: M(Se ? C : ne, {
17283
+ Pe && /* @__PURE__ */ N(h, {
17284
+ icon: N(I ? C : ne, {
17239
17285
  size: d.LG,
17240
17286
  stroke: 1.5
17241
17287
  }),
17242
- "aria-label": Se ? b : y,
17243
- tooltipProps: { tooltip: Se ? b : y },
17244
- onClick: Ee
17288
+ "aria-label": I ? b : y,
17289
+ tooltipProps: { tooltip: I ? b : y },
17290
+ onClick: De
17245
17291
  }),
17246
- Pe && /* @__PURE__ */ M(h, {
17247
- icon: M(L ? C : E, {
17292
+ Fe && /* @__PURE__ */ N(h, {
17293
+ icon: N(Ce ? C : E, {
17248
17294
  size: d.LG,
17249
17295
  stroke: 1.5
17250
17296
  }),
17251
- "aria-label": L ? w : x,
17252
- tooltipProps: { tooltip: L ? w : x },
17253
- onClick: De
17297
+ "aria-label": Ce ? w : x,
17298
+ tooltipProps: { tooltip: Ce ? w : x },
17299
+ onClick: Oe
17254
17300
  }),
17255
- Fe && /* @__PURE__ */ M(h, {
17256
- icon: /* @__PURE__ */ M(ee, {
17301
+ Ie && /* @__PURE__ */ N(h, {
17302
+ icon: /* @__PURE__ */ N(ee, {
17257
17303
  size: d.LG,
17258
17304
  stroke: 1.5
17259
17305
  }),
17260
17306
  "aria-label": m,
17261
17307
  tooltipProps: { tooltip: m },
17262
- onClick: O
17308
+ onClick: k
17263
17309
  })
17264
17310
  ] }) : null,
17265
- children: /* @__PURE__ */ M("div", {
17266
- style: !i && s.type === P.PlainText ? B : void 0,
17267
- className: a(i ? "flex h-full items-center justify-center" : Ie, Ae),
17268
- children: i ? /* @__PURE__ */ M(v, {}) : U
17311
+ children: /* @__PURE__ */ N("div", {
17312
+ style: !i && s.type === F.PlainText ? V : void 0,
17313
+ className: a(i ? "flex h-full items-center justify-center" : U, je),
17314
+ children: i ? /* @__PURE__ */ N(v, {}) : Le
17269
17315
  })
17270
17316
  });
17271
- }), Fo = {
17272
- type: P.PlainText,
17317
+ }), Lo = {
17318
+ type: F.PlainText,
17273
17319
  text: ""
17274
- }, Io = (e) => {
17275
- if (!(e.type !== P.Image && e.type !== P.Audio && e.type !== P.Pdf)) return e.url.startsWith("blob:") ? e.url : void 0;
17276
- }, Lo = O(void 0);
17277
- Lo.displayName = "AttachmentCanvasContext";
17278
- var Ro = ({ children: e }) => {
17279
- let [t, n] = j(!1), [r, i] = j(!1), [a, o] = j(Fo), [s, c] = j(void 0), l = k((e) => {
17320
+ }, Ro = (e) => {
17321
+ if (!(e.type !== F.Image && e.type !== F.Audio && e.type !== F.Pdf)) return e.url.startsWith("blob:") ? e.url : void 0;
17322
+ }, zo = k(void 0);
17323
+ zo.displayName = "AttachmentCanvasContext";
17324
+ var Bo = ({ children: e }) => {
17325
+ let [t, n] = M(!1), [r, i] = M(!1), [a, o] = M(Lo), [s, c] = M(void 0), l = A((e) => {
17280
17326
  c(e), i(!0), n(!0);
17281
- }, []), u = k((e, t) => {
17327
+ }, []), u = A((e, t) => {
17282
17328
  o(e), c(t), i(!1), n(!0);
17283
- }, []), d = k(() => {
17284
- n(!1), i(!1);
17329
+ }, []), d = A(() => {
17330
+ o(Lo), n(!1), i(!1);
17285
17331
  }, []);
17286
- return A(() => () => {
17287
- let e = Io(a);
17332
+ return j(() => () => {
17333
+ let e = Ro(a);
17288
17334
  e != null && URL.revokeObjectURL(e);
17289
- }, [a]), /* @__PURE__ */ M(Lo.Provider, {
17290
- value: oe(() => ({
17335
+ }, [a]), /* @__PURE__ */ N(zo.Provider, {
17336
+ value: ae(() => ({
17291
17337
  isOpen: t,
17292
17338
  isLoading: r,
17293
17339
  content: a,
@@ -17306,21 +17352,21 @@ var Ro = ({ children: e }) => {
17306
17352
  ]),
17307
17353
  children: e
17308
17354
  });
17309
- }, zo = () => {
17310
- let e = ae(Lo);
17355
+ }, Vo = () => {
17356
+ let e = ie(zo);
17311
17357
  if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
17312
17358
  return e;
17313
- }, Bo = ie(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: a }) => {
17314
- let { ariaLabel: o = "Attachment preview", closeLabel: s = "Close", downloadLabel: c = "Download", unsupportedLabel: l = "Preview is not supported for this file", loadErrorLabel: u = "Failed to load file", forbiddenErrorLabel: d = "You don't have permission to access this file", copyTextLabel: f, copiedTextLabel: p, copyMarkdownLabel: m, copiedMarkdownLabel: h, copyJsonLabel: g, copiedJsonLabel: _ } = e ?? {}, { isOpen: v, isLoading: y, content: b, fileName: x, closeCanvas: S } = zo(), C = k(() => {
17315
- me(b, x);
17316
- }, [b, x]), w = k(() => {
17317
- b.type === P.PlainText && i(b.text);
17318
- }, [b]), T = k(() => {
17319
- b.type === P.Markdown && i(b.text);
17320
- }, [b]), E = k(() => {
17321
- b.type === P.Json && i(JSON.stringify(b.value, null, 2));
17359
+ }, Ho = re(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: a }) => {
17360
+ let { ariaLabel: o = "Attachment preview", closeLabel: s = "Close", downloadLabel: c = "Download", unsupportedLabel: l = "Preview is not supported for this file", loadErrorLabel: u = "Failed to load file", forbiddenErrorLabel: d = "You don't have permission to access this file", copyTextLabel: f, copiedTextLabel: p, copyMarkdownLabel: m, copiedMarkdownLabel: h, copyJsonLabel: g, copiedJsonLabel: _ } = e ?? {}, { isOpen: v, isLoading: y, content: b, fileName: x, closeCanvas: S } = Vo(), C = A(() => {
17361
+ pe(b, x);
17362
+ }, [b, x]), w = A(() => {
17363
+ b.type === F.PlainText && i(b.text);
17364
+ }, [b]), T = A(() => {
17365
+ b.type === F.Markdown && i(b.text);
17366
+ }, [b]), E = A(() => {
17367
+ b.type === F.Json && i(JSON.stringify(b.value, null, 2));
17322
17368
  }, [b]);
17323
- return /* @__PURE__ */ M(Po, {
17369
+ return /* @__PURE__ */ N(Io, {
17324
17370
  isOpen: v,
17325
17371
  isLoading: y,
17326
17372
  onClose: S,
@@ -17341,28 +17387,28 @@ var Ro = ({ children: e }) => {
17341
17387
  forbiddenErrorLabel: d
17342
17388
  },
17343
17389
  onDownload: C,
17344
- onCopyText: b.type === P.PlainText ? w : void 0,
17345
- onCopyMarkdown: b.type === P.Markdown ? T : void 0,
17346
- onCopyJson: b.type === P.Json ? E : void 0,
17390
+ onCopyText: b.type === F.PlainText ? w : void 0,
17391
+ onCopyMarkdown: b.type === F.Markdown ? T : void 0,
17392
+ onCopyJson: b.type === F.Json ? E : void 0,
17347
17393
  isMobile: t,
17348
17394
  defaultWidth: n,
17349
17395
  maxWidth: r,
17350
17396
  codeBlockTheme: a
17351
17397
  });
17352
- }), Vo = new Set(/* @__PURE__ */ "txt.md.markdown.json.jsonl.ndjson.xml.csv.tsv.yaml.yml.toml.ini.conf.cfg.html.htm.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(".")), Ho = (e) => {
17398
+ }), Uo = new Set(/* @__PURE__ */ "txt.md.markdown.json.jsonl.ndjson.xml.csv.tsv.yaml.yml.toml.ini.conf.cfg.html.htm.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(".")), Wo = (e) => {
17353
17399
  let t = e.lastIndexOf(".");
17354
- return t === -1 ? !1 : Vo.has(e.slice(t + 1).toLowerCase());
17355
- }, Uo = (e) => ({
17356
- type: P.Unsupported,
17400
+ return t === -1 ? !1 : Uo.has(e.slice(t + 1).toLowerCase());
17401
+ }, Go = (e) => ({
17402
+ type: F.Unsupported,
17357
17403
  ...e != null && { url: e }
17358
- }), Wo = (e) => ({
17359
- type: P.Error,
17360
- errorType: de.LoadFailed,
17404
+ }), Ko = (e) => ({
17405
+ type: F.Error,
17406
+ errorType: ue.LoadFailed,
17361
17407
  ...e != null && { url: e }
17362
- }), Go = (e) => ({
17363
- type: P.Error,
17364
- errorType: de.Forbidden,
17408
+ }), qo = (e) => ({
17409
+ type: F.Error,
17410
+ errorType: ue.Forbidden,
17365
17411
  ...e != null && { url: e }
17366
17412
  });
17367
17413
  //#endregion
17368
- export { Po as AttachmentCanvas, Bo as AttachmentCanvasContainer, Ro as AttachmentCanvasProvider, P as AttachmentContentType, de as AttachmentErrorType, Go as createForbiddenCanvasContent, Wo as createLoadErrorCanvasContent, Uo as createUnsupportedCanvasContent, me as downloadAttachmentContent, fe as isDownloadable, Ho as isTextPreviewable, zo as useAttachmentCanvas };
17414
+ export { Io as AttachmentCanvas, Ho as AttachmentCanvasContainer, Bo as AttachmentCanvasProvider, F as AttachmentContentType, ue as AttachmentErrorType, qo as createForbiddenCanvasContent, Ko as createLoadErrorCanvasContent, Go as createUnsupportedCanvasContent, pe as downloadAttachmentContent, de as isDownloadable, Wo as isTextPreviewable, Vo as useAttachmentCanvas };
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, JSON, markdown, and plain text",
4
- "version": "1.1.0-dev.56",
4
+ "version": "1.1.0-dev.58",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -17,8 +17,8 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@epam/ai-dial-chat-shared": "1.1.0-dev.56",
21
- "@epam/ai-dial-sidebar": "1.1.0-dev.56",
20
+ "@epam/ai-dial-chat-shared": "1.1.0-dev.58",
21
+ "@epam/ai-dial-sidebar": "1.1.0-dev.58",
22
22
  "@epam/ai-dial-ui-kit": "^0.13.0-dev.17",
23
23
  "@epam/pdf-highlighter-kit": ">=0.0.14",
24
24
  "@tabler/icons-react": "^3.44.0",