teamsync-pdf-viewer 1.7.0 → 1.7.1

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.
@@ -3470,30 +3470,30 @@ function Ht(e, t, n = .5) {
3470
3470
  }
3471
3471
  //#endregion
3472
3472
  //#region src/core/pdfAssets.ts
3473
- var U = {};
3474
- function Ut(e) {
3475
- U = {
3476
- ...U,
3473
+ var Ut = {};
3474
+ function Wt(e) {
3475
+ Ut = {
3476
+ ...Ut,
3477
3477
  ...e
3478
3478
  }, e.workerSrc && (Be.GlobalWorkerOptions.workerSrc = e.workerSrc);
3479
3479
  }
3480
- function Wt() {
3481
- return U;
3482
- }
3483
3480
  function Gt() {
3484
- return !!(U.workerSrc || Be.GlobalWorkerOptions.workerSrc);
3481
+ return Ut;
3485
3482
  }
3486
3483
  function Kt() {
3487
- if (!Gt()) throw Error("[teamsync-pdf-viewer] pdf.js worker not configured. Call configurePdfAssets({ workerSrc }) with the URL of pdf.worker.min.mjs (same pdfjs-dist version) before loading a document, or pass `assets={{ workerSrc }}` to <TeamSyncViewer>.");
3484
+ return !!(Ut.workerSrc || Be.GlobalWorkerOptions.workerSrc);
3488
3485
  }
3489
3486
  function qt() {
3487
+ if (!Kt()) throw Error("[teamsync-pdf-viewer] pdf.js worker not configured. Call configurePdfAssets({ workerSrc }) with the URL of pdf.worker.min.mjs (same pdfjs-dist version) before loading a document, or pass `assets={{ workerSrc }}` to <TeamSyncViewer>.");
3488
+ }
3489
+ function Jt() {
3490
3490
  let e = {};
3491
- return U.cMapUrl && (e.cMapUrl = U.cMapUrl, e.cMapPacked = !0), U.standardFontDataUrl && (e.standardFontDataUrl = U.standardFontDataUrl), U.wasmUrl && (e.wasmUrl = U.wasmUrl), U.iccUrl && (e.iccUrl = U.iccUrl), e;
3491
+ return Ut.cMapUrl && (e.cMapUrl = Ut.cMapUrl, e.cMapPacked = !0), Ut.standardFontDataUrl && (e.standardFontDataUrl = Ut.standardFontDataUrl), Ut.wasmUrl && (e.wasmUrl = Ut.wasmUrl), Ut.iccUrl && (e.iccUrl = Ut.iccUrl), e;
3492
3492
  }
3493
- var Jt = Be.version;
3493
+ var Yt = Be.version;
3494
3494
  //#endregion
3495
3495
  //#region src/components/DiffHighlightOverlay.tsx
3496
- function Yt({ boxes: e, scale: t, colorScheme: n = "all", selectedDiffId: r, onSelectDiff: i }) {
3496
+ function Xt({ boxes: e, scale: t, colorScheme: n = "all", selectedDiffId: r, onSelectDiff: i }) {
3497
3497
  let [a, o] = c(null);
3498
3498
  if (!e || e.length === 0) return null;
3499
3499
  let s = e.filter((e) => n === "deletions" ? e.type === "deletion" || e.type === "modification" : n !== "additions" || e.type === "addition" || e.type === "modification");
@@ -3598,7 +3598,7 @@ function Yt({ boxes: e, scale: t, colorScheme: n = "all", selectedDiffId: r, onS
3598
3598
  }
3599
3599
  //#endregion
3600
3600
  //#region src/components/SideBySideViewer.tsx
3601
- function Xt({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePageDims: o, activeTab: l, activeTool: u, annotations: d, watermark: f, watermarkText: p, redactions: m, diffsA: h = [], diffsB: g = [], selectedDiffId: _, onSelectDiff: v, hideAnnotationsUntilPageRendered: y = !0 }) {
3601
+ function Zt({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePageDims: o, activeTab: l, activeTool: u, annotations: d, watermark: f, watermarkText: p, redactions: m, diffsA: h = [], diffsB: g = [], selectedDiffId: _, onSelectDiff: v, hideAnnotationsUntilPageRendered: y = !0 }) {
3602
3602
  let b = s(null), x = s(null), S = s(!1);
3603
3603
  i(() => {
3604
3604
  let e = b.current, t = x.current;
@@ -3731,7 +3731,7 @@ function Xt({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3731
3731
  watermarkText: p,
3732
3732
  redactions: m,
3733
3733
  hideAnnotationsUntilPageRendered: y
3734
- }), /* @__PURE__ */ P(Yt, {
3734
+ }), /* @__PURE__ */ P(Xt, {
3735
3735
  boxes: h,
3736
3736
  scale: r,
3737
3737
  colorScheme: "deletions",
@@ -3796,7 +3796,7 @@ function Xt({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3796
3796
  watermarkText: p,
3797
3797
  redactions: m,
3798
3798
  hideAnnotationsUntilPageRendered: y
3799
- }), /* @__PURE__ */ P(Yt, {
3799
+ }), /* @__PURE__ */ P(Xt, {
3800
3800
  boxes: g,
3801
3801
  scale: r,
3802
3802
  colorScheme: "additions",
@@ -3809,7 +3809,7 @@ function Xt({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3809
3809
  }
3810
3810
  //#endregion
3811
3811
  //#region src/components/CompareToolbar.tsx
3812
- function Zt({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r, onPrevDiff: i, onNextDiff: a, onExit: o }) {
3812
+ function Qt({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r, onPrevDiff: i, onNextDiff: a, onExit: o }) {
3813
3813
  let { mode: s, colorA: c, colorB: l, showCurtain: u, diffItems: d, currentDiffIndex: f } = e;
3814
3814
  return /* @__PURE__ */ F("div", {
3815
3815
  style: {
@@ -4065,7 +4065,7 @@ function Zt({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
4065
4065
  }
4066
4066
  //#endregion
4067
4067
  //#region src/components/DiffSummarySidebar.tsx
4068
- function Qt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSelectDiff: i, onJumpToPage: a }) {
4068
+ function $t({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSelectDiff: i, onJumpToPage: a }) {
4069
4069
  return e ? /* @__PURE__ */ F("div", {
4070
4070
  style: {
4071
4071
  width: "320px",
@@ -4296,7 +4296,7 @@ function Qt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
4296
4296
  }
4297
4297
  //#endregion
4298
4298
  //#region src/components/CompareCurtainSlider.tsx
4299
- function $t({ positionPercent: e, onChangePosition: t, containerRef: n }) {
4299
+ function en({ positionPercent: e, onChangePosition: t, containerRef: n }) {
4300
4300
  let [r, a] = c(!1), o = s(null);
4301
4301
  return i(() => {
4302
4302
  let e = (e) => {
@@ -4353,7 +4353,7 @@ function $t({ positionPercent: e, onChangePosition: t, containerRef: n }) {
4353
4353
  }
4354
4354
  //#endregion
4355
4355
  //#region src/utils/pdfDiffEngine.ts
4356
- async function en(e) {
4356
+ async function tn(e) {
4357
4357
  let t = e.getViewport({
4358
4358
  scale: 1,
4359
4359
  rotation: e.rotate
@@ -4376,8 +4376,8 @@ async function en(e) {
4376
4376
  }
4377
4377
  return r;
4378
4378
  }
4379
- async function tn(e, t, n) {
4380
- let [r, i] = await Promise.all([e.getPage(n), t.getPage(Math.min(n, t.numPages))]), [a, o] = await Promise.all([en(r), en(i)]), s = a.map((e) => e.text), c = o.map((e) => e.text), l = s.length, u = c.length, d = l + u, f = new Int32Array(2 * d + 1);
4379
+ async function nn(e, t, n) {
4380
+ let [r, i] = await Promise.all([e.getPage(n), t.getPage(Math.min(n, t.numPages))]), [a, o] = await Promise.all([tn(r), tn(i)]), s = a.map((e) => e.text), c = o.map((e) => e.text), l = s.length, u = c.length, d = l + u, f = new Int32Array(2 * d + 1);
4381
4381
  f[1] = 0;
4382
4382
  let p = [];
4383
4383
  for (let e = 0; e <= d; e++) {
@@ -4400,7 +4400,7 @@ async function tn(e, t, n) {
4400
4400
  e > 0 && (m === i ? (_.push(h - 1), h--) : h === a && (g.push(m - 1), m--));
4401
4401
  }
4402
4402
  g.reverse(), _.reverse();
4403
- let v = W(g.map((e) => a[e]), n, "deletion"), y = W(_.map((e) => o[e]), n, "addition"), b = [];
4403
+ let v = rn(g.map((e) => a[e]), n, "deletion"), y = rn(_.map((e) => o[e]), n, "addition"), b = [];
4404
4404
  for (let e of v) b.push({
4405
4405
  id: e.id,
4406
4406
  pageIndex: n,
@@ -4427,16 +4427,16 @@ async function tn(e, t, n) {
4427
4427
  summary: b
4428
4428
  };
4429
4429
  }
4430
- function W(e, t, n) {
4430
+ function rn(e, t, n) {
4431
4431
  if (e.length === 0) return [];
4432
4432
  let r = [], i = [e[0]];
4433
4433
  for (let a = 1; a < e.length; a++) {
4434
4434
  let o = i[i.length - 1], s = e[a], c = Math.abs(s.y - o.y) < Math.max(o.height, s.height) * .6, l = s.x - (o.x + o.width) < 30;
4435
- c && l ? i.push(s) : (r.push(G(i, t, n, r.length + 1)), i = [s]);
4435
+ c && l ? i.push(s) : (r.push(an(i, t, n, r.length + 1)), i = [s]);
4436
4436
  }
4437
- return i.length > 0 && r.push(G(i, t, n, r.length + 1)), r;
4437
+ return i.length > 0 && r.push(an(i, t, n, r.length + 1)), r;
4438
4438
  }
4439
- function G(e, t, n, r) {
4439
+ function an(e, t, n, r) {
4440
4440
  let i = Math.min(...e.map((e) => e.x)), a = Math.min(...e.map((e) => e.y)), o = Math.max(...e.map((e) => e.x + e.width)), s = Math.max(...e.map((e) => e.y + e.height)), c = e.map((e) => e.text).join(" ");
4441
4441
  return {
4442
4442
  id: `diff-box-${t}-${n}-${r}-${Math.round(i)}-${Math.round(a)}`,
@@ -4449,7 +4449,7 @@ function G(e, t, n, r) {
4449
4449
  height: s - a + 2
4450
4450
  };
4451
4451
  }
4452
- function nn(e, t, n) {
4452
+ function on(e, t, n) {
4453
4453
  let r = e.split(/(\s+)/), i = t.split(/(\s+)/), a = r.length, o = i.length, s = a + o, c = new Int32Array(2 * s + 1);
4454
4454
  c[1] = 0;
4455
4455
  let l = [];
@@ -4460,7 +4460,7 @@ function nn(e, t, n) {
4460
4460
  u = t === -e || t !== e && c[t - 1 + s] < c[t + 1 + s] ? c[t + 1 + s] : c[t - 1 + s] + 1;
4461
4461
  let d = u - t;
4462
4462
  for (; u < a && d < o && r[u] === i[d];) u++, d++;
4463
- if (c[t + s] = u, u >= a && d >= o) return K(l, r, i, n);
4463
+ if (c[t + s] = u, u >= a && d >= o) return U(l, r, i, n);
4464
4464
  }
4465
4465
  }
4466
4466
  return [{
@@ -4473,7 +4473,7 @@ function nn(e, t, n) {
4473
4473
  pageIndex: n
4474
4474
  }];
4475
4475
  }
4476
- function K(e, t, n, r) {
4476
+ function U(e, t, n, r) {
4477
4477
  let i = t.length, a = n.length, o = t.length + n.length, s = [];
4478
4478
  for (let r = e.length - 1; r >= 0; r--) {
4479
4479
  let c = e[r], l = i - a, u;
@@ -4499,10 +4499,10 @@ function K(e, t, n, r) {
4499
4499
  });
4500
4500
  return c;
4501
4501
  }
4502
- function rn(e, t, n, r, i = .75) {
4502
+ function W(e, t, n, r, i = .75) {
4503
4503
  e.save(), e.globalCompositeOperation = "source-atop", e.fillStyle = r, e.globalAlpha = i, e.fillRect(0, 0, t, n), e.restore();
4504
4504
  }
4505
- function an(e, t, n, r) {
4505
+ function G(e, t, n, r) {
4506
4506
  let i = Math.min(e.width, t.width), a = Math.min(e.height, t.height);
4507
4507
  if (i === 0 || a === 0) return [];
4508
4508
  let o = e.getContext("2d"), s = t.getContext("2d");
@@ -4529,7 +4529,7 @@ function an(e, t, n, r) {
4529
4529
  }
4530
4530
  //#endregion
4531
4531
  //#region src/components/DocumentViewer.tsx
4532
- function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationManager: u, initialDoc: d, loadNonce: p = 0, withCredentials: h = !1, assets: g, sidebars: _ = !0, redactions: v, regexRedactions: x, scale: C, setScale: ee, sidebarTab: te, setSidebarTab: ne, onAnnotationsChange: ie, onRedactionsChange: oe, onRedactionsApplied: se, onDocumentLoaded: ce, onLoadError: w, onFirstPageRendered: le, onPageRendered: ue, onPageChange: fe, pageTransition: T, pageLayout: me, rotation: E, setRotation: he, watermark: ge, watermarkText: D, enableAnnotations: _e, initialPage: ve, page: A, transientHighlights: ye, permissions: j, hideAnnotationsUntilPageRendered: be = !0, enableTextSelection: Se = !0, defaultTool: M = "select", showSelectionTooltip: Ce = !0, initialScale: Te, initialWidthRatio: Ee, responsive: De = !0, instance: Oe, targetViewer: ke, resolveLinkUrl: Ae, onLinkClick: Me }) {
4532
+ function sn({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationManager: u, initialDoc: d, loadNonce: p = 0, withCredentials: h = !1, assets: g, sidebars: _ = !0, redactions: v, regexRedactions: x, scale: C, setScale: ee, sidebarTab: te, setSidebarTab: ne, onAnnotationsChange: ie, onRedactionsChange: oe, onRedactionsApplied: se, onDocumentLoaded: ce, onLoadError: w, onFirstPageRendered: le, onPageRendered: ue, onPageChange: fe, pageTransition: T, pageLayout: me, rotation: E, setRotation: he, watermark: ge, watermarkText: D, enableAnnotations: _e, initialPage: ve, page: A, transientHighlights: ye, permissions: j, hideAnnotationsUntilPageRendered: be = !0, enableTextSelection: Se = !0, defaultTool: M = "select", showSelectionTooltip: Ce = !0, initialScale: Te, initialWidthRatio: Ee, responsive: De = !0, instance: Oe, targetViewer: ke, resolveLinkUrl: Ae, onLinkClick: Me }) {
4533
4533
  let N = s(null), I = We(), [L, Ve] = c(null), [He, Ue] = c(null), [R, Ke] = c(1), [qe, Je] = c([]), { getCommand: Ye } = _t(), [Xe, Ze] = c(null), [z, Qe] = c({
4534
4534
  isActive: !1,
4535
4535
  mode: "overlay",
@@ -4564,9 +4564,9 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4564
4564
  V.current = g;
4565
4565
  let st = n(async (e) => {
4566
4566
  try {
4567
- Kt(), V.current && Ut(V.current);
4567
+ qt(), V.current && Wt(V.current);
4568
4568
  let t = typeof e == "string" ? { url: e } : { data: e };
4569
- h && (t.withCredentials = !0), Object.assign(t, qt());
4569
+ h && (t.withCredentials = !0), Object.assign(t, Jt());
4570
4570
  let n = await Be.getDocument(t).promise;
4571
4571
  Ve(n), B.current.onDocumentLoaded?.(n, typeof e == "string" ? e : "documentA.pdf");
4572
4572
  } catch (e) {
@@ -4574,9 +4574,9 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4574
4574
  }
4575
4575
  }, [h]), ct = n(async (e) => {
4576
4576
  try {
4577
- Kt(), V.current && Ut(V.current);
4577
+ qt(), V.current && Wt(V.current);
4578
4578
  let t = typeof e == "string" ? { url: e } : { data: e };
4579
- h && (t.withCredentials = !0), Object.assign(t, qt());
4579
+ h && (t.withCredentials = !0), Object.assign(t, Jt());
4580
4580
  let n = await Be.getDocument(t).promise;
4581
4581
  Ze(n), Qe((e) => ({
4582
4582
  ...e,
@@ -4599,7 +4599,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4599
4599
  try {
4600
4600
  let t = Math.min(L.numPages, Xe.numPages), n = [], r = {}, i = {};
4601
4601
  for (let a = 1; a <= t; a++) {
4602
- let { diffsA: t, diffsB: o, summary: s } = await tn(L, Xe, a);
4602
+ let { diffsA: t, diffsB: o, summary: s } = await nn(L, Xe, a);
4603
4603
  if (e) return;
4604
4604
  r[a] = t, i[a] = o, n = n.concat(s);
4605
4605
  }
@@ -4609,7 +4609,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4609
4609
  pageDiffsA: r,
4610
4610
  pageDiffsB: i
4611
4611
  }));
4612
- let a = await L.getPage(R), o = await Xe.getPage(Math.min(R, Xe.numPages)), s = await a.getTextContent(), c = await o.getTextContent(), l = nn(s.items.map((e) => e.str).join(" "), c.items.map((e) => e.str).join(" "), R);
4612
+ let a = await L.getPage(R), o = await Xe.getPage(Math.min(R, Xe.numPages)), s = await a.getTextContent(), c = await o.getTextContent(), l = on(s.items.map((e) => e.str).join(" "), c.items.map((e) => e.str).join(" "), R);
4613
4613
  e || nt(l);
4614
4614
  } catch (e) {
4615
4615
  console.error("Error computing document diffs:", e);
@@ -4667,7 +4667,20 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4667
4667
  ]), [gt, vt] = c({
4668
4668
  top: 0,
4669
4669
  left: 0
4670
- }), [bt, xt] = c(!1), St = s(null), Ct = o(() => {
4670
+ }), [bt, xt] = c({
4671
+ width: 0,
4672
+ height: 0
4673
+ });
4674
+ i(() => {
4675
+ if (N.current) {
4676
+ let e = N.current;
4677
+ xt({
4678
+ width: e.clientWidth,
4679
+ height: e.clientHeight
4680
+ });
4681
+ }
4682
+ }, []);
4683
+ let [St, Ct] = c(!1), Et = s(null), At = o(() => {
4671
4684
  let e = [];
4672
4685
  if (!L) return e;
4673
4686
  if (me === "single") for (let t = 1; t <= L.numPages; t++) e.push([t]);
@@ -4677,20 +4690,20 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4677
4690
  for (let t = 2; t <= L.numPages; t += 2) e.push([t, t + 1].filter((e) => e <= L.numPages));
4678
4691
  }
4679
4692
  return e;
4680
- }, [L, me]), Et = o(() => Vt(Ct, H, C, 16), [
4681
- Ct,
4693
+ }, [L, me]), jt = o(() => Vt(At, H, C, 16), [
4694
+ At,
4682
4695
  C,
4683
4696
  H
4684
- ]), At = s(Ct);
4685
- At.current = Ct;
4686
- let jt = s(C);
4687
- jt.current = C;
4688
- let Nt = s(Et);
4689
- Nt.current = Et;
4690
- let It = s(T);
4691
- It.current = T;
4692
- let Ht = s(0), U = n((e) => Ct.findIndex((t) => t.includes(e)), [Ct]), Wt = n((e) => {
4693
- let t = Et.tops;
4697
+ ]), Nt = s(At);
4698
+ Nt.current = At;
4699
+ let It = s(C);
4700
+ It.current = C;
4701
+ let Ht = s(jt);
4702
+ Ht.current = jt;
4703
+ let Ut = s(T);
4704
+ Ut.current = T;
4705
+ let Gt = s(0), Kt = n((e) => At.findIndex((t) => t.includes(e)), [At]), Yt = n((e) => {
4706
+ let t = jt.tops;
4694
4707
  if (t.length === 0) return 0;
4695
4708
  let n = 0, r = t.length - 1;
4696
4709
  for (; n < r;) {
@@ -4698,30 +4711,30 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4698
4711
  t[i] <= e ? n = i : r = i - 1;
4699
4712
  }
4700
4713
  return n;
4701
- }, [Et]), Gt = n((e, t = {}) => {
4714
+ }, [jt]), tn = n((e, t = {}) => {
4702
4715
  let n = L ? Math.max(1, Math.min(e, L.numPages)) : Math.max(1, e);
4703
4716
  Ke(n);
4704
- let r = U(n);
4717
+ let r = Kt(n);
4705
4718
  r >= 0 && N.current && (t.smooth ? N.current.scrollTo({
4706
- top: Et.tops[r],
4719
+ top: jt.tops[r],
4707
4720
  behavior: "smooth"
4708
- }) : N.current.scrollTop = Et.tops[r]);
4721
+ }) : N.current.scrollTop = jt.tops[r]);
4709
4722
  }, [
4710
4723
  L,
4711
- U,
4712
- Et
4724
+ Kt,
4725
+ jt
4713
4726
  ]);
4714
4727
  i(() => {
4715
4728
  let e = (e) => {
4716
- e?.page && Gt(e.page, { smooth: e.smooth ?? !0 });
4729
+ e?.page && tn(e.page, { smooth: e.smooth ?? !0 });
4717
4730
  }, t = I.on("action-go-to-page", (t) => e(t)), n = (t) => e(t.detail);
4718
4731
  return window.addEventListener("action-go-to-page", n), () => {
4719
4732
  t(), window.removeEventListener("action-go-to-page", n);
4720
4733
  };
4721
- }, [I, Gt]);
4722
- let Jt = (e) => {
4723
- Ke(e.pageIndex), ft(e), Gt(e.pageIndex);
4724
- }, en = n((e, t) => {
4734
+ }, [I, tn]);
4735
+ let rn = (e) => {
4736
+ Ke(e.pageIndex), ft(e), tn(e.pageIndex);
4737
+ }, an = n((e, t) => {
4725
4738
  let n = t || z.diffItems[e];
4726
4739
  if (Qe((t) => ({
4727
4740
  ...t,
@@ -4730,7 +4743,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4730
4743
  n.pageIndex && n.pageIndex !== R && Ke(n.pageIndex);
4731
4744
  let r = (n.y ?? 0) * C, i = (n.x ?? 0) * C;
4732
4745
  if (N.current) {
4733
- let e = n.pageIndex || R, t = U(e), a = T === "continuous" && t >= 0 ? Et.tops[t] ?? 0 : 0, o = N.current.clientHeight || 600, s = N.current.clientWidth || 800, c = Math.max(0, a + r - o / 3), l = Math.max(0, i - s / 4);
4746
+ let e = n.pageIndex || R, t = Kt(e), a = T === "continuous" && t >= 0 ? jt.tops[t] ?? 0 : 0, o = N.current.clientHeight || 600, s = N.current.clientWidth || 800, c = Math.max(0, a + r - o / 3), l = Math.max(0, i - s / 4);
4734
4747
  N.current.scrollTo({
4735
4748
  top: c,
4736
4749
  left: l,
@@ -4742,48 +4755,58 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4742
4755
  R,
4743
4756
  C,
4744
4757
  T,
4745
- U,
4746
- Et.tops
4747
- ]), W = l(u.subscribe, u.getSnapshot, u.getSnapshot), [G, K] = c(M);
4758
+ Kt,
4759
+ jt.tops
4760
+ ]), U = l(u.subscribe, u.getSnapshot, u.getSnapshot), [W, G] = c(M);
4748
4761
  i(() => {
4749
- a === "Annotate" ? (K("highlight"), an("#fbc02d"), un(.5), cn(16)) : a === "Shapes" ? (K("rectangle"), un(1), cn(2)) : a === "Fill and Sign" ? K("signature") : a === "View" && K(M);
4762
+ a === "Annotate" ? (G("highlight"), ln("#fbc02d"), pn(.5), dn(16)) : a === "Shapes" ? (G("rectangle"), pn(1), dn(2)) : a === "Fill and Sign" ? G("signature") : a === "View" && G(M);
4750
4763
  }, [a, M]), i(() => {
4751
- I.emit("action-tool-changed", { tool: G });
4752
- }, [G, I]);
4753
- let [rn, an] = c("#d32f2f"), [on, cn] = c(2), [ln, un] = c(.8), [dn, fn] = c(!1), [pn, mn] = c(null), [J, hn] = c({
4764
+ I.emit("action-tool-changed", { tool: W });
4765
+ }, [W, I]);
4766
+ let [sn, ln] = c("#d32f2f"), [un, dn] = c(2), [fn, pn] = c(.8), [mn, hn] = c(!1), [gn, _n] = c(null), [q, vn] = c({
4754
4767
  x: 0,
4755
4768
  y: 0
4756
- }), [Y, gn] = c({
4769
+ }), [J, yn] = c({
4757
4770
  x: 0,
4758
4771
  y: 0
4759
- }), [_n, vn] = c([]), [X, yn] = c(null), [bn, xn] = c(""), Sn = s(null), [Z, Cn] = c(null), [wn, Tn] = c(null), [En, Dn] = c(!1), On = s(!1), kn = s(null);
4760
- Ge("action-set-tool", (e) => K(e?.tool ?? null)), i(() => {
4772
+ }), [bn, xn] = c([]), [Y, Sn] = c(null), [Cn, X] = c(""), wn = s(null), [Z, Tn] = c(null), [En, Dn] = c(null), [On, kn] = c(!1), An = s(!1), jn = s(null);
4773
+ Ge("action-set-tool", (e) => G(e?.tool ?? null)), i(() => {
4761
4774
  let e = () => {
4762
4775
  let e = typeof window < "u" ? window.getSelection()?.toString() ?? "" : "";
4763
4776
  I.emit("action-text-selected", { text: e });
4764
4777
  };
4765
4778
  return document.addEventListener("selectionchange", e), () => document.removeEventListener("selectionchange", e);
4766
4779
  }, [I]);
4767
- let An = s({
4780
+ let Mn = s({
4768
4781
  vx: null,
4769
4782
  vy: null
4770
- }), jn = s(C), Mn = s(!1), Nn = s(!1), Pn = typeof Ee == "number" && Number.isFinite(Ee) && Ee > 0 ? Ee : typeof Te == "object" && Te && Te.type === "fit-width" && typeof Te.ratio == "number" && Te.ratio > 0 ? Te.ratio : void 0, Fn = s(typeof Pn == "number" ? {
4783
+ }), Nn = s(C), Pn = s(!1), Fn = s(!1), In = typeof Ee == "number" && Number.isFinite(Ee) && Ee > 0 ? Ee : typeof Te == "object" && Te && Te.type === "fit-width" && typeof Te.ratio == "number" && Te.ratio > 0 ? Te.ratio : void 0, Q = s(typeof In == "number" ? {
4771
4784
  type: "fit-width",
4772
- ratio: Pn
4773
- } : Te === "fit-width" ? {
4785
+ ratio: In
4786
+ } : Te === "fit-width" || Te === void 0 ? {
4774
4787
  type: "fit-width",
4775
4788
  ratio: 1
4776
4789
  } : Te === "fit-page" ? { type: "fit-page" } : null);
4777
4790
  i(() => {
4778
- Nn.current = !1;
4779
- }, [L]), i(() => {
4780
- if (jn.current !== C) {
4781
- let e = jn.current, t = C;
4782
- jn.current = C;
4791
+ Fn.current = !1, typeof In == "number" ? Q.current = {
4792
+ type: "fit-width",
4793
+ ratio: In
4794
+ } : Te === "fit-width" || Te === void 0 ? Q.current = {
4795
+ type: "fit-width",
4796
+ ratio: 1
4797
+ } : Te === "fit-page" ? Q.current = { type: "fit-page" } : Q.current = null;
4798
+ }, [
4799
+ L,
4800
+ Te,
4801
+ In
4802
+ ]), i(() => {
4803
+ if (Nn.current !== C) {
4804
+ let e = Nn.current, t = C;
4805
+ Nn.current = C;
4783
4806
  let n = N.current;
4784
4807
  if (!n) return;
4785
- let r = Mn.current || !Nn.current || lr.current !== L;
4786
- r || (Fn.current = null), Nn.current = !0, Mn.current = !1;
4808
+ let r = Pn.current || !Fn.current || dr.current !== L;
4809
+ r || (Q.current = null), Fn.current = !0, Pn.current = !1;
4787
4810
  let i = rt({
4788
4811
  prevScale: e,
4789
4812
  newScale: t,
@@ -4792,15 +4815,15 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4792
4815
  currentScrollLeft: n.scrollLeft,
4793
4816
  currentScrollTop: n.scrollTop,
4794
4817
  basePageWidth: H(R).width,
4795
- focusPoint: An.current,
4818
+ focusPoint: Mn.current,
4796
4819
  isProgrammatic: r
4797
4820
  });
4798
- if (An.current = {
4821
+ if (Mn.current = {
4799
4822
  vx: null,
4800
4823
  vy: null
4801
4824
  }, r && R > 1 && T === "continuous") {
4802
- let e = U(R);
4803
- e >= 0 && (n.scrollTop = Et.tops[e] ?? 0), n.scrollLeft = 0;
4825
+ let e = Kt(R);
4826
+ e >= 0 && (n.scrollTop = jt.tops[e] ?? 0), n.scrollLeft = 0;
4804
4827
  } else n.scrollLeft = i.scrollLeft, n.scrollTop = i.scrollTop;
4805
4828
  }
4806
4829
  }, [C]), i(() => {
@@ -4812,7 +4835,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4812
4835
  let n = e.getBoundingClientRect(), r = t.clientX, i = t.clientY, a = Math.exp(-t.deltaY * .002);
4813
4836
  ee((e) => {
4814
4837
  let t = et(e * a);
4815
- return t !== e && (An.current = {
4838
+ return t !== e && (Mn.current = {
4816
4839
  vx: r - n.left,
4817
4840
  vy: i - n.top
4818
4841
  }), t;
@@ -4821,79 +4844,79 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4821
4844
  };
4822
4845
  return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
4823
4846
  }, [ee]);
4824
- let Q = n((e) => {
4847
+ let $ = n((e) => {
4825
4848
  u.commit(e);
4826
4849
  }, [u]);
4827
4850
  Ge("action-commit-digital-signature-local", (e) => {
4828
- e?.tempAnn && Q([...W, e.tempAnn]);
4851
+ e?.tempAnn && $([...U, e.tempAnn]);
4829
4852
  });
4830
- let $ = n(() => {
4853
+ let Ln = n(() => {
4831
4854
  u.undo();
4832
- }, [u]), In = n(() => {
4855
+ }, [u]), Rn = n(() => {
4833
4856
  u.redo();
4834
- }, [u]), [Ln, Rn] = c(null), [zn, Bn] = c(null), Vn = s(null), Hn = s(null), Un = s(null);
4835
- Un.current = Ln;
4836
- let Wn = s(null);
4837
- Wn.current = zn;
4838
- let Gn = n((e, t, n, r) => {
4839
- let i = W.find((t) => t.id === e);
4857
+ }, [u]), [zn, Bn] = c(null), [Vn, Hn] = c(null), Un = s(null), Wn = s(null), Gn = s(null);
4858
+ Gn.current = zn;
4859
+ let Kn = s(null);
4860
+ Kn.current = Vn;
4861
+ let qn = n((e, t, n, r) => {
4862
+ let i = U.find((t) => t.id === e);
4840
4863
  if (!i || j?.canEditAnnotations === !1 || !u.canEdit(i)) return;
4841
4864
  let a = {
4842
4865
  ...i,
4843
4866
  width: i.width && i.width > 0 ? i.width : 180,
4844
4867
  height: i.height && i.height > 0 ? i.height : 40
4845
4868
  };
4846
- Vn.current = {
4869
+ Un.current = {
4847
4870
  annId: e,
4848
4871
  handle: t,
4849
4872
  startX: n.clientX,
4850
4873
  startY: n.clientY,
4851
4874
  initialAnn: a,
4852
4875
  pageIndex: r
4853
- }, Rn(a);
4876
+ }, Bn(a);
4854
4877
  }, [
4855
- W,
4878
+ U,
4856
4879
  u,
4857
4880
  j
4858
- ]), Kn = n((e, t, n) => {
4859
- let r = W.find((t) => t.id === e);
4860
- !r || j?.canEditAnnotations === !1 || !u.canEdit(r) || (Hn.current = {
4881
+ ]), Jn = n((e, t, n) => {
4882
+ let r = U.find((t) => t.id === e);
4883
+ !r || j?.canEditAnnotations === !1 || !u.canEdit(r) || (Wn.current = {
4861
4884
  annId: e,
4862
4885
  startX: t.clientX,
4863
4886
  startY: t.clientY,
4864
4887
  initialAnn: { ...r },
4865
4888
  pageIndex: n
4866
- }, Bn({ ...r }));
4889
+ }, Hn({ ...r }));
4867
4890
  }, [
4868
- W,
4891
+ U,
4869
4892
  u,
4870
4893
  j
4871
- ]), qn = n((e, t) => {
4894
+ ]), Yn = n((e, t) => {
4872
4895
  t.stopPropagation();
4873
- let n = W.find((t) => t.id === e);
4896
+ let n = U.find((t) => t.id === e);
4874
4897
  if (n && (n.type === "text" || n.type === "note" || n.type === "callout")) {
4875
4898
  if (j?.canEditAnnotations === !1 || !u.canEdit(n)) {
4876
- Cn(e);
4899
+ Tn(e);
4877
4900
  return;
4878
4901
  }
4879
- yn({
4902
+ Sn({
4880
4903
  x: n.x,
4881
4904
  y: n.y,
4882
4905
  type: n.type,
4883
4906
  annId: n.id,
4884
4907
  points: n.points,
4885
4908
  pageIndex: n.pageIndex
4886
- }), xn(n.text || ""), n.color && an(n.color), Cn(e);
4909
+ }), X(n.text || ""), n.color && ln(n.color), Tn(e);
4887
4910
  }
4888
4911
  }, [
4889
- W,
4912
+ U,
4890
4913
  u,
4891
4914
  j
4892
4915
  ]);
4893
4916
  i(() => {
4894
4917
  let e = (e) => {
4895
- if (Vn.current) {
4896
- let { handle: t, startX: n, startY: r, initialAnn: i } = Vn.current, a = (e.clientX - n) / C, o = (e.clientY - r) / C;
4918
+ if (Un.current) {
4919
+ let { handle: t, startX: n, startY: r, initialAnn: i } = Un.current, a = (e.clientX - n) / C, o = (e.clientY - r) / C;
4897
4920
  if (E === 90) {
4898
4921
  let e = a;
4899
4922
  a = o, o = -e;
@@ -4903,15 +4926,15 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4903
4926
  a = -o, o = e;
4904
4927
  }
4905
4928
  let s = i.width, c = i.height, l = i.x, u = i.y;
4906
- t.includes("e") && (s = Math.max(30, i.width + a)), t.includes("s") && (c = Math.max(16, i.height + o)), t.includes("w") && (s = Math.max(30, i.width - a), l = i.x + (i.width - s)), t.includes("n") && (c = Math.max(16, i.height - o), u = i.y + (i.height - c)), Rn({
4929
+ t.includes("e") && (s = Math.max(30, i.width + a)), t.includes("s") && (c = Math.max(16, i.height + o)), t.includes("w") && (s = Math.max(30, i.width - a), l = i.x + (i.width - s)), t.includes("n") && (c = Math.max(16, i.height - o), u = i.y + (i.height - c)), Bn({
4907
4930
  ...i,
4908
4931
  x: l,
4909
4932
  y: u,
4910
4933
  width: s,
4911
4934
  height: c
4912
4935
  });
4913
- } else if (Hn.current) {
4914
- let { startX: t, startY: n, initialAnn: r } = Hn.current, i = (e.clientX - t) / C, a = (e.clientY - n) / C;
4936
+ } else if (Wn.current) {
4937
+ let { startX: t, startY: n, initialAnn: r } = Wn.current, i = (e.clientX - t) / C, a = (e.clientY - n) / C;
4915
4938
  if (E === 90) {
4916
4939
  let e = i;
4917
4940
  i = a, a = -e;
@@ -4920,26 +4943,26 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4920
4943
  let e = i;
4921
4944
  i = -a, a = e;
4922
4945
  }
4923
- Bn({
4946
+ Hn({
4924
4947
  ...r,
4925
4948
  x: Math.max(0, r.x + i),
4926
4949
  y: Math.max(0, r.y + a)
4927
4950
  });
4928
4951
  }
4929
4952
  }, t = () => {
4930
- if (Vn.current) {
4931
- if (Un.current) {
4932
- let e = Un.current;
4933
- Q(W.map((t) => t.id === e.id ? e : t));
4953
+ if (Un.current) {
4954
+ if (Gn.current) {
4955
+ let e = Gn.current;
4956
+ $(U.map((t) => t.id === e.id ? e : t));
4934
4957
  }
4935
- Vn.current = null, Rn(null);
4958
+ Un.current = null, Bn(null);
4936
4959
  }
4937
- if (Hn.current) {
4938
- if (Wn.current) {
4939
- let e = Wn.current;
4940
- Q(W.map((t) => t.id === e.id ? e : t));
4960
+ if (Wn.current) {
4961
+ if (Kn.current) {
4962
+ let e = Kn.current;
4963
+ $(U.map((t) => t.id === e.id ? e : t));
4941
4964
  }
4942
- Hn.current = null, Bn(null);
4965
+ Wn.current = null, Hn(null);
4943
4966
  }
4944
4967
  };
4945
4968
  return window.addEventListener("mousemove", e), window.addEventListener("mouseup", t), () => {
@@ -4948,10 +4971,10 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4948
4971
  }, [
4949
4972
  C,
4950
4973
  E,
4951
- W,
4952
- Q
4974
+ U,
4975
+ $
4953
4976
  ]);
4954
- let Jn = n((e) => {
4977
+ let Xn = n((e) => {
4955
4978
  if (j?.canAddAnnotations === !1 || typeof window > "u") return;
4956
4979
  let t = window.getSelection();
4957
4980
  if (!t || t.isCollapsed || !t.rangeCount) return;
@@ -4972,8 +4995,8 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4972
4995
  };
4973
4996
  }).filter((e) => e.width > 2 && e.height > 2);
4974
4997
  if (d.length === 0) return;
4975
- let f = Math.min(...d.map((e) => e.x)), p = Math.min(...d.map((e) => e.y)), m = Math.max(...d.map((e) => e.x + e.width)), h = Math.max(...d.map((e) => e.y + e.height)), g = e === "highlight" ? "#fbc02d" : e === "squiggly" ? "#388e3c" : rn || "#d32f2f", _ = e === "highlight" ? .5 : 1, v = e === "squiggly" ? 1.5 : 2, y = Ft();
4976
- Q([...W, {
4998
+ let f = Math.min(...d.map((e) => e.x)), p = Math.min(...d.map((e) => e.y)), m = Math.max(...d.map((e) => e.x + e.width)), h = Math.max(...d.map((e) => e.y + e.height)), g = e === "highlight" ? "#fbc02d" : e === "squiggly" ? "#388e3c" : sn || "#d32f2f", _ = e === "highlight" ? .5 : 1, v = e === "squiggly" ? 1.5 : 2, y = Ft();
4999
+ $([...U, {
4977
5000
  id: y,
4978
5001
  type: e,
4979
5002
  pageIndex: o,
@@ -4987,9 +5010,9 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4987
5010
  opacity: _
4988
5011
  }]), t.removeAllRanges();
4989
5012
  }, [
4990
- W,
4991
- Q,
4992
- rn,
5013
+ U,
5014
+ $,
5015
+ sn,
4993
5016
  H,
4994
5017
  j,
4995
5018
  E,
@@ -5006,11 +5029,11 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5006
5029
  return;
5007
5030
  }
5008
5031
  if (yt(e, Ye("UNDO"))) {
5009
- e.preventDefault(), $();
5032
+ e.preventDefault(), Ln();
5010
5033
  return;
5011
5034
  }
5012
5035
  if (yt(e, Ye("REDO"))) {
5013
- e.preventDefault(), In();
5036
+ e.preventDefault(), Rn();
5014
5037
  return;
5015
5038
  }
5016
5039
  if (yt(e, Ye("SEARCH"))) {
@@ -5021,7 +5044,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5021
5044
  e.preventDefault(), I.emit("action-open-file-picker");
5022
5045
  return;
5023
5046
  }
5024
- if (!t && !X) {
5047
+ if (!t && !Y) {
5025
5048
  if (yt(e, Ye("COPY"))) {
5026
5049
  let t = typeof window < "u" ? window.getSelection()?.toString() : "";
5027
5050
  if (t && t.length > 0) {
@@ -5029,14 +5052,14 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5029
5052
  return;
5030
5053
  }
5031
5054
  if (Z) {
5032
- let t = W.find((e) => e.id === Z);
5033
- t && (e.preventDefault(), kn.current = t);
5055
+ let t = U.find((e) => e.id === Z);
5056
+ t && (e.preventDefault(), jn.current = t);
5034
5057
  return;
5035
5058
  }
5036
5059
  }
5037
- if (yt(e, Ye("PASTE")) && kn.current) {
5060
+ if (yt(e, Ye("PASTE")) && jn.current) {
5038
5061
  e.preventDefault();
5039
- let t = kn.current, n = {
5062
+ let t = jn.current, n = {
5040
5063
  ...t,
5041
5064
  id: Ft(),
5042
5065
  pageIndex: R,
@@ -5049,77 +5072,77 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5049
5072
  readOnly: void 0,
5050
5073
  xfdfExtras: void 0
5051
5074
  };
5052
- Q([...W, n]), Cn(n.id);
5075
+ $([...U, n]), Tn(n.id);
5053
5076
  return;
5054
5077
  }
5055
5078
  if (yt(e, Ye("DELETE")) && Z) {
5056
- e.preventDefault(), Q(W.filter((e) => e.id !== Z)), Cn(null);
5079
+ e.preventDefault(), $(U.filter((e) => e.id !== Z)), Tn(null);
5057
5080
  return;
5058
5081
  }
5059
- if (e.key === "Enter" && Z && !X) {
5060
- let t = W.find((e) => e.id === Z);
5082
+ if (e.key === "Enter" && Z && !Y) {
5083
+ let t = U.find((e) => e.id === Z);
5061
5084
  if (t && (t.type === "text" || t.type === "note" || t.type === "callout")) {
5062
- e.preventDefault(), yn({
5085
+ e.preventDefault(), Sn({
5063
5086
  x: t.x,
5064
5087
  y: t.y,
5065
5088
  type: t.type,
5066
5089
  annId: t.id,
5067
5090
  points: t.points,
5068
5091
  pageIndex: t.pageIndex
5069
- }), xn(t.text || ""), t.color && an(t.color);
5092
+ }), X(t.text || ""), t.color && ln(t.color);
5070
5093
  return;
5071
5094
  }
5072
5095
  }
5073
5096
  }
5074
5097
  }), i(() => {
5075
- X && Sn.current && setTimeout(() => {
5076
- Sn.current?.focus();
5098
+ Y && wn.current && setTimeout(() => {
5099
+ wn.current?.focus();
5077
5100
  }, 10);
5078
- }, [X]), i(() => {
5079
- ie && ie(W);
5080
- }, [W, ie]);
5081
- let [Yn, Xn] = c([]);
5101
+ }, [Y]), i(() => {
5102
+ ie && ie(U);
5103
+ }, [U, ie]);
5104
+ let [Zn, Qn] = c([]);
5082
5105
  i(() => {
5083
5106
  if (L && x && x.length > 0) {
5084
5107
  let e = !1;
5085
5108
  return Rt(L, x).then((t) => {
5086
- e || Xn(t);
5109
+ e || Qn(t);
5087
5110
  }), () => {
5088
5111
  e = !0;
5089
5112
  };
5090
5113
  }
5091
- Xn([]);
5114
+ Qn([]);
5092
5115
  }, [L, x]);
5093
- let [Zn, Qn] = c(!1), $n = o(() => [
5116
+ let [$n, er] = c(!1), tr = o(() => [
5094
5117
  ...v || [],
5095
- ...Yn,
5118
+ ...Zn,
5096
5119
  ...qe
5097
5120
  ], [
5098
5121
  v,
5099
- Yn,
5122
+ Zn,
5100
5123
  qe
5101
5124
  ]);
5102
5125
  i(() => {
5103
- B.current.onRedactionsChange?.($n);
5104
- }, [$n]);
5105
- let er = o(() => $n.filter((e) => e.status === "pending").length, [$n]), tr = n(() => {
5106
- Je((e) => e.filter((e) => e.status === "applied")), Xn((e) => e.filter((e) => e.status === "applied"));
5107
- }, []), nr = n((e) => {
5108
- Je((t) => t.filter((t) => t !== e && t.id !== e.id)), Xn((t) => t.filter((t) => t !== e && t.id !== e.id));
5109
- }, []), { search: rr, searchResults: ir, isSearching: ar, searchProgress: or } = wt(L, $n);
5126
+ B.current.onRedactionsChange?.(tr);
5127
+ }, [tr]);
5128
+ let nr = o(() => tr.filter((e) => e.status === "pending").length, [tr]), rr = n(() => {
5129
+ Je((e) => e.filter((e) => e.status === "applied")), Qn((e) => e.filter((e) => e.status === "applied"));
5130
+ }, []), ir = n((e) => {
5131
+ Je((t) => t.filter((t) => t !== e && t.id !== e.id)), Qn((t) => t.filter((t) => t !== e && t.id !== e.id));
5132
+ }, []), { search: ar, searchResults: or, isSearching: sr, searchProgress: cr } = wt(L, tr);
5110
5133
  i(() => {
5111
- ir.length === 0 && ft(null);
5112
- }, [ir]);
5113
- let sr = s(!1);
5134
+ or.length === 0 && ft(null);
5135
+ }, [or]);
5136
+ let lr = s(!1);
5114
5137
  i(() => {
5115
- if (Ve(null), Ue(null), Ke(1), mt([]), sr.current = !1, !d) return;
5138
+ if (Ve(null), Ue(null), Ke(1), mt([]), lr.current = !1, !d) return;
5116
5139
  let e = d, t = !1, n = null;
5117
5140
  return (async () => {
5118
5141
  try {
5119
- V.current && Ut(V.current), Kt(), n = Be.getDocument({
5142
+ V.current && Wt(V.current), qt(), n = Be.getDocument({
5120
5143
  url: e,
5121
5144
  withCredentials: h,
5122
- ...qt()
5145
+ ...Jt()
5123
5146
  });
5124
5147
  let r = await n.promise;
5125
5148
  if (t) return;
@@ -5155,26 +5178,26 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5155
5178
  h,
5156
5179
  E
5157
5180
  ]);
5158
- let cr = n((e) => {
5159
- B.current.onPageRendered?.(e), !sr.current && (sr.current = !0, B.current.onFirstPageRendered?.(e));
5181
+ let ur = n((e) => {
5182
+ B.current.onPageRendered?.(e), !lr.current && (lr.current = !0, B.current.onFirstPageRendered?.(e));
5160
5183
  }, []);
5161
5184
  i(() => {
5162
5185
  L && B.current.onPageChange?.(R, L.numPages);
5163
5186
  }, [R, L]);
5164
- let lr = s(null), ur = s(void 0);
5187
+ let dr = s(null), fr = s(void 0);
5165
5188
  i(() => {
5166
5189
  let e = A ?? ve;
5167
- if (!L || !e || lr.current === L && ur.current === e || pt.length < Math.min(e, L.numPages)) return;
5168
- let t = lr.current !== L;
5169
- lr.current = L, ur.current = e;
5170
- let n = setTimeout(() => Gt(e, { smooth: !t }), 50);
5190
+ if (!L || !e || dr.current === L && fr.current === e || pt.length < Math.min(e, L.numPages)) return;
5191
+ let t = dr.current !== L;
5192
+ dr.current = L, fr.current = e;
5193
+ let n = setTimeout(() => tn(e, { smooth: !t }), 50);
5171
5194
  return () => clearTimeout(n);
5172
5195
  }, [
5173
5196
  L,
5174
5197
  A,
5175
5198
  ve,
5176
5199
  pt.length,
5177
- Gt
5200
+ tn
5178
5201
  ]), i(() => {
5179
5202
  if (!L) return;
5180
5203
  let e = !1, t = L;
@@ -5219,8 +5242,8 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5219
5242
  }
5220
5243
  if (!e && o) {
5221
5244
  let e = N.current;
5222
- if (e && e.scrollTop > 0 && It.current === "continuous") {
5223
- let t = Ht.current, n = Vt(At.current, (e) => a[e - 1] ?? i, jt.current, 16), r = Nt.current.tops[t] ?? 0, o = (n.tops[t] ?? 0) - r;
5245
+ if (e && e.scrollTop > 0 && Ut.current === "continuous") {
5246
+ let t = Gt.current, n = Vt(Nt.current, (e) => a[e - 1] ?? i, It.current, 16), r = Ht.current.tops[t] ?? 0, o = (n.tops[t] ?? 0) - r;
5224
5247
  o !== 0 && (e.scrollTop += o);
5225
5248
  }
5226
5249
  mt(a);
@@ -5229,79 +5252,84 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5229
5252
  e = !0;
5230
5253
  };
5231
5254
  }, [L, E]);
5232
- let dr = n((e) => {
5255
+ let pr = n((e) => {
5233
5256
  let t = H(R);
5234
5257
  if (!N.current || !t.width) return;
5235
- let n = N.current.clientWidth - 48, r = typeof e == "number" ? e : e?.ratio, i = typeof r == "number" && Number.isFinite(r) && r > 0 ? r : typeof Pn == "number" && !e ? Pn : 1;
5236
- if (Fn.current = {
5258
+ let n = N.current.clientWidth - 48, r = typeof e == "number" ? e : e?.ratio, i = typeof r == "number" && Number.isFinite(r) && r > 0 ? r : typeof In == "number" && !e ? In : 1;
5259
+ if (Q.current = {
5237
5260
  type: "fit-width",
5238
5261
  ratio: i
5239
5262
  }, n > 0 && t.width > 0) {
5240
5263
  let e = tt(n, t.width, i);
5241
- Mn.current = !0, N.current && (R === 1 || N.current.scrollTop <= 1) && (N.current.scrollTop = 0, N.current.scrollLeft = 0), ee(e);
5264
+ e === C ? Pn.current = !1 : (Pn.current = !0, ee(e)), N.current && (R === 1 || N.current.scrollTop <= 1) && (N.current.scrollTop = 0, N.current.scrollLeft = 0);
5242
5265
  }
5243
5266
  }, [
5244
5267
  H,
5245
5268
  R,
5269
+ C,
5246
5270
  ee,
5247
- Pn
5248
- ]), fr = n(() => {
5249
- Fn.current = { type: "fit-page" };
5271
+ In
5272
+ ]), mr = n(() => {
5273
+ Q.current = { type: "fit-page" };
5250
5274
  let e = H(R);
5251
5275
  if (!N.current || !e.width || !e.height) return;
5252
5276
  let t = N.current.clientWidth - 48, n = N.current.clientHeight - 48;
5253
5277
  if (t > 0 && n > 0 && e.width > 0 && e.height > 0) {
5254
5278
  let r = t / e.width, i = n / e.height, a = et(Math.min(r, i));
5255
- Mn.current = !0, N.current && (R === 1 || N.current.scrollTop <= 1) && (N.current.scrollTop = 0, N.current.scrollLeft = 0), ee(a);
5279
+ a === C ? Pn.current = !1 : (Pn.current = !0, ee(a)), N.current && (R === 1 || N.current.scrollTop <= 1) && (N.current.scrollTop = 0, N.current.scrollLeft = 0);
5256
5280
  }
5257
5281
  }, [
5258
5282
  H,
5259
5283
  R,
5284
+ C,
5260
5285
  ee
5261
5286
  ]);
5262
- Ge("action-fit-to-width", (e) => dr(e)), Ge("action-fit-to-page", () => fr()), i(() => {
5287
+ Ge("action-fit-to-width", (e) => pr(e)), Ge("action-fit-to-page", () => mr()), i(() => {
5263
5288
  if (De === !1) return;
5264
5289
  let e = N.current;
5265
5290
  if (!e || typeof ResizeObserver > "u") return;
5266
- let t = null, n = e.clientWidth, r = e.clientHeight, i = new ResizeObserver(() => {
5291
+ let t = null, n = e.clientWidth, r = e.clientHeight, i = () => {
5267
5292
  let i = e.clientWidth, a = e.clientHeight;
5268
- i <= 0 || a <= 0 || Math.abs(i - n) < 1 && Math.abs(a - r) < 1 || (n = i, r = a, Fn.current && (t && cancelAnimationFrame(t), t = requestAnimationFrame(() => {
5269
- let e = Fn.current;
5270
- e?.type === "fit-width" ? dr({ ratio: e.ratio }) : e?.type === "fit-page" && fr();
5293
+ i <= 0 || a <= 0 || Math.abs(i - n) < 1 && Math.abs(a - r) < 1 || (n = i, r = a, xt({
5294
+ width: i,
5295
+ height: a
5296
+ }), Q.current && (t && cancelAnimationFrame(t), t = requestAnimationFrame(() => {
5297
+ let e = Q.current;
5298
+ e?.type === "fit-width" ? pr({ ratio: e.ratio }) : e?.type === "fit-page" && mr();
5271
5299
  })));
5272
- });
5273
- return i.observe(e), () => {
5274
- i.disconnect(), t && cancelAnimationFrame(t);
5300
+ }, a = new ResizeObserver(i);
5301
+ return a.observe(e), window.addEventListener("resize", i), () => {
5302
+ a.disconnect(), window.removeEventListener("resize", i), t && cancelAnimationFrame(t);
5275
5303
  };
5276
5304
  }, [
5277
5305
  De,
5278
- dr,
5279
- fr
5306
+ pr,
5307
+ mr
5280
5308
  ]);
5281
- let pr = (e, t) => {
5309
+ let hr = (e, t) => {
5282
5310
  let n = e.currentTarget.getBoundingClientRect(), r = (e.clientX - n.left) / C, i = (e.clientY - n.top) / C, a = H(t);
5283
5311
  return Ot(r, i, E, E % 180 == 0 ? a.width : a.height, E % 180 == 0 ? a.height : a.width);
5284
- }, mr = (e, t) => {
5285
- if (!G) return;
5286
- let { x: n, y: r } = pr(e, t);
5287
- if (G === "text" || G === "note") {
5312
+ }, gr = (e, t) => {
5313
+ if (!W) return;
5314
+ let { x: n, y: r } = hr(e, t);
5315
+ if (W === "text" || W === "note") {
5288
5316
  e.preventDefault();
5289
5317
  return;
5290
5318
  }
5291
- if (G === "eraser") {
5292
- fn(!0);
5319
+ if (W === "eraser") {
5320
+ hn(!0);
5293
5321
  return;
5294
5322
  }
5295
- hn({
5323
+ vn({
5296
5324
  x: n,
5297
5325
  y: r
5298
- }), gn({
5326
+ }), yn({
5299
5327
  x: n,
5300
5328
  y: r
5301
- }), G === "freehand" ? (fn(!0), vn([{
5329
+ }), W === "freehand" ? (hn(!0), xn([{
5302
5330
  x: n,
5303
5331
  y: r
5304
- }]), mn(t)) : ([
5332
+ }]), _n(t)) : ([
5305
5333
  "rectangle",
5306
5334
  "ellipse",
5307
5335
  "line",
@@ -5311,46 +5339,46 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5311
5339
  "strikeout",
5312
5340
  "squiggly",
5313
5341
  "redaction"
5314
- ].includes(G) || ["callout", "link"].includes(G)) && (fn(!0), mn(t));
5315
- }, hr = () => {
5316
- if (X && bn.trim()) {
5317
- if (X.annId) Q(W.map((e) => e.id === X.annId ? {
5342
+ ].includes(W) || ["callout", "link"].includes(W)) && (hn(!0), _n(t));
5343
+ }, _r = () => {
5344
+ if (Y && Cn.trim()) {
5345
+ if (Y.annId) $(U.map((e) => e.id === Y.annId ? {
5318
5346
  ...e,
5319
- text: bn
5347
+ text: Cn
5320
5348
  } : e));
5321
5349
  else {
5322
- let e = Ft(), t = Math.max(160, Math.min(320, bn.length * 9 + 20)), n = bn.split("\n").length, r = Math.max(36, n * 22);
5323
- Q([...W, {
5350
+ let e = Ft(), t = Math.max(160, Math.min(320, Cn.length * 9 + 20)), n = Cn.split("\n").length, r = Math.max(36, n * 22);
5351
+ $([...U, {
5324
5352
  id: e,
5325
- type: X.type,
5326
- pageIndex: X.pageIndex,
5327
- x: X.x,
5328
- y: X.y,
5353
+ type: Y.type,
5354
+ pageIndex: Y.pageIndex,
5355
+ x: Y.x,
5356
+ y: Y.y,
5329
5357
  width: t,
5330
5358
  height: r,
5331
- text: bn,
5332
- points: X.points,
5333
- color: rn,
5334
- strokeWidth: on,
5335
- opacity: ln
5359
+ text: Cn,
5360
+ points: Y.points,
5361
+ color: sn,
5362
+ strokeWidth: un,
5363
+ opacity: fn
5336
5364
  }]);
5337
5365
  }
5338
5366
  }
5339
- yn(null), xn(""), G === "text" && K(null);
5340
- }, gr = (e, t) => {
5341
- if (!dn) return;
5342
- let { x: n, y: r } = pr(e, t);
5343
- gn({
5367
+ Sn(null), X(""), W === "text" && G(null);
5368
+ }, vr = (e, t) => {
5369
+ if (!mn) return;
5370
+ let { x: n, y: r } = hr(e, t);
5371
+ yn({
5344
5372
  x: n,
5345
5373
  y: r
5346
- }), G === "freehand" && vn((e) => [...e, {
5374
+ }), W === "freehand" && xn((e) => [...e, {
5347
5375
  x: n,
5348
5376
  y: r
5349
5377
  }]);
5350
- }, _r = (e, t) => {
5351
- if (G === "text" || G === "note" || G === "digital_signature" || G === "link") {
5352
- if (G === "link") {
5353
- let { x: n, y: r } = pr(e, t);
5378
+ }, yr = (e, t) => {
5379
+ if (W === "text" || W === "note" || W === "digital_signature" || W === "link") {
5380
+ if (W === "link") {
5381
+ let { x: n, y: r } = hr(e, t);
5354
5382
  if (j?.canAddAnnotations === !1) return;
5355
5383
  let i = Ft(), a = {
5356
5384
  id: i,
@@ -5367,63 +5395,63 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5367
5395
  opacity: 1,
5368
5396
  points: []
5369
5397
  };
5370
- Q([...W, a]), Cn(i), Dn(!0), K(null);
5398
+ $([...U, a]), Tn(i), kn(!0), G(null);
5371
5399
  return;
5372
5400
  }
5373
- if (G === "text" || G === "note") {
5374
- let { x: n, y: r } = pr(e, t);
5401
+ if (W === "text" || W === "note") {
5402
+ let { x: n, y: r } = hr(e, t);
5375
5403
  if (j?.canAddAnnotations === !1) return;
5376
- X && hr(), yn({
5404
+ Y && _r(), Sn({
5377
5405
  x: n,
5378
5406
  y: r,
5379
- type: G,
5407
+ type: W,
5380
5408
  pageIndex: t
5381
- }), xn("");
5409
+ }), X("");
5382
5410
  }
5383
5411
  return;
5384
5412
  }
5385
- if (dn && (fn(!1), mn(null), G)) {
5386
- if (G === "freehand") {
5387
- if (_n.length > 2) {
5388
- let e = _n.map((e) => e.x), n = _n.map((e) => e.y), r = Math.min(...e), i = Math.max(...e), a = Math.min(...n), o = Math.max(...n);
5389
- Q([...W, {
5413
+ if (mn && (hn(!1), _n(null), W)) {
5414
+ if (W === "freehand") {
5415
+ if (bn.length > 2) {
5416
+ let e = bn.map((e) => e.x), n = bn.map((e) => e.y), r = Math.min(...e), i = Math.max(...e), a = Math.min(...n), o = Math.max(...n);
5417
+ $([...U, {
5390
5418
  id: Ft(),
5391
- type: G,
5419
+ type: W,
5392
5420
  pageIndex: t,
5393
5421
  x: r,
5394
5422
  y: a,
5395
5423
  width: i - r,
5396
5424
  height: o - a,
5397
- points: [..._n],
5398
- strokes: [[..._n]],
5399
- color: rn,
5400
- strokeWidth: on,
5401
- opacity: ln
5425
+ points: [...bn],
5426
+ strokes: [[...bn]],
5427
+ color: sn,
5428
+ strokeWidth: un,
5429
+ opacity: fn
5402
5430
  }]);
5403
5431
  }
5404
- vn([]);
5432
+ xn([]);
5405
5433
  } else {
5406
- let e = Math.abs(Y.x - J.x), n = Math.abs(Y.y - J.y);
5434
+ let e = Math.abs(J.x - q.x), n = Math.abs(J.y - q.y);
5407
5435
  if (e > 5 || n > 5) {
5408
- let r = Math.min(J.x, Y.x), i = Math.min(J.y, Y.y), a = G === "line" || G === "arrow" || G === "callout" ? [J, Y] : void 0;
5436
+ let r = Math.min(q.x, J.x), i = Math.min(q.y, J.y), a = W === "line" || W === "arrow" || W === "callout" ? [q, J] : void 0;
5409
5437
  if ([
5410
5438
  "highlight",
5411
5439
  "underline",
5412
5440
  "strikeout",
5413
5441
  "squiggly",
5414
5442
  "redaction"
5415
- ].includes(G) && n < 18 && (n = Math.max(18, n), i = J.y - 9), G === "callout") {
5443
+ ].includes(W) && n < 18 && (n = Math.max(18, n), i = q.y - 9), W === "callout") {
5416
5444
  if (j?.canAddAnnotations === !1) return;
5417
- yn({
5418
- x: Y.x,
5419
- y: Y.y,
5445
+ Sn({
5446
+ x: J.x,
5447
+ y: J.y,
5420
5448
  type: "callout",
5421
5449
  points: a,
5422
5450
  pageIndex: t
5423
- }), xn("");
5451
+ }), X("");
5424
5452
  return;
5425
5453
  }
5426
- if (G === "redaction") {
5454
+ if (W === "redaction") {
5427
5455
  if (j?.canRedact === !1) return;
5428
5456
  Je((a) => [...a, {
5429
5457
  id: `manual-${Date.now()}-${Math.random().toString(36).substr(2, 6)}`,
@@ -5437,25 +5465,25 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5437
5465
  return;
5438
5466
  }
5439
5467
  if (j?.canAddAnnotations === !1) return;
5440
- Q([...W, {
5468
+ $([...U, {
5441
5469
  id: Ft(),
5442
- type: G,
5470
+ type: W,
5443
5471
  pageIndex: t,
5444
5472
  x: r,
5445
5473
  y: i,
5446
5474
  width: e,
5447
5475
  height: n,
5448
5476
  points: a,
5449
- color: rn,
5450
- strokeWidth: on,
5451
- opacity: ln
5477
+ color: sn,
5478
+ strokeWidth: un,
5479
+ opacity: fn
5452
5480
  }]);
5453
5481
  }
5454
5482
  }
5455
5483
  }
5456
- }, vr = (e) => {
5457
- G === "eraser" && dn && Q(W.filter((t) => t.id !== e));
5458
- }, yr = n(async (e, t, n) => {
5484
+ }, br = (e) => {
5485
+ W === "eraser" && mn && $(U.filter((t) => t.id !== e));
5486
+ }, xr = n(async (e, t, n) => {
5459
5487
  let r = lt(e), i = !1, a = {
5460
5488
  url: e,
5461
5489
  docUrl: r.docUrl,
@@ -5478,7 +5506,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5478
5506
  }
5479
5507
  if (i) return;
5480
5508
  if (r.isInternalPage && r.pageNumber) {
5481
- Gt(r.pageNumber);
5509
+ tn(r.pageNumber);
5482
5510
  return;
5483
5511
  }
5484
5512
  let o = r.docUrl, s = r.pageNumber;
@@ -5512,47 +5540,47 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5512
5540
  Oe,
5513
5541
  Me,
5514
5542
  Ae,
5515
- Gt
5543
+ tn
5516
5544
  ]);
5517
5545
  i(() => {
5518
5546
  Oe && ke !== void 0 && Oe.setTargetViewer(ke);
5519
5547
  }, [Oe, ke]), i(() => I.on("action-open-link", (e) => {
5520
- e?.url && yr(e.url);
5521
- }), [I, yr]);
5522
- let br = (e, t) => {
5523
- if (t.stopPropagation(), G === "eraser") {
5548
+ e?.url && xr(e.url);
5549
+ }), [I, xr]);
5550
+ let Sr = (e, t) => {
5551
+ if (t.stopPropagation(), W === "eraser") {
5524
5552
  if (j?.canDeleteAnnotations === !1) return;
5525
- Q(W.filter((t) => t.id !== e)), Z === e && (Cn(null), Tn(null));
5526
- } else if (G === null || G === "pan" || G === "select") {
5527
- let n = W.find((t) => t.id === e);
5553
+ $(U.filter((t) => t.id !== e)), Z === e && (Tn(null), Dn(null));
5554
+ } else if (W === null || W === "pan" || W === "select") {
5555
+ let n = U.find((t) => t.id === e);
5528
5556
  if (n && n.linkUrl && a === "View") {
5529
- yr(n.linkUrl, n, t);
5557
+ xr(n.linkUrl, n, t);
5530
5558
  return;
5531
5559
  }
5532
5560
  if (n && (n.type === "note" || n.type === "callout")) {
5533
5561
  if (j?.canEditAnnotations === !1 || !u.canEdit(n)) {
5534
- Cn(e);
5562
+ Tn(e);
5535
5563
  return;
5536
5564
  }
5537
- yn({
5565
+ Sn({
5538
5566
  x: n.x,
5539
5567
  y: n.y,
5540
5568
  type: n.type,
5541
5569
  annId: n.id,
5542
5570
  points: n.points,
5543
5571
  pageIndex: n.pageIndex
5544
- }), xn(n.text || ""), n.color && an(n.color);
5545
- } else if (n && n.type === "text") Cn(e);
5572
+ }), X(n.text || ""), n.color && ln(n.color);
5573
+ } else if (n && n.type === "text") Tn(e);
5546
5574
  else if (n && n.type === "link") {
5547
5575
  if (j?.canEditAnnotations === !1 || !u.canEdit(n)) {
5548
- Cn(e);
5576
+ Tn(e);
5549
5577
  return;
5550
5578
  }
5551
- Dn(!0);
5579
+ kn(!0);
5552
5580
  }
5553
- Cn(e);
5581
+ Tn(e);
5554
5582
  let r = N.current, i = r?.getBoundingClientRect();
5555
- i && r && Tn({
5583
+ i && r && Dn({
5556
5584
  top: t.clientY - i.top + r.scrollTop,
5557
5585
  left: t.clientX - i.left + r.scrollLeft
5558
5586
  });
@@ -5560,7 +5588,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5560
5588
  };
5561
5589
  return i(() => {
5562
5590
  if (L && N.current && T === "continuous") {
5563
- let e = gt.top + N.current.clientHeight / 2, t = Math.max(0, Math.min(Ct.length - 1, Wt(e))), n = Ct[t] ? Ct[t][0] : 1;
5591
+ let e = gt.top + N.current.clientHeight / 2, t = Math.max(0, Math.min(At.length - 1, Yt(e))), n = At[t] ? At[t][0] : 1;
5564
5592
  n !== R && Ke(n);
5565
5593
  }
5566
5594
  }, [
@@ -5568,9 +5596,9 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5568
5596
  C,
5569
5597
  L,
5570
5598
  R,
5571
- Wt,
5599
+ Yt,
5572
5600
  T,
5573
- Ct
5601
+ At
5574
5602
  ]), /* @__PURE__ */ F("div", {
5575
5603
  style: {
5576
5604
  flex: 1,
@@ -5584,7 +5612,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5584
5612
  isOpen: t,
5585
5613
  pdfDoc: L,
5586
5614
  pageNum: R,
5587
- setPageNum: (e) => Gt(e)
5615
+ setPageNum: (e) => tn(e)
5588
5616
  }),
5589
5617
  /* @__PURE__ */ F("div", {
5590
5618
  style: {
@@ -5597,7 +5625,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5597
5625
  overflow: "hidden"
5598
5626
  },
5599
5627
  children: [
5600
- z.isActive && /* @__PURE__ */ P(Zt, {
5628
+ z.isActive && /* @__PURE__ */ P(Qt, {
5601
5629
  compareState: z,
5602
5630
  onSetMode: (e) => Qe((t) => ({
5603
5631
  ...t,
@@ -5615,12 +5643,12 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5615
5643
  onPrevDiff: () => {
5616
5644
  if (z.diffItems.length === 0) return;
5617
5645
  let e = (z.currentDiffIndex - 1 + z.diffItems.length) % z.diffItems.length;
5618
- en(e);
5646
+ an(e);
5619
5647
  },
5620
5648
  onNextDiff: () => {
5621
5649
  if (z.diffItems.length === 0) return;
5622
5650
  let e = (z.currentDiffIndex + 1) % z.diffItems.length;
5623
- en(e);
5651
+ an(e);
5624
5652
  },
5625
5653
  onExit: () => {
5626
5654
  Qe((e) => ({
@@ -5640,16 +5668,16 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5640
5668
  height: "40px"
5641
5669
  },
5642
5670
  children: [
5643
- /* @__PURE__ */ P(q, {
5671
+ /* @__PURE__ */ P(K, {
5644
5672
  icon: /* @__PURE__ */ P(Re, { size: 16 }),
5645
5673
  disabled: !u.canUndo,
5646
- onClick: $,
5674
+ onClick: Ln,
5647
5675
  label: "Undo"
5648
5676
  }),
5649
- /* @__PURE__ */ P(q, {
5677
+ /* @__PURE__ */ P(K, {
5650
5678
  icon: /* @__PURE__ */ P(we, { size: 16 }),
5651
5679
  disabled: !u.canRedo,
5652
- onClick: In,
5680
+ onClick: Rn,
5653
5681
  label: "Redo"
5654
5682
  }),
5655
5683
  /* @__PURE__ */ P("div", { style: {
@@ -5658,59 +5686,59 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5658
5686
  backgroundColor: "var(--border-color)",
5659
5687
  margin: "0 4px"
5660
5688
  } }),
5661
- /* @__PURE__ */ P(q, {
5689
+ /* @__PURE__ */ P(K, {
5662
5690
  icon: /* @__PURE__ */ P(de, { size: 16 }),
5663
- active: G === "highlight",
5691
+ active: W === "highlight",
5664
5692
  onClick: () => {
5665
- K("highlight"), an("#fbc02d"), un(.5), cn(16);
5693
+ G("highlight"), ln("#fbc02d"), pn(.5), dn(16);
5666
5694
  },
5667
5695
  label: "Text Highlight"
5668
5696
  }),
5669
- /* @__PURE__ */ P(q, {
5697
+ /* @__PURE__ */ P(K, {
5670
5698
  icon: /* @__PURE__ */ P(Le, { size: 16 }),
5671
- active: G === "underline",
5699
+ active: W === "underline",
5672
5700
  onClick: () => {
5673
- K("underline"), an("#d32f2f"), un(1), cn(2);
5701
+ G("underline"), ln("#d32f2f"), pn(1), dn(2);
5674
5702
  },
5675
5703
  label: "Underline"
5676
5704
  }),
5677
- /* @__PURE__ */ P(q, {
5705
+ /* @__PURE__ */ P(K, {
5678
5706
  icon: /* @__PURE__ */ P(Pe, { size: 16 }),
5679
- active: G === "strikeout",
5707
+ active: W === "strikeout",
5680
5708
  onClick: () => {
5681
- K("strikeout"), an("#d32f2f"), un(1), cn(2);
5709
+ G("strikeout"), ln("#d32f2f"), pn(1), dn(2);
5682
5710
  },
5683
5711
  label: "Strikeout"
5684
5712
  }),
5685
- /* @__PURE__ */ P(q, {
5686
- icon: /* @__PURE__ */ P(sn, { size: 16 }),
5687
- active: G === "squiggly",
5713
+ /* @__PURE__ */ P(K, {
5714
+ icon: /* @__PURE__ */ P(cn, { size: 16 }),
5715
+ active: W === "squiggly",
5688
5716
  onClick: () => {
5689
- K("squiggly"), an("#388e3c"), un(1), cn(1.5);
5717
+ G("squiggly"), ln("#388e3c"), pn(1), dn(1.5);
5690
5718
  },
5691
5719
  label: "Squiggly"
5692
5720
  }),
5693
- /* @__PURE__ */ P(q, {
5721
+ /* @__PURE__ */ P(K, {
5694
5722
  icon: /* @__PURE__ */ P(m, { size: 16 }),
5695
- active: G === "freehand",
5723
+ active: W === "freehand",
5696
5724
  onClick: () => {
5697
- K("freehand"), an("#000000"), un(1), cn(2);
5725
+ G("freehand"), ln("#000000"), pn(1), dn(2);
5698
5726
  },
5699
5727
  label: "Marker"
5700
5728
  }),
5701
- /* @__PURE__ */ P(q, {
5729
+ /* @__PURE__ */ P(K, {
5702
5730
  icon: /* @__PURE__ */ P(Ie, { size: 16 }),
5703
- active: G === "text",
5731
+ active: W === "text",
5704
5732
  onClick: () => {
5705
- K("text"), an("#000000"), un(1);
5733
+ G("text"), ln("#000000"), pn(1);
5706
5734
  },
5707
5735
  label: "Text"
5708
5736
  }),
5709
- j?.canRedact !== !1 && /* @__PURE__ */ P(q, {
5737
+ j?.canRedact !== !1 && /* @__PURE__ */ P(K, {
5710
5738
  icon: /* @__PURE__ */ P(ae, { size: 16 }),
5711
- active: G === "redaction",
5739
+ active: W === "redaction",
5712
5740
  onClick: () => {
5713
- K("redaction"), an("#000000"), un(1);
5741
+ G("redaction"), ln("#000000"), pn(1);
5714
5742
  },
5715
5743
  label: "Redact"
5716
5744
  }),
@@ -5727,11 +5755,11 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5727
5755
  borderRight: "1px solid var(--border-color)",
5728
5756
  paddingRight: "8px"
5729
5757
  },
5730
- children: /* @__PURE__ */ P(q, {
5758
+ children: /* @__PURE__ */ P(K, {
5731
5759
  icon: /* @__PURE__ */ P(O, { size: 16 }),
5732
- active: G === "callout",
5760
+ active: W === "callout",
5733
5761
  onClick: () => {
5734
- K("callout"), un(1), cn(2);
5762
+ G("callout"), pn(1), dn(2);
5735
5763
  },
5736
5764
  label: "Callout"
5737
5765
  })
@@ -5741,17 +5769,17 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5741
5769
  display: "flex",
5742
5770
  gap: "4px"
5743
5771
  },
5744
- children: [/* @__PURE__ */ P(q, {
5772
+ children: [/* @__PURE__ */ P(K, {
5745
5773
  icon: /* @__PURE__ */ P(xe, { size: 16 }),
5746
- active: G === "freehand" && ln === 1,
5774
+ active: W === "freehand" && fn === 1,
5747
5775
  onClick: () => {
5748
- K("freehand"), un(1), cn(2);
5776
+ G("freehand"), pn(1), dn(2);
5749
5777
  },
5750
5778
  label: "Freehand"
5751
- }), j?.canDeleteAnnotations !== !1 && /* @__PURE__ */ P(q, {
5779
+ }), j?.canDeleteAnnotations !== !1 && /* @__PURE__ */ P(K, {
5752
5780
  icon: /* @__PURE__ */ P(re, { size: 16 }),
5753
- active: G === "eraser",
5754
- onClick: () => K("eraser"),
5781
+ active: W === "eraser",
5782
+ onClick: () => G("eraser"),
5755
5783
  label: "Eraser"
5756
5784
  })]
5757
5785
  }),
@@ -5767,34 +5795,34 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5767
5795
  gap: "4px"
5768
5796
  },
5769
5797
  children: [
5770
- /* @__PURE__ */ P(q, {
5798
+ /* @__PURE__ */ P(K, {
5771
5799
  icon: /* @__PURE__ */ P(k, { size: 16 }),
5772
- active: G === "line",
5773
- onClick: () => K("line"),
5800
+ active: W === "line",
5801
+ onClick: () => G("line"),
5774
5802
  label: "Line"
5775
5803
  }),
5776
- /* @__PURE__ */ P(q, {
5804
+ /* @__PURE__ */ P(K, {
5777
5805
  icon: /* @__PURE__ */ P(f, { size: 16 }),
5778
- active: G === "arrow",
5779
- onClick: () => K("arrow"),
5806
+ active: W === "arrow",
5807
+ onClick: () => G("arrow"),
5780
5808
  label: "Arrow"
5781
5809
  }),
5782
- /* @__PURE__ */ P(q, {
5810
+ /* @__PURE__ */ P(K, {
5783
5811
  icon: /* @__PURE__ */ P(Ne, { size: 16 }),
5784
- active: G === "rectangle",
5785
- onClick: () => K("rectangle"),
5812
+ active: W === "rectangle",
5813
+ onClick: () => G("rectangle"),
5786
5814
  label: "Rectangle"
5787
5815
  }),
5788
- /* @__PURE__ */ P(q, {
5816
+ /* @__PURE__ */ P(K, {
5789
5817
  icon: /* @__PURE__ */ P(S, { size: 16 }),
5790
- active: G === "ellipse",
5791
- onClick: () => K("ellipse"),
5818
+ active: W === "ellipse",
5819
+ onClick: () => G("ellipse"),
5792
5820
  label: "Ellipse"
5793
5821
  }),
5794
- /* @__PURE__ */ P(q, {
5822
+ /* @__PURE__ */ P(K, {
5795
5823
  icon: /* @__PURE__ */ P(pe, { size: 16 }),
5796
- active: G === "link",
5797
- onClick: () => K("link"),
5824
+ active: W === "link",
5825
+ onClick: () => G("link"),
5798
5826
  label: "Link"
5799
5827
  })
5800
5828
  ]
@@ -5817,7 +5845,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5817
5845
  "underline",
5818
5846
  "strikeout",
5819
5847
  "squiggly"
5820
- ].includes(G || "") && /* @__PURE__ */ F("div", {
5848
+ ].includes(W || "") && /* @__PURE__ */ F("div", {
5821
5849
  style: {
5822
5850
  display: "flex",
5823
5851
  alignItems: "center",
@@ -5831,16 +5859,16 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5831
5859
  color: "#666",
5832
5860
  minWidth: "85px"
5833
5861
  },
5834
- children: ["Thickness: ", /* @__PURE__ */ F("strong", { children: [on, "px"] })]
5862
+ children: ["Thickness: ", /* @__PURE__ */ F("strong", { children: [un, "px"] })]
5835
5863
  }), /* @__PURE__ */ P("input", {
5836
5864
  type: "range",
5837
5865
  min: "1",
5838
5866
  max: "24",
5839
- value: Math.min(24, Math.max(1, on)),
5867
+ value: Math.min(24, Math.max(1, un)),
5840
5868
  onMouseDown: (e) => e.stopPropagation(),
5841
5869
  onChange: (e) => {
5842
5870
  let t = parseInt(e.target.value, 10);
5843
- cn(t), Z && !X && Q(W.map((e) => e.id === Z ? {
5871
+ dn(t), Z && !Y && $(U.map((e) => e.id === Z ? {
5844
5872
  ...e,
5845
5873
  strokeWidth: t
5846
5874
  } : e));
@@ -5867,7 +5895,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5867
5895
  ].map((e) => /* @__PURE__ */ P("button", {
5868
5896
  onMouseDown: (e) => e.preventDefault(),
5869
5897
  onClick: () => {
5870
- an(e), Z && !X && Q(W.map((t) => t.id === Z ? {
5898
+ ln(e), Z && !Y && $(U.map((t) => t.id === Z ? {
5871
5899
  ...t,
5872
5900
  color: e
5873
5901
  } : t));
@@ -5877,14 +5905,14 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5877
5905
  height: "18px",
5878
5906
  borderRadius: "50%",
5879
5907
  backgroundColor: e,
5880
- border: rn === e ? "2px solid #000" : "1px solid transparent",
5908
+ border: sn === e ? "2px solid #000" : "1px solid transparent",
5881
5909
  cursor: "pointer",
5882
5910
  outline: "none",
5883
5911
  padding: 0
5884
5912
  }
5885
5913
  }, e))
5886
5914
  }),
5887
- er > 0 && /* @__PURE__ */ F("div", {
5915
+ nr > 0 && /* @__PURE__ */ F("div", {
5888
5916
  style: {
5889
5917
  display: "flex",
5890
5918
  alignItems: "center",
@@ -5892,7 +5920,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5892
5920
  marginLeft: "8px"
5893
5921
  },
5894
5922
  children: [/* @__PURE__ */ F("button", {
5895
- onClick: () => Qn(!0),
5923
+ onClick: () => er(!0),
5896
5924
  style: {
5897
5925
  display: "flex",
5898
5926
  alignItems: "center",
@@ -5911,11 +5939,11 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5911
5939
  children: [
5912
5940
  /* @__PURE__ */ P(je, { size: 16 }),
5913
5941
  "Apply Redactions (",
5914
- er,
5942
+ nr,
5915
5943
  ")"
5916
5944
  ]
5917
5945
  }), /* @__PURE__ */ F("button", {
5918
- onClick: tr,
5946
+ onClick: rr,
5919
5947
  style: {
5920
5948
  display: "flex",
5921
5949
  alignItems: "center",
@@ -5940,7 +5968,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5940
5968
  })
5941
5969
  ]
5942
5970
  }),
5943
- Zn && /* @__PURE__ */ P("div", {
5971
+ $n && /* @__PURE__ */ P("div", {
5944
5972
  style: {
5945
5973
  position: "fixed",
5946
5974
  top: 0,
@@ -6008,7 +6036,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6008
6036
  },
6009
6037
  children: [
6010
6038
  "You are about to permanently apply ",
6011
- /* @__PURE__ */ F("strong", { children: [er, " redaction(s)"] }),
6039
+ /* @__PURE__ */ F("strong", { children: [nr, " redaction(s)"] }),
6012
6040
  ". Marked areas will be blacked out and underlying text will be permanently removed. This action cannot be undone."
6013
6041
  ]
6014
6042
  }),
@@ -6020,7 +6048,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6020
6048
  },
6021
6049
  children: [
6022
6050
  /* @__PURE__ */ P("button", {
6023
- onClick: () => Qn(!1),
6051
+ onClick: () => er(!1),
6024
6052
  style: {
6025
6053
  padding: "8px 14px",
6026
6054
  borderRadius: "6px",
@@ -6035,7 +6063,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6035
6063
  }),
6036
6064
  /* @__PURE__ */ P("button", {
6037
6065
  onClick: () => {
6038
- tr(), Qn(!1);
6066
+ rr(), er(!1);
6039
6067
  },
6040
6068
  style: {
6041
6069
  padding: "8px 14px",
@@ -6054,7 +6082,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6054
6082
  let e = qe.map((e) => ({
6055
6083
  ...e,
6056
6084
  status: "applied"
6057
- })), t = Yn.map((e) => ({
6085
+ })), t = Zn.map((e) => ({
6058
6086
  ...e,
6059
6087
  status: "applied"
6060
6088
  })), n = [
@@ -6065,7 +6093,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6065
6093
  ...t,
6066
6094
  ...e
6067
6095
  ].filter((e) => e.status === "applied");
6068
- Je(e), Xn(t), Qn(!1), B.current.onRedactionsApplied?.(n);
6096
+ Je(e), Qn(t), er(!1), B.current.onRedactionsApplied?.(n);
6069
6097
  },
6070
6098
  style: {
6071
6099
  padding: "8px 14px",
@@ -6096,7 +6124,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6096
6124
  overflow: "hidden",
6097
6125
  position: "relative"
6098
6126
  },
6099
- children: [z.isActive && z.mode === "side-by-side" ? /* @__PURE__ */ P(Xt, {
6127
+ children: [z.isActive && z.mode === "side-by-side" ? /* @__PURE__ */ P(Zt, {
6100
6128
  pdfDocA: L,
6101
6129
  pdfDocB: Xe,
6102
6130
  pageNum: R,
@@ -6104,20 +6132,20 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6104
6132
  rotation: E,
6105
6133
  basePageDims: H(R),
6106
6134
  activeTab: a,
6107
- activeTool: G,
6108
- annotations: W,
6135
+ activeTool: W,
6136
+ annotations: U,
6109
6137
  permissions: j,
6110
6138
  watermark: ge,
6111
6139
  watermarkText: D,
6112
- redactions: $n,
6140
+ redactions: tr,
6113
6141
  diffsA: z.pageDiffsA?.[R] || [],
6114
6142
  diffsB: z.pageDiffsB?.[R] || [],
6115
6143
  selectedDiffId: z.diffItems[z.currentDiffIndex]?.id,
6116
6144
  onSelectDiff: (e) => {
6117
6145
  let t = z.diffItems.findIndex((t) => t.id === e);
6118
- t !== -1 && en(t);
6146
+ t !== -1 && an(t);
6119
6147
  }
6120
- }) : /* @__PURE__ */ F(ze, { children: [G === "highlight" && /* @__PURE__ */ P("style", { children: "\n .pdf-viewer-area, .pdf-viewer-area * {\n cursor: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTkgMTFsLTYgNnYzaDlsMy0zIi8+PHBhdGggZD0iTTIyIDEybC00LjYgNC42YTIgMiAwIDAgMS0yLjggMGwtNS4yLTUuMmEyIDIgMCAwIDEgMC0yLjhMMTQgNCIvPjwvc3ZnPg==') 0 24, auto !important;\n }\n " }), /* @__PURE__ */ F("div", {
6148
+ }) : /* @__PURE__ */ F(ze, { children: [W === "highlight" && /* @__PURE__ */ P("style", { children: "\n .pdf-viewer-area, .pdf-viewer-area * {\n cursor: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTkgMTFsLTYgNnYzaDlsMy0zIi8+PHBhdGggZD0iTTIyIDEybC00LjYgNC42YTIgMiAwIDAgMS0yLjggMGwtNS4yLTUuMmEyIDIgMCAwIDEgMC0yLjhMMTQgNCIvPjwvc3ZnPg==') 0 24, auto !important;\n }\n " }), /* @__PURE__ */ F("div", {
6121
6149
  className: "pdf-viewer-area",
6122
6150
  style: {
6123
6151
  flex: 1,
@@ -6128,16 +6156,16 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6128
6156
  overflow: "hidden",
6129
6157
  position: "relative",
6130
6158
  backgroundColor: "var(--bg-color)",
6131
- cursor: bt ? "grabbing" : G === "pan" ? "grab" : G === "eraser" ? "cell" : G === "select" || G === null ? "default" : "crosshair"
6159
+ cursor: St ? "grabbing" : W === "pan" ? "grab" : W === "eraser" ? "cell" : W === "select" || W === null ? "default" : "crosshair"
6132
6160
  },
6133
6161
  onMouseMove: (e) => {
6134
- if (bt && St.current && N.current) {
6135
- let t = e.clientX - St.current.x, n = e.clientY - St.current.y;
6136
- N.current.scrollLeft = St.current.scrollLeft - t, N.current.scrollTop = St.current.scrollTop - n;
6162
+ if (St && Et.current && N.current) {
6163
+ let t = e.clientX - Et.current.x, n = e.clientY - Et.current.y;
6164
+ N.current.scrollLeft = Et.current.scrollLeft - t, N.current.scrollTop = Et.current.scrollTop - n;
6137
6165
  }
6138
6166
  },
6139
6167
  onMouseLeave: () => {
6140
- bt && (xt(!1), St.current = null);
6168
+ St && (Ct(!1), Et.current = null);
6141
6169
  },
6142
6170
  children: [
6143
6171
  /* @__PURE__ */ P("div", {
@@ -6146,10 +6174,10 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6146
6174
  vt({
6147
6175
  top: e.currentTarget.scrollTop,
6148
6176
  left: e.currentTarget.scrollLeft
6149
- }), Ht.current = Wt(e.currentTarget.scrollTop);
6177
+ }), Gt.current = Yt(e.currentTarget.scrollTop);
6150
6178
  },
6151
6179
  onMouseDown: (e) => {
6152
- G === "pan" && e.button === 0 && (xt(!0), St.current = {
6180
+ W === "pan" && e.button === 0 && (Ct(!0), Et.current = {
6153
6181
  x: e.clientX,
6154
6182
  y: e.clientY,
6155
6183
  scrollLeft: e.currentTarget.scrollLeft,
@@ -6157,7 +6185,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6157
6185
  });
6158
6186
  },
6159
6187
  onMouseUp: (e) => {
6160
- bt && (xt(!1), St.current = null);
6188
+ St && (Ct(!1), Et.current = null);
6161
6189
  },
6162
6190
  onContextMenu: (e) => {
6163
6191
  typeof window < "u" && window.getSelection()?.toString().trim() || (e.preventDefault(), e.stopPropagation());
@@ -6170,51 +6198,51 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6170
6198
  },
6171
6199
  children: (() => {
6172
6200
  let t = (t, n, r) => {
6173
- let i = r ? Et.tops[n] ?? 0 : 0;
6201
+ let i = r ? jt.tops[n] ?? 0 : 0;
6174
6202
  if (r && N.current) {
6175
6203
  let e = C >= 4 ? 1 : C >= 2 ? 2 : 4, t = C >= 4 ? 1 : C >= 2 ? 2 : 5;
6176
- if (n < Ht.current - e || n > Ht.current + t) return null;
6204
+ if (n < Gt.current - e || n > Gt.current + t) return null;
6177
6205
  }
6178
- let o = dn && pn && G && G !== "eraser" ? (() => {
6179
- if (G === "freehand") return {
6206
+ let o = mn && gn && W && W !== "eraser" ? (() => {
6207
+ if (W === "freehand") return {
6180
6208
  id: "temp-live-drawing",
6181
6209
  type: "freehand",
6182
- pageIndex: pn,
6210
+ pageIndex: gn,
6183
6211
  x: 0,
6184
6212
  y: 0,
6185
6213
  width: 0,
6186
6214
  height: 0,
6187
- points: _n,
6188
- color: rn,
6189
- strokeWidth: on,
6190
- opacity: ln
6215
+ points: bn,
6216
+ color: sn,
6217
+ strokeWidth: un,
6218
+ opacity: fn
6191
6219
  };
6192
6220
  if ([
6193
6221
  "highlight",
6194
6222
  "underline",
6195
6223
  "strikeout",
6196
6224
  "squiggly"
6197
- ].includes(G)) {
6198
- let e = Math.abs(Y.x - J.x), t = Math.abs(Y.y - J.y), n = Math.min(J.x, Y.x), r = Math.min(J.y, Y.y);
6199
- return t < 18 && (t = Math.max(18, t), r = J.y - 9), {
6225
+ ].includes(W)) {
6226
+ let e = Math.abs(J.x - q.x), t = Math.abs(J.y - q.y), n = Math.min(q.x, J.x), r = Math.min(q.y, J.y);
6227
+ return t < 18 && (t = Math.max(18, t), r = q.y - 9), {
6200
6228
  id: "temp-live-drawing",
6201
- type: G,
6202
- pageIndex: pn,
6229
+ type: W,
6230
+ pageIndex: gn,
6203
6231
  x: n,
6204
6232
  y: r,
6205
6233
  width: e,
6206
6234
  height: t,
6207
- color: rn,
6208
- strokeWidth: on,
6209
- opacity: G === "highlight" ? ln : 1
6235
+ color: sn,
6236
+ strokeWidth: un,
6237
+ opacity: W === "highlight" ? fn : 1
6210
6238
  };
6211
6239
  }
6212
- if (G === "redaction") {
6213
- let e = Math.abs(Y.x - J.x), t = Math.abs(Y.y - J.y), n = Math.min(J.x, Y.x), r = Math.min(J.y, Y.y);
6214
- return t < 18 && (t = Math.max(18, t), r = J.y - 9), {
6240
+ if (W === "redaction") {
6241
+ let e = Math.abs(J.x - q.x), t = Math.abs(J.y - q.y), n = Math.min(q.x, J.x), r = Math.min(q.y, J.y);
6242
+ return t < 18 && (t = Math.max(18, t), r = q.y - 9), {
6215
6243
  id: "temp-live-drawing",
6216
6244
  type: "rectangle",
6217
- pageIndex: pn,
6245
+ pageIndex: gn,
6218
6246
  x: n,
6219
6247
  y: r,
6220
6248
  width: e,
@@ -6231,77 +6259,77 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6231
6259
  "rectangle",
6232
6260
  "ellipse",
6233
6261
  "link"
6234
- ].includes(G)) {
6235
- let e = Math.abs(Y.x - J.x), t = Math.abs(Y.y - J.y), n = Math.min(J.x, Y.x), r = Math.min(J.y, Y.y);
6262
+ ].includes(W)) {
6263
+ let e = Math.abs(J.x - q.x), t = Math.abs(J.y - q.y), n = Math.min(q.x, J.x), r = Math.min(q.y, J.y);
6236
6264
  return {
6237
6265
  id: "temp-live-drawing",
6238
- type: G,
6239
- pageIndex: pn,
6266
+ type: W,
6267
+ pageIndex: gn,
6240
6268
  x: n,
6241
6269
  y: r,
6242
6270
  width: e,
6243
6271
  height: t,
6244
- points: G === "line" || G === "arrow" || G === "callout" ? [J, Y] : void 0,
6245
- color: rn,
6246
- strokeWidth: on,
6247
- opacity: ln
6272
+ points: W === "line" || W === "arrow" || W === "callout" ? [q, J] : void 0,
6273
+ color: sn,
6274
+ strokeWidth: un,
6275
+ opacity: fn
6248
6276
  };
6249
6277
  }
6250
6278
  })() : null;
6251
6279
  return t.map((n, r) => {
6252
- let s, c = N.current?.clientWidth || 0, l = H(n), u = H(t[0]).width * C, d = l.width * C;
6253
- t.length === 2 ? (r === 0 && (s = Math.max(0, c / 2 - u)), r === 1 && (s = Math.max(u, c / 2))) : s = Math.max(0, c / 2 - d / 2);
6254
- let f = W.map((e) => Ln && e.id === Ln.id ? Ln : zn && e.id === zn.id ? zn : e), p = o && o.pageIndex === n ? [...f, o] : f;
6280
+ let s, c = bt.width || N.current?.clientWidth || 0, l = bt.height || N.current?.clientHeight || 0, u = H(n), d = H(t[0]).width * C, f = u.width * C;
6281
+ t.length === 2 ? (r === 0 && (s = Math.max(0, c / 2 - d)), r === 1 && (s = Math.max(d, c / 2))) : s = Math.max(0, c / 2 - f / 2);
6282
+ let p = U.map((e) => zn && e.id === zn.id ? zn : Vn && e.id === Vn.id ? Vn : e), m = o && o.pageIndex === n ? [...p, o] : p;
6255
6283
  return /* @__PURE__ */ F(e.Fragment, { children: [
6256
6284
  /* @__PURE__ */ P(Pt, {
6257
6285
  pageNum: n,
6258
6286
  pdfDoc: L,
6259
6287
  scale: C,
6260
6288
  rotation: E,
6261
- containerWidth: N.current?.clientWidth || 0,
6262
- containerHeight: N.current?.clientHeight || 0,
6289
+ containerWidth: c,
6290
+ containerHeight: l,
6263
6291
  scrollTop: gt.top,
6264
6292
  scrollLeft: gt.left,
6265
6293
  pageTop: i,
6266
6294
  pageLeft: s,
6267
- basePageWidth: l.width,
6268
- basePageHeight: l.height,
6295
+ basePageWidth: u.width,
6296
+ basePageHeight: u.height,
6269
6297
  activeTab: a,
6270
- activeTool: G,
6271
- annotations: p,
6298
+ activeTool: W,
6299
+ annotations: m,
6272
6300
  transientHighlights: ye?.filter((e) => e.pageIndex === n) || [],
6273
6301
  selectedAnnotationId: Z,
6274
6302
  activeSearchResult: dt,
6275
- onMouseDown: mr,
6276
- onMouseMove: gr,
6277
- onMouseUp: _r,
6278
- onAnnotationClick: br,
6279
- onAnnotationDoubleClick: qn,
6280
- onStartResize: Gn,
6281
- onStartMove: Kn,
6282
- onAnnotationMouseEnter: vr,
6303
+ onMouseDown: gr,
6304
+ onMouseMove: vr,
6305
+ onMouseUp: yr,
6306
+ onAnnotationClick: Sr,
6307
+ onAnnotationDoubleClick: Yn,
6308
+ onStartResize: qn,
6309
+ onStartMove: Jn,
6310
+ onAnnotationMouseEnter: br,
6283
6311
  onClearSelection: () => {
6284
- if (On.current || En) {
6285
- On.current = !1;
6312
+ if (An.current || On) {
6313
+ An.current = !1;
6286
6314
  return;
6287
6315
  }
6288
- Cn(null), Tn(null);
6316
+ Tn(null), Dn(null);
6289
6317
  },
6290
6318
  watermark: ge,
6291
6319
  watermarkText: D,
6292
- redactions: $n,
6293
- onDiscardRedaction: nr,
6294
- onRendered: cr,
6320
+ redactions: tr,
6321
+ onDiscardRedaction: ir,
6322
+ onRendered: ur,
6295
6323
  hideAnnotationsUntilPageRendered: be,
6296
- onLinkClick: yr
6324
+ onLinkClick: xr
6297
6325
  }),
6298
6326
  z.isActive && z.mode === "overlay" && Xe && /* @__PURE__ */ P("div", {
6299
6327
  style: {
6300
6328
  position: "absolute",
6301
6329
  top: `${i}px`,
6302
6330
  left: s === void 0 ? "0px" : `${s}px`,
6303
- width: `${l.width * C}px`,
6304
- height: `${l.height * C}px`,
6331
+ width: `${u.width * C}px`,
6332
+ height: `${u.height * C}px`,
6305
6333
  pointerEvents: "none",
6306
6334
  mixBlendMode: z.blendMode,
6307
6335
  opacity: z.opacityB,
@@ -6313,14 +6341,14 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6313
6341
  pdfDoc: Xe,
6314
6342
  scale: C,
6315
6343
  rotation: E,
6316
- containerWidth: N.current?.clientWidth || 0,
6317
- containerHeight: N.current?.clientHeight || 0,
6344
+ containerWidth: c,
6345
+ containerHeight: l,
6318
6346
  scrollTop: gt.top,
6319
6347
  scrollLeft: gt.left,
6320
6348
  pageTop: 0,
6321
6349
  pageLeft: 0,
6322
- basePageWidth: l.width,
6323
- basePageHeight: l.height,
6350
+ basePageWidth: u.width,
6351
+ basePageHeight: u.height,
6324
6352
  activeTab: a,
6325
6353
  activeTool: null,
6326
6354
  annotations: [],
@@ -6339,23 +6367,23 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6339
6367
  position: "absolute",
6340
6368
  top: `${i}px`,
6341
6369
  left: s === void 0 ? "0px" : `${s}px`,
6342
- width: `${l.width * C}px`,
6343
- height: `${l.height * C}px`,
6370
+ width: `${u.width * C}px`,
6371
+ height: `${u.height * C}px`,
6344
6372
  pointerEvents: "none",
6345
6373
  zIndex: 16
6346
6374
  },
6347
- children: /* @__PURE__ */ P(Yt, {
6375
+ children: /* @__PURE__ */ P(Xt, {
6348
6376
  boxes: [...z.pageDiffsA?.[n] || [], ...z.pageDiffsB?.[n] || []],
6349
6377
  scale: C,
6350
6378
  selectedDiffId: z.diffItems[z.currentDiffIndex]?.id,
6351
6379
  onSelectDiff: (e) => {
6352
6380
  let t = z.diffItems.findIndex((t) => t.id === e);
6353
- t !== -1 && en(t);
6381
+ t !== -1 && an(t);
6354
6382
  }
6355
6383
  })
6356
6384
  }),
6357
- X && X.pageIndex === n && (() => {
6358
- let e = E % 180 == 0 ? l.width : l.height, t = E % 180 == 0 ? l.height : l.width, n = kt(X.x, X.y, E, e, t);
6385
+ Y && Y.pageIndex === n && (() => {
6386
+ let e = E % 180 == 0 ? u.width : u.height, t = E % 180 == 0 ? u.height : u.width, n = kt(Y.x, Y.y, E, e, t);
6359
6387
  return /* @__PURE__ */ F("div", {
6360
6388
  style: {
6361
6389
  position: "absolute",
@@ -6369,19 +6397,19 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6369
6397
  flexDirection: "column"
6370
6398
  },
6371
6399
  children: [/* @__PURE__ */ P("textarea", {
6372
- ref: Sn,
6373
- value: bn,
6374
- onChange: (e) => xn(e.target.value),
6400
+ ref: wn,
6401
+ value: Cn,
6402
+ onChange: (e) => X(e.target.value),
6375
6403
  onBlur: (e) => {
6376
- e.currentTarget.parentElement?.contains(e.relatedTarget) || hr();
6404
+ e.currentTarget.parentElement?.contains(e.relatedTarget) || _r();
6377
6405
  },
6378
6406
  onKeyDown: (e) => {
6379
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), hr());
6407
+ e.key === "Enter" && !e.shiftKey && (e.preventDefault(), _r());
6380
6408
  },
6381
6409
  style: {
6382
6410
  backgroundColor: "transparent",
6383
6411
  border: "none",
6384
- color: rn,
6412
+ color: sn,
6385
6413
  fontSize: "16px",
6386
6414
  fontFamily: "sans-serif",
6387
6415
  minWidth: "150px",
@@ -6390,7 +6418,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6390
6418
  resize: "both",
6391
6419
  padding: "8px"
6392
6420
  },
6393
- placeholder: X.type === "note" ? "Note text..." : "Type text...",
6421
+ placeholder: Y.type === "note" ? "Note text..." : "Type text...",
6394
6422
  autoFocus: !0
6395
6423
  }), /* @__PURE__ */ P("div", {
6396
6424
  style: {
@@ -6401,7 +6429,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6401
6429
  },
6402
6430
  children: /* @__PURE__ */ P("button", {
6403
6431
  onMouseDown: (e) => {
6404
- e.preventDefault(), hr();
6432
+ e.preventDefault(), _r();
6405
6433
  },
6406
6434
  style: {
6407
6435
  padding: "4px 12px",
@@ -6424,17 +6452,17 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6424
6452
  style: {
6425
6453
  position: "relative",
6426
6454
  width: "100%",
6427
- height: `${Et.total}px`
6455
+ height: `${jt.total}px`
6428
6456
  },
6429
- children: Ct.map((e, n) => t(e, n, !0))
6457
+ children: At.map((e, n) => t(e, n, !0))
6430
6458
  });
6431
6459
  {
6432
- let e = Math.max(0, Ct.findIndex((e) => e.includes(R))), n = Ct[e] || [];
6460
+ let e = Math.max(0, At.findIndex((e) => e.includes(R))), n = At[e] || [];
6433
6461
  return /* @__PURE__ */ P("div", {
6434
6462
  style: {
6435
6463
  position: "relative",
6436
6464
  width: "100%",
6437
- minHeight: `${Et.heights[e] ?? 0}px`
6465
+ minHeight: `${jt.heights[e] ?? 0}px`
6438
6466
  },
6439
6467
  children: t(n, e, !1)
6440
6468
  });
@@ -6548,7 +6576,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6548
6576
  },
6549
6577
  children: [
6550
6578
  /* @__PURE__ */ P("button", {
6551
- onClick: () => Gt(Math.max(1, R - 1)),
6579
+ onClick: () => tn(Math.max(1, R - 1)),
6552
6580
  disabled: R <= 1,
6553
6581
  style: {
6554
6582
  background: "none",
@@ -6575,7 +6603,7 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6575
6603
  ]
6576
6604
  }),
6577
6605
  /* @__PURE__ */ P("button", {
6578
- onClick: () => Gt(Math.min(L.numPages, R + 1)),
6606
+ onClick: () => tn(Math.min(L.numPages, R + 1)),
6579
6607
  disabled: R >= L.numPages,
6580
6608
  style: {
6581
6609
  background: "none",
@@ -6589,11 +6617,11 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6589
6617
  })
6590
6618
  ]
6591
6619
  }),
6592
- Z && wn && /* @__PURE__ */ P(ot, {
6593
- annotation: W.find((e) => e.id === Z),
6594
- position: wn,
6620
+ Z && En && /* @__PURE__ */ P(ot, {
6621
+ annotation: U.find((e) => e.id === Z),
6622
+ position: En,
6595
6623
  onCopy: () => {
6596
- let e = W.find((e) => e.id === Z);
6624
+ let e = U.find((e) => e.id === Z);
6597
6625
  if (e) {
6598
6626
  let t = {
6599
6627
  ...e,
@@ -6607,25 +6635,25 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6607
6635
  x: e.x + 20,
6608
6636
  y: e.y + 20
6609
6637
  };
6610
- Q([...W, t]);
6638
+ $([...U, t]);
6611
6639
  }
6612
- Cn(null), Tn(null);
6640
+ Tn(null), Dn(null);
6613
6641
  },
6614
6642
  onDelete: () => {
6615
- Q(W.filter((e) => e.id !== Z)), Cn(null), Tn(null);
6643
+ $(U.filter((e) => e.id !== Z)), Tn(null), Dn(null);
6616
6644
  },
6617
6645
  onUpdateColor: (e) => {
6618
- Q(W.map((t) => t.id === Z ? {
6646
+ $(U.map((t) => t.id === Z ? {
6619
6647
  ...t,
6620
6648
  color: e
6621
6649
  } : t));
6622
6650
  },
6623
6651
  onOpenLinkModal: () => {
6624
- Dn(!0), Tn(null);
6652
+ kn(!0), Dn(null);
6625
6653
  },
6626
6654
  permissions: j
6627
6655
  }),
6628
- z.isActive && z.showCurtain && /* @__PURE__ */ P($t, {
6656
+ z.isActive && z.showCurtain && /* @__PURE__ */ P(en, {
6629
6657
  positionPercent: z.curtainPosition,
6630
6658
  onChangePosition: (e) => Qe((t) => ({
6631
6659
  ...t,
@@ -6636,31 +6664,31 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6636
6664
  Se !== !1 && Ce !== !1 && /* @__PURE__ */ P(Lt, {
6637
6665
  containerRef: N,
6638
6666
  onCopy: (e) => I.emit("action-text-copied", { text: e }),
6639
- onAnnotateSelection: Jn
6667
+ onAnnotateSelection: Xn
6640
6668
  })
6641
6669
  ]
6642
- })] }), z.isActive && /* @__PURE__ */ P(Qt, {
6670
+ })] }), z.isActive && /* @__PURE__ */ P($t, {
6643
6671
  isOpen: it,
6644
6672
  onClose: () => at(!1),
6645
6673
  diffItems: z.diffItems,
6646
6674
  textDiffs: $e,
6647
6675
  currentDiffIndex: z.currentDiffIndex,
6648
- onSelectDiff: (e, t) => en(e, t),
6649
- onJumpToPage: (e) => Gt(e)
6676
+ onSelectDiff: (e, t) => an(e, t),
6677
+ onJumpToPage: (e) => tn(e)
6650
6678
  })]
6651
6679
  })
6652
6680
  ]
6653
6681
  }),
6654
- En && Z && /* @__PURE__ */ P(ut, {
6655
- initialUrl: W.find((e) => e.id === Z)?.linkUrl || "",
6656
- initialText: W.find((e) => e.id === Z)?.text || "",
6657
- showTextInput: !W.find((e) => e.id === Z)?.width || W.find((e) => e.id === Z)?.text === "" || W.find((e) => e.id === Z)?.text !== void 0,
6682
+ On && Z && /* @__PURE__ */ P(ut, {
6683
+ initialUrl: U.find((e) => e.id === Z)?.linkUrl || "",
6684
+ initialText: U.find((e) => e.id === Z)?.text || "",
6685
+ showTextInput: !U.find((e) => e.id === Z)?.width || U.find((e) => e.id === Z)?.text === "" || U.find((e) => e.id === Z)?.text !== void 0,
6658
6686
  onClose: () => {
6659
- let e = W.find((e) => e.id === Z);
6660
- e && !e.linkUrl && Q(W.filter((e) => e.id !== Z)), Dn(!1), Cn(null);
6687
+ let e = U.find((e) => e.id === Z);
6688
+ e && !e.linkUrl && $(U.filter((e) => e.id !== Z)), kn(!1), Tn(null);
6661
6689
  },
6662
6690
  onSave: (e, t) => {
6663
- Q(W.map((n) => {
6691
+ $(U.map((n) => {
6664
6692
  if (n.id === Z) {
6665
6693
  let r = t === void 0 ? n.text : t, i = r ? Math.max(100, r.length * 8 + 20) : n.width;
6666
6694
  return {
@@ -6671,28 +6699,28 @@ function on({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
6671
6699
  };
6672
6700
  }
6673
6701
  return n;
6674
- })), Dn(!1), Cn(null);
6702
+ })), kn(!1), Tn(null);
6675
6703
  }
6676
6704
  }),
6677
6705
  _ && /* @__PURE__ */ P(Tt, {
6678
6706
  isOpen: r,
6679
6707
  activeTab: te,
6680
6708
  setActiveTab: ne,
6681
- annotations: W,
6682
- setAnnotations: Q,
6709
+ annotations: U,
6710
+ setAnnotations: $,
6683
6711
  selectedAnnotationId: Z,
6684
- setSelectedAnnotationId: Cn,
6685
- onSearch: rr,
6686
- searchResults: ir,
6687
- isSearching: ar,
6688
- searchProgress: or,
6689
- onResultClick: Jt,
6690
- onLinkClick: yr
6712
+ setSelectedAnnotationId: Tn,
6713
+ onSearch: ar,
6714
+ searchResults: or,
6715
+ isSearching: sr,
6716
+ searchProgress: cr,
6717
+ onResultClick: rn,
6718
+ onLinkClick: xr
6691
6719
  })
6692
6720
  ]
6693
6721
  });
6694
6722
  }
6695
- function q({ icon: e, active: t, onClick: n, label: r, disabled: i }) {
6723
+ function K({ icon: e, active: t, onClick: n, label: r, disabled: i }) {
6696
6724
  return /* @__PURE__ */ P("button", {
6697
6725
  onClick: i ? void 0 : n,
6698
6726
  title: r,
@@ -6720,7 +6748,7 @@ function q({ icon: e, active: t, onClick: n, label: r, disabled: i }) {
6720
6748
  children: e
6721
6749
  });
6722
6750
  }
6723
- function sn({ size: e = 16 }) {
6751
+ function cn({ size: e = 16 }) {
6724
6752
  return /* @__PURE__ */ F("svg", {
6725
6753
  width: e,
6726
6754
  height: e,
@@ -6735,7 +6763,7 @@ function sn({ size: e = 16 }) {
6735
6763
  }
6736
6764
  //#endregion
6737
6765
  //#region src/components/SettingsModal.tsx
6738
- function cn({ onClose: e, watermarkText: t, setWatermarkText: n }) {
6766
+ function ln({ onClose: e, watermarkText: t, setWatermarkText: n }) {
6739
6767
  let { shortcuts: r, updateShortcut: i, resetShortcuts: a } = _t(), [s, l] = c("Keyboard Shortcuts"), [u, d] = c(null), [f, p] = c(""), m = (e, t) => {
6740
6768
  if (e.preventDefault(), e.stopPropagation(), e.key === "Escape") {
6741
6769
  d(null);
@@ -7264,7 +7292,7 @@ function cn({ onClose: e, watermarkText: t, setWatermarkText: n }) {
7264
7292
  }
7265
7293
  //#endregion
7266
7294
  //#region src/components/AboutModal.tsx
7267
- function ln({ onClose: e }) {
7295
+ function un({ onClose: e }) {
7268
7296
  return /* @__PURE__ */ P("div", {
7269
7297
  style: {
7270
7298
  position: "fixed",
@@ -7485,7 +7513,7 @@ function ln({ onClose: e }) {
7485
7513
  }
7486
7514
  //#endregion
7487
7515
  //#region src/core/eventBus.ts
7488
- var un = class {
7516
+ var dn = class {
7489
7517
  listeners = /* @__PURE__ */ new Map();
7490
7518
  destroyed = !1;
7491
7519
  on(e, t) {
@@ -7527,21 +7555,21 @@ var un = class {
7527
7555
  get isDestroyed() {
7528
7556
  return this.destroyed;
7529
7557
  }
7530
- }, dn = (e) => e === 0 ? 0 : e;
7531
- function fn(e, t) {
7558
+ }, fn = (e) => e === 0 ? 0 : e;
7559
+ function pn(e, t) {
7532
7560
  return {
7533
- x: dn(e.x * t[0] + e.y * t[2] + t[4]),
7534
- y: dn(e.x * t[1] + e.y * t[3] + t[5])
7561
+ x: fn(e.x * t[0] + e.y * t[2] + t[4]),
7562
+ y: fn(e.x * t[1] + e.y * t[3] + t[5])
7535
7563
  };
7536
7564
  }
7537
- function pn(e, t) {
7565
+ function mn(e, t) {
7538
7566
  let n = t[0] * t[3] - t[1] * t[2];
7539
7567
  return {
7540
- x: dn((e.x * t[3] - e.y * t[2] + t[2] * t[5] - t[4] * t[3]) / n),
7541
- y: dn((-e.x * t[1] + e.y * t[0] + t[4] * t[1] - t[5] * t[0]) / n)
7568
+ x: fn((e.x * t[3] - e.y * t[2] + t[2] * t[5] - t[4] * t[3]) / n),
7569
+ y: fn((-e.x * t[1] + e.y * t[0] + t[4] * t[1] - t[5] * t[0]) / n)
7542
7570
  };
7543
7571
  }
7544
- function mn(e, t, n) {
7572
+ function hn(e, t, n) {
7545
7573
  let r = Mt(n), [i, a, o, s] = t, c = (o + i) / 2, l = (s + a) / 2, u, d, f, p;
7546
7574
  switch (r) {
7547
7575
  case 180:
@@ -7579,33 +7607,33 @@ function mn(e, t, n) {
7579
7607
  transform: v
7580
7608
  };
7581
7609
  }
7582
- function J(e) {
7610
+ function gn(e) {
7583
7611
  let t = e.view;
7584
- return mn(e.pageNumber, [
7612
+ return hn(e.pageNumber, [
7585
7613
  t[0],
7586
7614
  t[1],
7587
7615
  t[2],
7588
7616
  t[3]
7589
7617
  ], e.rotate);
7590
7618
  }
7591
- function hn(e) {
7619
+ function _n(e) {
7592
7620
  let t = /* @__PURE__ */ new Map();
7593
7621
  return (n) => {
7594
7622
  let r = Math.max(1, Math.min(e.numPages, n)), i = t.get(r);
7595
- return i || (i = e.getPage(r).then(J), t.set(r, i)), i;
7623
+ return i || (i = e.getPage(r).then(gn), t.set(r, i)), i;
7596
7624
  };
7597
7625
  }
7598
- function Y(e, t) {
7599
- return pn(t, e.transform);
7626
+ function q(e, t) {
7627
+ return mn(t, e.transform);
7600
7628
  }
7601
- function gn(e, t) {
7602
- return fn(t, e.transform);
7629
+ function vn(e, t) {
7630
+ return pn(t, e.transform);
7603
7631
  }
7604
- function _n(e, t) {
7605
- let n = Y(e, {
7632
+ function J(e, t) {
7633
+ let n = q(e, {
7606
7634
  x: t.x,
7607
7635
  y: t.y
7608
- }), r = Y(e, {
7636
+ }), r = q(e, {
7609
7637
  x: t.x + t.width,
7610
7638
  y: t.y + t.height
7611
7639
  });
@@ -7616,11 +7644,11 @@ function _n(e, t) {
7616
7644
  Math.max(n.y, r.y)
7617
7645
  ];
7618
7646
  }
7619
- function vn(e, t) {
7620
- let n = gn(e, {
7647
+ function yn(e, t) {
7648
+ let n = vn(e, {
7621
7649
  x: t[0],
7622
7650
  y: t[1]
7623
- }), r = gn(e, {
7651
+ }), r = vn(e, {
7624
7652
  x: t[2],
7625
7653
  y: t[3]
7626
7654
  });
@@ -7631,14 +7659,14 @@ function vn(e, t) {
7631
7659
  height: Math.abs(r.y - n.y)
7632
7660
  };
7633
7661
  }
7634
- function X(e, t) {
7635
- return t.map((t) => Y(e, t));
7662
+ function bn(e, t) {
7663
+ return t.map((t) => q(e, t));
7636
7664
  }
7637
- function yn(e, t) {
7638
- return t.map((t) => gn(e, t));
7665
+ function xn(e, t) {
7666
+ return t.map((t) => vn(e, t));
7639
7667
  }
7640
- function bn(e, t) {
7641
- let [n, r, i, a] = _n(e, t);
7668
+ function Y(e, t) {
7669
+ let [n, r, i, a] = J(e, t);
7642
7670
  return [
7643
7671
  n,
7644
7672
  a,
@@ -7650,7 +7678,7 @@ function bn(e, t) {
7650
7678
  r
7651
7679
  ];
7652
7680
  }
7653
- function xn(e, t) {
7681
+ function Sn(e, t) {
7654
7682
  let n = [];
7655
7683
  for (let r = 0; r + 7 < t.length; r += 8) {
7656
7684
  let i = [
@@ -7664,7 +7692,7 @@ function xn(e, t) {
7664
7692
  t[r + 5],
7665
7693
  t[r + 7]
7666
7694
  ];
7667
- n.push(vn(e, [
7695
+ n.push(yn(e, [
7668
7696
  Math.min(...i),
7669
7697
  Math.min(...a),
7670
7698
  Math.max(...i),
@@ -7673,7 +7701,7 @@ function xn(e, t) {
7673
7701
  }
7674
7702
  return n;
7675
7703
  }
7676
- function Sn(e) {
7704
+ function Cn(e) {
7677
7705
  if (e.length === 0) return {
7678
7706
  x: 0,
7679
7707
  y: 0,
@@ -7688,7 +7716,7 @@ function Sn(e) {
7688
7716
  height: i - n
7689
7717
  };
7690
7718
  }
7691
- var Z = (e) => (Math.round(e * 1e3) / 1e3).toString(), Cn = 524288e3, wn = (e) => {
7719
+ var X = (e) => (Math.round(e * 1e3) / 1e3).toString(), wn = 524288e3, Z = (e) => {
7692
7720
  let t = e && /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", n = parseInt(t.slice(1, 3), 16) / 255, r = parseInt(t.slice(3, 5), 16) / 255, i = parseInt(t.slice(5, 7), 16) / 255;
7693
7721
  return Ue(n, r, i);
7694
7722
  };
@@ -7706,12 +7734,12 @@ function Tn(e, t, n) {
7706
7734
  return o;
7707
7735
  }
7708
7736
  async function En(e, t, n, r, i) {
7709
- let a = wn(r.color), o = r.opacity ?? 1, s = r.strokeWidth || 1, [c, l, u, d] = _n(n, {
7737
+ let a = Z(r.color), o = r.opacity ?? 1, s = r.strokeWidth || 1, [c, l, u, d] = J(n, {
7710
7738
  x: r.x,
7711
7739
  y: r.y,
7712
7740
  width: r.width,
7713
7741
  height: r.height
7714
- }), f = u - c, p = d - l, m = He(n.rotate), h = (e, t, r) => Y(n, {
7742
+ }), f = u - c, p = d - l, m = He(n.rotate), h = (e, t, r) => q(n, {
7715
7743
  x: e,
7716
7744
  y: t + r
7717
7745
  });
@@ -7750,7 +7778,7 @@ async function En(e, t, n, r, i) {
7750
7778
  height: r.height
7751
7779
  }];
7752
7780
  for (let r of e) {
7753
- let [e, i, s, c] = _n(n, r);
7781
+ let [e, i, s, c] = J(n, r);
7754
7782
  t.drawRectangle({
7755
7783
  x: e,
7756
7784
  y: i,
@@ -7771,7 +7799,7 @@ async function En(e, t, n, r, i) {
7771
7799
  height: r.height
7772
7800
  }];
7773
7801
  for (let r of e) {
7774
- let [e, i] = X(n, [{
7802
+ let [e, i] = bn(n, [{
7775
7803
  x: r.x,
7776
7804
  y: r.y + r.height - 1.5
7777
7805
  }, {
@@ -7796,7 +7824,7 @@ async function En(e, t, n, r, i) {
7796
7824
  height: r.height
7797
7825
  }];
7798
7826
  for (let r of e) {
7799
- let [e, i] = X(n, [{
7827
+ let [e, i] = bn(n, [{
7800
7828
  x: r.x,
7801
7829
  y: r.y + r.height / 2
7802
7830
  }, {
@@ -7827,7 +7855,7 @@ async function En(e, t, n, r, i) {
7827
7855
  y: r.y + r.height - (i ? 3 : 1)
7828
7856
  }), i = !i;
7829
7857
  if (e.length >= 2) {
7830
- let r = X(n, e);
7858
+ let r = bn(n, e);
7831
7859
  for (let e = 1; e < r.length; e++) t.drawLine({
7832
7860
  start: r[e - 1],
7833
7861
  end: r[e],
@@ -7847,7 +7875,7 @@ async function En(e, t, n, r, i) {
7847
7875
  }, {
7848
7876
  x: r.x + r.width,
7849
7877
  y: r.y + r.height
7850
- }], [i, c] = X(n, [e[0], e[1]]);
7878
+ }], [i, c] = bn(n, [e[0], e[1]]);
7851
7879
  if (t.drawLine({
7852
7880
  start: i,
7853
7881
  end: c,
@@ -7855,7 +7883,7 @@ async function En(e, t, n, r, i) {
7855
7883
  opacity: o,
7856
7884
  thickness: s
7857
7885
  }), r.type === "arrow") {
7858
- let r = e[0], i = e[1], l = Math.atan2(i.y - r.y, i.x - r.x), u = 15 + s, [d, f] = X(n, [{
7886
+ let r = e[0], i = e[1], l = Math.atan2(i.y - r.y, i.x - r.x), u = 15 + s, [d, f] = bn(n, [{
7859
7887
  x: i.x - u * Math.cos(l - Math.PI / 6),
7860
7888
  y: i.y - u * Math.sin(l - Math.PI / 6)
7861
7889
  }, {
@@ -7881,7 +7909,7 @@ async function En(e, t, n, r, i) {
7881
7909
  case "freehand": {
7882
7910
  let e = r.strokes && r.strokes.length > 0 ? r.strokes : r.points ? [r.points] : [];
7883
7911
  for (let r of e) {
7884
- let e = X(n, r);
7912
+ let e = bn(n, r);
7885
7913
  for (let n = 1; n < e.length; n++) t.drawLine({
7886
7914
  start: e[n - 1],
7887
7915
  end: e[n],
@@ -7911,7 +7939,7 @@ async function En(e, t, n, r, i) {
7911
7939
  return;
7912
7940
  }
7913
7941
  case "note": {
7914
- let [e, i, c, l] = _n(n, {
7942
+ let [e, i, c, l] = J(n, {
7915
7943
  x: r.x,
7916
7944
  y: r.y,
7917
7945
  width: 24,
@@ -7945,7 +7973,7 @@ async function En(e, t, n, r, i) {
7945
7973
  }, {
7946
7974
  x: r.x,
7947
7975
  y: r.y
7948
- }], [i, c] = X(n, [e[0], e[1]]);
7976
+ }], [i, c] = bn(n, [e[0], e[1]]);
7949
7977
  if (t.drawLine({
7950
7978
  start: i,
7951
7979
  end: c,
@@ -7953,7 +7981,7 @@ async function En(e, t, n, r, i) {
7953
7981
  opacity: o,
7954
7982
  thickness: s
7955
7983
  }), r.text) {
7956
- let i = r.text.length * 8 + 20, [c, l, u, d] = _n(n, {
7984
+ let i = r.text.length * 8 + 20, [c, l, u, d] = J(n, {
7957
7985
  x: e[1].x,
7958
7986
  y: e[1].y,
7959
7987
  width: i,
@@ -8047,7 +8075,7 @@ async function En(e, t, n, r, i) {
8047
8075
  }
8048
8076
  }
8049
8077
  async function Dn(e, t) {
8050
- let n = wn(t.color || "#737373"), r = t.opacity ?? .08, i = await e.embedFont(Ve.Helvetica), a = -Math.PI / 4, o = Math.cos(a), s = Math.sin(a);
8078
+ let n = Z(t.color || "#737373"), r = t.opacity ?? .08, i = await e.embedFont(Ve.Helvetica), a = -Math.PI / 4, o = Math.cos(a), s = Math.sin(a);
8051
8079
  for (let a of e.getPages()) {
8052
8080
  let { width: e, height: c } = a.getSize();
8053
8081
  if (t.mode === "single") {
@@ -8081,7 +8109,7 @@ async function Dn(e, t) {
8081
8109
  async function On(e, t) {
8082
8110
  let n = await e.save(), r = Be.getDocument({
8083
8111
  data: n,
8084
- ...qt()
8112
+ ...Jt()
8085
8113
  }), i = await r.promise, a = await L.create();
8086
8114
  try {
8087
8115
  for (let n = 1; n <= i.numPages; n++) {
@@ -8128,8 +8156,8 @@ async function kn(e, t = {}) {
8128
8156
  let i = await L.load(r, { ignoreEncryption: !0 }), a = i.getPages(), o = t.explicitAnnotations || e.annotations, s = e.getPageGeometry, c = null;
8129
8157
  !s && o.length > 0 && (c = Be.getDocument({
8130
8158
  data: r.slice(),
8131
- ...qt()
8132
- }), s = hn(await c.promise));
8159
+ ...Jt()
8160
+ }), s = _n(await c.promise));
8133
8161
  try {
8134
8162
  for (let t of o) {
8135
8163
  let n = Math.max(0, Math.min((t.pageIndex || 1) - 1, a.length - 1)), r = await s(n + 1);
@@ -8166,13 +8194,13 @@ function Fn(e) {
8166
8194
  let f = Date.parse(`${n}-${r}-${i}T${a}:${o}:${s}${d}`);
8167
8195
  return Number.isNaN(f) ? void 0 : new Date(f).toISOString();
8168
8196
  }
8169
- var Q = (e) => {
8197
+ var In = (e) => {
8170
8198
  if (!(!e || e === "transparent")) {
8171
8199
  if (/^#[0-9a-f]{6}$/i.test(e)) return e.toUpperCase();
8172
8200
  if (/^#[0-9a-f]{3}$/i.test(e)) return `#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`.toUpperCase();
8173
8201
  }
8174
- }, $ = (e, t) => t == null || t === "" ? "" : ` ${e}="${Mn(String(t))}"`;
8175
- function In(e) {
8202
+ }, Q = (e, t) => t == null || t === "" ? "" : ` ${e}="${Mn(String(t))}"`;
8203
+ function $(e) {
8176
8204
  return `<trn-custom-data bytes="${Mn(JSON.stringify({ [jn]: e }))}"/>`;
8177
8205
  }
8178
8206
  function Ln(e) {
@@ -8186,7 +8214,7 @@ function Ln(e) {
8186
8214
  }
8187
8215
  }
8188
8216
  function Rn(e) {
8189
- return e.map((e) => `${Z(e.x)},${Z(e.y)}`).join(";");
8217
+ return e.map((e) => `${X(e.x)},${X(e.y)}`).join(";");
8190
8218
  }
8191
8219
  function zn(e) {
8192
8220
  return e ? e.split(";").map((e) => e.trim().split(/[,\s]+/).map(Number)).filter((e) => e.length >= 2 && e.every((e) => Number.isFinite(e))).map(([e, t]) => ({
@@ -8198,7 +8226,7 @@ function Bn(e) {
8198
8226
  return e ? e.split(/[,\s]+/).map(Number).filter((e) => Number.isFinite(e)) : [];
8199
8227
  }
8200
8228
  function Vn(e) {
8201
- return e.map(Z).join(",");
8229
+ return e.map(X).join(",");
8202
8230
  }
8203
8231
  var Hn = /* @__PURE__ */ new Set([
8204
8232
  "page",
@@ -8235,17 +8263,17 @@ var Hn = /* @__PURE__ */ new Set([
8235
8263
  "vertices"
8236
8264
  ]);
8237
8265
  function Wn(e, t, n, r) {
8238
- let i = r ?? _n(t, {
8266
+ let i = r ?? J(t, {
8239
8267
  x: e.x,
8240
8268
  y: e.y,
8241
8269
  width: e.width,
8242
8270
  height: e.height
8243
8271
  }), a = e.createdAt ?? (e.timestamp ? new Date(e.timestamp).toISOString() : void 0), o = ["print", ...e.readOnly ? ["readonly", "locked"] : []].join(",");
8244
- return $("page", e.pageIndex - 1) + $("rect", Vn(i)) + $("name", e.id) + (n ? $("title", e.author) : "") + $("date", Pn(e.modifiedAt ?? a)) + $("creationdate", Pn(a)) + $("flags", o) + $("opacity", e.opacity !== void 0 && e.opacity !== 1 ? Z(e.opacity) : void 0);
8272
+ return Q("page", e.pageIndex - 1) + Q("rect", Vn(i)) + Q("name", e.id) + (n ? Q("title", e.author) : "") + Q("date", Pn(e.modifiedAt ?? a)) + Q("creationdate", Pn(a)) + Q("flags", o) + Q("opacity", e.opacity !== void 0 && e.opacity !== 1 ? X(e.opacity) : void 0);
8245
8273
  }
8246
8274
  function Gn(e) {
8247
8275
  let t = e.xfdfExtras?.attrs;
8248
- return t ? Object.entries(t).filter(([e]) => !Hn.has(e)).map(([e, t]) => $(e, t)).join("") : "";
8276
+ return t ? Object.entries(t).filter(([e]) => !Hn.has(e)).map(([e, t]) => Q(e, t)).join("") : "";
8249
8277
  }
8250
8278
  function Kn(e) {
8251
8279
  return (e.xfdfExtras?.children ?? []).join("");
@@ -8255,15 +8283,15 @@ function qn(e, t = {}) {
8255
8283
  type: e.type,
8256
8284
  ...t
8257
8285
  };
8258
- return e.authorId && (n.authorId = e.authorId), e.strokeWidth !== void 0 && (n.strokeWidth = e.strokeWidth), In(n);
8286
+ return e.authorId && (n.authorId = e.authorId), e.strokeWidth !== void 0 && (n.strokeWidth = e.strokeWidth), $(n);
8259
8287
  }
8260
- var Jn = (e) => e ? `<contents>${Mn(e)}</contents>` : "", Yn = (e, t) => `<defaultstyle>font: Helvetica ${t}pt; text-align: left; color: ${Q(e.color) ?? "#000000"}</defaultstyle><defaultappearance>0 0 0 rg /Helv ${t} Tf</defaultappearance>`;
8288
+ var Jn = (e) => e ? `<contents>${Mn(e)}</contents>` : "", Yn = (e, t) => `<defaultstyle>font: Helvetica ${t}pt; text-align: left; color: ${In(e.color) ?? "#000000"}</defaultstyle><defaultappearance>0 0 0 rg /Helv ${t} Tf</defaultappearance>`;
8261
8289
  async function Xn(e, t, n = {}) {
8262
8290
  if (e.type === "opaque" && e.rawXfdf) return e.rawXfdf;
8263
- let r = await t(e.pageIndex), i = n.useDisplayAuthor !== !1, a = Q(e.color), o = $("color", a) + $("width", e.strokeWidth), s = (t) => Wn(e, r, i, t) + Gn(e), c = (t = {}) => qn(e, t) + Kn(e);
8291
+ let r = await t(e.pageIndex), i = n.useDisplayAuthor !== !1, a = In(e.color), o = Q("color", a) + Q("width", e.strokeWidth), s = (t) => Wn(e, r, i, t) + Gn(e), c = (t = {}) => qn(e, t) + Kn(e);
8264
8292
  switch (e.type) {
8265
- case "rectangle": return `<square${s()}${o}${$("interior-color", a)} subject="Rectangle">${c()}</square>`;
8266
- case "ellipse": return `<circle${s()}${o}${$("interior-color", a)} subject="Ellipse">${c()}</circle>`;
8293
+ case "rectangle": return `<square${s()}${o}${Q("interior-color", a)} subject="Rectangle">${c()}</square>`;
8294
+ case "ellipse": return `<circle${s()}${o}${Q("interior-color", a)} subject="Ellipse">${c()}</circle>`;
8267
8295
  case "line":
8268
8296
  case "arrow": {
8269
8297
  let t = e.points && e.points.length >= 2 ? e.points : [{
@@ -8272,17 +8300,17 @@ async function Xn(e, t, n = {}) {
8272
8300
  }, {
8273
8301
  x: e.x + e.width,
8274
8302
  y: e.y + e.height
8275
- }], [n, i] = X(r, [t[0], t[1]]), a = [
8303
+ }], [n, i] = bn(r, [t[0], t[1]]), a = [
8276
8304
  Math.min(n.x, i.x),
8277
8305
  Math.min(n.y, i.y),
8278
8306
  Math.max(n.x, i.x),
8279
8307
  Math.max(n.y, i.y)
8280
- ], l = e.type === "arrow" ? $("head", "OpenArrow") : "";
8281
- return `<line${s(a)}${o} start="${Z(n.x)},${Z(n.y)}" end="${Z(i.x)},${Z(i.y)}"${l} subject="${e.type === "arrow" ? "Arrow" : "Line"}">${c()}</line>`;
8308
+ ], l = e.type === "arrow" ? Q("head", "OpenArrow") : "";
8309
+ return `<line${s(a)}${o} start="${X(n.x)},${X(n.y)}" end="${X(i.x)},${X(i.y)}"${l} subject="${e.type === "arrow" ? "Arrow" : "Line"}">${c()}</line>`;
8282
8310
  }
8283
8311
  case "freehand": {
8284
- let t = e.strokes && e.strokes.length > 0 ? e.strokes : e.points ? [e.points] : [], n = t.map((e) => `<gesture>${Rn(X(r, e))}</gesture>`).join(""), i = t.flat();
8285
- return `<ink${s(i.length ? _n(r, Zn(i, e.strokeWidth)) : void 0)}${o} subject="Free Hand"><inklist>${n}</inklist>${c()}</ink>`;
8312
+ let t = e.strokes && e.strokes.length > 0 ? e.strokes : e.points ? [e.points] : [], n = t.map((e) => `<gesture>${Rn(bn(r, e))}</gesture>`).join(""), i = t.flat();
8313
+ return `<ink${s(i.length ? J(r, Zn(i, e.strokeWidth)) : void 0)}${o} subject="Free Hand"><inklist>${n}</inklist>${c()}</ink>`;
8286
8314
  }
8287
8315
  case "highlight":
8288
8316
  case "underline":
@@ -8293,10 +8321,10 @@ async function Xn(e, t, n = {}) {
8293
8321
  y: e.y,
8294
8322
  width: e.width,
8295
8323
  height: e.height
8296
- }], n = t.flatMap((e) => bn(r, e)).map(Z).join(","), i = _n(r, Sn(t)), o = e.type, l = e.type === "highlight" ? "Highlight" : e.type === "underline" ? "Underline" : e.type === "strikeout" ? "StrikeOut" : "Squiggly";
8297
- return `<${o}${s(i)}${$("color", a)} coords="${n}" subject="${l}">${c()}</${o}>`;
8324
+ }], n = t.flatMap((e) => Y(r, e)).map(X).join(","), i = J(r, Cn(t)), o = e.type, l = e.type === "highlight" ? "Highlight" : e.type === "underline" ? "Underline" : e.type === "strikeout" ? "StrikeOut" : "Squiggly";
8325
+ return `<${o}${s(i)}${Q("color", a)} coords="${n}" subject="${l}">${c()}</${o}>`;
8298
8326
  }
8299
- case "text": return `<freetext${s()}${$("color", a)} subject="Free Text">${Jn(e.text)}${Yn(e, 16)}${c()}</freetext>`;
8327
+ case "text": return `<freetext${s()}${Q("color", a)} subject="Free Text">${Jn(e.text)}${Yn(e, 16)}${c()}</freetext>`;
8300
8328
  case "callout": {
8301
8329
  let t = e.points && e.points.length >= 2 ? e.points : [{
8302
8330
  x: e.x,
@@ -8304,7 +8332,7 @@ async function Xn(e, t, n = {}) {
8304
8332
  }, {
8305
8333
  x: e.x,
8306
8334
  y: e.y
8307
- }], [n, i] = X(r, [t[0], t[1]]), a = _n(r, {
8335
+ }], [n, i] = bn(r, [t[0], t[1]]), a = J(r, {
8308
8336
  x: t[1].x,
8309
8337
  y: t[1].y,
8310
8338
  width: e.text ? e.text.length * 8 + 20 : 100,
@@ -8315,17 +8343,17 @@ async function Xn(e, t, n = {}) {
8315
8343
  Math.min(n.y, a[1]),
8316
8344
  Math.max(i.x, a[2]),
8317
8345
  Math.max(i.y, a[3])
8318
- ])}${o} IT="FreeTextCallout" callout="${Z(n.x)},${Z(n.y)},${Z(i.x)},${Z(i.y)}" subject="Callout">${Jn(e.text)}${Yn(e, 14)}${c({ box: a })}</freetext>`;
8346
+ ])}${o} IT="FreeTextCallout" callout="${X(n.x)},${X(n.y)},${X(i.x)},${X(i.y)}" subject="Callout">${Jn(e.text)}${Yn(e, 14)}${c({ box: a })}</freetext>`;
8319
8347
  }
8320
- case "note": return `<text${s(_n(r, {
8348
+ case "note": return `<text${s(J(r, {
8321
8349
  x: e.x,
8322
8350
  y: e.y,
8323
8351
  width: 24,
8324
8352
  height: 24
8325
- }))}${$("color", a)} icon="Comment" subject="Sticky Note">${Jn(e.text)}${c()}</text>`;
8353
+ }))}${Q("color", a)} icon="Comment" subject="Sticky Note">${Jn(e.text)}${c()}</text>`;
8326
8354
  case "link": {
8327
8355
  let t = e.linkUrl ?? "", n = t.startsWith("#page=") ? `<OnActivation><Action Trigger="U"><GoTo><Dest><Fit Page="${Math.max(0, (parseInt(t.slice(6), 10) || 1) - 1)}"/></Dest></GoTo></Action></OnActivation>` : t ? `<OnActivation><Action Trigger="U"><URI Name="${Mn(t)}"/></Action></OnActivation>` : "";
8328
- return `<link${s()}${$("color", a)} subject="Link">${n}${Jn(e.text)}${c()}</link>`;
8356
+ return `<link${s()}${Q("color", a)} subject="Link">${n}${Jn(e.text)}${c()}</link>`;
8329
8357
  }
8330
8358
  case "signature": return `<stamp${s()} subject="Signature">${e.imageUrl ? `<imagedata>${Mn(e.imageUrl)}</imagedata>` : ""}${c({
8331
8359
  signer: e.signer,
@@ -8375,7 +8403,7 @@ function er(e, t) {
8375
8403
  return Array.from(e.children).find((e) => e.localName === t)?.textContent ?? void 0;
8376
8404
  }
8377
8405
  function tr(e, t) {
8378
- let n = Bn(e.getAttribute("rect")), r = n.length === 4 ? vn(t, [
8406
+ let n = Bn(e.getAttribute("rect")), r = n.length === 4 ? yn(t, [
8379
8407
  n[0],
8380
8408
  n[1],
8381
8409
  n[2],
@@ -8385,7 +8413,7 @@ function tr(e, t) {
8385
8413
  y: 0,
8386
8414
  width: 0,
8387
8415
  height: 0
8388
- }, i = Ln(e), a = Q(e.getAttribute("color") || e.getAttribute("interior-color") || void 0) ?? "#000000", o = e.getAttribute("opacity"), s = o !== null && Number.isFinite(Number(o)) ? Number(o) : 1, c = e.getAttribute("width"), l = typeof i.strokeWidth == "number" ? i.strokeWidth : c !== null && Number.isFinite(Number(c)) ? Number(c) : 1, u = (e.getAttribute("flags") || "").toLowerCase(), d = u.includes("readonly") || u.includes("locked");
8416
+ }, i = Ln(e), a = In(e.getAttribute("color") || e.getAttribute("interior-color") || void 0) ?? "#000000", o = e.getAttribute("opacity"), s = o !== null && Number.isFinite(Number(o)) ? Number(o) : 1, c = e.getAttribute("width"), l = typeof i.strokeWidth == "number" ? i.strokeWidth : c !== null && Number.isFinite(Number(c)) ? Number(c) : 1, u = (e.getAttribute("flags") || "").toLowerCase(), d = u.includes("readonly") || u.includes("locked");
8389
8417
  return {
8390
8418
  id: e.getAttribute("name") || Ft(),
8391
8419
  pageIndex: (parseInt(e.getAttribute("page") || "0", 10) || 0) + 1,
@@ -8424,7 +8452,7 @@ function nr(e, t) {
8424
8452
  case "line": {
8425
8453
  let n = Bn(e.getAttribute("start")), r = Bn(e.getAttribute("end")), o = (e.getAttribute("head") || "None").toLowerCase(), s = (e.getAttribute("tail") || "None").toLowerCase();
8426
8454
  if (n.length < 2 || r.length < 2) return a();
8427
- let [c, l] = yn(t, [{
8455
+ let [c, l] = xn(t, [{
8428
8456
  x: n[0],
8429
8457
  y: n[1]
8430
8458
  }, {
@@ -8439,7 +8467,7 @@ function nr(e, t) {
8439
8467
  };
8440
8468
  }
8441
8469
  case "ink": {
8442
- let n = Array.from(e.getElementsByTagName("*")).filter((e) => e.localName === "gesture").map((e) => yn(t, zn(e.textContent))).filter((e) => e.length > 0);
8470
+ let n = Array.from(e.getElementsByTagName("*")).filter((e) => e.localName === "gesture").map((e) => xn(t, zn(e.textContent))).filter((e) => e.length > 0);
8443
8471
  if (n.length === 0) return a();
8444
8472
  let r = n.flat();
8445
8473
  return {
@@ -8454,12 +8482,12 @@ function nr(e, t) {
8454
8482
  case "underline":
8455
8483
  case "strikeout":
8456
8484
  case "squiggly": {
8457
- let r = Bn(e.getAttribute("coords")), a = r.length >= 8 ? xn(t, r) : [{
8485
+ let r = Bn(e.getAttribute("coords")), a = r.length >= 8 ? Sn(t, r) : [{
8458
8486
  x: i.x,
8459
8487
  y: i.y,
8460
8488
  width: i.width,
8461
8489
  height: i.height
8462
- }], o = Sn(a), s = n, c = s === "highlight" ? .5 : 1;
8490
+ }], o = Cn(a), s = n, c = s === "highlight" ? .5 : 1;
8463
8491
  return {
8464
8492
  ...i,
8465
8493
  ...o,
@@ -8471,7 +8499,7 @@ function nr(e, t) {
8471
8499
  case "freetext": {
8472
8500
  let n = er(e, "contents") ?? "", a = e.getAttribute("IT") || "", o = Bn(e.getAttribute("callout"));
8473
8501
  if (a === "FreeTextCallout" || r.type === "callout" || o.length >= 4) {
8474
- let e = o.length >= 4 ? yn(t, [{
8502
+ let e = o.length >= 4 ? xn(t, [{
8475
8503
  x: o[0],
8476
8504
  y: o[1]
8477
8505
  }, {
@@ -8584,7 +8612,7 @@ var ar = 100, or = () => (/* @__PURE__ */ new Date()).toISOString(), sr = class
8584
8612
  canEditOthers = !1;
8585
8613
  resolver = null;
8586
8614
  setDocument(e) {
8587
- this.resolver = e ? hn(e) : null;
8615
+ this.resolver = e ? _n(e) : null;
8588
8616
  }
8589
8617
  hasDocument() {
8590
8618
  return this.resolver !== null;
@@ -8976,7 +9004,7 @@ var ar = 100, or = () => (/* @__PURE__ */ new Date()).toISOString(), sr = class
8976
9004
  if (!e.ok) throw Error(`Failed to fetch document (${e.status})`);
8977
9005
  return e.arrayBuffer();
8978
9006
  },
8979
- getPageGeometry: n ? hn(n) : void 0,
9007
+ getPageGeometry: n ? _n(n) : void 0,
8980
9008
  annotations: this.annotationManager.getAnnotationsList(),
8981
9009
  redactions: t.getRedactions(),
8982
9010
  watermark: t.getWatermark(),
@@ -9079,7 +9107,7 @@ async function ur(e, t = {}) {
9079
9107
  var dr = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, fr = e.forwardRef(function(e, t) {
9080
9108
  let { fileUrl: r, initialDoc: l, initialScale: u, initialWidthRatio: d, widthRatio: f, responsive: p = !0, initialPage: m, page: h, transientHighlights: g, plugins: _, redactions: v, regexRedactions: y, enableAnnotations: b, enableSign: x = !1, watermark: S, permissions: C, enableRedactions: ee, canAddAnnotations: te, canEditAnnotations: ne, canDeleteAnnotations: re, readOnly: ie = !1, assets: ae, withCredentials: oe = !1, toolbar: se = !0, sidebars: ce = !0, leftPanelOpen: w = !0, className: le, style: ue, hideAnnotationsUntilPageRendered: de = !0, enableTextSelection: fe = !0, defaultTool: T = "select", showSelectionTooltip: pe = !0, id: me, targetViewer: E, resolveLinkUrl: he, onLinkClick: ge } = e, D = s(e);
9081
9109
  D.current = e;
9082
- let _e = s(null), O = o(() => new un(), []), k = o(() => new sr(), []), ve = s(null);
9110
+ let _e = s(null), O = o(() => new dn(), []), k = o(() => new sr(), []), ve = s(null);
9083
9111
  ve.current ||= new lr(O, k, me);
9084
9112
  let A = ve.current;
9085
9113
  a(t, () => A, [A]), i(() => {
@@ -9274,7 +9302,7 @@ var dr = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
9274
9302
  let t = Ye.current ?? "";
9275
9303
  if (!Ze.current) {
9276
9304
  Ze.current = !0;
9277
- let e = D.current.initialScale, t = D.current.initialWidthRatio ?? D.current.widthRatio ?? (typeof e == "object" && e && e.type === "fit-width" ? e.ratio : void 0);
9305
+ let e = D.current.initialScale ?? "fit-width", t = D.current.initialWidthRatio ?? D.current.widthRatio ?? (typeof e == "object" && e && e.type === "fit-width" ? e.ratio : void 0);
9278
9306
  typeof t == "number" && Number.isFinite(t) && t > 0 ? setTimeout(() => O.emit("action-fit-to-width", { ratio: t }), 0) : e === "fit-width" ? setTimeout(() => O.emit("action-fit-to-width"), 0) : e === "fit-page" && setTimeout(() => O.emit("action-fit-to-page"), 0);
9279
9307
  }
9280
9308
  O.emit("firstPageRendered", {
@@ -9434,7 +9462,7 @@ var dr = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
9434
9462
  minHeight: 0,
9435
9463
  overflow: "hidden"
9436
9464
  },
9437
- children: /* @__PURE__ */ P(on, {
9465
+ children: /* @__PURE__ */ P(sn, {
9438
9466
  leftSidebarOpen: ce && Te,
9439
9467
  rightSidebarOpen: ce && De,
9440
9468
  sidebarTab: ke,
@@ -9482,12 +9510,12 @@ var dr = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
9482
9510
  onLinkClick: ge
9483
9511
  })
9484
9512
  }),
9485
- Ne && /* @__PURE__ */ P(cn, {
9513
+ Ne && /* @__PURE__ */ P(ln, {
9486
9514
  onClose: () => Pe(!1),
9487
9515
  watermarkText: L,
9488
9516
  setWatermarkText: Ve
9489
9517
  }),
9490
- Fe && /* @__PURE__ */ P(ln, { onClose: () => Ie(!1) })
9518
+ Fe && /* @__PURE__ */ P(un, { onClose: () => Ie(!1) })
9491
9519
  ]
9492
9520
  })
9493
9521
  });
@@ -9511,6 +9539,6 @@ function pr(e, t) {
9511
9539
  }
9512
9540
  var mr = pr;
9513
9541
  //#endregion
9514
- export { sr as AnnotationManager, zt as DEFAULT_FALLBACK_DIMS, Cn as MAX_EXPORT_BYTES, qe as MAX_SCALE, Ke as MIN_SCALE, fr as TeamSyncViewer, Lt as TextSelectionTooltip, un as ViewerBus, mr as WebViewer, lr as WebViewerInstance, An as XFDF_NS, Xn as annotationToXfdfFragment, Qn as annotationsToXfdf, kn as buildPdfBytes, tt as calculateFitWidthScale, Qe as calculateNextZoomIn, $e as calculateNextZoomOut, rt as calculateScrollCompensation, et as clampScale, an as computeCanvasPixelDiff, tn as computePageDiffBoxes, Vt as computeRowLayout, nn as computeTextDiff, Ut as configurePdfAssets, It as copyTextToClipboard, hn as createGeometryResolver, mn as createPageGeometry, pr as createWebViewer, Bt as estimatePageDimensions, en as extractWordsFromPage, Fn as fromPdfDate, gn as fromPdfPoint, J as geometryFromPage, Wt as getPdfAssetPaths, Ht as hasDimensionMismatch, ct as isDocumentUrl, Gt as isWorkerConfigured, Ft as newAnnotationId, lt as parseLinkTarget, ir as parseXfdf, Jt as pdfjsVersion, ur as printPdfBytes, xn as quadPointsToRects, vn as rectFromPdf, _n as rectToPdf, bn as rectToQuadPoints, Ct as searchPdfText, rn as tintCanvas, Pn as toPdfDate, Y as toPdfPoint, wt as usePdfSearch };
9542
+ export { sr as AnnotationManager, zt as DEFAULT_FALLBACK_DIMS, wn as MAX_EXPORT_BYTES, qe as MAX_SCALE, Ke as MIN_SCALE, fr as TeamSyncViewer, Lt as TextSelectionTooltip, dn as ViewerBus, mr as WebViewer, lr as WebViewerInstance, An as XFDF_NS, Xn as annotationToXfdfFragment, Qn as annotationsToXfdf, kn as buildPdfBytes, tt as calculateFitWidthScale, Qe as calculateNextZoomIn, $e as calculateNextZoomOut, rt as calculateScrollCompensation, et as clampScale, G as computeCanvasPixelDiff, nn as computePageDiffBoxes, Vt as computeRowLayout, on as computeTextDiff, Wt as configurePdfAssets, It as copyTextToClipboard, _n as createGeometryResolver, hn as createPageGeometry, pr as createWebViewer, Bt as estimatePageDimensions, tn as extractWordsFromPage, Fn as fromPdfDate, vn as fromPdfPoint, gn as geometryFromPage, Gt as getPdfAssetPaths, Ht as hasDimensionMismatch, ct as isDocumentUrl, Kt as isWorkerConfigured, Ft as newAnnotationId, lt as parseLinkTarget, ir as parseXfdf, Yt as pdfjsVersion, ur as printPdfBytes, Sn as quadPointsToRects, yn as rectFromPdf, J as rectToPdf, Y as rectToQuadPoints, Ct as searchPdfText, W as tintCanvas, Pn as toPdfDate, q as toPdfPoint, wt as usePdfSearch };
9515
9543
 
9516
9544
  //# sourceMappingURL=teamsync-pdf-viewer.js.map